cclaw-cli 0.55.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +3 -3
  2. package/dist/artifact-linter/brainstorm.js +59 -1
  3. package/dist/artifact-linter/design.js +46 -1
  4. package/dist/artifact-linter/plan.js +22 -1
  5. package/dist/artifact-linter/review.js +35 -1
  6. package/dist/artifact-linter/scope.js +33 -9
  7. package/dist/artifact-linter/shared.d.ts +12 -10
  8. package/dist/artifact-linter/shared.js +102 -41
  9. package/dist/artifact-linter/ship.js +36 -0
  10. package/dist/artifact-linter/spec.js +23 -1
  11. package/dist/artifact-linter/tdd.js +74 -0
  12. package/dist/artifact-linter.d.ts +1 -1
  13. package/dist/artifact-linter.js +11 -1
  14. package/dist/constants.d.ts +1 -1
  15. package/dist/constants.js +1 -0
  16. package/dist/content/closeout-guidance.d.ts +1 -1
  17. package/dist/content/closeout-guidance.js +10 -11
  18. package/dist/content/core-agents.d.ts +35 -36
  19. package/dist/content/core-agents.js +189 -99
  20. package/dist/content/diff-command.js +1 -1
  21. package/dist/content/examples.d.ts +0 -3
  22. package/dist/content/examples.js +197 -752
  23. package/dist/content/hook-events.js +1 -2
  24. package/dist/content/hook-manifest.d.ts +3 -4
  25. package/dist/content/hook-manifest.js +22 -25
  26. package/dist/content/hooks.js +54 -14
  27. package/dist/content/idea.d.ts +60 -0
  28. package/dist/content/idea.js +404 -0
  29. package/dist/content/learnings.d.ts +2 -4
  30. package/dist/content/learnings.js +10 -26
  31. package/dist/content/meta-skill.js +4 -3
  32. package/dist/content/node-hooks.js +368 -164
  33. package/dist/content/observe.js +3 -3
  34. package/dist/content/opencode-plugin.js +12 -32
  35. package/dist/content/reference-patterns.js +2 -2
  36. package/dist/content/runtime-shared-snippets.d.ts +8 -0
  37. package/dist/content/runtime-shared-snippets.js +80 -0
  38. package/dist/content/session-hooks.js +1 -1
  39. package/dist/content/skills-elicitation.d.ts +1 -0
  40. package/dist/content/skills-elicitation.js +123 -0
  41. package/dist/content/skills.d.ts +1 -0
  42. package/dist/content/skills.js +54 -2
  43. package/dist/content/stage-schema.js +107 -63
  44. package/dist/content/stages/brainstorm.js +7 -3
  45. package/dist/content/stages/design.js +4 -0
  46. package/dist/content/stages/review.js +8 -8
  47. package/dist/content/stages/schema-types.d.ts +2 -2
  48. package/dist/content/stages/scope.js +7 -3
  49. package/dist/content/stages/ship.js +1 -1
  50. package/dist/content/start-command.js +4 -4
  51. package/dist/content/status-command.js +3 -3
  52. package/dist/content/subagent-context-skills.js +156 -1
  53. package/dist/content/subagents.d.ts +0 -5
  54. package/dist/content/subagents.js +12 -82
  55. package/dist/content/templates.js +108 -6
  56. package/dist/content/utility-skills.js +26 -97
  57. package/dist/flow-state.d.ts +12 -6
  58. package/dist/flow-state.js +5 -6
  59. package/dist/gate-evidence.d.ts +0 -31
  60. package/dist/gate-evidence.js +3 -181
  61. package/dist/harness-adapters.js +1 -1
  62. package/dist/hook-schemas/claude-hooks.v1.json +2 -3
  63. package/dist/hook-schemas/codex-hooks.v1.json +1 -1
  64. package/dist/hook-schemas/cursor-hooks.v1.json +1 -1
  65. package/dist/install.js +50 -7
  66. package/dist/internal/advance-stage/advance.js +22 -2
  67. package/dist/internal/advance-stage/parsers.d.ts +1 -0
  68. package/dist/internal/advance-stage/parsers.js +6 -0
  69. package/dist/internal/advance-stage/review-loop.js +1 -10
  70. package/dist/knowledge-store.d.ts +2 -20
  71. package/dist/knowledge-store.js +43 -57
  72. package/dist/policy.js +3 -3
  73. package/dist/retro-gate.js +8 -90
  74. package/dist/run-archive.js +1 -4
  75. package/dist/run-persistence.d.ts +1 -1
  76. package/dist/run-persistence.js +43 -111
  77. package/dist/runtime/run-hook.entry.d.ts +3 -0
  78. package/dist/runtime/run-hook.entry.js +5 -0
  79. package/dist/runtime/run-hook.mjs +9647 -0
  80. package/dist/track-heuristics.d.ts +7 -1
  81. package/dist/track-heuristics.js +12 -0
  82. package/package.json +4 -2
  83. package/dist/content/hook-inline-snippets.d.ts +0 -96
  84. package/dist/content/hook-inline-snippets.js +0 -515
  85. package/dist/content/idea-command.d.ts +0 -8
  86. package/dist/content/idea-command.js +0 -322
  87. package/dist/content/idea-frames.d.ts +0 -31
  88. package/dist/content/idea-frames.js +0 -140
  89. package/dist/content/idea-ranking.d.ts +0 -25
  90. package/dist/content/idea-ranking.js +0 -65
  91. package/dist/trace-matrix.d.ts +0 -27
  92. package/dist/trace-matrix.js +0 -226
@@ -112,11 +112,166 @@ Use after the default reviewer/security-reviewer passes when repo signals identi
112
112
  - Keep the default general reviewer pass intact; this is additive context, not a replacement.
113
113
  `;
114
114
  }
115
+ function criticMultiPerspectiveSkill() {
116
+ return `${skillFrontmatter("critic-multi-perspective", "Multi-perspective critic protocol with pre-commitment predictions and realist checks.")}# Critic Multi-Perspective Pass
117
+
118
+ Use with the \`critic\` delegation in \`brainstorm\`, \`scope\`, and \`design\`.
119
+
120
+ ## Required Output
121
+
122
+ - Before investigation, emit \`predictions[]\` with explicit hypotheses.
123
+ - Analyze through context-aware angles:
124
+ - plan/spec/scope: executor, stakeholder, skeptic
125
+ - design/code: security, operator, new-hire
126
+ - Include a dedicated gap analysis (what is missing, not only what is wrong).
127
+ - Move low-confidence concerns (<=4/10) into \`openQuestions[]\`.
128
+ - For every critical/major concern, include a \`realistCheckResults[]\` verdict.
129
+ - End with \`predictionsValidated[]\` mapping each prediction to confirmed/disproven.
130
+
131
+ ## Guardrails
132
+
133
+ - Do not block solely on low-confidence concerns.
134
+ - Suppress or downgrade implausible critical findings during realist checks.
135
+ - Escalate to adversarial mode when reviewers disagree, confidence is low, or trust boundaries are involved.
136
+ `;
137
+ }
138
+ function documentCoherencePassSkill() {
139
+ return `${skillFrontmatter("document-coherence-pass", "Consistency-focused pass for cross-section coherence in spec/plan/design documents.")}# Document Coherence Pass
140
+
141
+ Use with \`coherence-reviewer\` on spec/plan/design artifacts.
142
+
143
+ ## Required Output
144
+
145
+ - List contradictions between sections and where they occur.
146
+ - Flag terminology drift where one concept is named inconsistently.
147
+ - Flag broken internal references, forward references, and dependency narrative mismatches.
148
+ - Return calibrated findings with concrete anchors and one-line corrections.
149
+
150
+ ## Guardrails
151
+
152
+ - Do not score overall quality; focus on consistency and coherence only.
153
+ - Do not invent contradictions without citation to concrete sections/lines.
154
+ `;
155
+ }
156
+ function documentScopeGuardSkill() {
157
+ return `${skillFrontmatter("document-scope-guard", "Complexity and minimum-change guardrail for scope/plan/design documents.")}# Document Scope Guard
158
+
159
+ Use with \`scope-guardian-reviewer\` when expansion pressure or abstraction creep is likely.
160
+
161
+ ## Required Output
162
+
163
+ - Surface where existing solutions can be reused instead of adding new abstractions.
164
+ - Identify minimum-change alternative when current proposal is broader than needed.
165
+ - Call out complexity smells (speculative generic utilities, framework-ahead-of-need structures).
166
+ - Return calibrated findings with explicit impact on scope boundaries.
167
+
168
+ ## Guardrails
169
+
170
+ - Challenge unnecessary breadth, but do not silently shrink required user outcomes.
171
+ - Tie every scope reduction recommendation to a concrete cost/risk rationale.
172
+ `;
173
+ }
174
+ function documentFeasibilityPassSkill() {
175
+ return `${skillFrontmatter("document-feasibility-pass", "Feasibility validation for runtime/resource/dependency assumptions in plan/design artifacts.")}# Document Feasibility Pass
176
+
177
+ Use with \`feasibility-reviewer\` on plan/design docs that rely on runtime or operational assumptions.
178
+
179
+ ## Required Output
180
+
181
+ - Enumerate resource/time/runtime assumptions and whether they are validated.
182
+ - Flag external dependency availability or reliability risks.
183
+ - Flag rollout assumptions that are not backed by operational evidence.
184
+ - Return PASS/PASS_WITH_GAPS/FAIL/BLOCKED rationale grounded in cited assumptions.
185
+
186
+ ## Guardrails
187
+
188
+ - Focus on practical viability; do not redesign architecture unless feasibility is blocked.
189
+ - Distinguish unknowns that need evidence from hard blockers that require rework.
190
+ `;
191
+ }
192
+ function reviewPerfLensSkill() {
193
+ return `${skillFrontmatter("review-perf-lens", "Optional deep performance lens for large or high-risk review surfaces.")}# Review Performance Lens
194
+
195
+ Use as an optional follow-up lens when the default reviewer pass flags non-trivial performance risk.
196
+
197
+ ## Required Output
198
+
199
+ - Hot-path or algorithmic-risk summary with touched files.
200
+ - Potential regressions and estimated blast radius.
201
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
202
+
203
+ ## Guardrails
204
+
205
+ - Run only when justified by diff scope or explicit trigger.
206
+ - Do not replace the mandatory reviewer pass; this lens is additive.
207
+ `;
208
+ }
209
+ function reviewCompatLensSkill() {
210
+ return `${skillFrontmatter("review-compat-lens", "Optional compatibility lens for high-risk API/config/schema changes.")}# Review Compatibility Lens
211
+
212
+ Use as an optional follow-up lens when contracts, config, persistence schema, or generated clients might break consumers.
213
+
214
+ ## Required Output
215
+
216
+ - Surface inventory: APIs/config/schema/CLI/client contracts touched.
217
+ - Compatibility risk assessment (backward, forward, migration path).
218
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
219
+
220
+ ## Guardrails
221
+
222
+ - Focus on externally observable contracts and migration safety.
223
+ - Do not duplicate baseline reviewer findings verbatim.
224
+ `;
225
+ }
226
+ function reviewObservabilityLensSkill() {
227
+ return `${skillFrontmatter("review-observability-lens", "Optional observability lens for diagnosability and rollback safety.")}# Review Observability Lens
228
+
229
+ Use as an optional follow-up lens when failure diagnosis, telemetry, or operational rollback confidence is at risk.
230
+
231
+ ## Required Output
232
+
233
+ - Signals checked: logs, metrics, traces, alerts, debug handles.
234
+ - Gaps that could block diagnosis or rollback during incidents.
235
+ - Clear NO_IMPACT or FOUND_<n> result with evidence.
236
+
237
+ ## Guardrails
238
+
239
+ - Escalate only diagnosis-impacting gaps; avoid style-only telemetry suggestions.
240
+ - Keep scope tied to touched code paths and rollout-critical behavior.
241
+ `;
242
+ }
243
+ function architectCrossStageVerificationSkill() {
244
+ return `${skillFrontmatter("architect-cross-stage-verification", "Cross-stage cohesion verification before ship finalization.")}# Architect Cross-Stage Verification
245
+
246
+ Use with the \`architect\` delegation in the \`ship\` stage.
247
+
248
+ ## Required Output
249
+
250
+ - Read scope/design/spec/plan/review artifacts plus shipped diff/code surfaces.
251
+ - Validate that locked decisions and acceptance mappings still match shipped behavior.
252
+ - Flag drift between intended architecture and implemented boundaries.
253
+ - Return exactly one status token: \`CROSS_STAGE_VERIFIED\`, \`DRIFT_DETECTED\`, or \`BLOCKED\`.
254
+ - Provide evidence refs for every drift claim and identify the smallest corrective route.
255
+
256
+ ## Guardrails
257
+
258
+ - Do not defer unresolved drift to post-ship follow-up without explicit waiver.
259
+ - If evidence is insufficient to verify cohesion, return \`BLOCKED\` with missing inputs.
260
+ `;
261
+ }
115
262
  export const SUBAGENT_CONTEXT_SKILLS = {
116
263
  "tdd-cycle-evidence": tddCycleEvidenceSkill(),
117
264
  "review-spec-pass": reviewSpecPassSkill(),
118
265
  "security-audit": securityAuditSkill(),
119
266
  "adversarial-review": adversarialReviewSkill(),
120
267
  "receiving-code-review": receivingCodeReviewSkill(),
121
- "stack-aware-review": stackAwareReviewSkill()
268
+ "stack-aware-review": stackAwareReviewSkill(),
269
+ "critic-multi-perspective": criticMultiPerspectiveSkill(),
270
+ "document-coherence-pass": documentCoherencePassSkill(),
271
+ "document-scope-guard": documentScopeGuardSkill(),
272
+ "document-feasibility-pass": documentFeasibilityPassSkill(),
273
+ "review-perf-lens": reviewPerfLensSkill(),
274
+ "review-compat-lens": reviewCompatLensSkill(),
275
+ "review-observability-lens": reviewObservabilityLensSkill(),
276
+ "architect-cross-stage-verification": architectCrossStageVerificationSkill()
122
277
  };
@@ -1,8 +1,3 @@
1
1
  export declare function subagentDrivenDevSkill(): string;
2
2
  export declare function parallelAgentsSkill(): string;
3
- /**
4
- * Returns markdown fragments augmenting each specialist persona with Task tool
5
- * delegation guidance. Combine with the existing `body` field from `core-agents.ts`.
6
- */
7
- export declare function enhancedAgentBody(agentName: string): string;
8
3
  export declare function subagentsAgentsMdBlock(): string;
@@ -5,27 +5,6 @@ import { conversationLanguagePolicyMarkdown } from "./language-policy.js";
5
5
  * specialist payloads. Cclaw materializes static instructions — this module does not
6
6
  * execute orchestration logic at install time beyond string assembly.
7
7
  */
8
- const SUBAGENT_AGENT_NAMES = [
9
- "researcher",
10
- "architect",
11
- "spec-validator",
12
- "spec-document-reviewer",
13
- "slice-implementer",
14
- "performance-reviewer",
15
- "compatibility-reviewer",
16
- "observability-reviewer",
17
- "release-reviewer",
18
- "planner",
19
- "product-manager",
20
- "product-strategist",
21
- "critic",
22
- "reviewer",
23
- "security-reviewer",
24
- "test-author",
25
- "doc-updater",
26
- "implementer",
27
- "fixer"
28
- ];
29
8
  const MARKDOWN_CODE_FENCE = "```";
