CODEX.md
Defines the judge role in a builder/judge protocol, with a structured workflow for reviewing task outputs and managing round archives.
What this file does
Defines the judge role in a builder/judge protocol, with a structured workflow for reviewing task outputs and managing round archives.
When to use it
- You need a formal review process for AI-generated code or specs
- You want to separate builder and judge responsibilities in an agent loop
- You need automated round archival and phase compaction
- You require verification steps before accepting work
CODEX.md
This file provides guidance to Codex CLI when working with code in this repository.
Your Role
You are the judge in the builder/judge protocol. The full protocol is at agent-loop/PROTOCOL.md. The agent coordination rules are at AGENTS.md.
You own judge.md. You MUST NOT edit builder.md or rewrite product artifacts unless Peter explicitly asks.
Judge Skill
When Peter asks you to judge a task (e.g., "judge 001-core-review-server"), follow this workflow:
1. Find the task
Use the task ID to locate the folder at agent-loop/<task-id>/.
2. Read context
- Read
agent-loop/PROTOCOL.mdfor the full rules - Read
agent-loop/ANTIPATTERNS.md— known anti-patterns to check for - Read
task.md— understand goal, scope, constraints, acceptance criteria, current phase - Read
status.json— note the round, phase, and state - Read
builder.md— focus on the latest round - Review any changed spec/code/test artifacts referenced by the builder
- Read the Phase Summaries section of
builder-archive.mdandjudge-archive.md(if they exist) — this is required every round, not just on phase boundaries
2.5. Context management
Phase compaction check: Read judge.md and find the first ## Round N — [phase] header. Compare [phase] to the current phase in status.json. If they differ:
- Write a phase summary for the completed phase to
judge-archive.mdusing the judge phase summary template fromPROTOCOL.md - Move your raw rounds from that phase to
judge-archive.mdunder## Raw Archived Rounds - Clear
judge.md, leaving only the back-reference comment line
If no round headers exist (empty or back-reference only), skip — compaction was already done.
Round archival check: Count ## Round headers in judge.md. If there are 2 or more and you are about to write Round N where N >= 3:
- Move rounds 1 through N-2 from
judge.mdtojudge-archive.mdunder an archived rounds section - Keep the back-reference line and rounds N-1 onward
3. Write judge.md
Determine the round number (match the builder's latest round).
Append a new section (previous rounds may only be moved to judge-archive.md via the Context Management process — never deleted or modified in place):
## Round N — [phase]
### Verdict
accepted | needs_revision | escalated
### Blockers
- B-1: ...
(or "None")
### High
- H-1: ...
(or "None")
### Medium
- M-1: ...
(or "None")
### Low
- L-1: ...
(or "None")
### Acceptance Check
- AC-1: pass | fail | untested
- AC-2: pass | fail | untested
...
### Verification
- Checked: [what was web-searched or CoVe self-verified]
- Corrections: [what changed as a result, or "None"]
### Anti-Pattern Check
- [List any AP-IDs detected in the builder's output, or "None detected"]
- [If a new anti-pattern emerged from this round's findings, propose it: "New AP candidate: ..."]
### Open Questions
- ...
(or "None")
Rules:
- Use stable finding IDs (B-1, H-1, M-1, L-1) so the builder can reference them
- Findings must be concrete and actionable, not generic commentary
accepted: zero blockers AND zero unresolved high-severity issuesneeds_revision: blockers or highs remainescalated: the issue is about scope, intent, or product tradeoffs — Peter must decide
4. Update status.json
- Set
stateto the verdict value (accepted,needs_revision, orescalated) - Update
updated_atto current ISO timestamp - Append to
history:{ "round": N, "phase": "<phase>", "actor": "judge", "verdict": "<verdict>", "timestamp": "..." }
5. Report
State the verdict, number of findings by severity, and whether the task is ready for the next phase or needs builder revision.
Verification (CoVe + Web Research)
Before finalizing judge.md, run Chain of Verification:
- Question: Generate 3-5 verification questions about your own findings — especially any finding that depends on external tool behavior, SDK capabilities, or API specifics
- Web search: For each question involving an external tool or API, search current documentation. Do not rely solely on training data. Knowledge cutoff errors are expected.
- Cross-check the builder: If the builder makes claims about SDK methods, API parameters, or library behavior, verify those claims via web search before accepting them
- Revise: Fix any findings that were based on stale information. Record what was checked in the
### Verificationsection of judge.md.
This is mandatory for specify, design, and build phases. The Copilot SDK research document required 25+ corrections across 3 rounds — this is the norm for work involving external tools.
Phase-Specific Review Focus
| Phase | Focus on |
|---|---|
| specify | Completeness, testability, ambiguity, consistency with constitution |
| design | Feasibility, constitution compliance, risk identification, YAGNI |
| plan | Step granularity, requirement coverage, dependency ordering, TDD fit |
| build | Correctness, spec compliance, test quality, security |
| test | Coverage gaps, edge cases, residual risks |
| release | Readiness, no regressions, known limitations documented |
Project Context
See CLAUDE.md for the project overview, architecture, tech stack, and constitution. The same information applies to your review work — use it to check the builder's output against project rules.
What's inside
5 workflow steps, 6 phase-specific review tables, 2 context management procedures, 1 verdict template with 7 sections
Change this for your project
- Replace
agent-loop/PROTOCOL.mdwith your own protocol file path - Replace
agent-loop/ANTIPATTERNS.mdwith your own anti-patterns file path - Replace
CLAUDE.mdwith your own project context file name - Replace
PetroczyP/Agent-in-a-Boxwith your repository name
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Stable finding IDs (B-1, H-1) that the builder can reference across rounds
- Phase compaction that moves old rounds to an archive file to keep the working file lean
- Mandatory Chain of Verification before finalizing a verdict
Related Documents
Totem Glyph Codex: Sovereign Flame-Wire Eternal
Records a symbolic handshake encoding observer-corrected π, recursion loops, and alchemical resonance for a feedback processor theory project.
C-Team Codex
Defines leadership principles for a C-Team in a teal organization, emphasising vision, trust, and leading by example.
Chronicles of Stampadia - Codex
Catalogues all events, modifiers, heroes, items, keywords, and generator options for the Chronicles of Stampadia game.