vibe-coding-master 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +207 -66
  2. package/dist/backend/adapters/filesystem.js +13 -0
  3. package/dist/backend/adapters/git-adapter.js +79 -1
  4. package/dist/backend/adapters/translation-provider.js +145 -0
  5. package/dist/backend/api/artifact-routes.js +16 -7
  6. package/dist/backend/api/harness-routes.js +22 -0
  7. package/dist/backend/api/message-routes.js +2 -0
  8. package/dist/backend/api/project-routes.js +3 -8
  9. package/dist/backend/api/task-routes.js +14 -0
  10. package/dist/backend/api/translation-routes.js +70 -0
  11. package/dist/backend/runtime/node-pty-runtime.js +20 -18
  12. package/dist/backend/server.js +33 -2
  13. package/dist/backend/services/app-settings-service.js +128 -0
  14. package/dist/backend/services/artifact-service.js +7 -4
  15. package/dist/backend/services/claude-transcript-service.js +509 -0
  16. package/dist/backend/services/command-dispatcher.js +4 -2
  17. package/dist/backend/services/harness-service.js +196 -0
  18. package/dist/backend/services/message-service.js +1 -1
  19. package/dist/backend/services/project-service.js +50 -9
  20. package/dist/backend/services/session-service.js +13 -9
  21. package/dist/backend/services/status-service.js +79 -1
  22. package/dist/backend/services/task-service.js +118 -4
  23. package/dist/backend/services/translation-prompts.js +173 -0
  24. package/dist/backend/services/translation-queue.js +39 -0
  25. package/dist/backend/services/translation-service.js +546 -0
  26. package/dist/backend/templates/handoff.js +32 -0
  27. package/dist/backend/templates/harness/architect-agent.js +12 -0
  28. package/dist/backend/templates/harness/claude-root.js +14 -0
  29. package/dist/backend/templates/harness/coder-agent.js +11 -0
  30. package/dist/backend/templates/harness/gitignore.js +9 -0
  31. package/dist/backend/templates/harness/project-manager-agent.js +14 -0
  32. package/dist/backend/templates/harness/reviewer-agent.js +13 -0
  33. package/dist/backend/ws/translation-ws.js +35 -0
  34. package/dist/shared/types/harness.js +1 -0
  35. package/dist/shared/types/translation.js +5 -0
  36. package/dist/shared/validation/artifact-check.js +15 -1
  37. package/dist/shared/validation/language-detect.js +46 -0
  38. package/dist-frontend/assets/index-CuiNNOzj.css +32 -0
  39. package/dist-frontend/assets/index-D59GuHCR.js +58 -0
  40. package/dist-frontend/index.html +2 -2
  41. package/docs/cc-best-practices.md +109 -40
  42. package/docs/product-design.md +370 -1374
  43. package/docs/v1-architecture-design.md +595 -1114
  44. package/docs/v1-implementation-plan.md +898 -1603
  45. package/package.json +1 -1
  46. package/scripts/verify-package.mjs +8 -0
  47. package/dist/backend/templates/role-messaging-context.js +0 -44
  48. package/dist-frontend/assets/index-Bah6k-Ix.css +0 -32
  49. package/dist-frontend/assets/index-EMaQuIB6.js +0 -58
  50. package/docs/v1-message-bus-orchestration-design.md +0 -534
@@ -4,8 +4,8 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>VibeCodingMaster</title>
7
- <script type="module" crossorigin src="/assets/index-EMaQuIB6.js"></script>
8
- <link rel="stylesheet" crossorigin href="/assets/index-Bah6k-Ix.css">
7
+ <script type="module" crossorigin src="/assets/index-D59GuHCR.js"></script>
8
+ <link rel="stylesheet" crossorigin href="/assets/index-CuiNNOzj.css">
9
9
  </head>
10
10
  <body>
11
11
  <div id="root"></div>
@@ -68,6 +68,7 @@ Recommended structure:
68
68
  ```text
69
69
  repo/
70
70
  CLAUDE.md
71
+ .gitignore
71
72
 
72
73
  docs/
73
74
  ARCHITECTURE.md
@@ -95,6 +96,7 @@ repo/
95
96
  commands/
96
97
 
97
98
  .ai/
99
+ vcm/ # ignored local VCM control state
98
100
  task-specs/
99
101
  handoffs/
100
102
  <task-slug>/
@@ -137,7 +139,7 @@ Minimum baseline for non-trivial AI coding:
137
139
  - root `CLAUDE.md`
138
140
  - module-local `CLAUDE.md` for edited modules
139
141
  - architecture, module map, testing, security, and dependency docs
140
- - role agents for project management/user communication/translation, architecture/planning, coding, and independent review/testing
142
+ - role agents for project management/user communication, architecture/planning, coding, and independent review/testing
141
143
  - task specs, handoff artifacts, progress state, decisions, validation logs, known issues, and generated context artifacts
142
144
  - fast, changed-file, module, boundary, public-surface, contract-test, generated-artifact, docs-freshness, and agent-rule checks
143
145
  - hooks or CI gates for protected files, validation, docs sync, public contracts, and test quality
@@ -198,10 +200,10 @@ Root template:
198
200
 
199
201
  Role-specific behavior lives in `.claude/agents/`.
200
202
 
201
- - Use `claude --agent project-manager` for user communication, translation, task clarification, task specs, role routing, role commands, status summaries, and final acceptance.
202
- - Use `claude --agent architect` for architecture plans, module boundaries, file responsibilities, public contracts, test contracts, and phase plans.
203
+ - Use `claude --agent project-manager` for user communication, task clarification, task specs, role routing, role commands, status summaries, and final acceptance.
204
+ - 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.
203
205
  - Use `claude --agent coder` for implementation and direct tests within an approved plan.
204
- - Use `claude --agent reviewer` for independent review, test adequacy, validation evidence, docs sync, and acceptance findings.
206
+ - Use `claude --agent reviewer` for independent review, test adequacy, validation evidence, docs gap detection, and acceptance findings.
205
207
  - Do not use an untagged session as an implicit project manager for non-trivial work.
206
208
  - Do not simulate another role inside the wrong session.
207
209
 
@@ -209,13 +211,33 @@ Role-specific behavior lives in `.claude/agents/`.
209
211
 
210
212
  - For complex features, cross-module changes, refactors, public API changes, schema changes, auth, payment, permission, or security-sensitive work, start Claude Code with an explicit role: `claude --agent <role>`.
211
213
  - Default core roles are `project-manager`, `architect`, `coder`, and `reviewer`.
212
- - The `project-manager` role owns user communication, translation, task routing, role commands, handoff verification, and final status reporting.
214
+ - The `project-manager` role owns user communication, task routing, role commands, handoff verification, final status reporting, and PR preparation after required gates pass.
213
215
  - Do not let one coding session own architecture/plan decisions, implementation, final testing responsibility, and review.
214
216
  - Role outputs are exchanged through `.ai/handoffs/<task-slug>/`, not through chat history.
215
217
  - When the required role route includes `architect`, coding must not start until the architecture and plan artifact exists.
216
218
  - 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.
217
219
  - 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 `tools/check-agent-rules`. Do not maintain untracked manual copies.
218
220
 
221
+ ## VCM Managed Harness Blocks
222
+
223
+ If VibeCodingMaster or another 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.
224
+
225
+ Allowed managed block format:
226
+
227
+ ```md
228
+ <!-- VCM:BEGIN version=1 -->
229
+ VCM-managed rules.
230
+ <!-- VCM:END -->
231
+ ```
232
+
233
+ Rules:
234
+
235
+ - VCM may create missing `CLAUDE.md` and `.claude/agents/{project-manager,architect,coder,reviewer}.md` from recommended defaults.
236
+ - If a file already exists, VCM may only insert or replace the VCM managed block.
237
+ - VCM must not overwrite user-authored content outside managed blocks.
238
+ - After applying harness changes, VCM must report changed files and recommend a user review/commit.
239
+ - Session startup should pass environment variables and start the role agent; it should not paste a long VCM context into the terminal.
240
+
219
241
  ## Default Behavior
220
242
 
221
243
  - State assumptions before coding; ask when requirements, boundaries, or acceptance criteria are unclear.
@@ -241,7 +263,7 @@ Role-specific behavior lives in `.claude/agents/`.
241
263
  - Required validation passes.
242
264
  - New or modified public functions have contract tests.
243
265
  - Behavior changes have regression tests unless impractical.
244
- - Plan, architecture, public contract, test strategy, and module responsibility changes are reflected in docs.
266
+ - Plan, architecture, public contract, test strategy, and module responsibility changes are reflected in docs after post-review architect docs sync.
245
267
  - Follow-ups are recorded in `.ai/state/known-issues.md` or the execution plan.
246
268
  ```
