A Codex skill that orchestrates an external implementer session with structured task packets, loop detection, and mandatory diff-review gates.
SaferSkills independently audited codex-dispatch (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Codex is the orchestrator. An external OpenCode session is the implementer. Codex must NOT perform the implementation itself unless the implementer hits an unrecoverable dead end and the user explicitly asks Codex to take over.
This skill coordinates two agents: Codex (the orchestrator, running in the main session) and an external OpenCode session (the implementer, model configured at deploy time). The implementer model identity is treated as a configuration detail — this skill refers to it generically as "the implementer" or "the OpenCode session."
The three reference files are part of the quality system and must be loaded on demand:
references/implementer-task-packet.md — Load before drafting any task packet.references/diff-review-checklist.md — Load before every post-task review.references/loop-detection-policy.md — Load when monitoring detects a potential loop.references/worked-example.md — Optional; load to see a complete end-to-end trace.Use this decision tree before dispatching:
| Tier | Criteria | Path |
|---|---|---|
| Lightweight | ≤1 file modified, ≤10 lines of net change, no new tests required, no structural changes | Skip loop detection. Use simplified diff review (scope + correctness + validation only). Simplified evidence report: files changed, validation ran, exit status. |
| Standard | Multi-file, new behavior, refactors, structural changes, new tests required | Full orchestration pipeline: task packet, preflight, monitoring, loop detection, full diff-review checklist, correction loop. |
When in doubt between tiers, default to Standard. Lightweight tasks that fail simplified review revert to the Standard path.
#### Lightweight simplified diff review (inline checklist)
For Lightweight tasks only, skip the full references/diff-review-checklist.md and apply this 5-item checklist instead:
If any item fails, the Lightweight path is voided and the task reverts to the Standard path with the full checklist.
Use this state model and do not skip states:
Packet drafted -> pre-dispatch quality gate -> session assigned -> implementation monitored -> completion evidence received -> diff review -> correction loop if needed -> accepted or escalated.
If the implementer stops before full completion (e.g., runs out of context, hits an environment error, produces only a partial diff), the state is partial completion. See the partial completion section below for the continuation path.
Load references/implementer-task-packet.md for the canonical packet format before drafting the first task.
At minimum, every packet must specify: goal, read/search scope, modify scope, constraints, expected output, and project context when useful.
Never give the implementer underspecified or ambiguous requests. The packet is the contract.
Before sending the task, Codex must verify the packet is:
If the packet fails this gate, revise it before dispatch. Do not use the implementer to clarify a vague assignment.
Run this health check sequence:
OK_PRECHECK_v1.0.0".If any preflight step fails (empty assistant output, no-op response, or malformed evidence), mark the session unhealthy and do not dispatch the commit packet.
Send the task packet to the implementer session assigned to the current commit-sized unit of work. Codex observes the output.
A commit-sized unit of work means the coherent set of changes intended to land together in one commit, whether or not git commit has already been run.
Session discipline:
Codex does not have a background thread or event loop, so monitoring works as follows:
references/loop-detection-policy.md for the full timing model.Load references/loop-detection-policy.md when a potential loop is detected. This skill does not duplicate loop signals or recovery procedures.
Key principle: loop timing starts from the first detected non-progress output batch, not from the first line of implementer reasoning. A self-recovery window of 3 consecutive non-progress batches is granted before intervention. Hard-failure signals (empty output, malformed responses, repeated structural corruption) bypass the window and trigger immediate intervention. See the reference file for the timestamp-based fallback.
Before Codex accepts that an implementer task is complete, the implementer must return a compact evidence report:
Claims without evidence are not sufficient for acceptance. The implementer must not claim validation passed if tests were skipped without a reported reason.
Load references/diff-review-checklist.md and apply it in full. Block acceptance until every item is checked. This skill does not duplicate the checklist.
The review must compare the diff against the task packet's acceptance contract: requested behavior, modify scope, "must not change" constraints, validation expectations, and completion evidence.
Findings are classified by severity: blocker, major, minor, note. Codex must distinguish pre-existing failures from failures introduced by the implementer.
If the review finds issues, Codex must prompt corrections in the same session that produced the original output. Do not start a new session for corrections unless the original session is completely unresponsive.
When corrections are requested, restate file invariants explicitly. Do not rely on incremental "fix just this line" prompts if file structure has already drifted.
The canonical correction prompt structure is defined in references/diff-review-checklist.md.
If the implementer produces output that covers only some phases of the task (e.g., inspected files but did not implement, or implemented but did not validate, or produced a partial diff), do not treat this as a correction loop. The problem is incompleteness, not incorrectness.
Partial completion handling:
If corrections are needed:
references/diff-review-checklist.md).Throughout the entire orchestration cycle, Codex must monitor for:
| Dimension | What to watch for |
|---|---|
| Output quality | Does the change meet the stated requirements? Are edge cases handled? |
| Correctness | Does the code compile / pass type checks / pass existing tests? |
| Efficiency | Is the solution reasonably efficient? No obvious N+1 queries, redundant passes, or wasted work? |
| Architectural consistency | Does the change follow the project's existing patterns, naming conventions, and module boundaries? |
| Bugs | Any off-by-one errors, null-pointer risks, race conditions, or logic flaws? |
| Overengineering | Has the implementer added unnecessary abstraction, unused code paths, or premature generalization? |
| Duplicated code / functions | Did the implementer reimplement something that already exists? Did it copy-paste instead of extracting shared logic? |
| Unrelated edits | Did the implementer modify files or regions that are unrelated to the task? |
| Maintainability risks | Are new dependencies introduced unnecessarily? Is the code harder to understand than what it replaced? |
| Scope discipline | Did the implementer stay within the approved read/search and modify scopes? |
| Evidence quality | Are completion and validation claims backed by exact commands, exit statuses, and relevant output? |
| Baseline awareness | Are failures identified as pre-existing or introduced by the implementer? |
If any dimension raises a flag, treat it as a review-gate failure and proceed to the correction loop.
Before dispatching the first task packet, run the project's test suite once to establish a baseline pass rate:
npm test, pytest, cargo test).This makes the diff-review requirement "distinguish pre-existing failures from failures introduced by the implementer" actually achievable. Without a baseline, pre-existing failures and implementer-introduced failures are indistinguishable.
If the test suite is already broken before dispatching, document this in the task packet's project context so the implementer knows not to expect a green baseline.
Codex must stop degraded orchestration early:
After abort:
When escalating, always provide a diagnosis. The escalation target is the human who triggered the orchestration. If the task was auto-dispatched, escalation means pausing and waiting for explicit human direction.
Do not escalate silently. State the issue, the diagnosis, and ask for direction. Example:
"The implementer is stuck on [task description]. I have intervened [N] times. Root cause appears to be [diagnosis]. Do you want me to take over implementation directly, rephrase the task, or try a fresh session?"
The implementer is responsible for running its own validation before reporting completion. The implementer must not outsource its required validation to Codex or the user unless it is truly blocked (e.g., missing credentials, environment not configured, permissions error). Codex may run independent verification when needed to audit claims, resolve uncertainty, or protect quality — but this does not excuse missing implementer validation.
The full validation ownership rules and the implementer-facing constraints are in references/implementer-task-packet.md. The diff-review checklist for auditing validation is in references/diff-review-checklist.md.
Codex should split orchestration into commit-sized units that can be reviewed, validated, and accepted independently.
Prefer:
For each commit-sized unit, Codex must keep one session as the authoritative implementation context. Corrections, validation reruns, and final evidence for that commit must stay in that session.
Each commit-sized unit must be split into explicit phases in the prompt. Phases should be ordered, bounded, and outcome-oriented, for example:
The phase split is a prompt-quality requirement, not permission to use multiple sessions. All phases for the same commit-sized unit remain in the same session.
Codex should maintain a compact orchestration log while supervising the implementer:
Example log entry (single task, accepted):
[2026-05-27 14:30] Orchestrator v1.0.0 | Task: add --verbose flag to CLI
[14:30] Baseline: 14/14 tests passing, lint clean, type-check clean
[14:31] Preflight: OK_PRECHECK_v1.0.0 passed, health confirmed
[14:32] Dispatched packet: src/cli/main.ts, src/cli/types.ts, tests/cli/main.test.ts
[14:33] Batch 1: inspected src/cli/main.ts, src/cli/types.ts, src/logger/index.ts — on-topic
[14:34] Batch 2: implemented --verbose flag, added test — within scope, pattern-matched
[14:35] Batch 3: vitest run 2/2, tsc clean — no issues
[14:36] Completion evidence: 3 files changed, 2 tests passed, type-check clean
[14:37] Diff review: PASS — scope: ok, validation: ok, correctness: ok, structural: ok
[14:37] ACCEPTEDCodex should orchestrate efficiently. Prefer:
Quality has priority over speed. Do not skip diff review, validation review, architectural checks, or correction loops just to save tokens. Implementer-facing efficiency instructions live in references/implementer-task-packet.md.
The reference files are part of the quality system. If a required reference file cannot be loaded, Codex must not proceed casually.
Fallback behavior:
references/implementer-task-packet.md is unavailable: create a minimal packet containing goal, read/search scope, modify scope, constraints, acceptance criteria, validation expectations, expected output (files changed, commands run, exit statuses, evidence), and "must not change" items. Include the implementer-owned validation rules: do not outsource validation, report exact commands and exit statuses, distinguish focused/broad/lint/skipped.references/diff-review-checklist.md is unavailable: apply the quality monitoring dimensions table in this skill and block acceptance on unresolved blocker or major findings.references/loop-detection-policy.md is unavailable: apply the loop timing principle (T=0 starts from first non-progress output batch, 3 consecutive non-progress batch self-recovery window, hard-failure signals trigger immediate intervention) described in this skill.references/implementer-task-packet.md — Canonical task-packet format, constraints, and validation ownership rules.references/diff-review-checklist.md — Step-by-step post-task review procedure, correction prompt structure, and severity taxonomy.references/loop-detection-policy.md — Full loop-detection definition, timing model, and recovery rules.references/worked-example.md — Complete end-to-end orchestration trace.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.