Skip to content

Commit 7d76736

Browse files
xuiocodex
andcommitted
Make Codex tasks feel native to Claude
Co-Authored-By: OpenAI Codex <noreply@openai.com>
1 parent f223d45 commit 7d76736

13 files changed

Lines changed: 577 additions & 246 deletions

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ Claude should use `codex_task`.
7070
Launch three Codex subagents in parallel: one for API behavior, one for tests, and one for security. Keep all of them read-only.
7171
```
7272

73-
Claude should use `codex_task_group` and split the work into independent tasks.
73+
Claude can call `codex_task` three times in parallel, or use `codex_task_group`
74+
when a single rolled-up response is useful.
7475

7576
### Use Spark
7677

@@ -88,7 +89,8 @@ Start a long-running Codex session on this repo, then let me send follow-up prom
8889

8990
Claude should use `codex_task` for the initial prompt, preserve the returned
9091
`session_id`, and use `codex_followup` to continue, steer, or wait on that same
91-
Codex context. For long first turns, Claude should set `background: true`.
92+
Codex context. For a completed first turn, Claude should set `keep_session: true`;
93+
for long first turns, Claude should set `background: true`.
9294

9395
## Safety Model
9496

@@ -133,7 +135,7 @@ writes and DNS/network remain disabled unless `full_access: true` is set.
133135
| --- | --- |
134136
| One read-only Codex task | `codex_task` |
135137
| Several independent tasks | `codex_task_group` |
136-
| Persistent context | `codex_task`, then `codex_followup` |
138+
| Persistent context | `codex_task` with `keep_session: true`, then `codex_followup` |
137139
| Long-running sessions | `codex_task` with `background: true`, then `codex_followup` |
138140
| Live steering | `codex_followup` with `mode: "steer"` |
139141
| Diagnostics | MCP resources `codex://status`, `codex://doctor`, `codex://usage` |

dist/index.js

Lines changed: 221 additions & 97 deletions
Large diffs are not rendered by default.

docs/ARCHITECTURE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ are not persisted.
6565
After an MCP runtime shutdown, app-server sessions with a Codex thread id are
6666
preserved as recoverable internally. The default Claude-facing flow is to keep the
6767
`session_id` returned by `codex_task` and use `codex_followup` while the MCP
68-
process is alive; hidden debug tools can inspect lower-level recovery state.
68+
process is alive. `codex_task` returns that id for `background: true`,
69+
`keep_session: true`, or failure cases; hidden debug tools can inspect
70+
lower-level recovery state.
6971

7072
Async one-shot jobs are process-local and do not survive MCP restarts. Their tool
7173
results advertise this limitation and recommend persistent sessions for recoverable

docs/RELEASE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Highlights:
88

99
- Default tool surface is now `codex_task`, `codex_task_group`, and
1010
`codex_followup`.
11-
- `codex_task` always returns a `session_id` for follow-up, wait, or steering.
11+
- `codex_task` now defaults to a lean answer-first payload; it returns a
12+
`session_id` for `background`, `keep_session`, or failure cases.
1213
- Power-user knobs moved under `advanced`; routine calls use `description`,
1314
`prompt`, `project_dir`, `reasoning`, `subagent_type`, and `full_access`.
1415
- Diagnostics are resources by default: `codex://usage`, `codex://status`, and

docs/USAGE.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Prefer these tools in normal Claude usage:
2727
- `codex_task` - one Task-like Codex subagent with an answer-first result.
2828
- `codex_task_group` - several independent Task-like Codex subagents in parallel.
2929
- `codex_followup` - continue, steer, or wait on the `session_id` returned by
30-
`codex_task` or `codex_task_group`.
30+
`codex_task` or `codex_task_group` when `background` or `keep_session` is used.
3131

3232
Legacy compatibility tools are hidden by default. Set
3333
`CODEX_SUBAGENTS_ENABLE_LEGACY_TOOLS=1` only for older clients that still call
@@ -39,6 +39,10 @@ Diagnostic resources are available without cluttering the tool picker:
3939
- `codex://status`
4040
- `codex://doctor`
4141

42+
Native tool responses are intentionally lean by default. For a single debugging
43+
call, set `advanced.include_diagnostics: true` to include cwd/model/sandbox,
44+
event summaries, command events, and compacted session state in the response.
45+
4246
Tool-callable diagnostics are hidden by default. Set
4347
`CODEX_SUBAGENTS_ENABLE_DEBUG_TOOLS=1` only when a client needs:
4448

@@ -55,8 +59,8 @@ Use this decision path when writing prompts or debugging Claude tool choice:
5559
| User intent | Best tool |
5660
| --- | --- |
5761
| One normal read-only second opinion | `codex_task` |
58-
| Two or more independent workstreams | `codex_task_group` |
59-
| Same Codex agent should keep context | `codex_task`, then `codex_followup` |
62+
| Two or more independent workstreams | Multiple parallel `codex_task` calls, or `codex_task_group` for one rolled-up response |
63+
| Same Codex agent should keep context | `codex_task` with `keep_session: true`, then `codex_followup` |
6064
| Long first turn, user wants to keep working | `codex_task` with `background: true` |
6165
| Add a normal follow-up to a running session | `codex_followup` with `mode: "queue"` |
6266
| Redirect the active app-server turn | `codex_followup` with `mode: "steer"` |
@@ -129,11 +133,12 @@ Use a persistent session when Codex should keep context across prompts.
129133
"description": "Investigate session manager",
130134
"prompt": "Investigate the session manager read-only. Keep a compact working map of the code.",
131135
"project_dir": "/path/to/project",
132-
"reasoning": "medium"
136+
"reasoning": "medium",
137+
"keep_session": true
133138
}
134139
```
135140

136-
`codex_task` returns a `session_id`. Then:
141+
`codex_task` returns a `session_id` when `keep_session` is true. Then:
137142

138143
```json
139144
{

docs/wiki/Release-Notes.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ Native Claude-facing tool surface:
88
- `codex_task_group`
99
- `codex_followup`
1010

11-
Every `codex_task` returns a `session_id`, diagnostics moved to resources, and
12-
debug/legacy tools are hidden unless explicitly enabled.
11+
`codex_task` defaults to a lean answer-first result, returns `session_id` only
12+
for `background`, `keep_session`, or failure cases, diagnostics moved to
13+
resources, and debug/legacy tools are hidden unless explicitly enabled.
1314

1415
## v0.2.0
1516

docs/wiki/Tool-Guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Use the intuitive front-door tools first.
55
| Task | Tool |
66
| --- | --- |
77
| One Codex task | `codex_task` |
8-
| Several independent tasks | `codex_task_group` |
9-
| Persistent session | `codex_task`, then `codex_followup` |
8+
| Several independent tasks | Multiple `codex_task` calls, or `codex_task_group` for one rollup |
9+
| Persistent session | `codex_task` with `keep_session: true`, then `codex_followup` |
1010
| Long-running session | `codex_task` with `background: true`, then `codex_followup` |
1111
| Live steering | `codex_followup` with `mode: "steer"` |
1212
| Diagnostics | Resources `codex://status`, `codex://doctor`, `codex://usage` |

0 commit comments

Comments
 (0)