@paths.design/caws-cli 9.3.2 → 10.1.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 (286) hide show
  1. package/README.md +71 -32
  2. package/dist/budget-derivation.js +221 -74
  3. package/dist/commands/archive.js +67 -28
  4. package/dist/commands/burnup.js +20 -11
  5. package/dist/commands/diagnose.js +34 -22
  6. package/dist/commands/evaluate.js +41 -15
  7. package/dist/commands/gates.js +149 -0
  8. package/dist/commands/init.js +150 -19
  9. package/dist/commands/iterate.js +81 -4
  10. package/dist/commands/parallel.js +4 -0
  11. package/dist/commands/plan.js +9 -19
  12. package/dist/commands/provenance.js +53 -17
  13. package/dist/commands/quality-monitor.js +64 -45
  14. package/dist/commands/scope.js +264 -0
  15. package/dist/commands/sidecar.js +74 -0
  16. package/dist/commands/specs.js +381 -45
  17. package/dist/commands/status.js +117 -9
  18. package/dist/commands/templates.js +0 -8
  19. package/dist/commands/tutorial.js +10 -9
  20. package/dist/commands/validate.js +70 -6
  21. package/dist/commands/verify-acs.js +48 -76
  22. package/dist/commands/waivers.js +212 -13
  23. package/dist/commands/worktree.js +131 -26
  24. package/dist/error-handler.js +2 -13
  25. package/dist/gates/budget-limit.js +121 -0
  26. package/dist/gates/feedback.js +260 -0
  27. package/dist/gates/format.js +179 -0
  28. package/dist/gates/god-object.js +117 -0
  29. package/dist/gates/pipeline.js +167 -0
  30. package/dist/gates/scope-boundary.js +93 -0
  31. package/dist/gates/spec-completeness.js +109 -0
  32. package/dist/gates/todo-detection.js +205 -0
  33. package/dist/index.js +157 -151
  34. package/dist/parallel/parallel-manager.js +3 -3
  35. package/dist/policy/PolicyManager.js +51 -17
  36. package/dist/scaffold/claude-hooks.js +24 -1
  37. package/dist/scaffold/git-hooks.js +45 -102
  38. package/dist/scaffold/index.js +4 -3
  39. package/dist/session/session-manager.js +105 -14
  40. package/dist/sidecars/index.js +33 -0
  41. package/dist/sidecars/listeners.js +40 -0
  42. package/dist/sidecars/provenance-summary.js +238 -0
  43. package/dist/sidecars/quality-gaps.js +258 -0
  44. package/dist/sidecars/schema.js +149 -0
  45. package/dist/sidecars/spec-drift.js +151 -0
  46. package/dist/sidecars/waiver-draft.js +176 -0
  47. package/dist/templates/.caws/schemas/policy.schema.json +112 -0
  48. package/dist/templates/.caws/schemas/scope.schema.json +3 -3
  49. package/dist/templates/.caws/schemas/waivers.schema.json +96 -20
  50. package/dist/templates/.caws/schemas/working-spec.schema.json +264 -57
  51. package/dist/templates/.caws/schemas/worktrees.schema.json +3 -1
  52. package/dist/templates/.caws/templates/working-spec.template.yml +10 -4
  53. package/dist/templates/.caws/tools/scope-guard.js +66 -15
  54. package/dist/templates/.claude/README.md +1 -1
  55. package/dist/templates/.claude/hooks/audit.sh +0 -0
  56. package/dist/templates/.claude/hooks/block-dangerous.sh +52 -11
  57. package/dist/templates/.claude/hooks/classify_command.py +592 -0
  58. package/dist/templates/.claude/hooks/doc-frontmatter-check.sh +173 -0
  59. package/dist/templates/.claude/hooks/protected-paths.sh +39 -0
  60. package/dist/templates/.claude/hooks/quality-check.sh +23 -10
  61. package/dist/templates/.claude/hooks/scope-guard.sh +136 -55
  62. package/dist/templates/.claude/hooks/session-caws-status.sh +2 -2
  63. package/dist/templates/.claude/hooks/session-log.sh +76 -3
  64. package/dist/templates/.claude/hooks/stop-worktree-check.sh +1 -1
  65. package/dist/templates/.claude/hooks/test_classify_command.py +370 -0
  66. package/dist/templates/.claude/hooks/test_wrapper_smoke.sh +96 -0
  67. package/dist/templates/.claude/hooks/worktree-guard.sh +2 -2
  68. package/dist/templates/.claude/hooks/worktree-write-guard.sh +97 -4
  69. package/dist/templates/.claude/settings.json +31 -0
  70. package/dist/templates/.cursor/hooks/caws-quality-check.sh +4 -4
  71. package/dist/templates/.cursor/hooks/caws-scope-guard.sh +1 -1
  72. package/dist/templates/.cursor/hooks/session-log.sh +924 -0
  73. package/dist/templates/.cursor/hooks.json +25 -0
  74. package/dist/templates/.cursor/rules/02-quality-gates.mdc +3 -5
  75. package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +6 -11
  76. package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +14 -18
  77. package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +4 -4
  78. package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +3 -13
  79. package/dist/templates/.github/copilot-instructions.md +5 -5
  80. package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +1 -1
  81. package/dist/templates/.junie/guidelines.md +2 -2
  82. package/dist/templates/.vscode/settings.json +3 -1
  83. package/dist/templates/.windsurf/rules/caws-quality-standards.md +2 -2
  84. package/dist/templates/.windsurf/workflows/caws-guided-development.md +3 -3
  85. package/dist/templates/CLAUDE.md +77 -8
  86. package/dist/templates/agents.md +50 -9
  87. package/dist/templates/docs/README.md +8 -7
  88. package/dist/templates/scripts/new_feature.sh +80 -0
  89. package/dist/test-analysis.js +43 -30
  90. package/dist/tool-loader.js +1 -1
  91. package/dist/utils/agent-session.js +202 -0
  92. package/dist/utils/detection.js +8 -2
  93. package/dist/utils/event-log.js +584 -0
  94. package/dist/utils/event-renderer.js +521 -0
  95. package/dist/utils/finalization.js +7 -6
  96. package/dist/utils/gitignore-updater.js +3 -0
  97. package/dist/utils/lifecycle-events.js +94 -0
  98. package/dist/utils/quality-gates-utils.js +29 -44
  99. package/dist/utils/schema-validator.js +50 -0
  100. package/dist/utils/spec-resolver.js +93 -21
  101. package/dist/utils/working-state.js +530 -0
  102. package/dist/validation/spec-validation.js +191 -31
  103. package/dist/waivers-manager.js +144 -6
  104. package/dist/worktree/worktree-manager.js +598 -95
  105. package/package.json +9 -8
  106. package/templates/.caws/schemas/policy.schema.json +112 -0
  107. package/templates/.caws/schemas/scope.schema.json +3 -3
  108. package/templates/.caws/schemas/waivers.schema.json +96 -20
  109. package/templates/.caws/schemas/working-spec.schema.json +264 -57
  110. package/templates/.caws/schemas/worktrees.schema.json +3 -1
  111. package/templates/.caws/templates/working-spec.template.yml +10 -4
  112. package/templates/.caws/tools/scope-guard.js +66 -15
  113. package/templates/.claude/README.md +1 -1
  114. package/templates/.claude/hooks/block-dangerous.sh +52 -11
  115. package/templates/.claude/hooks/classify_command.py +592 -0
  116. package/templates/.claude/hooks/doc-frontmatter-check.sh +173 -0
  117. package/templates/.claude/hooks/protected-paths.sh +39 -0
  118. package/templates/.claude/hooks/quality-check.sh +23 -10
  119. package/templates/.claude/hooks/scope-guard.sh +136 -55
  120. package/templates/.claude/hooks/session-caws-status.sh +2 -2
  121. package/templates/.claude/hooks/session-log.sh +76 -3
  122. package/templates/.claude/hooks/stop-worktree-check.sh +1 -1
  123. package/templates/.claude/hooks/test_classify_command.py +370 -0
  124. package/templates/.claude/hooks/test_wrapper_smoke.sh +96 -0
  125. package/templates/.claude/hooks/worktree-guard.sh +2 -2
  126. package/templates/.claude/hooks/worktree-write-guard.sh +97 -4
  127. package/templates/.claude/settings.json +31 -0
  128. package/templates/.cursor/hooks/caws-quality-check.sh +4 -4
  129. package/templates/.cursor/hooks/caws-scope-guard.sh +1 -1
  130. package/templates/.cursor/hooks/session-log.sh +924 -0
  131. package/templates/.cursor/hooks.json +25 -0
  132. package/templates/.cursor/rules/02-quality-gates.mdc +3 -5
  133. package/templates/.cursor/rules/10-documentation-quality-standards.mdc +6 -11
  134. package/templates/.cursor/rules/11-scope-management-waivers.mdc +14 -18
  135. package/templates/.cursor/rules/12-implementation-completeness.mdc +4 -4
  136. package/templates/.cursor/rules/13-language-agnostic-standards.mdc +3 -13
  137. package/templates/.github/copilot-instructions.md +5 -5
  138. package/templates/.idea/runConfigurations/CAWS_Evaluate.xml +1 -1
  139. package/templates/.junie/guidelines.md +2 -2
  140. package/templates/.vscode/settings.json +3 -1
  141. package/templates/.windsurf/rules/caws-quality-standards.md +2 -2
  142. package/templates/.windsurf/workflows/caws-guided-development.md +3 -3
  143. package/templates/CLAUDE.md +77 -8
  144. package/templates/{AGENTS.md → agents.md} +50 -9
  145. package/templates/docs/README.md +8 -7
  146. package/templates/scripts/new_feature.sh +80 -0
  147. package/dist/budget-derivation.d.ts +0 -74
  148. package/dist/budget-derivation.d.ts.map +0 -1
  149. package/dist/cicd-optimizer.d.ts +0 -142
  150. package/dist/cicd-optimizer.d.ts.map +0 -1
  151. package/dist/commands/archive.d.ts +0 -51
  152. package/dist/commands/archive.d.ts.map +0 -1
  153. package/dist/commands/burnup.d.ts +0 -6
  154. package/dist/commands/burnup.d.ts.map +0 -1
  155. package/dist/commands/diagnose.d.ts +0 -52
  156. package/dist/commands/diagnose.d.ts.map +0 -1
  157. package/dist/commands/evaluate.d.ts +0 -8
  158. package/dist/commands/evaluate.d.ts.map +0 -1
  159. package/dist/commands/init.d.ts +0 -5
  160. package/dist/commands/init.d.ts.map +0 -1
  161. package/dist/commands/iterate.d.ts +0 -8
  162. package/dist/commands/iterate.d.ts.map +0 -1
  163. package/dist/commands/mode.d.ts +0 -25
  164. package/dist/commands/mode.d.ts.map +0 -1
  165. package/dist/commands/parallel.d.ts +0 -7
  166. package/dist/commands/parallel.d.ts.map +0 -1
  167. package/dist/commands/plan.d.ts +0 -49
  168. package/dist/commands/plan.d.ts.map +0 -1
  169. package/dist/commands/provenance.d.ts +0 -32
  170. package/dist/commands/provenance.d.ts.map +0 -1
  171. package/dist/commands/quality-gates.d.ts +0 -6
  172. package/dist/commands/quality-gates.d.ts.map +0 -1
  173. package/dist/commands/quality-gates.js +0 -444
  174. package/dist/commands/quality-monitor.d.ts +0 -17
  175. package/dist/commands/quality-monitor.d.ts.map +0 -1
  176. package/dist/commands/session.d.ts +0 -7
  177. package/dist/commands/session.d.ts.map +0 -1
  178. package/dist/commands/specs.d.ts +0 -77
  179. package/dist/commands/specs.d.ts.map +0 -1
  180. package/dist/commands/status.d.ts +0 -44
  181. package/dist/commands/status.d.ts.map +0 -1
  182. package/dist/commands/templates.d.ts +0 -74
  183. package/dist/commands/templates.d.ts.map +0 -1
  184. package/dist/commands/tool.d.ts +0 -13
  185. package/dist/commands/tool.d.ts.map +0 -1
  186. package/dist/commands/troubleshoot.d.ts +0 -8
  187. package/dist/commands/troubleshoot.d.ts.map +0 -1
  188. package/dist/commands/troubleshoot.js +0 -104
  189. package/dist/commands/tutorial.d.ts +0 -55
  190. package/dist/commands/tutorial.d.ts.map +0 -1
  191. package/dist/commands/validate.d.ts +0 -15
  192. package/dist/commands/validate.d.ts.map +0 -1
  193. package/dist/commands/waivers.d.ts +0 -8
  194. package/dist/commands/waivers.d.ts.map +0 -1
  195. package/dist/commands/workflow.d.ts +0 -85
  196. package/dist/commands/workflow.d.ts.map +0 -1
  197. package/dist/commands/worktree.d.ts +0 -7
  198. package/dist/commands/worktree.d.ts.map +0 -1
  199. package/dist/config/index.d.ts +0 -29
  200. package/dist/config/index.d.ts.map +0 -1
  201. package/dist/config/lite-scope.d.ts +0 -33
  202. package/dist/config/lite-scope.d.ts.map +0 -1
  203. package/dist/config/modes.d.ts +0 -264
  204. package/dist/config/modes.d.ts.map +0 -1
  205. package/dist/constants/spec-types.d.ts +0 -93
  206. package/dist/constants/spec-types.d.ts.map +0 -1
  207. package/dist/error-handler.d.ts +0 -151
  208. package/dist/error-handler.d.ts.map +0 -1
  209. package/dist/generators/jest-config-generator.d.ts +0 -32
  210. package/dist/generators/jest-config-generator.d.ts.map +0 -1
  211. package/dist/generators/jest-config.d.ts +0 -32
  212. package/dist/generators/jest-config.d.ts.map +0 -1
  213. package/dist/generators/jest-config.js +0 -242
  214. package/dist/generators/working-spec.d.ts +0 -13
  215. package/dist/generators/working-spec.d.ts.map +0 -1
  216. package/dist/index-new.d.ts +0 -5
  217. package/dist/index-new.d.ts.map +0 -1
  218. package/dist/index-new.js +0 -317
  219. package/dist/index.d.ts +0 -5
  220. package/dist/index.d.ts.map +0 -1
  221. package/dist/index.js.backup +0 -4711
  222. package/dist/minimal-cli.d.ts +0 -3
  223. package/dist/minimal-cli.d.ts.map +0 -1
  224. package/dist/parallel/parallel-manager.d.ts +0 -67
  225. package/dist/parallel/parallel-manager.d.ts.map +0 -1
  226. package/dist/policy/PolicyManager.d.ts +0 -104
  227. package/dist/policy/PolicyManager.d.ts.map +0 -1
  228. package/dist/scaffold/claude-hooks.d.ts +0 -28
  229. package/dist/scaffold/claude-hooks.d.ts.map +0 -1
  230. package/dist/scaffold/cursor-hooks.d.ts +0 -7
  231. package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
  232. package/dist/scaffold/git-hooks.d.ts +0 -38
  233. package/dist/scaffold/git-hooks.d.ts.map +0 -1
  234. package/dist/scaffold/index.d.ts +0 -17
  235. package/dist/scaffold/index.d.ts.map +0 -1
  236. package/dist/session/session-manager.d.ts +0 -94
  237. package/dist/session/session-manager.d.ts.map +0 -1
  238. package/dist/spec/SpecFileManager.d.ts +0 -146
  239. package/dist/spec/SpecFileManager.d.ts.map +0 -1
  240. package/dist/templates/.cursor/hooks/caws-tool-validation.sh +0 -121
  241. package/dist/templates/.github/copilot/instructions.md +0 -311
  242. package/dist/test-analysis.d.ts +0 -231
  243. package/dist/test-analysis.d.ts.map +0 -1
  244. package/dist/tool-interface.d.ts +0 -236
  245. package/dist/tool-interface.d.ts.map +0 -1
  246. package/dist/tool-loader.d.ts +0 -77
  247. package/dist/tool-loader.d.ts.map +0 -1
  248. package/dist/tool-validator.d.ts +0 -72
  249. package/dist/tool-validator.d.ts.map +0 -1
  250. package/dist/utils/async-utils.d.ts +0 -73
  251. package/dist/utils/async-utils.d.ts.map +0 -1
  252. package/dist/utils/command-wrapper.d.ts +0 -66
  253. package/dist/utils/command-wrapper.d.ts.map +0 -1
  254. package/dist/utils/detection.d.ts +0 -14
  255. package/dist/utils/detection.d.ts.map +0 -1
  256. package/dist/utils/error-categories.d.ts +0 -52
  257. package/dist/utils/error-categories.d.ts.map +0 -1
  258. package/dist/utils/finalization.d.ts +0 -17
  259. package/dist/utils/finalization.d.ts.map +0 -1
  260. package/dist/utils/git-lock.d.ts +0 -13
  261. package/dist/utils/git-lock.d.ts.map +0 -1
  262. package/dist/utils/gitignore-updater.d.ts +0 -39
  263. package/dist/utils/gitignore-updater.d.ts.map +0 -1
  264. package/dist/utils/ide-detection.d.ts +0 -89
  265. package/dist/utils/ide-detection.d.ts.map +0 -1
  266. package/dist/utils/project-analysis.d.ts +0 -34
  267. package/dist/utils/project-analysis.d.ts.map +0 -1
  268. package/dist/utils/promise-utils.d.ts +0 -30
  269. package/dist/utils/promise-utils.d.ts.map +0 -1
  270. package/dist/utils/quality-gates-utils.d.ts +0 -49
  271. package/dist/utils/quality-gates-utils.d.ts.map +0 -1
  272. package/dist/utils/quality-gates.d.ts +0 -49
  273. package/dist/utils/quality-gates.d.ts.map +0 -1
  274. package/dist/utils/quality-gates.js +0 -402
  275. package/dist/utils/spec-resolver.d.ts +0 -80
  276. package/dist/utils/spec-resolver.d.ts.map +0 -1
  277. package/dist/utils/typescript-detector.d.ts +0 -66
  278. package/dist/utils/typescript-detector.d.ts.map +0 -1
  279. package/dist/utils/yaml-validation.d.ts +0 -32
  280. package/dist/utils/yaml-validation.d.ts.map +0 -1
  281. package/dist/validation/spec-validation.d.ts +0 -43
  282. package/dist/validation/spec-validation.d.ts.map +0 -1
  283. package/dist/waivers-manager.d.ts +0 -167
  284. package/dist/waivers-manager.d.ts.map +0 -1
  285. package/dist/worktree/worktree-manager.d.ts +0 -54
  286. package/dist/worktree/worktree-manager.d.ts.map +0 -1
@@ -5,6 +5,9 @@
5
5
  {
6
6
  "command": "./.cursor/hooks/block-dangerous.sh"
7
7
  },
8
+ {
9
+ "command": "./.cursor/hooks/session-log.sh"
10
+ },
8
11
  {
9
12
  "command": "./.cursor/hooks/audit.sh"
10
13
  }
@@ -15,6 +18,9 @@
15
18
  },
16
19
  {
17
20
  "command": "./.cursor/hooks/caws-scope-guard.sh"
21
+ },
22
+ {
23
+ "command": "./.cursor/hooks/session-log.sh"
18
24
  }
19
25
  ],
20
26
  "afterFileEdit": [
@@ -30,6 +36,9 @@
30
36
  {
31
37
  "command": "./.cursor/hooks/caws-quality-check.sh"
32
38
  },
39
+ {
40
+ "command": "./.cursor/hooks/session-log.sh"
41
+ },
33
42
  {
34
43
  "command": "./.cursor/hooks/audit.sh"
35
44
  }
@@ -38,11 +47,27 @@
38
47
  {
39
48
  "command": "./.cursor/hooks/caws-scope-guard.sh"
40
49
  },
50
+ {
51
+ "command": "./.cursor/hooks/session-log.sh"
52
+ },
41
53
  {
42
54
  "command": "./.cursor/hooks/audit.sh"
43
55
  }
44
56
  ],
