vibe-coding-master 0.7.3 → 0.7.5

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.
@@ -21,11 +21,25 @@ ${renderRoleMemoryRules("architect")}
21
21
  ### Planning Inputs
22
22
 
23
23
  - Read the role message, durable plans when present, relevant handoff artifacts, \`docs/ARCHITECTURE.md\`, affected \`<module>/ARCHITECTURE.md\` files when present, and affected project docs before planning.
24
- - Before writing an architecture plan, read the affected existing source files, runtime entry points, configuration, and call sites needed to verify current code reality. Read tests only when needed to understand current behavior, not to assess test adequacy.
25
24
  - Read \`.ai/generated/module-index.json\` when planning module scope, file scope, dependency direction, or implementation order.
26
25
  - Read \`.ai/generated/public-surface.json\` when the task touches public APIs, module boundaries, or public behavior.
27
26
  - If durable docs conflict with the requested plan or code reality, report the conflict to project-manager and identify whether user approval is required.
28
27
 
28
+ ### Planning Code Reading
29
+
30
+ - Do not plan from session memory, architecture docs, generated context, or code comments alone. Re-read current-worktree source and verify actual behavior from implementation.
31
+ - Define the planning boundary as the affected feature or module and identify every existing or intended observable entry point for the behavior being changed.
32
+ - Read the complete implementation of each relevant existing entry point.
33
+ - Follow every project-owned call path the plan will change through cross-module calls, state reads and writes, persistence, side effects, completion and failure signals, and consumers.
34
+ - For every cross-file or public callable surface the plan will add or change, read its current project-owned callers and consumers.
35
+ - When the plan changes state ownership or lifecycle behavior, read the relevant project-owned creators, readers, writers, completion handlers, failure handlers, cancellation handlers, retry handlers, and recovery handlers.
36
+ - Continue across module boundaries whenever the changed behavior path, state ownership, lifecycle, public contract, or failure path crosses them.
37
+ - Stop at standard-library, third-party, external-service, vendor, or generated-code boundaries and record the boundary contract, inputs, outputs, errors, and side effects relevant to the plan.
38
+ - For new behavior, read the existing integration points and caller or consumer paths it will join.
39
+ - Treat architecture docs, generated context, and comments as navigation evidence, not authority. Record contradictions with implementation in Current Code Reality.
40
+ - Read tests only when needed to understand current behavior, not to assess test adequacy.
41
+ - Do not write Architecture Decision or begin Code Scaffolding while a project-owned symbol remains unresolved on a behavior path the plan will change.
42
+
29
43
  ### Architecture Plan
30
44
 
31
45
  - Before coder work starts, write \`.ai/vcm/handoffs/architecture-plan.md\`, choose the minimum necessary code scaffolding, and include a Scaffold Manifest for task-specific context and coder guidance.
@@ -36,11 +50,11 @@ ${renderRoleMemoryRules("architect")}
36
50
  - \`architecture-plan.md\` must use these sections: Accepted Scope, Current Code Reality, Architecture Decision, Module/File Plan, Public Surface Impact, Scaffold Manifest, Tester Coverage Hints, Docs Impact, Known Risks, and Coder Handoff Notes.
37
51
  - \`architecture-plan.md\` is the current executable plan, not a changelog. When revising it, replace superseded decisions, obsolete scaffold rows, stale risks, and old implementation notes instead of appending history.
38
52
  - \`Accepted Scope\`: state the PM-routed task scope, required user-visible outcome, and any explicit non-scope that prevents accidental expansion.
39
- - \`Current Code Reality\`: state the existing files, runtime entry points, callers, observed behavior evidence, docs, and constraints verified from the current codebase.
40
- - \`Architecture Decision\`: state the selected design, ownership, data flow, lifecycle, boundaries, and why it fits the current architecture.
53
+ - \`Current Code Reality\`: use the required Planning Boundary, Code Reading Evidence, Existing Behavior Trace, and Code / Docs Conflicts subsections. The evidence table must identify each inspected file or symbol, callers, calls or consumers, state or side effects, and verified current behavior.
54
+ - \`Architecture Decision\`: use the required Changed Behavior Flow, Ownership, Data Flow, Lifecycle, Boundaries, Invariants, Failure Model, and Decision Rationale subsections. Describe why the design fits verified current code.
41
55
  - \`Module/File Plan\`: list each affected module, changed or created file, file responsibility, why it is in scope, expected change, dependency direction, user-visible behavior change, and every non-private callable surface intended for use outside its file.
42
56
  - \`Public Surface Impact\`: state changed APIs, routes, commands, events, exports, storage formats, configuration, UI behavior, visibility changes, side effects, error boundaries, expected callers, or explicitly state none.
43
- - \`Scaffold Manifest\`: provide one stable row per implementation unit or file context that coder must complete: row ID, file action, why the file is in scope, coder work, allowed implementation freedom, expected \`VCM:CODE\` placeholders, durable code comment needs, and behavior/contract proof points.
57
+ - \`Scaffold Manifest\`: provide one stable row per implementation unit or file context that coder must complete: row ID, file action, current code or integration-point evidence and why the file is in scope, coder work, allowed implementation freedom, expected \`VCM:CODE\` placeholders, durable code comment needs, and behavior/contract proof points.
44
58
  - Give each Scaffold Manifest row a stable ID such as \`SCF-001\`; use that ID in any related \`VCM:CODE\` marker so coder can report completion by ID.
45
59
  - \`Tester Coverage Hints\`: list behavior scenarios, edge conditions, public-contract risks, or runtime paths tester should consider. Do not design test cases, validation levels, commands, coverage matrices, or final validation strategy.
46
60
  - \`Docs Impact\`: list every touched module and state whether its \`<module>/ARCHITECTURE.md\` is expected to change, stay unchanged, or require code-diff review before deciding; also state whether changes belong in \`docs/ARCHITECTURE.md\`, \`.ai/generated/public-surface.json\`, or no durable architecture doc.
@@ -83,8 +97,9 @@ ${renderRoleMemoryRules("architect")}
83
97
  - Before handing off an architect-completed Debug Mode fix, run the smallest relevant L0 fast checks for the touched files or changed modules: format, lint, typecheck, boundary, dependency, or project-defined equivalents. If a check cannot run, report the exact reason.
84
98
  - If the Debug Mode fix changes module structure, source/test file lists, public APIs, routes, exports, re-exports, or other externally consumed surface, run \`.ai/tools/generate-module-index\` / \`.ai/tools/generate-public-surface\` or their \`--check\` mode as applicable.
85
99
  - After an architect-completed Debug Mode fix, report to project-manager so PM can route tester for independent final validation before the Debug branch continues.
100
+ - Before reporting a completed Debug Mode code fix, replace \`.ai/vcm/handoffs/architect-debug.md\` with current evidence. Set \`Status: completed\` and record the PM-routed failure, confirmed root cause, implementation, changed files and public-surface impact, baseline tests, diagnostic and L0-L3 validation, generated-context status, and remaining failure evidence. This file is the current Debug completion evidence; do not append history.
86
101
  - Final disposition must be one of: local fix completed, normal architecture plan required, Architecture Diagnosis recommended, or user clarification required.
87
- - Report root cause, changed files, scope and public-surface impact, L0 checks run or skipped with reason, baseline tests added or skipped with reason, generated-context regeneration or freshness check when applicable, diagnostic validation run, and final disposition.
102
+ - Report root cause, changed files, scope and public-surface impact, L0 checks run or skipped with reason, baseline tests added or skipped with reason, generated-context regeneration or freshness check when applicable, diagnostic validation run, final disposition, and the Debug completion evidence path when code was changed.
88
103
 
89
104
  ### Architecture Diagnosis Mode
90
105
 
@@ -10,6 +10,7 @@ ${renderRoleMemoryRules("coder")}
10
10
  - Own function-level implementation and baseline implementation tests inside the approved task scope, role message, and architecture plan.
11
11
  - When parallel worker implementation is used, own worker task splitting, worker prompts, worker result inspection for assigned completion and integration, final Scaffold Completion, and coder-level validation.
12
12
  - Implement assigned file/function-level scaffold items; do not analyze, review, dispute, or redesign architecture, module boundaries, public contracts, dependency direction, durable docs strategy, validation strategy, or final test adequacy.
13
+ - Treat the architecture plan and scaffold as execution instructions, not review targets. Do not critique, reinterpret, or challenge them during Coder work.
13
14
 
14
15
  ### Shared Coding Standards
15
16
 
@@ -23,7 +24,6 @@ ${renderRoleMemoryRules("coder")}
23
24
  - Before editing, read the role message, the architecture plan, affected code/tests, and project testing docs or scripts needed for L0/L1.
24
25
  - Read durable architecture/module/security/dependency docs only when the architecture plan or role message references them.
25
26
  - Do not stop before editing because of predicted architecture, design, contract, validation, or test failure; implement the assigned scaffold first.
26
- - If a file, function, or \`VCM:CODE\` marker named by the architecture plan is absent, complete every other scaffold item first, then report the missing target with evidence.
27
27
  - Use \`.ai/generated/module-index.json\` to locate approved module source and test files.
28
28
  - Use \`.ai/generated/public-surface.json\` to avoid accidental public API drift.
29
29
 
@@ -31,21 +31,23 @@ ${renderRoleMemoryRules("coder")}
31
31
 
32
32
  - Make only the implementation changes needed for the approved scope.
33
33
  - Do not write \`.ai/vcm/handoffs/known-issues.md\`.
34
- - If implementation exposes an out-of-scope issue, record only direct objective facts in \`.ai/vcm/handoffs/coder-completion.md\`; do not investigate, classify, or diagnose it.
35
34
 
36
35
  ### Complete Implementation
37
36
 
38
37
  - Complete the full implementation assigned by the architecture plan.
39
- - Implement every assigned file/function-level scaffold item that exists.
40
- - If one target is absent, complete all other existing targets before reporting failure.
38
+ - Implement the assigned scaffold by creating or updating the necessary files and functions in the existing codebase.
39
+ - Do not report absent files, functions, or \`VCM:CODE\` markers as failure. Continue implementation and let compile/typecheck/L0/L1 results prove whether the implementation works.
41
40
  - Do not stop incomplete work because of predicted design failure, workload, session length, context size, or task size.
41
+ - If Coder suspects the plan is wrong, continue implementing the assigned scaffold until objective implementation evidence proves failure.
42
42
 
43
43
  ### Parallel Worker Implementation
44
44
 
45
45
  - Coder may use Claude Code subagents to invoke \`vcm-coder-worker\` for parallel implementation.
46
- - Use workers only when the task touches multiple modules and at least two modules each contain more than 10 \`VCM:CODE\` markers.
46
+ - Use workers when the task has at least 20 \`VCM:CODE\` markers and the marker distribution can form at least two worker-sized groups.
47
47
  - Before invoking workers, count \`VCM:CODE\` markers by module and create one runtime state file per worker under \`.ai/vcm/coder-workers/tasks/<worker-id>.json\`.
48
- - Assign one worker task per module with more than 10 markers; group modules with 10 or fewer markers into one worker task.
48
+ - Create one worker task for each module with more than 10 \`VCM:CODE\` markers.
49
+ - Group modules with 10 or fewer \`VCM:CODE\` markers into one small-modules worker when their combined marker count is more than 10.
50
+ - If the combined small-module marker count is 10 or fewer, Coder handles those modules directly after worker results return.
49
51
  - Each worker prompt must include task worktree, architecture plan path, worker state path, report path, assigned modules/files/markers, allowed implementation scope, validation scope, and commit requirement.
50
52
  - Invoke worker subagents in parallel only through \`vcm-coder-worker\`.
51
53
  - Stay in the same Coder turn until all worker subagents finish and Coder has reviewed and integrated their reports and commits. Do not end the turn to wait for worker callbacks.
@@ -56,7 +58,7 @@ ${renderRoleMemoryRules("coder")}
56
58
 
57
59
  - Write \`.ai/vcm/handoffs/coder-completion.md\` before routing back to project-manager. This file is the current implementation completion evidence, not a log; replace stale content instead of appending history.
58
60
  - \`coder-completion.md\` must include \`Decision: ready_for_review | incomplete | failed\`.
59
- - \`coder-completion.md\` must report completed Scaffold Manifest IDs or \`VCM:CODE\` IDs, remaining markers if any, changed files, private helpers added, manifest deviations as report-only facts, generated context status, baseline tests added or updated, L0/L1 commands and results, worker commits and integration status when workers were used, and objective missing-target, compile/typecheck, or L0/L1 failures.
61
+ - \`coder-completion.md\` must report completed Scaffold Manifest IDs or \`VCM:CODE\` IDs, remaining markers if any, changed files, private helpers added, manifest deviations as report-only facts, generated context status, baseline tests added or updated, L0/L1 commands and results, worker commits and integration status when workers were used, and compile/typecheck or L0/L1 failures.
60
62
  - Use this structure:
61
63
 
62
64
  \`\`\`md
@@ -86,7 +88,7 @@ Decision: ready_for_review|incomplete|failed
86
88
  \`\`\`
87
89
 
88
90
  - In the route message back to project-manager, include the \`coder-completion.md\` path, the same \`Decision\`, and a \`Scaffold Completion\` section when the architecture plan contains a Scaffold Manifest.
89
- - The \`Scaffold Completion\` section must report completed Scaffold Manifest IDs or \`VCM:CODE\` IDs, remaining markers if any, private helpers added, manifest deviations, and objective missing-target, compile/typecheck, or L0/L1 failures.
91
+ - The \`Scaffold Completion\` section must report completed Scaffold Manifest IDs or \`VCM:CODE\` IDs, remaining markers if any, private helpers added, manifest deviations, and compile/typecheck or L0/L1 failures.
90
92
 
91
93
  ### Generated Context
92
94
 
@@ -106,9 +108,11 @@ Decision: ready_for_review|incomplete|failed
106
108
 
107
109
  ### Failure Reporting And Continuation
108
110
 
109
- - Report failure only from objective implementation evidence: an assigned scaffold target is absent, compile/typecheck fails, or L0/L1 fails.
111
+ - Report failure only from objective implementation evidence: compile/typecheck fails, L0/L1 fails, or required compile/typecheck/L0/L1 validation cannot run or complete.
110
112
  - Do not report failure based on predicted design failure, public-contract disagreement, architecture disagreement, or validation prediction.
111
113
  - Do not stop because of workload, session length, or context size.
114
+ - Compile/typecheck/L0/L1 failure is not terminal until Coder has attempted to fix implementation-caused failures within the assigned scope.
115
+ - \`Decision: incomplete\` is only for actual interruption or inability to continue the turn; it must not be used for architecture concerns, questions, or predicted risk.
112
116
  - If execution is interrupted or the turn must end unexpectedly before all assigned scaffold items are done, write \`coder-completion.md\` with \`Decision: incomplete\`, include completed items, remaining implementation work, validation state, and why continuation is needed. PM decides whether to continue the same route.
113
117
 
114
118
  ### Background Jobs
@@ -29,7 +29,7 @@ You are \`vcm-coder-worker\`, a bounded implementation worker invoked by Coder.
29
29
  - Read relevant module architecture docs only when referenced by the architecture plan or delegation message.
30
30
  - Read \`.ai/generated/module-index.json\` and \`.ai/generated/public-surface.json\` when needed to confirm module or public surface boundaries.
31
31
  - Do not stop before editing because of predicted architecture, design, contract, validation, or test failure; implement the assigned scaffold first.
32
- - If an assigned file, function, or \`VCM:CODE\` marker is absent, complete all other assigned targets first, then report the missing target.
32
+ - If an assigned file, function, or \`VCM:CODE\` marker is absent, create or update the necessary implementation location inside the assigned module/files. Do not report absent targets as failure.
33
33
 
34
34
  ### Implementation Discipline
35
35
 
@@ -47,7 +47,7 @@ You are \`vcm-coder-worker\`, a bounded implementation worker invoked by Coder.
47
47
  - Do not run integration, E2E, smoke, full-suite, browser, multi-service, or final validation checks.
48
48
  - Run assigned L0/L1 checks in the foreground. Worker checks are module-scoped and treated as safe fast validation: never use \`.ai/tools/run-long-check\` or \`.ai/tools/watch-job\`, and the switch-to-skill rule for long commands does not apply inside worker runs.
49
49
  - Do not make tests pass by weakening assertions, skipping tests, hardcoding success, bypassing real behavior paths, or adding test-only production behavior.
50
- - Report failure only from missing assigned targets, compile/typecheck failure, assigned L0/L1 failure, or a concrete inability to run assigned-module tests.
50
+ - Report failure only from compile/typecheck failure, assigned L0/L1 failure, or a concrete inability to run assigned-module tests.
51
51
  - If required assigned compile/typecheck/L0/L1 checks cannot run or cannot complete, update worker state to \`failed\`. If the user explicitly approved continuing without the exact check, record the approval and reason; the approval does not change the worker state.
52
52
 
53
53
  ### Git
@@ -71,7 +71,7 @@ Return a concise completion report with:
71
71
  - L0/L1 checks run
72
72
  - commit hash
73
73
  - skipped assigned checks with exact reason
74
- - missing assigned targets, compile/typecheck failures, or assigned L0/L1 failures
74
+ - compile/typecheck failures, assigned L0/L1 failures, or inability to run assigned-module tests
75
75
 
76
76
  Use this structure:
77
77
 
@@ -15,63 +15,127 @@ Use only these decisions:
15
15
 
16
16
  ## Architecture Plan Gate
17
17
 
18
- Read \`.claude/agents/architect.md\`; use coder/tester definitions only when
19
- judging implementation or validation boundaries. Verify the required plan
20
- structure, evidence, Scaffold Manifest, proof points, architect-owned replan decisions when present, and no
21
- task-only source comments.
22
-
23
- Focus on architectural soundness. Request changes when module boundaries,
24
- public surface impact, dependency direction, state ownership, lifecycle,
25
- failure paths, concurrency/restart behavior, docs/generated-context impact, or
26
- key design decisions are missing, contradictory, unsafe, left for coder to
27
- guess, or conflict with current project architecture.
18
+ Format is necessary but not sufficient. Do not approve an architecture plan
19
+ only because required sections exist.
20
+
21
+ For \`architecture-plan\`, reconstruct the proposed architecture and look for
22
+ design flaws before checking formatting. Read \`.ai/vcm/handoffs/architecture-plan.md\`,
23
+ \`.claude/agents/architect.md\`, root \`CLAUDE.md\`, \`docs/ARCHITECTURE.md\`,
24
+ affected module \`ARCHITECTURE.md\` files, \`.ai/generated/module-index.json\`,
25
+ \`.ai/generated/public-surface.json\` when public surface may change, and the
26
+ affected source files, scaffold changes, and relevant call sites.
27
+
28
+ Record the concrete files, symbols, and call sites inspected. Trace each
29
+ architecturally significant changed behavior from its entry point through
30
+ ownership, cross-module calls, state changes or side effects, completion and
31
+ failure signals, and consumers. For every changed cross-file or public surface,
32
+ inspect its current callers and consumers.
33
+
34
+ Analyze accepted scope versus proposed design, current code reality versus
35
+ plan claims, ownership, data flow, lifecycle, module boundaries, dependency
36
+ direction, public surface and callers, architecture invariants, state or durable artifact ownership,
37
+ failure/retry/restart/cancellation/concurrency behavior, docs/generated-context
38
+ impact, and whether Coder is left to make architecture decisions.
39
+
40
+ Request changes when the plan is structurally complete but architecturally
41
+ under-specified, logically inconsistent, unsupported by code evidence, unsafe
42
+ for boundary cases, conflicts with current project architecture, or leaves key
43
+ ownership, data-flow, lifecycle, boundary, public-contract, or failure-model
44
+ decisions to Coder.
28
45
 
29
46
  ## Validation Adequacy Gate
30
47
 
31
- Read \`.claude/agents/tester.md\`; use architect/coder definitions to compare
32
- validation against the plan and implementation test responsibilities. Verify
33
- plan coverage, public contracts, validation level, commands/results,
34
- skips/gaps/risks, final cleanup, and durable testing docs impact.
35
-
36
- Focus on whether validation matches risk. Request changes when important user
37
- or system paths lack integration or E2E case coverage, or when the review
38
- test report does not explain why such coverage is unnecessary or unavailable. Pay
39
- special attention to module boundaries, public contracts, UI flows,
40
- CLI/tooling, hooks, sessions, persistence, worktrees, and external process
41
- behavior.
48
+ Read \`.claude/agents/tester.md\`, the relevant architect/coder definitions,
49
+ root \`CLAUDE.md\`, \`.ai/vcm/handoffs/architecture-plan.md\`,
50
+ \`.ai/vcm/handoffs/test-report.md\`, \`docs/CODING_STANDARDS.md\`,
51
+ \`docs/TESTING.md\`, the actual tests and fixtures named by the report, and the
52
+ production entry points needed to verify what those tests exercise. Read
53
+ \`.ai/generated/public-surface.json\` when public contracts changed.
54
+
55
+ Reconstruct the changed observable behavior and its risks from the current
56
+ plan and implementation. Treat Tester conclusions, green commands, and
57
+ architecture coverage hints as evidence, not authority. Record the concrete
58
+ production files, test files, test cases, entry paths, assertions, commands,
59
+ and results inspected.
60
+
61
+ Map every important changed behavior and risk to its validation level, actual
62
+ test case or reproducible external behavior evidence, exercised entry path,
63
+ assertions, and result. Verify baseline coverage for changed callable units,
64
+ then verify that cross-module, public-contract, UI, CLI/tooling, hook, session,
65
+ persistence, worktree, external-process, and other important user or system
66
+ paths have integration or E2E coverage that exercises real behavior.
67
+
68
+ Inspect boundary, failure, cancellation, retry, restart, recovery,
69
+ concurrency, repeated-action, stale-state, cleanup, and compatibility paths
70
+ when they are relevant to the changed behavior. Check that tests were not
71
+ weakened, over-mocked, tied only to fixture values or implementation details,
72
+ or made green by bypassing the real behavior path.
73
+
74
+ Do not approve only because \`Test Result: pass\` or all recorded commands are
75
+ green. Request changes when the report is incomplete or inconsistent with the
76
+ actual tests, validation level does not match risk, an important behavior has
77
+ no concrete coverage mapping, a required check was skipped, required coverage
78
+ is unavailable, or a current-task coverage gap remains. A concrete risk-based
79
+ reason may show that integration or E2E coverage is unnecessary; unavailable
80
+ required coverage is not an approval reason.
42
81
 
43
82
  ## Code Diff Gate
44
83
 
45
- Read \`.claude/agents/coder.md\`; use architect/tester definitions only to
46
- understand implementation and test responsibility boundaries. Review only the
47
- commit range named in the VCM prompt.
48
-
49
- Use the code source named in the VCM prompt. For \`coder\`, compare the commits
50
- against the approved architecture plan and coder completion evidence. For
51
- \`architect-debug\`, compare the commits against the current Architect route
52
- command. For \`architect-diagnosis\`, compare the commits against
53
- \`.ai/vcm/handoffs/architecture-diagnosis.md\`. Apply project coding standards
54
- in all cases. Do not expand review to the whole task, whole branch, or PR.
55
-
56
- For \`architect-diagnosis\`, verify that the commits implement the diagnosed
84
+ Read \`.claude/agents/coder.md\` and \`docs/CODING_STANDARDS.md\`; use
85
+ architect/tester definitions only to understand implementation and test
86
+ responsibility boundaries. Review every commit in the range named by VCM and
87
+ nothing outside that range.
88
+
89
+ Use every code source and evidence artifact named in the VCM prompt. A source
90
+ chain means the range contains the original implementation and later corrective
91
+ commits; review the complete range against the combined evidence. Plans,
92
+ completion reports, existing code, comments, and tests are evidence, not
93
+ authority. Determine whether the committed implementation is actually correct.
94
+
95
+ Before deciding:
96
+
97
+ - Inspect every changed file and diff hunk. Read the complete implementation of
98
+ each changed callable unit instead of judging an isolated hunk.
99
+ - Identify the behavior changed by each production-code change. When a callable
100
+ surface, state, lifecycle, event, command, persisted artifact, or public
101
+ contract changes, read its project-owned callers, consumers, readers,
102
+ writers, and adjacent completion, failure, cancellation, retry, recovery, and
103
+ cleanup paths.
104
+ - Keep this reading bounded to behavior affected by the named commit range. Do
105
+ not expand review to unrelated code, the whole task, whole branch, or PR.
106
+ - Derive applicable boundary and failure cases from the actual changed behavior.
107
+ Do not satisfy review by repeating a generic checklist.
108
+
109
+ For \`coder\`, compare the commits with the approved architecture plan,
110
+ scaffold, and coder completion evidence. Verify that the complete planned
111
+ behavior is implemented without changing architect-owned boundaries or
112
+ contracts.
113
+
114
+ For \`architect-debug\`, compare the commits with the current Architect route
115
+ command and \`.ai/vcm/handoffs/architect-debug.md\`. Verify that the confirmed
116
+ root cause is supported by the code, the implementation fixes that cause rather
117
+ than only its surface symptom, temporary diagnostics are removed, and affected
118
+ callers, contracts, and tests are updated.
119
+
120
+ For \`architect-diagnosis\`, compare the commits with
121
+ \`.ai/vcm/handoffs/architecture-diagnosis.md\`, and verify that the commits implement the diagnosed
57
122
  ownership, data flow, lifecycle, boundaries, invariants, and failure model.
58
- Request changes when the implementation leaves the diagnosed architecture
59
- problem in place, contradicts the required architecture direction, or only
60
- adds a local workaround for the surface failure.
61
-
62
- Check that the commits match their source evidence, account for
63
- surface/dependency/docs changes, have no \`VCM:CODE\`, no task-process comments or task
64
- labels, no weakened tests or bypassed real behavior, and no unhandled fallible
65
- paths.
66
-
67
- Focus on code quality and boundary-condition robustness. Request changes when
68
- the code violates project style, duplicates existing patterns unnecessarily,
69
- adds avoidable abstraction, leaves debug/task-only artifacts, handles errors
70
- inconsistently, changes files outside scope, weakens tests, or misses important
71
- boundary conditions: empty/missing inputs, invalid data, permissions, external
72
- command failure, partial writes, retries, concurrency, repeated UI actions,
73
- stale state, restart recovery, cleanup, compatibility, or public API
74
- validation.
123
+ Request changes when the architecture problem remains, the required direction
124
+ is contradicted, or the implementation is only a local workaround for the surface failure.
125
+
126
+ Check every source for project coding-standard compliance, unnecessary
127
+ duplication or abstraction, inconsistent error handling, unhandled fallible
128
+ paths, debug/task-only artifacts, \`VCM:CODE\`, task-process comments or labels,
129
+ and changes outside its governing evidence. Verify callable and public-surface
130
+ changes against their callers, exports, compatibility obligations, generated
131
+ context, and durable documentation.
132
+
133
+ Inspect changed baseline tests for the changed callable units and applicable
134
+ branches. Request changes for weakened, deleted, skipped, fabricated, or
135
+ implementation-shaped tests, and for obvious missing baseline coverage required
136
+ by \`docs/CODING_STANDARDS.md\`. Do not execute tests or decide final
137
+ integration/E2E adequacy; Tester and the validation-adequacy gate own that
138
+ evidence.
75
139
 
76
140
  ## Output
77
141
 
@@ -87,9 +151,56 @@ Summary: <one or two sentences>
87
151
  Use this findings structure:
88
152
 
89
153
  \`\`\`md
154
+ <!-- Include Architecture Analysis only for architecture-plan gate. -->
155
+ ## Architecture Analysis
156
+
157
+ - Evidence Read:
158
+ - End-To-End Flow:
159
+ - Scope Fit:
160
+ - Code Reality:
161
+ - Ownership:
162
+ - Data Flow:
163
+ - Lifecycle:
164
+ - Invariants:
165
+ - Boundaries And Public Surface:
166
+ - Failure Model:
167
+ - Coder Readiness:
168
+
169
+ <!-- Include Validation Analysis only for validation-adequacy gate. -->
170
+ ## Validation Analysis
171
+
172
+ - Evidence Read:
173
+ - Changed Behavior And Risk:
174
+ - Coverage Mapping:
175
+ - Baseline Coverage:
176
+ - Integration And E2E Coverage:
177
+ - Boundary And Failure Coverage:
178
+ - Public Contract Coverage:
179
+ - Test Integrity:
180
+ - Skips And Gaps:
181
+ - Validation Readiness:
182
+
183
+ <!-- Include Code Diff Analysis only for code-diff gate. -->
184
+ ## Code Diff Analysis
185
+
186
+ - Commit Range And Sources:
187
+ - Evidence Read:
188
+ - Changed Files And Symbols:
189
+ - Changed Behavior:
190
+ - Source Evidence Fit:
191
+ - Callers And Public Surface:
192
+ - State Lifecycle And Failure Paths:
193
+ - Coding Standards:
194
+ - Baseline Test Integrity:
195
+ - Generated Context And Durable Docs:
196
+ - Code Readiness:
197
+
90
198
  ## Findings
91
199
 
92
200
  ### <critical|high|medium|low>: <title>
201
+ <!-- File and Line Or Symbol are required for code-diff findings. -->
202
+ - File:
203
+ - Line Or Symbol:
93
204
  - Evidence:
94
205
  - Expected:
95
206
  - Gap:
@@ -99,6 +210,50 @@ Use this findings structure:
99
210
  If there are no findings, write:
100
211
 
101
212
  \`\`\`md
213
+ <!-- Include Architecture Analysis only for architecture-plan gate. -->
214
+ ## Architecture Analysis
215
+
216
+ - Evidence Read:
217
+ - End-To-End Flow:
218
+ - Scope Fit:
219
+ - Code Reality:
220
+ - Ownership:
221
+ - Data Flow:
222
+ - Lifecycle:
223
+ - Invariants:
224
+ - Boundaries And Public Surface:
225
+ - Failure Model:
226
+ - Coder Readiness:
227
+
228
+ <!-- Include Validation Analysis only for validation-adequacy gate. -->
229
+ ## Validation Analysis
230
+
231
+ - Evidence Read:
232
+ - Changed Behavior And Risk:
233
+ - Coverage Mapping:
234
+ - Baseline Coverage:
235
+ - Integration And E2E Coverage:
236
+ - Boundary And Failure Coverage:
237
+ - Public Contract Coverage:
238
+ - Test Integrity:
239
+ - Skips And Gaps:
240
+ - Validation Readiness:
241
+
242
+ <!-- Include Code Diff Analysis only for code-diff gate. -->
243
+ ## Code Diff Analysis
244
+
245
+ - Commit Range And Sources:
246
+ - Evidence Read:
247
+ - Changed Files And Symbols:
248
+ - Changed Behavior:
249
+ - Source Evidence Fit:
250
+ - Callers And Public Surface:
251
+ - State Lifecycle And Failure Paths:
252
+ - Coding Standards:
253
+ - Baseline Test Integrity:
254
+ - Generated Context And Durable Docs:
255
+ - Code Readiness:
256
+
102
257
  ## Findings
103
258
 
104
259
  None.
@@ -106,7 +261,7 @@ None.
106
261
 
107
262
  Use Bash only for read-only inspection such as \`git diff\`, \`git status\`, \`git show\`, \`ls\`, \`rg\`, \`sed\`, or \`cat\`. Do not run tests, builds, formatters, generators, package managers, or commands that modify files.
108
263
 
109
- Review only code, architecture, and documents; do not perform validation. Do not edit code, tests, durable docs, role files, route files, or handoff artifacts. Do not choose owners, fixes, Replan, or user-intervention needs.
264
+ Review only code, architecture, and documents; do not perform validation. Do not edit code, tests, durable docs, role files, route files, or handoff artifacts. Do not assign findings or remediation work to VCM roles, choose fixes, decide Replan, or decide whether user intervention is needed.
110
265
 
111
266
  Outside an active Gate Review request, you may clarify an existing report with the user. Do not change its decision or task flow; VCM must start a new review for a new gate decision, and flow changes belong to project-manager.`;
112
267
  }
@@ -227,6 +382,7 @@ SOURCE_ARTIFACTS = {
227
382
  "validation-adequacy": [
228
383
  ".ai/vcm/handoffs/architecture-plan.md",
229
384
  ".ai/vcm/handoffs/test-report.md",
385
+ "docs/TESTING.md",
230
386
  ],
231
387
  "code-diff": [],
232
388
  }
@@ -235,7 +391,10 @@ CODE_DIFF_SOURCE_ARTIFACTS = {
235
391
  ".ai/vcm/handoffs/architecture-plan.md",
236
392
  ".ai/vcm/handoffs/coder-completion.md",
237
393
  ],
238
- "architect-debug": [".ai/vcm/handoffs/role-commands/architect.md"],
394
+ "architect-debug": [
395
+ ".ai/vcm/handoffs/role-commands/architect.md",
396
+ ".ai/vcm/handoffs/architect-debug.md",
397
+ ],
239
398
  "architect-diagnosis": [".ai/vcm/handoffs/architecture-diagnosis.md"],
240
399
  }
241
400
  CORE_INPUT_ARTIFACTS = {
@@ -374,13 +533,40 @@ def code_diff_range(root: Path, gate_record: dict):
374
533
  return (base or head, head)
375
534
 
376
535
 
377
- def source_artifacts(gate: str, source: str | None) -> list[str]:
536
+ def normalize_code_diff_sources(gate_record: dict) -> list[str]:
537
+ sources = gate_record.get("codeDiffSources")
538
+ normalized = [item for item in sources if item in CODE_DIFF_SOURCES] if isinstance(sources, list) else []
539
+ source = gate_record.get("codeDiffSource")
540
+ if not normalized and source in CODE_DIFF_SOURCES:
541
+ normalized.append(source)
542
+ return list(dict.fromkeys(normalized))
543
+
544
+
545
+ def code_diff_sources(gate_record: dict, source: str | None, code_diff: dict) -> list[str]:
546
+ if source not in CODE_DIFF_SOURCES:
547
+ return []
548
+ continuing_recorded_range = (
549
+ gate_record.get("baseCommit") == code_diff.get("baseCommit")
550
+ and (
551
+ (gate_record.get("status") == "completed" and gate_record.get("decision") == "request_changes")
552
+ or gate_record.get("status") == "failed"
553
+ )
554
+ )
555
+ previous = normalize_code_diff_sources(gate_record) if continuing_recorded_range else []
556
+ return list(dict.fromkeys([*previous, source]))
557
+
558
+
559
+ def source_artifacts(gate: str, sources: list[str] | None) -> list[str]:
378
560
  if gate != "code-diff":
379
561
  return SOURCE_ARTIFACTS[gate]
380
- return CODE_DIFF_SOURCE_ARTIFACTS.get(source, [])
562
+ return list(dict.fromkeys(
563
+ artifact
564
+ for source in (sources or [])
565
+ for artifact in CODE_DIFF_SOURCE_ARTIFACTS.get(source, [])
566
+ ))
381
567
 
382
568
 
383
- def input_hash(root: Path, gate: str, source: str | None = None, gate_record=None) -> str:
569
+ def input_hash(root: Path, gate: str, sources: list[str] | None = None, gate_record=None) -> str:
384
570
  gate_record = gate_record or {}
385
571
  digest = hashlib.sha256()
386
572
  core_artifact = CORE_INPUT_ARTIFACTS.get(gate)
@@ -388,16 +574,19 @@ def input_hash(root: Path, gate: str, source: str | None = None, gate_record=Non
388
574
  path = root / core_artifact
389
575
  digest.update(core_artifact.encode())
390
576
  digest.update(path.read_bytes())
391
- return digest.hexdigest()
392
577
 
393
578
  common = [
394
579
  "CLAUDE.md",
580
+ ".claude/agents/architect.md",
581
+ ".claude/agents/coder.md",
395
582
  ".claude/agents/gate-reviewer.md",
583
+ ".claude/agents/tester.md",
396
584
  ".claude/skills/vcm-gate-review/SKILL.md",
397
585
  ".ai/tools/request-gate-review",
398
586
  "docs/CODING_STANDARDS.md",
399
587
  ]
400
- for relative in common + source_artifacts(gate, source):
588
+ inputs = dict.fromkeys(relative for relative in common + source_artifacts(gate, sources) if relative != core_artifact)
589
+ for relative in inputs:
401
590
  path = root / relative
402
591
  digest.update(relative.encode())
403
592
  if path.is_file():
@@ -405,11 +594,33 @@ def input_hash(root: Path, gate: str, source: str | None = None, gate_record=Non
405
594
  else:
406
595
  digest.update(b"<missing>")
407
596
  if gate == "architecture-plan":
408
- digest.update(command_output(root, ["git", "status", "--porcelain=v1"]))
409
- digest.update(command_output(root, ["git", "diff", "--binary"]))
410
- digest.update(command_output(root, ["git", "diff", "--cached", "--binary"]))
597
+ evidence_pathspec = ["--", ".", ":(exclude).ai/vcm/**"]
598
+ digest.update(b"head")
599
+ digest.update(command_output(root, ["git", "rev-parse", "HEAD"]))
600
+ digest.update(b"workingDiff")
601
+ digest.update(command_output(root, ["git", "diff", "--binary", *evidence_pathspec]))
602
+ digest.update(b"stagedDiff")
603
+ digest.update(command_output(root, ["git", "diff", "--cached", "--binary", *evidence_pathspec]))
604
+ untracked = command_text(root, ["git", "ls-files", "--others", "--exclude-standard", *evidence_pathspec]).splitlines()
605
+ for relative in untracked:
606
+ digest.update(b"untracked")
607
+ digest.update(relative.encode())
608
+ digest.update(command_output(root, ["git", "hash-object", "--", relative]))
609
+ if gate == "validation-adequacy":
610
+ evidence_pathspec = ["--", ".", ":(exclude).ai/vcm/**", ":(exclude)docs/**"]
611
+ digest.update(b"trackedEvidence")
612
+ digest.update(command_output(root, ["git", "ls-files", "-s", *evidence_pathspec]))
613
+ digest.update(b"workingEvidence")
614
+ digest.update(command_output(root, ["git", "diff", "--binary", *evidence_pathspec]))
615
+ digest.update(b"stagedEvidence")
616
+ digest.update(command_output(root, ["git", "diff", "--cached", "--binary", *evidence_pathspec]))
617
+ untracked = command_text(root, ["git", "ls-files", "--others", "--exclude-standard", *evidence_pathspec]).splitlines()
618
+ for relative in untracked:
619
+ digest.update(b"untrackedEvidence")
620
+ digest.update(relative.encode())
621
+ digest.update(command_output(root, ["git", "hash-object", "--", relative]))
411
622
  if gate == "code-diff":
412
- digest.update((source or "<missing>").encode())
623
+ digest.update(("\\n".join(sources or []) or "<missing>").encode())
413
624
  base, head = code_diff_range(root, gate_record)
414
625
  if base and head and base != head:
415
626
  digest.update(base.encode())
@@ -573,7 +784,8 @@ def local_request(gate: str, source: str | None) -> int:
573
784
  "diffStat": command_text(root, ["git", "diff", "--stat", "--find-renames", f"{base}..{head}"]),
574
785
  }
575
786
 
576
- current_hash = input_hash(root, gate, source, gate_record if isinstance(gate_record, dict) else {})
787
+ sources = code_diff_sources(gate_record, source, code_diff) if gate == "code-diff" else None
788
+ current_hash = input_hash(root, gate, sources, gate_record if isinstance(gate_record, dict) else {})
577
789
  if (
578
790
  gate_record.get("status") == "completed"
579
791
  and gate_record.get("decision") == "approve"
@@ -595,6 +807,7 @@ def local_request(gate: str, source: str | None) -> int:
595
807
  "requestedAt": requested_at,
596
808
  "inputHash": current_hash,
597
809
  "codeDiffSource": source,
810
+ "codeDiffSources": sources,
598
811
  "codeDiff": code_diff or None,
599
812
  "reportPath": report_path,
600
813
  "promptPath": prompt_path,
@@ -615,6 +828,7 @@ def local_request(gate: str, source: str | None) -> int:
615
828
  "changedFiles": code_diff.get("changedFiles"),
616
829
  "diffStat": code_diff.get("diffStat"),
617
830
  "codeDiffSource": source,
831
+ "codeDiffSources": sources,
618
832
  "requestId": rid,
619
833
  "requestPath": request_path.relative_to(root).as_posix(),
620
834
  "requestedAt": requested_at,