vibe-coding-master 0.0.16 → 0.2.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.
- package/README.md +74 -41
- package/dist/backend/api/artifact-routes.js +5 -5
- package/dist/backend/api/harness-routes.js +8 -0
- package/dist/backend/api/message-routes.js +4 -4
- package/dist/backend/api/round-routes.js +4 -2
- package/dist/backend/server.js +8 -2
- package/dist/backend/services/artifact-service.js +12 -12
- package/dist/backend/services/claude-hook-service.js +1 -1
- package/dist/backend/services/harness-service.js +579 -5
- package/dist/backend/services/message-service.js +71 -137
- package/dist/backend/services/project-service.js +4 -1
- package/dist/backend/services/round-service.js +14 -52
- package/dist/backend/services/session-service.js +1 -3
- package/dist/backend/services/task-service.js +16 -17
- package/dist/backend/templates/handoff.js +64 -26
- package/dist/backend/templates/harness/architect-agent.js +42 -12
- package/dist/backend/templates/harness/claude-root.js +42 -18
- package/dist/backend/templates/harness/coder-agent.js +15 -11
- package/dist/backend/templates/harness/known-issues-doc.js +22 -0
- package/dist/backend/templates/harness/project-manager-agent.js +66 -15
- package/dist/backend/templates/harness/pull-request-template.js +29 -0
- package/dist/backend/templates/harness/reviewer-agent.js +40 -12
- package/dist/backend/templates/harness/vcm-final-acceptance-skill.js +105 -0
- package/dist/backend/templates/harness/vcm-harness-bootstrap-skill.js +78 -0
- package/dist/backend/templates/harness/vcm-long-running-validation-skill.js +50 -0
- package/dist/backend/templates/harness/vcm-route-message-skill.js +86 -0
- package/dist/backend/templates/message-envelope.js +1 -0
- package/dist/backend/templates/role-command.js +7 -1
- package/dist/shared/validation/artifact-check.js +14 -9
- package/dist-frontend/assets/index-CrY5Ryps.js +90 -0
- package/dist-frontend/assets/index-CvvtrrCN.css +32 -0
- package/dist-frontend/index.html +2 -2
- package/docs/cc-best-practices.md +434 -192
- package/docs/full-harness-baseline.md +254 -0
- package/docs/product-design.md +31 -28
- package/docs/v0.2-implementation-plan.md +379 -0
- package/docs/vcm-cc-best-practices.md +449 -0
- package/package.json +3 -1
- package/scripts/harness-tools/generate-module-index +298 -0
- package/scripts/harness-tools/generate-public-surface +692 -0
- package/scripts/install-vcm-harness.mjs +1607 -0
- package/scripts/uninstall-vcm-harness.mjs +490 -0
- package/scripts/verify-package.mjs +4 -0
- package/dist-frontend/assets/index-CvtyKEfS.js +0 -89
- package/dist-frontend/assets/index-jEkUTnIY.css +0 -32
- package/docs/v1-architecture-design.md +0 -1009
- package/docs/v1-implementation-plan.md +0 -1376
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
# Claude Code AI Coding Best Practices
|
|
1
|
+
# Claude Code AI Coding Best Practices
|
|
2
|
+
|
|
3
|
+
> Archived: this document is kept for historical reference only. As of 2026-06-08, it is no longer maintained or updated. Current VCM-specific practice belongs in `docs/vcm-cc-best-practices.md`.
|
|
2
4
|
|
|
3
5
|
Date: 2026-05-22
|
|
4
6
|
|
|
@@ -10,7 +12,7 @@ Core principle:
|
|
|
10
12
|
Reliable loop:
|
|
11
13
|
|
|
12
14
|
```text
|
|
13
|
-
task
|
|
15
|
+
task brief
|
|
14
16
|
-> file responsibilities / public function contracts
|
|
15
17
|
-> small-step implementation
|
|
16
18
|
-> layered testing
|
|
@@ -56,8 +58,9 @@ Behavioral guardrails:
|
|
|
56
58
|
- When multiple interpretations are reasonable, do not choose silently; explain the difference and tradeoff, and ask for confirmation when needed.
|
|
57
59
|
- Prefer the simplest solution that satisfies the task; do not add unrequested features, configuration, extension points, or abstractions.
|
|
58
60
|
- Touch only files required by the task; do not clean up, format, or refactor adjacent code opportunistically.
|
|
61
|
+
- When the current task replaces a mechanism, remove obsolete code, stale paths, dead branches, legacy adapters, and unused compatibility shims. Do not preserve backward compatibility with stale code unless the user explicitly asks for it.
|
|
59
62
|
- Clean up only unused imports, variables, functions, or test leftovers created by the current change.
|
|
60
|
-
- Report-but-don't-act: when noticing an issue outside the current task scope
|
|
63
|
+
- Report-but-don't-act: when noticing an issue outside the current task scope, record it in the task-local handoff `known-issues.md`; promote it to `docs/known-issues.md` only if it remains confirmed and useful across tasks.
|
|
61
64
|
- Every diff line must trace to the task goal, public contract, test contract, or required documentation sync.
|
|
62
65
|
- For multi-step tasks, define the validation check for each step.
|
|
63
66
|
|
|
@@ -76,13 +79,16 @@ repo/
|
|
|
76
79
|
TESTING.md
|
|
77
80
|
SECURITY.md
|
|
78
81
|
DEPENDENCY_RULES.md
|
|
79
|
-
|
|
82
|
+
plans/
|
|
80
83
|
active/
|
|
81
84
|
completed/
|
|
82
85
|
|
|
83
86
|
.claude/
|
|
84
87
|
settings.json
|
|
85
88
|
skills/
|
|
89
|
+
route-message.md
|
|
90
|
+
docs-sync.md
|
|
91
|
+
long-running-validation.md
|
|
86
92
|
agents/
|
|
87
93
|
project-manager.md
|
|
88
94
|
architect.md
|
|
@@ -96,25 +102,24 @@ repo/
|
|
|
96
102
|
commands/
|
|
97
103
|
|
|
98
104
|
.ai/
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
progress.md
|
|
108
|
-
decisions.md
|
|
105
|
+
jobs/ # ignored runtime state for long-running validation jobs
|
|
106
|
+
handoffs/
|
|
107
|
+
role-commands/
|
|
108
|
+
architect.md
|
|
109
|
+
coder.md
|
|
110
|
+
reviewer.md
|
|
111
|
+
architecture-plan.md
|
|
112
|
+
implementation-log.md
|
|
109
113
|
validation-log.md
|
|
110
114
|
known-issues.md
|
|
111
|
-
|
|
115
|
+
review-report.md
|
|
116
|
+
docs-sync-report.md
|
|
112
117
|
generated/
|
|
113
118
|
module-index.json
|
|
114
119
|
test-map.json
|
|
115
120
|
public-surface.json
|
|
116
121
|
|
|
117
|
-
tools/
|
|
122
|
+
.ai/tools/
|
|
118
123
|
check-fast
|
|
119
124
|
check-changed
|
|
120
125
|
check-module
|
|
@@ -125,13 +130,17 @@ repo/
|
|
|
125
130
|
check-generated-artifacts
|
|
126
131
|
check-docs-freshness
|
|
127
132
|
check-agent-rules
|
|
133
|
+
run-long-check
|
|
134
|
+
watch-job
|
|
128
135
|
```
|
|
129
136
|
|
|
137
|
+
`.ai/tools/` is the recommended durable harness tool root. It keeps AI validation and discovery entry points near `.ai/generated/` while avoiding collisions with project-owned root `tools/` directories.
|
|
138
|
+
|
|
130
139
|
Required large-project baseline:
|
|
131
140
|
|
|
132
141
|
For a large project, the harness is not a maturity ladder. Treat the structure above as the baseline before letting Claude Code make non-trivial changes.
|
|
133
142
|
|
|
134
|
-
Missing pieces are not an accepted intermediate design. If a legacy project is missing part of the harness, record the gap in
|
|
143
|
+
Missing pieces are not an accepted intermediate design. If a legacy project is missing part of the harness, record the gap in `docs/known-issues.md` or an execution plan with owner, risk, and target date. High-risk work must wait until the relevant rules, role agents, docs, and validation commands exist.
|
|
135
144
|
|
|
136
145
|
Minimum baseline for non-trivial AI coding:
|
|
137
146
|
|
|
@@ -139,8 +148,9 @@ Minimum baseline for non-trivial AI coding:
|
|
|
139
148
|
- module-local `CLAUDE.md` for edited modules
|
|
140
149
|
- architecture, module map, testing, security, and dependency docs
|
|
141
150
|
- role agents for project management/user communication, architecture/planning, coding, and independent review/testing
|
|
142
|
-
- task
|
|
151
|
+
- task briefs or long-running plans, handoff artifacts, task-local known issues, durable `docs/known-issues.md`, validation logs, and generated context artifacts
|
|
143
152
|
- fast, changed-file, module, boundary, public-surface, contract-test, generated-artifact, docs-freshness, and agent-rule checks
|
|
153
|
+
- project skills for repeated operations such as long-running validation
|
|
144
154
|
- hooks or CI gates for protected files, validation, docs sync, public contracts, and test quality
|
|
145
155
|
|
|
146
156
|
## 3. `CLAUDE.md`
|
|
@@ -180,7 +190,7 @@ Root template:
|
|
|
180
190
|
- `packages/`: shared libraries
|
|
181
191
|
- `apps/`: user-facing applications
|
|
182
192
|
- `docs/`: architecture, testing, security, module docs
|
|
183
|
-
-
|
|
193
|
+
- `.ai/tools/`: validation and developer utilities
|
|
184
194
|
|
|
185
195
|
## Start Here
|
|
186
196
|
|
|
@@ -191,15 +201,15 @@ Root template:
|
|
|
191
201
|
|
|
192
202
|
## Commands
|
|
193
203
|
|
|
194
|
-
- Fast validation:
|
|
195
|
-
- Changed files validation:
|
|
196
|
-
- Module validation:
|
|
204
|
+
- Fast validation: `.ai/tools/check-fast`
|
|
205
|
+
- Changed files validation: `.ai/tools/check-changed`
|
|
206
|
+
- Module validation: `.ai/tools/check-module <module>`
|
|
197
207
|
|
|
198
208
|
## Role Entry Points
|
|
199
209
|
|
|
200
210
|
Role-specific behavior lives in `.claude/agents/`.
|
|
201
211
|
|
|
202
|
-
- Use `claude --agent project-manager` for user communication, task clarification, task
|
|
212
|
+
- Use `claude --agent project-manager` for user communication, task clarification, task briefs, role routing, role commands, status summaries, and final acceptance.
|
|
203
213
|
- Use `claude --agent architect` for architecture plans, module boundaries, file responsibilities, public contracts, test contracts, phase plans, and post-review docs sync / architecture drift checks.
|
|
204
214
|
- Use `claude --agent coder` for implementation and direct tests within an approved plan.
|
|
205
215
|
- Use `claude --agent reviewer` for independent review, test adequacy, validation evidence, docs gap detection, and acceptance findings.
|
|
@@ -212,37 +222,39 @@ Role-specific behavior lives in `.claude/agents/`.
|
|
|
212
222
|
- Default core roles are `project-manager`, `architect`, `coder`, and `reviewer`.
|
|
213
223
|
- The `project-manager` role owns user communication, task routing, role commands, handoff verification, final status reporting, and PR preparation after required gates pass.
|
|
214
224
|
- Do not let one coding session own architecture/plan decisions, implementation, final testing responsibility, and review.
|
|
215
|
-
- Role outputs are exchanged through `.ai/
|
|
225
|
+
- Role outputs are exchanged through a task-local handoff directory, for example `.ai/handoffs/`, not through chat history.
|
|
216
226
|
- Role messaging is turn-based. Keep at most one active message to the same target role.
|
|
217
|
-
-
|
|
227
|
+
- If the project installs a route-message skill, use it whenever writing or updating role message files.
|
|
228
|
+
- Send role messages by writing or updating a fixed route file, for example `.ai/handoffs/messages/<from-role>-<to-role>.md`.
|
|
218
229
|
- For a given target role, update the same route file instead of creating multiple fragmented messages.
|
|
219
230
|
- After writing or updating a role message file, end the current Claude Code turn. Treat the file write as the final coordination action of that turn.
|
|
220
|
-
- Do not poll message files, start shell loops, or keep the turn open waiting for another role's answer.
|
|
221
|
-
- Do not
|
|
231
|
+
- Do not poll message files, start shell loops, or keep the turn open waiting for another role's answer. The harness manager should dispatch pending route files after the role turn ends.
|
|
232
|
+
- Do not end the current turn only to wait for a long-running shell callback. For long-running builds/tests, use the `long-running-validation` skill and the project long-task wrapper.
|
|
233
|
+
- Do not use Claude Code Task/Subagent as the primary delegation mechanism for the main role chain; explicit role sessions own the long-running workflow.
|
|
222
234
|
- If new information appears while a role is still processing, update the handoff artifact or wait instead of sending fragmented follow-up messages.
|
|
223
235
|
- When the required role route includes `architect`, coding must not start until the architecture and plan artifact exists.
|
|
224
236
|
- If the current session was not started with the required role, stop and ask the user to restart with `claude --agent <role>`; do not pretend to be that role inside the wrong session.
|
|
225
|
-
- Critical global rules may be repeated in role agent files for defense in depth, but repeated rules must use stable rule IDs and be checked by
|
|
237
|
+
- Critical global rules may be repeated in role agent files for defense in depth, but repeated rules must use stable rule IDs and be checked by `.ai/tools/check-agent-rules`. Do not maintain untracked manual copies.
|
|
226
238
|
|
|
227
|
-
##
|
|
239
|
+
## Harness-Managed Blocks
|
|
228
240
|
|
|
229
|
-
If
|
|
241
|
+
If a harness manager maintains project rules, those rules must live in repo-local files and be reviewable in Git. Do not inject long-lived collaboration rules into a Claude Code terminal as ordinary input.
|
|
230
242
|
|
|
231
243
|
Allowed managed block format:
|
|
232
244
|
|
|
233
245
|
```md
|
|
234
|
-
<!--
|
|
235
|
-
|
|
236
|
-
<!--
|
|
246
|
+
<!-- HARNESS:BEGIN version=1 -->
|
|
247
|
+
Harness-managed rules.
|
|
248
|
+
<!-- HARNESS:END -->
|
|
237
249
|
```
|
|
238
250
|
|
|
239
251
|
Rules:
|
|
240
252
|
|
|
241
|
-
-
|
|
242
|
-
- If a file already exists,
|
|
243
|
-
-
|
|
244
|
-
- After applying harness changes,
|
|
245
|
-
- Session startup should pass environment variables and start the role agent; it should not paste a long
|
|
253
|
+
- A harness manager may create missing `CLAUDE.md` and `.claude/agents/{project-manager,architect,coder,reviewer}.md` from recommended defaults.
|
|
254
|
+
- If a file already exists, the harness manager may only insert or replace the harness-managed block.
|
|
255
|
+
- The harness manager must not overwrite user-authored content outside managed blocks.
|
|
256
|
+
- After applying harness changes, the harness manager must report changed files and recommend a user review/commit.
|
|
257
|
+
- Session startup should pass environment variables and start the role agent; it should not paste a long harness context into the terminal.
|
|
246
258
|
|
|
247
259
|
## Default Behavior
|
|
248
260
|
|
|
@@ -251,7 +263,7 @@ Rules:
|
|
|
251
263
|
- Prefer the simplest solution that satisfies the task; do not add speculative features, abstractions, configuration, or flexibility.
|
|
252
264
|
- Touch only files required by the task; do not clean up or refactor unrelated code.
|
|
253
265
|
- Clean up only unused code created by the current change.
|
|
254
|
-
- Report-but-don't-act: record out-of-scope issues in
|
|
266
|
+
- Report-but-don't-act: record out-of-scope issues in the task-local handoff `known-issues.md`; do not act on them.
|
|
255
267
|
- Every changed line must trace to the task goal, public contract, test contract, or required documentation sync.
|
|
256
268
|
- For multi-step tasks, define the validation check for each step before implementing it.
|
|
257
269
|
|
|
@@ -265,12 +277,12 @@ Rules:
|
|
|
265
277
|
|
|
266
278
|
## Definition of Done
|
|
267
279
|
|
|
268
|
-
-
|
|
280
|
+
- Changed files and meaningful hunks have traceable reasons.
|
|
269
281
|
- Required validation passes.
|
|
270
282
|
- New or modified public functions have contract tests.
|
|
271
283
|
- Behavior changes have regression tests unless impractical.
|
|
272
284
|
- Plan, architecture, public contract, test strategy, and module responsibility changes are reflected in docs after post-review architect docs sync.
|
|
273
|
-
- Follow-ups are recorded in
|
|
285
|
+
- Follow-ups are recorded in the task-local handoff `known-issues.md`, `docs/known-issues.md`, or the execution plan.
|
|
274
286
|
```
|
|
275
287
|
|
|
276
288
|
Large projects must have module-local `CLAUDE.md` files:
|
|
@@ -292,7 +304,7 @@ Module files should define:
|
|
|
292
304
|
- historical pitfalls
|
|
293
305
|
- high-risk behavior
|
|
294
306
|
|
|
295
|
-
## 4. Task
|
|
307
|
+
## 4. Task Briefs and Planning Granularity
|
|
296
308
|
|
|
297
309
|
Every task must define at least **file-level responsibilities**.
|
|
298
310
|
|
|
@@ -331,10 +343,12 @@ function internals: usually not fixed in advance
|
|
|
331
343
|
|
|
332
344
|
Large tasks can start with modules, directories, file responsibilities, data flow, and dependency direction. Before each implementation phase, define the public function contracts involved in that phase.
|
|
333
345
|
|
|
334
|
-
|
|
346
|
+
Task briefs do not require a dedicated file for every task. For ordinary work, the brief may live in the issue, PR description, role command, or project-manager handoff. For large, multi-phase, or multi-day work, the durable plan lives under `docs/plans/active/<plan-name>.md`.
|
|
347
|
+
|
|
348
|
+
### 4.1 Task Brief / Plan Template
|
|
335
349
|
|
|
336
350
|
```md
|
|
337
|
-
# Task
|
|
351
|
+
# Task Brief / Plan
|
|
338
352
|
|
|
339
353
|
## Goal
|
|
340
354
|
|
|
@@ -566,7 +580,7 @@ Do not include:
|
|
|
566
580
|
|
|
567
581
|
For large projects, the default execution model should be explicit role-based sessions, not dynamic role routing inside one generic Claude conversation.
|
|
568
582
|
|
|
569
|
-
The user-facing task should start with a `project-manager` role session. The project manager owns user communication, route-file message preparation,
|
|
583
|
+
The user-facing task should start with a `project-manager` role session. The project manager owns user communication, route-file message preparation, task risk classification, role routing, progress tracking, and process verification. It does not own architecture, coding, and independent review for the same non-trivial task.
|
|
570
584
|
|
|
571
585
|
Do not make one generic Claude session own architecture, planning, coding, final testing, and review for non-trivial work. That blurs responsibility and makes acceptance weak.
|
|
572
586
|
|
|
@@ -583,8 +597,8 @@ Project manager responsibilities:
|
|
|
583
597
|
```text
|
|
584
598
|
communicate with user
|
|
585
599
|
-> clarify task
|
|
586
|
-
-> turn user intent into a task brief /
|
|
587
|
-
-> classify
|
|
600
|
+
-> turn user intent into a task brief / durable plan
|
|
601
|
+
-> classify task risk
|
|
588
602
|
-> choose required role route
|
|
589
603
|
-> prepare the next role command
|
|
590
604
|
-> ensure handoff directory exists when needed
|
|
@@ -600,7 +614,7 @@ The project manager is a process owner, not an execution owner.
|
|
|
600
614
|
|
|
601
615
|
It is also the communication bridge between the user and the role agents. The user should not need to know how to write a perfect Claude Code prompt. The project manager owns the conversion from user intent to precise agent instructions.
|
|
602
616
|
|
|
603
|
-
|
|
617
|
+
A shorter route is a per-task exception, not a baseline default. If the user explicitly approves one, the project manager records the exception and still verifies ownership, validation, and acceptance gates.
|
|
604
618
|
|
|
605
619
|
Do not let the project manager:
|
|
606
620
|
|
|
@@ -618,7 +632,7 @@ A role command must include:
|
|
|
618
632
|
|
|
619
633
|
```text
|
|
620
634
|
role identity
|
|
621
|
-
task
|
|
635
|
+
task brief path
|
|
622
636
|
required input artifacts
|
|
623
637
|
allowed write scope
|
|
624
638
|
public surface contract
|
|
@@ -633,26 +647,26 @@ Role command examples:
|
|
|
633
647
|
|
|
634
648
|
```text
|
|
635
649
|
architect command:
|
|
636
|
-
read the task
|
|
637
|
-
produce .ai/
|
|
650
|
+
read the task brief, architecture docs, module map, and relevant module-local CLAUDE.md
|
|
651
|
+
produce .ai/handoffs/architecture-plan.md
|
|
638
652
|
define file responsibilities, public contracts, test contracts, phases, validation, and Replan triggers
|
|
639
653
|
do not edit production code
|
|
640
654
|
|
|
641
655
|
coder command:
|
|
642
|
-
read the task
|
|
656
|
+
read the task brief and approved architecture-plan.md
|
|
643
657
|
implement only the approved phase and allowed files
|
|
644
658
|
add or update direct contract/regression tests
|
|
645
659
|
update implementation-log.md and validation-log.md
|
|
646
660
|
stop if scope, public contract, architecture, or test strategy must change
|
|
647
661
|
|
|
648
662
|
reviewer command:
|
|
649
|
-
read task
|
|
663
|
+
read task brief, architecture-plan.md, implementation-log.md, validation-log.md, and git diff
|
|
650
664
|
verify scope, architecture, public contract, tests, validation, and docs gaps
|
|
651
665
|
write review-report.md
|
|
652
666
|
only apply small, local, low-risk review-scoped fixes
|
|
653
667
|
|
|
654
668
|
architect docs-sync command:
|
|
655
|
-
read task
|
|
669
|
+
read task brief, architecture-plan.md, implementation-log.md, validation-log.md, review-report.md, and git diff
|
|
656
670
|
verify whether the final code still matches the approved architecture and public contracts
|
|
657
671
|
update architecture/module/testing/security docs when the code change made them stale
|
|
658
672
|
write docs-sync-report.md with docs changed, docs intentionally unchanged, and remaining doc risks
|
|
@@ -682,20 +696,17 @@ The role is selected at session startup. The agent file defines that session's s
|
|
|
682
696
|
|
|
683
697
|
If the current session was not started with the required role, stop and ask the user to restart with the correct `claude --agent <role>` command. Do not simulate a different role through a normal prompt.
|
|
684
698
|
|
|
685
|
-
### 7.3 Task
|
|
699
|
+
### 7.3 Task Routing
|
|
686
700
|
|
|
687
|
-
This is not progressive adoption. The full harness exists by default
|
|
701
|
+
This is not progressive adoption. The full harness exists by default, and the baseline does not define shortcut routes.
|
|
688
702
|
|
|
689
|
-
All user-facing routes begin with `project-manager`.
|
|
703
|
+
All user-facing routes begin with `project-manager`. A shorter route requires explicit user approval recorded in the task evidence.
|
|
690
704
|
|
|
691
705
|
| Task class | Examples | Required role route |
|
|
692
706
|
| --- | --- | --- |
|
|
693
|
-
|
|
|
694
|
-
|
|
|
695
|
-
|
|
|
696
|
-
| T3 cross-module / architectural | cross-module change, module boundary change, refactor, new public surface | `project-manager` -> `architect` -> `coder` -> `reviewer` -> `architect` docs sync -> PM commit/PR |
|
|
697
|
-
| T4 high-risk | auth, permission, payment, billing, schema, data deletion, public API/SDK, security-sensitive infrastructure | `project-manager` -> `architect` -> relevant specialist if needed -> `coder` -> `reviewer` -> `architect` docs sync -> human approval -> PM commit/PR |
|
|
698
|
-
| T5 large rewrite / greenfield | new subsystem, major rewrite, migration across many modules | `project-manager` -> `architect`; then repeat `coder` -> `reviewer` -> `architect` docs sync per phase; PM commit/PR at phase or task boundary |
|
|
707
|
+
| Normal managed task | bug fix, doc change, config change, feature, ordinary PR | `project-manager` -> `architect` -> `coder` -> `reviewer` -> `architect` docs sync -> PM commit/PR |
|
|
708
|
+
| High-risk task | auth, permission, payment, billing, schema, data deletion, public API/SDK, security-sensitive infrastructure | `project-manager` -> `architect` -> relevant specialist if needed -> `coder` -> `reviewer` -> `architect` docs sync -> human approval -> PM commit/PR |
|
|
709
|
+
| Large / multi-phase task | new subsystem, major rewrite, migration across many modules | `project-manager` -> `architect`; then repeat `coder` -> `reviewer` -> `architect` docs sync per phase; PM commit/PR at phase or task boundary |
|
|
699
710
|
|
|
700
711
|
If classification is unclear, use the stricter route.
|
|
701
712
|
|
|
@@ -720,25 +731,25 @@ Role responsibilities:
|
|
|
720
731
|
|
|
721
732
|
```text
|
|
722
733
|
project-manager
|
|
723
|
-
owns user communication, task clarification, task
|
|
734
|
+
owns user communication, task clarification, task briefs, role routing, and route-file message preparation
|
|
724
735
|
turns user input into an engineering task when needed
|
|
725
736
|
summarizes role outputs back to the user
|
|
726
737
|
creates and verifies handoff artifacts
|
|
727
738
|
tracks progress, blockers, validation, docs sync, and Replan
|
|
728
|
-
outputs task
|
|
739
|
+
outputs task briefs, role commands, status summaries, and final acceptance reports
|
|
729
740
|
must not own architecture, implementation, and independent review for the same non-trivial task
|
|
730
741
|
|
|
731
742
|
architect
|
|
732
743
|
owns architecture and plan
|
|
733
744
|
defines module boundaries, file responsibilities, public contracts, dependency direction, risk, and phases
|
|
734
745
|
owns post-review docs sync and architecture drift checks before PM final acceptance
|
|
735
|
-
outputs .ai/
|
|
736
|
-
outputs .ai/
|
|
746
|
+
outputs .ai/handoffs/architecture-plan.md
|
|
747
|
+
outputs .ai/handoffs/docs-sync-report.md when a post-review docs sync gate is required
|
|
737
748
|
must not implement production code
|
|
738
749
|
|
|
739
750
|
coder
|
|
740
751
|
owns code changes and baseline tests required to complete the approved task
|
|
741
|
-
follows approved architecture-plan.md and task
|
|
752
|
+
follows approved architecture-plan.md and task brief
|
|
742
753
|
outputs touched files, implementation notes, validation results, and follow-ups
|
|
743
754
|
must write/update direct unit, contract, or regression tests needed for the changed behavior
|
|
744
755
|
must not change module responsibilities, public contracts, architecture direction, or test strategy without Replan
|
|
@@ -749,7 +760,7 @@ reviewer
|
|
|
749
760
|
checks, designs, and adds missing tests when needed
|
|
750
761
|
may directly apply small, local, low-risk review fixes
|
|
751
762
|
owns complex tests, E2E coverage, regression matrix, and release-level validation recommendations
|
|
752
|
-
outputs .ai/
|
|
763
|
+
outputs .ai/handoffs/review-report.md
|
|
753
764
|
must escalate larger implementation issues to coder
|
|
754
765
|
must escalate architecture, public contract, design, or documentation drift issues to architect
|
|
755
766
|
```
|
|
@@ -760,9 +771,9 @@ Prompt rules are not enough. Role separation must be backed by tool scope, permi
|
|
|
760
771
|
|
|
761
772
|
| Role | Suggested tools | Write scope | Must not |
|
|
762
773
|
| --- | --- | --- | --- |
|
|
763
|
-
| `project-manager` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | task
|
|
764
|
-
| `architect` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | architecture plan, docs sync report,
|
|
765
|
-
| `coder` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | approved source files, baseline tests, validation log, implementation log | change scope, public contracts, module boundaries, or test strategy without Replan |
|
|
774
|
+
| `project-manager` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | task briefs, role commands, handoff metadata, status/progress/known-issues, final reports, PR description | implement non-trivial production code, write durable project docs, approve without reviewer/docs-sync evidence, replace architect/coder/reviewer roles |
|
|
775
|
+
| `architect` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | architecture plan, docs sync report, durable plan updates, approved architecture/module/testing/security/dependency docs | edit production code, rewrite tests, expand task scope |
|
|
776
|
+
| `coder` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | approved source files, baseline tests, validation log, implementation log | change scope, write durable project docs, change public contracts, module boundaries, or test strategy without Replan |
|
|
766
777
|
| `reviewer` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | review report, missing tests/fixtures, validation log, small review-scoped fixes | take over implementation, change architecture/public contracts, approve own implementation, weaken tests |
|
|
767
778
|
| `security-specialist` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | security review report and approved security tests | bypass approvals, edit production code without explicit scope |
|
|
768
779
|
| `migration-specialist` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | migration plan, migration tests, validation notes | run destructive migrations, change schema without approval |
|
|
@@ -771,8 +782,8 @@ Prompt rules are not enough. Role separation must be backed by tool scope, permi
|
|
|
771
782
|
Recommended permission modes:
|
|
772
783
|
|
|
773
784
|
```text
|
|
774
|
-
project-manager: default with write hooks limited to task
|
|
775
|
-
architect: default with write hooks limited to architecture-plan.md, docs-sync-report.md,
|
|
785
|
+
project-manager: default with write hooks limited to task briefs, role commands, handoff metadata, state files, final reports, and PR description
|
|
786
|
+
architect: default with write hooks limited to architecture-plan.md, docs-sync-report.md, durable plan updates, and approved durable docs
|
|
776
787
|
coder: default or acceptEdits, but only inside approved scope
|
|
777
788
|
reviewer: default with production-code writes blocked except explicitly review-scoped small fixes; test writes allowed
|
|
778
789
|
specialist: default with write hooks limited to specialist reports, tests, and approved files
|
|
@@ -787,7 +798,7 @@ Role sessions communicate through files, not memory from previous chats.
|
|
|
787
798
|
Required handoff directory:
|
|
788
799
|
|
|
789
800
|
```text
|
|
790
|
-
.ai/
|
|
801
|
+
.ai/handoffs/
|
|
791
802
|
role-commands/
|
|
792
803
|
architect.md
|
|
793
804
|
coder.md
|
|
@@ -804,26 +815,26 @@ Each role session must start by reading the artifacts it depends on:
|
|
|
804
815
|
```text
|
|
805
816
|
project-manager
|
|
806
817
|
reads: user request, repo entry docs, task state, role outputs
|
|
807
|
-
writes: task
|
|
818
|
+
writes: task brief, role commands, progress/status, known issues, final acceptance report
|
|
808
819
|
|
|
809
820
|
architect
|
|
810
|
-
reads: task request, task
|
|
821
|
+
reads: task request, task brief, ARCHITECTURE.md, MODULE_MAP.md, module-local CLAUDE.md, relevant source/tests
|
|
811
822
|
writes: architecture-plan.md
|
|
812
823
|
|
|
813
824
|
architect docs sync
|
|
814
|
-
reads: task
|
|
825
|
+
reads: task brief, architecture-plan.md, implementation-log.md, validation-log.md, review-report.md, git diff, relevant docs
|
|
815
826
|
writes: docs updates when needed, docs-sync-report.md
|
|
816
827
|
|
|
817
828
|
coder
|
|
818
|
-
reads: task
|
|
829
|
+
reads: task brief, architecture-plan.md, relevant module docs
|
|
819
830
|
writes: code, baseline tests, implementation-log.md, validation-log.md
|
|
820
831
|
|
|
821
832
|
reviewer
|
|
822
|
-
reads: task
|
|
833
|
+
reads: task brief, architecture-plan.md, implementation-log.md, validation-log.md, git diff
|
|
823
834
|
writes: review-report.md
|
|
824
835
|
|
|
825
836
|
optional specialist
|
|
826
|
-
reads: task
|
|
837
|
+
reads: task brief, architecture-plan.md, relevant source/tests
|
|
827
838
|
writes: specialist report, approved tests, validation-log.md
|
|
828
839
|
```
|
|
829
840
|
|
|
@@ -881,7 +892,7 @@ escalate to architect:
|
|
|
881
892
|
the implementation reveals that the architecture plan is invalid
|
|
882
893
|
```
|
|
883
894
|
|
|
884
|
-
For a task with a handoff directory,
|
|
895
|
+
For a task with a handoff directory, the task-level `validation-log.md` is the authoritative validation record for that task. Do not maintain a separate rolling validation log as durable truth; completed validation evidence should survive through tests, CI, commits, PR text, or explicitly preserved plans.
|
|
885
896
|
|
|
886
897
|
For complex or high-risk work, the next role must not start until the required previous artifact exists and is coherent.
|
|
887
898
|
|
|
@@ -966,7 +977,7 @@ Worktree isolation is by task, not by role:
|
|
|
966
977
|
```text
|
|
967
978
|
one task
|
|
968
979
|
-> one branch: feature/<task-slug>
|
|
969
|
-
-> one worktree:
|
|
980
|
+
-> one worktree: <task-worktree-root>/<task-slug>
|
|
970
981
|
-> one handoff directory
|
|
971
982
|
-> architect -> coder -> reviewer in sequence
|
|
972
983
|
```
|
|
@@ -1037,14 +1048,14 @@ You are the architecture and planning role for this project.
|
|
|
1037
1048
|
|
|
1038
1049
|
# Required Inputs
|
|
1039
1050
|
|
|
1040
|
-
- task
|
|
1051
|
+
- task brief or user request
|
|
1041
1052
|
- `docs/ARCHITECTURE.md`
|
|
1042
1053
|
- `docs/MODULE_MAP.md`
|
|
1043
1054
|
- relevant module-local `CLAUDE.md`
|
|
1044
1055
|
|
|
1045
1056
|
# Outputs
|
|
1046
1057
|
|
|
1047
|
-
- `.ai/
|
|
1058
|
+
- `.ai/handoffs/architecture-plan.md`
|
|
1048
1059
|
|
|
1049
1060
|
# Do Not
|
|
1050
1061
|
|
|
@@ -1072,7 +1083,7 @@ project-manager.md
|
|
|
1072
1083
|
required inputs:
|
|
1073
1084
|
user request, repo entry docs, current task state, role outputs
|
|
1074
1085
|
outputs:
|
|
1075
|
-
task
|
|
1086
|
+
task brief, role commands, progress/status updates, final acceptance report
|
|
1076
1087
|
do not:
|
|
1077
1088
|
implement non-trivial production code, replace architect/coder/reviewer, approve without reviewer evidence
|
|
1078
1089
|
stop when:
|
|
@@ -1083,7 +1094,7 @@ architect.md
|
|
|
1083
1094
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
1084
1095
|
permissionMode: default
|
|
1085
1096
|
required inputs:
|
|
1086
|
-
task
|
|
1097
|
+
task brief, ARCHITECTURE.md, MODULE_MAP.md, module-local CLAUDE.md
|
|
1087
1098
|
outputs:
|
|
1088
1099
|
architecture-plan.md
|
|
1089
1100
|
do not:
|
|
@@ -1096,7 +1107,7 @@ coder.md
|
|
|
1096
1107
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
1097
1108
|
permissionMode: default
|
|
1098
1109
|
required inputs:
|
|
1099
|
-
task
|
|
1110
|
+
task brief, architecture-plan.md
|
|
1100
1111
|
outputs:
|
|
1101
1112
|
code, baseline tests, implementation-log.md, validation-log.md
|
|
1102
1113
|
do not:
|
|
@@ -1109,7 +1120,7 @@ reviewer.md
|
|
|
1109
1120
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
1110
1121
|
permissionMode: default
|
|
1111
1122
|
required inputs:
|
|
1112
|
-
task
|
|
1123
|
+
task brief, architecture-plan.md, implementation-log.md, validation-log.md, git diff
|
|
1113
1124
|
outputs:
|
|
1114
1125
|
review-report.md, missing tests/fixtures when needed, review-scoped small fixes, validation-log.md
|
|
1115
1126
|
do not:
|
|
@@ -1144,7 +1155,7 @@ project-manager session
|
|
|
1144
1155
|
-> final acceptance + commit + PR submission
|
|
1145
1156
|
```
|
|
1146
1157
|
|
|
1147
|
-
For small bug fixes or ordinary PRs, one coder session is acceptable if the task
|
|
1158
|
+
For small bug fixes or ordinary PRs, one coder session is acceptable if the task brief is clear, file responsibilities are explicit, public contracts are defined when needed, and validation is cheap.
|
|
1148
1159
|
|
|
1149
1160
|
For complex features, cross-module changes, public API changes, schema changes, auth, payment, permissions, data deletion, or security-sensitive work, role sessions are required.
|
|
1150
1161
|
|
|
@@ -1186,12 +1197,14 @@ L4 full-regression: nightly / release only
|
|
|
1186
1197
|
### 8.2 Commands
|
|
1187
1198
|
|
|
1188
1199
|
```text
|
|
1189
|
-
tools/check-fast
|
|
1190
|
-
tools/check-changed
|
|
1191
|
-
tools/check-module <module>
|
|
1192
|
-
tools/check-e2e-smoke [scope]
|
|
1193
|
-
tools/check-e2e-release
|
|
1194
|
-
tools/check-full
|
|
1200
|
+
.ai/tools/check-fast
|
|
1201
|
+
.ai/tools/check-changed
|
|
1202
|
+
.ai/tools/check-module <module>
|
|
1203
|
+
.ai/tools/check-e2e-smoke [scope]
|
|
1204
|
+
.ai/tools/check-e2e-release
|
|
1205
|
+
.ai/tools/check-full
|
|
1206
|
+
.ai/tools/run-long-check
|
|
1207
|
+
.ai/tools/watch-job
|
|
1195
1208
|
```
|
|
1196
1209
|
|
|
1197
1210
|
What Claude should run:
|
|
@@ -1223,7 +1236,59 @@ release / major version / high-risk migration:
|
|
|
1223
1236
|
L0 + L1 + L2 + L3 + L4
|
|
1224
1237
|
```
|
|
1225
1238
|
|
|
1226
|
-
### 8.3
|
|
1239
|
+
### 8.3 Long-Running Validation
|
|
1240
|
+
|
|
1241
|
+
Do not end the current Claude Code turn only to wait for a long-running build or test callback. That callback-based waiting model is unreliable: the callback can be delayed, lost, or resumed with stale context.
|
|
1242
|
+
|
|
1243
|
+
Use a project skill instead:
|
|
1244
|
+
|
|
1245
|
+
```text
|
|
1246
|
+
.claude/skills/long-running-validation.md
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
The skill should instruct Claude to:
|
|
1250
|
+
|
|
1251
|
+
```text
|
|
1252
|
+
1. Start the long-running command through `.ai/tools/run-long-check`.
|
|
1253
|
+
2. Write status and logs under `.ai/jobs/<job-id>/` or the harness-managed runtime job directory.
|
|
1254
|
+
3. Run `.ai/tools/watch-job` in the same turn with a bounded timeout.
|
|
1255
|
+
4. Exit with success, failure, or timeout.
|
|
1256
|
+
5. Read the final status and relevant log tail.
|
|
1257
|
+
6. Record the command, result, duration, and skipped/follow-up checks in validation-log.md.
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
Recommended job files:
|
|
1261
|
+
|
|
1262
|
+
```text
|
|
1263
|
+
.ai/jobs/<job-id>/status.json
|
|
1264
|
+
.ai/jobs/<job-id>/stdout.log
|
|
1265
|
+
.ai/jobs/<job-id>/stderr.log
|
|
1266
|
+
```
|
|
1267
|
+
|
|
1268
|
+
`status.json` should include:
|
|
1269
|
+
|
|
1270
|
+
```json
|
|
1271
|
+
{
|
|
1272
|
+
"jobId": "check-e2e-20260606-001",
|
|
1273
|
+
"command": ".ai/tools/check-e2e-smoke --run",
|
|
1274
|
+
"status": "running",
|
|
1275
|
+
"startedAt": "2026-06-06T00:00:00Z",
|
|
1276
|
+
"finishedAt": null,
|
|
1277
|
+
"exitCode": null,
|
|
1278
|
+
"stdoutPath": ".ai/jobs/check-e2e-20260606-001/stdout.log",
|
|
1279
|
+
"stderrPath": ".ai/jobs/check-e2e-20260606-001/stderr.log"
|
|
1280
|
+
}
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
Rules:
|
|
1284
|
+
|
|
1285
|
+
- The watcher must be bounded and exit on success, failure, or timeout.
|
|
1286
|
+
- Claude must not hand-write an infinite shell loop.
|
|
1287
|
+
- Claude must not rely on ending the conversation to receive a shell-completion callback.
|
|
1288
|
+
- Timeout is a result. Record it, summarize the log tail, and route the blocker through the normal handoff / Replan path.
|
|
1289
|
+
- Job state under `.ai/jobs/**` or the harness-managed runtime job directory is runtime state. Delete it during task close after useful facts are promoted.
|
|
1290
|
+
|
|
1291
|
+
### 8.4 Change-Aware Test Selection
|
|
1227
1292
|
|
|
1228
1293
|
Do not maintain a manual test map. Generate or verify a test map from source code, test naming conventions, coverage data, build metadata, and CI history.
|
|
1229
1294
|
|
|
@@ -1248,10 +1313,10 @@ Rules:
|
|
|
1248
1313
|
|
|
1249
1314
|
- `.ai/generated/test-map.json` is a derived artifact, not a hand-edited source of truth.
|
|
1250
1315
|
- Manual edits to generated test maps are forbidden.
|
|
1251
|
-
-
|
|
1252
|
-
- If the map cannot be generated reliably,
|
|
1316
|
+
- `.ai/tools/check-generated-artifacts` fails in CI if the generated map is stale.
|
|
1317
|
+
- If the map cannot be generated reliably, `.ai/tools/check-changed` must fall back to code search, LSP, ownership metadata, and conservative module-level tests.
|
|
1253
1318
|
|
|
1254
|
-
|
|
1319
|
+
`.ai/tools/check-changed` should:
|
|
1255
1320
|
|
|
1256
1321
|
```text
|
|
1257
1322
|
git diff
|
|
@@ -1263,7 +1328,7 @@ git diff
|
|
|
1263
1328
|
-> if critical user path changed, suggest L3
|
|
1264
1329
|
```
|
|
1265
1330
|
|
|
1266
|
-
### 8.
|
|
1331
|
+
### 8.5 E2E Tiers
|
|
1267
1332
|
|
|
1268
1333
|
```text
|
|
1269
1334
|
e2e/
|
|
@@ -1283,7 +1348,7 @@ e2e/
|
|
|
1283
1348
|
upgrade-migration.spec.ts
|
|
1284
1349
|
```
|
|
1285
1350
|
|
|
1286
|
-
Smoke E2E: small, stable, core paths, runnable on every PR or high-risk change.
|
|
1351
|
+
Smoke E2E: small, stable, core paths, runnable on every PR or high-risk change.
|
|
1287
1352
|
Release E2E: complex combinations, historical incidents, cross-browser, slower but non-flaky, run before release or nightly.
|
|
1288
1353
|
|
|
1289
1354
|
Test tags:
|
|
@@ -1293,7 +1358,7 @@ Test tags:
|
|
|
1293
1358
|
@billing @auth @risk-high @public-api @contract
|
|
1294
1359
|
```
|
|
1295
1360
|
|
|
1296
|
-
### 8.
|
|
1361
|
+
### 8.6 Public Function Test Contract
|
|
1297
1362
|
|
|
1298
1363
|
Every new or modified public function must have tests covering its contract.
|
|
1299
1364
|
|
|
@@ -1331,7 +1396,7 @@ internal helper call counts
|
|
|
1331
1396
|
local implementation steps
|
|
1332
1397
|
```
|
|
1333
1398
|
|
|
1334
|
-
### 8.
|
|
1399
|
+
### 8.7 Test Quality Red Lines
|
|
1335
1400
|
|
|
1336
1401
|
Forbidden:
|
|
1337
1402
|
|
|
@@ -1367,8 +1432,8 @@ Recommended hooks:
|
|
|
1367
1432
|
|
|
1368
1433
|
```text
|
|
1369
1434
|
Stop:
|
|
1370
|
-
notify
|
|
1371
|
-
trigger
|
|
1435
|
+
notify the harness manager that a role turn ended
|
|
1436
|
+
trigger the harness manager to scan task-local route files for pending messages
|
|
1372
1437
|
|
|
1373
1438
|
PreToolUse:
|
|
1374
1439
|
block protected files
|
|
@@ -1386,7 +1451,7 @@ PostToolUse:
|
|
|
1386
1451
|
Stop:
|
|
1387
1452
|
switch the role activity state to idle
|
|
1388
1453
|
check project manager did not bypass required role route
|
|
1389
|
-
check task
|
|
1454
|
+
check task risk and required role route
|
|
1390
1455
|
check required handoff artifacts exist
|
|
1391
1456
|
check required validation
|
|
1392
1457
|
check task-level validation-log.md updated when handoffs exist
|
|
@@ -1400,7 +1465,7 @@ SessionStart:
|
|
|
1400
1465
|
show that task coordination should use `claude --agent project-manager`
|
|
1401
1466
|
warn when a non-trivial task is running in an untagged session
|
|
1402
1467
|
show current role and expected role for the task
|
|
1403
|
-
show required handoff artifacts for the
|
|
1468
|
+
show required handoff artifacts for the required route
|
|
1404
1469
|
inject current task state
|
|
1405
1470
|
show recent failing checks
|
|
1406
1471
|
show module owner and validation commands
|
|
@@ -1425,6 +1490,109 @@ Lockfiles and migrations are not permanently forbidden, but they require explici
|
|
|
1425
1490
|
|
|
1426
1491
|
If you type the same long prompt for the third time, turn it into a skill or command.
|
|
1427
1492
|
|
|
1493
|
+
Skill placement:
|
|
1494
|
+
|
|
1495
|
+
```text
|
|
1496
|
+
CLAUDE.md
|
|
1497
|
+
-> short mandatory rules
|
|
1498
|
+
|
|
1499
|
+
docs/AI_WORKFLOW.md
|
|
1500
|
+
-> role route, gates, handoff protocol, acceptance policy
|
|
1501
|
+
|
|
1502
|
+
.claude/agents/*.md
|
|
1503
|
+
-> role ownership and stop conditions
|
|
1504
|
+
|
|
1505
|
+
.claude/skills/*.md
|
|
1506
|
+
-> reusable operating procedures
|
|
1507
|
+
|
|
1508
|
+
.ai/tools/*
|
|
1509
|
+
-> deterministic execution
|
|
1510
|
+
```
|
|
1511
|
+
|
|
1512
|
+
Good skill candidates:
|
|
1513
|
+
|
|
1514
|
+
- `route-message`
|
|
1515
|
+
- `long-running-validation`
|
|
1516
|
+
- `final-acceptance`
|
|
1517
|
+
- `docs-sync`
|
|
1518
|
+
- `replan`
|
|
1519
|
+
- `harness-bootstrap`
|
|
1520
|
+
- `harness-maintenance`
|
|
1521
|
+
- `known-issues-triage`
|
|
1522
|
+
- `task-cleanup`
|
|
1523
|
+
|
|
1524
|
+
Hard constraints must not live only in skills. Role boundaries, default routes, high-risk approval rules, protected-file rules, route-file turn rules, and durable-doc ownership must remain in `CLAUDE.md`, `docs/AI_WORKFLOW.md`, role agent files, hooks, or CI checks.
|
|
1525
|
+
|
|
1526
|
+
One-off or occasional procedures do not always need to be committed as repo-local skill files. Harness bootstrap and harness maintenance can be injected as temporary session procedures when their main purpose is to guide a single analysis/audit run. Keep deterministic installation, managed-block updates, hook merging, manifest migration, and uninstall logic in tools or backend code.
|
|
1527
|
+
|
|
1528
|
+
### `route-message` Skill
|
|
1529
|
+
|
|
1530
|
+
Use this skill when a role needs to hand work, ask a question, report a result, report a blocker, or raise a finding to another role.
|
|
1531
|
+
|
|
1532
|
+
Hard rule for `CLAUDE.md` / `docs/AI_WORKFLOW.md`:
|
|
1533
|
+
|
|
1534
|
+
```text
|
|
1535
|
+
When sending a role message, use the route-message skill.
|
|
1536
|
+
After writing the route file, end the current turn.
|
|
1537
|
+
Do not poll, loop, or wait for another role's answer.
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
Skill contract:
|
|
1541
|
+
|
|
1542
|
+
- write or update exactly one route file under the task-local handoff messages directory
|
|
1543
|
+
- keep the filename as the authoritative route
|
|
1544
|
+
- use only the allowed message types for the route
|
|
1545
|
+
- include artifact references instead of copying long handoff documents
|
|
1546
|
+
- update an existing pending route file instead of creating fragmented follow-ups
|
|
1547
|
+
- leave backend delivery, history, target-idle checks, and route-file clearing to the harness manager
|
|
1548
|
+
|
|
1549
|
+
The skill is an authoring procedure, not a transport. It must not paste directly into another role terminal or bypass the harness manager.
|
|
1550
|
+
|
|
1551
|
+
### `long-running-validation` Skill
|
|
1552
|
+
|
|
1553
|
+
Use this skill for builds, test suites, browser/E2E runs, or validation commands that may exceed the normal interactive shell timeout.
|
|
1554
|
+
|
|
1555
|
+
Hard rule for `CLAUDE.md` / `docs/AI_WORKFLOW.md`:
|
|
1556
|
+
|
|
1557
|
+
```text
|
|
1558
|
+
Do not end the current turn only to wait for a long-running shell callback.
|
|
1559
|
+
Use the long-running-validation skill and bounded job watcher.
|
|
1560
|
+
```
|
|
1561
|
+
|
|
1562
|
+
Skill contract:
|
|
1563
|
+
|
|
1564
|
+
- start the job through `.ai/tools/run-long-check`
|
|
1565
|
+
- write job status and logs under `.ai/jobs/<job-id>/` or the harness-managed runtime job directory
|
|
1566
|
+
- run `.ai/tools/watch-job` in the same turn
|
|
1567
|
+
- watcher exits on success, failure, or timeout
|
|
1568
|
+
- summarize the final status and log tail
|
|
1569
|
+
- record the result in the task `validation-log.md`
|
|
1570
|
+
- route failures or timeouts through the normal handoff / Replan path
|
|
1571
|
+
|
|
1572
|
+
Do not implement this by asking Claude to keep an infinite loop open. The loop belongs inside the project tool, with a bounded timeout and clear output.
|
|
1573
|
+
|
|
1574
|
+
### `docs-sync` Skill
|
|
1575
|
+
|
|
1576
|
+
Use this skill after implementation and review, before final acceptance or PR preparation, when code changes may affect long-term project documentation.
|
|
1577
|
+
|
|
1578
|
+
Hard rule for `CLAUDE.md` / `docs/AI_WORKFLOW.md`:
|
|
1579
|
+
|
|
1580
|
+
```text
|
|
1581
|
+
The architecture/documentation owner performs docs sync after review.
|
|
1582
|
+
Final acceptance checks the docs-sync result; it does not replace it.
|
|
1583
|
+
```
|
|
1584
|
+
|
|
1585
|
+
Skill contract:
|
|
1586
|
+
|
|
1587
|
+
- read the task brief or durable plan, architecture plan, implementation evidence, validation evidence, review findings, current diff, and affected durable docs
|
|
1588
|
+
- check architecture, module boundaries, public contracts, validation strategy, security assumptions, dependency direction, and durable plan state
|
|
1589
|
+
- update long-term docs when implementation changed durable project truth
|
|
1590
|
+
- explicitly list docs reviewed and left unchanged
|
|
1591
|
+
- write a task-local docs-sync report with decision, evidence, docs updated, docs unchanged, remaining documentation risks, and final-acceptance notes
|
|
1592
|
+
- route architecture or contract drift back through the normal Replan path
|
|
1593
|
+
|
|
1594
|
+
The skill may edit durable documentation, but it must not edit production code, tests, or generated artifacts unless a project-specific generator/check owns that output.
|
|
1595
|
+
|
|
1428
1596
|
Recommended subagents:
|
|
1429
1597
|
|
|
1430
1598
|
```text
|
|
@@ -1450,7 +1618,7 @@ Default rule:
|
|
|
1450
1618
|
```text
|
|
1451
1619
|
one task
|
|
1452
1620
|
-> one branch: feature/<task-slug>
|
|
1453
|
-
-> one worktree:
|
|
1621
|
+
-> one worktree: <task-worktree-root>/<task-slug>
|
|
1454
1622
|
-> one handoff directory
|
|
1455
1623
|
-> one PR
|
|
1456
1624
|
```
|
|
@@ -1490,18 +1658,18 @@ Branch rules:
|
|
|
1490
1658
|
|
|
1491
1659
|
- never do AI implementation work directly on the main branch
|
|
1492
1660
|
- one task branch should map to one task worktree
|
|
1493
|
-
-
|
|
1494
|
-
-
|
|
1495
|
-
- `.gitignore` should
|
|
1661
|
+
- harness-managed task branches should use a stable task naming convention, for example `feature/<task-slug>`
|
|
1662
|
+
- harness-managed task worktrees should live under a repo-local ignored worktree root
|
|
1663
|
+
- `.gitignore` should ignore harness runtime state and repo-local task worktrees
|
|
1496
1664
|
- a task should not switch to a different branch/worktree after creation; create a new task instead
|
|
1497
1665
|
- large work should use phase commits on the same task branch unless phases are independently releasable
|
|
1498
1666
|
- if a task becomes too large, split it into child tasks with explicit branch and PR ownership
|
|
1499
1667
|
|
|
1500
|
-
|
|
1668
|
+
Task close rules:
|
|
1501
1669
|
|
|
1502
|
-
- after task completion,
|
|
1503
|
-
- for worktree-backed tasks,
|
|
1504
|
-
-
|
|
1670
|
+
- after task completion, close the task only when the user is ready to delete task-local state
|
|
1671
|
+
- for worktree-backed tasks, task close may delete the task worktree, optionally delete the task branch, and remove task/session/message/orchestration/handoff metadata
|
|
1672
|
+
- task close may stop harness-managed running role sessions, but it must not silently discard uncommitted changes; finish, commit, or preserve anything important before using it
|
|
1505
1673
|
|
|
1506
1674
|
Small commits:
|
|
1507
1675
|
|
|
@@ -1514,14 +1682,14 @@ Small commits:
|
|
|
1514
1682
|
|
|
1515
1683
|
Diff discipline:
|
|
1516
1684
|
|
|
1517
|
-
- every changed file must trace to the task
|
|
1685
|
+
- every changed file must trace to the task brief, architecture plan, implementation log, validation log, or reviewer fix
|
|
1518
1686
|
- before handoff, coder must inspect `git diff` for unrelated changes, architecture drift, accidental formatting churn, generated artifacts, lockfiles, and migrations
|
|
1519
1687
|
- before acceptance, reviewer must compare `git diff` against the architecture plan and public contracts
|
|
1520
1688
|
- unrelated cleanup belongs in a separate task
|
|
1521
1689
|
|
|
1522
1690
|
PR discipline:
|
|
1523
1691
|
|
|
1524
|
-
- PR description must link or summarize task
|
|
1692
|
+
- PR description must link or summarize task brief, architecture plan, validation evidence, docs sync, and known risks
|
|
1525
1693
|
- draft PRs are preferred for large or phased work
|
|
1526
1694
|
- PR review must check scope, architecture compliance, public contracts, test adequacy, docs sync, and whether the diff is appropriately small
|
|
1527
1695
|
- final merge requires human accountability for product semantics, security boundaries, and business risk
|
|
@@ -1542,11 +1710,10 @@ Do not rely only on grep. In large codebases, grep easily finds the wrong symbol
|
|
|
1542
1710
|
Provide:
|
|
1543
1711
|
|
|
1544
1712
|
```text
|
|
1545
|
-
tools/
|
|
1546
|
-
tools/find-
|
|
1547
|
-
tools/find-
|
|
1548
|
-
tools/
|
|
1549
|
-
tools/check-boundaries
|
|
1713
|
+
.ai/tools/find-owner <path>
|
|
1714
|
+
.ai/tools/find-callers <symbol>
|
|
1715
|
+
.ai/tools/find-tests <path>
|
|
1716
|
+
.ai/tools/check-boundaries
|
|
1550
1717
|
```
|
|
1551
1718
|
|
|
1552
1719
|
If LSP, Sourcegraph, code search, or MCP is available, Claude should prefer them.
|
|
@@ -1581,7 +1748,7 @@ Example generated module index:
|
|
|
1581
1748
|
"docs": ["docs/modules/billing.md"],
|
|
1582
1749
|
"entrypoints": ["services/billing/invoice/calculator.ts"],
|
|
1583
1750
|
"tests": ["tests/billing/invoice-calculator.test.ts"],
|
|
1584
|
-
"commands": ["tools/check-module billing"],
|
|
1751
|
+
"commands": [".ai/tools/check-module billing"],
|
|
1585
1752
|
"rules": [
|
|
1586
1753
|
"Use Money object for all amounts",
|
|
1587
1754
|
"Do not import from payment/adapters/internal"
|
|
@@ -1594,15 +1761,15 @@ Rules:
|
|
|
1594
1761
|
|
|
1595
1762
|
- generated artifacts are caches, not truth
|
|
1596
1763
|
- manual edits to `.ai/generated/**` are forbidden
|
|
1597
|
-
- CI must run
|
|
1764
|
+
- CI must run `.ai/tools/check-generated-artifacts`
|
|
1598
1765
|
- if a generated artifact is stale, Claude must regenerate it or fall back to live code search
|
|
1599
1766
|
- if generated context conflicts with live code, live code wins
|
|
1600
1767
|
|
|
1601
1768
|
Architecture boundaries must be mechanically checked:
|
|
1602
1769
|
|
|
1603
1770
|
```text
|
|
1604
|
-
tools/check-boundaries
|
|
1605
|
-
tools/check-generated-artifacts
|
|
1771
|
+
.ai/tools/check-boundaries
|
|
1772
|
+
.ai/tools/check-generated-artifacts
|
|
1606
1773
|
```
|
|
1607
1774
|
|
|
1608
1775
|
and enforced in CI.
|
|
@@ -1611,52 +1778,50 @@ and enforced in CI.
|
|
|
1611
1778
|
|
|
1612
1779
|
Long tasks cannot rely on chat context.
|
|
1613
1780
|
|
|
1614
|
-
|
|
1781
|
+
Task runtime and durable issue files:
|
|
1615
1782
|
|
|
1616
1783
|
```text
|
|
1617
|
-
.ai/
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
scratch.md — current session's working TODOs (cleared at task completion)
|
|
1784
|
+
.ai/handoffs/
|
|
1785
|
+
validation-log.md — task-local validation evidence
|
|
1786
|
+
known-issues.md — task-local unresolved findings
|
|
1787
|
+
|
|
1788
|
+
docs/known-issues.md — confirmed unresolved issues that must survive across tasks
|
|
1623
1789
|
```
|
|
1624
1790
|
|
|
1625
1791
|
Validation log authority:
|
|
1626
1792
|
|
|
1627
|
-
-
|
|
1628
|
-
-
|
|
1793
|
+
- the task-level handoff `validation-log.md` is authoritative for one task.
|
|
1794
|
+
- completed validation evidence should not be copied into a separate rolling state file as current truth.
|
|
1629
1795
|
- Final reports and review reports should cite the task-level validation log, not scattered chat output.
|
|
1630
1796
|
|
|
1631
1797
|
Information lifetime determines where it lives:
|
|
1632
1798
|
|
|
1633
1799
|
```text
|
|
1634
1800
|
within one session (phase breakdown, mid-implementation TODOs)
|
|
1635
|
-
-> scratch
|
|
1801
|
+
-> task-local scratch notes or role command updates
|
|
1802
|
+
|
|
1803
|
+
across sessions of one task (progress, pending decisions)
|
|
1804
|
+
-> durable plan current-state section when the plan should survive
|
|
1805
|
+
-> otherwise task-local handoff/runtime state that is deleted at close
|
|
1636
1806
|
|
|
1637
|
-
|
|
1638
|
-
->
|
|
1639
|
-
-> otherwise progress.md + decisions.md
|
|
1807
|
+
durable architecture, testing, security, dependency, or module facts
|
|
1808
|
+
-> docs/ARCHITECTURE.md, docs/TESTING.md, docs/SECURITY.md, docs/DEPENDENCY_RULES.md, docs/MODULE_MAP.md, or module-local CLAUDE.md
|
|
1640
1809
|
|
|
1641
1810
|
across tasks (deferred findings, out-of-scope discoveries)
|
|
1642
|
-
-> known-issues.md
|
|
1811
|
+
-> docs/known-issues.md
|
|
1643
1812
|
```
|
|
1644
1813
|
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
- Snapshot, not log. Holds current status of every active task in one place.
|
|
1648
|
-
- One entry per active task; entry is rewritten in place, not appended.
|
|
1649
|
-
- When a task has an `exec-plan`, its detailed progress lives in the exec-plan's `current state`; `progress.md` keeps only a one-line pointer.
|
|
1650
|
-
- Completed tasks are removed from `progress.md`; their final state is preserved in the archived exec-plan or commit history.
|
|
1814
|
+
Task-local state rules:
|
|
1651
1815
|
|
|
1652
|
-
|
|
1816
|
+
- Progress, scratch notes, pending decisions, and validation evidence are temporary task runtime state.
|
|
1817
|
+
- Completed task state is deleted or archived only when it still has real future value.
|
|
1818
|
+
- Durable architecture truth belongs in `docs/ARCHITECTURE.md`.
|
|
1819
|
+
- Durable testing decisions belong in `docs/TESTING.md`.
|
|
1820
|
+
- Durable security decisions belong in `docs/SECURITY.md`.
|
|
1821
|
+
- Durable dependency or module-boundary decisions belong in `docs/DEPENDENCY_RULES.md`, `docs/MODULE_MAP.md`, or module-local `CLAUDE.md`.
|
|
1822
|
+
- Rare historical rationale that should remain discoverable but does not fit the current-state docs may move to an optional ADR file, for example `docs/adr/<id>.md`.
|
|
1653
1823
|
|
|
1654
|
-
-
|
|
1655
|
-
- Cleared when the task completes or when a fresh session starts.
|
|
1656
|
-
- Anything that must survive (decisions, deferred findings, progress) is promoted to `decisions.md`, `known-issues.md`, `progress.md`, or the exec-plan before clearing.
|
|
1657
|
-
- This file is the legitimate home for the working TODOs that `Stop` hook forbids inside source code.
|
|
1658
|
-
|
|
1659
|
-
`known-issues.md` entry format:
|
|
1824
|
+
`docs/known-issues.md` entry format:
|
|
1660
1825
|
|
|
1661
1826
|
```md
|
|
1662
1827
|
## YYYY-MM-DD <one-line summary>
|
|
@@ -1682,13 +1847,13 @@ Open issues:
|
|
|
1682
1847
|
Next step:
|
|
1683
1848
|
```
|
|
1684
1849
|
|
|
1685
|
-
For
|
|
1850
|
+
For large, multi-phase, or multi-day tasks, create:
|
|
1686
1851
|
|
|
1687
1852
|
```text
|
|
1688
|
-
docs/
|
|
1853
|
+
docs/plans/active/<plan-name>.md
|
|
1689
1854
|
```
|
|
1690
1855
|
|
|
1691
|
-
|
|
1856
|
+
Durable plans include:
|
|
1692
1857
|
|
|
1693
1858
|
- background
|
|
1694
1859
|
- goal
|
|
@@ -1698,7 +1863,7 @@ Execution plans include:
|
|
|
1698
1863
|
- decision log
|
|
1699
1864
|
- current state
|
|
1700
1865
|
|
|
1701
|
-
When a task has
|
|
1866
|
+
When a task has a durable plan, `current state` in the plan is the authoritative progress record; task runtime state may point to it but should not duplicate it.
|
|
1702
1867
|
|
|
1703
1868
|
### 12.1 Documentation Sync Contract
|
|
1704
1869
|
|
|
@@ -1710,17 +1875,17 @@ Rule:
|
|
|
1710
1875
|
|
|
1711
1876
|
Check:
|
|
1712
1877
|
|
|
1713
|
-
- task
|
|
1714
|
-
-
|
|
1878
|
+
- task brief
|
|
1879
|
+
- durable plan
|
|
1715
1880
|
- `docs/ARCHITECTURE.md`
|
|
1716
1881
|
- `docs/MODULE_MAP.md`
|
|
1717
1882
|
- module docs
|
|
1718
1883
|
- module-local `CLAUDE.md`
|
|
1719
1884
|
- public surface contract
|
|
1720
1885
|
- test plan / validation section
|
|
1721
|
-
-
|
|
1722
|
-
-
|
|
1723
|
-
-
|
|
1886
|
+
- task-local pending decisions
|
|
1887
|
+
- task-local progress state
|
|
1888
|
+
- task-local known issues and `docs/known-issues.md`
|
|
1724
1889
|
|
|
1725
1890
|
Final report must list:
|
|
1726
1891
|
|
|
@@ -1734,9 +1899,84 @@ Enforcement:
|
|
|
1734
1899
|
|
|
1735
1900
|
- PR template must include a docs sync checklist covering plan, public contract, architecture, module docs, and test plan.
|
|
1736
1901
|
- Stop hook checks that plan, public contract, or test strategy changes have matching doc updates before the session ends.
|
|
1737
|
-
-
|
|
1902
|
+
- `.ai/tools/check-docs-freshness` runs in CI and fails the build when code touching tracked surfaces lands without corresponding doc updates.
|
|
1903
|
+
|
|
1904
|
+
### 12.2 Documentation Lifecycle and Cleanup
|
|
1905
|
+
|
|
1906
|
+
The rule is:
|
|
1907
|
+
|
|
1908
|
+
> Temporary task documents must be deleted or archived when they stop being useful; long-term project documents must be updated when the task changes durable project truth.
|
|
1909
|
+
|
|
1910
|
+
AI coding creates many coordination artifacts. Those artifacts are useful while a task is moving, but harmful after completion if they become stale pseudo-documentation. A clean repository should preserve durable knowledge, not every intermediate note.
|
|
1911
|
+
|
|
1912
|
+
Documentation lifetime categories:
|
|
1913
|
+
|
|
1914
|
+
```text
|
|
1915
|
+
runtime / disposable
|
|
1916
|
+
-> route messages, raw logs, translation cache, session records, orchestration records
|
|
1917
|
+
|
|
1918
|
+
task-local / temporary
|
|
1919
|
+
-> task briefs, role commands, architecture-plan.md, implementation-log.md,
|
|
1920
|
+
validation-log.md, known-issues.md, review-report.md, docs-sync-report.md,
|
|
1921
|
+
scratch notes and decision staging entries
|
|
1922
|
+
|
|
1923
|
+
durable / source of truth
|
|
1924
|
+
-> ARCHITECTURE.md, MODULE_MAP.md, TESTING.md, SECURITY.md,
|
|
1925
|
+
DEPENDENCY_RULES.md, module-local CLAUDE.md, accepted public contracts,
|
|
1926
|
+
code, tests, commit messages, PR text
|
|
1927
|
+
|
|
1928
|
+
archival / exceptional
|
|
1929
|
+
-> completed plans or optional ADRs for large features, migrations,
|
|
1930
|
+
incidents, or high-value historical rationale
|
|
1931
|
+
```
|
|
1932
|
+
|
|
1933
|
+
Cleanup rules:
|
|
1934
|
+
|
|
1935
|
+
- Harness runtime artifacts are not long-term project documentation. They should be removed by task close after the user has preserved anything important in durable docs, source, commit messages, or PR text.
|
|
1936
|
+
- Role route files under the task-local handoff messages directory are pending message queues. After dispatch, manual handling, or task close, they should be blank or deleted with the task state.
|
|
1937
|
+
- Raw terminal logs are recovery/debug evidence. They should not be retained as project knowledge after task close unless an incident review explicitly needs them.
|
|
1938
|
+
- Task briefs captured in role commands, handoffs, issues, or PR text are temporary unless the requirements remain useful as durable product or engineering knowledge. Large, multi-phase work should promote durable requirements into `docs/plans/active/<plan-name>.md`.
|
|
1939
|
+
- `architecture-plan.md` is a task handoff artifact. Durable architecture changes must be promoted to `docs/ARCHITECTURE.md`, `docs/MODULE_MAP.md`, `docs/DEPENDENCY_RULES.md`, or module-local `CLAUDE.md`.
|
|
1940
|
+
- `implementation-log.md`, `review-report.md`, and `docs-sync-report.md` are task evidence. They should not become long-term docs unless their findings are promoted to durable docs or PR text.
|
|
1941
|
+
- `validation-log.md` is useful evidence during acceptance. After merge, the durable facts are the passing tests, CI history, and PR/commit record; stale local validation logs should not be treated as current truth.
|
|
1942
|
+
- Pending decisions are task-local staging notes. Confirmed durable decisions should be moved into the appropriate long-term doc and then removed from task state.
|
|
1943
|
+
- `docs/known-issues.md` must be actively triaged. Fixed, rejected, obsolete, or no-longer-actionable issues should be removed or marked resolved with a short reason.
|
|
1944
|
+
- Completed plans should move to `docs/plans/completed/` only for work whose execution history remains useful. Routine tasks should not leave completed plans behind forever.
|
|
1945
|
+
|
|
1946
|
+
Promotion rules:
|
|
1947
|
+
|
|
1948
|
+
- Durable architecture facts go to `docs/ARCHITECTURE.md`.
|
|
1949
|
+
- Durable module ownership, file responsibility, or public surface facts go to `docs/MODULE_MAP.md` or module-local `CLAUDE.md`.
|
|
1950
|
+
- Durable testing policy, regression strategy, or E2E scope goes to `docs/TESTING.md`.
|
|
1951
|
+
- Durable security, auth, permission, privacy, or data-deletion policy goes to `docs/SECURITY.md`.
|
|
1952
|
+
- Durable dependency direction or forbidden-import rules go to `docs/DEPENDENCY_RULES.md`.
|
|
1953
|
+
- Durable public behavior belongs in code, tests, public contract docs, and PR text.
|
|
1954
|
+
- Deferred out-of-scope work goes to `docs/known-issues.md` only if it has owner-worthy future value; otherwise leave it out.
|
|
1955
|
+
|
|
1956
|
+
Task close checklist:
|
|
1957
|
+
|
|
1958
|
+
```text
|
|
1959
|
+
Before closing a task:
|
|
1960
|
+
1. Promote durable facts into long-term docs, tests, source, PR text, or commit messages.
|
|
1961
|
+
2. Remove or clear temporary route messages, scratch notes, and staging decisions.
|
|
1962
|
+
3. Decide whether task brief and plan should be deleted, archived, or kept active.
|
|
1963
|
+
4. Triage known-issues entries touched by the task.
|
|
1964
|
+
5. Confirm no stale task artifact is being used as current project truth.
|
|
1965
|
+
```
|
|
1966
|
+
|
|
1967
|
+
Final acceptance must state:
|
|
1968
|
+
|
|
1969
|
+
```text
|
|
1970
|
+
Temporary docs removed:
|
|
1971
|
+
Temporary docs archived:
|
|
1972
|
+
Durable docs updated:
|
|
1973
|
+
Known stale docs:
|
|
1974
|
+
Cleanup exceptions:
|
|
1975
|
+
```
|
|
1976
|
+
|
|
1977
|
+
Do not keep a document only because it was useful during the task. A document earns long-term residence only if it helps future humans or future AI sessions understand current project truth, durable rationale, or a still-open obligation.
|
|
1738
1978
|
|
|
1739
|
-
### 12.
|
|
1979
|
+
### 12.3 Replan Protocol
|
|
1740
1980
|
|
|
1741
1981
|
Triggers:
|
|
1742
1982
|
|
|
@@ -1781,7 +2021,7 @@ Low-risk deviations may continue with a note:
|
|
|
1781
2021
|
- private implementation detail changes
|
|
1782
2022
|
- scope, public surface, architecture boundary, and test contract stay unchanged
|
|
1783
2023
|
|
|
1784
|
-
### 12.
|
|
2024
|
+
### 12.4 Design Change Control
|
|
1785
2025
|
|
|
1786
2026
|
When a large feature is split into subtasks and a design defect is found midstream, do not default to full rollback, and do not continue because of sunk cost.
|
|
1787
2027
|
|
|
@@ -1793,7 +2033,7 @@ Freeze current implementation
|
|
|
1793
2033
|
-> Record completed subtasks
|
|
1794
2034
|
-> Identify design defect
|
|
1795
2035
|
-> Assess impact radius
|
|
1796
|
-
-> Classify
|
|
2036
|
+
-> Classify task risk
|
|
1797
2037
|
-> Compare options
|
|
1798
2038
|
-> Preserve reusable assets
|
|
1799
2039
|
-> Discard wrong boundaries/contracts/abstractions
|
|
@@ -1829,7 +2069,7 @@ B. Partial rollback + redesign
|
|
|
1829
2069
|
C. Full rollback + rebuild
|
|
1830
2070
|
```
|
|
1831
2071
|
|
|
1832
|
-
Prefer preserving tests, fixtures, docs, clarified requirements, types, UI components, validated pure functions, and low-level tools.
|
|
2072
|
+
Prefer preserving tests, fixtures, docs, clarified requirements, types, UI components, validated pure functions, and low-level tools.
|
|
1833
2073
|
Prefer discarding wrong public APIs, wrong module boundaries, wrong data models, wrong permission models, wrong abstractions, and glue code built around the wrong design.
|
|
1834
2074
|
|
|
1835
2075
|
Principle:
|
|
@@ -1856,8 +2096,8 @@ behavior is correct
|
|
|
1856
2096
|
|
|
1857
2097
|
## Scope
|
|
1858
2098
|
|
|
1859
|
-
- [ ]
|
|
1860
|
-
- [ ]
|
|
2099
|
+
- [ ] Changed files and meaningful hunks have traceable reasons.
|
|
2100
|
+
- [ ] Unexplained refactor, rename, formatting churn, or cleanup was explained, reverted, approved, or routed for follow-up.
|
|
1861
2101
|
- [ ] No forbidden files changed.
|
|
1862
2102
|
- [ ] No unapproved dependency added.
|
|
1863
2103
|
- [ ] No scope expansion without Replan.
|
|
@@ -1865,7 +2105,7 @@ behavior is correct
|
|
|
1865
2105
|
## Role / Handoff
|
|
1866
2106
|
|
|
1867
2107
|
- [ ] The task used an explicit `project-manager` role session for user communication, routing, and status reporting.
|
|
1868
|
-
- [ ] Task
|
|
2108
|
+
- [ ] Task risk and required route were classified.
|
|
1869
2109
|
- [ ] Required role route was followed or an exception was approved.
|
|
1870
2110
|
- [ ] The project manager verified required handoff artifacts, validation evidence, docs sync, and remaining risks.
|
|
1871
2111
|
- [ ] The project manager did not become the architect, coder, and reviewer for the same non-trivial task.
|
|
@@ -1876,10 +2116,10 @@ behavior is correct
|
|
|
1876
2116
|
- [ ] Any reviewer direct fixes were small, local, low-risk, and review-scoped.
|
|
1877
2117
|
- [ ] Larger implementation issues were returned to coder.
|
|
1878
2118
|
- [ ] Architecture, public contract, dependency, schema, auth, permission, payment, or design issues were returned to architect.
|
|
1879
|
-
- [ ]
|
|
2119
|
+
- [ ] Architect performed post-review docs sync / architecture drift check before final PM acceptance.
|
|
1880
2120
|
- [ ] Docs updates or a docs-sync-report explain why affected architecture/module/testing/security/dependency docs are current.
|
|
1881
2121
|
- [ ] The project manager prepared final acceptance, commit, and PR only after reviewer and docs-sync gates passed or an exception was approved.
|
|
1882
|
-
- [ ] Task-level validation evidence is recorded in
|
|
2122
|
+
- [ ] Task-level validation evidence is recorded in the task handoff `validation-log.md` when a handoff directory exists.
|
|
1883
2123
|
|
|
1884
2124
|
## Architecture
|
|
1885
2125
|
|
|
@@ -1888,7 +2128,7 @@ behavior is correct
|
|
|
1888
2128
|
- [ ] Business logic stays in the correct layer.
|
|
1889
2129
|
- [ ] Existing service/domain/repository APIs are reused where appropriate.
|
|
1890
2130
|
- [ ] No duplicate parallel abstraction was introduced.
|
|
1891
|
-
- [ ]
|
|
2131
|
+
- [ ] `.ai/tools/check-boundaries` passes.
|
|
1892
2132
|
|
|
1893
2133
|
## Public Contract
|
|
1894
2134
|
|
|
@@ -1922,7 +2162,9 @@ behavior is correct
|
|
|
1922
2162
|
- [ ] Module docs are updated if responsibilities changed.
|
|
1923
2163
|
- [ ] Public surface contract is updated if public functions changed.
|
|
1924
2164
|
- [ ] Test plan / validation section is updated if testing strategy changed.
|
|
1925
|
-
- [ ]
|
|
2165
|
+
- [ ] Durable decisions are promoted into the appropriate long-term docs.
|
|
2166
|
+
- [ ] Temporary task documents, staging decisions, route messages, and scratch notes are removed, cleared, or intentionally archived.
|
|
2167
|
+
- [ ] Known issues are triaged: fixed/resolved entries are removed or marked resolved, and still-open entries remain actionable.
|
|
1926
2168
|
- [ ] No known stale docs are left behind.
|
|
1927
2169
|
|
|
1928
2170
|
## Replan / Design Change
|
|
@@ -1935,10 +2177,10 @@ behavior is correct
|
|
|
1935
2177
|
### 13.2 Acceptance Flow
|
|
1936
2178
|
|
|
1937
2179
|
```text
|
|
1938
|
-
1. Project manager classifies task
|
|
2180
|
+
1. Project manager classifies task risk and required role route
|
|
1939
2181
|
2. Verify required handoff artifacts exist
|
|
1940
2182
|
3. Inspect diff scope
|
|
1941
|
-
4. Compare diff against task
|
|
2183
|
+
4. Compare diff against task brief and architecture plan
|
|
1942
2184
|
5. Compare public surface against Public Surface Contract
|
|
1943
2185
|
6. Review tests for contract and regression coverage
|
|
1944
2186
|
7. Run or inspect validation evidence
|
|
@@ -1952,7 +2194,7 @@ behavior is correct
|
|
|
1952
2194
|
Claude’s final report must include:
|
|
1953
2195
|
|
|
1954
2196
|
```text
|
|
1955
|
-
Task
|
|
2197
|
+
Task risk and required route:
|
|
1956
2198
|
Project manager decision:
|
|
1957
2199
|
Role sessions used:
|
|
1958
2200
|
Handoff artifacts:
|
|
@@ -1982,14 +2224,14 @@ Replan Required:
|
|
|
1982
2224
|
Automation tools:
|
|
1983
2225
|
|
|
1984
2226
|
```text
|
|
1985
|
-
tools/check-boundaries
|
|
1986
|
-
tools/check-public-surface
|
|
1987
|
-
tools/check-contract-tests
|
|
1988
|
-
tools/check-docs-freshness
|
|
1989
|
-
tools/check-generated-artifacts
|
|
1990
|
-
tools/check-agent-rules
|
|
1991
|
-
tools/check-changed
|
|
1992
|
-
tools/check-e2e-smoke
|
|
2227
|
+
.ai/tools/check-boundaries
|
|
2228
|
+
.ai/tools/check-public-surface
|
|
2229
|
+
.ai/tools/check-contract-tests
|
|
2230
|
+
.ai/tools/check-docs-freshness
|
|
2231
|
+
.ai/tools/check-generated-artifacts
|
|
2232
|
+
.ai/tools/check-agent-rules
|
|
2233
|
+
.ai/tools/check-changed
|
|
2234
|
+
.ai/tools/check-e2e-smoke
|
|
1993
2235
|
```
|
|
1994
2236
|
|
|
1995
2237
|
## 14. MCP and Permissions
|
|
@@ -2047,7 +2289,7 @@ Allowed:
|
|
|
2047
2289
|
Required check:
|
|
2048
2290
|
|
|
2049
2291
|
```text
|
|
2050
|
-
tools/check-generated-artifacts
|
|
2292
|
+
.ai/tools/check-generated-artifacts
|
|
2051
2293
|
```
|
|
2052
2294
|
|
|
2053
2295
|
This check should fail when:
|
|
@@ -2069,7 +2311,7 @@ Rules:
|
|
|
2069
2311
|
- critical repeated rules must have stable IDs, such as `RULE-SCOPE-001`, `RULE-ARCH-001`, `RULE-TEST-001`, `RULE-PERM-001`
|
|
2070
2312
|
- root rule text is canonical unless a different canonical source is explicitly defined
|
|
2071
2313
|
- role agent files should reference rule IDs or include generated rule snippets
|
|
2072
|
-
-
|
|
2314
|
+
- `.ai/tools/check-agent-rules` must fail when repeated rule text, rule IDs, or required rule coverage drift
|
|
2073
2315
|
- do not copy long rule blocks manually into many files without a freshness check
|
|
2074
2316
|
|
|
2075
2317
|
### 15.3 Scaffolding Must Earn Its Keep
|
|
@@ -2148,11 +2390,11 @@ Monthly review:
|
|
|
2148
2390
|
- Which checks should move into hooks?
|
|
2149
2391
|
- Which checks, hooks, or role requirements can be simplified?
|
|
2150
2392
|
|
|
2151
|
-
`known-issues.md` triage (every monthly review):
|
|
2393
|
+
`docs/known-issues.md` triage (every monthly review):
|
|
2152
2394
|
|
|
2153
2395
|
- For each unhandled entry, decide: promote to task, fold into a planned change, or dismiss.
|
|
2154
|
-
- Entries older than 90 days with no action are dismissed with a reason recorded in `
|
|
2155
|
-
- `known-issues.md` is only useful if it stays small; an ever-growing file means triage is not happening.
|
|
2396
|
+
- Entries older than 90 days with no action are dismissed with a short reason recorded in `docs/known-issues.md` before removal, or in the relevant durable doc when the reason changes project policy.
|
|
2397
|
+
- `docs/known-issues.md` is only useful if it stays small; an ever-growing file means triage is not happening.
|
|
2156
2398
|
|
|
2157
2399
|
## 17. Minimum Team Rules
|
|
2158
2400
|
|
|
@@ -2169,7 +2411,7 @@ If you can only enforce 16 rules, enforce these:
|
|
|
2169
2411
|
9. Ordinary tasks must define public function contracts.
|
|
2170
2412
|
10. New or modified public functions must have contract tests.
|
|
2171
2413
|
11. Code changes must run relevant validation.
|
|
2172
|
-
12. Architecture, public contract, or test strategy changes must sync docs.
|
|
2414
|
+
12. Architecture, public contract, or test strategy changes must sync durable docs, and completed task artifacts must be cleaned up.
|
|
2173
2415
|
13. Manual indexes are not authoritative; generated context must be freshness-checked.
|
|
2174
2416
|
14. AI review uses fresh context or a reviewer role session.
|
|
2175
2417
|
15. High-risk actions require human approval.
|