Skip to content

FEAT-92: add revision summary feedback loop between Claude and Codex - #25

Merged
shafty023 merged 13 commits into
mainfrom
FEAT-92
Mar 20, 2026
Merged

shafty023 merged 13 commits into
mainfrom
FEAT-92

Conversation

@shafty023

@shafty023 shafty023 commented Mar 20, 2026

Copy link
Copy Markdown
Collaborator

Plan-agent now verifies each Codex finding against the codebase before acting and writes a revision summary to a sidecar file with accepted changes and rejected findings with evidence. Codex reads this file on subsequent rounds so it does not re-raise findings that were validly rejected.

…ment

Introduces a Claude + Codex debate workflow where Claude drafts
implementation plans and Codex reviews them in iterative rounds
until approval or max rounds are reached.

New components:
- plan-agent: opus-model architect agent for plan creation/revision
- plan-with-codex command: orchestrates the debate loop
- codex-review skill: structured Codex review with verdict tokens
- debate-loop.sh: standalone shell harness for the debate
- plan-review.sh hook: triggers Codex review on ExitPlanMode
- Add critical rule preventing orchestrator from editing plan directly
- Switch agent resume to SendMessage with ToolSearch preload
- Add explicit delegation for open question answers to plan-agent
- Make Codex/Claude debate loop fully automated after user approval
- Add mode=acceptEdits and run_in_background=false to Agent launches
- Add AskUserQuestion, SendMessage, ToolSearch to allowed-tools
Structure each finding with a title, problem, and fix section
instead of single long lines.
- Add --log-id to run_codex_review.sh, raw JSON stream logged to
  ~/.closedloop-ai/plan-with-codex/<uuid>.jsonl across rounds
- Switch from SendMessage to Agent(resume=) for plan-agent session
  continuity; add explicit rule to ignore SendMessage guidance
- Add log cleanup prompt (30+ day old logs) at end of workflow
- Fix dependency check ordering (before log setup)
- Normalize LOG_ID:none and CODEX_SESSION:none sentinels to empty
- Fix Step 1.5 stray code fence and SendMessage prose mismatch
- Add self-check guardrails to plan-agent (goal alignment, scope,
  simplicity, reuse, tests)
- Detect existing plan file without state and ask user to resume or
  start fresh; synthesize prompt sidecar from plan summary only when
  missing
- Move prompt validation after existing-plan branch so resume path
  is reachable without a prompt argument
- Normalize LOG_ID:none sentinel to empty in debate-loop.sh caller
- Move dependency checks before log setup in run_codex_review.sh
- Add LOG_ID to all SKILL.md output examples and usage snippet
- Fix argument table: prompt optional when resuming existing plan
Apply context engineering principles to reduce token footprint ~35%:
- Extract repeated agent-resume pattern into <templates> block (was 5x)
- Extract state-write pattern into single template (was 4x)
- Consolidate critical rules into <constraints> XML block
- Merge vestigial Step 2e into 2d, renumber 2f to 2e
- Fix stale-state STOP guard to allow fall-through on failed preconditions
- Add explicit cross-session resume rule (no agent_id = launch fresh)
- Preserve Codex session/log IDs in round-transition state writes
When user chooses "resume with existing plan", go directly to the
Codex debate loop after resolving open questions instead of stopping
at the Step 1.5 user checkpoint. Update option text to match behavior.
Plan-agent now verifies each Codex finding against the codebase before
acting and writes a revision summary to a sidecar file with accepted
changes and rejected findings with evidence. Codex reads this file on
subsequent rounds so it does not re-raise findings that were validly rejected.
Add changelog entries for revision summary feedback loop, codex-review
--revisions-file parameter, and plan-with-codex resume fix. Bump version
to 1.2.1. Fix README hook description for plan-review.sh.
Install anthropic and mcp in CI so pyright/pytest can resolve all
imports. Add pyproject.toml with ruff target-version and pyright
pythonVersion set to py311. Run pull_request on all branches.
@shafty023
shafty023 merged commit 963dd00 into main Mar 20, 2026
3 checks passed
@shafty023
shafty023 deleted the FEAT-92 branch March 20, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants