nitm-ai-dev-toolkit 5.1.3 → 5.2.1

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 (62) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/package.json +1 -1
  3. package/src/monorepo/.claude/agents-snippets/implementer.md +5 -1
  4. package/src/monorepo/.claude/commands/bootstrap-patch.md +2 -2
  5. package/src/monorepo/.claude/commands/constitution.md +1 -1
  6. package/src/monorepo/.claude/commands/create-skill.md +1 -1
  7. package/src/monorepo/.claude/commands/implement-feature.md +2 -2
  8. package/src/monorepo/.claude/commands/implement-fixes.md +1 -1
  9. package/src/monorepo/.claude/commands/implement.md +1 -1
  10. package/src/monorepo/.claude/commands/plan.md +1 -1
  11. package/src/monorepo/.claude/prompt-snippets/assign-tasks.md +3 -2
  12. package/src/monorepo/.claude/prompt-snippets/bootstrap-patch.md +15 -10
  13. package/src/monorepo/.claude/prompt-snippets/constitution.md +7 -1
  14. package/src/monorepo/.claude/prompt-snippets/create-skill.md +10 -0
  15. package/src/monorepo/.claude/prompt-snippets/implement-feature.md +38 -57
  16. package/src/monorepo/.claude/prompt-snippets/implement-fixes.md +31 -40
  17. package/src/monorepo/.claude/prompt-snippets/implement.md +93 -35
  18. package/src/monorepo/.claude/prompt-snippets/plan.md +19 -1
  19. package/src/monorepo/.claude/prompt-snippets/tasks.md +5 -5
  20. package/src/monorepo/.claude/rules-snippets/documentation.md +9 -1
  21. package/src/monorepo/.claude/rules-snippets/subagent-workflow.md +13 -0
  22. package/src/monorepo/.cursor/commands/bootstrap-patch.md +1 -1
  23. package/src/monorepo/.cursor/commands/implement-feature.md +1 -1
  24. package/src/monorepo/.github/prompts/bootstrap-patch.prompt.md +1 -1
  25. package/src/monorepo/.github/prompts/constitution.prompt.md +1 -0
  26. package/src/monorepo/.github/prompts/create-skill.prompt.md +1 -0
  27. package/src/monorepo/.github/prompts/implement-feature.prompt.md +1 -1
  28. package/src/monorepo/.github/prompts/plan.prompt.md +1 -0
  29. package/src/monorepo/.opencode/commands/bootstrap-patch.md +1 -1
  30. package/src/monorepo/.opencode/commands/implement-feature.md +1 -1
  31. package/src/monorepo/AGENTS.md +4 -0
  32. package/src/repo/.claude/agents-snippets/implementer.md +5 -1
  33. package/src/repo/.claude/commands/bootstrap-patch.md +2 -2
  34. package/src/repo/.claude/commands/constitution.md +1 -1
  35. package/src/repo/.claude/commands/create-skill.md +1 -1
  36. package/src/repo/.claude/commands/implement-feature.md +2 -2
  37. package/src/repo/.claude/commands/implement-fixes.md +1 -1
  38. package/src/repo/.claude/commands/implement.md +1 -1
  39. package/src/repo/.claude/commands/plan.md +1 -1
  40. package/src/repo/.claude/prompt-snippets/assign-tasks.md +3 -2
  41. package/src/repo/.claude/prompt-snippets/bootstrap-patch.md +15 -10
  42. package/src/repo/.claude/prompt-snippets/constitution.md +7 -1
  43. package/src/repo/.claude/prompt-snippets/create-skill.md +10 -0
  44. package/src/repo/.claude/prompt-snippets/implement-feature.md +37 -58
  45. package/src/repo/.claude/prompt-snippets/implement-fixes.md +33 -34
  46. package/src/repo/.claude/prompt-snippets/implement.md +93 -35
  47. package/src/repo/.claude/prompt-snippets/plan.md +19 -3
  48. package/src/repo/.claude/prompt-snippets/tasks.md +6 -6
  49. package/src/repo/.claude/rules-snippets/documentation.md +11 -1
  50. package/src/repo/.claude/rules-snippets/subagent-workflow.md +13 -0
  51. package/src/repo/.cursor/commands/bootstrap-patch.md +1 -1
  52. package/src/repo/.cursor/commands/implement-feature.md +1 -1
  53. package/src/repo/.github/prompts/bootstrap-patch.prompt.md +2 -2
  54. package/src/repo/.github/prompts/constitution.prompt.md +1 -1
  55. package/src/repo/.github/prompts/create-skill.prompt.md +1 -1
  56. package/src/repo/.github/prompts/implement-feature.prompt.md +2 -2
  57. package/src/repo/.github/prompts/implement-fixes.prompt.md +1 -1
  58. package/src/repo/.github/prompts/implement.prompt.md +1 -1
  59. package/src/repo/.github/prompts/plan.prompt.md +1 -1
  60. package/src/repo/.opencode/commands/bootstrap-patch.md +1 -1
  61. package/src/repo/.opencode/commands/implement-feature.md +1 -1
  62. package/src/repo/AGENTS.md +5 -1
@@ -11,41 +11,41 @@ Implement a feature by completing tasks sequentially with proper tracking.
11
11
 
12
12
  ## Orchestrator Checkpoint
13
13
 
14
- > **🛑 Before starting**: This command involves planning, implementation, testing, and review.
15
- > Use the **orchestrator-first** flow. Delegate to the **Feature Builder** coordinator or use
16
- > the `subagent-driven-development` skill to dispatch a fresh subagent per task.
17
- > 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.
18
18
 
19
19
  ## Process
20
20
 
21
21
  > **📋 Standards**: Follow [Coding Standards](../rules-snippets/coding-standards.md), [Testing](../rules-snippets/testing.md), and [Documentation](../rules-snippets/documentation.md).
22
22
 
23
23
  1. **Load Feature Context**:
24
- - Read specification from `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`
25
- - Read implementation plan from `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/plan.md`
26
- - Read task list from `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/tasks.md`
27
- - Review `AGENTS.md` for project patterns
24
+ - The supplied feature text or task list is the requirement. Do not require a spec or plan first.
25
+ - If `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.
26
+ - Review `AGENTS.md` for project patterns.
27
+ - Turn every requirement of the feature into an acceptance criterion and discover the real checks, as in [implement.md](implement.md) step 1.
28
+ - Preserve the original full-feature text, acceptance criteria, and real checks separately for aggregate feature review; task-local inputs must not overwrite them.
28
29
 
29
30
  2. **Parallelization Analysis**:
30
31
  - Scan task list for `[P]` markers and independent tasks
31
32
  - Group tasks by domain (backend, frontend, docs, tests)
32
- - Tasks that touch **different files with no shared state** → dispatch in parallel
33
+ - Tasks that touch **different files with no shared state** → run their loops in parallel
33
34
  - Tasks with dependencies or shared files → keep sequential
34
35
  - Use `dispatching-parallel-agents` skill when 3+ independent tasks exist
35
36
 
36
- 3. **Create Feature Branch**:
37
+ 3. **Create Feature Branch** (before any build):
37
38
 
38
39
  ```bash
39
40
  git checkout -b feature/{{FEATURE_NAME}}
40
41
  git pull origin {{DEFAULT_BRANCH}}
41
42
  ```
42
43
 
43
- 4. **Task Implementation** (sequential or parallel per analysis):
44
+ Then take the baseline snapshot as in implement.md step 1, before any build.
44
45
 
45
- For tasks with dependencies, execute in order.
46
- For `[P]` tasks with no shared state, **dispatch parallel subagents** — one per task domain:
46
+ 4. **Task Implementation** (sequential or parallel per analysis):
47
47
 
48
- For each task:
48
+ For each task, in dependency order:
49
49
 
50
50
  a. **Mark Task In Progress**
51
51
 
@@ -53,70 +53,49 @@ Implement a feature by completing tasks sequentially with proper tracking.
53
53
  - Search codebase for similar patterns
54
54
  - Review referenced files
55
55
  - Understand dependencies
56
+ - 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
57
 
57
- c. **Implement (TDD required)**:
58
- - Follow the acceptance criteria in `spec.md` for this task's deliverable
59
- - Use patterns from `AGENTS.md`
60
- - **Write a failing test first** — one behavior per test, clear name, real code
61
- - **Verify it fails** — watch it fail for the right reason (feature missing, not error)
62
- - **Write minimal code to pass** — simplest implementation, no over-engineering
63
- - **Verify it passes** — all tests green, no regressions
64
- - **Refactor** — clean up only after green (remove duplication, improve names)
65
- - Ensure type safety
66
- - See `test-driven-development/SKILL.md` for the full cycle
67
-
68
- d. **Validate**:
69
- - Run type checking: `{{PACKAGE_MANAGER}} run check-types`
70
- - Run linter: `{{PACKAGE_MANAGER}} run lint`
71
- - Run tests: `{{PACKAGE_MANAGER}} run test`
72
- - Build: `{{PACKAGE_MANAGER}} run build`
73
-
74
- e. **Update Documentation**:
75
- - Ensure `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md` reflects final implementation
76
- - Update `plan.md` if implementation deviated from original plan
77
- - Update `docs/api/` if any API surfaces changed
78
- - Update `README.md` if setup steps, commands, or env vars changed
79
- - Add entry to `CHANGELOG.md` under `[Unreleased]`
80
- - See `.claude/rules-snippets/documentation.md` for full pre-commit checklist
81
-
82
- f. **Commit Changes**:
58
+ c. **Delivery loop for the task** (implement.md steps 2–5):
59
+ - 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: `docs/api/` if API surfaces changed, `README.md` if setup steps, commands, or env vars changed, and `CHANGELOG.md` under `[Unreleased]`. Update a feature `spec.md` or `plan.md` only if one exists.
60
+ - Orchestrator: verify the checks yourself, dispatch the independent read-only reviewer, then decide.
61
+ - Repair goes back to the builder. Repeat until the task is accepted or blocked. Do not commit or tick the task before acceptance.
62
+ - See `.claude/rules-snippets/documentation.md` for the full pre-commit checklist.
63
+
64
+ 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.
83
65
 
84
66
  ```bash
85
67
  git commit -m "feat({{SCOPE}}): {{DESCRIPTION}}"
86
68
  ```
87
69
 
88
- f. **Mark Task Complete**:
70
+ e. **Mark Task Complete** (after the commit):
89
71
  - Slim `tasks.md`: tick `- [x]` on the task's line
90
72
  - 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
91
73
 
92
- 5. **Post-Implementation Review**:
93
- - Dispatch **Reviewer** agent on all changes before proceeding
94
- - If reviewer requests changes, route back to the original domain specialist
95
- - Use `verification-before-completion` skill for final quality gate
96
-
97
- 6. **Create Pull Request**:
74
+ 5. **Feature Review** (aggregate loop, every round):
75
+ - Restore the saved full-feature text, acceptance criteria, and real checks as the inputs for aggregate verification, independent review, and acceptance.
76
+ - Run implement.md steps 3, 4 and 5 for the **whole feature**, against every requirement from step 1, not only the last task.
77
+ - 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.
78
+ - Repairs go to the builder that owns each file, uncommitted. Then run steps 3–5 again on the current tree.
79
+ - 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.
98
80
 
99
- After all tasks complete:
81
+ 6. **Create Pull Request** (only after the feature review is accepted):
100
82
 
101
- a. **Final Validation**:
102
- - All tests passing
103
- - No type errors
104
- - No linter errors
105
- - Build successful
83
+ a. **Final Validation**: the accepted verify results from step 5 (every required check ran and passed).
106
84
 
107
- b. **Push and Create PR**:
85
+ 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.
108
86
 
109
87
  ```bash
88
+ git commit -m "feat({{SCOPE}}): {{DESCRIPTION}}" # only when there are uncommitted accepted changes
110
89
  git push -u origin feature/{{FEATURE_NAME}}
111
90
  ```
112
91
 
113
92
  - Create PR targeting `{{DEFAULT_BRANCH}}`
114
- - Include feature summary and testing notes
93
+ - Include feature summary, the AC evidence, and testing notes
115
94
 
116
95
  7. **Report Status**:
117
- - Completed tasks count
118
- - PR URL
119
- - Ready for code review
96
+ - Tasks accepted (count) and any task blocked or awaiting a user decision
97
+ - Feature review verdict and `ACCEPTED` or `BLOCKED` / `NOT ACCEPTED` with the open items
98
+ - PR URL, only when accepted
120
99
 
121
100
  ## Guidelines
122
101
 
@@ -11,10 +11,12 @@ Implement bug fixes and corrections with proper validation and documentation.
11
11
 
12
12
  ## Orchestrator Checkpoint
13
13
 
14
- > **🛑 For multiple independent fixes**: If fixing 2+ unrelated bugs, use `dispatching-parallel-agents`
15
- > to dispatch one subagent per bug (different root causes, different files = parallel-safe).
16
- > For a single focused fix, proceed directly — single-agent is appropriate.
17
- > 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.
18
20
 
19
21
  ## Workflow Modes
20
22
 
@@ -25,55 +27,51 @@ Implement bug fixes and corrections with proper validation and documentation.
25
27
 
26
28
  > **📋 Standards**: Follow [Coding Standards](../rules-snippets/coding-standards.md) and [Documentation](../rules-snippets/documentation.md).
27
29
 
28
- 1. **Load Fix Context**:
30
+ 1. **Load Fix Context** (orchestrator, before any build):
29
31
  - Retrieve issue details if applicable
30
- - Understand the reported bug
31
- - Identify affected code areas
32
+ - The reported bug and any stated expected behavior are the requirement. Do not require a spec or plan first.
33
+ - Identify the affected code areas
34
+ - 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.
35
+
36
+ 2. **Create Fix Branch and Capture Baseline** (orchestrator, before any build):
32
37
 
33
- 2. **Create Fix Branch**:
34
38
  ```bash
35
39
  git checkout {{DEFAULT_BRANCH}}
36
40
  git pull origin {{DEFAULT_BRANCH}}
37
41
  git checkout -b fix/{{FIX_DESCRIPTION}}
38
42
  ```
39
43
 
40
- 3. **Reproduce & Test (TDD required)**:
41
- - Identify root cause
42
- - **Write a failing test that reproduces the bug** — this proves you understand the issue
43
- - **Verify it fails** — watch it fail for the right reason
44
- - See `test-driven-development/SKILL.md` for the bug fix workflow
45
-
46
- 4. **Implement Fix**:
47
- - Write minimal code to make the failing test pass
48
- - Fix only the reported issue
49
- - Maintain backward compatibility
50
- - **Verify all tests pass** — run the full suite, no regressions
51
-
52
- 5. **Validate Fix**:
53
- - Run type checking: `{{PACKAGE_MANAGER}} run check-types`
54
- - Run tests: `{{PACKAGE_MANAGER}} run test`
55
- - Build: `{{PACKAGE_MANAGER}} run build`
56
- - Verify fix resolves the issue
57
- - Check for regressions
58
-
59
- 6. **Commit and Push**:
44
+ Then take the baseline snapshot as in implement.md step 1, before any build.
45
+
46
+ 3. **Reproduce and Build** (builder, implement.md step 2):
47
+ - Dispatch one builder with the bug report, the AC list, the discovered checks, the base commit and the baseline.
48
+ - 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.
49
+ - Fix only the reported issue. Maintain backward compatibility. Leave all changes uncommitted, including new files.
50
+
51
+ 4. **Verify, Review and Decide** (repeat implement.md steps 3, 4 and 5 until an exit):
52
+ - 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.
53
+ - Review: the independent read-only reviewer checks the fix, the reproducing test, and the untracked files.
54
+ - 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.
55
+
56
+ 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.
60
57
  ```bash
61
58
  git commit -m "fix({{SCOPE}}): {{FIX_DESCRIPTION}}"
62
59
  git push -u origin fix/{{FIX_DESCRIPTION}}
63
60
  ```
64
61
 
65
- 7. **Create Pull Request**:
62
+ 6. **Create Pull Request** (only after `ACCEPTED`):
66
63
  - Target: `{{DEFAULT_BRANCH}}`
67
64
  - Include:
68
65
  - Root cause explanation
69
66
  - Fix approach description
70
- - Testing performed
67
+ - Testing performed, with the reproducing test and its failing-then-passing output
71
68
  - Potential impacts
72
69
 
73
- 8. **Report Status**:
70
+ 7. **Report Status**:
74
71
  - Bug fixed and root cause
75
- - Validation completed
76
- - PR ready for review
72
+ - Review verdict and `ACCEPTED`, or `BLOCKED` / `NOT ACCEPTED` with the open items
73
+ - Validation evidence per AC
74
+ - PR ready for review (only when accepted)
77
75
 
78
76
  **Include a Fixes Applied table** summarizing every change:
79
77
 
@@ -99,7 +97,7 @@ Implement bug fixes and corrections with proper validation and documentation.
99
97
  - **Minimal Scope**: Fix only the reported issue
100
98
  - **No Refactoring**: Avoid unrelated code changes
101
99
  - **Backward Compatible**: Don't break existing functionality
102
- - **Test First**: Write a failing test reproducing the bug before writing the fix — no exceptions
100
+ - **Test First**: The builder writes a failing test reproducing the bug before writing the fix — no exceptions
103
101
  - **Document**: Record the fix in changelog if significant
104
102
 
105
103
  ## Documentation
@@ -110,6 +108,7 @@ For significant fixes, document in `docs/fixes/` or `CHANGELOG.md`:
110
108
  ## [{{VERSION}}] - {{DATE}}
111
109
 
112
110
  ### Fixed
111
+
113
112
  - {{FIX_DESCRIPTION}} ({{ISSUE_KEY}})
114
113
  - Root cause: {{ROOT_CAUSE}}
115
114
  - Solution: {{SOLUTION}}
@@ -1,51 +1,109 @@
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.
10
11
 
11
- ## Your Task
12
+ ## Roles
13
+
14
+ | Role | Agent | Rules |
15
+ | ------------ | ------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
+ | Orchestrator | this session | Derives the acceptance criteria, dispatches, verifies, decides. Only the orchestrator accepts work or ticks tasks as accepted. |
17
+ | 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. |
18
+ | 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. |
19
+ | Oracle | `oracle` | Advises on approach or root cause before a build. Does not build or review. |
20
+
21
+ ## Delivery Loop
22
+
23
+ The loop repeats until it reaches an exit. It is not a single pass, and it has no fixed round limit.
24
+
25
+ ```
26
+ build → verify → review → decide ─┬─ accept (review PASS, every requirement verified, every required check passing)
27
+ ▲ ├─ blocked (stop and report; never accepted)
28
+ └──── repair (any gap) ─────────┤─ needs user decision (stop and report; never accepted)
29
+ └─ (anything else loops back to build)
30
+ ```
31
+
32
+ ### 1. Task, checks and baseline (orchestrator)
33
+
34
+ - 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. Do not require a new spec or plan first, and do not write one.
35
+ - 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.
36
+ - 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.
37
+ - A documentation criterion may be checked by direct inspection: open the file and confirm the content, and quote what you found as evidence.
38
+ - 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. Stop and ask the user for the command (see the Blocked exit in step 5).
39
+ - Ask only when the task 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, offering the options, and wait.
40
+ - 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:
41
+ - `git rev-parse HEAD`: the base commit.
42
+ - `git status --porcelain > <tmp>/baseline/status.txt`: which files were already changed, staged or untracked.
43
+ - `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.
44
+ - A copy of the content of every preexisting dirty tracked file and every preexisting untracked file, under `<tmp>/baseline/files/<path>`.
45
+ - 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.
46
+
47
+ ### 2. Build or repair (builder)
48
+
49
+ **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:
50
+
51
+ - 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.
52
+ - Leave all its changes uncommitted and unstaged, including new files, so the review sees them. Do not commit.
53
+ - Report each AC as `pass` with the command and result, or `not verified` with the reason. List every changed and new file.
54
+ - Report `BLOCKED` with the decision the human must make if the task cannot be built as written.
12
55
 
13
- 1. **Load context**:
56
+ **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.
14
57
 
15
- - Read the specification or task list provided
16
- - Review `AGENTS.md` for coding patterns
17
- - Check relevant documentation in `docs/`
58
+ ### 3. Verify (orchestrator)
18
59
 
19
- 2. **Analyze implementation requirements**:
60
+ 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.
20
61
 
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
62
+ ### 4. Review (reviewer, read-only)
26
63
 
27
- 3. **Execute implementation**:
64
+ 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
65
 
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
66
+ - Tracked file that was clean at baseline: `git diff --binary HEAD -- <file>`, which covers staged and unstaged changes.
67
+ - Tracked file that was dirty at baseline: compare the current file with its saved copy under `<tmp>/baseline/files/<path>`.
68
+ - New untracked file: read each one in full.
69
+ - Preexisting untracked file: compare it with its saved copy, and only if the user agreed to the scope (step 1).
34
70
 
35
- 4. **Review gate**:
36
- - Dispatch **Reviewer** agent after implementation, before marking work complete
37
- - Use `verification-before-completion` skill for final quality check
71
+ The reviewer's rules:
38
72
 
