nitm-ai-dev-toolkit 5.2.0 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +24 -0
  3. package/bin/cli.js +1 -1
  4. package/package.json +1 -1
  5. package/src/monorepo/.agents/skills/dispatching-parallel-agents/SKILL.md +1 -1
  6. package/src/monorepo/.agents/skills/factory/SKILL.md +36 -13
  7. package/src/monorepo/.agents/skills/factory/roles/approve.md +3 -2
  8. package/src/monorepo/.agents/skills/factory/roles/review-code.md +2 -1
  9. package/src/monorepo/.agents/skills/factory/roles/spec.md +3 -1
  10. package/src/monorepo/.claude/agents-snippets/implementer.md +5 -1
  11. package/src/monorepo/.claude/commands/bootstrap-patch.md +2 -2
  12. package/src/monorepo/.claude/commands/constitution.md +1 -1
  13. package/src/monorepo/.claude/commands/create-skill.md +1 -1
  14. package/src/monorepo/.claude/commands/implement-feature.md +2 -2
  15. package/src/monorepo/.claude/commands/implement-fixes.md +1 -1
  16. package/src/monorepo/.claude/commands/implement.md +1 -1
  17. package/src/monorepo/.claude/commands/plan.md +1 -1
  18. package/src/monorepo/.claude/prompt-snippets/assign-tasks.md +3 -2
  19. package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +15 -10
  20. package/src/monorepo/.claude/prompt-snippets/constitution.md +7 -1
  21. package/src/monorepo/.claude/prompt-snippets/create-skill.md +10 -0
  22. package/src/monorepo/.claude/prompt-snippets/implement-feature.md +39 -57
  23. package/src/monorepo/.claude/prompt-snippets/implement-fixes.md +31 -40
  24. package/src/monorepo/.claude/prompt-snippets/implement.md +101 -35
  25. package/src/monorepo/.claude/prompt-snippets/plan.md +19 -1
  26. package/src/monorepo/.claude/prompt-snippets/specify.md +9 -2
  27. package/src/monorepo/.claude/prompt-snippets/tasks.md +5 -5
  28. package/src/monorepo/.claude/rules-snippets/documentation.md +9 -1
  29. package/src/monorepo/.claude/rules-snippets/fit-review.md +62 -0
  30. package/src/monorepo/.claude/rules-snippets/subagent-workflow.md +71 -27
  31. package/src/monorepo/.cursor/commands/bootstrap-patch.md +1 -1
  32. package/src/monorepo/.cursor/commands/implement-feature.md +1 -1
  33. package/src/monorepo/.github/prompts/bootstrap-patch.prompt.md +1 -1
  34. package/src/monorepo/.github/prompts/constitution.prompt.md +1 -0
  35. package/src/monorepo/.github/prompts/create-skill.prompt.md +1 -0
  36. package/src/monorepo/.github/prompts/implement-feature.prompt.md +1 -1
  37. package/src/monorepo/.github/prompts/plan.prompt.md +1 -0
  38. package/src/monorepo/.opencode/commands/bootstrap-patch.md +1 -1
  39. package/src/monorepo/.opencode/commands/implement-feature.md +1 -1
  40. package/src/monorepo/AGENTS.md +12 -5
  41. package/src/monorepo/factory/README.md +3 -1
  42. package/src/repo/.agents/skills/dispatching-parallel-agents/SKILL.md +1 -1
  43. package/src/repo/.agents/skills/factory/SKILL.md +36 -13
  44. package/src/repo/.agents/skills/factory/roles/approve.md +3 -2
  45. package/src/repo/.agents/skills/factory/roles/review-code.md +2 -1
  46. package/src/repo/.agents/skills/factory/roles/spec.md +3 -1
  47. package/src/repo/.claude/agents-snippets/implementer.md +5 -1
  48. package/src/repo/.claude/commands/bootstrap-patch.md +2 -2
  49. package/src/repo/.claude/commands/constitution.md +1 -1
  50. package/src/repo/.claude/commands/create-skill.md +1 -1
  51. package/src/repo/.claude/commands/implement-feature.md +2 -2
  52. package/src/repo/.claude/commands/implement-fixes.md +1 -1
  53. package/src/repo/.claude/commands/implement.md +1 -1
  54. package/src/repo/.claude/commands/plan.md +1 -1
  55. package/src/repo/.claude/prompt-snippets/assign-tasks.md +3 -2
  56. package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +15 -10
  57. package/src/repo/.claude/prompt-snippets/constitution.md +7 -1
  58. package/src/repo/.claude/prompt-snippets/create-skill.md +10 -0
  59. package/src/repo/.claude/prompt-snippets/implement-feature.md +38 -58
  60. package/src/repo/.claude/prompt-snippets/implement-fixes.md +33 -34
  61. package/src/repo/.claude/prompt-snippets/implement.md +101 -35
  62. package/src/repo/.claude/prompt-snippets/plan.md +19 -3
  63. package/src/repo/.claude/prompt-snippets/specify.md +9 -2
  64. package/src/repo/.claude/prompt-snippets/tasks.md +6 -6
  65. package/src/repo/.claude/rules-snippets/documentation.md +11 -1
  66. package/src/repo/.claude/rules-snippets/fit-review.md +62 -0
  67. package/src/repo/.claude/rules-snippets/subagent-workflow.md +71 -27
  68. package/src/repo/.cursor/commands/bootstrap-patch.md +1 -1
  69. package/src/repo/.cursor/commands/implement-feature.md +1 -1
  70. package/src/repo/.github/prompts/bootstrap-patch.prompt.md +2 -2
  71. package/src/repo/.github/prompts/constitution.prompt.md +1 -1
  72. package/src/repo/.github/prompts/create-skill.prompt.md +1 -1
  73. package/src/repo/.github/prompts/implement-feature.prompt.md +2 -2
  74. package/src/repo/.github/prompts/implement-fixes.prompt.md +1 -1
  75. package/src/repo/.github/prompts/implement.prompt.md +1 -1
  76. package/src/repo/.github/prompts/plan.prompt.md +1 -1
  77. package/src/repo/.opencode/commands/bootstrap-patch.md +1 -1
  78. package/src/repo/.opencode/commands/implement-feature.md +1 -1
  79. package/src/repo/AGENTS.md +17 -6
  80. package/src/repo/factory/README.md +3 -1
@@ -5,113 +5,95 @@ Implement a feature by completing tasks sequentially with proper tracking.
5
5
  ## Usage
6
6
 
7
7
  ```
8
-
9
8
  /implement-feature {{ISSUE_KEY}}-123
10
9
  /implement-feature apps/{{APP_NAME}}/docs/features/{{FEATURE_NAME}}/tasks.md
11
-
12
- ````
10
+ ```
13
11
 
14
12
  ## Orchestrator Checkpoint
15
13
 
16
- > **🛑 Before starting**: This command involves planning, implementation, testing, and review.
17
- > Use the **orchestrator-first** flow. Delegate to the **Feature Builder** coordinator or use
18
- > the `subagent-driven-development` skill to dispatch a fresh subagent per task.
19
- > See `.claude/rules-snippets/subagent-workflow.md` for full patterns.
14
+ > **🛑 Before starting**: Every task and the whole feature run the delivery loop in
15
+ > [implement.md](implement.md). Dispatch the builder directly with that loop. Do not route through a
16
+ > planning skill, and do not write a spec or plan first. **Feature Builder** may be the builder for a
17
+ > task, but its own review never replaces the independent review, and only the orchestrator accepts.
20
18
 
21
19
  ## Process
22
20
 
23
21
  1. **Load Feature Context**:
24
- - Read specification from `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`
25
- - Read implementation plan from `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/plan.md`
26
- - Read task list from `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/tasks.md`
27
- - Review `AGENTS.md` for project patterns
22
+ - The supplied feature text or task list is the requirement. Do not require a spec or plan first.
23
+ - If `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/` exists, read whichever of `spec.md`, `plan.md` and `tasks.md` it contains as context. Skip any that are absent.
24
+ - Review `AGENTS.md` for project patterns.
25
+ - Turn every requirement of the feature into an acceptance criterion and discover the real checks, as in [implement.md](implement.md) step 1.
26
+ - Preserve the original full-feature text, acceptance criteria, and real checks separately for aggregate feature review; task-local inputs must not overwrite them.
28
27
 
29
28
  2. **Parallelization Analysis**:
30
29
  - Scan task list for `[P]` markers and independent tasks
31
30
  - Group tasks by domain (backend, frontend, docs, tests)
32
- - Tasks that touch **different files with no shared state** → dispatch in parallel
31
+ - Tasks that touch **different files with no shared state** → run their loops in parallel
33
32
  - Tasks with dependencies or shared files → keep sequential
33
+ - Tasks with an unknown or undeclared write set → keep sequential until the scope is established
34
34
  - Use `dispatching-parallel-agents` skill when 3+ independent tasks exist
35
35
 
36
- 3. **Create Feature Branch**:
36
+ 3. **Create Feature Branch** (before any build):
37
+
37
38
  ```bash
38
39
  git checkout -b feature/{{FEATURE_NAME}}
39
40
  git pull origin {{DEFAULT_BRANCH}}
40
- ````
41
+ ```
41
42
 
42
- 4. **Task Implementation** (sequential or parallel per analysis):
43
+ Then take the baseline snapshot as in implement.md step 1, before any build.
43
44
 
44
- For tasks with dependencies, execute in order.
45
- For `[P]` tasks with no shared state, **dispatch parallel subagents** — one per task domain:
45
+ 4. **Task Implementation** (sequential or parallel per analysis):
46
46
 
47
- For each task:
47
+ For each task, in dependency order:
48
48
 
49
49
  a. **Mark Task In Progress**
50
50
 
51
51
  b. **Research & Understand**:
52
-
53
52
  - Search codebase for similar patterns
54
53
  - Review referenced files
55
54
  - Understand dependencies
55
+ - Before entering the task's delivery loop, bind the current task's original text unchanged, task-local acceptance criteria, and applicable real checks as in implement.md step 1. Use these inputs for the builder, verification, independent reviewer, and acceptance in steps 2–5. Do not use another task's criteria or require later tasks to pass. Keep the saved baseline unchanged.
56
56
 
57
- c. **Implement (TDD required)**:
58
-
59
- - Follow the acceptance criteria in `spec.md` for this task's deliverable
60
- - Use patterns from `AGENTS.md`
61
- - **Write a failing test first** — one behavior per test, clear name, real code
62
- - **Verify it fails** — watch it fail for the right reason (feature missing, not error)
63
- - **Write minimal code to pass** — simplest implementation, no over-engineering
64
- - **Verify it passes** — all tests green, no regressions
65
- - **Refactor** — clean up only after green (remove duplication, improve names)
66
- - Ensure type safety
67
- - See `test-driven-development/SKILL.md` for the full cycle
68
-
69
- d. **Validate**:
57
+ c. **Delivery loop for the task** (implement.md steps 2–5):
58
+ - Builder: write the failing test first, watch it fail for the right reason, make the minimal change to pass, then refactor (TDD). Update the docs the task requires in its app or package.
59
+ - Orchestrator: verify the checks yourself, dispatch the independent read-only reviewer, then decide.
60
+ - Repair goes back to the builder. Repeat until the task is accepted or blocked. Do not commit or tick the task before acceptance.
70
61
 
71
- - Run type checking: `{{PACKAGE_MANAGER}} run check-types`
72
- - Run linter: `{{PACKAGE_MANAGER}} run lint`
73
- - Run tests: `{{PACKAGE_MANAGER}} run test`
74
- - Build: `{{PACKAGE_MANAGER}} run build`
75
-
76
- e. **Commit Changes**:
62
+ d. **Commit the Task** (after acceptance, only when there are accepted changes): stage only this task's paths, never `git add -A` or a foreign change, then commit. Skip the commit when nothing is staged.
77
63
 
78
64
  ```bash
79
65
  git commit -m "feat({{SCOPE}}): {{DESCRIPTION}}"
80
66
  ```
81
67
 
82
- f. **Mark Task Complete**:
68
+ e. **Mark Task Complete** (after the commit):
83
69
  - Slim `tasks.md`: tick `- [x]` on the task's line
84
70
  - Legacy `tasks.md`: tick `- [x]` only on checkboxes under the current task's heading (until the next heading). Never tick checkboxes under other headings. If that heading has no checkboxes, report "no checkboxes under <heading>; nothing ticked" and continue
85
71
 
86
- 5. **Post-Implementation Review**:
87
- - Dispatch **Reviewer** agent on all changes before proceeding
88
- - If reviewer requests changes, route back to the original domain specialist
89
- - Use `verification-before-completion` skill for final quality gate
90
-
91
- 6. **Create Pull Request**:
92
-
93
- After all tasks complete:
72
+ 5. **Feature Review** (aggregate loop, every round):
73
+ - Restore the saved full-feature text, acceptance criteria, and real checks as the inputs for aggregate verification, independent review, and acceptance.
74
+ - Run implement.md steps 3, 4 and 5 for the **whole feature**, against every requirement from step 1, not only the last task.
75
+ - Review scope: the current working tree against the merge-base, `git diff $(git merge-base {{DEFAULT_BRANCH}} HEAD)`. This covers committed task work, uncommitted repairs, and new files (read the untracked ones directly). Do not review only `{{DEFAULT_BRANCH}}...HEAD`: it misses uncommitted repairs and new files. Compare preexisting files against the saved baseline copies from step 1, as in implement.md step 4.
76
+ - Repairs go to the builder that owns each file, uncommitted. Then run steps 3–5 again on the current tree.
77
+ - Exits are the same as implement.md step 5: accepted, blocked, or needs a user decision. There is no round limit. Only acceptance ends the feature review successfully.
94
78
 
95
- a. **Final Validation**:
79
+ 6. **Create Pull Request** (only after the feature review is accepted):
96
80
 
97
- - All tests passing
98
- - No type errors
99
- - No linter errors
100
- - Build successful
81
+ a. **Final Validation**: after all tasks are reconciled, run the project's full required regression checks once on the final integrated tree (implement.md step 3): the repo-defined full suite, lint, typecheck, and build, where they exist. Every required check must pass on this tree. Any edit after this run requires revalidation.
101
82
 
102
- b. **Push and Create PR**:
83
+ b. **Commit and push**: if accepted feature-review changes are still uncommitted, commit them once, staging only the feature's paths, and skip the commit when nothing is staged. Do not create repair-only commits.
103
84
 
104
85
  ```bash
86
+ git commit -m "feat({{SCOPE}}): {{DESCRIPTION}}" # only when there are uncommitted accepted changes
105
87
  git push -u origin feature/{{FEATURE_NAME}}
106
88
  ```
107
89
 
108
90
  - Create PR targeting `{{DEFAULT_BRANCH}}`
109
- - Include feature summary and testing notes
91
+ - Include feature summary, the AC evidence, and testing notes
110
92
 
111
93
  7. **Report Status**:
112
- - Completed tasks count
113
- - PR URL
114
- - Ready for code review
94
+ - Tasks accepted (count) and any task blocked or awaiting a user decision
95
+ - Feature review verdict and `ACCEPTED` or `BLOCKED` / `NOT ACCEPTED` with the open items
96
+ - PR URL, only when accepted
115
97
 
116
98
  ## Guidelines
117
99
 
@@ -5,18 +5,18 @@ Implement bug fixes and corrections with proper validation and documentation.
5
5
  ## Usage
6
6
 
7
7
  ```
8
-
9
8
  /implement-fixes {{ISSUE_KEY}}-456
10
9
  /implement-fixes "Fix authentication timeout issue"
11
-
12
- ````
10
+ ```
13
11
 
14
12
  ## Orchestrator Checkpoint
15
13
 
16
- > **🛑 For multiple independent fixes**: If fixing 2+ unrelated bugs, use `dispatching-parallel-agents`
17
- > to dispatch one subagent per bug (different root causes, different files = parallel-safe).
18
- > For a single focused fix, proceed directly — single-agent is appropriate.
19
- > See `.claude/rules-snippets/subagent-workflow.md` for patterns.
14
+ > **🛑 Every fix runs the delivery loop** in [implement.md](implement.md). Initialize steps 1 and 2 below
15
+ > before any reproduction or build. Then one builder reproduces and fixes the bug, and the orchestrator
16
+ > repeats verify, review and decide until the fix is accepted or a stop condition is reached. Do not
17
+ > fix the bug inline, and do not write a spec or plan first.
18
+ > For several unrelated bugs, run one loop per bug, each with its own builder. Use
19
+ > `dispatching-parallel-agents` only when their root causes and files do not overlap.
20
20
 
21
21
  ## Workflow Modes
22
22
 
@@ -25,60 +25,51 @@ Implement bug fixes and corrections with proper validation and documentation.
25
25
 
26
26
  ## Process
27
27
 
28
- 1. **Load Fix Context**:
28
+ 1. **Load Fix Context** (orchestrator, before any build):
29
29
  - Retrieve issue details if applicable
30
- - Understand the reported bug
31
- - Identify affected code areas
30
+ - The reported bug and any stated expected behavior are the requirement. Do not require a spec or plan first.
31
+ - Identify the affected code areas
32
+ - Turn the requirements into acceptance criteria, one per requirement: for example "the reported behavior no longer occurs" and "existing behavior the bug touches still works". Discover the real checks as in [implement.md](implement.md) step 1.
33
+
34
+ 2. **Create Fix Branch and Capture Baseline** (orchestrator, before any build):
32
35
 
33
- 2. **Create Fix Branch**:
34
36
  ```bash
35
37
  git checkout {{DEFAULT_BRANCH}}
36
38
  git pull origin {{DEFAULT_BRANCH}}
37
39
  git checkout -b fix/{{FIX_DESCRIPTION}}
38
- ````
39
-
40
- 3. **Reproduce & Test (TDD required)**:
41
-
42
- - Identify root cause
43
- - **Write a failing test that reproduces the bug** — this proves you understand the issue
44
- - **Verify it fails** — watch it fail for the right reason
45
- - See `test-driven-development/SKILL.md` for the bug fix workflow
46
-
47
- 4. **Implement Fix**:
48
-
49
- - Write minimal code to make the failing test pass
50
- - Fix only the reported issue
51
- - Maintain backward compatibility
52
- - **Verify all tests pass** — run the full suite, no regressions
40
+ ```
53
41
 
54
- 5. **Validate Fix**:
42
+ Then take the baseline snapshot as in implement.md step 1, before any build.
55
43
 
56
- - Run type checking: `{{PACKAGE_MANAGER}} run check-types`
57
- - Run tests: `{{PACKAGE_MANAGER}} run test`
58
- - Build: `{{PACKAGE_MANAGER}} run build`
59
- - Verify fix resolves the issue
60
- - Check for regressions
44
+ 3. **Reproduce and Build** (builder, implement.md step 2):
45
+ - Dispatch one builder with the bug report, the AC list, the discovered checks, the base commit and the baseline.
46
+ - The builder identifies the root cause and writes a **failing test that reproduces the bug**. It watches the test fail for the right reason, then makes the minimal change that passes it. The reproduction belongs to the builder, not to the orchestrator.
47
+ - Fix only the reported issue. Maintain backward compatibility. Leave all changes uncommitted, including new files.
61
48
 
62
- 6. **Commit and Push**:
49
+ 4. **Verify, Review and Decide** (repeat implement.md steps 3, 4 and 5 until an exit):
50
+ - Verify: rerun the reproducing test and confirm it passes now, run every check that covers an AC, and run the full test suite for regressions.
51
+ - Review: the independent read-only reviewer checks the fix, the reproducing test, and the untracked files.
52
+ - Decide: repair goes back to the same builder. Repeat until `ACCEPTED`, `BLOCKED`, or `NOT ACCEPTED: needs decision`. There is no round limit. A review PASS alone never accepts.
63
53
 
54
+ 5. **Commit and Push** (only after `ACCEPTED`, and only when there are accepted changes): stage only the fix's paths, never `git add -A` or a foreign change. Skip the commit when nothing is staged.
64
55
  ```bash
65
56
  git commit -m "fix({{SCOPE}}): {{FIX_DESCRIPTION}}"
66
57
  git push -u origin fix/{{FIX_DESCRIPTION}}
67
58
  ```
68
59
 
69
- 7. **Create Pull Request**:
70
-
60
+ 6. **Create Pull Request** (only after `ACCEPTED`):
71
61
  - Target: `{{DEFAULT_BRANCH}}`
72
62
  - Include:
73
63
  - Root cause explanation
74
64
  - Fix approach description
75
- - Testing performed
65
+ - Testing performed, with the reproducing test and its failing-then-passing output
76
66
  - Potential impacts
77
67
 
78
- 8. **Report Status**:
68
+ 7. **Report Status**:
79
69
  - Bug fixed and root cause
80
- - Validation completed
81
- - PR ready for review
70
+ - Review verdict and `ACCEPTED`, or `BLOCKED` / `NOT ACCEPTED` with the open items
71
+ - Validation evidence per AC
72
+ - PR ready for review (only when accepted)
82
73
 
83
74
  **Include a Fixes Applied table** summarizing every change:
84
75
 
@@ -104,7 +95,7 @@ Implement bug fixes and corrections with proper validation and documentation.
104
95
  - **Minimal Scope**: Fix only the reported issue
105
96
  - **No Refactoring**: Avoid unrelated code changes
106
97
  - **Backward Compatible**: Don't break existing functionality
107
- - **Test First**: Write a failing test reproducing the bug before writing the fix — no exceptions
98
+ - **Test First**: The builder writes a failing test reproducing the bug before writing the fix — no exceptions
108
99
  - **Document**: Record the fix in changelog if significant
109
100
 
110
101
  ## Documentation
@@ -1,51 +1,117 @@
1
- You are helping to implement features based on a task list or specification.
1
+ # Implement
2
+
3
+ You are the orchestrator for this implementation. You derive the acceptance criteria from the supplied task, delegate the build, get an independent review, verify the evidence yourself, and decide whether the work is accepted. Only the orchestrator accepts work, and only when the loop below says so. Accepting does not commit: the calling flow decides that.
2
4
 
3
5
  ## Orchestrator Checkpoint
4
6
 
5
- > **🛑 Before starting**: If the task list contains 2+ tasks across different domains or files,
6
- > use the **orchestrator-first** flow. Dispatch a fresh subagent per task using the
7
- > `subagent-driven-development` skill. For 3+ independent `[P]` tasks, use the
8
- > `dispatching-parallel-agents` skill to run them concurrently.
9
- > See `.claude/rules-snippets/subagent-workflow.md` for full patterns.
7
+ > **🛑 Before starting**: Every task or fix runs the delivery loop below. Dispatch the builder directly
8
+ > with this loop. Do not route through a planning skill, and do not write a spec or plan first.
9
+ > For 3+ independent `[P]` tasks that touch disjoint files, the loops may run concurrently with the
10
+ > `dispatching-parallel-agents` skill. Each task still runs its own loop.
11
+ > Nontrivial ad-hoc code changes outside these commands follow the same loop. Context-heavy nontrivial work may be built directly, but acceptance still needs an independent reviewer; without one it is BLOCKED. Trivial changes (typos, one-line edits) stay outside this loop.
10
12
 
11
- ## Your Task
13
+ ## Roles
14
+
15
+ | Role | Agent | Rules |
16
+ | ------------ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
17
+ | Orchestrator | this session | Derives the acceptance criteria, dispatches, verifies, decides. Only the orchestrator accepts work or ticks tasks as accepted. |
18
+ | Builder | `fixer` (bounded) or `implementer` where the harness has it; `feature-builder` for complex builds | Reproduces, builds, repairs and reports evidence. Never approves its own work. Its internal self-review, and any reviewer it dispatches, do not count as the independent review. |
19
+ | Reviewer | `reviewer`, or any read-only agent given the reviewer brief | Reads the original task, the diff, the untracked files and the checks. Never edits. |
20
+ | Oracle | `oracle` | Advises on approach or root cause before a build. Does not build or review. |
21
+
22
+ ## Delivery Loop
23
+
24
+ The loop repeats until it reaches an exit. It is not a single pass, and it has no fixed round limit.
25
+
26
+ ```
27
+ build → verify → review → decide ─┬─ accept (review PASS, every requirement verified, every required check passing)
28
+ ▲ ├─ blocked (stop and report; never accepted)
29
+ └──── repair (any gap) ─────────┤─ needs user decision (stop and report; never accepted)
30
+ └─ (anything else loops back to build)
31
+ ```
32
+
33
+ ### 1. Task, checks and baseline (orchestrator)
34
+
35
+ - The original supplied task (request, task list entry, or fix description) is the requirement. Keep its text and give it to the builder and the reviewer unchanged. Explicit user amendments and answers given during the loop are part of the requirement too: record each one as a dated entry beside the original text (do not rewrite it), and give the builder and the reviewer the original text plus every amendment. Do not require a new spec or plan first, and do not write one.
36
+ - Turn every requirement in the supplied task into an acceptance criterion, `AC-1`, `AC-2`, ... There is no fixed count: one criterion per requirement, however many there are. Do not add requirements the task does not state.
37
+ - Each AC names its check. Discover the real checks; do not assume them. Read the project's manifests (for example `package.json` scripts, `Makefile`, `pyproject.toml`, `Cargo.toml`, `go.mod`), its CI configuration (for example `.github/workflows`), its README, and `AGENTS.md`. Use the commands the project actually runs.
38
+ - A documentation criterion may be checked by direct inspection: open the file and confirm the content, and quote what you found as evidence.
39
+ - A required check that cannot be discovered, or cannot be run, is a gap. It is not a pass, and it is not a bypass. It blocks acceptance of the affected task and of any aggregate run that needs it. Ask the user for the command as one targeted question and keep that question in the progress report. Independent tasks whose checks do not depend on the gap continue (see the Blocked exit in step 5).
40
+ - Ask only when a requirement is unclear in a way that changes what gets built: two readings lead to different code, or a needed fact is missing. Ask one targeted question with its options. A task-scoped question blocks only that task and its dependents: independent tasks with clear requirements continue, and the question stays in the progress report (see [subagent-workflow.md](../rules-snippets/subagent-workflow.md), Autonomous Execution and Blockers). If the whole request is unclear, stop and ask before any build.
41
+ - Take a baseline snapshot once, before any build. It is a plain copy of the state the task starts from, kept in a temporary directory outside the repository:
42
+ - `git rev-parse HEAD`: the base commit.
43
+ - `git status --porcelain > <tmp>/baseline/status.txt`: which files were already changed, staged or untracked.
44
+ - `git diff --binary HEAD > <tmp>/baseline/tracked.patch`: a record of the preexisting tracked changes, staged and unstaged. It is for reference only. The review never subtracts it.
45
+ - A copy of the content of every preexisting dirty tracked file and every preexisting untracked file, under `<tmp>/baseline/files/<path>`.
46
+ - Preexisting untracked files the task would change are out of scope until the user agrees to that scope. If the task must touch one, stop before the overlap, ask, and continue only with the agreed scope. Hashes alone do not show which lines changed, so the saved copy is the comparison point.
47
+
48
+ ### 2. Build or repair (builder)
49
+
50
+ **Round 1 (build):** dispatch one builder, directly, with the original task text, the AC list, the discovered checks, the base commit, and the baseline snapshot. The builder must:
51
+
52
+ - For a bug, first write a failing test that reproduces it, and watch it fail for the right reason. Then make the minimal change that passes it. For a feature, follow TDD: failing test, minimal code, then refactor. Keep the diff as small as the task allows.
53
+ - Leave all its changes uncommitted and unstaged, including new files, so the review sees them. Do not commit.
54
+ - Report each AC as `pass` with the command and result, or `not verified` with the reason. List every changed and new file.
55
+ - Report `BLOCKED` with the decision the human must make if the task cannot be built as written.
56
+
57
+ **Later rounds (repair):** dispatch the same builder again with only the open items: every blocking review item, every AC that is not `pass`, and every check that failed or did not run. It must fix each item, or say in its report why it should stand. It must not expand scope.
12
58
 
13
- 1. **Load context**:
59
+ ### 3. Verify (orchestrator)
14
60
 
15
- - Read the specification or task list provided
16
- - Review `AGENTS.md` for coding patterns
17
- - Check relevant documentation in `docs/`
61
+ Every round, run every check that covers an AC, using the commands from step 1. Treat the builder's report as a lead, not as evidence. For each AC, record `pass` with the command and result from this round, or `not verified` or `fail` with the reason. Docs criteria are recorded with the quoted content.
18
62
 
19
- 2. **Analyze implementation requirements**:
63
+ Checks are scoped: each repair and each task runs the checks for its own ACs. After all writers are reconciled, run the project's full required regression checks once: the repo-defined full suite, lint, typecheck, and build, where they exist. Use only commands the project defines; do not invent them. A failed required check is a repair. A required check that does not exist or cannot run is BLOCKED (see step 5).
20
64
 
21
- - Identify files to create or modify
22
- - Understand dependencies between tasks
23
- - Note testing requirements
24
- - **Parallelization check**: Identify `[P]` tasks and group independent work by domain
25
- - Tasks touching different files with no shared state → dispatch in parallel
65
+ ### 4. Review (reviewer, read-only)
26
66
 
27
- 3. **Execute implementation**:
67
+ Every round, after verify, dispatch the reviewer on the current working tree. Give it the original supplied task text, the AC list, this round's check results, the base commit, and the baseline snapshot. Its review scope covers the whole task, and it compares content, not patches:
28
68
 
29
- - For sequential tasks: implement in dependency order
30
- - For parallel `[P]` tasks: dispatch domain specialist subagents concurrently
31
- - **Follow TDD**: Write failing tests before implementation (red-green-refactor). See `test-driven-development/SKILL.md`.
32
- - Follow project coding standards
33
- - Add appropriate comments and documentation
69
+ - Tracked file that was clean at baseline: `git diff --binary HEAD -- <file>`, which covers staged and unstaged changes.
70
+ - Tracked file that was dirty at baseline: compare the current file with its saved copy under `<tmp>/baseline/files/<path>`.
71
+ - New untracked file: read each one in full.
72
+ - Preexisting untracked file: compare it with its saved copy, and only if the user agreed to the scope (step 1).
34
73
 
35
- 4. **Review gate**:
36
- - Dispatch **Reviewer** agent after implementation, before marking work complete
37
- - Use `verification-before-completion` skill for final quality check
74
+ The reviewer's rules:
38
75
 
39
- 5. **Validate implementation**:
76
+ - Read-only. Do not edit files, format code, stage, or commit.
77
+ - The first line of the reply is exactly `VERDICT: PASS` or `VERDICT: CHANGES`.
78
+ - `VERDICT: CHANGES` needs at least one blocking item, each with `file:line`, the problem, and the specific fix. Blocking means a correctness issue, a failing check, a requirement with no test or evidence, or a clear convention break. Taste goes in non-blocking notes.
79
+ - Check each requirement of the original task, not only the diff. A requirement with no coverage is a blocking item.
80
+ - Scope drift, both ways: trace the diff against the original supplied task. A change that no requirement needs is a blocking item unless the reviewer confirms it is a necessary implementation detail for a stated goal and says why. Goals are the original supplied task plus the user amendments recorded in step 1: do not require or assume a spec or plan (supplied-task exception). Simplicity and SRP notes stay non-blocking unless they add scope the task does not ask for.
40
81
 
41
- - Run linting: `{{PACKAGE_MANAGER}} run lint`
42
- - Run tests: `{{PACKAGE_MANAGER}} run test`
43
- - Build project: `{{PACKAGE_MANAGER}} run build`
82
+ ### 5. Decide (orchestrator)
83
+
84
+ Pick one outcome per round:
85
+
86
+ - **Repair (back to step 2):** the review is `VERDICT: CHANGES`, **or** any AC is `not verified` or `fail`, **or** a required check failed or did not run. Send the open items to the builder, then run steps 3, 4 and 5 again on the current tree.
87
+ - **Accept (exit):** all of these hold on this round's verify and review: the review is `VERDICT: PASS`; every requirement has an AC marked `pass` with evidence from this round; every required check ran and passed; an independent reviewer produced the verdict; and the builder did not report `BLOCKED`. Then report `ACCEPTED` with the AC evidence. A review PASS alone never accepts.
88
+ - **Blocked (exit for the affected work):** the builder reports `BLOCKED`, a required check cannot be discovered or run, or no independent reviewer is available. Report `BLOCKED` with the blocker and what would unblock it. Never mark blocked work accepted. Work that depends on it stops; independent authorized work with its own checks and reviewer continues. Without an independent reviewer nothing is accepted, but discovery and builds that do not need acceptance may continue and be reported as awaiting review. Stop the run only when no authorized work remains or a mandatory approval, security, or permission gate applies.
89
+ - **Needs user decision (exit for the affected work):** the task is unclear in a way only the user can settle. Stop work on that task and its dependents, report `NOT ACCEPTED: needs decision` with the question, and continue independent authorized work. This is not acceptance.
90
+
91
+ No other exit exists. An unmet requirement, a failing check, or a `not verified` result always loops back to repair. There is no round limit to escape the loop.
92
+
93
+ **Evidence freshness.** Acceptance uses evidence from the tree it accepts. Any edit after a verify or review, whether by the builder, a repair, or the orchestrator, invalidates the evidence it affects: rerun the checks covering those ACs and re-review the changed diff. Reuse evidence that the edit cannot affect. If unsure whether an edit affects a check, treat it as affected. Do not rerun everything for an unrelated edit.
94
+
95
+ ### Commit (only when the calling flow asks)
96
+
97
+ The loop never commits by itself. Accepting reports the result; it does not create a commit. The calling command decides whether accepted work is committed, and only when its own flow says so and the user has not asked otherwise. When it does commit:
98
+
99
+ - Stage only the paths this task changed, taken from the builder's list and checked against the baseline. Never `git add -A`, and never stage a preexisting or foreign change.
100
+ - Skip the commit when nothing is staged. Do not create empty commits, and do not create a separate commit for each repair round.
101
+
102
+ ### Limits
103
+
104
+ - **No independent reviewer means nothing is accepted.** The orchestrator may run its own verify and report the evidence, but it cannot accept the work on its own review. Report `BLOCKED` for acceptance. Do not treat all work as blocked when independent discovery or build can proceed (see the Blocked exit in step 5).
105
+ - Mandatory approval, security, and permission gates are never bypassed. They apply to the affected work, or to the whole run when the gate is global.
106
+ - A self-review is never presented as an independent review.
107
+ - These gates are prompt instructions, not host enforcement. Resuming after a pause depends on the host; this prompt does not guarantee automatic resume.
108
+
109
+ ## Your Task
44
110
 
45
- 6. **Track progress**:
46
- - Mark completed tasks
47
- - Report any blockers or issues
48
- - Summarize changes made
111
+ 1. **Analyze**: identify the files to create or modify, the dependencies between tasks, and the `[P]` tasks.
112
+ Dispatch `[P]` tasks in parallel only when they touch different files with no shared state. Otherwise keep them sequential. A task whose write set is unknown or undeclared runs serially until the builder's changed-file list establishes its scope.
113
+ 2. **Run the delivery loop** for each task, in dependency order, until it exits as accepted, blocked, or needs a user decision.
114
+ 3. **Track progress**: tick a task only after the orchestrator accepts it. Report blockers and summarize the accepted changes.
49
115
 
50
116
  ## Guidelines
51
117
 
@@ -53,4 +119,4 @@ You are helping to implement features based on a task list or specification.
53
119
  - Keep changes focused and atomic
54
120
  - Write tests for new functionality
55
121
  - Update documentation as needed
56
- - Use conventional commit messages
122
+ - Use conventional commit messages when a commit is requested
@@ -5,15 +5,19 @@ You are helping to create an implementation plan for a feature or requirement.
5
5
  > **🛑 Before starting**: For complex features spanning multiple domains (backend + frontend + API + docs),
6
6
  > dispatch **Researcher** subagents in parallel to analyze each domain simultaneously.
7
7
  > Use the `writing-plans` skill for structured plan creation.
8
+ > For this command, the artifact-only scope, source preservation, template and review gates below override that skill's execution handoff, worktree and commit procedures. Stop after reporting the accepted artifacts.
8
9
  > See `.claude/rules-snippets/subagent-workflow.md` for full patterns.
9
10
 
10
11
  ## Your Task
11
12
 
12
13
  1. **Load context**:
13
14
 
15
+ - Use the supplied requirement as sufficient input. Ask targeted questions only when the request is unclear; do not require creating a specification first.
14
16
  - Read `AGENTS.md` for project architecture and patterns
15
17
  - Review `docs/constitution.md` for project principles (if exists)
16
- - Read the feature spec from `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`
18
+ - If an existing specification is available at `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`, read it as optional context.
19
+ - Without an existing specification, persist the original supplied requirements and acceptance criteria verbatim in `plan.md` under **Requirements Source** and **Acceptance Criteria**, including the source path or issue key when available. Preserve constraints; label any derived criteria or assumptions separately and ask the user about unclear or missing criteria rather than inventing approval. This plan is the durable requirements source for `/tasks` and `/assign-tasks`.
20
+ - With an existing specification, link to its requirements and acceptance criteria instead of duplicating them. Surface conflicts with the supplied request to the user before proceeding.
17
21
  - Check relevant existing code for patterns to follow
18
22
 
19
23
  2. **Analyze the requirement**:
@@ -39,6 +43,14 @@ You are helping to create an implementation plan for a feature or requirement.
39
43
  - Include estimated complexity and effort
40
44
  - List any open questions or decisions needed
41
45
 
46
+ 5. **Review and Accept Planning Artifacts**:
47
+ - The orchestrator dispatches an independent, read-only reviewer with the original request, requirements/context, plan and any additional artifact paths. Use the goal-fit brief (read and follow [fit-review](../rules-snippets/fit-review.md)): Oracle when available read-only, otherwise a separate reviewer; the author's self-review does not count. Review the actual artifacts for completeness, dependencies/order, actionability, and coverage of the request, and trace goals and plan items both ways. Return `VERDICT: PASS` or `VERDICT: CHANGES` with blocking findings and section references. A finding that needs a user decision is blocking, marked `requires user decision; do not auto-repair`; stop and ask the user.
48
+ - Repair blocking findings within the agreed scope, repeat affected artifact checks, and re-review the changed artifacts independently. Repeat until PASS or blocked, or until the user decides. Stop as BLOCKED with the reason when a repair changes nothing or the same finding returns unchanged. A goal change from the review is a user decision, not a repair. Open decisions block PASS until the user resolves them.
49
+ - Only the orchestrator accepts, after an independent PASS and evidence for every requirement and applicable artifact check. If an independent reviewer is unavailable, report BLOCKED; self-review cannot substitute for independent acceptance.
50
+ - This is a lightweight artifact review, not a code build loop: do not implement the plan, run runtime build/TDD/git procedures, or add commit, push, or apply steps. Keep any required human approval separate from artifact acceptance.
51
+
52
+ 6. **Report completion** only after artifact acceptance, with the plan path, artifact check evidence, and any remaining questions for human approval.
53
+
42
54
  ## Plan Template
43
55
 
44
56
  ```markdown
@@ -48,6 +60,12 @@ You are helping to create an implementation plan for a feature or requirement.
48
60
 
49
61
  [Brief description of the feature]
50
62
 
63
+ ## Requirements Source
64
+ [Without a specification: original supplied requirements verbatim and source path/issue key. Otherwise: link to the specification's requirements.]
65
+
66
+ ## Acceptance Criteria
67
+ [Without a specification: original supplied acceptance criteria verbatim; label derived criteria/assumptions separately. Otherwise: link to the specification's criteria.]
68
+
51
69
  ## Technical Approach
52
70
 
53
71
  [How this will be implemented]
@@ -18,8 +18,15 @@ You are helping to create a feature specification based on the user's descriptio
18
18
  - Use the template structure below
19
19
  - Be specific and actionable
20
20
 
21
- 4. **Output**:
22
- - Confirm specification created
21
+ 4. **Review and Accept the Specification**:
22
+ - Dispatch an independent, read-only reviewer with the original request (verbatim, with any later user amendments), the feature description, and `spec.md`. Use the goal-fit brief (read and follow [fit-review](../rules-snippets/fit-review.md)): Oracle when available read-only, otherwise a separate reviewer; the author's self-review does not count.
23
+ - The reviewer traces requirements and acceptance criteria both ways against the original request, checks that each criterion is testable, and returns `VERDICT: PASS` or `VERDICT: CHANGES` with blocking findings and section references. A finding that needs a user decision is blocking, marked `requires user decision; do not auto-repair`; stop and ask the user.
24
+ - Repair blocking findings within the agreed scope, repeat the affected checks, and re-review the changed spec independently. Repeat until PASS or blocked, or until the user decides. Stop as BLOCKED with the reason when a repair changes nothing or the same finding returns unchanged. A goal change from the review is a user decision, not a repair. Open decisions block PASS until the user resolves them.
25
+ - Only the orchestrator accepts, after an independent PASS. If an independent reviewer is unavailable, report BLOCKED; self-review cannot substitute for independent acceptance.
26
+ - Acceptance is separate from human approval: the human still confirms the spec.
27
+
28
+ 5. **Output** (only after artifact acceptance):
29
+ - Confirm specification created and accepted
23
30
  - Summarize key requirements
24
31
  - Suggest next step: `/plan` to create implementation plan
25
32
 
@@ -1,12 +1,12 @@
1
1
  You are helping to break down a feature into actionable tasks.
2
2
 
3
- `tasks.md` is a checklist only. Acceptance criteria live in `spec.md`; approach, files, and effort live in `plan.md`. Do not repeat them here.
3
+ `tasks.md` is a checklist only. Acceptance criteria live in `spec.md` when present, otherwise in `plan.md` under **Requirements Source** and **Acceptance Criteria**; approach, files, and effort live in `plan.md`. Do not repeat them here.
4
4
 
5
5
  ## Your Task
6
6
 
7
7
  1. **Load context**:
8
- - Read the specification in `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`
9
- - Read the plan in `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/plan.md` (if exists)
8
+ - Read the plan in `apps/{{APP_NAME}}/docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/plan.md` when present
9
+ - Read sibling `spec.md` when present; otherwise use `plan.md` under **Requirements Source** and **Acceptance Criteria** as the requirements source. Cover every requirement and acceptance criterion in the deliverables without copying them into the checklist. If that source is missing or unclear, ask the user; do not require creating a specification.
10
10
  - Review `AGENTS.md` for project patterns
11
11
 
12
12
  2. **Break down into tasks** (aim for 3-7 total; never exceed 10):
@@ -65,6 +65,6 @@ You are helping to break down a feature into actionable tasks.
65
65
  When this list is used by `/implement-feature` or `/implement`:
66
66
 
67
67
  - **`[P]` tasks**: dispatch one subagent per task concurrently, using `dispatching-parallel-agents`
68
- - **Other tasks**: execute in dependency order, one subagent per task, using `subagent-driven-development`
68
+ - **Other tasks**: execute in dependency order, one subagent per task
69
69
  - **Domain routing**: match each task to a specialist (Backend Architect, Frontend Developer, API Specialist, etc.)
70
- - **Review gate**: every task passes a Reviewer before it is ticked `[x]`
70
+ - **Review gate**: follow the shared delivery loop in `implement.md`; only the orchestrator accepts and ticks `[x]` after independent review and required evidence. This command only generates the checklist; do not dispatch implementation or bypass required human approval.
@@ -85,7 +85,7 @@ Each app maintains its own feature documentation:
85
85
 
86
86
  **Location:** `apps/{{APP_NAME}}/docs/features/<feature>/`
87
87
 
88
- **Required Files:**
88
+ **Required Files** (subject to the [requirement-only planning exception](#requirement-only-planning-exception) and the separate [supplied-task exception](#supplied-task-exception)):
89
89
 
90
90
  ```
91
91
  apps/{{APP_1}}/docs/features/<feature>/
@@ -156,6 +156,14 @@ Tracks monorepo-wide changes.
156
156
 
157
157
  **⚠️ MANDATORY: Documentation MUST be written or updated BEFORE committing code. This is a hard requirement — no commit should land without the corresponding docs entry.**
158
158
 
159
+ ### Requirement-Only Planning Exception
160
+
161
+ For `/plan` without an existing specification, preserve the original supplied requirements and acceptance criteria in `plan.md` under **Requirements Source** and **Acceptance Criteria**; do not require or create `spec.md`. `/tasks` and `/assign-tasks` consume that plan source when no specification exists; keep acceptance criteria out of the slim task checklist. This exception overrides the spec prerequisite and mandatory spec-first sequence above and in the documentation checklist only for these planning artifacts. It does not authorize implementation, replace artifact review, waive required human approvals, or change any other documentation duties. The separate implementation-command supplied-task exception remains unchanged.
162
+
163
+ ### Supplied-Task Exception
164
+
165
+ For changes made by the `implement`, `implement-feature` and `implement-fixes` commands only, the task supplied to the command replaces the spec and plan prerequisites. Do not create or require `spec.md` or `plan.md` (feature folders or complex fix folders) unless the user asks for them. This exception covers only the spec and plan items below and in the decision tree above. Every other applicable item still applies.
166
+
159
167
  ### Pre-Commit Checklist
160
168
 
161
169
  Before running `git commit`, verify ALL items that apply to your change: