Skip to content

Commit c4c0f9e

Browse files
authored
Merge pull request #160 from Buyi-wsgzg/fix/gen-plan-current-scope-ac-contract
Align gen-plan AC contract with RLCR review
2 parents 1c45548 + 4419813 commit c4c0f9e

5 files changed

Lines changed: 210 additions & 28 deletions

File tree

commands/gen-plan.md

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ After Claude candidate plan v1 is ready, run iterative challenge/refine rounds w
266266
"${CLAUDE_PLUGIN_ROOT}/scripts/ask-codex.sh" "<review current candidate plan>"
267267
```
268268
- Prompt MUST include current candidate plan, prior disagreements, and unresolved items
269+
- Prompt MUST include the RLCR plan contract: `AC-*` items are current RLCR completion gates; deferred, future, out-of-scope, post-work, or successor-loop goals must be represented as `FUT-*` under `## Future Work / Out of Scope`, optionally with a current-loop handoff AC.
270+
- Prompt MUST require Codex to inspect each AC for deferral semantics. If any AC claims the real work happens outside this RLCR loop, Codex MUST put it under `REQUIRED_CHANGES`, not `OPTIONAL_IMPROVEMENTS`.
271+
- Prompt MUST include the Handoff AC Pattern definition inline: when preserving a future goal, a current-loop AC may cover only the handoff state/artifact/documentation. The handoff AC may reference `FUT-*`, but its positive and negative tests must be fully verifiable in this loop without completing the future work. The final plan must not leave a `Handoff AC Pattern` template/example section behind.
272+
- Prompt MUST require semantic deferred-AC detection within each AC body. Use these strings as review hints, not automatic blockers: `TODO`, `TBD`, `deferred`, `future`, `follow-up`, `subsequent`, `next phase`, `next iteration`, `next milestone`, `next loop`, `v2`, `v.next`, `Phase II`, `left for`, `to be implemented in`, `see FUT-`. Codex MUST put the issue under `REQUIRED_CHANGES` only when the AC's meaning makes the real work happen outside this RLCR loop and the AC is not a valid Handoff AC. Do not block current-scope domain wording solely because it contains a marker term, such as an AC about validating future dates as input.
273+
- Prompt MUST require AC/Task bidirectional coverage: every `AC-*` is targeted by at least one Task Breakdown row; every Task Breakdown row targets at least one current-scope `AC-*`; no task target may be empty, `-`, `FUT-*`, or `DEC-*`.
269274
- Require output format:
270275
- `AGREE:` points accepted as reasonable
271276
- `DISAGREE:` points considered unreasonable and why
@@ -280,8 +285,9 @@ After Claude candidate plan v1 is ready, run iterative challenge/refine rounds w
280285
- Topic
281286
- Claude position
282287
- Second Codex position
283-
- Resolution status (`resolved`, `needs_user_decision`, `deferred`)
288+
- Resolution status (`resolved` or `needs_user_decision`)
284289
- Round-to-round delta
290+
- Do NOT use `deferred` as a convergence status. If the selected resolution defers work, it is `resolved` only after the candidate plan records a `DEC-*` decision with a non-`PENDING` `Decision Status`, links that decision to a `FUT-*` item under `## Future Work / Out of Scope`, and ensures the deferred work is not represented as a current-scope AC/task. If that DEC/FUT linkage is missing or the decision needs human input, mark the topic `needs_user_decision`.
285291
286292
### Loop Termination Rules
287293
@@ -293,8 +299,9 @@ Repeat convergence rounds until one of the following is true:
293299
If max rounds are reached with unresolved opposite opinions, carry them to user decision phase explicitly.
294300
295301
Set convergence state explicitly:
296-
- `PLAN_CONVERGENCE_STATUS=converged` when convergence conditions are met
302+
- `PLAN_CONVERGENCE_STATUS=converged` when convergence conditions are met, no `needs_user_decision` topic remains, and every resolution that defers work already has a resolved `DEC-*` plus linked `FUT-*` entry
297303
- `PLAN_CONVERGENCE_STATUS=partially_converged` otherwise
304+
- Any unlinked deferred-work resolution MUST force `PLAN_CONVERGENCE_STATUS=partially_converged` and `HUMAN_REVIEW_REQUIRED=true`
298305
299306
---
300307
@@ -309,19 +316,21 @@ Decide if manual review can be skipped:
309316
- Else if `AUTO_START_RLCR_IF_CONVERGED=true` **and** `PLAN_CONVERGENCE_STATUS=converged`, set `HUMAN_REVIEW_REQUIRED=false`
310317
- Otherwise set `HUMAN_REVIEW_REQUIRED=true`
311318
312-
If `HUMAN_REVIEW_REQUIRED=false`, skip Step 2-4 and continue directly to Phase 7.
319+
Do not skip Step 1.5. If `HUMAN_REVIEW_REQUIRED=false`, run Step 1.5 first, then skip Step 2-4 and continue directly to Phase 7.
313320
314321
### Step 1.5: Consolidate Pending User Decisions (runs unconditionally)
315322
316323
Before proceeding (regardless of `HUMAN_REVIEW_REQUIRED`), consolidate all user-facing questions from prior phases into the plan's `## Pending User Decisions` section:
317324

318325
1. Extract `QUESTIONS_FOR_USER` items from Codex Analysis v1 (Phase 3)
319326
2. Extract items with status `needs_user_decision` from the final convergence matrix (Phase 5) — use the last round's state, not intermediate rounds
320-
3. Deduplicate: if the same topic appears in both sources, merge into one entry
321-
4. For each collected item, check if it was substantively resolved during Phase 4-5 plan refinement (i.e., Claude addressed it and second Codex agreed in a subsequent round). Remove only items with clear evidence of resolution.
322-
5. Write all remaining unresolved items into the plan's `## Pending User Decisions` section. Use `DEC-N` identifiers. Set `Decision Status` to `PENDING`.
327+
3. Extract any convergence topic whose selected resolution defers work but lacks a resolved `DEC-*` plus linked `FUT-*` entry. Add it as a `PENDING` decision so it blocks auto-start instead of silently escaping the completion gate.
328+
4. Deduplicate: if the same topic appears in multiple sources, merge into one entry
329+
5. For each collected item, check if it was substantively resolved during Phase 4-5 plan refinement (i.e., Claude addressed it and second Codex agreed in a subsequent round). Remove only items with clear evidence of resolution and, for deferred-work resolutions, complete resolved `DEC-*`/`FUT-*` linkage.
330+
6. Write all remaining unresolved items into the plan's `## Pending User Decisions` section. Use `DEC-N` identifiers. Set `Decision Status` to `PENDING`.
323331
- For Claude-vs-Codex disagreements: fill `Claude Position`, `Codex Position`, and `Tradeoff Summary`
324332
- For open questions (no opposing positions): set `Claude Position` to Claude's tentative answer (if any), `Codex Position` to `N/A - open question`, and `Tradeoff Summary` to the question's context
333+
- For deferred-work resolutions that are already decided, do not leave them as `PENDING`; instead record the resolved decision, reference its `FUT-*` entry, and ensure the `FUT-*` entry includes `Source DEC: DEC-N`
325334

326335
This ensures:
327336
- When `HUMAN_REVIEW_REQUIRED=true`: items are visible for Steps 2-4 user resolution
@@ -384,6 +393,7 @@ Deeply think and generate the plan.md following these rules:
384393
## Acceptance Criteria
385394
386395
Following TDD philosophy, each criterion includes positive and negative tests for deterministic verification.
396+
The `AC-*` items are current RLCR completion gates for this implementation loop.
387397
388398
- AC-1: <First criterion>
389399
- Positive Tests (expected to PASS):
@@ -450,11 +460,22 @@ Each task must include exactly one routing tag:
450460
- `coding`: implemented by Claude
451461
- `analyze`: executed via Codex (`/humanize:ask-codex`)
452462
463+
Every `AC-*` must be covered by at least one task. Every task must target at least one `AC-*`. Do not target `FUT-*`, `DEC-*`, or `-` in the Target AC column.
464+
453465
| Task ID | Description | Target AC | Tag (`coding`/`analyze`) | Depends On |
454466
|---------|-------------|-----------|----------------------------|------------|
455467
| task1 | <...> | AC-1 | coding | - |
456468
| task2 | <...> | AC-2 | analyze | task1 |
457469
470+
## Future Work / Out of Scope
471+
472+
Future, deferred, post-work, successor-loop, and out-of-scope items belong here, not under `## Acceptance Criteria`.
473+
474+
- FUT-1: <Future item that is not required for this RLCR loop>
475+
- Source DEC: DEC-1
476+
- Current-loop handoff: AC-X
477+
- Promotion trigger: <Condition or follow-up loop that should promote this to a current-scope AC>
478+
458479
## Claude-Codex Deliberation
459480
460481
### Agreements
@@ -510,23 +531,33 @@ When `alternative_plan_language` is empty, absent, set to `"English"`, or set to
510531
511532
5. **AC Format**: All acceptance criteria must use AC-X or AC-X.Y format.
512533
513-
6. **Clear Dependencies**: Show what depends on what, not when things happen.
534+
6. **Current-Scope AC Contract**: `AC-*` items are the current RLCR completion gate. Do NOT create deferred ACs. Any deferred, future, out-of-scope, post-work, successor-task, or successor-loop goal must be written as `FUT-*` under `## Future Work / Out of Scope`, optionally linked to a current-loop Handoff AC.
535+
536+
7. **Deferred AC Semantic Guard**: Before finalizing, inspect each AC body for deferral semantics. Deferral marker terms such as `TODO`, `TBD`, `deferred`, `future`, `follow-up`, `subsequent`, `next phase`, `next iteration`, `next milestone`, `next loop`, `v2`, `v.next`, `Phase II`, `left for`, `to be implemented in`, and `see FUT-` are review hints, not automatic failures. If the AC's meaning makes the real work happen outside this loop, rewrite the item as a current-loop handoff AC plus a `FUT-*` item, or move it entirely to future work. If a marker term is ordinary current-scope domain language, such as validating future dates as input, keep the AC if its tests are fully current-loop verifiable.
537+
538+
8. **Handoff AC Pattern**: When preserving a future goal, write a current-loop AC only for the handoff state/artifact/documentation. The handoff AC may reference `FUT-*`, but its positive and negative tests must be fully verifiable in this loop and must not require completing the future work. This pattern is generation guidance only; do not leave a `Handoff AC Pattern` template/example section in the final plan.
539+
540+
9. **AC/Task Bidirectional Coverage**: Every `AC-*` must be covered by at least one Task Breakdown row. Every Task Breakdown row must target at least one current-scope `AC-*`. No row may use an empty target, `-`, `FUT-*`, or `DEC-*` as its Target AC.
541+
542+
10. **DEC/FUT Linkage**: If a resolved decision defers work, the decision resolution must explicitly reference a `FUT-*` item. Each `FUT-*` item caused by a decision must include `Source DEC: DEC-N`. If there is a current-loop handoff, both the DEC and FUT entry should reference the handoff AC.
543+
544+
11. **Clear Dependencies**: Show what depends on what, not when things happen.
514545
515-
7. **TDD-Style Tests**: Each acceptance criterion MUST include both positive tests (expected to pass) and negative tests (expected to fail). This follows Test-Driven Development philosophy and enables deterministic verification.
546+
12. **TDD-Style Tests**: Each acceptance criterion MUST include both positive tests (expected to pass) and negative tests (expected to fail). This follows Test-Driven Development philosophy and enables deterministic verification.
516547
517-
8. **Affirmative Path Boundaries**: Describe upper and lower bounds using affirmative language (what IS acceptable) rather than negative language (what is NOT acceptable).
548+
13. **Affirmative Path Boundaries**: Describe upper and lower bounds using affirmative language (what IS acceptable) rather than negative language (what is NOT acceptable).
518549
519-
9. **Respect Deterministic Designs**: If the draft specifies a fixed approach with no choices, reflect this in the plan by narrowing the path boundaries to match the user's specification.
550+
14. **Respect Deterministic Designs**: If the draft specifies a fixed approach with no choices, reflect this in the plan by narrowing the path boundaries to match the user's specification.
520551
521-
10. **Code Style Constraint**: The generated plan MUST include a section or note instructing that implementation code and comments should NOT contain plan-specific progress terminology such as "AC-", "Milestone", "Step", "Phase", or similar workflow markers. These terms belong in the plan document, not in the resulting codebase.
552+
15. **Code Style Constraint**: The generated plan MUST include a section or note instructing that implementation code and comments should NOT contain plan-specific progress terminology such as "AC-", "Milestone", "Step", "Phase", or similar workflow markers. These terms belong in the plan document, not in the resulting codebase.
522553
523-
11. **Draft Completeness Requirement**: The generated plan MUST incorporate ALL information from the input draft document without omission. The draft represents the most valuable human input and must be fully preserved. Any clarifications obtained through Phase 6 should be added incrementally to the draft's original content, never replacing or losing any original requirements. The final plan must be a superset of the draft information plus all clarified details.
554+
16. **Draft Completeness Requirement**: The generated plan MUST incorporate ALL information from the input draft document without omission. The draft represents the most valuable human input and must be fully preserved. Any clarifications obtained through Phase 6 should be added incrementally to the draft's original content, never replacing or losing any original requirements. The final plan must be a superset of the draft information plus all clarified details.
524555
525-
12. **Debate Traceability**: The plan MUST include Codex-first findings, Claude/Codex agreements, resolved disagreements, and unresolved decisions. Unresolved opposite opinions MUST be recorded in `## Pending User Decisions` for explicit user decision.
556+
17. **Debate Traceability**: The plan MUST include Codex-first findings, Claude/Codex agreements, resolved disagreements, and unresolved decisions. Unresolved opposite opinions MUST be recorded in `## Pending User Decisions` for explicit user decision.
526557
527-
13. **Convergence Requirement**: The plan MUST record Claude/Codex agreements, resolved disagreements, and final convergence status in `## Claude-Codex Deliberation`. Stop only when convergence conditions are met or max rounds reached with explicit carry-over decisions.
558+
18. **Convergence Requirement**: The plan MUST record Claude/Codex agreements, resolved disagreements, and final convergence status in `## Claude-Codex Deliberation`. Stop only when convergence conditions are met or max rounds reached with explicit carry-over decisions.
528559
529-
14. **Task Tag Requirement**: The plan MUST include `## Task Breakdown`, and every task MUST be tagged as either `coding` or `analyze` (no untagged tasks, no other tag values).
560+
19. **Task Tag Requirement**: The plan MUST include `## Task Breakdown`, and every task MUST be tagged as either `coding` or `analyze` (no untagged tasks, no other tag values).
530561
531562
---
532563
@@ -549,6 +580,11 @@ After updating, **read the complete plan file** and verify:
549580
- The structured plan aligns with the original draft content
550581
- Claude/Codex disagreement handling is explicit and correctly reflected
551582
- No contradictions exist between different parts of the document
583+
- No instructional `Handoff AC Pattern` template/example section remains in the final plan
584+
- No `AC-*` uses deferred, future, out-of-scope, post-work, or successor-loop semantics except as a valid Handoff AC whose current-loop verification is complete without performing future work
585+
- Every `AC-*` is covered by at least one Task Breakdown row, and every Task Breakdown row targets at least one current-scope `AC-*`
586+
- Every decision that defers work links to a `FUT-*` entry, and every such `FUT-*` entry links back with `Source DEC: DEC-N`
587+
- Items under `## Future Work / Out of Scope` use `FUT-*`, not `AC-*`, and are not listed as current-scope Task Breakdown work
552588
553589
If inconsistencies are found, fix them using the Edit tool.
554590
@@ -598,6 +634,7 @@ If all of the following are true:
598634
- `PLAN_CONVERGENCE_STATUS=converged`
599635
- `GEN_PLAN_MODE=discussion`
600636
- There are no pending decisions with status `PENDING`
637+
- Every convergence topic whose resolution defers work has a resolved `DEC-*` plus linked `FUT-*` entry; no deferred-work resolution exists only in the convergence matrix
601638
602639
Then start work immediately by running:
603640

prompt-template/codex/full-alignment-review.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This is a **mandatory checkpoint** (at configurable intervals). You must conduct
88
@{{PLAN_FILE}}
99

1010
You MUST read this plan file first to understand the full scope of work before conducting your review.
11+
Only items under `## Acceptance Criteria` and current-scope Task Breakdown rows are completion gates.
12+
Items under `## Future Work` / `## Out of Scope`, including `FUT-*` items, are informational and MUST NOT block the COMPLETE verdict.
13+
If a current-scope AC or current-scope task is deferred, treat it as incomplete.
1114

1215
---
1316
## Claude's Work Summary
@@ -103,12 +106,12 @@ The project's `.humanize/rlcr/{{LOOP_TIMESTAMP}}/` directory contains the histor
103106

104107
## Part 6: Output Requirements
105108

106-
- If issues found OR any AC is NOT MET (including deferred ACs), write your findings to @{{REVIEW_RESULT_FILE}}
109+
- If issues found OR any current-scope AC is NOT MET (including deferred current-scope ACs), write your findings to @{{REVIEW_RESULT_FILE}}
107110
- Include specific action items for Claude to address, classified into:
108111
- Mainline Gaps
109112
- Blocking Side Issues
110113
- Queued Side Issues
111114
- **If development is stagnating** (see Part 4), write "STOP" as the last line
112-
- **CRITICAL**: Only write "COMPLETE" as the last line if ALL ACs from the original plan are FULLY MET with no deferrals
113-
- DEFERRED items are considered INCOMPLETE - do NOT output COMPLETE if any AC is deferred
114-
- The ONLY condition for COMPLETE is: all original plan tasks are done, all ACs are met, no deferrals allowed
115+
- **CRITICAL**: Only write "COMPLETE" as the last line if ALL current-scope ACs from the original plan are FULLY MET with no deferrals
116+
- DEFERRED current-scope items are considered INCOMPLETE - do NOT output COMPLETE if any current-scope AC is deferred
117+
- The ONLY condition for COMPLETE is: all current-scope original plan tasks are done, all current-scope ACs are met, no current-scope deferrals allowed

0 commit comments

Comments
 (0)