Codex issue coordinator
Use one Codex thread to coordinate a GitHub issue batch. Give each active issue
its own worker thread, worktree, branch, and pull request. Workers hold
implementation context. GitHub holds dependency state.
Explicitly naming /codex-issue-coordinator, or explicitly telling the
coordinator that agents may merge, authorizes in-scope workers to merge their
own pull requests after every merge gate below passes. An implicit skill match
does not grant merge authority: run in no-merge mode unless the user's words
grant it.
Neither mode authorizes deployment, release publication, destructive
operations, branch-protection bypasses, or changes outside the supplied batch.
Preconditions
- Read the repository instructions, parent issue, native sub-issues, declared
dependencies, project board, issue state, and linked open or merged pull
requests. A merged pull request is only evidence of completion when it
closes or explicitly references the issue and its final change and proof
satisfy the issue scope. Reconcile that issue and project state instead of
dispatching it again. Do not infer completion from a link alone.
- Use Codex thread tools. If visible Codex threads and Codex-managed worktrees
are unavailable, stop. Do not replace workers with hidden subagents.
- Make every issue a complete task before dispatch. If a missing product or
technical decision could change behavior, data, security, compatibility,
operations, cost, or proof, mark that issue as needing human input.
- Build a dependency graph. Treat GitHub as the durable source of issue, pull
request, review, and merge state. Stop for human correction if the graph
contains a dependency cycle. Do not create a second local tracker.
- Default to two active workers. Use another limit only when the user asks or
the repository gives a stricter limit.
Coordinator workflow
- Keep the calling thread as coordinator. Name it
#<parent> Coordinator when
the batch has a parent issue. Use set_thread_pinned to pin it at the start
of every new or resumed coordinator run, before inspecting or dispatching
workers.
- Reuse an existing active worker for the same issue. Inspect an unclear or
interrupted worker before creating another. If the issue already has an
open pull request, create or resume its worker on that pull request's exact
head branch and include the branch and pull request URL in its prompt.
Otherwise create a Codex project thread in a managed worktree from the
latest remote default branch and include the required new branch name.
- Name every worker
#<issue-number> <short title>.
- Start only issues whose prerequisites are merged. Independent issues may
run together up to the worker limit. Do not stack dependent branches in
this workflow.
- Give the worker the full issue URL, dependency state, repository location,
resolved branch and pull request state, and the worker contract below. Tell
it to use
/task-to-pr and pass the coordinator's explicit merge or
no-merge mode. Merge mode grants authority only for that worker's issue.
- Monitor workers with compact
wait_threads snapshots. Use read_thread
only when a worker needs help. Send decisions or corrected scope back with
send_message_to_thread; do not edit the worker's files from the
coordinator.
- Continue independent work when one issue is blocked. After three failed
attempts at the same check or review finding, pause that issue, record the
evidence on GitHub, and request human input.
- In merge mode, when a worker reports completion, verify GitHub says the pull
request is merged, the issue contains final proof, and the issue is closed.
Close it explicitly if the merged pull request did not close it. Then mark
the issue Done when the project supports it and archive the worker thread.
In no-merge mode, stop that worker after its pull request passes all
agent-completable gates, leave the issue in Review, record any pending human
approval or merge as its blocker, and leave the thread available.
- Refresh the dependency graph after every merge and dispatch newly ready
issues from the updated remote default branch. In no-merge mode, when a
dependent issue is waiting only for a passing prerequisite pull request to
be merged, record that human-merge dependency as its blocker. Do not wait
indefinitely or dispatch the dependent from an unmerged branch.
- In merge mode, finish only when every in-scope issue is merged, closed, and
Done when the project supports that state, or every unfinished issue has a
recorded blocker that needs human action. In no-merge mode, finish when
every in-scope issue has a ready pull request with all agent-completable
gates passing or a recorded human blocker.
Worker contract
Each worker owns one issue and follows this order:
- Read the issue, repository instructions, relevant design, code, tests, and
dependency pull requests. Move the issue to In Progress when possible.
- Use the Codex-managed worktree. If the issue has an open pull request, reuse
its exact head branch and pull request. Otherwise create the repository's
required issue-linked branch from the updated default branch.
- Implement only the issue. Add or update tests for every acceptance
criterion, affected failure path, regression risk, and named edge case.
- Use
/test. Browser-facing work requires a real browser check of the
affected success and failure flows, responsive widths, keyboard behavior,
console errors, and failed requests when relevant.
- Commit and push the tested change. Open a draft pull request if one is not
already open. Include a short summary and current proof.
- Mark the pull request ready for review and move the issue to Review. Do this
before requesting independent review or waiting for GitHub review.
- Use
/review with a fresh subagent that did not implement the change. Wait
for required CI and automated review. In merge mode, also wait for every
repository-required approval. In no-merge mode, do not wait indefinitely
for human feedback; record a pending required approval as a human blocker.
- Address every valid in-scope finding. Reply to review threads with the fix
or evidence for making no change. Resolve a thread only when it is fully
addressed.
- After any code change, repeat affected
/test proof and fresh /review,
commit and push, update the pull request evidence, and wait for CI and
automated review again. Iterate until the mode's gates pass; do not
manufacture extra rounds or wait indefinitely for optional human feedback.
- In merge mode, merge the pull request using the repository's preferred
method after every merge gate passes. Never use an admin bypass. Wait until
GitHub reports the pull request as merged, record final proof, and verify
the issue is closed. Close it explicitly if the pull request did not. In
no-merge mode, leave the passing pull request open for a human to merge.
Report the final state to the coordinator.
Merge gates
A worker may merge only when all of these are true:
- The pull request is ready for review, not draft.
- The complete issue scope and acceptance criteria have recorded proof.
- Focused and required wider tests pass on the final commit.
- A fresh
/review verdict is Approve on the final code.
- Every required GitHub check passes.
- Every actionable automated or human review thread is resolved.
- Every repository-required approval is present.
- The pull request is mergeable and current with its required base.
- No security, data-loss, compatibility, operational, or product decision is
unresolved.
- The pull request changes only the worker's issue.
If a gate cannot pass, do not merge. Record the blocker and continue other
independent work.
Worker prompt
Use this shape and replace every placeholder:
Use /task-to-pr to complete <issue URL> in this Codex-managed worktree.
Your thread owns only this issue, branch, worktree, and pull request.
Branch state: <reuse PR head branch and PR URL, or create new branch name>.
Delivery mode: <merge after all gates pass, or leave the passing PR open>.
Read the issue and repository instructions as the source of truth.
Implement the smallest complete change and prove acceptance criteria, edge
cases, failure paths, and regressions.
After local proof passes, commit, push, open or update the pull request, and
mark it ready for review. Only then run fresh independent /review and wait for
CI and GitHub review. Address valid findings and repeat test and review after
every code change.
<If merge mode: The user explicitly authorized this /codex-issue-coordinator run to
merge this issue's pull request after every merge gate passes. Wait until
GitHub reports the merge, update and close the issue, and return the result.>
<If no-merge mode: Leave the passing pull request open for human merge and
return its URL and proof.>
Do not deploy, publish a release, bypass repository rules, or change unrelated
work.
Return
For each issue, report its worker, pull request, gate state, and blocker. State
which issues are complete and which need human action. Do not repeat worker
logs that do not change the result.
Boundaries
- Use visible Codex threads for workers. Fresh subagents are only for the
independent
/review inside a worker.
- Never dispatch two workers for one issue or let two workers share a worktree.
- Never replace or duplicate an existing pull request for the issue. Resume it.
- Reconcile already-merged pull requests and closed issues before dispatch,
but only after their change and proof satisfy the issue scope.
- Never start dependent work from an unmerged pull request in this workflow.
- Never merge an unrelated pull request merely because it blocks the batch.
- Never infer deployment or release authority from merge authority.
- Do not archive a worker until its merge and final issue state are verified.
1---2name: codex-issue-coordinator3description: Coordinates a large batch of GitHub issues through separate Codex worker threads, tested pull requests, review loops, and gated merges. Use when the user asks one Codex thread to manage several coding sessions or complete a parent issue, milestone, or issue batch.4---5
6# Codex issue coordinator
7
8Use one Codex thread to coordinate a GitHub issue batch. Give each active issue
9its own worker thread, worktree, branch, and pull request. Workers hold
10implementation context. GitHub holds dependency state.
11
12Explicitly naming `/codex-issue-coordinator`, or explicitly telling the
13coordinator that agents may merge, authorizes in-scope workers to merge their
14own pull requests after every merge gate below passes. An implicit skill match
15does not grant merge authority: run in no-merge mode unless the user's words
16grant it.
17Neither mode authorizes deployment, release publication, destructive
18operations, branch-protection bypasses, or changes outside the supplied batch.
19
20## Preconditions
21
221. Read the repository instructions, parent issue, native sub-issues, declared
23 dependencies, project board, issue state, and linked open or merged pull
24 requests. A merged pull request is only evidence of completion when it
25 closes or explicitly references the issue and its final change and proof
26 satisfy the issue scope. Reconcile that issue and project state instead of
27 dispatching it again. Do not infer completion from a link alone.
282. Use Codex thread tools. If visible Codex threads and Codex-managed worktrees
29 are unavailable, stop. Do not replace workers with hidden subagents.
303. Make every issue a complete task before dispatch. If a missing product or
31 technical decision could change behavior, data, security, compatibility,
32 operations, cost, or proof, mark that issue as needing human input.
334. Build a dependency graph. Treat GitHub as the durable source of issue, pull
34 request, review, and merge state. Stop for human correction if the graph
35 contains a dependency cycle. Do not create a second local tracker.
365. Default to two active workers. Use another limit only when the user asks or
37 the repository gives a stricter limit.
38
39## Coordinator workflow
40
411. Keep the calling thread as coordinator. Name it `#<parent> Coordinator` when
42 the batch has a parent issue. Use `set_thread_pinned` to pin it at the start
43 of every new or resumed coordinator run, before inspecting or dispatching
44 workers.
452. Reuse an existing active worker for the same issue. Inspect an unclear or
46 interrupted worker before creating another. If the issue already has an
47 open pull request, create or resume its worker on that pull request's exact
48 head branch and include the branch and pull request URL in its prompt.
49 Otherwise create a Codex project thread in a managed worktree from the
50 latest remote default branch and include the required new branch name.
513. Name every worker `#<issue-number> <short title>`.
524. Start only issues whose prerequisites are merged. Independent issues may
53 run together up to the worker limit. Do not stack dependent branches in
54 this workflow.
555. Give the worker the full issue URL, dependency state, repository location,
56 resolved branch and pull request state, and the worker contract below. Tell
57 it to use `/task-to-pr` and pass the coordinator's explicit merge or
58 no-merge mode. Merge mode grants authority only for that worker's issue.
596. Monitor workers with compact `wait_threads` snapshots. Use `read_thread`
60 only when a worker needs help. Send decisions or corrected scope back with
61 `send_message_to_thread`; do not edit the worker's files from the
62 coordinator.
637. Continue independent work when one issue is blocked. After three failed
64 attempts at the same check or review finding, pause that issue, record the
65 evidence on GitHub, and request human input.
668. In merge mode, when a worker reports completion, verify GitHub says the pull
67 request is merged, the issue contains final proof, and the issue is closed.
68 Close it explicitly if the merged pull request did not close it. Then mark
69 the issue Done when the project supports it and archive the worker thread.
70 In no-merge mode, stop that worker after its pull request passes all
71 agent-completable gates, leave the issue in Review, record any pending human
72 approval or merge as its blocker, and leave the thread available.
739. Refresh the dependency graph after every merge and dispatch newly ready
74 issues from the updated remote default branch. In no-merge mode, when a
75 dependent issue is waiting only for a passing prerequisite pull request to
76 be merged, record that human-merge dependency as its blocker. Do not wait
77 indefinitely or dispatch the dependent from an unmerged branch.
7810. In merge mode, finish only when every in-scope issue is merged, closed, and
79 Done when the project supports that state, or every unfinished issue has a
80 recorded blocker that needs human action. In no-merge mode, finish when
81 every in-scope issue has a ready pull request with all agent-completable
82 gates passing or a recorded human blocker.
83
84## Worker contract
85
86Each worker owns one issue and follows this order:
87
881. Read the issue, repository instructions, relevant design, code, tests, and
89 dependency pull requests. Move the issue to In Progress when possible.
902. Use the Codex-managed worktree. If the issue has an open pull request, reuse
91 its exact head branch and pull request. Otherwise create the repository's
92 required issue-linked branch from the updated default branch.
933. Implement only the issue. Add or update tests for every acceptance
94 criterion, affected failure path, regression risk, and named edge case.
954. Use `/test`. Browser-facing work requires a real browser check of the
96 affected success and failure flows, responsive widths, keyboard behavior,
97 console errors, and failed requests when relevant.
985. Commit and push the tested change. Open a draft pull request if one is not
99 already open. Include a short summary and current proof.
1006. Mark the pull request ready for review and move the issue to Review. Do this
101 before requesting independent review or waiting for GitHub review.
1027. Use `/review` with a fresh subagent that did not implement the change. Wait
103 for required CI and automated review. In merge mode, also wait for every
104 repository-required approval. In no-merge mode, do not wait indefinitely
105 for human feedback; record a pending required approval as a human blocker.
1068. Address every valid in-scope finding. Reply to review threads with the fix
107 or evidence for making no change. Resolve a thread only when it is fully
108 addressed.
1099. After any code change, repeat affected `/test` proof and fresh `/review`,
110 commit and push, update the pull request evidence, and wait for CI and
111 automated review again. Iterate until the mode's gates pass; do not
112 manufacture extra rounds or wait indefinitely for optional human feedback.
11310. In merge mode, merge the pull request using the repository's preferred
114 method after every merge gate passes. Never use an admin bypass. Wait until
115 GitHub reports the pull request as merged, record final proof, and verify
116 the issue is closed. Close it explicitly if the pull request did not. In
117 no-merge mode, leave the passing pull request open for a human to merge.
118 Report the final state to the coordinator.
119
120## Merge gates
121
122A worker may merge only when all of these are true:
123
124- The pull request is ready for review, not draft.
125- The complete issue scope and acceptance criteria have recorded proof.
126- Focused and required wider tests pass on the final commit.
127- A fresh `/review` verdict is `Approve` on the final code.
128- Every required GitHub check passes.
129- Every actionable automated or human review thread is resolved.
130- Every repository-required approval is present.
131- The pull request is mergeable and current with its required base.
132- No security, data-loss, compatibility, operational, or product decision is
133 unresolved.
134- The pull request changes only the worker's issue.
135
136If a gate cannot pass, do not merge. Record the blocker and continue other
137independent work.
138
139## Worker prompt
140
141Use this shape and replace every placeholder:
142
143```text
144Use /task-to-pr to complete <issue URL> in this Codex-managed worktree.
145
146Your thread owns only this issue, branch, worktree, and pull request.
147Branch state: <reuse PR head branch and PR URL, or create new branch name>.
148Delivery mode: <merge after all gates pass, or leave the passing PR open>.
149Read the issue and repository instructions as the source of truth.
150Implement the smallest complete change and prove acceptance criteria, edge
151cases, failure paths, and regressions.
152
153After local proof passes, commit, push, open or update the pull request, and
154mark it ready for review. Only then run fresh independent /review and wait for
155CI and GitHub review. Address valid findings and repeat test and review after
156every code change.
157
158<If merge mode: The user explicitly authorized this /codex-issue-coordinator run to
159merge this issue's pull request after every merge gate passes. Wait until
160GitHub reports the merge, update and close the issue, and return the result.>
161<If no-merge mode: Leave the passing pull request open for human merge and
162return its URL and proof.>
163Do not deploy, publish a release, bypass repository rules, or change unrelated
164work.
165```
166
167## Return
168
169For each issue, report its worker, pull request, gate state, and blocker. State
170which issues are complete and which need human action. Do not repeat worker
171logs that do not change the result.
172
173## Boundaries
174
175- Use visible Codex threads for workers. Fresh subagents are only for the
176 independent `/review` inside a worker.
177- Never dispatch two workers for one issue or let two workers share a worktree.
178- Never replace or duplicate an existing pull request for the issue. Resume it.
179- Reconcile already-merged pull requests and closed issues before dispatch,
180 but only after their change and proof satisfy the issue scope.
181- Never start dependent work from an unmerged pull request in this workflow.
182- Never merge an unrelated pull request merely because it blocks the batch.
183- Never infer deployment or release authority from merge authority.
184- Do not archive a worker until its merge and final issue state are verified.