vibe-coding-master 0.0.17 → 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 +57 -28
- package/dist/backend/api/artifact-routes.js +5 -5
- package/dist/backend/api/harness-routes.js +8 -0
- package/dist/backend/server.js +8 -2
- package/dist/backend/services/artifact-service.js +12 -12
- package/dist/backend/services/harness-service.js +579 -5
- package/dist/backend/services/project-service.js +4 -1
- 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 -16
- 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 +433 -192
- package/docs/full-harness-baseline.md +254 -0
- package/docs/product-design.md +9 -9
- 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-D40qaonx.css +0 -32
- package/dist-frontend/assets/index-DK2F4LFT.js +0 -90
- package/docs/v1-architecture-design.md +0 -1014
- package/docs/v1-implementation-plan.md +0 -1379
|
@@ -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
|
|
@@ -58,7 +60,7 @@ Behavioral guardrails:
|
|
|
58
60
|
- Touch only files required by the task; do not clean up, format, or refactor adjacent code opportunistically.
|
|
59
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.
|
|
60
62
|
- Clean up only unused imports, variables, functions, or test leftovers created by the current change.
|
|
61
|
-
- 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.
|
|
62
64
|
- Every diff line must trace to the task goal, public contract, test contract, or required documentation sync.
|
|
63
65
|
- For multi-step tasks, define the validation check for each step.
|
|
64
66
|
|
|
@@ -77,13 +79,16 @@ repo/
|
|
|
77
79
|
TESTING.md
|
|
78
80
|
SECURITY.md
|
|
79
81
|
DEPENDENCY_RULES.md
|
|
80
|
-
|
|
82
|
+
plans/
|
|
81
83
|
active/
|
|
82
84
|
completed/
|
|
83
85
|
|
|
84
86
|
.claude/
|
|
85
87
|
settings.json
|
|
86
88
|
skills/
|
|
89
|
+
route-message.md
|
|
90
|
+
docs-sync.md
|
|
91
|
+
long-running-validation.md
|
|
87
92
|
agents/
|
|
88
93
|
project-manager.md
|
|
89
94
|
architect.md
|
|
@@ -97,25 +102,24 @@ repo/
|
|
|
97
102
|
commands/
|
|
98
103
|
|
|
99
104
|
.ai/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
progress.md
|
|
109
|
-
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
|
|
110
113
|
validation-log.md
|
|
111
114
|
known-issues.md
|
|
112
|
-
|
|
115
|
+
review-report.md
|
|
116
|
+
docs-sync-report.md
|
|
113
117
|
generated/
|
|
114
118
|
module-index.json
|
|
115
119
|
test-map.json
|
|
116
120
|
public-surface.json
|
|
117
121
|
|
|
118
|
-
tools/
|
|
122
|
+
.ai/tools/
|
|
119
123
|
check-fast
|
|
120
124
|
check-changed
|
|
121
125
|
check-module
|
|
@@ -126,13 +130,17 @@ repo/
|
|
|
126
130
|
check-generated-artifacts
|
|
127
131
|
check-docs-freshness
|
|
128
132
|
check-agent-rules
|
|
133
|
+
run-long-check
|
|
134
|
+
watch-job
|
|
129
135
|
```
|
|
130
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
|
+
|
|
131
139
|
Required large-project baseline:
|
|
132
140
|
|
|
133
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.
|
|
134
142
|
|
|
135
|
-
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.
|
|
136
144
|
|
|
137
145
|
Minimum baseline for non-trivial AI coding:
|
|
138
146
|
|
|
@@ -140,8 +148,9 @@ Minimum baseline for non-trivial AI coding:
|
|
|
140
148
|
- module-local `CLAUDE.md` for edited modules
|
|
141
149
|
- architecture, module map, testing, security, and dependency docs
|
|
142
150
|
- role agents for project management/user communication, architecture/planning, coding, and independent review/testing
|
|
143
|
-
- 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
|
|
144
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
|
|
145
154
|
- hooks or CI gates for protected files, validation, docs sync, public contracts, and test quality
|
|
146
155
|
|
|
147
156
|
## 3. `CLAUDE.md`
|
|
@@ -181,7 +190,7 @@ Root template:
|
|
|
181
190
|
- `packages/`: shared libraries
|
|
182
191
|
- `apps/`: user-facing applications
|
|
183
192
|
- `docs/`: architecture, testing, security, module docs
|
|
184
|
-
-
|
|
193
|
+
- `.ai/tools/`: validation and developer utilities
|
|
185
194
|
|
|
186
195
|
## Start Here
|
|
187
196
|
|
|
@@ -192,15 +201,15 @@ Root template:
|
|
|
192
201
|
|
|
193
202
|
## Commands
|
|
194
203
|
|
|
195
|
-
- Fast validation:
|
|
196
|
-
- Changed files validation:
|
|
197
|
-
- 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>`
|
|
198
207
|
|
|
199
208
|
## Role Entry Points
|
|
200
209
|
|
|
201
210
|
Role-specific behavior lives in `.claude/agents/`.
|
|
202
211
|
|
|
203
|
-
- 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.
|
|
204
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.
|
|
205
214
|
- Use `claude --agent coder` for implementation and direct tests within an approved plan.
|
|
206
215
|
- Use `claude --agent reviewer` for independent review, test adequacy, validation evidence, docs gap detection, and acceptance findings.
|
|
@@ -213,37 +222,39 @@ Role-specific behavior lives in `.claude/agents/`.
|
|
|
213
222
|
- Default core roles are `project-manager`, `architect`, `coder`, and `reviewer`.
|
|
214
223
|
- The `project-manager` role owns user communication, task routing, role commands, handoff verification, final status reporting, and PR preparation after required gates pass.
|
|
215
224
|
- Do not let one coding session own architecture/plan decisions, implementation, final testing responsibility, and review.
|
|
216
|
-
- 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.
|
|
217
226
|
- Role messaging is turn-based. Keep at most one active message to the same target role.
|
|
218
|
-
-
|
|
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`.
|
|
219
229
|
- For a given target role, update the same route file instead of creating multiple fragmented messages.
|
|
220
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.
|
|
221
|
-
- Do not poll message files, start shell loops, or keep the turn open waiting for another role's answer.
|
|
222
|
-
- 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.
|
|
223
234
|
- If new information appears while a role is still processing, update the handoff artifact or wait instead of sending fragmented follow-up messages.
|
|
224
235
|
- When the required role route includes `architect`, coding must not start until the architecture and plan artifact exists.
|
|
225
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.
|
|
226
|
-
- 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.
|
|
227
238
|
|
|
228
|
-
##
|
|
239
|
+
## Harness-Managed Blocks
|
|
229
240
|
|
|
230
|
-
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.
|
|
231
242
|
|
|
232
243
|
Allowed managed block format:
|
|
233
244
|
|
|
234
245
|
```md
|
|
235
|
-
<!--
|
|
236
|
-
|
|
237
|
-
<!--
|
|
246
|
+
<!-- HARNESS:BEGIN version=1 -->
|
|
247
|
+
Harness-managed rules.
|
|
248
|
+
<!-- HARNESS:END -->
|
|
238
249
|
```
|
|
239
250
|
|
|
240
251
|
Rules:
|
|
241
252
|
|
|
242
|
-
-
|
|
243
|
-
- If a file already exists,
|
|
244
|
-
-
|
|
245
|
-
- After applying harness changes,
|
|
246
|
-
- 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.
|
|
247
258
|
|
|
248
259
|
## Default Behavior
|
|
249
260
|
|
|
@@ -252,7 +263,7 @@ Rules:
|
|
|
252
263
|
- Prefer the simplest solution that satisfies the task; do not add speculative features, abstractions, configuration, or flexibility.
|
|
253
264
|
- Touch only files required by the task; do not clean up or refactor unrelated code.
|
|
254
265
|
- Clean up only unused code created by the current change.
|
|
255
|
-
- 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.
|
|
256
267
|
- Every changed line must trace to the task goal, public contract, test contract, or required documentation sync.
|
|
257
268
|
- For multi-step tasks, define the validation check for each step before implementing it.
|
|
258
269
|
|
|
@@ -266,12 +277,12 @@ Rules:
|
|
|
266
277
|
|
|
267
278
|
## Definition of Done
|
|
268
279
|
|
|
269
|
-
-
|
|
280
|
+
- Changed files and meaningful hunks have traceable reasons.
|
|
270
281
|
- Required validation passes.
|
|
271
282
|
- New or modified public functions have contract tests.
|
|
272
283
|
- Behavior changes have regression tests unless impractical.
|
|
273
284
|
- Plan, architecture, public contract, test strategy, and module responsibility changes are reflected in docs after post-review architect docs sync.
|
|
274
|
-
- 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.
|
|
275
286
|
```
|
|
276
287
|
|
|
277
288
|
Large projects must have module-local `CLAUDE.md` files:
|
|
@@ -293,7 +304,7 @@ Module files should define:
|
|
|
293
304
|
- historical pitfalls
|
|
294
305
|
- high-risk behavior
|
|
295
306
|
|
|
296
|
-
## 4. Task
|
|
307
|
+
## 4. Task Briefs and Planning Granularity
|
|
297
308
|
|
|
298
309
|
Every task must define at least **file-level responsibilities**.
|
|
299
310
|
|
|
@@ -332,10 +343,12 @@ function internals: usually not fixed in advance
|
|
|
332
343
|
|
|
333
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.
|
|
334
345
|
|
|
335
|
-
|
|
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
|
|
336
349
|
|
|
337
350
|
```md
|
|
338
|
-
# Task
|
|
351
|
+
# Task Brief / Plan
|
|
339
352
|
|
|
340
353
|
## Goal
|
|
341
354
|
|
|
@@ -567,7 +580,7 @@ Do not include:
|
|
|
567
580
|
|
|
568
581
|
For large projects, the default execution model should be explicit role-based sessions, not dynamic role routing inside one generic Claude conversation.
|
|
569
582
|
|
|
570
|
-
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.
|
|
571
584
|
|
|
572
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.
|
|
573
586
|
|
|
@@ -584,8 +597,8 @@ Project manager responsibilities:
|
|
|
584
597
|
```text
|
|
585
598
|
communicate with user
|
|
586
599
|
-> clarify task
|
|
587
|
-
-> turn user intent into a task brief /
|
|
588
|
-
-> classify
|
|
600
|
+
-> turn user intent into a task brief / durable plan
|
|
601
|
+
-> classify task risk
|
|
589
602
|
-> choose required role route
|
|
590
603
|
-> prepare the next role command
|
|
591
604
|
-> ensure handoff directory exists when needed
|
|
@@ -601,7 +614,7 @@ The project manager is a process owner, not an execution owner.
|
|
|
601
614
|
|
|
602
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.
|
|
603
616
|
|
|
604
|
-
|
|
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.
|
|
605
618
|
|
|
606
619
|
Do not let the project manager:
|
|
607
620
|
|
|
@@ -619,7 +632,7 @@ A role command must include:
|
|
|
619
632
|
|
|
620
633
|
```text
|
|
621
634
|
role identity
|
|
622
|
-
task
|
|
635
|
+
task brief path
|
|
623
636
|
required input artifacts
|
|
624
637
|
allowed write scope
|
|
625
638
|
public surface contract
|
|
@@ -634,26 +647,26 @@ Role command examples:
|
|
|
634
647
|
|
|
635
648
|
```text
|
|
636
649
|
architect command:
|
|
637
|
-
read the task
|
|
638
|
-
produce .ai/
|
|
650
|
+
read the task brief, architecture docs, module map, and relevant module-local CLAUDE.md
|
|
651
|
+
produce .ai/handoffs/architecture-plan.md
|
|
639
652
|
define file responsibilities, public contracts, test contracts, phases, validation, and Replan triggers
|
|
640
653
|
do not edit production code
|
|
641
654
|
|
|
642
655
|
coder command:
|
|
643
|
-
read the task
|
|
656
|
+
read the task brief and approved architecture-plan.md
|
|
644
657
|
implement only the approved phase and allowed files
|
|
645
658
|
add or update direct contract/regression tests
|
|
646
659
|
update implementation-log.md and validation-log.md
|
|
647
660
|
stop if scope, public contract, architecture, or test strategy must change
|
|
648
661
|
|
|
649
662
|
reviewer command:
|
|
650
|
-
read task
|
|
663
|
+
read task brief, architecture-plan.md, implementation-log.md, validation-log.md, and git diff
|
|
651
664
|
verify scope, architecture, public contract, tests, validation, and docs gaps
|
|
652
665
|
write review-report.md
|
|
653
666
|
only apply small, local, low-risk review-scoped fixes
|
|
654
667
|
|
|
655
668
|
architect docs-sync command:
|
|
656
|
-
read task
|
|
669
|
+
read task brief, architecture-plan.md, implementation-log.md, validation-log.md, review-report.md, and git diff
|
|
657
670
|
verify whether the final code still matches the approved architecture and public contracts
|
|
658
671
|
update architecture/module/testing/security docs when the code change made them stale
|
|
659
672
|
write docs-sync-report.md with docs changed, docs intentionally unchanged, and remaining doc risks
|
|
@@ -683,20 +696,17 @@ The role is selected at session startup. The agent file defines that session's s
|
|
|
683
696
|
|
|
684
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.
|
|
685
698
|
|
|
686
|
-
### 7.3 Task
|
|
699
|
+
### 7.3 Task Routing
|
|
687
700
|
|
|
688
|
-
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.
|
|
689
702
|
|
|
690
|
-
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.
|
|
691
704
|
|
|
692
705
|
| Task class | Examples | Required role route |
|
|
693
706
|
| --- | --- | --- |
|
|
694
|
-
|
|
|
695
|
-
|
|
|
696
|
-
|
|
|
697
|
-
| 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 |
|
|
698
|
-
| 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 |
|
|
699
|
-
| 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 |
|
|
700
710
|
|
|
701
711
|
If classification is unclear, use the stricter route.
|
|
702
712
|
|
|
@@ -721,25 +731,25 @@ Role responsibilities:
|
|
|
721
731
|
|
|
722
732
|
```text
|
|
723
733
|
project-manager
|
|
724
|
-
owns user communication, task clarification, task
|
|
734
|
+
owns user communication, task clarification, task briefs, role routing, and route-file message preparation
|
|
725
735
|
turns user input into an engineering task when needed
|
|
726
736
|
summarizes role outputs back to the user
|
|
727
737
|
creates and verifies handoff artifacts
|
|
728
738
|
tracks progress, blockers, validation, docs sync, and Replan
|
|
729
|
-
outputs task
|
|
739
|
+
outputs task briefs, role commands, status summaries, and final acceptance reports
|
|
730
740
|
must not own architecture, implementation, and independent review for the same non-trivial task
|
|
731
741
|
|
|
732
742
|
architect
|
|
733
743
|
owns architecture and plan
|
|
734
744
|
defines module boundaries, file responsibilities, public contracts, dependency direction, risk, and phases
|
|
735
745
|
owns post-review docs sync and architecture drift checks before PM final acceptance
|
|
736
|
-
outputs .ai/
|
|
737
|
-
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
|
|
738
748
|
must not implement production code
|
|
739
749
|
|
|
740
750
|
coder
|
|
741
751
|
owns code changes and baseline tests required to complete the approved task
|
|
742
|
-
follows approved architecture-plan.md and task
|
|
752
|
+
follows approved architecture-plan.md and task brief
|
|
743
753
|
outputs touched files, implementation notes, validation results, and follow-ups
|
|
744
754
|
must write/update direct unit, contract, or regression tests needed for the changed behavior
|
|
745
755
|
must not change module responsibilities, public contracts, architecture direction, or test strategy without Replan
|
|
@@ -750,7 +760,7 @@ reviewer
|
|
|
750
760
|
checks, designs, and adds missing tests when needed
|
|
751
761
|
may directly apply small, local, low-risk review fixes
|
|
752
762
|
owns complex tests, E2E coverage, regression matrix, and release-level validation recommendations
|
|
753
|
-
outputs .ai/
|
|
763
|
+
outputs .ai/handoffs/review-report.md
|
|
754
764
|
must escalate larger implementation issues to coder
|
|
755
765
|
must escalate architecture, public contract, design, or documentation drift issues to architect
|
|
756
766
|
```
|
|
@@ -761,9 +771,9 @@ Prompt rules are not enough. Role separation must be backed by tool scope, permi
|
|
|
761
771
|
|
|
762
772
|
| Role | Suggested tools | Write scope | Must not |
|
|
763
773
|
| --- | --- | --- | --- |
|
|
764
|
-
| `project-manager` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | task
|
|
765
|
-
| `architect` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | architecture plan, docs sync report,
|
|
766
|
-
| `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 |
|
|
767
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 |
|
|
768
778
|
| `security-specialist` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | security review report and approved security tests | bypass approvals, edit production code without explicit scope |
|
|
769
779
|
| `migration-specialist` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | migration plan, migration tests, validation notes | run destructive migrations, change schema without approval |
|
|
@@ -772,8 +782,8 @@ Prompt rules are not enough. Role separation must be backed by tool scope, permi
|
|
|
772
782
|
Recommended permission modes:
|
|
773
783
|
|
|
774
784
|
```text
|
|
775
|
-
project-manager: default with write hooks limited to task
|
|
776
|
-
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
|
|
777
787
|
coder: default or acceptEdits, but only inside approved scope
|
|
778
788
|
reviewer: default with production-code writes blocked except explicitly review-scoped small fixes; test writes allowed
|
|
779
789
|
specialist: default with write hooks limited to specialist reports, tests, and approved files
|
|
@@ -788,7 +798,7 @@ Role sessions communicate through files, not memory from previous chats.
|
|
|
788
798
|
Required handoff directory:
|
|
789
799
|
|
|
790
800
|
```text
|
|
791
|
-
.ai/
|
|
801
|
+
.ai/handoffs/
|
|
792
802
|
role-commands/
|
|
793
803
|
architect.md
|
|
794
804
|
coder.md
|
|
@@ -805,26 +815,26 @@ Each role session must start by reading the artifacts it depends on:
|
|
|
805
815
|
```text
|
|
806
816
|
project-manager
|
|
807
817
|
reads: user request, repo entry docs, task state, role outputs
|
|
808
|
-
writes: task
|
|
818
|
+
writes: task brief, role commands, progress/status, known issues, final acceptance report
|
|
809
819
|
|
|
810
820
|
architect
|
|
811
|
-
reads: task request, task
|
|
821
|
+
reads: task request, task brief, ARCHITECTURE.md, MODULE_MAP.md, module-local CLAUDE.md, relevant source/tests
|
|
812
822
|
writes: architecture-plan.md
|
|
813
823
|
|
|
814
824
|
architect docs sync
|
|
815
|
-
reads: task
|
|
825
|
+
reads: task brief, architecture-plan.md, implementation-log.md, validation-log.md, review-report.md, git diff, relevant docs
|
|
816
826
|
writes: docs updates when needed, docs-sync-report.md
|
|
817
827
|
|
|
818
828
|
coder
|
|
819
|
-
reads: task
|
|
829
|
+
reads: task brief, architecture-plan.md, relevant module docs
|
|
820
830
|
writes: code, baseline tests, implementation-log.md, validation-log.md
|
|
821
831
|
|
|
822
832
|
reviewer
|
|
823
|
-
reads: task
|
|
833
|
+
reads: task brief, architecture-plan.md, implementation-log.md, validation-log.md, git diff
|
|
824
834
|
writes: review-report.md
|
|
825
835
|
|
|
826
836
|
optional specialist
|
|
827
|
-
reads: task
|
|
837
|
+
reads: task brief, architecture-plan.md, relevant source/tests
|
|
828
838
|
writes: specialist report, approved tests, validation-log.md
|
|
829
839
|
```
|
|
830
840
|
|
|
@@ -882,7 +892,7 @@ escalate to architect:
|
|
|
882
892
|
the implementation reveals that the architecture plan is invalid
|
|
883
893
|
```
|
|
884
894
|
|
|
885
|
-
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.
|
|
886
896
|
|
|
887
897
|
For complex or high-risk work, the next role must not start until the required previous artifact exists and is coherent.
|
|
888
898
|
|
|
@@ -967,7 +977,7 @@ Worktree isolation is by task, not by role:
|
|
|
967
977
|
```text
|
|
968
978
|
one task
|
|
969
979
|
-> one branch: feature/<task-slug>
|
|
970
|
-
-> one worktree:
|
|
980
|
+
-> one worktree: <task-worktree-root>/<task-slug>
|
|
971
981
|
-> one handoff directory
|
|
972
982
|
-> architect -> coder -> reviewer in sequence
|
|
973
983
|
```
|
|
@@ -1038,14 +1048,14 @@ You are the architecture and planning role for this project.
|
|
|
1038
1048
|
|
|
1039
1049
|
# Required Inputs
|
|
1040
1050
|
|
|
1041
|
-
- task
|
|
1051
|
+
- task brief or user request
|
|
1042
1052
|
- `docs/ARCHITECTURE.md`
|
|
1043
1053
|
- `docs/MODULE_MAP.md`
|
|
1044
1054
|
- relevant module-local `CLAUDE.md`
|
|
1045
1055
|
|
|
1046
1056
|
# Outputs
|
|
1047
1057
|
|
|
1048
|
-
- `.ai/
|
|
1058
|
+
- `.ai/handoffs/architecture-plan.md`
|
|
1049
1059
|
|
|
1050
1060
|
# Do Not
|
|
1051
1061
|
|
|
@@ -1073,7 +1083,7 @@ project-manager.md
|
|
|
1073
1083
|
required inputs:
|
|
1074
1084
|
user request, repo entry docs, current task state, role outputs
|
|
1075
1085
|
outputs:
|
|
1076
|
-
task
|
|
1086
|
+
task brief, role commands, progress/status updates, final acceptance report
|
|
1077
1087
|
do not:
|
|
1078
1088
|
implement non-trivial production code, replace architect/coder/reviewer, approve without reviewer evidence
|
|
1079
1089
|
stop when:
|
|
@@ -1084,7 +1094,7 @@ architect.md
|
|
|
1084
1094
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
1085
1095
|
permissionMode: default
|
|
1086
1096
|
required inputs:
|
|
1087
|
-
task
|
|
1097
|
+
task brief, ARCHITECTURE.md, MODULE_MAP.md, module-local CLAUDE.md
|
|
1088
1098
|
outputs:
|
|
1089
1099
|
architecture-plan.md
|
|
1090
1100
|
do not:
|
|
@@ -1097,7 +1107,7 @@ coder.md
|
|
|
1097
1107
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
1098
1108
|
permissionMode: default
|
|
1099
1109
|
required inputs:
|
|
1100
|
-
task
|
|
1110
|
+
task brief, architecture-plan.md
|
|
1101
1111
|
outputs:
|
|
1102
1112
|
code, baseline tests, implementation-log.md, validation-log.md
|
|
1103
1113
|
do not:
|
|
@@ -1110,7 +1120,7 @@ reviewer.md
|
|
|
1110
1120
|
tools: Read, Grep, Glob, Bash, Edit, Write
|
|
1111
1121
|
permissionMode: default
|
|
1112
1122
|
required inputs:
|
|
1113
|
-
task
|
|
1123
|
+
task brief, architecture-plan.md, implementation-log.md, validation-log.md, git diff
|
|
1114
1124
|
outputs:
|
|
1115
1125
|
review-report.md, missing tests/fixtures when needed, review-scoped small fixes, validation-log.md
|
|
1116
1126
|
do not:
|
|
@@ -1145,7 +1155,7 @@ project-manager session
|
|
|
1145
1155
|
-> final acceptance + commit + PR submission
|
|
1146
1156
|
```
|
|
1147
1157
|
|
|
1148
|
-
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.
|
|
1149
1159
|
|
|
1150
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.
|
|
1151
1161
|
|
|
@@ -1187,12 +1197,14 @@ L4 full-regression: nightly / release only
|
|
|
1187
1197
|
### 8.2 Commands
|
|
1188
1198
|
|
|
1189
1199
|
```text
|
|
1190
|
-
tools/check-fast
|
|
1191
|
-
tools/check-changed
|
|
1192
|
-
tools/check-module <module>
|
|
1193
|
-
tools/check-e2e-smoke [scope]
|
|
1194
|
-
tools/check-e2e-release
|
|
1195
|
-
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
|
|
1196
1208
|
```
|
|
1197
1209
|
|
|
1198
1210
|
What Claude should run:
|
|
@@ -1224,7 +1236,59 @@ release / major version / high-risk migration:
|
|
|
1224
1236
|
L0 + L1 + L2 + L3 + L4
|
|
1225
1237
|
```
|
|
1226
1238
|
|
|
1227
|
-
### 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
|
|
1228
1292
|
|
|
1229
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.
|
|
1230
1294
|
|
|
@@ -1249,10 +1313,10 @@ Rules:
|
|
|
1249
1313
|
|
|
1250
1314
|
- `.ai/generated/test-map.json` is a derived artifact, not a hand-edited source of truth.
|
|
1251
1315
|
- Manual edits to generated test maps are forbidden.
|
|
1252
|
-
-
|
|
1253
|
-
- 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.
|
|
1254
1318
|
|
|
1255
|
-
|
|
1319
|
+
`.ai/tools/check-changed` should:
|
|
1256
1320
|
|
|
1257
1321
|
```text
|
|
1258
1322
|
git diff
|
|
@@ -1264,7 +1328,7 @@ git diff
|
|
|
1264
1328
|
-> if critical user path changed, suggest L3
|
|
1265
1329
|
```
|
|
1266
1330
|
|
|
1267
|
-
### 8.
|
|
1331
|
+
### 8.5 E2E Tiers
|
|
1268
1332
|
|
|
1269
1333
|
```text
|
|
1270
1334
|
e2e/
|
|
@@ -1284,7 +1348,7 @@ e2e/
|
|
|
1284
1348
|
upgrade-migration.spec.ts
|
|
1285
1349
|
```
|
|
1286
1350
|
|
|
1287
|
-
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.
|
|
1288
1352
|
Release E2E: complex combinations, historical incidents, cross-browser, slower but non-flaky, run before release or nightly.
|
|
1289
1353
|
|
|
1290
1354
|
Test tags:
|
|
@@ -1294,7 +1358,7 @@ Test tags:
|
|
|
1294
1358
|
@billing @auth @risk-high @public-api @contract
|
|
1295
1359
|
```
|
|
1296
1360
|
|
|
1297
|
-
### 8.
|
|
1361
|
+
### 8.6 Public Function Test Contract
|
|
1298
1362
|
|
|
1299
1363
|
Every new or modified public function must have tests covering its contract.
|
|
1300
1364
|
|
|
@@ -1332,7 +1396,7 @@ internal helper call counts
|
|
|
1332
1396
|
local implementation steps
|
|
1333
1397
|
```
|
|
1334
1398
|
|
|
1335
|
-
### 8.
|
|
1399
|
+
### 8.7 Test Quality Red Lines
|
|
1336
1400
|
|
|
1337
1401
|
Forbidden:
|
|
1338
1402
|
|
|
@@ -1368,8 +1432,8 @@ Recommended hooks:
|
|
|
1368
1432
|
|
|
1369
1433
|
```text
|
|
1370
1434
|
Stop:
|
|
1371
|
-
notify
|
|
1372
|
-
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
|
|
1373
1437
|
|
|
1374
1438
|
PreToolUse:
|
|
1375
1439
|
block protected files
|
|
@@ -1387,7 +1451,7 @@ PostToolUse:
|
|
|
1387
1451
|
Stop:
|
|
1388
1452
|
switch the role activity state to idle
|
|
1389
1453
|
check project manager did not bypass required role route
|
|
1390
|
-
check task
|
|
1454
|
+
check task risk and required role route
|
|
1391
1455
|
check required handoff artifacts exist
|
|
1392
1456
|
check required validation
|
|
1393
1457
|
check task-level validation-log.md updated when handoffs exist
|
|
@@ -1401,7 +1465,7 @@ SessionStart:
|
|
|
1401
1465
|
show that task coordination should use `claude --agent project-manager`
|
|
1402
1466
|
warn when a non-trivial task is running in an untagged session
|
|
1403
1467
|
show current role and expected role for the task
|
|
1404
|
-
show required handoff artifacts for the
|
|
1468
|
+
show required handoff artifacts for the required route
|
|
1405
1469
|
inject current task state
|
|
1406
1470
|
show recent failing checks
|
|
1407
1471
|
show module owner and validation commands
|
|
@@ -1426,6 +1490,109 @@ Lockfiles and migrations are not permanently forbidden, but they require explici
|
|
|
1426
1490
|
|
|
1427
1491
|
If you type the same long prompt for the third time, turn it into a skill or command.
|
|
1428
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
|
+
|
|
1429
1596
|
Recommended subagents:
|
|
1430
1597
|
|
|
1431
1598
|
```text
|
|
@@ -1451,7 +1618,7 @@ Default rule:
|
|
|
1451
1618
|
```text
|
|
1452
1619
|
one task
|
|
1453
1620
|
-> one branch: feature/<task-slug>
|
|
1454
|
-
-> one worktree:
|
|
1621
|
+
-> one worktree: <task-worktree-root>/<task-slug>
|
|
1455
1622
|
-> one handoff directory
|
|
1456
1623
|
-> one PR
|
|
1457
1624
|
```
|
|
@@ -1491,18 +1658,18 @@ Branch rules:
|
|
|
1491
1658
|
|
|
1492
1659
|
- never do AI implementation work directly on the main branch
|
|
1493
1660
|
- one task branch should map to one task worktree
|
|
1494
|
-
-
|
|
1495
|
-
-
|
|
1496
|
-
- `.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
|
|
1497
1664
|
- a task should not switch to a different branch/worktree after creation; create a new task instead
|
|
1498
1665
|
- large work should use phase commits on the same task branch unless phases are independently releasable
|
|
1499
1666
|
- if a task becomes too large, split it into child tasks with explicit branch and PR ownership
|
|
1500
1667
|
|
|
1501
|
-
|
|
1668
|
+
Task close rules:
|
|
1502
1669
|
|
|
1503
|
-
- after task completion,
|
|
1504
|
-
- for worktree-backed tasks,
|
|
1505
|
-
-
|
|
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
|
|
1506
1673
|
|
|
1507
1674
|
Small commits:
|
|
1508
1675
|
|
|
@@ -1515,14 +1682,14 @@ Small commits:
|
|
|
1515
1682
|
|
|
1516
1683
|
Diff discipline:
|
|
1517
1684
|
|
|
1518
|
-
- 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
|
|
1519
1686
|
- before handoff, coder must inspect `git diff` for unrelated changes, architecture drift, accidental formatting churn, generated artifacts, lockfiles, and migrations
|
|
1520
1687
|
- before acceptance, reviewer must compare `git diff` against the architecture plan and public contracts
|
|
1521
1688
|
- unrelated cleanup belongs in a separate task
|
|
1522
1689
|
|
|
1523
1690
|
PR discipline:
|
|
1524
1691
|
|
|
1525
|
-
- 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
|
|
1526
1693
|
- draft PRs are preferred for large or phased work
|
|
1527
1694
|
- PR review must check scope, architecture compliance, public contracts, test adequacy, docs sync, and whether the diff is appropriately small
|
|
1528
1695
|
- final merge requires human accountability for product semantics, security boundaries, and business risk
|
|
@@ -1543,11 +1710,10 @@ Do not rely only on grep. In large codebases, grep easily finds the wrong symbol
|
|
|
1543
1710
|
Provide:
|
|
1544
1711
|
|
|
1545
1712
|
```text
|
|
1546
|
-
tools/
|
|
1547
|
-
tools/find-
|
|
1548
|
-
tools/find-
|
|
1549
|
-
tools/
|
|
1550
|
-
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
|
|
1551
1717
|
```
|
|
1552
1718
|
|
|
1553
1719
|
If LSP, Sourcegraph, code search, or MCP is available, Claude should prefer them.
|
|
@@ -1582,7 +1748,7 @@ Example generated module index:
|
|
|
1582
1748
|
"docs": ["docs/modules/billing.md"],
|
|
1583
1749
|
"entrypoints": ["services/billing/invoice/calculator.ts"],
|
|
1584
1750
|
"tests": ["tests/billing/invoice-calculator.test.ts"],
|
|
1585
|
-
"commands": ["tools/check-module billing"],
|
|
1751
|
+
"commands": [".ai/tools/check-module billing"],
|
|
1586
1752
|
"rules": [
|
|
1587
1753
|
"Use Money object for all amounts",
|
|
1588
1754
|
"Do not import from payment/adapters/internal"
|
|
@@ -1595,15 +1761,15 @@ Rules:
|
|
|
1595
1761
|
|
|
1596
1762
|
- generated artifacts are caches, not truth
|
|
1597
1763
|
- manual edits to `.ai/generated/**` are forbidden
|
|
1598
|
-
- CI must run
|
|
1764
|
+
- CI must run `.ai/tools/check-generated-artifacts`
|
|
1599
1765
|
- if a generated artifact is stale, Claude must regenerate it or fall back to live code search
|
|
1600
1766
|
- if generated context conflicts with live code, live code wins
|
|
1601
1767
|
|
|
1602
1768
|
Architecture boundaries must be mechanically checked:
|
|
1603
1769
|
|
|
1604
1770
|
```text
|
|
1605
|
-
tools/check-boundaries
|
|
1606
|
-
tools/check-generated-artifacts
|
|
1771
|
+
.ai/tools/check-boundaries
|
|
1772
|
+
.ai/tools/check-generated-artifacts
|
|
1607
1773
|
```
|
|
1608
1774
|
|
|
1609
1775
|
and enforced in CI.
|
|
@@ -1612,52 +1778,50 @@ and enforced in CI.
|
|
|
1612
1778
|
|
|
1613
1779
|
Long tasks cannot rely on chat context.
|
|
1614
1780
|
|
|
1615
|
-
|
|
1781
|
+
Task runtime and durable issue files:
|
|
1616
1782
|
|
|
1617
1783
|
```text
|
|
1618
|
-
.ai/
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
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
|
|
1624
1789
|
```
|
|
1625
1790
|
|
|
1626
1791
|
Validation log authority:
|
|
1627
1792
|
|
|
1628
|
-
-
|
|
1629
|
-
-
|
|
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.
|
|
1630
1795
|
- Final reports and review reports should cite the task-level validation log, not scattered chat output.
|
|
1631
1796
|
|
|
1632
1797
|
Information lifetime determines where it lives:
|
|
1633
1798
|
|
|
1634
1799
|
```text
|
|
1635
1800
|
within one session (phase breakdown, mid-implementation TODOs)
|
|
1636
|
-
-> 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
|
|
1637
1806
|
|
|
1638
|
-
|
|
1639
|
-
->
|
|
1640
|
-
-> 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
|
|
1641
1809
|
|
|
1642
1810
|
across tasks (deferred findings, out-of-scope discoveries)
|
|
1643
|
-
-> known-issues.md
|
|
1811
|
+
-> docs/known-issues.md
|
|
1644
1812
|
```
|
|
1645
1813
|
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
- Snapshot, not log. Holds current status of every active task in one place.
|
|
1649
|
-
- One entry per active task; entry is rewritten in place, not appended.
|
|
1650
|
-
- 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.
|
|
1651
|
-
- 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:
|
|
1652
1815
|
|
|
1653
|
-
|
|
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`.
|
|
1654
1823
|
|
|
1655
|
-
-
|
|
1656
|
-
- Cleared when the task completes or when a fresh session starts.
|
|
1657
|
-
- Anything that must survive (decisions, deferred findings, progress) is promoted to `decisions.md`, `known-issues.md`, `progress.md`, or the exec-plan before clearing.
|
|
1658
|
-
- This file is the legitimate home for the working TODOs that `Stop` hook forbids inside source code.
|
|
1659
|
-
|
|
1660
|
-
`known-issues.md` entry format:
|
|
1824
|
+
`docs/known-issues.md` entry format:
|
|
1661
1825
|
|
|
1662
1826
|
```md
|
|
1663
1827
|
## YYYY-MM-DD <one-line summary>
|
|
@@ -1683,13 +1847,13 @@ Open issues:
|
|
|
1683
1847
|
Next step:
|
|
1684
1848
|
```
|
|
1685
1849
|
|
|
1686
|
-
For
|
|
1850
|
+
For large, multi-phase, or multi-day tasks, create:
|
|
1687
1851
|
|
|
1688
1852
|
```text
|
|
1689
|
-
docs/
|
|
1853
|
+
docs/plans/active/<plan-name>.md
|
|
1690
1854
|
```
|
|
1691
1855
|
|
|
1692
|
-
|
|
1856
|
+
Durable plans include:
|
|
1693
1857
|
|
|
1694
1858
|
- background
|
|
1695
1859
|
- goal
|
|
@@ -1699,7 +1863,7 @@ Execution plans include:
|
|
|
1699
1863
|
- decision log
|
|
1700
1864
|
- current state
|
|
1701
1865
|
|
|
1702
|
-
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.
|
|
1703
1867
|
|
|
1704
1868
|
### 12.1 Documentation Sync Contract
|
|
1705
1869
|
|
|
@@ -1711,17 +1875,17 @@ Rule:
|
|
|
1711
1875
|
|
|
1712
1876
|
Check:
|
|
1713
1877
|
|
|
1714
|
-
- task
|
|
1715
|
-
-
|
|
1878
|
+
- task brief
|
|
1879
|
+
- durable plan
|
|
1716
1880
|
- `docs/ARCHITECTURE.md`
|
|
1717
1881
|
- `docs/MODULE_MAP.md`
|
|
1718
1882
|
- module docs
|
|
1719
1883
|
- module-local `CLAUDE.md`
|
|
1720
1884
|
- public surface contract
|
|
1721
1885
|
- test plan / validation section
|
|
1722
|
-
-
|
|
1723
|
-
-
|
|
1724
|
-
-
|
|
1886
|
+
- task-local pending decisions
|
|
1887
|
+
- task-local progress state
|
|
1888
|
+
- task-local known issues and `docs/known-issues.md`
|
|
1725
1889
|
|
|
1726
1890
|
Final report must list:
|
|
1727
1891
|
|
|
@@ -1735,9 +1899,84 @@ Enforcement:
|
|
|
1735
1899
|
|
|
1736
1900
|
- PR template must include a docs sync checklist covering plan, public contract, architecture, module docs, and test plan.
|
|
1737
1901
|
- Stop hook checks that plan, public contract, or test strategy changes have matching doc updates before the session ends.
|
|
1738
|
-
-
|
|
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.
|
|
1739
1978
|
|
|
1740
|
-
### 12.
|
|
1979
|
+
### 12.3 Replan Protocol
|
|
1741
1980
|
|
|
1742
1981
|
Triggers:
|
|
1743
1982
|
|
|
@@ -1782,7 +2021,7 @@ Low-risk deviations may continue with a note:
|
|
|
1782
2021
|
- private implementation detail changes
|
|
1783
2022
|
- scope, public surface, architecture boundary, and test contract stay unchanged
|
|
1784
2023
|
|
|
1785
|
-
### 12.
|
|
2024
|
+
### 12.4 Design Change Control
|
|
1786
2025
|
|
|
1787
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.
|
|
1788
2027
|
|
|
@@ -1794,7 +2033,7 @@ Freeze current implementation
|
|
|
1794
2033
|
-> Record completed subtasks
|
|
1795
2034
|
-> Identify design defect
|
|
1796
2035
|
-> Assess impact radius
|
|
1797
|
-
-> Classify
|
|
2036
|
+
-> Classify task risk
|
|
1798
2037
|
-> Compare options
|
|
1799
2038
|
-> Preserve reusable assets
|
|
1800
2039
|
-> Discard wrong boundaries/contracts/abstractions
|
|
@@ -1830,7 +2069,7 @@ B. Partial rollback + redesign
|
|
|
1830
2069
|
C. Full rollback + rebuild
|
|
1831
2070
|
```
|
|
1832
2071
|
|
|
1833
|
-
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.
|
|
1834
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.
|
|
1835
2074
|
|
|
1836
2075
|
Principle:
|
|
@@ -1857,8 +2096,8 @@ behavior is correct
|
|
|
1857
2096
|
|
|
1858
2097
|
## Scope
|
|
1859
2098
|
|
|
1860
|
-
- [ ]
|
|
1861
|
-
- [ ]
|
|
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.
|
|
1862
2101
|
- [ ] No forbidden files changed.
|
|
1863
2102
|
- [ ] No unapproved dependency added.
|
|
1864
2103
|
- [ ] No scope expansion without Replan.
|
|
@@ -1866,7 +2105,7 @@ behavior is correct
|
|
|
1866
2105
|
## Role / Handoff
|
|
1867
2106
|
|
|
1868
2107
|
- [ ] The task used an explicit `project-manager` role session for user communication, routing, and status reporting.
|
|
1869
|
-
- [ ] Task
|
|
2108
|
+
- [ ] Task risk and required route were classified.
|
|
1870
2109
|
- [ ] Required role route was followed or an exception was approved.
|
|
1871
2110
|
- [ ] The project manager verified required handoff artifacts, validation evidence, docs sync, and remaining risks.
|
|
1872
2111
|
- [ ] The project manager did not become the architect, coder, and reviewer for the same non-trivial task.
|
|
@@ -1877,10 +2116,10 @@ behavior is correct
|
|
|
1877
2116
|
- [ ] Any reviewer direct fixes were small, local, low-risk, and review-scoped.
|
|
1878
2117
|
- [ ] Larger implementation issues were returned to coder.
|
|
1879
2118
|
- [ ] Architecture, public contract, dependency, schema, auth, permission, payment, or design issues were returned to architect.
|
|
1880
|
-
- [ ]
|
|
2119
|
+
- [ ] Architect performed post-review docs sync / architecture drift check before final PM acceptance.
|
|
1881
2120
|
- [ ] Docs updates or a docs-sync-report explain why affected architecture/module/testing/security/dependency docs are current.
|
|
1882
2121
|
- [ ] The project manager prepared final acceptance, commit, and PR only after reviewer and docs-sync gates passed or an exception was approved.
|
|
1883
|
-
- [ ] 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.
|
|
1884
2123
|
|
|
1885
2124
|
## Architecture
|
|
1886
2125
|
|
|
@@ -1889,7 +2128,7 @@ behavior is correct
|
|
|
1889
2128
|
- [ ] Business logic stays in the correct layer.
|
|
1890
2129
|
- [ ] Existing service/domain/repository APIs are reused where appropriate.
|
|
1891
2130
|
- [ ] No duplicate parallel abstraction was introduced.
|
|
1892
|
-
- [ ]
|
|
2131
|
+
- [ ] `.ai/tools/check-boundaries` passes.
|
|
1893
2132
|
|
|
1894
2133
|
## Public Contract
|
|
1895
2134
|
|
|
@@ -1923,7 +2162,9 @@ behavior is correct
|
|
|
1923
2162
|
- [ ] Module docs are updated if responsibilities changed.
|
|
1924
2163
|
- [ ] Public surface contract is updated if public functions changed.
|
|
1925
2164
|
- [ ] Test plan / validation section is updated if testing strategy changed.
|
|
1926
|
-
- [ ]
|
|
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.
|
|
1927
2168
|
- [ ] No known stale docs are left behind.
|
|
1928
2169
|
|
|
1929
2170
|
## Replan / Design Change
|
|
@@ -1936,10 +2177,10 @@ behavior is correct
|
|
|
1936
2177
|
### 13.2 Acceptance Flow
|
|
1937
2178
|
|
|
1938
2179
|
```text
|
|
1939
|
-
1. Project manager classifies task
|
|
2180
|
+
1. Project manager classifies task risk and required role route
|
|
1940
2181
|
2. Verify required handoff artifacts exist
|
|
1941
2182
|
3. Inspect diff scope
|
|
1942
|
-
4. Compare diff against task
|
|
2183
|
+
4. Compare diff against task brief and architecture plan
|
|
1943
2184
|
5. Compare public surface against Public Surface Contract
|
|
1944
2185
|
6. Review tests for contract and regression coverage
|
|
1945
2186
|
7. Run or inspect validation evidence
|
|
@@ -1953,7 +2194,7 @@ behavior is correct
|
|
|
1953
2194
|
Claude’s final report must include:
|
|
1954
2195
|
|
|
1955
2196
|
```text
|
|
1956
|
-
Task
|
|
2197
|
+
Task risk and required route:
|
|
1957
2198
|
Project manager decision:
|
|
1958
2199
|
Role sessions used:
|
|
1959
2200
|
Handoff artifacts:
|
|
@@ -1983,14 +2224,14 @@ Replan Required:
|
|
|
1983
2224
|
Automation tools:
|
|
1984
2225
|
|
|
1985
2226
|
```text
|
|
1986
|
-
tools/check-boundaries
|
|
1987
|
-
tools/check-public-surface
|
|
1988
|
-
tools/check-contract-tests
|
|
1989
|
-
tools/check-docs-freshness
|
|
1990
|
-
tools/check-generated-artifacts
|
|
1991
|
-
tools/check-agent-rules
|
|
1992
|
-
tools/check-changed
|
|
1993
|
-
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
|
|
1994
2235
|
```
|
|
1995
2236
|
|
|
1996
2237
|
## 14. MCP and Permissions
|
|
@@ -2048,7 +2289,7 @@ Allowed:
|
|
|
2048
2289
|
Required check:
|
|
2049
2290
|
|
|
2050
2291
|
```text
|
|
2051
|
-
tools/check-generated-artifacts
|
|
2292
|
+
.ai/tools/check-generated-artifacts
|
|
2052
2293
|
```
|
|
2053
2294
|
|
|
2054
2295
|
This check should fail when:
|
|
@@ -2070,7 +2311,7 @@ Rules:
|
|
|
2070
2311
|
- critical repeated rules must have stable IDs, such as `RULE-SCOPE-001`, `RULE-ARCH-001`, `RULE-TEST-001`, `RULE-PERM-001`
|
|
2071
2312
|
- root rule text is canonical unless a different canonical source is explicitly defined
|
|
2072
2313
|
- role agent files should reference rule IDs or include generated rule snippets
|
|
2073
|
-
-
|
|
2314
|
+
- `.ai/tools/check-agent-rules` must fail when repeated rule text, rule IDs, or required rule coverage drift
|
|
2074
2315
|
- do not copy long rule blocks manually into many files without a freshness check
|
|
2075
2316
|
|
|
2076
2317
|
### 15.3 Scaffolding Must Earn Its Keep
|
|
@@ -2149,11 +2390,11 @@ Monthly review:
|
|
|
2149
2390
|
- Which checks should move into hooks?
|
|
2150
2391
|
- Which checks, hooks, or role requirements can be simplified?
|
|
2151
2392
|
|
|
2152
|
-
`known-issues.md` triage (every monthly review):
|
|
2393
|
+
`docs/known-issues.md` triage (every monthly review):
|
|
2153
2394
|
|
|
2154
2395
|
- For each unhandled entry, decide: promote to task, fold into a planned change, or dismiss.
|
|
2155
|
-
- Entries older than 90 days with no action are dismissed with a reason recorded in `
|
|
2156
|
-
- `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.
|
|
2157
2398
|
|
|
2158
2399
|
## 17. Minimum Team Rules
|
|
2159
2400
|
|
|
@@ -2170,7 +2411,7 @@ If you can only enforce 16 rules, enforce these:
|
|
|
2170
2411
|
9. Ordinary tasks must define public function contracts.
|
|
2171
2412
|
10. New or modified public functions must have contract tests.
|
|
2172
2413
|
11. Code changes must run relevant validation.
|
|
2173
|
-
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.
|
|
2174
2415
|
13. Manual indexes are not authoritative; generated context must be freshness-checked.
|
|
2175
2416
|
14. AI review uses fresh context or a reviewer role session.
|
|
2176
2417
|
15. High-risk actions require human approval.
|