thachvd-kit 1.0.36 → 1.0.38

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 (32) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +240 -0
  3. package/THIRD_PARTY_NOTICES.md +49 -0
  4. package/bin/cli.js +80 -24
  5. package/bin/config.js +164 -0
  6. package/bin/entry.js +11 -1
  7. package/bin/native-skills.js +183 -0
  8. package/bin/spec-doctor.js +251 -0
  9. package/bin/spec-link.js +97 -0
  10. package/bin/spec-recipe.js +74 -0
  11. package/bin/spec-state.js +415 -0
  12. package/bin/spec.js +859 -0
  13. package/bin/upgrade.js +303 -298
  14. package/package.json +5 -3
  15. package/skills/finishing-a-development-branch/SKILL.md +240 -0
  16. package/skills/requesting-code-review/code-reviewer.md +198 -0
  17. package/skills/subagent-driven-development/SKILL.md +574 -0
  18. package/skills/subagent-driven-development/implementer-prompt.md +154 -0
  19. package/skills/subagent-driven-development/re-review-prompt.md +115 -0
  20. package/skills/subagent-driven-development/scripts/review-package +53 -0
  21. package/skills/subagent-driven-development/scripts/review-package.js +52 -0
  22. package/skills/subagent-driven-development/scripts/sdd-workspace +82 -0
  23. package/skills/subagent-driven-development/scripts/sdd-workspace-lib.js +62 -0
  24. package/skills/subagent-driven-development/scripts/sdd-workspace.js +15 -0
  25. package/skills/subagent-driven-development/scripts/task-brief +43 -0
  26. package/skills/subagent-driven-development/scripts/task-brief.js +46 -0
  27. package/skills/subagent-driven-development/task-reviewer-prompt.md +207 -0
  28. package/skills/system-discovery/SKILL.md +140 -0
  29. package/skills/system-reverse-engineer/SKILL.md +208 -0
  30. package/skills/system-spec-review/SKILL.md +177 -0
  31. package/skills/upstream.json +30 -0
  32. package/skills/using-git-worktrees/SKILL.md +175 -0
@@ -0,0 +1,207 @@
1
+ # Task Reviewer Prompt Template
2
+
3
+ Use this template when dispatching a task reviewer subagent. The reviewer
4
+ reads the task's diff once and returns two verdicts: spec compliance and
5
+ code quality.
6
+
7
+ **Purpose:** Verify one task's implementation matches its requirements (nothing
8
+ more, nothing less) and is well-built (clean, tested, maintainable)
9
+
10
+ ```
11
+ Subagent (general-purpose):
12
+ description: "Review Task N (spec + quality)"
13
+ model: [MODEL — REQUIRED: choose per SKILL.md Model Selection; an omitted
14
+ model silently inherits the session's most expensive one]
15
+ prompt: |
16
+ You are reviewing one task's implementation: first whether it matches its
17
+ requirements, then whether it is well-built. This is a task-scoped gate,
18
+ not a merge review — a broad whole-branch review happens separately after
19
+ all tasks are complete.
20
+
21
+ ## What Was Requested
22
+
23
+ Read the task brief: [BRIEF_FILE]
24
+
25
+ Global constraints from the spec/design that bind this task:
26
+ [GLOBAL_CONSTRAINTS]
27
+
28
+ ## What the Implementer Claims They Built
29
+
30
+ Read the implementer's report: [REPORT_FILE]
31
+
32
+ ## Diff Under Review
33
+
34
+ **Base:** [BASE_SHA]
35
+ **Head:** [HEAD_SHA]
36
+ **Diff file:** [DIFF_FILE]
37
+
38
+ Read the diff file once — it contains the commit list, a stat summary,
39
+ and the full diff with surrounding context, and it is your view of the
40
+ change. The diff's context lines ARE the changed files: do not Read a
41
+ changed file separately unless a hunk you must judge is cut off
42
+ mid-function — and say so in your report. Do not re-run git commands.
43
+ If the diff file is missing, fetch the diff yourself:
44
+ `git diff --stat [BASE_SHA]..[HEAD_SHA]` and `git diff [BASE_SHA]..[HEAD_SHA]`.
45
+ Do not crawl the broader codebase. Inspect code outside the diff only
46
+ to evaluate a concrete risk you can name — one focused check per named
47
+ risk, and name both the risk and what you checked in your report.
48
+ Cross-cutting changes are legitimate named risks: if the diff changes
49
+ lock ordering, a function or API contract, or shared mutable state,
50
+ checking the call sites is the right method.
51
+
52
+ Your review is read-only on this checkout. Do not mutate the working
53
+ tree, the index, HEAD, or branch state in any way.
54
+
55
+ ## You Do Not Dispatch Subagents
56
+
57
+ Do all of this review yourself. Never spawn a subagent to review part
58
+ of the diff, and never spawn another reviewer for a second opinion.
59
+ This process already provides every review seat the work gets; a
60
+ reviewer you spawn duplicates one of them at full cost, and its
61
+ verdict counts for nothing. If the diff feels too large for one
62
+ pass, review it in passes yourself and say so in your report.
63
+
64
+ ## Do Not Trust the Report
65
+
66
+ Treat the implementer's report as unverified claims about the code. It
67
+ may be incomplete, inaccurate, or optimistic. Verify the claims against
68
+ the diff. Design rationales in the report are claims too: "left it per
69
+ YAGNI," "kept it simple deliberately," or any other justification is the
70
+ implementer grading their own work. Judge the code on its merits — a
71
+ stated rationale never downgrades a finding's severity.
72
+
73
+ ## Tests
74
+
75
+ The implementer already ran the tests and reported results with TDD
76
+ evidence for exactly this code. Do not re-run the suite to confirm their
77
+ report. Run a test only when reading the code raises a specific doubt
78
+ that no existing run answers — and then a focused test, never a
79
+ package-wide suite, race detector run, or repeated/high-count loop. If
80
+ heavy validation seems warranted, recommend it in your report instead of
81
+ running it. If you cannot run commands in this environment, name the
82
+ test you would run.
83
+
84
+ Warnings or other noise in the implementer's reported test output are
85
+ findings — test output should be pristine.
86
+
87
+ Evidence you cannot see is not evidence that doesn't exist. If the
88
+ report or its test evidence looks truncated, or you cannot locate the
89
+ results it claims, re-read the file at its stated path — and if it is
90
+ genuinely missing or garbled, report that as a gap for the controller.
91
+ Re-running the suite to regenerate what you failed to read is not
92
+ verification; illegibility of the evidence is not invalidation of it.
93
+
94
+ ## Part 1: Spec Compliance
95
+
96
+ Compare the diff against What Was Requested:
97
+
98
+ - **Missing:** requirements they skipped, missed, or claimed without
99
+ implementing
100
+ - **Extra:** features that weren't requested, over-engineering, unneeded
101
+ "nice to haves"
102
+ - **Misunderstood:** right feature built the wrong way, wrong problem
103
+ solved
104
+
105
+ If the brief lists several files each with its own change (a batched
106
+ dispatch), check the diff against that list file by file: every listed
107
+ file must have its corresponding hunk. A listed file the diff never
108
+ touches is a Missing finding, no matter how clean the rest of the
109
+ batch looks.
110
+
111
+ If a requirement cannot be verified from this diff alone (it lives in
112
+ unchanged code or spans tasks), report it as a ⚠️ item instead of
113
+ broadening your search.
114
+
115
+ ## Part 2: Code Quality
116
+
117
+ **Code quality:**
118
+ - Clean separation of concerns?
119
+ - Proper error handling?
120
+ - DRY without premature abstraction?
121
+ - Edge cases handled?
122
+
123
+ **Tests:**
124
+ - Do the new and changed tests verify real behavior, not mocks?
125
+ - Are the task's edge cases covered?
126
+
127
+ **Structure:**
128
+ - Does each file have one clear responsibility with a well-defined interface?
129
+ - Are units decomposed so they can be understood and tested independently?
130
+ - Is the implementation following the file structure from the plan?
131
+ - Did this change create new files that are already large, or
132
+ significantly grow existing files? (Don't flag pre-existing file
133
+ sizes — focus on what this change contributed.)
134
+
135
+ Your report should point at evidence: file:line references for every
136
+ finding and for any check you would otherwise answer with a bare
137
+ "yes." A tight report that cites lines gives the controller everything
138
+ it needs.
139
+
140
+ Your final message is the report itself: begin directly with the
141
+ spec-compliance verdict. Every line is a verdict, a finding with
142
+ file:line, or a check you ran — no preamble, no process narration,
143
+ no closing summary.
144
+
145
+ ## Calibration
146
+
147
+ Categorize issues by actual severity. Not everything is Critical.
148
+ Important means this task cannot be trusted until it is fixed: incorrect
149
+ or fragile behavior, a missed requirement, or maintainability damage you
150
+ would block a merge over — verbatim duplication of a logic block,
151
+ swallowed errors, tests that assert nothing. "Coverage could be broader"
152
+ and polish suggestions are Minor.
153
+ If the plan or brief explicitly mandates something this rubric calls a
154
+ defect (a test that asserts nothing, verbatim duplication of a logic
155
+ block), that IS a finding — report it as Important, labeled
156
+ plan-mandated. The plan's authorship does not grade its own work; the
157
+ human decides.
158
+ Acknowledge what was done well before listing issues — accurate praise
159
+ helps the implementer trust the rest of the feedback.
160
+
161
+ ## Output Format
162
+
163
+ ### Spec Compliance
164
+
165
+ - ✅ Spec compliant | ❌ Issues found: [what's missing/extra/misunderstood,
166
+ with file:line references]
167
+ - ⚠️ Cannot verify from diff: [requirements you could not verify from the
168
+ diff alone, and what the controller should check — report alongside the
169
+ ✅/❌ verdict for everything you could verify]
170
+
171
+ ### Strengths
172
+ [What's well done? Be specific.]
173
+
174
+ ### Issues
175
+
176
+ #### Critical (Must Fix)
177
+ #### Important (Should Fix)
178
+ #### Minor (Nice to Have)
179
+
180
+ For each issue: file:line, what's wrong, why it matters, how to fix
181
+ (if not obvious).
182
+
183
+ ### Assessment
184
+
185
+ **Task quality:** [Approved | Needs fixes]
186
+
187
+ **Reasoning:** [1-2 sentence technical assessment]
188
+ ```
189
+
190
+ **Placeholders:**
191
+ - `[MODEL]` — REQUIRED: reviewer model per SKILL.md Model Selection
192
+ - `[BRIEF_FILE]` — REQUIRED: the task brief file (`node scripts/task-brief.js PLAN N`
193
+ prints the path; same file the implementer worked from)
194
+ - `[GLOBAL_CONSTRAINTS]` — the binding requirements copied verbatim from
195
+ the plan's Global Constraints section or the spec: exact values, formats,
196
+ and stated relationships between components (not process rules — those
197
+ are already in this template)
198
+ - `[REPORT_FILE]` — REQUIRED: the file the implementer wrote its detailed
199
+ report to
200
+ - `[BASE_SHA]` — commit before this task
201
+ - `[HEAD_SHA]` — current commit
202
+ - `[DIFF_FILE]` — REQUIRED: the path the controller wrote the review
203
+ package to (`node scripts/review-package.js PLAN_FILE BASE HEAD` prints the unique
204
+ path it wrote; the package never enters the controller's context)
205
+
206
+ **Reviewer returns:** Spec Compliance verdict (✅/❌/⚠️), Strengths, Issues
207
+ (Critical/Important/Minor), Task quality verdict
@@ -0,0 +1,140 @@
1
+ ---
2
+ name: system-discovery
3
+ description: Build or refresh the AS-IS system map for a brownfield multi-repository workspace using Codebase Memory MCP as the primary structural source.
4
+ ---
5
+
6
+ # System Discovery
7
+
8
+ Use this skill only for documentation/discovery. Do not modify product code.
9
+
10
+ ## Preconditions
11
+
12
+ - `.thachvd/system.json` exists.
13
+ - Repositories in that manifest have been indexed with Codebase Memory MCP.
14
+ - If the index is stale or missing, stop and tell the user to run `thachvd-kit spec index`.
15
+
16
+ ## Goal
17
+
18
+ Create a reviewed AS-IS map of what the current system does before detailed reverse-engineered specs are generated.
19
+
20
+ ## Analysis profile
21
+
22
+ Read `profile` from `.thachvd/system.json`.
23
+
24
+ - `auto`: infer a practical profile for each repository from code/config evidence. A multi-repo system may mix backend, frontend, mobile, and infra repos. Record inferred profiles with evidence.
25
+ - `backend`: emphasize routes/RPC, middleware, auth/policies, services/domain logic, persistence/migrations/transactions, cache, queues/events/jobs/schedulers, external clients, feature flags, retry/idempotency/concurrency and rollback/failure paths.
26
+ - `frontend`: emphasize routes/navigation, page/component composition, state management, API/data clients, forms/validation, auth/session, feature flags, analytics, accessibility, loading/error/empty states, browser storage and build/runtime config.
27
+ - `fullstack`: apply both backend and frontend emphasis and trace client/server boundaries, shared schemas/types, auth/session propagation, BFF/SSR/server actions, and end-to-end failures.
28
+ - `mobile`: emphasize navigation, lifecycle/background work, local storage/cache, offline/sync, permissions, push, deep links, auth refresh, platform-specific code, device integrations and release config.
29
+ - `infra`: emphasize IaC modules/stacks, environments/workspaces, CI/CD, secrets, IAM, networking, state backends, observability, capacity/autoscaling, deployment ordering, rollback/recovery and destructive-change safeguards.
30
+
31
+ Profile guidance is a checklist, not a source of truth. Never omit real behavior merely because it falls outside the selected profile.
32
+
33
+ ## Documentation language
34
+
35
+ Read `language` from `.thachvd/system.json`.
36
+
37
+ - `vi`: write prose, headings, explanations, and summaries in natural Vietnamese.
38
+ - `en`: write prose, headings, explanations, and summaries in English.
39
+ - Always preserve code identifiers, class/function names, API routes, event/queue names, database/schema names, file paths, commands, and source anchors exactly as they appear in source.
40
+ - When writing Vietnamese, retain the original English technical term in parentheses if translating it would reduce precision.
41
+
42
+ The implementation and tests are the source of truth. Never invent business intent.
43
+
44
+ ## Read first
45
+
46
+ 1. `.thachvd/system.json`
47
+ 2. Existing files under the configured `spec_root`
48
+ 3. Relevant `AGENTS.md` / `.agent/docs/*` files when present
49
+
50
+ ## Discovery method
51
+
52
+ Use Codebase Memory MCP first for structural questions: repository inventory, symbols, entry points, callers/callees, data flow, cross-service links, routes, jobs, events, schedulers, queues, clients, and shared persistence. Use direct file reads only to verify or fill gaps.
53
+
54
+ Inspect all configured repositories. Pay special attention to framework side paths that are often missed by direct call graphs: middleware, observers/hooks, event listeners, background jobs, schedulers, policies/guards, migrations, CLI commands, configuration, and tests.
55
+
56
+ Do not document dead code as active behavior unless evidence shows it is reachable or intentionally retained.
57
+
58
+ ## Outputs
59
+
60
+ Write or update these files under `spec_root`:
61
+
62
+ - `architecture/system-overview.md`
63
+ - `architecture/repo-map.md`
64
+ - `architecture/capability-map.md`
65
+ - `architecture/integrations.md`
66
+ - `glossary.md`
67
+
68
+ ### system-overview.md
69
+
70
+ Describe:
71
+ - system purpose as observable from code
72
+ - major actors/interfaces
73
+ - major runtime/deployment components
74
+ - major data stores
75
+ - major external systems
76
+ - top-level business capabilities
77
+ - uncertainty / missing evidence
78
+
79
+ ### repo-map.md
80
+
81
+ For every repository:
82
+ - responsibility
83
+ - primary entry points
84
+ - owned data or services
85
+ - inbound dependencies
86
+ - outbound dependencies
87
+ - events/queues/jobs
88
+ - important source anchors
89
+
90
+ ### capability-map.md
91
+
92
+ Group by business capability, not repository boundary.
93
+
94
+ For every capability:
95
+ - short observable purpose
96
+ - participating repositories
97
+ - primary entry points
98
+ - important data/entities
99
+ - integrations/events
100
+ - candidate scope for later reverse engineering
101
+
102
+ Add a matrix showing capability × repository participation.
103
+
104
+ ### integrations.md
105
+
106
+ Document cross-repository and external contracts:
107
+ - HTTP/RPC
108
+ - events/messages/queues
109
+ - scheduled/batch interactions
110
+ - shared database/storage access
111
+ - third-party systems
112
+
113
+ Include direction, producer/caller, consumer/callee, contract location, and evidence.
114
+
115
+ ### glossary.md
116
+
117
+ Capture domain terms found in code/tests/docs. Mark ambiguous terms instead of guessing.
118
+
119
+ ## Evidence rules
120
+
121
+ For every important claim, include the strongest available source anchor: repository + file + symbol/function/class; add line ranges when available.
122
+
123
+ Classify uncertain statements as one of:
124
+ - Confirmed by implementation
125
+ - Confirmed by tests
126
+ - Inferred
127
+ - Unknown / owner confirmation required
128
+
129
+ Never turn an inference into a requirement or business rationale.
130
+
131
+ ## Human review gate
132
+
133
+ End by summarizing:
134
+ - proposed capability boundaries
135
+ - ambiguous ownership
136
+ - suspicious cross-repo coupling
137
+ - missing/uncertain business terminology
138
+ - areas that should be split/merged before detailed specs
139
+
140
+ Do not proceed to detailed PRD/Design reverse engineering until the user/team approves the capability map.
@@ -0,0 +1,208 @@
1
+ ---
2
+ name: system-reverse-engineer
3
+ description: Reverse-engineer an approved brownfield system map into durable AS-IS PRD, design, flow, and contract specifications across one or many repositories.
4
+ ---
5
+
6
+ # System Reverse Engineer
7
+
8
+ Use this skill after `/system-discovery` has produced a human-reviewed capability map.
9
+
10
+ This is a documentation workflow. Do not modify product code.
11
+
12
+ ## Goal
13
+
14
+ Turn the current implementation of the whole system into a durable AS-IS specification set that helps members understand the system and gives future coding agents reliable context.
15
+
16
+ One invocation should cover the whole approved system. Work capability-by-capability internally so each area can be verified and checkpointed. A named capability in the handoff is only a targeted refresh.
17
+
18
+ ## Analysis profile
19
+
20
+ Read `profile` from `.thachvd/system.json` and apply the same profile-specific emphasis defined by `/system-discovery`. In `auto` mode, use the repo profiles inferred during discovery. Re-check the evidence if the implementation has changed.
21
+
22
+ Profile guidance must never suppress behavior outside the selected profile. Source code/tests remain authoritative.
23
+
24
+ ## Documentation language
25
+
26
+ Read `language` from `.thachvd/system.json`.
27
+
28
+ - `vi`: write prose, headings, explanations, summaries, PRDs, design docs, flows, and contract explanations in natural Vietnamese.
29
+ - `en`: write those documents in English.
30
+ - Always preserve code identifiers, class/function names, API routes, event/queue names, database/schema names, file paths, commands, and source anchors exactly as they appear in source.
31
+ - When writing Vietnamese, retain the original English technical term in parentheses if translating it would reduce precision.
32
+
33
+ ## Preconditions
34
+
35
+ Read:
36
+
37
+ 1. `.thachvd/system.json`
38
+ 2. the configured `spec_root/architecture/system-overview.md`
39
+ 3. `spec_root/architecture/repo-map.md`
40
+ 4. `spec_root/architecture/capability-map.md`
41
+ 5. `spec_root/architecture/integrations.md`
42
+ 6. `spec_root/glossary.md`
43
+ 7. `spec_root/_meta/reverse-progress.json`
44
+
45
+ The capability map must have been reviewed by a human. If it is obviously still draft or ambiguous, stop rather than manufacturing detailed specs.
46
+
47
+ ## Durable checkpoint and resume
48
+
49
+ `thachvd-kit spec reverse` creates a durable checkpoint. Full-system runs use `spec_root/_meta/reverse-progress.json`; targeted refreshes use `spec_root/_meta/reverse-progress-<capability>.json`. Use the exact checkpoint path declared by the handoff prompt.
50
+
51
+ Expected shape:
52
+
53
+ ```json
54
+ {
55
+ "schema_version": 1,
56
+ "system": "example",
57
+ "mode": "full",
58
+ "target": null,
59
+ "started_at": "<ISO-8601>",
60
+ "updated_at": "<ISO-8601>",
61
+ "status": "in_progress",
62
+ "capabilities": {
63
+ "booking": {
64
+ "title": "Booking",
65
+ "status": "pending",
66
+ "updated_at": "<ISO-8601>",
67
+ "source_paths": {}
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ Rules:
74
+
75
+ 1. If `capabilities` is empty, derive the approved capability list from `capability-map.md` and populate it before deep work.
76
+ 2. In targeted mode, include/work only the requested capability.
77
+ 3. Before working on a capability, set it to `in_progress` and persist the file.
78
+ 4. After both PRD/design exist and the capability-level quality checks below pass, set it to `completed`, save its relevant `source_paths` by repo, and persist.
79
+ 5. If blocked, set `blocked` with a concise reason and continue with other capabilities when possible.
80
+ 6. On a later invocation, resume `pending`, `in_progress`, or retryable `blocked` capabilities. Do not redo `completed` capabilities unless the handoff is a targeted refresh or the user explicitly reset progress.
81
+ 7. Mark top-level `status` `completed` only when every intended capability is completed or explicitly blocked.
82
+ 8. Update `updated_at` after every state change.
83
+ 9. A targeted refresh must never overwrite the full-system checkpoint.
84
+
85
+ Do not keep progress only in chat memory.
86
+
87
+ ## Sources of truth
88
+
89
+ Use, in order of evidentiary strength:
90
+
91
+ - production implementation
92
+ - tests
93
+ - configuration
94
+ - schemas/migrations
95
+ - existing reviewed system docs
96
+
97
+ Use Codebase Memory MCP as the primary source for structural discovery, cross-repository tracing, callers/callees, routes, jobs, events, queues, schedulers, and data flow. Read source files directly to verify important behavior and fill gaps.
98
+
99
+ Do not infer undocumented business rationale from implementation.
100
+
101
+ ## Processing model
102
+
103
+ For each approved capability:
104
+
105
+ 1. Identify every participating repository and coherent implementation scope.
106
+ 2. Trace entry points through services, persistence, async work, integrations, and outputs.
107
+ 3. Inspect tests that lock down observable behavior.
108
+ 4. Explicitly inspect framework side paths that call graphs may miss: middleware, policies/guards, observers/hooks, event listeners, jobs, schedulers, migrations, CLI commands, config and feature flags.
109
+ 5. Extract current requirements, invariants, error/failure behavior, state transitions, retries/idempotency, and contracts.
110
+ 6. Verify important claims against code/tests.
111
+ 7. Write the capability PRD and design doc using the fixed templates below.
112
+ 8. Record uncertainty explicitly.
113
+ 9. Save stable repository-relative source paths into the progress entry for later drift checking.
114
+ 10. Continue to the next incomplete capability.
115
+
116
+ If Shinpr's `/recipe-reverse-engineer` workflow is installed, it may be used as a high-assurance helper for coherent implementation scopes. It is optional.
117
+
118
+ ## Fixed PRD template
119
+
120
+ Every `spec_root/capabilities/<capability>/prd.md` must contain these sections in this order:
121
+
122
+ 1. **Purpose**
123
+ 2. **Actors**
124
+ 3. **Current Behaviors / Use Cases**
125
+ 4. **Requirements**
126
+ 5. **Business Rules and Invariants**
127
+ 6. **Error and Edge Cases**
128
+ 7. **Current Limitations**
129
+ 8. **Unknown Business Rationale / Owner Confirmation**
130
+ 9. **Evidence Summary**
131
+
132
+ Requirements describe what the current system demonstrably does, not what it should ideally do.
133
+
134
+ ## Fixed design template
135
+
136
+ Every `spec_root/capabilities/<capability>/design.md` must contain these sections in this order:
137
+
138
+ 1. **Participating Repositories**
139
+ 2. **Entry Points**
140
+ 3. **Components / Modules**
141
+ 4. **End-to-End Execution Flow**
142
+ 5. **Data Model and Ownership**
143
+ 6. **Persistence**
144
+ 7. **State Transitions**
145
+ 8. **Events / Queues / Jobs / Schedulers**
146
+ 9. **External Integrations**
147
+ 10. **Configuration / Feature Flags**
148
+ 11. **Failure / Retry / Rollback / Idempotency**
149
+ 12. **Tests**
150
+ 13. **Source Map**
151
+ 14. **Known Ambiguities**
152
+
153
+ Do not omit a section silently. Use "None observed" or "Unknown / requires confirmation" when evidence does not establish content.
154
+
155
+ ## System-level outputs
156
+
157
+ Update only when real evidence warrants them:
158
+
159
+ - `spec_root/flows/*.md` for important end-to-end or cross-repository flows
160
+ - `spec_root/contracts/*.md` for HTTP/RPC, events/messages, queues, shared storage, or other cross-boundary contracts
161
+
162
+ For cross-repository contracts, verify both producer/caller and consumer/callee when both codebases are available.
163
+
164
+ Do not create files merely to fill directories.
165
+
166
+ ## Evidence and uncertainty
167
+
168
+ Attach repository + file + symbol/function/class anchors to important behavior. Add line ranges when reliably available.
169
+
170
+ Distinguish:
171
+
172
+ - Confirmed by implementation
173
+ - Confirmed by tests
174
+ - Inferred
175
+ - Unknown / owner confirmation required
176
+
177
+ Never promote an inference to a requirement without evidence.
178
+
179
+ ## Capability quality gate
180
+
181
+ Before marking one capability `completed` in progress:
182
+
183
+ - PRD and design templates are complete
184
+ - PRD and design agree
185
+ - primary entry points were traced
186
+ - relevant tests were inspected
187
+ - async/framework side paths were considered
188
+ - important failure/state-transition behavior is represented
189
+ - material cross-repo contracts are represented
190
+ - major claims have source anchors
191
+ - relevant `source_paths` were recorded in progress
192
+ - no undocumented business rationale was invented
193
+ - dead/unreachable code is not presented as active without evidence
194
+
195
+ This is an author-side gate only. A later independent `/system-spec-review` decides whether the result is actually verified.
196
+
197
+ ## Final output
198
+
199
+ Return a concise coverage summary:
200
+
201
+ - capabilities completed
202
+ - capabilities blocked
203
+ - unresolved ambiguities
204
+ - specs needing owner review
205
+ - cross-repository flows/contracts produced
206
+ - current checkpoint status
207
+
208
+ Do not claim the specs are independently verified. That happens only after `thachvd-kit spec verify` + `/system-spec-review`.