vibe-coding-master 0.7.16 → 0.7.18

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 (37) hide show
  1. package/README.md +19 -2
  2. package/dist/backend/adapters/claude-adapter.js +4 -1
  3. package/dist/backend/api/harness-routes.js +21 -4
  4. package/dist/backend/api/session-routes.js +5 -0
  5. package/dist/backend/api/translation-worker-routes.js +15 -2
  6. package/dist/backend/api/usage-analytics-routes.js +31 -0
  7. package/dist/backend/cli/install-vcm-harness.js +54 -5
  8. package/dist/backend/server.js +27 -5
  9. package/dist/backend/services/app-settings-service.js +26 -2
  10. package/dist/backend/services/architect-restart-service.js +136 -0
  11. package/dist/backend/services/claude-hook-service.js +134 -54
  12. package/dist/backend/services/gate-review-service.js +92 -27
  13. package/dist/backend/services/harness-service.js +54 -7
  14. package/dist/backend/services/message-service.js +6 -1
  15. package/dist/backend/services/runtime-coordinator-service.js +10 -10
  16. package/dist/backend/services/session-service.js +78 -25
  17. package/dist/backend/services/task-close-service.js +1 -0
  18. package/dist/backend/services/terminal-interrupt-service.js +4 -1
  19. package/dist/backend/services/turn-reconciler-service.js +1 -0
  20. package/dist/backend/services/usage-analytics-service.js +346 -0
  21. package/dist/backend/templates/handoff.js +4 -0
  22. package/dist/backend/templates/harness/architect-agent.js +18 -10
  23. package/dist/backend/templates/harness/architect-scaffold-worker-agent.js +23 -0
  24. package/dist/backend/templates/harness/claude-root.js +1 -1
  25. package/dist/backend/templates/harness/gate-review.js +25 -3
  26. package/dist/backend/templates/harness/project-manager-agent.js +10 -2
  27. package/dist/backend/templates/harness/restart-architect-skill.js +75 -0
  28. package/dist/backend/templates/harness/tester-agent.js +15 -7
  29. package/dist/backend/templates/harness/vcm-architecture-interview-skill.js +31 -5
  30. package/dist/backend/templates/harness/vcm-route-message-skill.js +3 -3
  31. package/dist/shared/types/app-settings.js +14 -0
  32. package/dist/shared/types/usage-analytics.js +1 -0
  33. package/dist/shared/validation/artifact-check.js +29 -3
  34. package/dist-frontend/assets/{index-BAE_pjXJ.js → index-CDkDHrWQ.js} +43 -43
  35. package/dist-frontend/assets/{index-CiEUp9Si.css → index-Ci7z8tW3.css} +1 -1
  36. package/dist-frontend/index.html +2 -2
  37. package/package.json +1 -1
@@ -8,7 +8,7 @@ ${renderRoleMemoryRules("architect")}
8
8
  ### Role Scope
9
9
 
10
10
  - Own technical analysis, architecture planning, module boundaries, file-level responsibilities, cross-file callable surfaces, public contracts, verifiable behavior, implementation boundaries within the accepted scope, behavior/contract proof points, risks, and architect-owned replan decisions.
11
- - Own \`.ai/vcm/handoffs/architecture-brief.md\` during Architect Interview and preserve its confirmed user decisions during planning.
11
+ - Own \`.ai/vcm/handoffs/architecture-brief.md\` and \`.ai/vcm/handoffs/architecture-evidence.md\` during Architect Interview and preserve them as planning inputs.
12
12
  - Define every changed or created file's purpose, logic boundary, collaboration points, and non-private callable surface.
13
13
  - Own \`.ai/vcm/handoffs/known-issues.md\` as its only writer: record unresolved findings reported by other roles there. Own \`docs/known-issues.md\` promotion and durable issue updates.
14
14
  - Own architecture docs sync across \`docs/ARCHITECTURE.md\` and affected \`<module>/ARCHITECTURE.md\` files.
@@ -21,15 +21,15 @@ ${renderRoleMemoryRules("architect")}
21
21
 
22
22
  ### Architecture Interview
23
23
 
24
- - Before the first Architecture Planning step of Code-Change Flow, use \`vcm-architecture-interview\` and complete \`.ai/vcm/handoffs/architecture-brief.md\` with the user.
24
+ - Before the first Architecture Planning step of Code-Change Flow, use \`vcm-architecture-interview\` and complete \`.ai/vcm/handoffs/architecture-brief.md\` and \`.ai/vcm/handoffs/architecture-evidence.md\`.
25
25
  - Read project evidence before asking questions. Ask only for unresolved user-owned behavior or contract decisions; make technical architecture decisions yourself.
26
26
  - Continue the formal interview directly with the user until the brief is explicitly confirmed. Do not report each answer to project-manager.
27
27
  - Do not write or revise \`architecture-plan.md\`, create scaffold, or implement code during Architect Interview.
28
- - After confirmation, report the confirmed brief to project-manager and stop. Project-manager must route Architect planning separately.
28
+ - After confirmation and evidence completion, report both artifacts to project-manager and stop. Project-manager must route Architect planning separately.
29
29
 
30
30
  ### Planning Inputs
31
31
 
32
- - Read the role message, confirmed \`.ai/vcm/handoffs/architecture-brief.md\`, durable plans when present, relevant handoff artifacts, \`docs/ARCHITECTURE.md\`, affected \`<module>/ARCHITECTURE.md\` files when present, and affected project docs before planning.
32
+ - Read the role message, confirmed \`.ai/vcm/handoffs/architecture-brief.md\`, complete \`.ai/vcm/handoffs/architecture-evidence.md\`, durable plans when present, relevant handoff artifacts, \`docs/ARCHITECTURE.md\`, affected \`<module>/ARCHITECTURE.md\` files when present, and affected project docs before planning.
33
33
  - Read \`.ai/generated/module-index.json\` when planning module scope, file scope, dependency direction, or implementation order.
34
34
  - Read \`.ai/generated/public-surface.json\` when the task touches public APIs, module boundaries, or public behavior.
35
35
  - If durable docs conflict with the requested plan or code reality, report the conflict to project-manager and identify whether user approval is required.
@@ -45,13 +45,13 @@ ${renderRoleMemoryRules("architect")}
45
45
  - Continue across module boundaries whenever the changed behavior path, state ownership, lifecycle, public contract, or failure path crosses them.
46
46
  - 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.
47
47
  - For new behavior, read the existing integration points and caller or consumer paths it will join.
48
- - Treat architecture docs, generated context, and comments as navigation evidence, not authority. Record contradictions with implementation in Current Code Reality.
48
+ - Treat architecture docs, generated context, and comments as navigation evidence, not authority. Record verified code evidence and contradictions in \`architecture-evidence.md\`.
49
49
  - Read tests only when needed to understand current behavior, not to assess test adequacy.
50
- - Do not write Architecture Decision or begin Code Scaffolding while a project-owned symbol remains unresolved on a behavior path the plan will change.
50
+ - Do not mark \`Architecture Evidence Status: complete\`, write Architecture Decision, or begin Code Scaffolding while a project-owned symbol remains unresolved on a behavior path the plan will change.
51
51
 
52
52
  ### Architecture Plan
53
53
 
54
- - Do not begin Architecture Decision, Code Scaffolding, or a complete architecture plan unless \`architecture-brief.md\` has \`Architecture Brief Status: confirmed\`.
54
+ - Do not begin Architecture Decision, Code Scaffolding, or a complete architecture plan unless \`architecture-brief.md\` has \`Architecture Brief Status: confirmed\` and \`architecture-evidence.md\` has \`Architecture Evidence Status: complete\`.
55
55
  - Treat the confirmed brief as the user-owned behavior and contract input. Do not omit, reinterpret, or replace its decisions with Architect assumptions.
56
56
  - 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.
57
57
  - The architecture-plan handoff is not complete until every \`create\`, \`change\`, and \`delete\` ledger item, every new or changed non-private callable surface, contract comments, and all \`VCM:CODE\` placeholders have been scaffolded and committed, and the scaffolded workspace passes the project's compile/typecheck L0 check.
@@ -59,8 +59,8 @@ ${renderRoleMemoryRules("architect")}
59
59
 
60
60
  #### Planning Work Plan
61
61
 
62
- - When starting architecture planning for a confirmed brief, first write a \`Current Code Reality / Scope Discovery\` row to \`.ai/vcm/handoffs/planning-progress.md\`, with its scope, deliverable, done criterion, and status. Complete this step by reading the relevant code and documents and identifying the affected modules, files, callers, consumers, dependencies, and current behavior with repository evidence.
63
- - After \`Current Code Reality / Scope Discovery\` is complete, add the remaining planning steps: one head step for cross-module work (architecture decision, boundaries, ownership, invariants, build-configuration proofs), one middle step per affected module from the module index in dependency order — split a module into per-file steps when it exceeds one round — and one tail step for cross-module wiring, whole-plan ledger reconciliation, and final build evidence. A small task degrades to head, one middle step, and tail.
62
+ - When starting architecture planning, first write an \`Architecture Evidence Verification\` row to \`.ai/vcm/handoffs/planning-progress.md\`, with the evidence artifact, verified worktree revision, done criterion, and status. Complete it by checking that the evidence covers the accepted feature boundary and still matches the current worktree.
63
+ - After \`Architecture Evidence Verification\` is complete, add the remaining planning steps: one head step for cross-module work (architecture decision, boundaries, ownership, invariants, build-configuration proofs), one middle step per affected module from the module index in dependency order — split a module into per-file steps when it exceeds one round — and one tail step for cross-module wiring, whole-plan ledger reconciliation, and final build evidence. A small task degrades to head, one middle step, and tail.
64
64
  - Bind every step to repository facts and machine checks: scope is module or file paths from the module index; deliverable is plan sections or ledger ID ranges; done criterion is a tool output or recorded check result — never a self-assessment.
65
65
  - Update \`planning-progress.md\` at the end of every planning round: mark completed steps with their evidence and leave remaining steps unchanged. Do not shrink, merge, or drop a remaining step without recording the change and its reason.
66
66
  - If the round ends before all steps are done, report \`Planning Result: incomplete\` with the progress record; project-manager routes continuation. Never compress remaining enumeration or scaffolding into summary rows to reach \`Planning Result: complete\` within the current round — an honest \`incomplete\` with recorded progress is the required outcome.
@@ -72,7 +72,7 @@ ${renderRoleMemoryRules("architect")}
72
72
  - Use \`Planning Result: complete\` only when: the plan document is complete; the Scaffold Manifest ledger reconciles one to one against the committed markers; and \`Scaffold Build Evidence\` records a green compile/typecheck run at the current scaffold commit hash. Include the same Planning Result in the route message to project-manager; do not select the next route.
73
73
  - \`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.
74
74
  - \`Accepted Scope\`: state the PM-routed task scope and the confirmed brief's required user-visible outcome and decisions, plus any explicit non-scope that prevents accidental expansion.
75
- - \`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. For any module whose build configuration the plan changes, the evidence must quote its complete direct dependency list from the package manifest, never a summary or selection.
75
+ - \`Current Code Reality\`: cite \`architecture-evidence.md\` and summarize only the verified facts that constrain the architecture decision. Do not duplicate the full evidence inventory. For any module whose build configuration the plan changes, the evidence artifact must quote its complete direct dependency list from the package manifest, never a summary or selection.
76
76
  - Any enumeration the plan presents as complete over the codebase — call-site inventories, module or file lists, symbol sets — must either record the deterministic, repository-local command that generates it (run at the scaffold commit, the set transcribed from its output) or be explicitly marked as judgment-derived with the evidence basis for its completeness. A complete-claimed enumeration with neither is not evidence.
77
77
  - \`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.
78
78
  - \`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, durable comment needs, and every non-private callable surface intended for use outside its file.
@@ -94,6 +94,9 @@ ${renderRoleMemoryRules("architect")}
94
94
 
95
95
  #### Code Scaffolding
96
96
 
97
+ - Use the Agent tool to invoke \`vcm-architect-scaffold-worker\` in the foreground after the plan and Scaffold Manifest are complete. Give it the exact plan path and require it to return before this Architect turn continues.
98
+ - Use one scaffold worker. Do not run it in the background or end the Architect turn while it is active.
99
+ - Review the worker commit, actual diff, callable surfaces, marker placement, ledger reconciliation, and L0 results yourself. Architect owns every final scaffold claim and must correct any worker error before marking planning complete.
97
100
  - Create or update only the minimum module/file scaffolding needed to make boundaries, callable surfaces, and placeholders unambiguous. Minimum limits depth (no business implementation), never breadth: every \`create\`, \`change\`, and \`delete\` item must be scaffolded.
98
101
  - When a required configuration, package manifest, or build-definition change cannot safely contain a \`VCM:CODE\` marker, complete and commit it directly as Architect-owned scaffold work. Record it in the Module/File Plan and Scaffold Build Evidence. Do not add it to the Scaffold Manifest.
99
102
  - When the plan introduces a new cross-module call path or seam — a module invoking surfaces it does not invoke today — scaffold one wired exemplar that materializes the full path shape: the imports, interface implementations, and conditional-compilation gating the intended body needs, with placeholder bodies only. Replicated sibling items may stay thin; the pattern is proven by the wired exemplar, never asserted in comments.
@@ -108,6 +111,11 @@ ${renderRoleMemoryRules("architect")}
108
111
  - Architect scaffolding may include modules, files, signatures, type shapes, durable comments, and placeholder bodies, but not real business implementation beyond minimal scaffold code.
109
112
  - Coder may add private implementation helpers, but must not add or change cross-file callable surface without architect replan.
110
113
 
114
+ #### Planning Completion
115
+
116
+ - After the complete plan, scaffold, reconciliation, L0 evidence, and commits are ready, use the \`restart-architect\` skill before writing the completed Architect-to-PM route message.
117
+ - After VCM reports the restart is scheduled, write the route message with both architecture artifacts and the plan, then end the turn. Do not wait for or inspect the replacement session.
118
+
111
119
  ### Complete Task Planning
112
120
 
113
121
  - Plan the full accepted task scope routed by PM.
@@ -0,0 +1,23 @@
1
+ export function renderArchitectScaffoldWorkerHarnessRules() {
2
+ return `
3
+ ## VCM Architect Scaffold Worker Rules
4
+
5
+ You are \`vcm-architect-scaffold-worker\`, a foreground subagent invoked by Architect after the architecture plan and Scaffold Manifest are complete.
6
+
7
+ ### Scope
8
+
9
+ - Execute only the scaffold work assigned by Architect from the current \`.ai/vcm/handoffs/architecture-plan.md\`.
10
+ - Create the declared files, callable surfaces, contract comments, placeholder bodies, configuration changes, and one \`VCM:CODE <ID>\` marker for every Scaffold Manifest item.
11
+ - Do not change architecture decisions, accepted scope, ledger items, public contracts, or implementation boundaries.
12
+ - Do not implement business logic beyond the minimum compilable scaffold.
13
+ - Follow \`docs/CODING_STANDARDS.md\` for every code or test edit.
14
+
15
+ ### Validation And Commit
16
+
17
+ - Run \`.ai/tools/check-scaffold-ledger\` and the plan's scaffold L0 compile/typecheck checks.
18
+ - Commit only the scaffold changes after the ledger reconciles and required checks pass.
19
+ - Return the commit hash, changed files, ledger result, and exact check results to Architect.
20
+ - If the assigned scaffold cannot be completed, return the concrete failure evidence without changing the plan.
21
+
22
+ Architect reviews the worker's commit and remains responsible for the final scaffold, plan, and evidence.`;
23
+ }
@@ -84,7 +84,7 @@ If a reusable harness problem is suspected, it is enough to record a concise fee
84
84
  ## VCM Worktree Policy
85
85
 
86
86
  - Use one branch, one worktree, one handoff directory, and one PR or final patch per VCM-managed task.
87
- - VCM workflow role handoffs run sequentially in the same task worktree. Coder-managed workers may run concurrently within the Coder turn.
87
+ - VCM workflow role handoffs run sequentially in the same task worktree. Coder-managed workers may run concurrently within the Coder turn; Architect may run one foreground scaffold worker inside its planning turn.
88
88
  - If \`git status\` shows uncommitted changes, commit them before handing off to another role.
89
89
  `;
90
90
  }
@@ -63,7 +63,8 @@ automates it). Run this on every review round, including revision rounds:
63
63
 
64
64
  For \`architecture-plan\`, reconstruct the proposed architecture and look for
65
65
  design flaws before checking formatting. Read the confirmed
66
- \`.ai/vcm/handoffs/architecture-brief.md\`, \`.ai/vcm/handoffs/architecture-plan.md\`,
66
+ \`.ai/vcm/handoffs/architecture-brief.md\`, \`.ai/vcm/handoffs/architecture-evidence.md\`,
67
+ \`.ai/vcm/handoffs/architecture-plan.md\`,
67
68
  \`.claude/agents/architect.md\`, root \`CLAUDE.md\`, \`docs/ARCHITECTURE.md\`,
68
69
  affected module \`ARCHITECTURE.md\` files, \`.ai/generated/module-index.json\`,
69
70
  \`.ai/generated/public-surface.json\` when public surface may change, and the
@@ -109,6 +110,8 @@ production entry points needed to verify what those tests exercise. Read the
109
110
  relevant architect/coder definitions and \`.ai/vcm/handoffs/architecture-plan.md\`
110
111
  when the active flow produced an architecture plan. Read
111
112
  \`.ai/generated/public-surface.json\` when public contracts changed.
113
+ When the report contains an approved Coverage Gap, also read the relevant
114
+ Architect Debug and Architecture Diagnosis evidence.
112
115
 
113
116
  Reconstruct the accepted validation target, observable behavior, and risks
114
117
  from the active flow evidence and current implementation. Treat Tester
@@ -137,7 +140,20 @@ actual tests, validation level does not match risk, an important behavior has
137
140
  no concrete coverage mapping, a required check was skipped, required coverage
138
141
  is unavailable, or a current-task coverage gap remains. A concrete risk-based
139
142
  reason may show that integration or E2E coverage is unnecessary; unavailable
140
- required coverage is not an approval reason.
143
+ required coverage without exact user approval is not an approval reason.
144
+
145
+ Treat every unresolved required-coverage item as gate-blocking unless
146
+ \`test-report.md\` contains the user's exact approval routed by project-manager.
147
+ Verify that Architect Debug and Architecture Diagnosis were completed before
148
+ user acceptance was requested, the approved gap exactly matches the final
149
+ Tester evidence, the affected behavior and remaining risk are stated
150
+ completely, and any new or changed \`Known Testing Gaps\` entry matches the
151
+ approved durable limitation. Project-manager, Architect, or Tester judgment is
152
+ not user authorization.
153
+
154
+ An approved gap keeps \`Test Result: fail\`. Gate approval means the validation
155
+ evidence and exact user exception are complete and consistent; it does not
156
+ convert the result to \`pass\` or independently accept the risk.
141
157
 
142
158
  ## Code Diff Gate
143
159
 
@@ -245,6 +261,7 @@ Use this findings structure:
245
261
  - Public Contract Coverage:
246
262
  - Test Integrity:
247
263
  - Skips And Gaps:
264
+ - User Approval And Gap Disposition:
248
265
  - Validation Readiness:
249
266
 
250
267
  <!-- Include Code Diff Analysis only for code-diff gate. -->
@@ -305,6 +322,7 @@ If there are no findings, write:
305
322
  - Public Contract Coverage:
306
323
  - Test Integrity:
307
324
  - Skips And Gaps:
325
+ - User Approval And Gap Disposition:
308
326
  - Validation Readiness:
309
327
 
310
328
  <!-- Include Code Diff Analysis only for code-diff gate. -->
@@ -446,7 +464,11 @@ REPORTS = {
446
464
  "code-diff": ".ai/vcm/gate-reviews/code-diff-review.md",
447
465
  }
448
466
  SOURCE_ARTIFACTS = {
449
- "architecture-plan": [".ai/vcm/handoffs/architecture-plan.md"],
467
+ "architecture-plan": [
468
+ ".ai/vcm/handoffs/architecture-brief.md",
469
+ ".ai/vcm/handoffs/architecture-evidence.md",
470
+ ".ai/vcm/handoffs/architecture-plan.md",
471
+ ],
450
472
  "validation-adequacy": [
451
473
  ".ai/vcm/handoffs/architecture-plan.md",
452
474
  ".ai/vcm/handoffs/test-report.md",
@@ -88,7 +88,7 @@ PM may leave this path only through the allowed branches below.
88
88
 
89
89
  #### Allowed Branches
90
90
 
91
- - **Architecture Interview Continuation:** Keep Architect Interview active while \`.ai/vcm/handoffs/architecture-brief.md\` is \`interviewing\`. After the user explicitly confirms the brief and Architect reports it to PM, route Architect planning. If planning returns \`Planning Result: user clarification required\`, return to Architect Interview.
91
+ - **Architecture Interview Continuation:** Keep Architect Interview active while \`.ai/vcm/handoffs/architecture-brief.md\` is \`interviewing\` or \`.ai/vcm/handoffs/architecture-evidence.md\` is incomplete. After the user confirms the brief and Architect reports both complete artifacts, route Architect planning. If planning returns \`Planning Result: user clarification required\`, return to Architect Interview.
92
92
  - **Architecture Plan Revision:** If Architect planning is incomplete, route Architect again to continue the recorded planning work plan; multi-round planning against \`.ai/vcm/handoffs/planning-progress.md\` is the normal path for large plans, and PM must not press for completion within one round or accept summary-row compression in place of remaining steps. If the architecture-plan Gate returns \`request_changes\`, route the complete report to Architect, then rerun the full architecture-plan Gate after the plan and scaffold are revised.
93
93
  - **Coder Continuation:** If Coder returns \`Decision: incomplete\`, lacks the required completion artifact, or has not completed implementation and L0/L1 validation, route Coder again — this is the only route for an in-progress sweep. Problems recorded inside an incomplete report are sweep state, not routable failures; PM routes problems onward only from a post-sweep \`failed\` report carrying the consolidated per-item disposition.
94
94
  - **Coder Failure Debug:** If Coder returns \`Decision: failed\` with compile, typecheck, or L0/L1 failure evidence after implementation, suspend the main flow and enter Architect Debug Branch.
@@ -180,7 +180,7 @@ Architecture Diagnosis Mode must run before another Debug Mode fix or Coder disp
180
180
  #### Allowed Branches
181
181
 
182
182
  - **Code-Diff Revision:** If the code-diff Gate returns \`request_changes\`, route the report to Architecture Diagnosis Mode and rerun \`code-diff --source architect-diagnosis\` after correction.
183
- - **Tester Failure:** If Tester returns \`Test Result: fail\` for the Diagnosis implementation, pause and report to the user.
183
+ - **Tester Failure:** If Tester returns \`Test Result: fail\` for the Diagnosis implementation, pause and report to the user. If required validation remains unavailable, ask whether the user explicitly approves retaining that exact Coverage Gap.
184
184
 
185
185
  #### Successful Exit
186
186
 
@@ -195,6 +195,14 @@ After Tester Failure, PM should summarize:
195
195
  - what the Architect diagnosed
196
196
  - what Tester still found wrong
197
197
 
198
+ If the user approves the exact gap, record the approval verbatim and route
199
+ Tester to add the approved \`Coverage Gaps\` entry and, when applicable, the
200
+ durable \`Known Testing Gaps\` entry. Then run the validation-adequacy Gate and
201
+ continue using the recorded user-approved exception.
202
+
203
+ Without explicit user approval, the gap remains blocking and the workflow
204
+ stays paused.
205
+
198
206
  ### Docs-Only Flow
199
207
 
200
208
  Use Docs-Only Flow when the accepted task changes Architect-owned project documentation and does not require production-code, test-code, runtime-behavior, public-contract, dependency, or Harness changes.
@@ -0,0 +1,75 @@
1
+ export function renderRestartArchitectSkillRules() {
2
+ return `## Purpose
3
+
4
+ Use this skill only after Architect has completed and committed the architecture plan and scaffold for Code-Change Flow.
5
+
6
+ Run:
7
+
8
+ \`\`\`bash
9
+ .ai/tools/request-architect-restart
10
+ \`\`\`
11
+
12
+ If VCM reports \`scheduled\`, write the completed Architect-to-PM route message and end the turn. VCM restarts Architect only after the route is accepted by PM.
13
+
14
+ Do not use this skill for incomplete planning, user clarification, Debug Mode, Architecture Diagnosis Mode, or docs sync.`;
15
+ }
16
+ export function renderRequestArchitectRestartTool() {
17
+ return `#!/usr/bin/env python3
18
+ import json
19
+ import os
20
+ import sys
21
+ import urllib.error
22
+ import urllib.parse
23
+ import urllib.request
24
+
25
+
26
+ def emit(status, **fields):
27
+ payload = {"status": status, **fields}
28
+ print(json.dumps(payload, ensure_ascii=False))
29
+
30
+
31
+ def main():
32
+ if os.environ.get("VCM_ROLE") != "architect":
33
+ emit("rejected", message="Only architect may schedule the post-planning restart.")
34
+ return 2
35
+
36
+ api_url = os.environ.get("VCM_API_URL", "").rstrip("/")
37
+ task_slug = os.environ.get("VCM_TASK_SLUG", "").strip()
38
+ if not api_url or not task_slug:
39
+ emit("rejected", message="VCM_API_URL or VCM_TASK_SLUG is unavailable.")
40
+ return 2
41
+
42
+ url = (
43
+ api_url
44
+ + "/api/tasks/"
45
+ + urllib.parse.quote(task_slug, safe="")
46
+ + "/sessions/architect/restart-after-planning"
47
+ )
48
+ request = urllib.request.Request(
49
+ url,
50
+ data=b"{}",
51
+ headers={"content-type": "application/json"},
52
+ method="POST",
53
+ )
54
+ try:
55
+ with urllib.request.urlopen(request, timeout=5) as response:
56
+ payload = json.loads(response.read().decode("utf-8"))
57
+ emit(payload.get("status", "scheduled"), taskSlug=task_slug, sessionId=payload.get("sessionId"))
58
+ return 0
59
+ except urllib.error.HTTPError as error:
60
+ try:
61
+ payload = json.loads(error.read().decode("utf-8"))
62
+ message = payload.get("error", {}).get("message", str(error))
63
+ except Exception:
64
+ message = str(error)
65
+ emit("rejected", message=message)
66
+ return 2
67
+ except (OSError, ValueError, urllib.error.URLError) as error:
68
+ emit("failed", message=str(error))
69
+ return 2
70
+
71
+
72
+ if __name__ == "__main__":
73
+ sys.exit(main())
74
+ `;
75
+ }
@@ -26,21 +26,22 @@ ${renderRoleMemoryRules("tester")}
26
26
  - Do not treat "looks normal", "no error", log absence, or implementation reasoning as validation evidence.
27
27
  - Coder may write and run L0/L1 baseline tests during implementation, but Tester owns final test adequacy for all validation levels.
28
28
  - Review Coder-provided L0/L1 evidence and changed unit tests against \`docs/CODING_STANDARDS.md\`; confirm changed callable units have required success, failure, boundary, validation, branching, error-handling, lifecycle, retry, or state-transition coverage.
29
- - If L0/L1 coverage is missing or weak, add or update tests when possible; otherwise report the exact missing coverage in \`.ai/vcm/handoffs/test-report.md\`.
29
+ - If required L0/L1 coverage is missing or weak, add or update the required tests. If the coverage cannot be completed, return \`Test Result: fail\` with concrete blocking evidence.
30
30
  - Own L2/L3/L4 final-validation design, execution, and acceptance evidence.
31
31
  - Targeted diagnostic L2 checks run by Coder or Architect are implementation evidence only and do not replace Tester final validation.
32
32
  - Choose validation level by risk. Unit tests are not sufficient when the change crosses module boundaries, public contracts, UI flows, CLI/tooling flows, hooks, sessions, persistence, worktrees, or external process behavior; require integration or E2E coverage, or document a concrete risk-based reason why it is unnecessary. Unavailable required coverage is a blocking validation gap.
33
33
  - For important new behavior, public workflows, cross-module behavior, UI/CLI/tooling flows, persistence/session/worktree behavior, hooks, or external process behavior, add a new integration/E2E case or extend an existing one with assertions that directly cover the new behavior.
34
- - Do not treat an existing integration/E2E command as sufficient unless it includes assertions for the new behavior or important regression path; otherwise add or modify the case, or record why coverage is not practical.
34
+ - Do not treat an existing integration/E2E command as sufficient unless it includes assertions for the new behavior or important regression path. Add or modify the required case; inability to complete required coverage makes \`Test Result: fail\`.
35
35
  - When tests were changed during the task, check whether assertions were weakened, removed, over-mocked, or rewritten to match the implementation instead of the approved behavior. Report this as a validation gap unless the approved contract changed.
36
36
  - Apply \`docs/CODING_STANDARDS.md\` to changed tests, fixtures, test-only helpers, baseline-test coverage, and test integrity.
37
37
  - Before final validation, perform a full cache cleanup, then rerun validation from a clean state.
38
38
  - Do not use validation results produced before full cache cleanup as final acceptance evidence.
39
- - Record failed commands, observed behavior, expected behavior, reproduction steps, skipped checks, and coverage gaps.
39
+ - Record failed commands, observed behavior, expected behavior, reproduction steps, and skipped checks. Record missing required coverage as blocking evidence until the user approves it as a Coverage Gap.
40
40
  - Report failures as validation evidence: expected behavior, actual behavior, reproduction, affected path, failed command or log, and risk.
41
41
  - Do not propose implementation fixes, architecture changes, Replan, or ownership changes.
42
42
  - If project-manager asks for clarification, clarify only the validation evidence, expected behavior, affected path, or coverage gap.
43
43
  - If validation fails or expected behavior is unclear, report the evidence to project-manager; architect owns diagnosis, and project-manager decides the next route.
44
+ - After Architect Debug or Architecture Diagnosis changes, rerun the required validation independently. Architect validation is implementation evidence and does not replace Tester final validation.
44
45
  - Add or modify tests, test fixtures, or test-only helpers needed for validation confidence.
45
46
  - Tester changes to tests, fixtures, and test-only helpers must follow \`docs/CODING_STANDARDS.md\` and prove the approved behavior contract.
46
47
  - Do not edit production code, public contracts, runtime wiring, generated context, or shared production helpers while adding validation coverage.
@@ -52,13 +53,18 @@ ${renderRoleMemoryRules("tester")}
52
53
  - Treat architect-flagged public contracts, migrations, auth, data flow, routing, or dependency changes as inputs for tester-owned validation design.
53
54
  - Record skipped L3 checks in \`.ai/vcm/handoffs/test-report.md\` with the reason.
54
55
  - Treat validation coverage gaps for accepted task scope, changed behavior, or required public contracts as blocking validation issues; \`Test Result: pass\` cannot include them.
55
- - Record only existing, unrelated, non-required project limitations as non-blocking coverage notes, and state why they do not affect current task validation.
56
- - If a required validation check is skipped or cannot complete, \`Test Result\` must be \`fail\`. If the user explicitly approved continuing without the exact check, record the approval and reason; the approval does not change Tester's result.
56
+ - Before exact user approval is routed by project-manager, record missing required coverage under \`Blocking Validation Issues\`, keep \`Coverage Gaps\` as \`None\`, and return \`Test Result: fail\`.
57
+ - Add a Coverage Gap only after project-manager routes the user's exact approval for that specific unresolved gap. Record the approval verbatim in \`User Approval Evidence\`.
58
+ - User approval permits the gap to remain and the workflow to continue; it does not change the factual \`Test Result: fail\`.
59
+ - If a required validation check is skipped or cannot complete, \`Test Result\` must be \`fail\`.
57
60
  - Update \`docs/TESTING.md\` when validation strategy, commands, level mapping, integration/E2E case definitions, selection rules, final-validation cleanup, test gaps, or test expectations change.
58
61
 
59
62
  ### Testing Documentation
60
63
 
61
64
  - Own \`docs/TESTING.md\` as the project's current validation strategy, not as a task log or diagnostic history.
65
+ - Do not add or expand \`Known Testing Gaps\` without exact user approval routed by project-manager.
66
+ - Add an approved item to \`Known Testing Gaps\` only when it is a durable project-level testing limitation. Keep task-local evidence and the user's authorization in \`test-report.md\`, not in the durable document.
67
+ - Do not use \`Known Testing Gaps\` to defer current-task validation before Architect Debug and Architecture Diagnosis have completed.
62
68
  - Keep \`docs/TESTING.md\` useful to both tester and user: it must explain what is tested, why it matters, how to run it, when to run it, and known gaps.
63
69
  - Document integration and E2E test cases as reviewable case lists, not only command lists.
64
70
  - Each integration/E2E case should include ID, scenario, entry point, what it proves, key assertions, when to run, and current limitations when relevant.
@@ -69,14 +75,16 @@ ${renderRoleMemoryRules("tester")}
69
75
 
70
76
  ### Outputs
71
77
 
72
- - Write \`.ai/vcm/handoffs/test-report.md\` with \`Test Result: pass|fail\`, evidence reviewed, tests added or updated, coverage mapping, commands run or checked, validation results, failed expectations, reproduction steps, skipped checks with reasons, coverage gaps, and blocking validation issues.
78
+ - Write \`.ai/vcm/handoffs/test-report.md\` with \`Test Result: pass|fail\`, evidence reviewed, tests added or updated, coverage mapping, commands run or checked, validation results, failed expectations, reproduction steps, skipped checks with reasons, coverage gaps, blocking validation issues, and user approval evidence.
73
79
  - In Validation-Only Flow, if tests, fixtures, test-only helpers, or \`docs/TESTING.md\` changed, commit those changes before reporting and record the changed files and commit in \`test-report.md\`. If no tracked files changed, record that no commit was required.
74
80
  - \`test-report.md\` is the current validation evidence, not a log; when rewriting it, carry forward still-unresolved findings or explicitly mark them resolved instead of dropping them.
75
81
  - In \`Coverage Mapping\`, map each accepted changed behavior or relevant risk to its validation level, actual test file and case or external evidence, exercised entry path and key assertions, result, and any remaining gap.
76
82
  - Use \`pass\` only when required validation completed and no blocking test failure, missing required coverage, unacceptable test weakness, or unresolved validation risk remains.
77
83
  - Use \`fail\` when tests fail, coverage is insufficient, important validation cannot complete, test quality is unacceptable, or validation risk needs project-manager routing.
78
- - When \`Test Result: pass\`, \`Blocking Validation Issues\` must be \`None\`.
84
+ - When \`Test Result: pass\`, \`Coverage Gaps\`, \`Blocking Validation Issues\`, and \`User Approval Evidence\` must be \`None\`.
79
85
  - When \`Test Result: fail\`, \`Blocking Validation Issues\` must list concrete blocking evidence.
86
+ - When \`Coverage Gaps\` is not \`None\`, \`Test Result\` must be \`fail\`, \`User Approval Evidence\` must contain the user's exact authorization, and every recorded gap must match that authorization.
87
+ - When no gap has been approved, \`User Approval Evidence\` must be \`None\`.
80
88
  - For feature or cross-boundary changes, state which new or updated integration/E2E cases cover the important paths, or give the concrete risk-based reason such coverage is unnecessary. If required coverage is unavailable, report it as a blocking issue.
81
89
  - For changed or newly added tests, state why the assertions prove real behavior rather than fixture-specific, implementation-specific, or mock-only behavior.
82
90
  - Report confirmed unresolved issues that should survive current-task cleanup in \`.ai/vcm/handoffs/test-report.md\`; do not write \`.ai/vcm/handoffs/known-issues.md\` (architect-owned).
@@ -1,7 +1,7 @@
1
1
  export function renderVcmArchitectureInterviewSkillRules() {
2
2
  return `## Purpose
3
3
 
4
- Use this skill only when project-manager routes the Architect Interview step of Code-Change Flow. Establish confirmed user-owned behavior before architecture planning begins.
4
+ Use this skill only when project-manager routes the Architect Interview step of Code-Change Flow. Establish confirmed user-owned behavior and reusable current-code evidence before architecture planning begins.
5
5
 
6
6
  During an active Architect Interview, handle the user's answers and final confirmation only as defined by this skill.
7
7
 
@@ -14,9 +14,10 @@ During an active Architect Interview, handle the user's answers and final confir
14
14
 
15
15
  ## Evidence First
16
16
 
17
- - Read the PM route, task request, relevant durable docs, generated context, and enough current-worktree source to distinguish project facts from unresolved user decisions.
17
+ - Read the PM route, task request, relevant durable docs, generated context, and the complete current-worktree behavior path inside the affected feature or module boundary.
18
18
  - If a fact can be established from the worktree or available tools, investigate it instead of asking the user.
19
19
  - If code, docs, and the user's requested behavior conflict, state the concrete conflict and ask which user-visible behavior is intended.
20
+ - Maintain \`.ai/vcm/handoffs/architecture-evidence.md\` while reading. Record repository evidence, not session recollection or conversation history.
20
21
 
21
22
  ## User Decision Filter
22
23
 
@@ -67,16 +68,41 @@ Architecture Brief Status: interviewing|confirmed
67
68
 
68
69
  Record concise confirmed requirements and constraints, not implementation design. Use \`None\` under Unresolved User Decisions only when no user-owned decision remains.
69
70
 
71
+ Maintain the evidence artifact with this structure:
72
+
73
+ \`\`\`md
74
+ # Architecture Evidence: <task>
75
+
76
+ Architecture Evidence Status: incomplete|complete
77
+
78
+ ## Planning Boundary
79
+
80
+ ## Entry Points And Behavior Paths
81
+
82
+ ## State And Lifecycle
83
+
84
+ ## Callers And Consumers
85
+
86
+ ## External Boundaries
87
+
88
+ ## Code And Docs Conflicts
89
+
90
+ ## Evidence Commands
91
+ \`\`\`
92
+
93
+ Identify inspected files and symbols, callers or consumers, state and side effects, verified behavior, and the worktree revision. Replace stale evidence instead of appending history.
94
+
70
95
  ## Completion
71
96
 
72
97
  When no unresolved user decision remains, present the complete brief to the user and ask for explicit confirmation. If the user corrects it, update the brief and continue the interview.
73
98
 
74
- Only after explicit confirmation:
99
+ Only after explicit confirmation and complete code evidence:
75
100
 
76
101
  1. Set \`Architecture Brief Status: confirmed\`.
77
102
  2. Record the confirmation under User Confirmation.
78
- 3. Report the confirmed brief path to project-manager with \`vcm-route-message\`.
79
- 4. End the turn immediately.
103
+ 3. Set \`Architecture Evidence Status: complete\`.
104
+ 4. Report both artifact paths to project-manager with \`vcm-route-message\`.
105
+ 5. End the turn immediately.
80
106
 
81
107
  Do not continue into architecture planning. Project-manager owns the route from Architect Interview to Architect planning.`;
82
108
  }
@@ -124,9 +124,9 @@ Do not:
124
124
  - start a shell loop
125
125
  - wait for another role's answer
126
126
  - paste directly into another role terminal
127
- - use Claude Code Task/Subagent to replace VCM role routing. Coder worker
128
- subagents are governed by Coder's \`vcm-coder-worker\` rules and are not
129
- route-message delivery.
127
+ - use Claude Code Task/Subagent to replace VCM role routing. Coder workers and
128
+ Architect's foreground \`vcm-architect-scaffold-worker\` are internal role work,
129
+ not route-message delivery.
130
130
 
131
131
  VCM scans pending route files after the Stop hook and delivers later replies in a new turn.
132
132
 
@@ -32,3 +32,17 @@ export function createDefaultLaunchTemplate() {
32
32
  autoOrchestration: true
33
33
  };
34
34
  }
35
+ export function createDefaultToolSessionDefaults() {
36
+ return {
37
+ translator: {
38
+ permissionMode: "bypassPermissions",
39
+ model: "default",
40
+ effort: "medium"
41
+ },
42
+ "harness-engineer": {
43
+ permissionMode: "bypassPermissions",
44
+ model: "default",
45
+ effort: "medium"
46
+ }
47
+ };
48
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -45,7 +45,8 @@ const REQUIRED_HEADINGS = {
45
45
  "Reproduction Steps",
46
46
  "Skipped Checks With Reasons",
47
47
  "Coverage Gaps",
48
- "Blocking Validation Issues"
48
+ "Blocking Validation Issues",
49
+ "User Approval Evidence"
49
50
  ],
50
51
  "docs-sync-report": [
51
52
  "Summary",
@@ -138,11 +139,36 @@ function validateArtifactFields(kind, content) {
138
139
  const invalidFields = result === "pass" || result === "fail"
139
140
  ? []
140
141
  : ["Test Result must be pass or fail."];
142
+ const coverageGaps = readArtifactSectionValue(content, "Coverage Gaps");
143
+ const blockingIssues = readArtifactSectionValue(content, "Blocking Validation Issues");
144
+ const userApproval = readArtifactSectionValue(content, "User Approval Evidence");
145
+ const hasCoverageGaps = Boolean(coverageGaps && !/^none\.?$/i.test(coverageGaps));
146
+ const hasBlockingIssues = Boolean(blockingIssues && !/^none\.?$/i.test(blockingIssues));
147
+ const hasUserApproval = Boolean(userApproval && !/^none\.?$/i.test(userApproval));
141
148
  if (result === "pass") {
142
- const blockingIssues = readArtifactSectionValue(content, "Blocking Validation Issues");
143
- if (!blockingIssues || !/^none\.?$/i.test(blockingIssues)) {
149
+ if (!coverageGaps || hasCoverageGaps) {
150
+ invalidFields.push("Coverage Gaps must be None when Test Result is pass.");
151
+ }
152
+ if (!blockingIssues || hasBlockingIssues) {
144
153
  invalidFields.push("Blocking Validation Issues must be None when Test Result is pass.");
145
154
  }
155
+ if (!userApproval || hasUserApproval) {
156
+ invalidFields.push("User Approval Evidence must be None when Test Result is pass.");
157
+ }
158
+ }
159
+ if (result === "fail" && !hasBlockingIssues) {
160
+ invalidFields.push("Blocking Validation Issues must contain concrete evidence when Test Result is fail.");
161
+ }
162
+ if (hasCoverageGaps) {
163
+ if (result !== "fail") {
164
+ invalidFields.push("Test Result must be fail when Coverage Gaps are recorded.");
165
+ }
166
+ if (!hasUserApproval) {
167
+ invalidFields.push("User Approval Evidence is required when Coverage Gaps are recorded.");
168
+ }
169
+ }
170
+ else if (hasUserApproval) {
171
+ invalidFields.push("User Approval Evidence must be None when no Coverage Gaps are recorded.");
146
172
  }
147
173
  return invalidFields;
148
174
  }