|
1 | 1 | --- |
| 2 | +deferred_work_file: '{implementation_artifacts}/deferred-work.md' |
2 | 3 | --- |
3 | 4 |
|
4 | | -# Step 4: Present |
| 5 | +# Step 4: Present and Act |
5 | 6 |
|
6 | 7 | ## RULES |
7 | 8 |
|
8 | 9 | - YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}` |
9 | | -- Do NOT auto-fix anything. Present findings and let the user decide next steps. |
| 10 | +- Deferred findings are handled automatically — no user input needed. |
| 11 | +- Patch findings require user choice before acting. |
| 12 | +- Intent gap and bad spec findings require a conversation — suggest options but let the user decide. |
10 | 13 |
|
11 | 14 | ## INSTRUCTIONS |
12 | 15 |
|
13 | | -1. Group remaining findings by category. |
| 16 | +### 1. Clean review shortcut |
14 | 17 |
|
15 | | -2. Present to the user in this order (include a section only if findings exist in that category): |
| 18 | +If zero findings remain after triage (all rejected or none raised): state that and end the workflow. |
16 | 19 |
|
17 | | - - **Intent Gaps**: "These findings suggest the captured intent is incomplete. Consider clarifying intent before proceeding." |
18 | | - - List each with title + detail. |
| 20 | +### 2. Handle deferred findings automatically |
19 | 21 |
|
20 | | - - **Bad Spec**: "These findings suggest the spec should be amended. Consider regenerating or amending the spec with this context:" |
21 | | - - List each with title + detail + suggested spec amendment. |
| 22 | +If `defer` findings exist: |
22 | 23 |
|
23 | | - - **Patch**: "These are fixable code issues:" |
24 | | - - List each with title + detail + location (if available). |
| 24 | +1. Append each to `{deferred_work_file}` under a heading `## Deferred from: code review ({date})`. If `{spec_file}` is set, include its basename in the heading (e.g., `code review of story-3.3 (2026-03-18)`). One bullet per finding with severity and description. |
| 25 | +2. If `{spec_file}` exists and contains a Tasks/Subtasks section, append each as a checked-off item: |
| 26 | + `- [x] [AI-Review][Defer] Description [file:line]` |
| 27 | +3. Announce: "**{N} deferred findings** written to deferred-work.md and marked complete in the story file." |
25 | 28 |
|
26 | | - - **Defer**: "Pre-existing issues surfaced by this review (not caused by current changes):" |
27 | | - - List each with title + detail. |
| 29 | +### 3. Present remaining findings |
28 | 30 |
|
29 | | -3. Summary line: **X** intent_gap, **Y** bad_spec, **Z** patch, **W** defer findings. **R** findings rejected as noise. |
| 31 | +Group and present in this order (include a section only if findings exist): |
30 | 32 |
|
31 | | -4. If clean review (zero findings across all layers after triage): state that N findings were raised but all were classified as noise, or that no findings were raised at all (as applicable). |
| 33 | +- **Intent Gaps**: "These findings suggest the captured intent is incomplete." |
| 34 | + - List each with title + detail. |
32 | 35 |
|
33 | | -5. Offer the user next steps (recommendations, not automated actions): |
34 | | - - If `patch` findings exist: "These can be addressed in a follow-up implementation pass or manually." |
35 | | - - If `intent_gap` or `bad_spec` findings exist: "Consider running the planning workflow to clarify intent or amend the spec before continuing." |
36 | | - - If only `defer` findings remain: "No action needed for this change. Deferred items are noted for future attention." |
| 36 | +- **Bad Spec**: "These findings suggest the spec should be amended." |
| 37 | + - List each with title + detail + suggested spec amendment. |
| 38 | + |
| 39 | +- **Patch**: "These are fixable code issues:" |
| 40 | + - List each with title + detail + location (if available). |
| 41 | + |
| 42 | +Summary line: **X** intent_gap, **Y** bad_spec, **Z** patch, **W** defer (auto-handled), **R** rejected as noise. |
| 43 | + |
| 44 | +### 4. Handle intent gap and bad spec findings |
| 45 | + |
| 46 | +If `intent_gap` or `bad_spec` findings exist, initiate a conversation: |
| 47 | + |
| 48 | +1. Present each finding with its detail and the specific spec section it relates to. |
| 49 | +2. For each finding (or as a batch if they relate to the same spec section), suggest resolution options: |
| 50 | + - **Downgrade to patch** — reclassify as a `patch` finding and handle it with the other patches in step 5. Cheapest option — avoids re-running dev story or create story. |
| 51 | + - **Patch the spec** — amend the specific section in `{spec_file}` to address the gap or fix the bad spec language, then continue with implementation. |
| 52 | + - **Reset to ready-for-dev** — update the story status back to ready-for-dev so the spec can be reworked and code regenerated from the corrected spec. Most expensive — triggers another full dev cycle. |
| 53 | + - **Dismiss** — the finding is not actionable or the spec is correct as-is. |
| 54 | +3. For findings that trace upstream of the story file (e.g., a PRD or architecture gap), note this explicitly: "This may originate upstream of the story — consider whether the PRD or architecture docs need a course correction." |
| 55 | +4. Let the user decide. Do not auto-apply any spec changes. |
| 56 | + |
| 57 | +### 5. Handle patch findings |
| 58 | + |
| 59 | +If `patch` findings exist (including any downgraded from step 4), ask the user: |
| 60 | + |
| 61 | +> **How would you like to handle the {Z} patch findings?** |
| 62 | +> 1. **Fix them automatically** — I will apply fixes now |
| 63 | +> 2. **Create action items** — I will add them to the story file for later |
| 64 | +> 3. **Show me details** — Let me walk through each one before deciding |
| 65 | +
|
| 66 | +- **Option 1**: Apply each fix. After all patches are applied, present a summary of changes made. |
| 67 | +- **Option 2**: Add a "Review Follow-ups (AI)" subsection to the Tasks/Subtasks section of `{spec_file}`. For each finding: `- [ ] [AI-Review][{Severity}] {Description} [{file}:{line}]` |
| 68 | +- **Option 3**: Present each finding with full detail, diff context, and suggested fix. After walkthrough, re-offer options 1 and 2. |
37 | 69 |
|
38 | 70 | Workflow complete. |
0 commit comments