30
9
  function formatAgentList(agents) {
31
10
  return agents.length > 0 ? agents.join(", ") : "none";
@@ -145,8 +124,8 @@ Concrete per-stage rules so the controller does not have to guess which tier fit
145
124
 
146
125
  | Stage | Deep slot | Balanced slot(s) | Fast fan-out | Trigger to escalate |
147
126
  |---|---|---|---|---|
148
- | brainstorm | planner (only if ambiguity spans >1 module) | product-manager / critic when product value or premise is uncertain | run in-thread research playbooks | promote to \`balanced\` critic if the do-nothing path may beat the idea |
149
- | scope | planner (always) | product-manager / product-strategist / critic when mode changes value, trajectory, or boundaries | run \`research/git-history.md\` in-thread when churn is high | promote to \`balanced\` critic if scope mode is disputed |
127
+ | brainstorm | planner (only if ambiguity spans >1 module) | product-discovery / critic when product value or premise is uncertain | run in-thread research playbooks | promote to \`balanced\` critic if the do-nothing path may beat the idea |
128
+ | scope | planner (always) | product-discovery / critic when mode changes value, trajectory, or boundaries | run \`research/git-history.md\` in-thread when churn is high | promote to \`balanced\` critic if scope mode is disputed |
150
129
  | design | planner (always) | critic, security-reviewer, test-author when alternatives/trust/testability apply | run \`research/framework-docs-lookup.md\` + \`research/best-practices-lookup.md\` in-thread | escalate one specialist to \`deep\` only if a failure mode is Critical-severity |
151
130
  | spec | — | spec-validator / spec-document-reviewer / reviewer (for long or high-risk specs) | — | escalate to \`deep\` only for spec ↔ design contradictions |
152
131
  | plan | planner (solo, always) | — | — | never fan out at plan stage; one owner for dependency graph |
@@ -176,6 +155,7 @@ Borrow the good part of Team/Ruflo-style orchestration without adding a swarm ru
176
155
  - **No parallel writes to adjacent surfaces.** If tasks may touch the same module, serialize them.
177
156
  - **Checkpoint before synthesis.** Each agent returns status, files inspected/changed, evidence, and blockers before the parent acts.
178
157
  - **Consensus is for hard calls only.** Use two reviewers when severity or architecture is disputed; otherwise one evidence-backed reviewer is enough.
158
+ - **Multi-wave persistence uses the executing-waves skill.** For 2+ wave efforts, maintain \`.cclaw/wave-plans/\` and run carry-forward drift audits in brainstorm.
179
159
 
180
160
  ## Parallelization Decision Gate
181
161
 
@@ -406,6 +386,8 @@ ${conversationLanguagePolicyMarkdown()}
406
386
 
407
387
  Implementation that touches shared source trees must remain **sequential** unless you have proven disjoint filesystem ownership (rare) and an explicit merge protocol.
408
388
 
389
+ When explicit bounded TDD fan-out is approved with parallel \`slice-implementer\` lanes, author \`.cclaw/artifacts/cohesion-contract.md\` + \`.json\` before launch and run \`integration-overseer\` after fan-in.
390
+
409
391
  ## When to Use
410
392
 
411
393
  - **Independent investigations** (perf vs correctness vs dependency hygiene) with separated code neighborhoods.
@@ -429,11 +411,13 @@ Implementation that touches shared source trees must remain **sequential** unles
429
411
  ## Dispatch Protocol
430
412
 
431
413
  1. **Identify independent problem domains** (no file overlap; no shared mutable working assumptions).
432
- 2. **Craft one prompt per domain** with **full context pasted** — same HARD-GATE as SDD: no “go read X to learn why.”
433
- 3. **Launch ALL agents in a single controller message** (multiple Task tool calls) so they start with comparable timelines.
434
- 4. **Wait for all to return** before synthesis (avoid incremental confirmation bias).
435
- 5. **Reconcile results:** deduplicate findings, merge overlaps, and **conflict-check** contradictions explicitly.
436
- 6. **Run the full test suite after any code changes** parallel analysis may propose edits; verification stays mandatory.
414
+ 2. **Author cohesion contract first** whenever fan-out touches shared interfaces or bounded parallel \`slice-implementer\` lanes.
415
+ 3. **Craft one prompt per domain** with **full context pasted** same HARD-GATE as SDD: no “go read X to learn why.”
416
+ 4. **Launch ALL agents in a single controller message** (multiple Task tool calls) so they start with comparable timelines.
417
+ 5. **Wait for all to return** before synthesis (avoid incremental confirmation bias).
418
+ 6. **Run integration-overseer after fan-in** to verify touchpoints, boundary types, invariants, and integration-test outcomes.
419
+ 7. **Reconcile results:** deduplicate findings, merge overlaps, and **conflict-check** contradictions explicitly.
420
+ 8. **Run the full test suite after any code changes** — parallel analysis may propose edits; verification stays mandatory.
437
421
 
438
422
  ## Review Army Pattern (gstack)
439
423
 
@@ -1009,60 +993,6 @@ ${MARKDOWN_CODE_FENCE}
1009
993
 
1010
994
  `;
1011
995
  }