247
269
 
@@ -418,6 +440,7 @@ Explore
418
440
  -> implement phase 1
419
441
  -> validate
420
442
  -> review
443
+ -> architect docs sync / architecture drift check
421
444
  -> commit
422
445
  -> implement next phase
423
446
  ```
@@ -537,7 +560,7 @@ Do not include:
537
560
 
538
561
  For large projects, the default execution model should be explicit role-based sessions, not dynamic role routing inside one generic Claude conversation.
539
562
 
540
- The user-facing task should start with a `project-manager` role session. The project manager owns user communication, translation, role command dispatch, severity classification, role routing, progress tracking, and process verification. It does not own architecture, coding, and independent review for the same non-trivial task.
563
+ The user-facing task should start with a `project-manager` role session. The project manager owns user communication, role command dispatch, severity classification, role routing, progress tracking, and process verification. It does not own architecture, coding, and independent review for the same non-trivial task.
541
564
 
542
565
  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.
543
566
 
@@ -554,7 +577,7 @@ Project manager responsibilities:
554
577
  ```text
555
578
  communicate with user
556
579
  -> clarify task
557
- -> translate user intent into a task brief / task spec
580
+ -> turn user intent into a task brief / task spec
558
581
  -> classify severity
559
582
  -> choose required role route
560
583
  -> prepare the next role command
@@ -562,12 +585,14 @@ communicate with user
562
585
  -> start or ask the user to start architect/coder/reviewer/specialist sessions when needed
563
586
  -> track progress, blockers, validation, docs sync, and Replan
564
587
  -> verify role outputs and handoff artifacts
588
+ -> request post-review architect docs sync when required
589
+ -> prepare commit and submit the PR only after review and docs sync gates pass
565
590
  -> summarize final status and risks to the user
566
591
  ```
567
592
 
568
593
  The project manager is a process owner, not an execution owner.
569
594
 
570
- 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 translation from user intent to precise agent instructions.
595
+ 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.
571
596
 
572
597
  It may route T0/T1 work to a lightweight coder flow when the task is small, scoped, and low risk. For non-trivial work, it coordinates role sessions and verifies the process.
573
598
 
@@ -616,9 +641,16 @@ coder command:
616
641
 
617
642
  reviewer command:
618
643
  read task spec, architecture-plan.md, implementation-log.md, validation-log.md, and git diff
619
- verify scope, architecture, public contract, tests, validation, and docs sync
644
+ verify scope, architecture, public contract, tests, validation, and docs gaps
620
645
  write review-report.md
621
646
  only apply small, local, low-risk review-scoped fixes
647
+
648
+ architect docs-sync command:
649
+ read task spec, architecture-plan.md, implementation-log.md, validation-log.md, review-report.md, and git diff
650
+ verify whether the final code still matches the approved architecture and public contracts
651
+ update architecture/module/testing/security docs when the code change made them stale
652
+ write docs-sync-report.md with docs changed, docs intentionally unchanged, and remaining doc risks
653
+ stop and request Replan if implementation drift changes architecture, public contracts, dependency direction, schema, auth, permission, payment, or design assumptions
622
654
  ```
623
655
 
624
656
  The project manager may use a prompt compiler or template system to build role commands, but the responsibility stays with the project manager. A role command is an auditable artifact: if a role agent fails because the command was vague, the harness should improve the command template rather than blaming the role agent alone.
@@ -648,16 +680,16 @@ If the current session was not started with the required role, stop and ask the
648
680
 
649
681
  This is not progressive adoption. The full harness exists by default; the role chain depends on task risk.
650
682
 
651
- All user-facing routes begin with `project-manager`. The project manager may hand off T0/T1 work to `coder` quickly, but it still owns translation, status reporting, and acceptance communication.
683
+ All user-facing routes begin with `project-manager`. The project manager may hand off T0/T1 work to `coder` quickly, but it still owns status reporting and acceptance communication.
652
684
 
653
685
  | Task class | Examples | Required role route |
654
686
  | --- | --- | --- |
655
- | T0 trivial | copy, comments, docs typo, tiny config with no behavior change | `project-manager` -> `coder`; optional reviewer checklist |
656
- | T1 small scoped change | single-file bug, focused test addition, known-pattern fix | `project-manager` -> `coder` -> fresh review context or `reviewer` |
657
- | T2 ordinary feature | bounded behavior, normal multi-file feature, ordinary PR | `project-manager` -> `architect` -> `coder` -> `reviewer` |
658
- | T3 cross-module / architectural | cross-module change, module boundary change, refactor, new public surface | `project-manager` -> `architect` -> `coder` -> `reviewer` |
659
- | 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` -> human approval |
660
- | T5 large rewrite / greenfield | new subsystem, major rewrite, migration across many modules | `project-manager` -> `architect`; then repeat `coder` -> `reviewer` per phase, with architect review at phase boundaries |
687
+ | T0 trivial | copy, comments, docs typo, tiny config with no behavior change | `project-manager` -> `coder`; optional reviewer checklist; PM commit/PR |
688
+ | T1 small scoped change | single-file bug, focused test addition, known-pattern fix | `project-manager` -> `coder` -> fresh review context or `reviewer` -> docs checklist; PM commit/PR |
689
+ | T2 ordinary feature | bounded behavior, normal multi-file feature, ordinary PR | `project-manager` -> `architect` -> `coder` -> `reviewer` -> `architect` docs sync -> PM commit/PR |
690
+ | 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 |
691
+ | 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 |
692
+ | 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 |
661
693
 
662
694
  If classification is unclear, use the stricter route.
663
695
 
@@ -682,9 +714,9 @@ Role responsibilities:
682
714
 
683
715
  ```text
684
716
  project-manager
685
- owns user communication, multilingual translation, task clarification, task specs, role routing, and role command dispatch
686
- translates user input into an English engineering task when needed
687
- translates role outputs back into the user's preferred language
717
+ owns user communication, task clarification, task specs, role routing, and role command dispatch
718
+ turns user input into an engineering task when needed
719
+ summarizes role outputs back to the user
688
720
  creates and verifies handoff artifacts
689
721
  tracks progress, blockers, validation, docs sync, and Replan
690
722
  outputs task specs, role commands, status summaries, and final acceptance reports
@@ -693,7 +725,9 @@ project-manager
693
725
  architect
694
726
  owns architecture and plan
695
727
  defines module boundaries, file responsibilities, public contracts, dependency direction, risk, and phases
728
+ owns post-review docs sync and architecture drift checks before PM final acceptance
696
729
  outputs .ai/handoffs/<task-slug>/architecture-plan.md
730
+ outputs .ai/handoffs/<task-slug>/docs-sync-report.md when a post-review docs sync gate is required
697
731
  must not implement production code
698
732
 
699
733
  coder
@@ -705,13 +739,13 @@ coder
705
739
 
706
740
  reviewer
707
741
  owns independent acceptance and final test responsibility
708
- checks scope, role compliance, architecture compliance, public contract compliance, docs sync, validation evidence, and risk
742
+ checks scope, role compliance, architecture compliance, public contract compliance, docs gaps, validation evidence, and risk
709
743
  checks, designs, and adds missing tests when needed
710
744
  may directly apply small, local, low-risk review fixes
711
745
  owns complex tests, E2E coverage, regression matrix, and release-level validation recommendations
712
746
  outputs .ai/handoffs/<task-slug>/review-report.md
713
747
  must escalate larger implementation issues to coder
714
- must escalate architecture, public contract, or design issues to architect
748
+ must escalate architecture, public contract, design, or documentation drift issues to architect
715
749
  ```
716
750
 
717
751
  ### 7.5 Role Permission Matrix
@@ -720,8 +754,8 @@ Prompt rules are not enough. Role separation must be backed by tool scope, permi
720
754
 
721
755
  | Role | Suggested tools | Write scope | Must not |
722
756
  | --- | --- | --- | --- |
723
- | `project-manager` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | task specs, role commands, handoff metadata, status/progress/known-issues, final reports | implement non-trivial production code, approve without reviewer evidence, replace architect/coder/reviewer roles |
724
- | `architect` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | architecture plan, task spec, architecture docs only with approval | edit production code, rewrite tests, expand task scope |
757
+ | `project-manager` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | task specs, role commands, handoff metadata, status/progress/known-issues, final reports, PR description | implement non-trivial production code, approve without reviewer/docs-sync evidence, replace architect/coder/reviewer roles |
758
+ | `architect` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | architecture plan, docs sync report, task spec, approved architecture/module/testing/security docs | edit production code, rewrite tests, expand task scope |
725
759
  | `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 |
726
760
  | `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 |
727
761
  | `security-specialist` | `Read`, `Grep`, `Glob`, `Bash`, `Edit`, `Write` | security review report and approved security tests | bypass approvals, edit production code without explicit scope |
@@ -731,8 +765,8 @@ Prompt rules are not enough. Role separation must be backed by tool scope, permi
731
765
  Recommended permission modes:
732
766
 
733
767
  ```text
734
- project-manager: default with write hooks limited to task specs, role commands, handoff metadata, state files, and final reports
735
- architect: default with write hooks limited to architecture-plan.md, task specs, and approved docs
768
+ project-manager: default with write hooks limited to task specs, role commands, handoff metadata, state files, final reports, and PR description
769
+ architect: default with write hooks limited to architecture-plan.md, docs-sync-report.md, task specs, and approved docs
736
770
  coder: default or acceptEdits, but only inside approved scope
737
771
  reviewer: default with production-code writes blocked except explicitly review-scoped small fixes; test writes allowed
738
772
  specialist: default with write hooks limited to specialist reports, tests, and approved files
@@ -749,13 +783,14 @@ Required handoff directory:
749
783
  ```text
750
784
  .ai/handoffs/<task-slug>/
751
785
  role-commands/
752
- architect-command.md
753
- coder-command.md
754
- reviewer-command.md
786
+ architect.md
787
+ coder.md
788
+ reviewer.md
755
789
  architecture-plan.md
756
790
  implementation-log.md
757
791
  validation-log.md
758
792
  review-report.md
793
+ docs-sync-report.md
759
794
  ```
760
795
 
761
796
  Each role session must start by reading the artifacts it depends on:
@@ -769,6 +804,10 @@ architect
769
804
  reads: task request, task spec, ARCHITECTURE.md, MODULE_MAP.md, module-local CLAUDE.md, relevant source/tests
770
805
  writes: architecture-plan.md
771
806
 
807
+ architect docs sync
808
+ reads: task spec, architecture-plan.md, implementation-log.md, validation-log.md, review-report.md, git diff, relevant docs
809
+ writes: docs updates when needed, docs-sync-report.md
810
+
772
811
  coder
773
812
  reads: task spec, architecture-plan.md, relevant module docs
774
813
  writes: code, baseline tests, implementation-log.md, validation-log.md
@@ -795,7 +834,7 @@ reviewer:
795
834
  owns complex test strategy, E2E smoke/release coverage, and regression matrix
796
835
  may directly apply small, local, low-risk review fixes
797
836
  must request coder fixes for larger implementation issues
798
- must request architect review for architecture, public contract, dependency, schema, auth, permission, payment, or design issues
837
+ must request architect review for architecture, public contract, dependency, schema, auth, permission, payment, design, or docs drift issues
799
838
  must not weaken tests to pass validation
800
839
  ```
801
840
 
@@ -832,6 +871,7 @@ escalate to architect:
832
871
  public contract is wrong
833
872
  dependency direction is wrong
834
873
  schema, auth, permission, payment, public API, or security design is wrong
874
+ architecture, module, testing, security, or dependency docs are stale after implementation
835
875
  the implementation reveals that the architecture plan is invalid
836
876
  ```
837
877
 
@@ -896,9 +936,19 @@ Handoff artifact schemas:
896
936
  ## Escalations To Coder / Architect
897
937
  ## E2E / Regression Recommendation
898
938
  ## Validation Evidence
899
- ## Docs Sync
939
+ ## Docs Gap Review
900
940
  ## Findings
901
941
  ## Decision
942
+
943
+ # docs-sync-report.md
944
+
945
+ ## Summary
946
+ ## Architecture Drift Check
947
+ ## Docs Updated
948
+ ## Docs Reviewed And Left Unchanged
949
+ ## Public Contract / Module Boundary Notes
950
+ ## Remaining Documentation Risks
951
+ ## Decision
902
952
  ```
903
953
 
904
954
  ### 7.7 Role Session vs Subagent
@@ -909,8 +959,8 @@ Worktree isolation is by task, not by role:
909
959
 
910
960
  ```text
911
961
  one task
912
- -> one branch
913
- -> one worktree
962
+ -> one branch: feature/<task-slug>
963
+ -> one worktree: .ai/vcm/worktrees/<task-slug>
914
964
  -> one handoff directory
915
965
  -> architect -> coder -> reviewer in sequence
916
966
  ```
@@ -1068,7 +1118,7 @@ For large features:
1068
1118
 
1069
1119
  ```text
1070
1120
  project-manager session
1071
- -> communicate with user + translate intent + classify task + route roles + track process
1121
+ -> communicate with user + clarify intent + classify task + route roles + track process
1072
1122
 
1073
1123
  architect session
1074
1124
  -> architecture-plan.md
@@ -1079,7 +1129,13 @@ coder session
1079
1129
  reviewer session
1080
1130
  -> review-report.md + missing tests/fixtures if needed + validation-log.md
1081
1131
 
1082
- human approval
1132
+ architect docs-sync session
1133
+ -> docs updates if needed + docs-sync-report.md
1134
+
1135
+ human approval when required
1136
+
1137
+ project-manager session
1138
+ -> final acceptance + commit + PR submission
1083
1139
  ```
1084
1140
 
1085
1141
  For small bug fixes or ordinary PRs, one coder session is acceptable if the task spec is clear, file responsibilities are explicit, public contracts are defined when needed, and validation is cheap.
@@ -1382,8 +1438,8 @@ Default rule:
1382
1438
 
1383
1439
  ```text
1384
1440
  one task
1385
- -> one branch
1386
- -> one worktree
1441
+ -> one branch: feature/<task-slug>
1442
+ -> one worktree: .ai/vcm/worktrees/<task-slug>
1387
1443
  -> one handoff directory
1388
1444
  -> one PR
1389
1445
  ```
@@ -1423,9 +1479,19 @@ Branch rules:
1423
1479
 
1424
1480
  - never do AI implementation work directly on the main branch
1425
1481
  - one task branch should map to one task worktree
1482
+ - VCM-managed task branches should use `feature/<task-slug>`
1483
+ - VCM-managed task worktrees should live under `.ai/vcm/worktrees/<task-slug>`
1484
+ - `.gitignore` should contain a VCM managed block that ignores `.ai/vcm/`
1485
+ - a task should not switch to a different branch/worktree after creation; create a new task instead
1426
1486
  - large work should use phase commits on the same task branch unless phases are independently releasable
1427
1487
  - if a task becomes too large, split it into child tasks with explicit branch and PR ownership
1428
1488
 
1489
+ Cleanup rules:
1490
+
1491
+ - after task completion, remove the task worktree only after role sessions are stopped and uncommitted work is handled
1492
+ - remove VCM task/session/message/orchestration metadata with the worktree cleanup
1493
+ - keep the task branch by default until PR merge; delete it only with explicit confirmation
1494
+
1429
1495
  Small commits:
1430
1496
 
1431
1497
  - one commit per phase
@@ -1787,7 +1853,7 @@ behavior is correct
1787
1853
 
1788
1854
  ## Role / Handoff
1789
1855
 
1790
- - [ ] The task used an explicit `project-manager` role session for user communication, translation, routing, and status reporting.
1856
+ - [ ] The task used an explicit `project-manager` role session for user communication, routing, and status reporting.
1791
1857
  - [ ] Task severity was classified.
1792
1858
  - [ ] Required role route was followed or an exception was approved.
1793
1859
  - [ ] The project manager verified required handoff artifacts, validation evidence, docs sync, and remaining risks.
@@ -1799,6 +1865,9 @@ behavior is correct
1799
1865
  - [ ] Any reviewer direct fixes were small, local, low-risk, and review-scoped.
1800
1866
  - [ ] Larger implementation issues were returned to coder.
1801
1867
  - [ ] Architecture, public contract, dependency, schema, auth, permission, payment, or design issues were returned to architect.
1868
+ - [ ] For T2+ work, architect performed post-review docs sync / architecture drift check before final PM acceptance.
1869
+ - [ ] Docs updates or a docs-sync-report explain why affected architecture/module/testing/security/dependency docs are current.
1870
+ - [ ] The project manager prepared final acceptance, commit, and PR only after reviewer and docs-sync gates passed or an exception was approved.
1802
1871
  - [ ] Task-level validation evidence is recorded in `.ai/handoffs/<task-slug>/validation-log.md` when a handoff directory exists.
1803
1872
 
1804
1873
  ## Architecture
@@ -2079,7 +2148,7 @@ Monthly review:
2079
2148
  If you can only enforce 16 rules, enforce these:
2080
2149
 
2081
2150
  1. User-facing tasks start with `claude --agent project-manager`; untagged sessions are not implicit project managers.
2082
- 2. The `project-manager` agent owns user communication, translation, task clarification, and precise role command dispatch.
2151
+ 2. The `project-manager` agent owns user communication, task clarification, and precise role command dispatch.
2083
2152
  3. Complex tasks use explicit role sessions, handoff artifacts, and plan first; do not edit directly.
2084
2153
  4. One task uses one branch, one worktree, one handoff directory, and one PR by default.
2085
2154
  5. Role sessions for the same task work in the same task worktree sequentially; parallel write work uses separate task or sub-task worktrees.
@@ -2123,7 +2192,7 @@ Project manager becomes coder/reviewer
2123
2192
  -> project manager coordinates and verifies; role sessions execute
2124
2193
 
2125
2194
  Project manager only tracks status but sends vague role prompts
2126
- -> project manager translates user intent into precise role commands with scope, contracts, validation, outputs, and stop conditions
2195
+ -> project manager turns user intent into precise role commands with scope, contracts, validation, outputs, and stop conditions
2127
2196
 
2128
2197
  Role-based worktree fragmentation
2129
2198
  -> one task worktree; architect -> coder -> reviewer hand off sequentially inside it