cclaw-cli 0.55.2 → 1.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 (72) hide show
  1. package/README.md +3 -3
  2. package/dist/artifact-linter/brainstorm.js +45 -1
  3. package/dist/artifact-linter/design.js +32 -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 +19 -9
  7. package/dist/artifact-linter/shared.d.ts +11 -10
  8. package/dist/artifact-linter/shared.js +70 -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/constants.d.ts +1 -1
  14. package/dist/constants.js +1 -0
  15. package/dist/content/closeout-guidance.d.ts +1 -1
  16. package/dist/content/closeout-guidance.js +10 -11
  17. package/dist/content/core-agents.d.ts +35 -36
  18. package/dist/content/core-agents.js +189 -99
  19. package/dist/content/diff-command.js +1 -1
  20. package/dist/content/examples.d.ts +0 -3
  21. package/dist/content/examples.js +197 -752
  22. package/dist/content/idea.d.ts +60 -0
  23. package/dist/content/idea.js +404 -0
  24. package/dist/content/learnings.d.ts +2 -4
  25. package/dist/content/learnings.js +10 -26
  26. package/dist/content/node-hooks.js +131 -97
  27. package/dist/content/opencode-plugin.js +12 -26
  28. package/dist/content/reference-patterns.js +2 -2
  29. package/dist/content/runtime-shared-snippets.d.ts +8 -0
  30. package/dist/content/runtime-shared-snippets.js +80 -0
  31. package/dist/content/session-hooks.js +1 -1
  32. package/dist/content/skills.d.ts +1 -0
  33. package/dist/content/skills.js +50 -0
  34. package/dist/content/stage-schema.js +107 -63
  35. package/dist/content/stages/review.js +8 -8
  36. package/dist/content/stages/schema-types.d.ts +2 -2
  37. package/dist/content/stages/scope.js +1 -1
  38. package/dist/content/stages/ship.js +1 -1
  39. package/dist/content/status-command.js +3 -3
  40. package/dist/content/subagent-context-skills.js +156 -1
  41. package/dist/content/subagents.d.ts +0 -5
  42. package/dist/content/subagents.js +12 -82
  43. package/dist/content/templates.js +87 -6
  44. package/dist/content/utility-skills.js +26 -97
  45. package/dist/flow-state.d.ts +5 -6
  46. package/dist/flow-state.js +4 -6
  47. package/dist/gate-evidence.d.ts +0 -31
  48. package/dist/gate-evidence.js +3 -181
  49. package/dist/harness-adapters.js +1 -1
  50. package/dist/install.js +38 -4
  51. package/dist/internal/advance-stage/advance.js +0 -1
  52. package/dist/internal/advance-stage/review-loop.js +1 -10
  53. package/dist/knowledge-store.d.ts +2 -20
  54. package/dist/knowledge-store.js +43 -57
  55. package/dist/policy.js +3 -3
  56. package/dist/retro-gate.js +8 -90
  57. package/dist/run-archive.js +1 -4
  58. package/dist/run-persistence.js +14 -109
  59. package/dist/runtime/run-hook.entry.d.ts +3 -0
  60. package/dist/runtime/run-hook.entry.js +5 -0
  61. package/dist/runtime/run-hook.mjs +9477 -0
  62. package/package.json +4 -2
  63. package/dist/content/hook-inline-snippets.d.ts +0 -96
  64. package/dist/content/hook-inline-snippets.js +0 -515
  65. package/dist/content/idea-command.d.ts +0 -8
  66. package/dist/content/idea-command.js +0 -322
  67. package/dist/content/idea-frames.d.ts +0 -31
  68. package/dist/content/idea-frames.js +0 -140
  69. package/dist/content/idea-ranking.d.ts +0 -25
  70. package/dist/content/idea-ranking.js +0 -65
  71. package/dist/trace-matrix.d.ts +0 -27
  72. package/dist/trace-matrix.js +0 -226
@@ -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
 
@@ -1021,6 +1021,76 @@ Execution rule: complete and verify each batch before starting the next batch.
1021
1021
 
1022
1022
  ## Learnings
1023
1023
  - None this stage.
1024
+ `,
1025
+ "cohesion-contract.md": `${artifactFrontmatter("tdd")}
1026
+
1027
+ # Cohesion Contract — <wave / stage / topic>
1028
+
1029
+ ## Shared Types & Interfaces
1030
+ | Symbol | Path | Signature | Owner slice |
1031
+ |---|---|---|---|
1032
+ | | | | |
1033
+
1034
+ ## Naming Conventions
1035
+ -
1036
+
1037
+ ## Invariants
1038
+ -
1039
+
1040
+ ## Integration Touchpoints
1041
+ | From slice | To slice | Surface | Integration test name |
1042
+ |---|---|---|---|
1043
+ | | | | |
1044
+
1045
+ ## Behavior Specifications per Slice
1046
+ ### Slice <n>: <description>
1047
+ - test: <name>
1048
+ assert: <one-line assertion>
1049
+ surface: <public interface>
1050
+
1051
+ ## Status
1052
+ | Slice | Implemented | Tests pass | Cohesion verified |
1053
+ |---|---|---|---|
1054
+ | S-1 | no | no | no |
1055
+
1056
+ ## Learnings
1057
+ - None this stage.
1058
+ `,
1059
+ "cohesion-contract.json": `{
1060
+ "version": 1,
1061
+ "sharedTypes": [
1062
+ {
1063
+ "symbol": "",
1064
+ "path": "",
1065
+ "signature": "",
1066
+ "ownerSlice": ""
1067
+ }
1068
+ ],
1069
+ "touchpoints": [
1070
+ {
1071
+ "fromSlice": "",
1072
+ "toSlice": "",
1073
+ "surface": "",
1074
+ "integrationTestName": ""
1075
+ }
1076
+ ],
1077
+ "slices": [
1078
+ {
1079
+ "sliceId": "S-1",
1080
+ "description": "",
1081
+ "test": "",
1082
+ "assert": "",
1083
+ "surface": "",
1084
+ "implemented": false,
1085
+ "testsPass": false,
1086
+ "cohesionVerified": false
1087
+ }
1088
+ ],
1089
+ "status": {
1090
+ "overall": "pending",
1091
+ "notes": ""
1092
+ }
1093
+ }
1024
1094
  `,
1025
1095
  "07-review.md": `${artifactFrontmatter("review")}
1026
1096
 
@@ -1094,6 +1164,12 @@ Execution rule: complete and verify each batch before starting the next batch.
1094
1164
  | R-1 | Critical/Important/Suggestion | correctness/security/performance/architecture/external-safety | path:line | | open/resolved |
1095
1165
  - NO_FINDINGS_ATTESTATION: <required when no findings are reported; cite inspected coverage>
1096
1166
 
1167
+ ## Lens Coverage
1168
+ - Performance: NO_IMPACT | FOUND_<n>
1169
+ - Compatibility: NO_IMPACT | FOUND_<n>
1170
+ - Observability: NO_IMPACT | FOUND_<n>
1171
+ - Security: routed to security-reviewer (always separate)
1172
+
1097
1173
  ## Security Sweep Attestation
1098
1174
  - Result: findings | NO_CHANGE_ATTESTATION | NO_SECURITY_IMPACT
1099
1175
  - Inspected surfaces:
@@ -1115,7 +1191,7 @@ Execution rule: complete and verify each batch before starting the next batch.
1115
1191
 
1116
1192
  ## Review Readiness Snapshot
1117
1193
 
1118
- - Victory Detector: pass | fail (Layer 1, Layer 2, security sweep, structured findings, trace evidence, unresolved-critical status)
1194
+ - Victory Detector: pass | fail (Layer 1, Layer 2, security sweep, structured findings, acceptance/reproduction coverage evidence, unresolved-critical status)
1119
1195
  - Completed checks: Layer 1, Layer 2 tags, security sweep, schema validation
1120
1196
  - Delegation log: \`.cclaw/state/delegation-log.json\` required/completed/waived/pending
1121
1197
  - Staleness signal: commit at last review pass vs current commit
@@ -1130,11 +1206,10 @@ Execution rule: complete and verify each batch before starting the next batch.
1130
1206
  - Adversarial review: not triggered | pass | fail
1131
1207
  - Overall: complete | concerns | blocked
1132
1208
 
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
1209
+ ## Coverage Check
1210
+ - AC/source-item/slice coverage rationale:
1211
+ - Orphaned source items: none | explain gap
1212
+ - Orphaned tests: none | explain gap
1138
1213
  - Evidence ref:
1139
1214
 
1140
1215
  ## Verification Command Discovery
@@ -1209,6 +1284,12 @@ Execution rule: complete and verify each batch before starting the next batch.
1209
1284
  - Type-check:
1210
1285
  - Working tree clean:
1211
1286
 
1287
+ ## Architect Cross-Stage Verification
1288
+ - Skill: architect-cross-stage-verification
1289
+ - Result: CROSS_STAGE_VERIFIED | DRIFT_DETECTED | BLOCKED
1290
+ - Evidence refs:
1291
+ - Drift summary:
1292
+
1212
1293
  ## Base Branch Determination
1213
1294
  - Command run: \`git merge-base HEAD main || git merge-base HEAD master\`
1214
1295
  - 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() {
@@ -32,14 +32,13 @@ export interface RetroState {
32
32
  /**
33
33
  * Ship closeout substate machine.
34
34
  *
35
- * After ship completes, cclaw auto-chains retro compound → archive.
35
+ * After ship completes, cclaw auto-chains post-ship review → archive.
36
36
  * Each step is interruptible: `/cc` reads `shipSubstate` and resumes
37
37
  * from the correct step even across sessions.
38
38
  *
39
39
  * - `idle` — ship not complete, or closeout not yet started.
40
- * - `retro_review` — 09-retro.md draft exists; awaiting user edit/accept/skip.
41
- * - `compound_review` retro accepted; compound pass awaiting execution
42
- * (or user skip).
40
+ * - `post_ship_review` — unified closeout leg: retro acceptance/edit/skip
41
+ * plus compound pass execution (or explicit skip).
43
42
  * - `ready_to_archive` — retro + compound done; archive is the next
44
43
  * automatic step.
45
44
  * - `archived` — archive completed in this session (transient — archive
@@ -53,7 +52,7 @@ export interface RetroState {
53
52
  * These are not duplicates: `done` lives in stage transitions; `archived` /
54
53
  * `idle` live in closeout lifecycle state.
55
54
  */
56
- export declare const SHIP_SUBSTATES: readonly ["idle", "retro_review", "compound_review", "ready_to_archive", "archived"];
55
+ export declare const SHIP_SUBSTATES: readonly ["idle", "post_ship_review", "ready_to_archive", "archived"];
57
56
  export type ShipSubstate = (typeof SHIP_SUBSTATES)[number];
58
57
  export interface CloseoutState {
59
58
  shipSubstate: ShipSubstate;
@@ -85,7 +84,7 @@ export interface FlowState {
85
84
  rewinds: RewindRecord[];
86
85
  /** Mandatory retrospective gate status before archive. */
87
86
  retro: RetroState;
88
- /** Ship → retrocompound → archive substate for resumable closeout. */
87
+ /** Ship → post_ship_review → archive substate for resumable closeout. */
89
88
  closeout: CloseoutState;
90
89
  }
91
90
  export interface InitialFlowStateOptions {
@@ -5,14 +5,13 @@ export const FLOW_STATE_SCHEMA_VERSION = 1;
5
5
  /**
6
6
  * Ship closeout substate machine.
7
7
  *
8
- * After ship completes, cclaw auto-chains retro compound → archive.
8
+ * After ship completes, cclaw auto-chains post-ship review → archive.
9
9
  * Each step is interruptible: `/cc` reads `shipSubstate` and resumes
10
10
  * from the correct step even across sessions.
11
11
  *
12
12
  * - `idle` — ship not complete, or closeout not yet started.
13
- * - `retro_review` — 09-retro.md draft exists; awaiting user edit/accept/skip.
14
- * - `compound_review` retro accepted; compound pass awaiting execution
15
- * (or user skip).
13
+ * - `post_ship_review` — unified closeout leg: retro acceptance/edit/skip
14
+ * plus compound pass execution (or explicit skip).
16
15
  * - `ready_to_archive` — retro + compound done; archive is the next
17
16
  * automatic step.
18
17
  * - `archived` — archive completed in this session (transient — archive
@@ -28,8 +27,7 @@ export const FLOW_STATE_SCHEMA_VERSION = 1;
28
27
  */
29
28
  export const SHIP_SUBSTATES = [
30
29
  "idle",
31
- "retro_review",
32
- "compound_review",
30
+ "post_ship_review",
33
31
  "ready_to_archive",
34
32
  "archived"
35
33
  ];
@@ -29,37 +29,6 @@ export interface CompletedStagesClosureResult {
29
29
  blocked: string[];
30
30
  }>;
31
31
  }
32
- export declare const RECONCILIATION_NOTICES_REL_PATH = ".cclaw/state/reconciliation-notices.json";
33
- export type ReconciliationNoticeKind = "gate_demotion" | "closeout_substate_demotion";
34
- export interface CloseoutSubstateDemotionPayload {
35
- previous: string;
36
- next: string;
37
- reason: string;
38
- }
39
- export interface ReconciliationNotice {
40
- id: string;
41
- runId: string;
42
- stage: FlowStage;
43
- gateId: string;
44
- reason: string;
45
- demotedAt: string;
46
- kind?: ReconciliationNoticeKind;
47
- payload?: CloseoutSubstateDemotionPayload;
48
- }
49
- export interface ReconciliationNoticesPayload {
50
- schemaVersion: number;
51
- notices: ReconciliationNotice[];
52
- parseOk: boolean;
53
- schemaOk: boolean;
54
- }
55
- export interface ReconciliationNoticeBuckets {
56
- activeBlocked: ReconciliationNotice[];
57
- currentStageBlocked: ReconciliationNotice[];
58
- unsynced: ReconciliationNotice[];
59
- staleRun: ReconciliationNotice[];
60
- }
61
- export declare function readReconciliationNotices(projectRoot: string): Promise<ReconciliationNoticesPayload>;
62
- export declare function classifyReconciliationNotices(flowState: FlowState, notices: ReconciliationNotice[]): ReconciliationNoticeBuckets;
63
32
  export declare function verifyCurrentStageGateEvidence(projectRoot: string, flowState: FlowState): Promise<GateEvidenceCheckResult>;
64
33
  export declare function verifyCompletedStagesGateClosure(flowState: FlowState): CompletedStagesClosureResult;
65
34
  export interface GateReconciliationResult {