1012
- /**
1013
- * Returns markdown fragments augmenting each specialist persona with Task tool
1014
- * delegation guidance. Combine with the existing `body` field from `core-agents.ts`.
1015
- */
1016
- export function enhancedAgentBody(agentName) {
1017
- switch (agentName) {
1018
- case "researcher":
1019
- return researcherEnhancedBody();
1020
- case "architect":
1021
- return architectEnhancedBody();
1022
- case "spec-validator":
1023
- return specValidatorEnhancedBody();
1024
- case "spec-document-reviewer":
1025
- return specDocumentReviewerEnhancedBody();
1026
- case "slice-implementer":
1027
- return sliceImplementerEnhancedBody();
1028
- case "performance-reviewer":
1029
- return performanceReviewerEnhancedBody();
1030
- case "compatibility-reviewer":
1031
- return compatibilityReviewerEnhancedBody();
1032
- case "observability-reviewer":
1033
- return observabilityReviewerEnhancedBody();
1034
- case "release-reviewer":
1035
- return releaseReviewerEnhancedBody();
1036
- case "planner":
1037
- return plannerEnhancedBody();
1038
- case "product-manager":
1039
- return productManagerEnhancedBody();
1040
- case "product-strategist":
1041
- return productStrategistEnhancedBody();
1042
- case "critic":
1043
- return criticEnhancedBody();
1044
- case "reviewer":
1045
- return reviewerEnhancedBody();
1046
- case "security-reviewer":
1047
- return securityReviewerEnhancedBody();
1048
- case "test-author":
1049
- return testAuthorEnhancedBody();
1050
- case "doc-updater":
1051
- return docUpdaterEnhancedBody();
1052
- case "implementer":
1053
- return implementerEnhancedBody();
1054
- case "fixer":
1055
- return fixerEnhancedBody();
1056
- default:
1057
- return `
1058
-
1059
- ## Task Tool Delegation
1060
-
1061
- _No enhanced Task template is defined for agent \`${agentName}\`._
1062
-
1063
- `;
1064
- }
1065
- }
1066
996
  export function subagentsAgentsMdBlock() {
1067
997
  return `### Subagent Orchestration
1068
998
 
@@ -76,6 +76,13 @@ export const ARTIFACT_TEMPLATES = {
76
76
  |---|---|---|---|
77
77
  | 1 | | | |
78
78
 
79
+ ## Q&A Log
80
+ | Turn | Question | User answer (1-line) | Decision impact |
81
+ |---|---|---|---|
82
+ | 1 | | | |
83
+
84
+ > Append-only by turn. Add one row after each user answer; do not rewrite prior rows.
85
+
79
86
  ## Approach Tier
80
87
  - Tier: lite | standard | deep
81
88
  - Why this tier:
@@ -192,6 +199,13 @@ ${MARKDOWN_CODE_FENCE}
192
199
  - Open questions:
193
200
  - Drift from upstream (or \`None\`):
194
201
 
202
+ ## Q&A Log
203
+ | Turn | Question | User answer (1-line) | Decision impact |
204
+ |---|---|---|---|
205
+ | 1 | | | |
206
+
207
+ > Append-only by turn. Add one row after each user answer; do not rewrite prior rows.
208
+
195
209
  ## Pre-Scope System Audit
196
210
  | Check | Command | Findings |
197
211
  |---|---|---|
@@ -427,6 +441,13 @@ ${MARKDOWN_CODE_FENCE}
427
441
  - Open questions:
428
442
  - Drift from upstream (or \`None\`):
429
443
 
444
+ ## Q&A Log
445
+ | Turn | Question | User answer (1-line) | Decision impact |
446
+ |---|---|---|---|
447
+ | 1 | | | |
448
+
449
+ > Append-only by turn. Add one row after each user answer; do not rewrite prior rows.
450
+
430
451
  ## Codebase Investigation
431
452
  | File | Current responsibility | Patterns discovered | Existing fit / reuse candidate |
432
453
  |---|---|---|---|
@@ -1021,6 +1042,76 @@ Execution rule: complete and verify each batch before starting the next batch.
1021
1042
 
1022
1043
  ## Learnings
1023
1044
  - None this stage.
1045
+ `,
1046
+ "cohesion-contract.md": `${artifactFrontmatter("tdd")}
1047
+
1048
+ # Cohesion Contract — <wave / stage / topic>
1049
+
1050
+ ## Shared Types & Interfaces
1051
+ | Symbol | Path | Signature | Owner slice |
1052
+ |---|---|---|---|
1053
+ | | | | |
1054
+
1055
+ ## Naming Conventions
1056
+ -
1057
+
1058
+ ## Invariants
1059
+ -
1060
+
1061
+ ## Integration Touchpoints
1062
+ | From slice | To slice | Surface | Integration test name |
1063
+ |---|---|---|---|
1064
+ | | | | |
1065
+
1066
+ ## Behavior Specifications per Slice
1067
+ ### Slice <n>: <description>
1068
+ - test: <name>
1069
+ assert: <one-line assertion>
1070
+ surface: <public interface>
1071
+
1072
+ ## Status
1073
+ | Slice | Implemented | Tests pass | Cohesion verified |
1074
+ |---|---|---|---|
1075
+ | S-1 | no | no | no |
1076
+
1077
+ ## Learnings
1078
+ - None this stage.
1079
+ `,
1080
+ "cohesion-contract.json": `{
1081
+ "version": 1,
1082
+ "sharedTypes": [
1083
+ {
1084
+ "symbol": "",
1085
+ "path": "",
1086
+ "signature": "",
1087
+ "ownerSlice": ""
1088
+ }
1089
+ ],
1090
+ "touchpoints": [
1091
+ {
1092
+ "fromSlice": "",
1093
+ "toSlice": "",
1094
+ "surface": "",
1095
+ "integrationTestName": ""
1096
+ }
1097
+ ],
1098
+ "slices": [
1099
+ {
1100
+ "sliceId": "S-1",
1101
+ "description": "",
1102
+ "test": "",
1103
+ "assert": "",
1104
+ "surface": "",
1105
+ "implemented": false,
1106
+ "testsPass": false,
1107
+ "cohesionVerified": false
1108
+ }
1109
+ ],
1110
+ "status": {
1111
+ "overall": "pending",
1112
+ "notes": ""
1113
+ }
1114
+ }
1024
1115
  `,
1025
1116
  "07-review.md": `${artifactFrontmatter("review")}
1026
1117
 
@@ -1094,6 +1185,12 @@ Execution rule: complete and verify each batch before starting the next batch.
1094
1185
  | R-1 | Critical/Important/Suggestion | correctness/security/performance/architecture/external-safety | path:line | | open/resolved |
1095
1186
  - NO_FINDINGS_ATTESTATION: <required when no findings are reported; cite inspected coverage>
1096
1187
 
1188
+ ## Lens Coverage
1189
+ - Performance: NO_IMPACT | FOUND_<n>
1190
+ - Compatibility: NO_IMPACT | FOUND_<n>
1191
+ - Observability: NO_IMPACT | FOUND_<n>
1192
+ - Security: routed to security-reviewer (always separate)
1193
+
1097
1194
  ## Security Sweep Attestation
1098
1195
  - Result: findings | NO_CHANGE_ATTESTATION | NO_SECURITY_IMPACT
1099
1196
  - Inspected surfaces:
@@ -1115,7 +1212,7 @@ Execution rule: complete and verify each batch before starting the next batch.
1115
1212
 
1116
1213
  ## Review Readiness Snapshot
1117
1214
 
1118
- - Victory Detector: pass | fail (Layer 1, Layer 2, security sweep, structured findings, trace evidence, unresolved-critical status)
1215
+ - Victory Detector: pass | fail (Layer 1, Layer 2, security sweep, structured findings, acceptance/reproduction coverage evidence, unresolved-critical status)
1119
1216
  - Completed checks: Layer 1, Layer 2 tags, security sweep, schema validation
1120
1217
  - Delegation log: \`.cclaw/state/delegation-log.json\` required/completed/waived/pending
1121
1218
  - Staleness signal: commit at last review pass vs current commit
@@ -1130,11 +1227,10 @@ Execution rule: complete and verify each batch before starting the next batch.
1130
1227
  - Adversarial review: not triggered | pass | fail
1131
1228
  - Overall: complete | concerns | blocked
1132
1229
 
1133
- ## Trace Matrix Check
1134
- - Command: \`npx cclaw-cli internal trace-matrix\` when the active track enforces it; otherwise record direct AC/reproduction-slice coverage.
1135
- - Orphaned criteria: 0
1136
- - Orphaned source items: 0 or \`N/A - direct spec/reproduction coverage\`
1137
- - Orphaned tests: 0
1230
+ ## Coverage Check
1231
+ - AC/source-item/slice coverage rationale:
1232
+ - Orphaned source items: none | explain gap
1233
+ - Orphaned tests: none | explain gap
1138
1234
  - Evidence ref:
1139
1235
 
1140
1236
  ## Verification Command Discovery
@@ -1209,6 +1305,12 @@ Execution rule: complete and verify each batch before starting the next batch.
1209
1305
  - Type-check:
1210
1306
  - Working tree clean:
1211
1307
 
1308
+ ## Architect Cross-Stage Verification
1309
+ - Skill: architect-cross-stage-verification
1310
+ - Result: CROSS_STAGE_VERIFIED | DRIFT_DETECTED | BLOCKED
1311
+ - Evidence refs:
1312
+ - Drift summary:
1313
+
1212
1314
  ## Base Branch Determination
1213
1315
  - Command run: \`git merge-base HEAD main || git merge-base HEAD master\`
1214
1316
  - Base branch:
@@ -5,128 +5,57 @@
5
5
  export function languageTypescriptSkill() {
6
6
  return `---
7
7
  name: language-typescript
8
- description: "TypeScript rule pack. Opt-in language lens. Use when reviewing or writing TypeScript/JavaScript diffs during tdd or review enforces type-safety, runtime-boundary validation, and idiomatic patterns."
8
+ description: "TypeScript rule pack. Compact opt-in lens for tdd/review when diffs touch TS/JS files."
9
9
  ---
10
10
 
11
11
  # TypeScript Rule Pack
12
12
 
13
- ## Quick Start
14
-
15
- > 1. Activate during tdd or review whenever the diff touches \`.ts\`, \`.tsx\`, \`.mts\`, \`.cts\`, or \`.js\` files.
16
- > 2. Walk the rule tiers in order. Tier-1 violations block merge. Tier-2 need a named follow-up.
17
- > 3. Cite each finding as \`file:line — <rule id> — <one-line remediation>\`.
18
-
19
- ## HARD-GATE
20
-
21
- Do not approve a TypeScript change that ships \`any\`, \`@ts-ignore\`, or
22
- \`@ts-expect-error\` *without* (a) a comment explaining why, (b) a linked issue,
23
- and (c) an assertion that the blast radius is bounded to the current file.
24
- No exceptions in production code paths.
25
-
26
- ## Tier 1 — blocking rules
27
-
28
- 1. **No silent \`any\`.** Unknown inputs must be typed as \`unknown\` first, then narrowed.
29
- 2. **Runtime validate trust boundaries.** HTTP bodies, env vars, file contents, and
30
- IPC payloads must be parsed through a schema validator (zod, valibot, io-ts) before
31
- being treated as typed data.
32
- 3. **No \`as\` without a narrowing reason.** \`value as Foo\` is only acceptable when
33
- preceded by a runtime check that proves the shape (e.g. \`if ("id" in value)\`).
34
- 4. **Exhaustive switches on discriminated unions.** Every \`switch\` on a tagged
35
- union must end with a \`default\` branch that assigns to \`never\` to surface
36
- missing cases at compile time.
37
- 5. **Promise hygiene.** No unawaited promises in \`async\` functions; no
38
- \`void promise\` unless documented. Use \`@typescript-eslint/no-floating-promises\`.
39
- 6. **Null-safety at the boundary.** Optional chaining (\`?.\`) and nullish
40
- coalescing (\`??\`) must only be used when the null path is handled, not as a
41
- silent default.
13
+ Use this only when a diff includes \`.ts\`, \`.tsx\`, \`.mts\`, \`.cts\`, or \`.js\`.
42
14
 
43
- ## Tier 2 — follow-up rules
15
+ ## Blocking rules
44
16
 
45
- 7. Prefer \`readonly\` for arrays/object fields that are not mutated.
46
- 8. Prefer \`type\` aliases for unions, \`interface\` for extendable object shapes.
47
- 9. Name generic parameters descriptively once they carry semantic meaning (\`TEvent\`, \`TPayload\`).
48
- 10. Avoid re-exporting entire namespaces; named re-exports keep bundle analysis tractable.
49
- 11. Co-locate test fixtures with their types to keep drift visible.
17
+ 1. **No silent \`any\` or blanket \`@ts-ignore\`.** Unknown input starts as \`unknown\` and gets narrowed.
18
+ 2. **Validate trust boundaries at runtime.** HTTP/env/file/IPC payloads require schema parse before typed use.
19
+ 3. **No floating promises.** Await promises or explicitly document fire-and-forget behavior.
20
+ 4. **Exhaustive union handling.** Discriminated-union switches must fail loudly on missing branches.
50
21
 
51
- ## Anti-patterns
22
+ ## Follow-up rules
52
23
 
53
- - "It compiles, ship it" — compilation is necessary, not sufficient. Runtime boundary validation is the gate.
54
- - Casting library return types to tighten them without reading the library's actual contract.
55
- - Wrapping every function in \`try/catch\` and swallowing the error errors must either be rethrown typed or mapped to a Result/Either shape.
56
- - Using enums where a string-literal union would do (enums carry runtime cost and erase at tree-shaking time only when \`const\`).
24
+ - Prefer immutable/readonly data by default.
25
+ - Keep types local and explicit at module boundaries.
26
+ - Add/adjust tests when changing inferred public behavior.
57
27
 
58
- ## Review output shape
28
+ ## Output format
59
29
 
60
- \`\`\`
61
- - **Rule:** T1-2 (runtime validate trust boundaries)
62
- - **File:line:** src/api/users.ts:42
63
- - **Finding:** POST body cast directly to \`UserCreateInput\`; no schema parse.
64
- - **Remediation:** Parse through \`userCreateSchema\` (zod) before passing to the service layer.
65
- \`\`\`
30
+ \`file:line — rule id — concise remediation\`
66
31
  `;
67
32
  }