57
+ "afterAgentResponse": [
58
+ {
59
+ "command": "./.cursor/hooks/session-log.sh"
60
+ }
61
+ ],
62
+ "afterAgentThought": [
63
+ {
64
+ "command": "./.cursor/hooks/session-log.sh"
65
+ }
66
+ ],
45
67
  "stop": [
68
+ {
69
+ "command": "./.cursor/hooks/session-log.sh"
70
+ },
46
71
  {
47
72
  "command": "./.cursor/hooks/audit.sh"
48
73
  }
@@ -342,12 +342,10 @@ Tag placeholders explicitly in code:
342
342
  # Run comprehensive test suite
343
343
  caws quality-gates --test-coverage --mutation-testing
344
344
 
345
- # Check test quality metrics
346
- caws metrics track --metric="test_coverage" --value=85
347
- caws metrics track --metric="mutation_score" --value=70
345
+ # Metrics are tracked automatically via working state
348
346
 
349
- # Update progress with test completion
350
- caws progress update --criterion-id="TEST-001" --status="completed" --tests-passing=25
347
+ # Verify acceptance criteria for test completion
348
+ caws verify-acs --spec-id <id>
351
349
  ```
352
350
 
353
351
  ### Test Analysis
@@ -337,11 +337,10 @@ caws validate --check-documentation-quality
337
337
  # Generate documentation quality report
338
338
  caws docs quality-report --include-marketing-check --include-status-verification
339
339
 
340
- # Track documentation quality metrics
341
- caws metrics track --metric="documentation_quality_score" --value=95
340
+ # Metrics are tracked automatically via working state
342
341
 
343
- # Update progress with documentation quality
344
- caws progress update --criterion-id="DOCS-001" --status="completed"
342
+ # Verify acceptance criteria for documentation quality
343
+ caws verify-acs --spec-id <id>
345
344
  ```
346
345
 
347
346
  ## Continuous Improvement
@@ -377,14 +376,10 @@ caws progress update --criterion-id="DOCS-001" --status="completed"
377
376
  ### CAWS Integration Points
378
377
 
379
378
  ```bash
380
- # Track documentation quality trends
381
- caws metrics trends --metric="documentation_quality_score" --period="30d"
379
+ # Metrics are tracked automatically via working state
382
380
 
383
- # Export documentation quality metrics
384
- caws metrics export --format=json --include-documentation-quality
385
-
386
- # Archive documentation with quality verification
387
- caws archive DOCS-001 --verify-documentation-quality
381
+ # Archive documentation
382
+ caws archive DOCS-001
388
383
  ```
389
384
 
390
385
  This rule ensures documentation maintains engineering-grade quality and prevents the accumulation of problematic content that requires manual cleanup, fully integrated with CAWS workflow and quality gates.
@@ -246,7 +246,7 @@ check-change-budget() {
246
246
  # GitHub Actions example
247
247
  - name: Check Scope Compliance
248
248
  run: |
249
- if ! caws validate --scope-check; then
249
+ if ! caws gates run; then
250
250
  echo "❌ Scope violation detected"
251
251
  exit 1
252
252
  fi
@@ -317,11 +317,8 @@ risk_tier: 'T2' # T1, T2, or T3
317
317
  ### CAWS Commands
318
318
 
319
319
  ```bash
320
- # Validate scope compliance
321
- caws validate --scope-check
322
-
323
- # Check change budget
324
- caws validate --budget-check
320
+ # Run quality gates (includes scope and budget checks)
321
+ caws gates run
325
322
 
326
323
  # Create emergency waiver
327
324
  caws waivers create \
@@ -343,14 +340,14 @@ caws waivers status --waiver-id="AUTH-FIX-001"
343
340
  ### Quality Gate Integration
344
341
 
345
342
  ```bash
346
- # Run quality gates with tier-specific requirements
347
- caws quality-gates --tier=T2
343
+ # Run quality gates (tier is determined from spec)
344
+ caws gates run
348
345
 
349
- # Check if waiver is required
350
- caws quality-gates --check-waiver-required
346
+ # List active waivers
347
+ caws waivers list
351
348
 
352
- # Apply waiver to quality gates
353
- caws quality-gates --apply-waiver=AUTH-FIX-001
349
+ # Create a waiver for quality gates
350
+ caws waivers create
354
351
  ```
355
352
 
356
353
  ## Continuous Improvement
@@ -372,14 +369,13 @@ caws quality-gates --apply-waiver=AUTH-FIX-001
372
369
  ### CAWS Integration Points
373
370
 
374
371
  ```bash
375
- # Track scope compliance in CAWS metrics
376
- caws metrics track --metric="scope_violations" --value=0
372
+ # Metrics are tracked automatically via working state
377
373
 
378
- # Update progress with scope compliance
379
- caws progress update --criterion-id="SCOPE-001" --status="completed"
374
+ # Verify acceptance criteria for scope compliance
375
+ caws verify-acs --spec-id <id>
380
376
 
381
- # Archive changes with scope compliance verification
382
- caws archive FEAT-001 --verify-scope-compliance
377
+ # Archive changes
378
+ caws archive FEAT-001
383
379
  ```
384
380
 
385
381
  This rule ensures proper scope management while providing structured escape hatches for critical situations that require immediate attention, fully integrated with CAWS workflow and quality gates.
@@ -484,11 +484,11 @@ def calculate_completeness_score(analysis_results):
484
484
  ### CAWS Quality Monitoring
485
485
 
486
486
  ```bash
487
- # Use CAWS quality monitoring
488
- caws quality-monitor --action=code_edited --files="$(git diff --name-only)"
487
+ # Run quality gates after code changes
488
+ caws gates run
489
489
 
490
- # Track TODO resolution progress
491
- caws progress-update --criterion-id="TODO-001" --status="completed" --tests-passing=1
490
+ # Verify acceptance criteria for TODO resolution
491
+ caws verify-acs --spec-id <id>
492
492
  ```
493
493
 
494
494
  ### Continuous Improvement
@@ -485,24 +485,14 @@ caws quality-gates --check-universal-standards
485
485
  ### Metrics Tracking
486
486
 
487
487
  ```bash
488
- # Track complexity metrics
489
- caws metrics track --metric="cyclomatic_complexity" --value=8
490
-
491
- # Track maintainability metrics
492
- caws metrics track --metric="function_size" --value=25
493
-
494
- # Track architectural compliance
495
- caws metrics track --metric="dependency_injection" --value=1
488
+ # Metrics are tracked automatically via working state
496
489
  ```
497
490
 
498
491
  ### Progress Tracking
499
492
 
500
493
  ```bash
501
- # Update progress with complexity compliance
502
- caws progress update --criterion-id="COMPLEXITY-001" --status="completed"
503
-
504
- # Track architectural pattern implementation
505
- caws progress update --criterion-id="ARCHITECTURE-001" --status="in_progress"
494
+ # Verify acceptance criteria for complexity compliance
495
+ caws verify-acs --spec-id <id>
506
496
  ```
507
497
 
508
498
  ## Enforcement Mechanisms
@@ -30,9 +30,9 @@ Always validate working specs: `caws validate`
30
30
 
31
31
  ## Quality Workflow
32
32
 
33
- 1. **Before implementation**: `caws agent iterate --current-state "describe what you're about to do"`
34
- 2. **During implementation**: `caws agent evaluate --quiet`
35
- 3. **Before commit**: `caws validate && caws agent evaluate`
33
+ 1. **Before implementation**: `caws iterate --current-state "describe what you're about to do"`
34
+ 2. **During implementation**: `caws evaluate --quiet`
35
+ 3. **Before commit**: `caws validate && caws evaluate`
36
36
 
37
37
  ## Quality Gates by Risk Tier
38
38
 
@@ -65,8 +65,8 @@ Valid reasons: `emergency_hotfix`, `legacy_integration`, `experimental_feature`,
65
65
 
66
66
  ### Feature Development
67
67
  1. Validate working spec: `caws validate`
68
- 2. Get implementation guidance: `caws agent iterate`
69
- 3. Implement with quality checks: `caws agent evaluate --quiet`
68
+ 2. Get implementation guidance: `caws iterate`
69
+ 3. Implement with quality checks: `caws evaluate --quiet`
70
70
  4. Run full validation: `caws validate && npm test`
71
71
 
72
72
  ### Bug Fixes
@@ -1,5 +1,5 @@
1
1
  <component name="ProjectRunConfigurationManager">
2
- <configuration default="false" name="CAWS: Evaluate Quality" type="NodeJSConfigurationType" factoryName="Node.js" path-to-js-file="$PROJECT_DIR$/packages/caws-cli/dist/index.js" working-dir="$PROJECT_DIR$" application-parameters="agent evaluate .caws/working-spec.yaml">
2
+ <configuration default="false" name="CAWS: Evaluate Quality" type="NodeJSConfigurationType" factoryName="Node.js" path-to-js-file="$PROJECT_DIR$/packages/caws-cli/dist/index.js" working-dir="$PROJECT_DIR$" application-parameters="evaluate">
3
3
  <method v="2" />
4
4
  </configuration>
5
5
  </component>
@@ -15,8 +15,8 @@ Before making changes, read `.caws/working-spec.yaml`. It defines:
15
15
 
16
16
  ```bash
17
17
  caws validate # Validate the working spec
18
- caws agent iterate # Get implementation guidance
19
- caws agent evaluate # Evaluate quality compliance
18
+ caws iterate # Get implementation guidance
19
+ caws evaluate # Evaluate quality compliance
20
20
  caws waivers create --reason ... # Create waiver for justified exceptions
21
21
  ```
22
22
 
@@ -22,12 +22,14 @@
22
22
  // Exclude CAWS-generated files from search and navigation
23
23
  "files.exclude": {
24
24
  ".caws/cache/": true,
25
+ ".caws/state/": true,
25
26
  ".caws/waivers/review-*.md": true
26
27
  },
27
28
 
28
29
  // Search excludes for CAWS artifacts
29
30
  "search.exclude": {
30
31
  ".caws/cache/**": true,
32
+ ".caws/state/**": true,
31
33
  "packages/*/dist/**": true,
32
34
  "packages/*/node_modules/**": true
33
35
  },
@@ -57,7 +59,7 @@
57
59
  "label": "CAWS: Evaluate Quality",
58
60
  "type": "shell",
59
61
  "command": "caws",
60
- "args": ["agent", "evaluate", ".caws/working-spec.yaml"],
62
+ "args": ["evaluate"],
61
63
  "group": "test",
62
64
  "presentation": {
63
65
  "echo": true,
@@ -29,8 +29,8 @@ Always check `.caws/working-spec.yaml` before making changes. It defines:
29
29
 
30
30
  ```bash
31
31
  caws validate # Validate working spec
32
- caws agent iterate # Get implementation guidance
33
- caws agent evaluate # Evaluate quality compliance
32
+ caws iterate # Get implementation guidance
33
+ caws evaluate # Evaluate quality compliance
34
34
  caws waivers create --reason ... # Create waiver for justified exceptions
35
35
  ```
36
36
 
@@ -20,7 +20,7 @@ caws init feature-name --interactive
20
20
  ### 2. Plan Implementation Strategy
21
21
  ```
22
22
  # Get CAWS guidance for implementation approach
23
- caws agent iterate --current-state "Planning phase complete, need implementation strategy"
23
+ caws iterate --current-state "Planning phase complete, need implementation strategy"
24
24
 
25
25
  # CAWS will suggest:
26
26
  # - Implementation steps
@@ -35,7 +35,7 @@ caws agent iterate --current-state "Planning phase complete, need implementation
35
35
  # Real-time feedback via CAWS tools
36
36
 
37
37
  # Regular quality checks
38
- caws agent evaluate --quiet
38
+ caws evaluate --quiet
39
39
  ```
40
40
 
41
41
  ### 4. Quality Assurance Integration
@@ -63,7 +63,7 @@ npm run test:contract
63
63
  ### 6. Final Quality Review
64
64
  ```
65
65
  # Complete CAWS evaluation
66
- caws agent evaluate
66
+ caws evaluate
67
67
 
68
68
  # Generate provenance report
69
69
  caws provenance generate
@@ -23,30 +23,93 @@ caws validate
23
23
 
24
24
  ## CAWS Workflow
25
25
 
26
- Before writing code, check the working spec:
26
+ Before writing code, check the canonical spec for the current feature:
27
27
 
28
28
  ```bash
29
- # Validate the working spec
30
- caws validate
29
+ # Create a feature spec for isolated work
30
+ caws specs create FEAT-001 --type feature --title "description"
31
+
32
+ # If you're in a CAWS worktree, the created spec should record it:
33
+ # worktree: <worktree-name>
34
+
35
+ # Validate the feature spec
36
+ caws validate --spec-id FEAT-001
37
+
38
+ # Run quality gates v2 pipeline
39
+ caws gates run
31
40
 
32
41
  # Get iteration guidance
33
- caws agent iterate --current-state "describe what you're about to do"
42
+ caws iterate --current-state "describe what you're about to do"
34
43
 
35
44
  # After implementation, evaluate quality
36
- caws agent evaluate
45
+ caws evaluate
46
+
47
+ # Verify acceptance criteria have evidence
48
+ caws verify-acs --spec-id FEAT-001
49
+
50
+ # Check budget burn-up
51
+ caws burnup --spec-id FEAT-001
52
+
53
+ # Check status for the same feature
54
+ caws status --spec-id FEAT-001
55
+ ```
56
+
57
+ ### Advisory Sidecars
58
+
59
+ Sidecar commands are diagnostic analysis tools. They don't enforce anything -- they help you understand what's happening and what to do next.
60
+
61
+ ```bash
62
+ caws sidecar drift # Compare spec intent vs current implementation
63
+ caws sidecar gaps # Diagnose quality gaps blocking gate passage
64
+ caws sidecar waiver-draft # Generate pre-filled waiver template for a failing gate
65
+ caws sidecar provenance # Summarize work history for merge readiness review
37
66
  ```
38
67
 
39
68
  ### Working Spec
40
69
 
41
- The project spec lives at `.caws/working-spec.yaml`. Feature specs live at `.caws/specs/<ID>.yaml`. It defines:
70
+ Canonical feature specs live at `.caws/specs/<ID>.yaml` (create with `caws specs create <id> --type feature --title "description"`). `.caws/working-spec.yaml` is a compatibility mirror for older tooling and legacy single-spec flows. The active spec defines:
42
71
 
43
72
  - **Risk tier**: Quality requirements (T1: critical, T2: standard, T3: low risk)
73
+ - **Mode**: The type of change (`feature`, `refactor`, `fix`, `doc`, `chore`) -- required
74
+ - **Worktree**: The owning CAWS worktree name for this spec (`worktree`) -- recommended for all isolated work
75
+ - **Blast radius**: Which modules are affected (`blast_radius.modules`) -- required
76
+ - **Operational rollback SLO**: Time target for rollback (e.g. `"30m"`) -- required
44
77
  - **Scope**: Which files you can edit (`scope.in`) and which are off-limits (`scope.out`)
45
78
  - **Change budget**: Max files and lines of code per change (see note below)
46
- - **Acceptance criteria**: What "done" means IDs must match `^A\d+$` (e.g. `A1`, `A12`)
79
+ - **Acceptance criteria**: What "done" means -- IDs must match `^A\d+$` (e.g. `A1`, `A12`)
47
80
 
48
81
  Always stay within scope boundaries and change budgets.
49
82
 
83
+ Recommended operating rule: one active feature spec, one active worktree. If a task has a worktree, record that ownership in the spec YAML with `worktree: <name>`.
84
+
85
+ ### Scope and Worktree Binding
86
+
87
+ The scope guard enforces file edit boundaries based on your spec's `scope.in` and `scope.out` patterns. **How it enforces depends on whether your worktree is bound to a spec:**
88
+
89
+ - **Authoritative mode** (worktree bound to a spec): Only your spec's scope patterns are checked. Other agents' specs cannot block your edits. This is the correct state.
90
+ - **Union mode** (no binding): The guard checks ALL active specs. Any `scope.out` from any spec can block you, even unrelated ones. This is the common source of "why is spec X blocking me?" confusion.
91
+
92
+ **The mutual binding** requires both sides:
93
+ 1. The worktree registry (`.caws/worktrees.json`) must have `specId` pointing to your spec
94
+ 2. Your spec (`.caws/specs/<id>.yaml`) must have `worktree: <name>` pointing to your worktree
95
+
96
+ If either side is missing, the guard falls back to union mode.
97
+
98
+ **Quick commands:**
99
+ ```bash
100
+ # See your effective scope and binding health
101
+ caws scope show
102
+
103
+ # Fix a broken binding
104
+ caws worktree bind <spec-id>
105
+ ```
106
+
107
+ **Recovery checklist** (when the scope guard blocks you unexpectedly):
108
+ 1. Run `caws scope show` — check if you're in authoritative or union mode
109
+ 2. If union mode: bind your spec with `caws worktree bind <spec-id>`
110
+ 3. If authoritative but still blocked: the file is genuinely outside your spec's scope. Update your spec's `scope.in` if the file should be in scope, or request a waiver
111
+ 4. Do NOT modify another spec's `scope.out` to unblock yourself — that defeats the isolation
112
+
50
113
  > **Budget note**: `change_budget:` in a spec is informational documentation only. CAWS
51
114
  > derives the enforced budget from `policy.yaml` keyed on `risk_tier`. The field in the
52
115
  > spec is not used by `caws validate` for enforcement.
@@ -89,11 +152,17 @@ Valid reasons: `emergency_hotfix`, `legacy_integration`, `experimental_feature`,
89
152
 
90
153
  ```
91
154
  .caws/
92
- working-spec.yaml # Project spec (risk tier, scope, acceptance criteria)
155
+ working-spec.yaml # Compatibility mirror for legacy commands
156
+ specs/ # Canonical feature specs
93
157
  policy.yaml # Quality policy overrides (optional)
94
158
  waivers.yml # Active waivers
159
+ state/ # Runtime working state (auto-managed)
95
160
  ```
96
161
 
162
+ > **Working state**: `.caws/state/<spec-id>.json` tracks runtime progress -- current phase,
163
+ > validation/evaluation results, gate history, and files touched. This is maintained
164
+ > automatically by CAWS commands. Agents don't need to manage it directly.
165
+
97
166
  ## Hooks
98
167
 
99
168
  This project has Claude Code hooks configured in `.claude/settings.json`:
@@ -9,27 +9,56 @@ npm install # Install dependencies
9
9
  npm test # Run tests
10
10
  npm run lint # Lint code
11
11
  npm run typecheck # Type check (if TypeScript)
12
- caws validate # Validate CAWS working spec
12
+ caws validate # Validate the current CAWS spec
13
13
  ```
14
14
 
15
15
  ## Project Structure
16
16
 
17
17
  ```
18
18
  .caws/
19
- working-spec.yaml # Project spec (risk tier, scope, acceptance criteria)
19
+ working-spec.yaml # Compatibility mirror for legacy paths
20
+ specs/ # Canonical feature specs
20
21
  policy.yaml # Quality policy overrides (optional)
21
22
  waivers.yml # Active waivers (optional)
22
23
  ```
23
24
 
24
25
  ## CAWS Workflow
25
26
 
26
- 1. **Read the working spec**: Check `.caws/working-spec.yaml` for scope, risk tier, and acceptance criteria
27
- 2. **Validate**: Run `caws validate` to ensure the spec is valid
28
- 3. **Plan**: Run `caws agent iterate` for implementation guidance
27
+ 1. **Read the canonical spec**: Use `.caws/specs/<spec-id>.yaml` when feature specs exist
28
+ 2. **Validate**: Run `caws validate --spec-id <spec-id>` for feature work
29
+ 3. **Plan**: Run `caws iterate` for implementation guidance
29
30
  4. **Implement**: Write tests first, then implementation. Stay within scope boundaries.
30
- 5. **Verify**: Run `caws agent evaluate` to check quality compliance
31
+ 5. **Verify**: Run `caws evaluate` to check quality compliance
31
32
  6. **Commit**: Use conventional commits (`feat:`, `fix:`, `refactor:`, `docs:`, `chore:`)
32
33
 
34
+ For a new feature in a multi-agent project:
35
+
36
+ ```bash
37
+ caws specs create my-feature --type feature --title "My Feature"
38
+ caws validate --spec-id my-feature
39
+ ```
40
+
41
+ ## Scope and Worktree Binding
42
+
43
+ The scope guard enforces `scope.in` and `scope.out` from your spec. How it enforces depends on binding:
44
+
45
+ - **Authoritative mode** (worktree bound to a spec): Only your spec's scope is checked. Other agents' specs cannot block you.
46
+ - **Union mode** (no binding): ALL active specs are checked. Any `scope.out` from any spec can block you.
47
+
48
+ ```bash
49
+ # See your effective scope and binding health
50
+ caws scope show
51
+
52
+ # Fix a broken binding
53
+ caws worktree bind <spec-id>
54
+ ```
55
+
56
+ **Recovery** (when blocked unexpectedly):
57
+ 1. Run `caws scope show` to check mode and binding health
58
+ 2. If union mode: `caws worktree bind <spec-id>`
59
+ 3. If authoritative but blocked: update your spec's `scope.in`
60
+ 4. Do NOT edit another spec's `scope.out` to unblock yourself
61
+
33
62
  ## Key Rules
34
63
 
35
64
  1. **Stay in scope** -- only edit files listed in `scope.in`, never touch `scope.out`
@@ -44,7 +73,7 @@ caws validate # Validate CAWS working spec
44
73
 
45
74
  ## Quality Gates
46
75
 
47
- Requirements are tiered based on the `risk_tier` in the working spec:
76
+ Requirements are tiered based on the `risk_tier` in the active spec:
48
77
 
49
78
  | Gate | T1 (Critical) | T2 (Standard) | T3 (Low Risk) |
50
79
  |------|---------------|----------------|----------------|
@@ -94,11 +123,23 @@ Valid reasons: `emergency_hotfix`, `legacy_integration`, `experimental_feature`,
94
123
 
95
124
  ## Pre-Submit Checklist
96
125
 
97
- - [ ] Working spec exists and validates (`caws validate`)
126
+ - [ ] Canonical spec exists and validates (`caws validate --spec-id <spec-id>` when applicable)
98
127
  - [ ] All tests pass (`npm test`)
99
128
  - [ ] Coverage meets tier requirements
100
129
  - [ ] Lints pass (`npm run lint`)
101
130
  - [ ] Types check (`npm run typecheck`)
102
131
  - [ ] No scope violations
103
- - [ ] Change budget not exceeded
132
+ - [ ] Change budget not exceeded (`caws burnup --spec-id <spec-id>` shows budget consumption)
133
+ - [ ] Acceptance criteria proven (`caws verify-acs --spec-id <spec-id>` checks evidence exists)
104
134
  - [ ] Conventional commit message
135
+
136
+ ### Optional: Self-Diagnosis with Sidecars
137
+
138
+ If a gate blocks you, use sidecar commands to understand why before retrying:
139
+
140
+ ```bash
141
+ caws sidecar gaps # What's missing? Which gates are failing and why?
142
+ caws sidecar drift # Has implementation drifted from the spec intent?
143
+ caws sidecar waiver-draft # Generate a pre-filled waiver if the gap is acceptable
144
+ caws sidecar provenance # Summarize work history for merge readiness
145
+ ```
@@ -14,12 +14,13 @@ This project is built with the **Coding Agent Workflow System (CAWS)** - an engi
14
14
 
15
15
  ### 1. Project Setup
16
16
  The project is already scaffolded with CAWS. Review and customize:
17
- - `.caws/working-spec.yaml` - Project specification and requirements
18
- - `.caws/policy/tier-policy.json` - Risk tier definitions
17
+ - `.caws/specs/<spec-id>.yaml` - Canonical feature specification and requirements
18
+ - `.caws/working-spec.yaml` - Compatibility mirror for legacy paths
19
+ - `.caws/policy.yaml` - Risk tier definitions
19
20
  - `.github/workflows/caws.yml` - CI/CD quality gates
20
21
 
21
22
  ### 2. Development Workflow
22
- 1. **Plan**: Update working spec with requirements and scope
23
+ 1. **Plan**: Update the active feature spec with requirements and scope
23
24
  2. **Implement**: Follow agent conduct rules and mode constraints
24
25
  3. **Verify**: Run tests and quality gates locally
25
26
  4. **Document**: Update documentation and generate provenance
@@ -111,7 +112,7 @@ The project includes automated quality gates:
111
112
 
112
113
  ### Common Issues
113
114
  1. **Trust Score Low**: Check test coverage and quality gates
114
- 2. **Scope Violations**: Ensure changes align with working spec
115
+ 2. **Scope Violations**: Ensure changes align with the active spec
115
116
  3. **Budget Exceeded**: Review change size and complexity
116
117
  4. **Flaky Tests**: Use property testing and proper mocking
117
118
 
@@ -124,14 +125,14 @@ The project includes automated quality gates:
124
125
  ## Contributing
125
126
 
126
127
  ### Development Process
127
- 1. Update working specification
128
+ 1. Update the active feature specification
128
129
  2. Create comprehensive tests
129
130
  3. Implement with quality gates
130
131
  4. Generate provenance artifacts
131
132
  5. Document changes thoroughly
132
133
 
133
134
  ### Code Review
134
- - Review against working specification
135
+ - Review against the active feature spec
135
136
  - Check trust score and quality gates
136
137
  - Validate observability and rollback
137
138
  - Ensure documentation completeness
@@ -139,7 +140,7 @@ The project includes automated quality gates:
139
140
  ## Resources
140
141
 
141
142
  - **[CAWS Framework](agents.md)**: Complete system documentation
142
- - **[Working Specification](.caws/working-spec.yaml)**: Project requirements
143
+ - **[Canonical Specs](.caws/specs/)**: Project requirements
143
144
  - **[Quality Gates](.github/workflows/caws.yml)**: CI/CD pipeline
144
145
  - **[Tools](apps/tools/caws/)**: Development utilities
145
146