Skip to content

Support first-class per-thread skill/plugin selection in app-server thread/start #30967

Open

Description

@jyokotori

What variant of Codex are you using?

CLI

What feature would you like to see?

Support first-class per-thread skill/plugin selection in app-server thread/start

Summary

App-server hosts that run multiple independent Codex agent sessions need a way to choose different skill/plugin sets for each thread/start request without mutating the user's global/project config.toml and without running each agent type under a separate CODEX_HOME.

Current main has useful partial mechanisms, but none provide positive per-thread selection of installed plugins/skills by logical identity, nor a clear replace/restrict mode for the user's existing capability set.

Checked against local main at beca198b8a (telemetry: log structured direct tool-call timing (#30334)).

Why this matters

Some hosts launch many Codex sessions for different task types:

  • a code-review agent with review-only skills/plugins
  • a planning agent with project-management integrations
  • a support/debugging agent with log or incident-response integrations
  • an internal automation agent with only a narrow allowlist of tools

The host should be able to start each thread with the intended capabilities. It should not need to rewrite a user's config.toml, ask the user to toggle plugins globally, or create one synthetic CODEX_HOME per agent type just to isolate plugin/skill loading.

Current mechanisms and gaps

thread/start.selectedCapabilityRoots

selectedCapabilityRoots is an experimental field for environment-owned capability roots. The current shape is SelectedCapabilityRoot { id, location }, and CapabilityRootLocation only has Environment { environmentId, path }. The roots are stored in thread extension data and SessionMeta; current code preserves them across resume/fork and copies them for spawned child threads. The README now documents the basic behavior for environment-owned plugin or standalone-skill roots.

This is useful, but it is still path/root based and additive. The host must know an environment-native absolute path, there is no local-only or installed-capability locator, and there is no way to reference an installed plugin by marketplace/plugin ID or a skill by logical name. It also cannot replace or restrict the user-config-derived skill/plugin set.

thread/start.config

thread/start.config is loaded as a ConfigLayerSource::SessionFlags layer. That gives hosts some per-thread control:

  • features.plugins = false disables all plugin loading for that thread.
  • [mcp_servers.*] can add or override MCP servers for that thread.
  • [[skills.config]] name/path rules can disable specific skills for that thread, because skill_config_rules_from_stack reads SessionFlags.

The plugin path is asymmetric: [plugins.*] state from SessionFlags is ignored because configured_plugins_from_stack goes through project_effective_user_config() and effective_user_config(), which only merge ConfigLayerSource::User layers. Project .codex/config.toml does not provide a project-scoped plugin profile either; it can disable all plugins with features.plugins=false, but it cannot replace the user's enabled plugin set. Skill roots have a similar limitation for adding new roots: they are derived from system/user/project config folders, and SessionFlags has no config folder.

Other related fields

thread/start.environments can make environment-owned selected roots available or unavailable, but it is not a selector for user-installed skills/plugins. thread/start.dynamic_tools adds host-defined tools for one thread, but does not restrict existing skills/plugins. permissions selects permission profiles, not skill/plugin capability sets. ThreadSettingsUpdateParams can update runtime settings after start, but cannot alter the thread's capability selection.

Combined, a host can currently turn all plugins off, add ad-hoc MCP servers, and selectively disable named skills. It cannot positively select or replace a per-thread set of installed skills/plugins by logical identity.

Request

Please either document/stabilize the existing mechanisms as the intended app-server answer for per-thread skill/plugin selection, or add a first-class thread/start API for selecting capabilities by logical identity.

Option A: Clarify or extend selectedCapabilityRoots

I've been waiting for an official surface for this kind of per-thread capability selection. Seeing selectedCapabilityRoots was encouraging, but its current shape seems focused on environment-owned roots rather than the installed skill/plugin selection use case described here.

If selectedCapabilityRoots is intended to become the official per-thread capability-selection surface, it would help to:

  • add a local or installed-capability locator, so hosts do not have to express every root as an environment path
  • clarify that today's behavior is additive, and add a mode that can restrict/replace the user-config-derived skill/plugin set
  • support referencing installed plugins/skills by logical ID instead of only absolute paths
  • document lifecycle behavior for resume/fork/spawn, trust/ownership/policy validation, and the experimental-gate stability plan

If selectedCapabilityRoots is only meant for environment-owned capability paths, please document that boundary explicitly so hosts do not treat it as a general capability profile API.

Option B: Add logical per-thread capability selection

For installed plugins/skills, a higher-level request field could select by logical IDs or named profiles:

{
  "method": "thread/start",
  "params": {
    "capabilitySelection": {
      "mode": "replace",
      "plugins": ["github@openai", "linear@internal"],
      "skills": ["repo-review", "incident-debugging"],
      "mcpServers": ["github", "linear"]
    }
  }
}

This would let the app-server host choose a capability profile per agent session while Codex still owns installation lookup, policy checks, config precedence, and environment resolution.

This is the direction I am currently implementing locally because mutating config.toml cannot safely support concurrent agents with different capability sets. It would be much better for app-server to expose this as a native, documented contract.

Option C: Extend SessionFlags to cover [plugins.*]

A narrower fix would be to let configured_plugins_from_stack include the SessionFlags layer for [plugins.*] enable/disable state, similar to how skill_config_rules_from_stack already handles SessionFlags. Then a host could pass [plugins.foo] enabled = false per thread the same way it can disable skills today.

Desired behavior

An app-server host can start two threads against the same Codex server and same user CODEX_HOME, but with different effective capability sets:

  1. thread/start for agent A enables/selects only review-related skills/plugins.
  2. thread/start for agent B enables/selects only planning-related skills/plugins.
  3. The selection is persisted with the thread and preserved across resume/fork/spawn according to documented rules.
  4. The user's global installed/enabled plugin state is not mutated.
  5. The host does not need to create one CODEX_HOME per agent type.

Related issues

These look adjacent but not exact duplicates:

This issue is specifically about app-server thread/start choosing different skill/plugin capability sets per new agent thread.

Additional information

No response

Activity

  1. added
    enhancement
    on Jul 3, 2026
  2. added
    CLI
    app-server
    skills
    on Jul 3, 2026
  3. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    Potential duplicates detected. Please review them and close your issue if it is a duplicate.

    Powered by Codex Action

  4. jyokotori commented on Jul 3, 2026

    @jyokotori
    Author

    Thanks for flagging #30913. I agree it is related, but not a strict duplicate: it is about Desktop thread-profile UX, while this issue is about the lower-level app-server thread/start API for per-thread skill/plugin/MCP selection.

    This matters especially for enterprise workflows where different threads may need isolated capability descriptions and instructions rather than one globally enabled plugin set.

  5. ifBars commented on Aug 16, 2026

    @ifBars

    +1, I’d really like to see this supported. On the Windows desktop app, opening or resuming a task can start another instance of every configured and plugin-provided MCP. With 10–20 MCPs, that can add several GB of memory per task.

    A per-task allowlist could make a huge difference for desktop performance. This feels pretty necessary as the plugin ecosystem grows.

  6. Slimzeo commented on Sep 3, 2026

    @Slimzeo

    I have been working on a narrower first slice of this request: per-thread model-visible Skill catalog selection, without trying to select or replace the complete plugin/MCP capability set.

    The host-facing shape is:

    {
      "method": "thread/skillCatalog/set",
      "params": {
        "threadId": "...",
        "visibility": { "type": "allowList", "names": ["review", "incident-debugging"] }
      }
    }

    with { "type": "native" } restoring ordinary provider visibility.

    The intent is a host/plugin integration that binds a thread to a user-selected Skill Environment. The host decides which already-discovered native skills are automatically model-visible for that thread; Codex still owns discovery, source authority, permission checks, and Skill body loading. Explicit user selection remains allowed, so this is catalog/context selection rather than disabling the underlying skill.

    I have a local prototype patch with app-server v2 protocol types, step-scoped visibility snapshots, and integration coverage. The prototype filters the thread context catalog, world-state catalogs, and model-facing skill list/read tools consistently within one model step. It also keeps the authorization receipt for an explicitly read hidden skill in sidecar metadata across compaction, so visibility changes do not turn a previously authorized explicit read into a false denial after history reconstruction.

    It is not a public PR yet. Before preparing one, I would appreciate maintainer feedback on whether this narrow native | allowList experimental API is a useful first stage for #30967, or whether it should be folded into a broader capability-selection design. I can split the patch down to the agreed boundary and target the preferred branch/API surface.

  7. lcoeli commented on Sep 18, 2026

    @lcoeli

    A concrete embedding case for this request needs capability selection to take effect before host-skill discovery, including thread/start initialization. Filtering the model-visible catalog after discovery is useful, but does not satisfy this additional requirement.

    Retained observation

    Official Windows x64 Codex 0.154.0, executable SHA-256 be96b992178b1e467c225800da0d65f2c86d5eba1ef0b14632f65db381cbdfde; source revision 6b9826e3aa83b1a5947db50f4332cb9c65f1b340.

    A metadata-only App Server process used a newly created private CODEX_HOME, a private task cwd outside repositories, an explicit clean child environment, skills.include_instructions=false, bundled/orchestrator skills disabled, and thread/start.environments=[]. Its only requests were initialize and thread/start, with the initialized notification between them. No skills/list, turn/start, auth operation, setup or sandbox command was sent.

    A synthetic skill under the actual user's .agents/skills deliberately omitted description:

    ---
    name: no-host-discovery-canary
    ---
    SYNTHETIC_DIAGNOSTIC_CANARY
    

    After thread/start, the captured diagnostic was:

    codex_core::session::session: failed to load skill <ACTUAL_USER_PROFILE>/.agents/skills/<OWNED_CANARY>/SKILL.md: missing field `description`
    

    The thread started successfully and the process exited with code 0. This content-dependent parser error shows host-driven skill-file reading during initialization. It does not prove model-visible skill exposure, a model-invoked filesystem tool, credential access or a sandbox escape. No model ran. The observed fixture layout also contained an inert valid global skill and an inert valid private-home skill; omitting those controls has not been live-tested as a further minimization.

    Protocol-level reproduction

    Use a disposable Windows test-user context and the exact executable above. Create the diagnostic skill in the actual user profile, and fresh private home/task directories outside repositories. Keep the real user profile distinct from CODEX_HOME. No login or auth-state copy was needed in the retained run.

    Clear the child environment and set only SystemRoot, actual USERPROFILE, an account name resolved from process TokenUser as USERNAME, the new CODEX_HOME, CODEX_INTERNAL_APP_SERVER_REMOTE_CONTROL_DISABLED=1, and DOTNET_EnableDiagnostics=0. Append each setting below as its own pair of argument-vector entries (-c, complete TOML assignment), followed by app-server --listen stdio://; preserve TOML quotes instead of shell-concatenating the command.

    Exact retained configuration (50 entries; not a certified empty tool registry)
    forced_login_method="chatgpt"
    cli_auth_credentials_store="file"
    approval_policy="never"
    windows.sandbox="unelevated"
    web_search="disabled"
    mcp_servers={}
    skills.bundled.enabled=false
    skills.include_instructions=false
    orchestrator.skills.enabled=false
    orchestrator.mcp.enabled=false
    project_doc_max_bytes=0
    include_environment_context=false
    history.persistence="none"
    tools.update_plan.enabled=false
    tools.experimental_request_user_input.enabled=false
    memories.use_memories=false
    features.shell_tool=false
    features.view_image=false
    features.unified_exec=false
    features.code_mode=false
    features.code_mode_host=false
    features.code_mode_prewarm=false
    features.code_mode_only=false
    features.shell_snapshot=false
    features.shell_snapshot_v2=false
    features.apps=false
    features.enable_mcp_apps=false
    features.plugins=false
    features.remote_plugin=false
    features.recommended_plugins=false
    features.hooks=false
    features.plugin_hooks=false
    features.browser_use=false
    features.browser_use_external=false
    features.in_app_browser=false
    features.computer_use=false
    features.image_generation=false
    features.multi_agent=false
    features.multi_agent_v2=false
    features.web_search_request=false
    features.web_search_cached=false
    features.standalone_web_search=false
    features.memory_tool=false
    features.goals=false
    features.token_budget=false
    features.sleep_tool=false
    features.current_time_reminder=false
    features.deferred_executor=false
    features.skill_search=false
    features.executor_capability_discovery=false

    Redirect stdin/stdout/stderr, drain both outputs concurrently, bound request time/output, and reject server-originated requests. Send these JSONL messages in order, waiting for successful initialize response ID 1 before initialized, and for thread-start response ID 2 before shutdown. Substitute the private task path with JSON serialization:

    {"id":1,"method":"initialize","params":{"clientInfo":{"name":"host_skill_discovery_repro","title":"Host skill discovery metadata reproduction","version":"1.0"},"capabilities":{"experimentalApi":true}}}
    {"method":"initialized"}
    {"id":2,"method":"thread/start","params":{"model":"gpt-5.6-sol","modelProvider":"openai","cwd":"<NEW_PRIVATE_TASK_DIRECTORY_OUTSIDE_REPOSITORIES>","approvalPolicy":"never","ephemeral":true,"environments":[]}}

    experimentalApi=true is needed to negotiate the pinned thread/start.environments field. No other experimental request field is used. Capture stderr at the thread-start boundary, then close stdin and await exit. Do not send an inventory request or model turn. Remove only the exact owned canary files after hash verification and process exit.

    The protocol/configuration above was reconstructed from retained receipts for this report, not executed again as a new standalone reproduction. The original launcher additionally used a one-process Windows Job. All original canaries were removed after the observation.

    Why the inspected controls do not stop this read

    At the pinned revision:

    • App Server extensions install a host skill provider unconditionally.
    • The skill contributor then requires host discovery. Session warmup loads the host snapshot; even the inspected skip-discovery guard requires that no extension demand it. The under-development skip flag was not enabled in the observed run.
    • Host roots use the actual user home and local filesystem independently of an execution environment.
    • Host outcome construction loads roots before disabled-name/path rules are applied.

    The official skill documentation describes global discovery and per-skill disablement. This report does not assume those controls promise to prevent discovery I/O. Likewise, empty execution environments should not be assumed to disable independent host providers.

    Requested contract

    Is there a supported App Server mechanism to select no host skill discovery or invocation before initialization, across all skill roots, while retaining trusted broker protocol/authentication operation? If none exists, could this capability-selection work include that explicit opt-out?

    Useful acceptance criteria would be: no skill-root enumeration/file reads in the opted-out profile; no skill catalogs, implicit/explicit injection or skill tool authority; stable behavior across start/resume/fork/turn and concurrent profiles; newly added user/admin/configured roots remain excluded without enumerating their names; and failure before any model turn when the requested restriction cannot be honored. Trusted runtime/config/auth I/O is a separate boundary, not a demand for zero process file reads.

    This extends the already-discovered catalog projection discussed in #42440. The required no-discovery mode is an embedding constraint, not a claim of a regression against a documented current guarantee. An authoritative supported configuration or exact supported release reference would let us evaluate this without source patches or mutation of users' global skill state.

  8. YourWildDad commented on Oct 21, 2026

    @YourWildDad

    Additional integration evidence from Dreamux, while evaluating the shared app-server daemon.

    Our current provider launches one private app-server per agent and supplies that agent's additional role/custom skill directories through skills/extraRoots/set. With one shared process, the most recent setter request from any connection replaces the process-wide extra-root vector and changes what every connection's skills/list returns. The initialize handshake itself does not change roots.

    Scope clarification: source review indicates that alpha.8 already has an additive per-thread local-root mechanism through selectedCapabilityRoots. This comment asks for confirmation/documentation of the intended migration path and its lifecycle differences; it is not a claim that per-thread local roots are unavailable.

    Observed on: codex-cli 0.164.0-alpha.8, Linux x86_64, Node.js 22.16.0, two WebSocket connections to one app-server over a Unix socket. This probe uses a fresh temporary CODEX_HOME, synthetic skills outside the workspace, and no model turns. It launches app-server directly to isolate the shared-process behavior; it does not exercise daemon installation, updates, or remote control.

    Minimal protocol reproduction

    Create two extra roots with valid skill files:

    <scratch>/roots-a/probe-a/SKILL.md
    <scratch>/roots-b/probe-b/SKILL.md
    

    For example, the first file contains:

    ---
    name: probe-a
    description: Synthetic scope probe a
    ---
    Synthetic probe.

    Use probe-b / Synthetic scope probe b in the other file. Start one server with a fresh Codex home and a separate empty workspace:

    codex app-server --listen unix://<scratch>/app-server.sock \
      -c 'approval_policy="never"' -c 'sandbox_mode="read-only"'

    Set CODEX_HOME to the fresh directory for that process. Connect clients A and B to the same socket. On each connection, send initialize with clientInfo and capabilities.experimentalApi=true, await its response, then send initialized.

    Run these requests sequentially, awaiting each response:

    A: skills/extraRoots/set {"extraRoots":["<scratch>/roots-a"]}
    A: skills/list {"cwds":["<scratch>/workspace"],"forceReload":true}
    B: skills/extraRoots/set {"extraRoots":["<scratch>/roots-b"]}
    A: skills/list {"cwds":["<scratch>/workspace"],"forceReload":true}
    B: skills/list {"cwds":["<scratch>/workspace"],"forceReload":true}
    

    Actual output, filtering returned skill names to the synthetic probe- prefix:

    A after A sets roots: ["probe-a"]
    A after B sets roots: ["probe-b"]
    B after B sets roots: ["probe-b"]
    

    This agrees with the implementation: the RPC handler writes to the shared skills service, whose setter replaces the extra-root vector and clears its cache. The probe establishes process-level discovery behavior; it does not measure what an already-running model turn sees.

    Requested guidance

    Our immediate requirement is additive per-thread local host skill roots: preserve normal user/project skills, add role A's roots only to thread A, and role B's roots only to thread B, including when both threads use the same workspace. This concerns skill discovery and model context; both agents run under the same OS user.

    The existing executor-skills tests exercise selected roots with a local execution environment and verify model-visible skill content. Is this experimental thread/start field the intended replacement for the additive local-host use case?

    {
      "selectedCapabilityRoots": [
        {
          "id": "agent-role-a",
          "location": {
            "type": "environment",
            "environmentId": "local",
            "path": "<local-root-path-uri>"
          }
        }
      ]
    }

    A documented local-host example would help clarify the root layout and these lifecycle differences we found in source:

    • The app-server skills/list RPC lists host skills, not the selected-root catalog.
    • Resume restores the persisted selected roots, but thread/resume and thread/settings/update do not expose a selected-root replacement field.
    • Selected-root contents are discovered for turns, but these roots are not registered with the host skill watcher for skillsChanged notifications.

    Are these the intended integration contracts for shared app-server clients? We have inspected the relevant upstream tests but have not run those tests or a model-turn probe ourselves.

    The broader per-thread catalog projection in #42440 is related, but our immediate use case does not require replacing or filtering the user's native skill catalog. We would like to reuse the intended upstream primitive rather than add another host-managed skill mechanism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CLIapp-serverenhancementskills

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions