Commit 963dd00
authored
FEAT-92: add revision summary feedback loop between Claude and Codex (#25)
* feat(code): add plan-with-codex debate loop for iterative plan refinement
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
* fix(code): refine plan-with-codex orchestration and agent resume
- 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
* fix(code): improve codex review feedback formatting
Structure each finding with a title, problem, and fix section
instead of single long lines.
* feat(code): add codex review logging and fix agent resume pattern
- 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)
* fix(code): harden resume paths and fix codex review logging
- 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
* refactor(code): compress plan-with-codex prompt with extracted templates
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
* fix(code): skip redundant review gate when resuming existing plan
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.
* feat(code): add revision summary feedback loop between Claude and Codex
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.
* docs(code): update changelog and readme for v1.2.1
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.
* add github workflow to run tests
* fix CI workflow: add missing deps and pyproject.toml config
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.
* fix CI: add pytest to typecheck deps1 parent 696c989 commit 963dd00
9 files changed
Lines changed: 96 additions & 14 deletions
File tree
- .github/workflows
- plugins/code
- .claude-plugin
- agents
- commands
- skills/codex-review
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
304 | 304 | | |
305 | | - | |
| 305 | + | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
| 189 | + | |
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
| |||
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
216 | | - | |
| 218 | + | |
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
| |||
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
229 | | - | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
80 | 82 | | |
81 | 83 | | |
82 | 84 | | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
90 | 99 | | |
| 100 | + | |
91 | 101 | | |
92 | 102 | | |
93 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments