CinvanaAI
← All projects

Tool · Models & evaluation / Code & architecture

Codex Judge Loop

Run a bounded coding-and-review cycle and retain each phase, including a stop before implementation.

Repository: CinvanaAI/codex-judge-loop

Recorded synthetic example. Source with a complete offline example.

See the idea in action.

The approved example records two commands and two judgments. The STOP variant omits implementation. Neither example launches Codex, edits a repository or calls a model.

Example input
Synthetic strategy events and explicit FOLLOW_STRATEGY or STOP judgments.
Captured result
{
  "mode": "synthetic boundaries; actual run_cycle coordinator",
  "status": "completed",
  "codex_commands": 2,
  "judge_calls": 2,
  "resume_target": "synthetic-demo-thread",
  "strategy_decision": "FOLLOW_STRATEGY",
  "implementation_decision": "STOP",
  "implementation_skipped": false,
  "stop_reason": null,
  "commands": [
    [
      "synthetic-codex",
      "exec",
      "--json",
      "--sandbox",
      "read-only",
      "Propose one check."
    ],
    [
      "synthetic-codex",
      "exec",
      "--json",
      "--sandbox",
      "workspace-write",
      "resume",
      "synthetic-demo-thread",
      "Implement the one approved empty-input check."
    ]
  ],
  "evidence": {
    "strategy": {
      "packet": {
        "phase": "strategy",
        "thread_id": "synthetic-demo-thread",
        "codex_exit_code": 0,
        "git_before_status": "",
        "git_after_status": "",
        "git_diff_stat": "",
        "git_changed_names": "",
        "event_counts": {
          "thread.started": 1,
          "item.completed": 1,
          "turn.completed": 1
        },
        "terminal_events": [
          {
            "type": "turn.completed"
          }
        ],
        "error_events": [],
        "text_candidates": [
          "Synthetic proposal: add one explicit empty-input check and verify it."
        ],
        "stdout_tail": "{\"type\": \"thread.started\", \"thread_id\": \"synthetic-demo-thread\"}\n{\"type\": \"item.completed\", \"item\": {\"type\": \"agent_message\", \"text\": \"Synthetic proposal: add one explicit empty-input check and verify it.\"}}\n{\"type\": \"turn.completed\"}",
        "stderr_tail": ""
      },
      "decision": {
        "decision": "FOLLOW_STRATEGY",
        "reason": "Synthetic reviewer accepts this single bounded step.",
        "confidence": 0.8,
        "risk_flags": [],
        "follow_prompt": "Implement the one approved empty-input check."
      }
    },
    "implementation": {
      "packet": {
        "phase": "implementation",
        "thread_id": "synthetic-demo-thread",
        "codex_exit_code": 0,
        "git_before_status": "",
        "git_after_status": "",
        "git_diff_stat": "",
        "git_changed_names": "",
        "event_counts": {
          "thread.started": 1,
          "item.completed": 1,
          "turn.completed": 1
        },
        "terminal_events": [
          {
            "type": "turn.completed"
          }
        ],
        "error_events": [],
        "text_candidates": [
          "Synthetic proposal: add one explicit empty-input check and verify it."
        ],
        "stdout_tail": "{\"type\": \"thread.started\", \"thread_id\": \"synthetic-demo-thread\"}\n{\"type\": \"item.completed\", \"item\": {\"type\": \"agent_message\", \"text\": \"Synthetic proposal: add one explicit empty-input check and verify it.\"}}\n{\"type\": \"turn.completed\"}",
        "stderr_tail": ""
      },
      "decision": {
        "decision": "STOP",
        "reason": "Synthetic reviewer accepts this single bounded step.",
        "confidence": 0.8,
        "risk_flags": [],
        "next_prompt": ""
      }
    }
  }
}

Try the example.

From the repository root, follow the dependency requirements in the README. This example uses supplied synthetic material.

python -m pip install -e .
python -m examples.offline_cycle
python -m examples.offline_cycle --stop

The approved example records two commands and two judgments. The STOP variant omits implementation. Neither example launches Codex, edits a repository or calls a model.

Complete setup and instructions ↗

The interesting part.

An independent judgment can gate a single next step without creating an infinite autonomous loop.

Focused extraction

Where it came from.

Working one-cycle Codex strategy/implementation probe with a separate judge.

Replaces the private architecture prompt and paths, adds explicit gates and captures phase evidence.

The origin does not establish it as an extraction from Governed Change Workbench or another public project.

Source ↗