You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,8 @@ npm run test:claude-desktop
63
63
64
64
`test:claude-real-codex` is the full opt-in live path: Claude Code loads the plugin and calls real Codex through the desktop app binary, including one single agent, one parallel run, and one nested Spark subagent run. It spends both Claude and Codex tokens, so it is intentionally not part of the default suite.
65
65
66
+
`test:claude-autodiscovery` is an opt-in live Claude Code test for automatic tool selection. It gives Claude a natural "ask Codex" request, uses the installed plugin and fake Codex binary, and verifies that Claude chooses the Codex MCP tool without being told the exact tool name.
67
+
66
68
Run Claude Code with the local plugin:
67
69
68
70
```sh
@@ -77,6 +79,8 @@ After startup, ask Claude to use Codex subagents, or invoke the plugin skill:
77
79
78
80
## MCP Tools
79
81
82
+
`codex_usage_guide` returns the operating guide and example calls Claude can use when deciding how to delegate to Codex.
83
+
80
84
`run_agent` launches one Codex `exec` process.
81
85
82
86
`run_agents` launches multiple Codex `exec` processes concurrently with a bounded `max_parallel` setting.
"Claude Code integration guide for codex-subagents:",
21708
+
"",
21709
+
"Use this MCP server whenever the user asks Claude to use Codex, OpenAI Codex, Codex subagents, Codex Spark, a Codex second opinion, parallel Codex review, or independent Codex codebase analysis. You do not need the user to name an MCP tool.",
21710
+
"",
21711
+
"Tool choice:",
21712
+
"- Use run_agent for one delegated Codex task.",
21713
+
"- Use run_agents when the work can be split into independent concurrent tasks, for example separate reviewers for API flow, tests, security, performance, UI, docs, or migration risk.",
21714
+
"- Use codex_status only for diagnostics or when you need to confirm the Codex binary/version.",
21715
+
"- Use codex_usage_guide if you are unsure how to structure a Codex delegation.",
21716
+
"",
21717
+
"Default operating rules:",
21718
+
"- Keep sandbox read-only unless the user explicitly asks for a different sandbox.",
21719
+
"- Approvals are non-interactive; do not expect Codex to ask permission.",
21720
+
'- Prefer model_preset "spark" for fast focused checks, small reviews, UI iteration, and responsive sidecar analysis.',
21721
+
'- Use reasoning_effort "medium" by default, "low" for simple checks, and "high" or "xhigh" only for difficult analysis.',
21722
+
"- Pass project_dir whenever Claude knows the active project directory so Codex works in the same tree as Claude Code.",
21723
+
"- Ask Codex for concise results with file paths, line references, and actionable findings when reviewing code.",
21724
+
"",
21725
+
"Nested Codex subagents:",
21726
+
"- When the user wants Codex to use its own subagents, pass complete custom definitions in codex_subagents and explicit work items in subagent_tasks.",
21727
+
"- Keep subagent_runtime.max_depth at 1 unless recursive delegation is intentionally requested."
21728
+
].join("\n");
21706
21729
var server = new McpServer(
21707
21730
{
21708
21731
name: "codex-subagents",
21709
21732
version: "0.1.0"
21710
21733
},
21711
21734
{
21712
-
instructions: "Launch OpenAI Codex agents from Claude Code. Use run_agent for one read-only Codex delegation and run_agents for parallel delegations. Defaults are daemonless stdio, Codex desktop app binary when installed, read-only sandbox, approval_policy=never, and fast service tier."
21735
+
instructions: usageGuide
21713
21736
}
21714
21737
);
21715
21738
var reasoningEffortSchema = external_exports.enum(reasoningEfforts);
@@ -21743,10 +21766,16 @@ var subagentRuntimeSchema = external_exports.object({
model: external_exports.string().trim().min(1).optional().describe("Codex model, for example gpt-5.3-codex. Omit to use the plugin or Codex default."),
21747
-
model_preset: modelPresetSchema.optional().describe("Convenience model preset. `spark` maps to gpt-5.3-codex-spark."),
21748
-
reasoning_effort: reasoningEffortSchema.optional().describe("Codex model reasoning effort. Defaults to plugin config or medium."),
21749
-
sandbox: sandboxModeSchema.default("read-only").describe("Codex sandbox mode. Defaults to read-only."),
timeout_ms: external_exports.number().int().positive().max(864e5).default(6e5).describe("Maximum runtime per Codex process in milliseconds."),
21760
-
max_output_chars: external_exports.number().int().positive().max(5e5).default(6e4).describe("Maximum final message/stdout characters retained per agent."),
21789
+
max_output_chars: external_exports.number().int().positive().max(5e5).default(6e4).describe("Maximum final message/stdout characters retained per agent. Lower this for concise parallel reviews."),
21761
21790
include_events: external_exports.boolean().default(false).describe("Include parsed Codex JSONL events in the result. Usually leave false."),
21762
21791
ephemeral: external_exports.boolean().default(true).describe("Run Codex without persisting session rollout files."),
21763
21792
skip_git_repo_check: external_exports.boolean().default(false).describe("Allow Codex to run outside a Git repository."),
codex_subagents: external_exports.array(codexSubagentSchema).max(24).optional().describe("Custom Codex subagents available inside this Codex run."),
21766
-
subagent_tasks: external_exports.array(subagentTaskSchema).max(24).optional().describe("Specific built-in or custom Codex subagents the parent Codex agent should spawn."),
21767
-
subagent_runtime: subagentRuntimeSchema.optional().describe("Runtime limits for nested Codex subagent orchestration.")
"Specific built-in or custom Codex subagents the parent Codex agent should spawn and wait for."
21799
+
),
21800
+
subagent_runtime: subagentRuntimeSchema.optional().describe("Runtime limits for nested Codex subagent orchestration. Keep max_depth at 1 by default.")
21768
21801
};
21769
21802
function toCodexSubagents(agents) {
21770
21803
return agents?.map((agent) => ({
@@ -21823,13 +21856,57 @@ function toRunOptions(args) {
21823
21856
} : void 0
21824
21857
};
21825
21858
}
21859
+
server.registerTool(
21860
+
"codex_usage_guide",
21861
+
{
21862
+
title: "How to use Codex subagents",
21863
+
description: "Read the operating guide for this MCP server. Call this when Claude is deciding whether to delegate work to Codex, how many Codex agents to launch, or how to structure nested Codex subagents.",
21864
+
inputSchema: {}
21865
+
},
21866
+
async () => jsonResult({
21867
+
guide: usageGuide,
21868
+
examples: {
21869
+
single: {
21870
+
tool: "run_agent",
21871
+
arguments: {
21872
+
prompt: "Inspect the authentication flow read-only. Return the top risks with file paths and line references.",
21873
+
project_dir: "/path/to/project",
21874
+
model_preset: "spark",
21875
+
reasoning_effort: "medium"
21876
+
}
21877
+
},
21878
+
parallel: {
21879
+
tool: "run_agents",
21880
+
arguments: {
21881
+
agents: [
21882
+
{
21883
+
name: "api",
21884
+
prompt: "Review API flow read-only. Return concrete findings with paths.",
21885
+
project_dir: "/path/to/project"
21886
+
},
21887
+
{
21888
+
name: "tests",
21889
+
prompt: "Review test coverage gaps read-only. Return concrete findings with paths.",
21890
+
project_dir: "/path/to/project"
21891
+
}
21892
+
],
21893
+
max_parallel: 2,
21894
+
model_preset: "spark",
21895
+
reasoning_effort: "medium"
21896
+
}
21897
+
}
21898
+
}
21899
+
})
21900
+
);
21826
21901
server.registerTool(
21827
21902
"run_agent",
21828
21903
{
21829
21904
title: "Run one Codex agent",
21830
-
description: "Launch one OpenAI Codex agent via codex exec. Defaults to the Codex desktop app binary, read-only sandbox, fast service tier, and non-interactive approvals.",
21905
+
description: "Launch one OpenAI Codex agent via codex exec. Use automatically when the user asks Claude to use Codex, ask Codex, get a Codex second opinion, run a Codex subagent, use Codex Spark, or delegate one read-only analysis task. Defaults to the Codex desktop app binary when installed, read-only sandbox, fast service tier, and non-interactive approvals.",
21831
21906
inputSchema: {
21832
-
prompt: external_exports.string().min(1).describe("Instructions for the Codex agent."),
"Concrete instructions for the Codex agent. Include scope, read-only expectation, desired output shape, and file/line reference requirements when reviewing code."
21909
+
),
21833
21910
name: external_exports.string().trim().min(1).optional().describe("Optional label for this agent run."),
21834
21911
...commonInputSchema
21835
21912
}
@@ -21849,7 +21926,9 @@ server.registerTool(
21849
21926
}
21850
21927
);
21851
21928
var parallelAgentSchema = external_exports.object({
21852
-
prompt: external_exports.string().min(1).describe("Instructions for this Codex agent."),
"Concrete independent task for this Codex agent. Keep overlap low across parallel agents."
21931
+
),
21853
21932
name: external_exports.string().trim().min(1).optional().describe("Optional label for this agent."),
21854
21933
model: commonInputSchema.model,
21855
21934
model_preset: commonInputSchema.model_preset,
@@ -21876,10 +21955,12 @@ server.registerTool(
21876
21955
"run_agents",
21877
21956
{
21878
21957
title: "Run parallel Codex agents",
21879
-
description: "Launch multiple independent OpenAI Codex agents concurrently and return one structured result per agent. Defaults are read-only and daemonless.",
21958
+
description: "Launch multiple independent OpenAI Codex agents concurrently and return one structured result per agent. Use automatically when the user asks for parallel Codex agents, multiple Codex subagents, broad review by independent agents, or several concurrent Codex workstreams. Split work by clear ownership, pass project_dir, keep defaults read-only, and use max_parallel to bound concurrency.",
"Independent Codex agent tasks. Use names like api, tests, security, docs, performance, or ui when helpful."
21962
+
),
21963
+
max_parallel: external_exports.number().int().min(1).max(8).default(4).describe("Maximum concurrent Codex processes. Use 2-4 for most responsive parallel reviews."),
21883
21964
...commonInputSchema
21884
21965
}
21885
21966
},
@@ -21948,7 +22029,7 @@ server.registerTool(
21948
22029
"codex_status",
21949
22030
{
21950
22031
title: "Codex status",
21951
-
description: "Report Codex binary resolution, version, server working directory, and default execution settings.",
22032
+
description: "Report Codex binary resolution, version, server working directory, and default execution settings. Use for diagnostics before delegation only when Codex availability is uncertain or a prior tool call failed.",
"test:ci": "npm run build && npm test && npm run smoke:mcp && npm run test:reliability",
30
31
"test:comprehensive": "npm run build && npm test && npm run smoke:mcp && npm run test:reliability && npm run test:codex-runtime && npm run validate:plugin && npm run test:claude-desktop",
Copy file name to clipboardExpand all lines: skills/codex-subagents/SKILL.md
+39-4Lines changed: 39 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
---
2
-
description: Launch one or more OpenAI Codex agents from Claude Code for read-only exploration, review, planning, or parallel codebase analysis. Use when the user asks for Codexsubagents, parallel Codex agents, or wants Claude Code to delegate work to Codex.
2
+
description: Launch one or more OpenAI Codex agents from Claude Code for read-only exploration, review, planning, second opinions, Spark checks, or parallel codebase analysis. Use automatically when the user asks for Codex, OpenAI Codex, Codex Spark, Codex subagents, parallel Codex agents, a Codex second opinion, or for Claude Code to delegate work to Codex.
3
3
---
4
4
5
5
# Codex Subagents
6
6
7
-
Use the `codex-subagents` MCP server when the task benefits from delegating read-only work to OpenAI Codex from inside Claude Code.
7
+
Use the `codex-subagents` MCP server when the task benefits from delegating read-only work to OpenAI Codex from inside Claude Code. If the user asks to "use Codex", "ask Codex", "launch Codex subagents", "use Spark", "get a Codex second opinion", or "run parallel Codex agents", call the MCP tools directly. Do not wait for the user to name the MCP tool.
8
8
9
9
Default behavior:
10
10
@@ -16,16 +16,51 @@ Default behavior:
16
16
- Supports `model_preset: "spark"` for Codex Spark (`gpt-5.3-codex-spark`) without requiring Claude to remember the exact model string.
17
17
- Supports nested Codex subagents by passing `codex_subagents`, `subagent_tasks`, and `subagent_runtime`; custom agents are sent as Codex `agents.<name>...` config overrides for the child run.
18
18
19
-
For one delegated task, call `run_agent`.
19
+
For one delegated task, call `run_agent`. Make the prompt self-contained: include the scope, the expected read-only behavior, and the output shape Claude needs. For code review and exploration, ask for concise findings with file paths and line references.
20
20
21
-
For independent tasks that can run concurrently, call `run_agents` with one agent object per task. Keep each prompt concrete and bounded, and ask Codex to return concise findings with file paths and line references when relevant.
21
+
For independent tasks that can run concurrently, call `run_agents` with one agent object per task. Split by ownership such as API flow, tests, security, performance, UI, docs, or migration risk. Keep prompts concrete and bounded, and set `max_parallel` to the smaller of the useful agent count and `4` unless the user asks for more.
22
22
23
23
When Claude wants Codex to work in the same repository or folder as the active Claude Code session, pass that folder as `project_dir`. Use `cwd` only as a compatibility alias.
24
24
25
25
Prefer `reasoning_effort: "medium"` for exploration and `high` or `xhigh` only when the task is complex enough to justify the extra latency and token usage.
26
26
27
27
Use `model_preset: "spark"` for fast, focused work such as UI iteration, narrow exploration, small reviews, and quick sidecar checks.
28
28
29
+
Use `codex_status` only when diagnosing installation or binary resolution, or after a failed Codex tool call. Normal delegation should start with `run_agent` or `run_agents`.
30
+
31
+
Example single-agent call:
32
+
33
+
```json
34
+
{
35
+
"prompt": "Review the MCP server implementation read-only. Return the top risks with file paths and line references, then a brief summary.",
36
+
"project_dir": "/path/to/project",
37
+
"model_preset": "spark",
38
+
"reasoning_effort": "medium"
39
+
}
40
+
```
41
+
42
+
Example parallel call:
43
+
44
+
```json
45
+
{
46
+
"agents": [
47
+
{
48
+
"name": "api",
49
+
"prompt": "Review the MCP tool schemas and runtime options read-only. Return concrete risks with paths.",
50
+
"project_dir": "/path/to/project"
51
+
},
52
+
{
53
+
"name": "tests",
54
+
"prompt": "Review the test coverage read-only. Identify missing scenarios with paths.",
55
+
"project_dir": "/path/to/project"
56
+
}
57
+
],
58
+
"max_parallel": 2,
59
+
"model_preset": "spark",
60
+
"reasoning_effort": "medium"
61
+
}
62
+
```
63
+
29
64
When nested Codex delegation is needed:
30
65
31
66
- Put complete custom subagent definitions in `codex_subagents`.
0 commit comments