- codex-run.sh review: CLI forbids scope flags + prompt (stdin '-' counts as [PROMPT]); translate scope into prompt text, native review only when prompt.md is empty. Add --skip-git-repo-check for consistency. - agents/codex.md: marker contract (=== TASK FOR CODEX === / === END TASK ===, legacy RU markers accepted) so wrapper instructions never leak into the codex prompt and the wrapper never mistakes the task for its own job; self-check against doing the task itself; preamble now states codex is a subagent executor and process flows belong to the orchestrator; scope flags as separate args; no nohup; Read before rewriting prompt.md. - skills: wrapper framing line + marker block in prompt templates. - All instructions and README translated to English (RU trigger phrases kept in skill descriptions). - tests: 3 new review-mode cases, ALL PASS. - bump 0.1.2.
50 lines
2.2 KiB
Markdown
50 lines
2.2 KiB
Markdown
---
|
|
name: codex-agent
|
|
description: Delegate execution to Codex — write code, fix a bug, research. Use when user says «отдай кодексу», «пусть codex сделает/напишет/починит», «делегируй в codex», "delegate to codex", or when a plan step is assigned to Codex as the implementer.
|
|
---
|
|
|
|
# Delegating a task to Codex
|
|
|
|
Spawn the `codex` subagent (Agent tool). It keeps a live codex session:
|
|
refinements and answers to its questions go via SendMessage to the same
|
|
agent, NOT a new spawn.
|
|
|
|
## Subagent prompt — required parts
|
|
|
|
- First line — framing for the wrapper: "You are a wrapper around the codex
|
|
CLI: do not solve the task yourself, launch codex and return its answer +
|
|
thread_id". Without it the wrapper may take the task as its own and do it
|
|
instead of codex.
|
|
- `cwd: <absolute project path>`
|
|
- The task — in a block between markers `=== TASK FOR CODEX ===` and
|
|
`=== END TASK ===`: the wrapper forwards only this block to codex, so your
|
|
wrapper instructions don't leak into the prompt. Inside the block:
|
|
- Task: what to do. Concrete, with relevant files/paths.
|
|
- Acceptance criteria: what must work, which tests/commands must pass.
|
|
- What to return: report, list of touched files, how verified.
|
|
- Optional: `codex options: -m o3 -s read-only ...`
|
|
|
|
## Example
|
|
|
|
```
|
|
You are a wrapper around the codex CLI: do not solve the task yourself, launch codex and return its answer + thread_id.
|
|
cwd: /abs/path/to/project
|
|
=== TASK FOR CODEX ===
|
|
Task: fix the N+1 in GET /orders — the queries log shows one query per order
|
|
line item. See app/controllers/OrdersController.php.
|
|
Acceptance: existing tests pass (composer test), ≤3 DB queries per request.
|
|
Return: list of changed files, the essence of the fix, composer test output.
|
|
=== END TASK ===
|
|
```
|
|
|
|
## After completion
|
|
|
|
- Codex answer = report + `thread_id: ...`. Don't take it on faith: check
|
|
the diff, run the tests yourself.
|
|
- Remarks → SendMessage to the same subagent (same codex session, context
|
|
intact).
|
|
- Codex ended with a question (blocker) → answer via SendMessage, it
|
|
continues.
|
|
- While it's working you can ask for status via SendMessage — doesn't
|
|
interrupt.
|