39
- 5. **Validate implementation**:
73
+ - Read-only. Do not edit files, format code, stage, or commit.
74
+ - The first line of the reply is exactly `VERDICT: PASS` or `VERDICT: CHANGES`.
75
+ - `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.
76
+ - Check each requirement of the original task, not only the diff. A requirement with no coverage is a blocking item.
40
77
 
41
- - Run linting: `{{PACKAGE_MANAGER}} run lint`
42
- - Run tests: `{{PACKAGE_MANAGER}} run test`
43
- - Build project: `{{PACKAGE_MANAGER}} run build`
78
+ ### 5. Decide (orchestrator)
79
+
80
+ Pick one outcome per round:
81
+
82
+ - **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.
83
+ - **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.
84
+ - **Blocked (exit):** the builder reports `BLOCKED`, or a required check cannot be discovered or run, or no independent reviewer is available. Stop, report `BLOCKED` with the blocker and what would unblock it. Never mark blocked work accepted.
85
+ - **Needs user decision (exit):** the task is unclear in a way only the user can settle. Stop, report `NOT ACCEPTED: needs decision` with the question. This is not acceptance.
86
+
87
+ 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.
88
+
89
+ ### Commit (only when the calling flow asks)
90
+
91
+ 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:
92
+
93
+ - 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.
94
+ - Skip the commit when nothing is staged. Do not create empty commits, and do not create a separate commit for each repair round.
95
+
96
+ ### Limits
97
+
98
+ - **No independent reviewer means BLOCKED.** The orchestrator may run its own verify and report the evidence, but it cannot accept the work on its own review. Report `BLOCKED`, and stop.
99
+ - A self-review is never presented as an independent review.
100
+
101
+ ## Your Task
44
102
 
45
- 6. **Track progress**:
46
- - Mark completed tasks
47
- - Report any blockers or issues
48
- - Summarize changes made
103
+ 1. **Analyze**: identify the files to create or modify, the dependencies between tasks, and the `[P]` tasks.
104
+ Dispatch `[P]` tasks in parallel only when they touch different files with no shared state. Otherwise keep them sequential.
105
+ 2. **Run the delivery loop** for each task, in dependency order, until it exits as accepted, blocked, or needs a user decision.
106
+ 3. **Track progress**: tick a task only after the orchestrator accepts it. Report blockers and summarize the accepted changes.
49
107
 
50
108
  ## Guidelines
51
109
 
@@ -53,4 +111,4 @@ You are helping to implement features based on a task list or specification.
53
111
  - Keep changes focused and atomic
54
112
  - Write tests for new functionality
55
113
  - Update documentation as needed
56
- - Use conventional commit messages
114
+ - Use conventional commit messages when a commit is requested
@@ -1,6 +1,6 @@
1
1
  # Plan Feature Implementation
2
2
 
3
- Plan how to implement the specified feature. This is the second step in the development lifecycle.
3
+ Plan how to implement the supplied feature or requirement; a prior specification is not required.
4
4
 
5
5
  ## Usage
6
6
 
@@ -14,6 +14,7 @@ Plan how to implement the specified feature. This is the second step in the deve
14
14
  > **🛑 Before starting**: For complex features spanning multiple domains (backend + frontend + API + docs),
15
15
  > dispatch **Researcher** subagents in parallel to analyze each domain simultaneously.
16
16
  > Use the `writing-plans` skill for structured plan creation.
17
+ > 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.
17
18
  > See `.claude/rules-snippets/subagent-workflow.md` for full patterns.
18
19
 
19
20
  ## Process
@@ -21,7 +22,10 @@ Plan how to implement the specified feature. This is the second step in the deve
21
22
  > **📋 Standards**: Reference [Patterns](../rules-snippets/patterns.md) for architecture patterns.
22
23
 
23
24
  1. **Load Feature Context**:
24
- - Read specification from `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`
25
+ - Use the supplied requirement as sufficient input. Ask targeted questions only when the request is unclear; do not require creating a specification first.
26
+ - If an existing specification is available at `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`, read it as optional context.
27
+ - 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`.
28
+ - 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.
25
29
  - Review `AGENTS.md` for architecture patterns
26
30
  - Check `docs/constitution.md` for project principles
27
31
 
@@ -50,7 +54,13 @@ Plan how to implement the specified feature. This is the second step in the deve
50
54
  - `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/data-model.md` - Data model details
51
55
  - `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/api-contract.md` - API specifications
52
56
 
53
- 5. **Report Completion**:
57
+ 5. **Review and Accept Planning Artifacts**:
58
+ - The orchestrator dispatches an independent, read-only reviewer with the original request, requirements/context, plan and any additional artifact paths. Review the actual artifacts for completeness, dependencies/order, actionability, and coverage of the request; return `VERDICT: PASS` or `VERDICT: CHANGES` with blocking findings and section references.
59
+ - Repair blocking findings within the agreed scope, repeat affected artifact checks, and re-review the changed artifacts independently. Repeat until PASS or blocked; unresolved decisions go to the user.
60
+ - 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.
61
+ - 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.
62
+
63
+ 6. **Report Completion** (only after artifact acceptance):
54
64
  - Plan file path
55
65
  - Additional artifacts created
56
66
  - Ready for `/tasks` command
@@ -63,6 +73,12 @@ Plan how to implement the specified feature. This is the second step in the deve
63
73
  ## Overview
64
74
  [Feature description and goals]
65
75
 
76
+ ## Requirements Source
77
+ [Without a specification: original supplied requirements verbatim and source path/issue key. Otherwise: link to the specification's requirements.]
78
+
79
+ ## Acceptance Criteria
80
+ [Without a specification: original supplied acceptance criteria verbatim; label derived criteria/assumptions separately. Otherwise: link to the specification's criteria.]
81
+
66
82
  ## Architecture
67
83
  [Component structure and relationships]
68
84
 
@@ -1,8 +1,8 @@
1
1
  # Generate Task Checklist
2
2
 
3
- Break the implementation plan into a slim task checklist. This is the third step in the development lifecycle.
3
+ Break the implementation plan into a slim task checklist; no prior specification is required.
4
4
 
5
- `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.
5
+ `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.
6
6
 
7
7
  ## Usage
8
8
 
@@ -13,7 +13,7 @@ Break the implementation plan into a slim task checklist. This is the third step
13
13
 
14
14
  ## When Not to Create tasks.md
15
15
 
16
- Small work (1-2 steps) needs no `tasks.md`. Implement it directly.
16
+ Small work (1-2 steps) needs no `tasks.md`. Report that a separate implementation command can handle it; do not implement it in this command.
17
17
 
18
18
  ## Consolidation Rules (CRITICAL)
19
19
 
@@ -37,7 +37,7 @@ Before finalizing, ask: Can adjacent tasks merge? Would one developer naturally
37
37
 
38
38
  ## Process
39
39
 
40
- 1. **Load context**: `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/spec.md`, `plan.md`, and `AGENTS.md` (project patterns).
40
+ 1. **Load context**: Read `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/plan.md` and `AGENTS.md` (project patterns). 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.
41
41
 
42
42
  2. **Write `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/tasks.md`** in the format below.
43
43
 
@@ -78,6 +78,6 @@ Ordering: setup before implementation; tests before or alongside code (TDD); cor
78
78
  When this list is used by `/implement-feature` or `/implement`:
79
79
 
80
80
  - **`[P]` tasks**: dispatch one subagent per task concurrently, using `dispatching-parallel-agents`
81
- - **Other tasks**: execute in dependency order, one subagent per task, using `subagent-driven-development`
81
+ - **Other tasks**: execute in dependency order, one subagent per task
82
82
  - **Domain routing**: match each task to a specialist (Backend Architect, Frontend Developer, API Specialist, etc.)
83
- - **Review gate**: every task passes a Reviewer before it is ticked `[x]`
83
+ - **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.
@@ -32,7 +32,7 @@ Create feature documentation for:
32
32
 
33
33
  **Location:** `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/`
34
34
 
35
- **Required Files:**
35
+ **Required Files** (subject to the [requirement-only planning exception](#requirement-only-planning-exception) and the separate [supplied-task exception](#supplied-task-exception)):
36
36
 
37
37
  ```
38
38
  {{ISSUE_ID}}-{{FEATURE_NAME}}/
@@ -43,6 +43,8 @@ Create feature documentation for:
43
43
 
44
44
  ### Creating Feature Documentation
45
45
 
46
+ The [requirement-only planning exception](#requirement-only-planning-exception) takes precedence over the spec-first sequence below for `/plan`, `/tasks` and `/assign-tasks` without a specification.
47
+
46
48
  1. **Use the spec workflow**: Run `/specify` command to generate `spec.md` in `docs/features/{{ISSUE_ID}}-{{FEATURE_NAME}}/`
47
49
  2. **Create implementation plan**: Run `/plan` command to generate `plan.md` in the same feature folder
48
50
  3. **Keep it updated**: Update during implementation if scope changes
@@ -500,6 +502,14 @@ What is the change we're proposing and/or doing?
500
502
 
501
503
  **⚠️ MANDATORY: Documentation MUST be written or updated BEFORE committing code. This is a hard requirement — no commit should land without the corresponding docs entry.**
502
504
 
505
+ ### Requirement-Only Planning Exception
506
+
507
+ 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.
508
+
509
+ ### Supplied-Task Exception
510
+
511
+ 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. Every other applicable item still applies.
512
+
503
513
  ### Pre-Commit Checklist
504
514
 
505
515
  Before running `git commit`, verify ALL items that apply to your change:
@@ -114,6 +114,19 @@ Example: 5 tasks → T1 (setup) → T2 [P] (backend API) + T3 [P] (frontend UI)
114
114
  - Coordinators should not skip review even for "simple" changes
115
115
  - If a reviewer requests changes, the original specialist fixes them and re-review occurs
116
116
 
117
+ ## Model Capacity Fallback
118
+
119
+ When a subagent stops on a model capacity, quota, session limit, or reset-wait failure (most often Claude), switch its **model** and keep its **agent**. This is automatic for those failures; do not ask first.
120
+
121
+ - **Same agent, same role.** Re-dispatch the same agent with the same task, permissions, and context (and session, where the harness supports it). Do not substitute an equivalent agent.
122
+ - **Model order, one attempt each.** Try the next model in the configured fallback order for that agent. When the order is exhausted, try the harness's known available default, unless it was already tried. Then stop; do not cycle back.
123
+ - **Never** retry the same unavailable model, and never wait blindly for a quota reset.
124
+ - **Only supported switching.** Change the model through per-call selection the runtime supports, using only fallback models and defaults that are already configured or exposed. Do not invent model IDs, and do not edit persistent or global config, accounts, or billing.
125
+ - **Blocker when nothing is left.** If no configured fallback or default is available, or per-call selection is unsupported, stop, report the blocker, and ask the user which model to use.
126
+ - **Inspect before resuming.** Check what the failed attempt left in the working tree, then resume from that partial work. Never run two writers on the same files at once.
127
+ - **Keep review independent.** The reviewer stays a separate agent from the builder, even when the builder moves to a fallback model.
128
+ - **Disclose.** The final report names the original model, each fallback attempted, and the model that finished the work.
129
+
117
130
  ## Skills Integration
118
131
 
119
132
  These skills complement subagent workflows:
@@ -10,7 +10,7 @@ argument-hint: "optional patch options"
10
10
  | Agent | When to use |
11
11
  |-------|-------------|
12
12
  | `fixer` | Standard patch — incremental changes to existing config |
13
- | `planner` | Complex patch — cross-cutting changes needing analysis first |
13
+ | `reviewer` | Independent read-only review before approval and after apply |
14
14
 
15
15
  Patch AI instructions by comparing against the latest templates and applying updates.
16
16
 
@@ -10,7 +10,7 @@ argument-hint: "feature specification or task list"
10
10
  | Agent | When to use |
11
11
  |-------|-------------|
12
12
  | `fixer` | Bounded feature work — spec is clear, files are known |
13
- | `feature-builder` | Complex feature — needs research, planning, and coordination |
13
+ | `feature-builder` | Complex feature build — builder only; the orchestrator still runs the review |
14
14
 
15
15
  Implement a feature by completing tasks sequentially with proper tracking.
16
16
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Patch AI instructions by fetching updates from the toolkit repo and applying new/updated/missing guidance
3
- tools: ["read", "search", "edit", "terminal"]
3
+ tools: ["read", "search", "edit", "terminal", "agent"]
4
4
  argument-hint: "[--dry-run] [--category <category>]"
5
5
  ---
6
6
 
@@ -11,6 +11,6 @@ argument-hint: "[--dry-run] [--category <category>]"
11
11
  | Agent | When to use |
12
12
  |-------|-------------|
13
13
  | `fixer` | Standard patch — incremental changes to existing config |
14
- | `planner` | Complex patch — cross-cutting changes needing analysis first |
14
+ | `reviewer` | Independent read-only review before approval and after apply |
15
15
 
16
16
  **CRITICAL: READ:** [.claude/prompt-snippets/bootstrap-patch.md](../../.claude/prompt-snippets/bootstrap-patch.md).