|
1 | 1 | --- |
2 | | -description: Human plans big changes first; agent executes after explicit approval |
| 2 | +description: Two-phase planning for big changes; builder must not be sole judge |
3 | 3 | alwaysApply: true |
4 | 4 | --- |
5 | 5 |
|
6 | 6 | # Multi-Agent Workflow (Human Plan → Agent Execute) |
7 | 7 |
|
8 | 8 | For **big changes**, split work into two phases. Do not skip Phase 1. |
9 | 9 |
|
10 | | -## What Counts as a Big Change |
11 | | - |
12 | | -Treat the change as **big** when any of these apply: |
| 10 | +## What counts as a big change |
13 | 11 |
|
14 | 12 | - New feature, new standard importer, or new user-facing capability |
15 | 13 | - Expected to touch **3+ files** or **>500 lines** of diff |
16 | 14 | - Refactor or migration with behavioral risk |
17 | 15 | - Touches critical paths (auth, secrets, production data, payments) |
18 | | -- Requirements are incomplete or have meaningful product/design choices |
| 16 | +- Incomplete requirements or meaningful product/design choices |
| 17 | + |
| 18 | +Small fixes: single-file bugfix, typo, test-only tweak, clear one-liner → `plan-first-workflow.mdc` only. |
| 19 | + |
| 20 | +## Phase 1 — Human-led planning (no code) |
| 21 | + |
| 22 | +**Stop before editing.** |
19 | 23 |
|
20 | | -Small fixes (single-file bugfix, typo, test-only tweak, clear one-liner scope) skip this rule; use `plan-first-workflow.mdc` only. |
| 24 | +1. Acknowledge this is a big change; planning comes first. |
| 25 | +2. Ask minimum questions: goal, data sources, pattern to mirror, acceptance criteria, out of scope. |
| 26 | +3. Draft a plan: steps, `@` file paths, similar code, test/validation plan, risks. |
| 27 | +4. Wait for explicit approval ("proceed", "approved", or confirmed edited plan). |
| 28 | +5. No commits, push, or implementation code in Phase 1. Read-only research is fine. |
| 29 | + Tests and production code begin in Phase 2 after approval (see `tdd-workflow.mdc`). |
21 | 30 |
|
22 | | -## Phase 1 — Human-Led Planning (Agent Facilitates, No Code) |
| 31 | +## Phase 2 — Agent execution |
23 | 32 |
|
24 | | -**Stop before editing.** Your job is to help the human produce and approve a plan. |
| 33 | +After approval: |
25 | 34 |
|
26 | | -1. **Acknowledge** this is a big change and that planning comes first. |
27 | | -2. **Ask the human** the minimum questions needed to plan well. Prefer a short numbered list over a long questionnaire. Typical prompts: |
28 | | - - What is the goal and definition of done? |
29 | | - - What source format / data / URLs does FOOBAR (or the feature) use? |
30 | | - - Which existing pattern should we mirror (e.g. a similar importer or route)? |
31 | | - - Acceptance criteria and manual checks? |
32 | | - - Out of scope / constraints? |
33 | | -3. **Draft a plan** for the human to edit, including: |
34 | | - - Goal and acceptance criteria |
35 | | - - Steps in execution order |
36 | | - - Files likely touched (with `@`-style paths where helpful) |
37 | | - - Similar code to follow |
38 | | - - Test and validation plan (`make lint`, `make mypy`, `make test`, import smoke if relevant) |
39 | | - - Risks and open questions |
40 | | -4. **Wait for explicit approval** before Phase 2. Approval looks like: "looks good", "proceed", "approved", or an edited plan the human confirms. |
41 | | -5. **Do not** create commits, push, or write implementation code during Phase 1. Research and read-only exploration are fine. |
| 35 | +1. Execute per `autonomous-workflow.mdc`. |
| 36 | +2. Follow the approved plan; pause if material deviation is needed. |
| 37 | +3. Implement incrementally; verify as you go (`verifiable-goals.mdc`). |
| 38 | +4. Hand off with checklist including test evidence. |
42 | 39 |
|
43 | | -If the human already supplied a complete plan, reflect it back briefly and ask them to confirm before executing. |
| 40 | +## Builder ≠ Judge (required on substantive work) |
44 | 41 |
|
45 | | -## Phase 2 — Agent Execution (Autonomous) |
| 42 | +| Role | Responsibility | |
| 43 | +|------|----------------| |
| 44 | +| **Builder** | Implements approved plan | |
| 45 | +| **Judge** | Independent review — edge cases, security, test gaps | |
46 | 46 |
|
47 | | -After the human approves the plan: |
| 47 | +Invoke judge via subagent, parallel agent, or fresh context: |
48 | 48 |
|
49 | | -1. **Execute end-to-end** per `autonomous-workflow.mdc` and `AGENTS.md`. |
50 | | -2. **Follow the approved plan**; if you discover a material deviation, pause and ask before continuing. |
51 | | -3. **Implement in small increments** when possible; run validation as you go. |
52 | | -4. **Evaluate** against acceptance criteria: run tests, note manual spot-checks for the human. |
53 | | -5. **Hand off** with the standard checklist (changes, checks, CI status, risks). |
| 49 | +- "Use a subagent to review this change for edge cases and security issues." |
54 | 50 |
|
55 | | -## Optional Cursor Agent Window Roles |
| 51 | +Do not mark substantive work complete without independent review or documented reason to skip. |
56 | 52 |
|
57 | | -When using parallel agents, map roles to phases: |
| 53 | +**Re-review:** Required only when judge findings change behavior, tests, or security posture materially. Style-only nits fixed in-place do not require a second judge pass. |
58 | 54 |
|
59 | | -| Role | Phase | Responsibility | |
60 | | -|------|-------|----------------| |
61 | | -| Planner | 1 | Expand prompt into spec + acceptance criteria; human approves | |
62 | | -| Builder | 2 | Implement approved plan | |
63 | | -| Evaluator | 2 | Run tests/checks; compare results to acceptance criteria | |
| 55 | +## Decision tree |
64 | 56 |
|
65 | | -One agent can cover Builder + Evaluator; Phase 1 still requires human approval before Builder starts. |
| 57 | +``` |
| 58 | +User request received |
| 59 | + │ |
| 60 | + ├─ Missing goal / criteria / context / constraints? |
| 61 | + │ └─ STOP → ask questions OR offer Requirements template (requirements-gate.mdc) |
| 62 | + │ |
| 63 | + ├─ Typo / rename / one-sentence fix? |
| 64 | + │ └─ Implement → quality checks → show evidence |
| 65 | + │ |
| 66 | + ├─ Multi-file / new feature / refactor / critical path? |
| 67 | + │ └─ Plan Mode → detailed plan → WAIT for approval → implement |
| 68 | + │ → quality checks → subagent review → handoff with evidence |
| 69 | + │ |
| 70 | + └─ Otherwise |
| 71 | + └─ Brief plan → implement → quality checks → handoff with evidence |
| 72 | +``` |
0 commit comments