68
33
  export function languagePythonSkill() {
69
34
  return `---
70
35
  name: language-python
71
- description: "Python rule pack. Opt-in language lens. Use when reviewing or writing Python diffs during tdd or review enforces typing, exception hygiene, and idiomatic patterns."
36
+ description: "Python rule pack. Compact opt-in lens for tdd/review when diffs touch Python files."
72
37
  ---
73
38
 
74
39
  # Python Rule Pack
75
40
 
76
- ## Quick Start
77
-
78
- > 1. Activate during tdd or review whenever the diff touches \`.py\` / \`.pyi\` files.
79
- > 2. Walk the rule tiers in order. Tier-1 violations block merge. Tier-2 need a named follow-up.
80
- > 3. Cite each finding as \`file:line — <rule id> — <one-line remediation>\`.
81
-
82
- ## HARD-GATE
83
-
84
- Do not approve a Python change that catches bare \`except:\` or \`except Exception:\`
85
- in production code *without* (a) re-raising, (b) logging with \`logger.exception\`, or
86
- (c) a comment explaining the intentional swallow. Silent broad catches are the
87
- single biggest source of "works on my machine" bugs in Python services.
88
-
89
- ## Tier 1 — blocking rules
90
-
91
- 1. **Type hints on public APIs.** Every exported function, method, and dataclass
92
- must have full type hints. Use \`from __future__ import annotations\` or PEP 604 union syntax.
93
- 2. **No mutable default arguments.** \`def f(x=[])\` is a bug. Use \`None\` + inline default.
94
- 3. **Exception specificity.** Catch the narrowest exception class you actually handle.
95
- 4. **Context managers for resources.** Files, sockets, DB sessions, locks — always \`with\`.
96
- 5. **No bare \`assert\` in production code.** \`assert\` is stripped under \`python -O\`.
97
- For invariants, raise \`ValueError\`/\`RuntimeError\` explicitly.
98
- 6. **Deterministic imports.** No conditional imports at module top level except for
99
- platform branches; no import-time side effects.
100
-
101
- ## Tier 2 — follow-up rules
102
-
103
- 7. Prefer \`@dataclass(slots=True, frozen=True)\` for value objects.
104
- 8. Prefer \`pathlib.Path\` over \`os.path\` for new code.
105
- 9. Use f-strings for interpolation; reserve \`%\` and \`.format\` for logger messages (lazy eval).
106
- 10. Use \`logging.getLogger(__name__)\` per module; never the root logger.
107
- 11. Pin dependency ranges in \`pyproject.toml\`; lock with \`uv lock\` / \`pip-compile\`.
41
+ Use this only when a diff includes \`.py\` / \`.pyi\`.
108
42
 
109
- ## Async-specific
43
+ ## Blocking rules
110
44
 
111
- - Do not mix \`requests\`/sync I/O inside \`async def\`. Use \`httpx.AsyncClient\` / \`aiofiles\`.
112
- - \`asyncio.gather\` with \`return_exceptions=False\` cancels siblings on first failure — be explicit.
113
- - Every task created with \`asyncio.create_task\` must have its reference kept and awaited.
45
+ 1. **No broad silent catches.** Avoid bare \`except\` / \`except Exception\` unless re-raised or justified.
46
+ 2. **No mutable defaults.** Use \`None\` + local initialization.
47
+ 3. **Type exported surfaces.** Public functions/classes include clear type hints.
48
+ 4. **Resource safety by default.** File/DB/network handles use context managers.
114
49
 
115
- ## Anti-patterns
50
+ ## Follow-up rules
116
51
 
117
- - Using \`**kwargs\` to avoid writing a real signature.
118
- - Monkey-patching modules from tests without a \`contextlib.contextmanager\` cleanup.
119
- - Treating \`__init__.py\` as a place to run logic (imports only).
120
- - Re-inventing \`itertools\`/\`functools\` instead of using stdlib.
52
+ - Prefer explicit, narrow exceptions.
53
+ - Keep async and sync I/O models separated.
54
+ - Add/adjust tests with behavior changes.
121
55
 
122
- ## Review output shape
56
+ ## Output format
123
57
 
124
- \`\`\`
125
- - **Rule:** P1-3 (exception specificity)
126
- - **File:line:** users/service.py:88
127
- - **Finding:** \`except Exception\` around DB call silently drops integrity errors.
128
- - **Remediation:** Catch \`IntegrityError\` explicitly; re-raise everything else.
129
- \`\`\`
58
+ \`file:line — rule id — concise remediation\`
130
59
  `;
131
60
  }
132
61
  export function languageGoSkill() {