cadre-ai 3.9.0 → 4.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 (234) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +213 -0
  4. package/README.md +68 -21
  5. package/dist/cadre-cli.mjs +4 -6
  6. package/dist/cadre-mcp.mjs +5397 -3973
  7. package/package.json +2 -2
  8. package/skills/archive/SKILL.md +12 -10
  9. package/skills/create/SKILL.md +9 -9
  10. package/skills/implement/SKILL.md +10 -8
  11. package/skills/implement/references/governed-mode.md +1 -1
  12. package/skills/implement/references/resume-recovery.md +2 -0
  13. package/skills/refresh/SKILL.md +25 -18
  14. package/skills/revert/SKILL.md +33 -13
  15. package/skills/review/SKILL.md +27 -34
  16. package/skills/revise/SKILL.md +21 -11
  17. package/skills/status/SKILL.md +2 -0
  18. package/skills/track/SKILL.md +11 -7
  19. package/templates/{v5 → v6}/init/workflow.md +1 -1
  20. package/templates/v1/init/gitignore.template +0 -5
  21. package/templates/v1/init/patterns/index.md +0 -6
  22. package/templates/v1/init/project.json +0 -26
  23. package/templates/v1/init/workflow.md +0 -181
  24. package/templates/v1/project/archive-operation.json +0 -15
  25. package/templates/v1/project/refresh-operation.json +0 -14
  26. package/templates/v1/track/execution.json +0 -19
  27. package/templates/v1/track/learning.md +0 -39
  28. package/templates/v1/track/plan.md +0 -39
  29. package/templates/v1/track/revert-operation.json +0 -13
  30. package/templates/v1/track/revise-operation.json +0 -14
  31. package/templates/v1/track/state.json +0 -25
  32. package/templates/v2/init/archive/.gitkeep +0 -1
  33. package/templates/v2/init/gitignore.template +0 -8
  34. package/templates/v2/init/guidelines.md +0 -25
  35. package/templates/v2/init/operations/.gitkeep +0 -1
  36. package/templates/v2/init/patterns/index.md +0 -6
  37. package/templates/v2/init/product.md +0 -30
  38. package/templates/v2/init/project.json +0 -27
  39. package/templates/v2/init/refreshes/.gitkeep +0 -1
  40. package/templates/v2/init/styleguides/general.md +0 -14
  41. package/templates/v2/init/styleguides/language.md +0 -21
  42. package/templates/v2/init/tech-stack.md +0 -21
  43. package/templates/v2/init/tracks/.gitkeep +0 -1
  44. package/templates/v2/init/tracks.md +0 -6
  45. package/templates/v2/init/wisps/.gitkeep +0 -1
  46. package/templates/v2/init/workflow.md +0 -72
  47. package/templates/v2/project/pattern.md +0 -20
  48. package/templates/v2/project/refresh.md +0 -21
  49. package/templates/v2/styleguides/dart.md +0 -27
  50. package/templates/v2/styleguides/flutter.md +0 -27
  51. package/templates/v2/styleguides/go.md +0 -29
  52. package/templates/v2/styleguides/gradle.md +0 -28
  53. package/templates/v2/styleguides/html-css.md +0 -39
  54. package/templates/v2/styleguides/index.md +0 -27
  55. package/templates/v2/styleguides/java.md +0 -27
  56. package/templates/v2/styleguides/javascript.md +0 -27
  57. package/templates/v2/styleguides/kotlin.md +0 -26
  58. package/templates/v2/styleguides/maven.md +0 -28
  59. package/templates/v2/styleguides/python.md +0 -27
  60. package/templates/v2/styleguides/react.md +0 -28
  61. package/templates/v2/styleguides/swift.md +0 -27
  62. package/templates/v2/styleguides/swiftui.md +0 -27
  63. package/templates/v2/styleguides/typescript.md +0 -26
  64. package/templates/v2/track/bug.md +0 -14
  65. package/templates/v2/track/execution.json +0 -19
  66. package/templates/v2/track/learning.md +0 -39
  67. package/templates/v2/track/plan.md +0 -39
  68. package/templates/v2/track/revision.md +0 -36
  69. package/templates/v2/track/spec.md +0 -38
  70. package/templates/v2/track/state.json +0 -31
  71. package/templates/v3/init/archive/.gitkeep +0 -1
  72. package/templates/v3/init/gitignore.template +0 -8
  73. package/templates/v3/init/guidelines.md +0 -25
  74. package/templates/v3/init/operations/.gitkeep +0 -1
  75. package/templates/v3/init/product.md +0 -30
  76. package/templates/v3/init/project.json +0 -27
  77. package/templates/v3/init/refreshes/.gitkeep +0 -1
  78. package/templates/v3/init/styleguides/general.md +0 -14
  79. package/templates/v3/init/styleguides/language.md +0 -21
  80. package/templates/v3/init/tech-stack.md +0 -21
  81. package/templates/v3/init/tracks/.gitkeep +0 -1
  82. package/templates/v3/init/tracks.md +0 -6
  83. package/templates/v3/init/wisps/.gitkeep +0 -1
  84. package/templates/v3/init/workflow.md +0 -82
  85. package/templates/v3/project/archive-operation.json +0 -19
  86. package/templates/v3/project/pattern.md +0 -20
  87. package/templates/v3/project/refresh-operation.json +0 -18
  88. package/templates/v3/project/refresh.md +0 -21
  89. package/templates/v3/styleguides/dart.md +0 -27
  90. package/templates/v3/styleguides/flutter.md +0 -27
  91. package/templates/v3/styleguides/go.md +0 -29
  92. package/templates/v3/styleguides/gradle.md +0 -28
  93. package/templates/v3/styleguides/html-css.md +0 -39
  94. package/templates/v3/styleguides/index.md +0 -27
  95. package/templates/v3/styleguides/java.md +0 -27
  96. package/templates/v3/styleguides/javascript.md +0 -27
  97. package/templates/v3/styleguides/kotlin.md +0 -26
  98. package/templates/v3/styleguides/maven.md +0 -28
  99. package/templates/v3/styleguides/python.md +0 -27
  100. package/templates/v3/styleguides/react.md +0 -28
  101. package/templates/v3/styleguides/swift.md +0 -27
  102. package/templates/v3/styleguides/swiftui.md +0 -27
  103. package/templates/v3/styleguides/typescript.md +0 -26
  104. package/templates/v3/track/bug.md +0 -14
  105. package/templates/v3/track/execution.json +0 -19
  106. package/templates/v3/track/plan.md +0 -39
  107. package/templates/v3/track/revert-operation.json +0 -17
  108. package/templates/v3/track/revise-operation.json +0 -18
  109. package/templates/v3/track/revision.md +0 -36
  110. package/templates/v3/track/spec.md +0 -38
  111. package/templates/v3/track/state.json +0 -31
  112. package/templates/v4/init/archive/.gitkeep +0 -1
  113. package/templates/v4/init/gitignore.template +0 -8
  114. package/templates/v4/init/guidelines.md +0 -25
  115. package/templates/v4/init/operations/.gitkeep +0 -1
  116. package/templates/v4/init/patterns/index.md +0 -8
  117. package/templates/v4/init/product.md +0 -30
  118. package/templates/v4/init/project.json +0 -27
  119. package/templates/v4/init/refreshes/.gitkeep +0 -1
  120. package/templates/v4/init/styleguides/general.md +0 -14
  121. package/templates/v4/init/styleguides/language.md +0 -21
  122. package/templates/v4/init/tech-stack.md +0 -21
  123. package/templates/v4/init/tracks/.gitkeep +0 -1
  124. package/templates/v4/init/tracks.md +0 -6
  125. package/templates/v4/init/wisps/.gitkeep +0 -1
  126. package/templates/v4/init/workflow.md +0 -91
  127. package/templates/v4/project/archive-operation.json +0 -19
  128. package/templates/v4/project/pattern.md +0 -20
  129. package/templates/v4/project/refresh-operation.json +0 -18
  130. package/templates/v4/project/refresh.md +0 -21
  131. package/templates/v4/styleguides/dart.md +0 -27
  132. package/templates/v4/styleguides/flutter.md +0 -27
  133. package/templates/v4/styleguides/go.md +0 -29
  134. package/templates/v4/styleguides/gradle.md +0 -28
  135. package/templates/v4/styleguides/html-css.md +0 -39
  136. package/templates/v4/styleguides/index.md +0 -27
  137. package/templates/v4/styleguides/java.md +0 -27
  138. package/templates/v4/styleguides/javascript.md +0 -27
  139. package/templates/v4/styleguides/kotlin.md +0 -26
  140. package/templates/v4/styleguides/maven.md +0 -28
  141. package/templates/v4/styleguides/python.md +0 -27
  142. package/templates/v4/styleguides/react.md +0 -28
  143. package/templates/v4/styleguides/swift.md +0 -27
  144. package/templates/v4/styleguides/swiftui.md +0 -27
  145. package/templates/v4/styleguides/typescript.md +0 -26
  146. package/templates/v4/track/bug.md +0 -14
  147. package/templates/v4/track/execution.json +0 -20
  148. package/templates/v4/track/learning.md +0 -45
  149. package/templates/v4/track/plan.md +0 -39
  150. package/templates/v4/track/revert-operation.json +0 -17
  151. package/templates/v4/track/revise-operation.json +0 -18
  152. package/templates/v4/track/revision.md +0 -36
  153. package/templates/v4/track/spec.md +0 -38
  154. package/templates/v4/track/state.json +0 -31
  155. package/templates/v5/init/archive/.gitkeep +0 -1
  156. package/templates/v5/init/guidelines.md +0 -25
  157. package/templates/v5/init/operations/.gitkeep +0 -1
  158. package/templates/v5/init/patterns/index.md +0 -8
  159. package/templates/v5/init/product.md +0 -30
  160. package/templates/v5/init/refreshes/.gitkeep +0 -1
  161. package/templates/v5/init/styleguides/general.md +0 -14
  162. package/templates/v5/init/styleguides/language.md +0 -21
  163. package/templates/v5/init/tech-stack.md +0 -21
  164. package/templates/v5/init/tracks/.gitkeep +0 -1
  165. package/templates/v5/init/tracks.md +0 -6
  166. package/templates/v5/init/wisps/.gitkeep +0 -1
  167. package/templates/v5/project/archive-operation.json +0 -19
  168. package/templates/v5/project/pattern.md +0 -20
  169. package/templates/v5/project/refresh-operation.json +0 -18
  170. package/templates/v5/project/refresh.md +0 -21
  171. package/templates/v5/styleguides/dart.md +0 -27
  172. package/templates/v5/styleguides/flutter.md +0 -27
  173. package/templates/v5/styleguides/go.md +0 -29
  174. package/templates/v5/styleguides/gradle.md +0 -28
  175. package/templates/v5/styleguides/html-css.md +0 -39
  176. package/templates/v5/styleguides/index.md +0 -27
  177. package/templates/v5/styleguides/java.md +0 -27
  178. package/templates/v5/styleguides/javascript.md +0 -27
  179. package/templates/v5/styleguides/kotlin.md +0 -26
  180. package/templates/v5/styleguides/maven.md +0 -28
  181. package/templates/v5/styleguides/python.md +0 -27
  182. package/templates/v5/styleguides/react.md +0 -28
  183. package/templates/v5/styleguides/swift.md +0 -27
  184. package/templates/v5/styleguides/swiftui.md +0 -27
  185. package/templates/v5/styleguides/typescript.md +0 -26
  186. package/templates/v5/track/bug.md +0 -14
  187. package/templates/v5/track/learning.md +0 -45
  188. package/templates/v5/track/revert-operation.json +0 -17
  189. package/templates/v5/track/revise-operation.json +0 -18
  190. package/templates/v5/track/revision.md +0 -36
  191. package/templates/v5/track/spec.md +0 -38
  192. /package/templates/{v1 → v6}/init/archive/.gitkeep +0 -0
  193. /package/templates/{v5 → v6}/init/gitignore.template +0 -0
  194. /package/templates/{v1 → v6}/init/guidelines.md +0 -0
  195. /package/templates/{v1 → v6}/init/operations/.gitkeep +0 -0
  196. /package/templates/{v3 → v6}/init/patterns/index.md +0 -0
  197. /package/templates/{v1 → v6}/init/product.md +0 -0
  198. /package/templates/{v5 → v6}/init/project.json +0 -0
  199. /package/templates/{v1 → v6}/init/refreshes/.gitkeep +0 -0
  200. /package/templates/{v1 → v6}/init/styleguides/general.md +0 -0
  201. /package/templates/{v1 → v6}/init/styleguides/language.md +0 -0
  202. /package/templates/{v1 → v6}/init/tech-stack.md +0 -0
  203. /package/templates/{v1 → v6}/init/tracks/.gitkeep +0 -0
  204. /package/templates/{v1 → v6}/init/tracks.md +0 -0
  205. /package/templates/{v1 → v6}/init/wisps/.gitkeep +0 -0
  206. /package/templates/{v2 → v6}/project/archive-operation.json +0 -0
  207. /package/templates/{v1 → v6}/project/pattern.md +0 -0
  208. /package/templates/{v2 → v6}/project/refresh-operation.json +0 -0
  209. /package/templates/{v1 → v6}/project/refresh.md +0 -0
  210. /package/templates/{v1 → v6}/styleguides/dart.md +0 -0
  211. /package/templates/{v1 → v6}/styleguides/flutter.md +0 -0
  212. /package/templates/{v1 → v6}/styleguides/go.md +0 -0
  213. /package/templates/{v1 → v6}/styleguides/gradle.md +0 -0
  214. /package/templates/{v1 → v6}/styleguides/html-css.md +0 -0
  215. /package/templates/{v1 → v6}/styleguides/index.md +0 -0
  216. /package/templates/{v1 → v6}/styleguides/java.md +0 -0
  217. /package/templates/{v1 → v6}/styleguides/javascript.md +0 -0
  218. /package/templates/{v1 → v6}/styleguides/kotlin.md +0 -0
  219. /package/templates/{v1 → v6}/styleguides/maven.md +0 -0
  220. /package/templates/{v1 → v6}/styleguides/python.md +0 -0
  221. /package/templates/{v1 → v6}/styleguides/react.md +0 -0
  222. /package/templates/{v1 → v6}/styleguides/swift.md +0 -0
  223. /package/templates/{v1 → v6}/styleguides/swiftui.md +0 -0
  224. /package/templates/{v1 → v6}/styleguides/typescript.md +0 -0
  225. /package/templates/{v1 → v6}/track/bug.md +0 -0
  226. /package/templates/{v5 → v6}/track/dependency-context.json +0 -0
  227. /package/templates/{v5 → v6}/track/execution.json +0 -0
  228. /package/templates/{v3 → v6}/track/learning.md +0 -0
  229. /package/templates/{v5 → v6}/track/plan.md +0 -0
  230. /package/templates/{v2 → v6}/track/revert-operation.json +0 -0
  231. /package/templates/{v2 → v6}/track/revise-operation.json +0 -0
  232. /package/templates/{v1 → v6}/track/revision.md +0 -0
  233. /package/templates/{v1 → v6}/track/spec.md +0 -0
  234. /package/templates/{v5 → v6}/track/state.json +0 -0
@@ -7,15 +7,15 @@ description: Review a Cadre track that is ready for review, present evidence-bac
7
7
 
8
8
  ## Cohesive commits and retained context
9
9
 
10
- For v5/schema-2 state, each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
10
+ Each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
11
11
 
12
- Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval.
12
+ Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval. Resume checks the approved unchanged-input fingerprints before further writes. `OPERATION_INPUT_DRIFT` preserves the pending operation; retain changed files and deliberately restore the approved inputs or obtain an exact repair approval. Never alter recovery hashes, delete the journal, or repeat product work to bypass this gate.
13
13
 
14
- Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same token across continuation pages. Clear it after compaction, context loss, expiration, or a fresh task. Keep `knownSources` only for compatibility. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
14
+ Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same scope, token and knowledge arguments across continuation pages. Do not add or change `knownSources` midway through a paginated read; changing those arguments invalidates its cursor. Clear it after compaction, context loss, expiration, or a fresh task. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
15
15
 
16
16
  Serialized errors are bounded to 8 KiB. Use `diagnostic_read` with the returned diagnostic ID only when fuller evidence is needed; paginate it. Do not dump cache path lists into conversation. Build outputs belong in the runtime-returned owned `buildCachePath`, never an arbitrary `.cadre/.build-cache` directory.
17
17
 
18
- Legacy SHA records and immutable v1–v4 templates remain evidence. Migrate through one approved refresh at a quiescent boundary before creating a v5 execution. Retain each existing execution's original contract and preserve approvals, completed nodes, findings, journals, and archived learning. The v5 commit instructions here replace legacy follow-up provenance commits described below.
18
+ Existing 3.9.0/3.9.1/3.9.2 projects using schema-2 state and template v5 continue without a version-only refresh. If status reports `PROJECT_UPGRADE_REQUIRED`, stop mutations: install Cadre 3.9.0, reconcile interrupted operations and perform its approved refresh to schema-2/v5 at a quiescent boundary, then install 4.0.0 and reload the client. Preserve approvals, historical journals, SHA references and archived learning; never edit version labels to bypass this gate.
19
19
 
20
20
  Review a `ready_for_review` track. A persisted policy-v2 Autonomous review operation may also resume interrupted promotion from `in_progress`; finish that operation before implementation starts. Apply the Autonomous rules below under the originating persisted authorization and retain explicit human approval for clean completion. Load `.cadre/workflow.md`, all track artifacts and learning, dependency context, relevant patterns/styleguides, implementation commits, and repository tests. Read every reviewed file before judging or proposing edits.
21
21
 
@@ -27,7 +27,7 @@ Call `project_status` first with `view: "track"` and `trackId`; use its embedded
27
27
 
28
28
  Build one bounded context inventory from `project_status`, the current track paths, and the reviewed Git range. Read each required artifact once. Do not run a line-count pass before reading, repeat `rg --files` discovery, or reread a whole file after truncated output; continue from the first unread line. During consecutive review cycles in the same flow, reuse unchanged product, workflow, pattern, and styleguide context and verify it by Git path/hash; reread the current state, plan, execution, new review range, and affected files/callers. Use batched parallel reads where independent.
29
29
 
30
- The declared review mutation surface is adaptive `review_complete` for clean completion. Finding-bearing review uses the explicitly journaled direct-write procedure below. Do not inspect the installed runtime, global tool catalog, or generated MCP bundle looking for another review-state tool.
30
+ The declared review mutation surface is adaptive `review_complete` for clean completion and `candidate_apply` for remediation. Do not inspect the installed runtime, global tool catalog, or generated MCP bundle looking for another review-state tool.
31
31
 
32
32
  Expected human decision count is one per review cycle outside policy-v2 Autonomous when the human accepts the recommended exact remediation, approves a clean review, or explicitly rejects findings and approves clean completion. Ask again only when the human changes the proposal or new evidence changes its content or consequences.
33
33
 
@@ -36,14 +36,14 @@ Expected human decision count is one per review cycle outside policy-v2 Autonomo
36
36
  1. Read the completed execution journal and review its exact `baseCommit..headCommit` range (Autonomous uses persisted `initialBaseCommit..headCommit` across all remediation executions), which includes the first implementation commit. Inspect diffs and affected callers, tests, security boundaries, error paths, compatibility, acceptance criteria, and non-functional requirements.
37
37
  2. Run relevant verification without mutating production behavior. Report findings by severity with file/line evidence, impact, reproduction, and proposed acceptance criteria. Do not write a bug file yet.
38
38
  3. Prepare one decision-ready proposal before asking for approval (Autonomous binds in-scope findings to persisted authorization as described below):
39
- - If findings exist, call `template_get_many` for `track/bug`, then `candidate_stage_prepare` for `review-<track-id>` with `expectedFiles` equal to the exact bug artifact paths plus `plan.md`. Draft only those files beneath the stage so removed findings cannot remain. Do not pass plan Markdown through MCP or create a temporary project copy.
40
- - Append remediation phases and a new final `Track-level User Manual Verification` phase. Preserve every completed former final verification phase with its exact title, task IDs, checkboxes, and commit markers; its dependencies remain the preceding phases it verified. Do not rename it, insert a fictitious delivery task, or reopen it to satisfy validation.
39
+ - If findings exist, call `template_get_many` for `track/bug`, then `candidate_stage_prepare` for `review-<track-id>` with `expectedFiles` equal to the exact bug artifact paths plus `plan.md`. Use `bugs/review-<cycle>.md` for the cycle's report, or `bugs/bug-<number>.md` for individual reports, with numeric suffixes (for example `bugs/review-1.md`). Keep the `bugs/` directory in candidate-relative paths; root `bugs.md`, root `bug-1.md`, and descriptive filenames are not promotion paths. Draft only those files beneath the stage so removed findings cannot remain. Do not pass plan Markdown through MCP or create a temporary project copy.
40
+ - Append remediation phases and a new final `Track-level User Manual Verification` phase. Every appended phase includes `- Phase completion commit: pending`. Preserve every completed former final verification phase with its exact title, task IDs, checkboxes, and commit markers; its dependencies remain the preceding phases it verified. Do not rename it, insert a fictitious delivery task, or reopen it to satisfy validation.
41
41
  - Call `candidate_inspect` once for the complete staged bug/plan set with `planValidations: [{ path: "plan.md", targetStatus: "in_progress" }]`. Present findings, exact diff, graph summary, manifest, consequences, and choices together, bound to its digest. One response may approve both the finding disposition and the unchanged exact artifacts, or reject all findings while explicitly accepting their risks and approve clean completion.
42
42
  - Inspection validates that target status without changing canonical state. Keep the canonical track `ready_for_review` and its completed execution unchanged until human approval or the exact Autonomous remediation authorization is journaled. If a staged state is included, its status must agree with `targetStatus`; an active execution still requires reconciliation at a safe boundary.
43
43
  - If the human changes the finding subset or remediation, rebuild and validate the exact proposal and request approval once for that changed proposal. Do not reuse approval for superseded content.
44
44
  - If no findings exist, prepare the clean completion proposal in step 5 before presenting its exact transition for approval.
45
- 4. For v5 approved changes, include the findings, proposed final state, appended plan, reassessed learning and dependency context in `candidate_apply` prepare with `workflow: "review"`. Preserve completed execution and finding evidence. Under valid Autonomous authority bind the exact candidate to that authority; other modes require the human decision. Apply only the unchanged approved token. Commit `cadre(review): request changes for <track-id>` once with receipt trailers and reconcile before the next execution. For legacy recovery, retain the original candidate_inspect planValidations and SHA journal contract.
46
- 5. For a clean review, call `review_complete` with `request: { mode: "prepare", projectRoot, trackId, approval, acceptedRisks? }`. The server derives the cumulative range for Autonomous and the completed execution range for other modes. Present its exact proposal and evidence, then ask once for explicit approval. After approval, call only `request: { mode: "apply", proposalToken }`. A retry converges a matching cycle/index without duplicating history. Commit `cadre(review): complete <track-id>`.
45
+ 4. For approved changes, include findings, appended plan, reassessed learning and dependency context in `candidate_apply` prepare with `workflow: "review"`. Autonomous also includes `reviews/loop-<next-cycle>.json` and omits `state.json`: the runtime derives the state transition, changes-requested cycle, attempted finding IDs and receipt reference from canonical authority and the exact snapshot. Keep canonical state and operation unchanged while preparing. Other modes include the proposed `in_progress` state and require the human decision. Apply only the unchanged approved token; the receipt binds its digest without a self-referential operation. Commit `cadre(review): request changes for <track-id>` once with receipt trailers and reconcile before the next execution.
46
+ 5. For a clean review, call `review_complete` with `request: { mode: "prepare", projectRoot, trackId, approval, acceptedRisks? }`. The server derives the cumulative range for Autonomous and the completed execution range for other modes. Present its exact proposal and evidence, then ask once for explicit approval. After approval, call only `request: { mode: "apply", proposalToken }`. A retry converges a matching cycle/index without duplicating history. Commit `cadre(review): complete <track-id>` with the receipt trailers and reconcile. If a retry returns `receipt.status: committed` and no changed paths, completion is already committed; do not create another commit or ask for another approval.
47
47
 
48
48
  Repeat review → implement → review until a human approves a clean review. Autonomous continues the loop in this task without asking permission for in-scope remediation. Other approval modes retain their existing gates. Only this command may mark a track completed.
49
49
 
@@ -55,32 +55,17 @@ Satisfy `prerequisite` before handoff: `implementation_bookkeeping_commit` means
55
55
 
56
56
  ## Memory contract
57
57
 
58
- Preserve phase history and existing handoffs. For active v3/v4/v5 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
58
+ Preserve phase history and existing handoffs. For active tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
59
59
 
60
- The legacy input field `approval` carries prepared review evidence, not a claim of a human decision. State stores it as `reviewEvidence`. Prepare once, obtain approval of the exact digest, and apply its token unchanged. The runtime adds `approvalConfirmation` with the bound digest, confirmation time and `explicit-apply` method, separately from the evidence. Do not re-prepare merely to replace pending-approval prose. This receipt records the approved application, not an authenticated identity or a fabricated quotation from a human.
60
+ The input field `approval` carries prepared review evidence, not a claim of a human decision. State stores it as `reviewEvidence`. Prepare once, obtain approval of the exact digest, and apply its token unchanged. The runtime adds `approvalConfirmation` with the bound digest, confirmation time and `explicit-apply` method, separately from the evidence. Do not re-prepare merely to replace pending-approval prose. This receipt records the approved application, not an authenticated identity or a fabricated quotation from a human.
61
+
62
+ The clean-review prepare state hash excludes the future `approvalConfirmation`. After apply, verify the applied state/index against the returned immutable receipt's artifact hashes, and confirm that the state differs from the prepared proposal only by this exact confirmation. Do not require the prepared and applied state hashes to be identical or treat that documented addition as source drift. Preserve the original approval and finish its pending commit/reconciliation.
61
63
 
62
64
  ## Autonomous authorization
63
65
 
64
66
  These rules override intermediate human gates only for a valid policy-v2 persisted Autonomous loop. Use the same candidate, journal, promotion, memory, and commit procedure above. Main owns scheduling and state and performs a separate review pass; no additional reviewer agent is required. Never duplicate a review cycle, execution, or commit during recovery.
65
67
 
66
- Use this exact canonical `state.operation` shape for remediation; a finding disposition such as `request_changes` is not an operation action:
67
-
68
- ```json
69
- {
70
- "action": "review",
71
- "checkpoint": "approved",
72
- "baseCommit": "<canonical HEAD before promotion>",
73
- "expectedCommit": "cadre(review): request changes for <track-id>",
74
- "approvedArtifacts": ["<each inspected relative path>"],
75
- "approvedArtifactHashes": [{ "path": "<same relative path>", "sha256": "<inspected hash>" }],
76
- "artifactProgress": [],
77
- "approvedAt": "<ISO timestamp of this mode-authorized operation>",
78
- "approvalDigest": "<complete inspected digest>",
79
- "authorization": { "kind": "persisted-mode", "originExecutionId": "<original execution>", "proposalDigest": "<same digest>" }
80
- }
81
- ```
82
-
83
- List every inspected file in both artifact arrays, including the loop snapshot and learning. `approvedArtifacts` contains path strings; `approvedArtifactHashes` contains path/hash objects. `expectedCommit` is the intended commit message, not a SHA. After journaling, call `state_validate` and require valid state before the first canonical promotion; repair journal metadata without changing its inspected manifest or authority if validation fails. Record the findings assigned to the next remediation execution as `attemptedFindingIds` on the changes-requested cycle, even though their completed-attempt counters are initially empty.
68
+ Use `candidate_apply` to derive the remediation transition from the staged loop snapshot and artifacts. The preview binds the exact findings, next remediation execution and persisted-mode authorization to its receipt. Do not author a separate direct-write review operation or add a provenance commit.
84
69
 
85
70
  ## Durable authority and checkpoints
86
71
 
@@ -105,14 +90,22 @@ Checkpoints are `implementing`, `reviewing`, `remediating`, `awaiting_approval`,
105
90
  ## Review and remediation
106
91
 
107
92
  1. Finish the current implementation journal and commit its bookkeeping before invoking review. At `ready_for_review`, review `initialBaseCommit..lastExecution.headCommit`, all acceptance criteria, affected callers/tests, and prior findings. Verify actual product changes and re-run affected checks. Do not treat the latest remediation diff alone as a clean track review.
108
- 2. Keep each finding's ID stable across renames, moves, rewritten fixes, and review wording. Reopen a recurring finding using the same ID. After reviewing a completed execution that attempted that finding, append that execution ID to `attemptExecutionIds` only if absent; never count the original discovery execution or count an interrupted attempt twice. Mark resolved only from actual verification and review evidence. Preserve resolved finding history.
109
- 3. If an open finding has two recorded remediation execution IDs, stop with checkpoint `blocked` and a precise blocker. Do the same for material scope decisions, unavailable human-only verification, or external blockers. Present the evidence and ask how to continue; never reset IDs/attempt counts to bypass the stop. Persist this evidence in canonical state using a focused bookkeeping commit. On explicit instructions to retry a stalled finding, use a digest-bound refresh to record those instructions and start a new authorized loop while retaining the former loop in track history.
110
- 4. For progressable in-scope findings, stage bug artifacts, appended remediation phases and final verification, learning, and `reviews/loop-<cycle>.json` at the review candidate root. The loop snapshot contains the complete updated `autonomousReview` object: retained authority/findings, reviewed execution/HEAD, and checkpoint `remediating`. Include that exact snapshot path in `expectedFiles`; validate the proposed plan as `in_progress`. Keep canonical state `ready_for_review` until promotion; do not stage `state.json` with a self-referential operation digest. Record attempted finding IDs on the changes-requested review cycle so the next review can identify which findings this execution attempted. Do not reopen or rename completed verification phases.
111
- 5. Re-inspect the exact complete staged set immediately before promotion; require valid plan and fresh learning/memory inputs. Bind the current digest to `operation.authorization: { kind: "persisted-mode", originExecutionId, proposalDigest }`, with `proposalDigest` equal to `operation.approvalDigest`. Existing `approvedAt`/`approvedArtifacts` fields record the mode-authorized operation, not a new human decision. Journal the operation before any canonical promotion. Record verification and scope evidence in the review cycle; do not record `approvalConfirmation` for automatic remediation.
112
- 6. Promote only the inspected files, copy the approved loop snapshot into `state.autonomousReview` as the deterministic state transition while retaining its active review operation, and follow the revision/index/commit/provenance procedure above. Retain the operation in canonical state until the commit is recorded; re-inspect changed candidates and reconcile interrupted promotion before resuming. After the review bookkeeping commit and operation clearance, call focused `project_status` and follow its `nextStep` into implement with a new execution ID and inherited Autonomous mode. No additional user prompt is needed for these bounded changes.
93
+ 2. Keep each finding's ID stable across renames, moves, rewritten fixes, and review wording. Use lowercase slug IDs such as `exact-integer-precision` in loop JSON; uppercase bug labels in report headings are not finding IDs. Reopen a recurring finding using the same ID. After reviewing a completed execution that attempted that finding, append that execution ID to `attemptExecutionIds` only if absent; never count the original discovery execution or count an interrupted attempt twice. Mark resolved only from actual verification and review evidence. Preserve resolved finding history.
94
+ 3. For each open finding, count remediation execution IDs since its latest explicitly approved `retryAuthorization.attemptBaseline`; count all IDs when no retry authority exists. After two new attempts in that budget, stop with checkpoint `blocked` and a precise blocker. Retain the entire attempt array as history. Do the same for material scope decisions, unavailable human-only verification, or external blockers. Present the evidence and ask how to continue; never reset IDs/attempt counts to bypass the stop. Persist this evidence in canonical state using a focused bookkeeping commit. On explicit instructions to retry a blocked or stalled loop, use the refresh skill’s `reviewRetry` request under a new digest-bound human approval. Stage the unchanged current track state and a human-instruction refresh record. The runtime preserves the original authorization, cumulative baseline, finding identities and all attempts, appends the complete prior loop to refresh history, removes the approved blocker and records a fresh two-attempt budget. Never hand-reset attempts, replace the loop or reuse an earlier approval to renew the budget.
95
+ 4. For progressable in-scope findings, stage bug artifacts, appended remediation phases and final verification, learning, reassessed `dependency-context.json`, and `reviews/loop-<cycle>.json` at the review candidate root. Use the next cycle number. The loop snapshot contains the complete updated `autonomousReview` object: retained authority/findings, reviewed execution/HEAD, and checkpoint `remediating`. Include every exact path in `expectedFiles`; validate the proposed plan as `in_progress`. Keep canonical state `ready_for_review` until promotion; omit staged `state.json` in this receipt-based review operation. Do not reopen or rename completed verification phases or change the specification revision; increment the plan revision once.
96
+
97
+ The runtime checks the persisted loop's blocked/stalled gate before accepting this snapshot. Changing only the proposed checkpoint cannot remove a blocker. Pending remediation also retains and revalidates its original authority on generic resume, including after state promotion or candidate-stage loss. Older partial intent without exact pre-promotion evidence requires an approved evidence repair; never replace its digest or reset the loop to continue.
98
+ 5. Re-inspect the exact complete staged set immediately before promotion; require valid plan and fresh learning/memory inputs. prepare `candidate_apply` with that exact manifest and `workflow: "review"`, verify its derived proposal against the persisted authority, then apply its unchanged token. The runtime journals the approved receipt and records attempted finding IDs; do not hand-write canonical state, `state.operation`, or `approvalConfirmation`. The candidate_inspect digest and candidate_apply digest bind different previews: use the apply tool's proposal token for promotion. Legacy recovery retains the journal authorization and digest procedure above.
99
+ 6. Commit all promoted files and the immutable receipt once with both returned trailers, then reconcile the operation. On interruption, resume or reconcile that original receipt; never create a second commit to record its SHA or clear an operation in tracked state. The runtime copies the approved snapshot into `state.autonomousReview` and clears the canonical operation in the same promotion. Legacy recovery retains its original promotion/commit/provenance contract. After reconciliation, call focused `project_status` and follow its `nextStep` into implement with a new execution ID and inherited Autonomous mode. No additional user prompt is needed for these bounded changes.
113
100
 
114
101
  ## Clean result and approval
115
102
 
116
103
  When no unresolved findings remain, persist checkpoint `awaiting_approval`, findings, and `reviewedExecutionId`/`reviewedHead`, and retain that evidence durably on disk without a clean-evidence-only commit. The track remains `ready_for_review`. Call `review_complete` prepare with review evidence, present verification results, remediation history, and its exact completion proposal, and ask once for explicit human approval. Apply only that unchanged token after approval; only the review runtime marks the loop and track completed. Autonomous does not use `acceptedRisks` to waive findings.
117
104
 
118
105
  Resume `awaiting_approval` by checking the recorded execution/HEAD and product content, preparing a fresh token if needed, and requesting the still-missing final approval. A prior unresolved question is not approval. Changed product or verification inputs require renewed verification/review and a new clean checkpoint; ordinary Cadre bookkeeping alone does not. A request for changes returns to review under the existing scope; cancellation stops with state intact.
106
+
107
+ ## Review freshness on approval and recovery
108
+
109
+ All modes preserve the complete completed plan and append remediation at exactly the next plan revision, with the specification revision unchanged. Ordinary review state retains its prior execution, scope, policy and review history and appends one `changes_requested` cycle naming that execution's ID, plan revision, graph digest and reviewed HEAD. Approval of a review does not authorize reopening completed tasks. Pending promotion retains exact original state/plan evidence for recovery after partial writes or stage loss; missing or inconsistent original evidence requires an approved repair, never recreated hashes or another delivery run.
110
+
111
+ Every approval mode checks product and verification-policy content against the reviewed HEAD before clean completion. Interrupted clean or finding-bearing review promotion performs the same check before any remaining write, using the reviewed evidence retained in its original intent, including older pending receipts. Preserve dirty changes and the pending journal if freshness fails; verify the current product and obtain an exact repair approval, or deliberately restore the approved inputs. A committed approval replays its immutable historical receipt even after later product changes.
@@ -7,24 +7,29 @@ description: Route a requested track change according to lifecycle state, revise
7
7
 
8
8
  ## Cohesive commits and retained context
9
9
 
10
- For v5/schema-2 state, each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
10
+ Each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
11
11
 
12
- Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval.
12
+ Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval. Resume checks the approved unchanged-input fingerprints before further writes. `OPERATION_INPUT_DRIFT` preserves the pending operation; retain changed files and deliberately restore the approved inputs or obtain an exact repair approval. Never alter recovery hashes, delete the journal, or repeat product work to bypass this gate.
13
13
 
14
- Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same token across continuation pages. Clear it after compaction, context loss, expiration, or a fresh task. Keep `knownSources` only for compatibility. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
14
+ Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same scope, token and knowledge arguments across continuation pages. Do not add or change `knownSources` midway through a paginated read; changing those arguments invalidates its cursor. Clear it after compaction, context loss, expiration, or a fresh task. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
15
15
 
16
16
  Serialized errors are bounded to 8 KiB. Use `diagnostic_read` with the returned diagnostic ID only when fuller evidence is needed; paginate it. Do not dump cache path lists into conversation. Build outputs belong in the runtime-returned owned `buildCachePath`, never an arbitrary `.cadre/.build-cache` directory.
17
17
 
18
- Legacy SHA records and immutable v1–v4 templates remain evidence. Migrate through one approved refresh at a quiescent boundary before creating a v5 execution. Retain each existing execution's original contract and preserve approvals, completed nodes, findings, journals, and archived learning. The v5 commit instructions here replace legacy follow-up provenance commits described below.
18
+ Existing 3.9.0/3.9.1/3.9.2 projects using schema-2 state and template v5 continue without a version-only refresh. If status reports `PROJECT_UPGRADE_REQUIRED`, stop mutations: install Cadre 3.9.0, reconcile interrupted operations and perform its approved refresh to schema-2/v5 at a quiescent boundary, then install 4.0.0 and reload the client. Preserve approvals, historical journals, SHA references and archived learning; never edit version labels to bypass this gate.
19
19
 
20
20
  Read `.cadre/workflow.md`, the full target track, its dependencies, all tracks that depend on it, relevant repository files, and applicable patterns. Read each artifact before editing; never propose a revision from guessed contents.
21
21
 
22
22
  At every required clarification or approval boundary, show a concise impact summary or focused diff. Inspect the active host policy before calling `workflow_elicit`: if the task context reports approval policy `never`, including Codex Full Access, skip the form and ask the same short question once in chat. Otherwise prefer `workflow_elicit`, using `clarification` for at most three questions and `approval` bound to the exact revision proposal checkpoint. Treat only an `approved` result as approval. If it returns `fallback_required`, or immediately returns `declined` while the task explicitly reports policy `never`, ask the same short question once in chat; the latter is policy rejection, not a human decline. Never request secrets or retry the form.
23
23
 
24
- Call `project_status` first with `view: "implementation"` and `trackId` for active canonical work, otherwise `view: "track"`; use its embedded structured validation and do not repeat `state_validate` at command entry. Stop on invalid status. A `staged_track_candidate` has no approved baseline: route its changes through the track proposal without creating a revision artifact or operation.
24
+ Call `project_status` first with `view: "implementation"` and `trackId` for active canonical work, otherwise `view: "track"`; use its embedded structured validation and do not repeat `state_validate` at command entry. Stop on invalid status, except for preparing an explicitly approved revision repair when the only errors are the reported revision's scope/current-graph mismatch and the original execution binding remains intact. Inspect the original receipt, full artifacts, and committed execution plan first; unrelated validation failures remain blockers. A `staged_track_candidate` has no approved baseline: route its changes through the track proposal without creating a revision artifact or operation.
25
+
26
+ Pending recovery enforces the original history, fresh revision record and synchronized counters before further writes. If an older intent lacks that evidence, retain it for an explicitly approved repair; do not repeatedly reconcile it or fabricate missing approval fields. Already-committed receipt replay remains historical and unchanged.
27
+
28
+ For an imported draft, derive the specification counter from its committed approval, not an edited draft plan. Revision and its recovery keep `drafting-plan` with no plan approval or execution; obtain plan approval through track before implementation.
25
29
 
26
30
  ## Route by current status
27
31
 
32
+ - No canonical track: use `track`; revision cannot create its own approved baseline, including when resuming an older pending operation.
28
33
  - `drafting-spec`: follow the `track` specification procedure and resume its journal. The content is not yet an approved baseline, so do not create a revision artifact or increment a revision.
29
34
  - `drafting-plan`: if the approved specification changes, perform the semantic revision procedure below and remain `drafting-plan`; if only the unapproved plan changes, resume the `track` planning procedure without a revision artifact.
30
35
  - `planned`: perform the semantic revision and remain `planned`.
@@ -43,16 +48,21 @@ Expected human decision count is one when the requested change and partial-work
43
48
  3. Apply the workflow clarification gate. Ask when materially different interpretations remain for the desired outcome, scope, acceptance criteria, compatibility, dependency changes, treatment of completed or partial work, or whether dependent tracks should change now. Do not infer permission to invalidate approved work.
44
49
  4. Trace transitive dependent tracks. For each, classify impact as none, reseed-only, plan change, spec change, or invalidated work, with evidence. If evidence cannot resolve a material impact, ask before choosing a classification.
45
50
  5. Call `template_get_many` once for `track/revision` and `track/revise-operation`, then `candidate_stage_prepare` for `revise-<track-id>` with `expectedFiles` equal to the exact revision and affected artifact paths. Render only that set beneath the stage, preserving eventual track-relative paths and completed provenance.
46
- 6. Increment revisions exactly once and restore derived manual-verification barriers. A changed plan uses a new execution ID. Do not pass plan Markdown through MCP, validate the stale canonical plan, or create a temporary project copy.
47
- When appending work after completed track verification, preserve that historical phase's exact title, task IDs, checks, and commit markers and append a new final `Track-level User Manual Verification`. Historical verification depends only on its preceding phases. Candidate inspection uses the intended resulting status for a revision of `ready_for_review`; no pre-approval canonical status change is needed. A staged state must agree with its plan's `targetStatus`, and active execution bindings must still match the reconciled graph.
48
- 7. Call `candidate_inspect` once for every staged revision and cascading artifact. Supply one `planValidations` entry for every staged root or nested `plan.md`, using its exact candidate-relative path and intended resulting track status; omit the list only when the candidate contains no plans. Present every plan result, the target revision, manifest, partial-work disposition, dependent changes, lifecycle transitions, commits, and bookkeeping together, bound to its digest. Partial approval requires a fresh inspection.
49
- 8. Include proposed final states, reassessed dependency-context artifacts, and every cascading change in `candidate_apply` prepare with `workflow: "revise"`. This replaces direct promotion and the separate candidate inspection on the v5 path; `planValidations` remains the legacy inspection interface. Preserve original execution bindings and historical evidence.
51
+ 6. Increment revisions exactly once and restore derived manual-verification barriers. A changed approved plan uses a new execution ID; a specification revision while drafting-plan retains the unapproved plan and has no execution. Do not pass plan Markdown through MCP, validate the stale canonical plan, or create a temporary project copy.
52
+ When appending work after completed track verification, preserve that historical phase's exact title, task IDs, checks, and commit markers and append a new final `Track-level User Manual Verification`. Historical verification depends only on its preceding phases. Proposed state and plan must agree on the resulting lifecycle status; keep canonical state and the original execution binding unchanged until the runtime derives the revision transition.
53
+ 7. Use sequential task ordinals in each phase. Preserve completed task IDs, titles, dependencies and commit groups. Inserting work before pending tasks may renumber those pending tasks and their dependency references; do not renumber completed work. If this cannot preserve completed provenance, append a new phase. A completed task line ends with `<!-- commit: FULL_HEX_SHA -->`, substituting its verified full SHA; a bare `[SHA]` or backticked SHA is not a task commit marker. A completed phase uses `- Phase completion commit: ` followed by its backticked verified SHA.
54
+ Validate the full revision through `candidate_apply` prepare below. Do not first run `candidate_inspect` on revised state that still retains the original execution binding: that inspection compares the new graph with the old journal before revision derivation. Keep every staged file in the manifest, including state.json; fix reported staged syntax or content rather than dropping files or clearing authority.
55
+ 8. Use only `candidate_apply` prepare with `workflow: "revise"`, including `state.json` with the next track revision, exactly one revision record per revised track, reassessed dependency-context artifacts, and every cascading change. A changed specification requires the next spec revision in a reassessed plan; changed graphs require the next plan revision and updated learning/dependency context. The revision record must agree with all previous/new revision numbers. Preserve the authored operation, last execution, review cycles, Autonomous loop, and commit references; the runtime derives their resulting transition in the proposal. Do not rewrite the old execution to fit the new graph or clear its binding before approval. Copy completed-task and phase commit markers from verified journal evidence into the revised plan, retaining their structure and handoffs. Invalidated completed work requires an approved additive revert first.
56
+ For an imported `drafting-plan` baseline with an approved spec and no approved plan or execution, keep the proposed status `drafting-plan`. Stage the changed spec, reassessed draft plan/learning/dependency context, next track revision, and fresh revision record together. Preserve authored commit references; the runtime records the previous spec approval, binds the revised spec, and leaves `commits.plan` null. Increment the spec and draft-plan counters exactly once. An initial draft with no plan uses previous spec revision 1 and previous plan revision 0; do not guess missing counters for a later draft. Resume the track drafting flow afterwards to obtain combined plan approval before delivery. Draft-plan-only edits stay on track drafting without a semantic revision.
57
+ At a quiescent active boundary, the full proposal includes the old journal as `superseded`, its unchanged node evidence, the retained execution binding, and updated Autonomous scope authority. Superseded does not mean completed. Inspect the complete manifest and `stateChanges` before asking for approval. After commit/reconciliation, start a new execution for the revised graph with inherited modes; do not resume the superseded execution. A spec-only promotion or a committed revision record alone cannot complete this transition. Receipt reconciliation verifies the recorded promotion; it cannot manufacture fields omitted from its original approval.
58
+ For an older incomplete promotion, keep its receipt and revision record immutable and use a fresh repair artifact. State/plan/spec revision numbers must describe the actual canonical source and proposed result. When canonical plan and active journal differ, include `## Recovery evidence` with exact `- Previous execution graph: <graphDigest>` and `- Previous execution plan commit: <planCommit>` lines. The runtime verifies the journal against that reachable committed plan before proposing supersession; it never rewrites the original graph or invents completion.
59
+ Assign appended delivery a fresh commit group; adding tasks to an already completed group would require replacing that group's verified product commit and is rejected before approval.
50
60
  9. Obtain one approval for its exact manifest/digest, then apply the proposal token. Commit `cadre(revise): update <track-id>` with the operation receipt trailers and reconcile. The runtime sets changed spec/plan references before commit and updates the index atomically. Do not write a follow-up record commit or fill the operation's SHA into tracked files.
51
61
 
52
62
  ## Memory contract
53
63
 
54
- Preserve phase history and existing handoffs. For active v3/v4/v5 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
64
+ Preserve phase history and existing handoffs. For active tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Use the combined `candidate_apply` preparation to validate the proposed graph, state and memory together; resolve invalid or stale inputs before approval. Bind approval to that complete proposal digest, including unchanged memory inputs. If inputs change, reassess and prepare a corrected proposal for approval; never substitute a separate inspection digest for the apply token. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
55
65
 
56
66
  ## Revision provenance
57
67
 
58
- Use `revisions/revision-<id>.md` (including the `revision-` prefix) and include the same path in the approved manifest and operation. Before clearing the revision operation, set `state.commits.spec` and `state.commits.plan` to the revision artifact commit for every spec/plan changed by that commit. Confirm the committed plan has the proposed revisions and graph; a reachable SHA alone is insufficient. For v5, candidate_apply includes stable operation references in the original approval envelope; reconcile them without a follow-up commit. Do not start delivery with pointers to an older revision. Retain the previous execution binding and handoffs while an approved repair operation owns state.
68
+ Use `revisions/revision-<id>.md` (including the `revision-` prefix), with lowercase letters, digits and hyphens in the artifact ID, such as `revisions/revision-2.md` or `revisions/revision-20261001t064657z.md`. Uppercase ISO timestamp letters and dots are not allowed in that basename. Include the same path in the approved manifest and operation. The runtime binds changed `state.commits.spec` and `state.commits.plan` to the revision operation receipt within the approved promotion. Confirm the committed plan has the proposed revisions and graph; a reachable SHA alone is insufficient. candidate_apply includes stable operation references in the original approval envelope; reconcile them without a follow-up commit. Do not start delivery with pointers to an older revision. Retain the previous execution binding and handoffs while an approved repair operation owns state.
@@ -26,3 +26,5 @@ Read any file before quoting or interpreting it. Do not mutate files, run commit
26
26
  ## Bounded reporting
27
27
 
28
28
  This workflow creates no commits. Reuse retained context and the latest mutation receipt when available; status itself is read-only. Report `commit_pending` as unresolved provenance, never as completed delivery. Clear retainedContextToken after context loss. Use diagnostic_read only for explicitly needed full diagnostics; ordinary errors are capped at 8 KiB. Never migrate or normalize historical state from this workflow.
29
+
30
+ When status reports `PROJECT_UPGRADE_REQUIRED`, show its upgrade instructions: use Cadre 3.9.0 to reconcile pending operations and perform the approved schema-2/v5 refresh, then install 4.0.0 and reload the client. Compatible 3.9.0/3.9.1/3.9.2 schema-2/v5 projects need no version-only refresh. Do not mutate metadata from status.
@@ -7,18 +7,20 @@ description: Create or resume a Cadre feature or bug track, including a function
7
7
 
8
8
  ## Cohesive commits and retained context
9
9
 
10
- For v5/schema-2 state, each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
10
+ Each approved operation produces one immutable receipt under `.cadre/receipts/` and a temporary recovery journal under `.cadre/stage/operations/`. Apply returns `receipt` (or the receipt fields directly): `operationId`, `receiptHash`, `trailers`, and `status: commit_pending`. Include the promoted files and receipt in one agent-created Git commit with both exact returned trailers. Commit execution stays with the agent. Use `candidate_apply` with `request: {mode: "reconcile", projectRoot, operationId}` after committing; reconciliation verifies a unique reachable commit and committed artifacts and changes temporary state only. Never add a follow-up record-SHA commit. An operation reference is `op:<operationId>`, not a Git revision to pass directly to shell Git. Resolve it through receipt reconciliation before Git range commands.
11
11
 
12
- Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval.
12
+ Before any dependent delivery, resolve `commit_pending`. On interruption, inspect the persisted recovery journal and original approval; use `candidate_apply` with `request: {mode: "resume", projectRoot, operationId, approvalDigest}` to finish the already-approved promotion. Reconcile an existing commit before creating another. Any drift or ambiguous/forged receipt blocks continuation. Never replace an approved recovery journal or fabricate its approval. Resume checks the approved unchanged-input fingerprints before further writes. `OPERATION_INPUT_DRIFT` preserves the pending operation; retain changed files and deliberately restore the approved inputs or obtain an exact repair approval. Never alter recovery hashes, delete the journal, or repeat product work to bypass this gate.
13
13
 
14
- Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same token across continuation pages. Clear it after compaction, context loss, expiration, or a fresh task. Keep `knownSources` only for compatibility. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
14
+ Use the scheduler and validation in mutation results. Do not immediately request the same status again. For `context_read`, retain `retainedContextToken` only after a complete successful read. Pass it on later reads only while that text remains in context, with the same scope, token and knowledge arguments across continuation pages. Do not add or change `knownSources` midway through a paginated read; changing those arguments invalidates its cursor. Clear it after compaction, context loss, expiration, or a fresh task. Default pages are 48 KiB, maximum 64 KiB. Section identity/content hashes allow reuse despite unrelated file changes; source freshness is checked independently. Required project instructions, full current spec/plan, applicable constraints, and repository instructions remain authoritative. Consume every page and require `contextReady`. An explicit full-source dependency fallback must be read completely and reassessed; do not silently omit guidance.
15
15
 
16
16
  Serialized errors are bounded to 8 KiB. Use `diagnostic_read` with the returned diagnostic ID only when fuller evidence is needed; paginate it. Do not dump cache path lists into conversation. Build outputs belong in the runtime-returned owned `buildCachePath`, never an arbitrary `.cadre/.build-cache` directory.
17
17
 
18
- Legacy SHA records and immutable v1–v4 templates remain evidence. Migrate through one approved refresh at a quiescent boundary before creating a v5 execution. Retain each existing execution's original contract and preserve approvals, completed nodes, findings, journals, and archived learning. The v5 commit instructions here replace legacy follow-up provenance commits described below.
18
+ Existing 3.9.0/3.9.1/3.9.2 projects using schema-2 state and template v5 continue without a version-only refresh. If status reports `PROJECT_UPGRADE_REQUIRED`, stop mutations: install Cadre 3.9.0, reconcile interrupted operations and perform its approved refresh to schema-2/v5 at a quiescent boundary, then install 4.0.0 and reload the client. Preserve approvals, historical journals, SHA references and archived learning; never edit version labels to bypass this gate.
19
19
 
20
20
  Create only `feature` or `bug` tracks. Resume an existing drafting track instead of replacing it.
21
21
 
22
+ Track IDs remain reserved after archive. Inspect both active and archived ownership before proposing a new track; terminal work needs a distinct successor ID. An interrupted older proposal that would duplicate an archived ID requires an approved repair, preserving the archived evidence and pending intent.
23
+
22
24
  At every required clarification or approval boundary, show a concise summary or focused diff. Inspect the active host policy before calling `workflow_elicit`: if the task context reports approval policy `never`, including Codex Full Access, skip the form and ask the same short question once in chat. Otherwise prefer `workflow_elicit`, using `clarification` for at most three questions and `approval` bound to the current proposal digest. Treat only an `approved` result as approval. If it returns `fallback_required`, or immediately returns `declined` while the task explicitly reports policy `never`, ask the same short question once in chat; the latter is policy rejection, not a human decline. Never request secrets or retry the form.
23
25
 
24
26
  ## Required context
@@ -35,15 +37,17 @@ Call `project_status` first with `view: "project"` for a new track or `view: "tr
35
37
  4. Draft an acyclic phase/task graph from that proposed specification. Every regular phase explicitly declares phase dependencies and every regular task explicitly declares same-phase task dependencies. Do not repeat derived barriers: each phase's final `User Manual Verification` depends on every sibling task, while the final `Track-level User Manual Verification` phase contains only its manual task and depends on every preceding phase. Include tests, formatting, documentation, and Definition of Done work explicitly. Do not pass plan Markdown through MCP, write it into canonical `.cadre/`, or create a temporary project copy for validation.
36
38
  5. Build the marked `Pattern Seed` section at the top of `learning.md` from patterns relevant to the proposed spec and plan. Root phases read the seed; other phases read learning from their declared dependency phases. Cite pattern file paths and explain relevance. Do not invent patterns.
37
39
  6. Draft final `state.json` alongside spec, plan and learning. Assign closely related tasks within one phase a ` - Commit group: <slug>`; preserve each task's dependency, verification and handoff requirements. Group dependencies must be acyclic after collapsing internal edges; independent groups may run in parallel.
38
- 7. Author `dependency-context.json` from every transitive dependency's spec and learning. Record spec/plan revisions, direct dependency IDs, the dependency-graph fingerprint, exact source SHA-256s, and stable constraint IDs with source-linked text. Every source needs an explicit applicability assessment, including no applicable constraints when justified. This curated context is part of the same human approval; never silently summarize away uncertain requirements. An empty dependency set uses the supplied template.
40
+ 7. Author `dependency-context.json` from every transitive dependency's spec and learning. Record spec/plan revisions, direct dependency IDs, the dependency-graph fingerprint, exact source SHA-256s, and stable constraint IDs with source-linked text. Source records contain exactly `{path, sha256}`; put applicability assessments in constraints shaped `{id, text, sources: [sourcePath]}`, not extra source fields or a singular `source` field. Every source needs an explicit applicability assessment, including no applicable constraints when justified. This curated context is part of the same human approval; never silently summarize away uncertain requirements. An empty dependency set uses the supplied template.
39
41
  8. Call `candidate_apply` with `request: {mode: "prepare", projectRoot, candidateId: "track-<track-id>", workflow: "track", files: ["spec.md", "plan.md", "learning.md", "state.json", "dependency-context.json"]}`. It validates graphs, state and memory and generates the final state/index. Present the complete proposed content, manifest, commit groups, dependency coverage, and one combined commit. After approval, call `request: {mode: "apply", proposalToken}`. Commit `cadre(track): plan <track-id>` once with receipt trailers, then reconcile. No direct canonical promotion, separate specification commit, index call, or record-plan commit is needed.
40
42
 
41
- For legacy candidates, `candidate_inspect` with exact `planValidations` remains available for diagnostics and the original recovery contract. New tracks use the combined v5 operation.
43
+ For legacy candidates, `candidate_inspect` with exact `planValidations` remains available for diagnostics and the original recovery contract. New tracks use the combined receipt-based operation.
42
44
 
43
45
  Expected human decision count is one for a clear new track; do not create a specification-only approval prompt.
44
46
 
45
47
  The plan is the execution source of truth. Dependency changes or a modified approved spec require the Cadre revise workflow.
46
48
 
49
+ When resuming `drafting-plan`, compare the proposed specification against its reachable approved commit, even if the working copy already contains requested edits. Preserve that approved content, specification revision counter, track revision and dependencies during planning. Unapproved draft-plan counters cannot replace the specification's approval evidence. Route changed approved scope through revise first; an interrupted older planning proposal that replaces it requires an approved repair.
50
+
47
51
  ## Memory contract
48
52
 
49
- Preserve phase history and existing handoffs. For active v3/v4/v5 tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
53
+ Preserve phase history and existing handoffs. For active tracks, keep the marked `cadre:memory` JSON block inside Pattern Seed synchronized with the proposed spec/plan revisions and exact approved pattern hashes. Every applicable pattern requires its safe `patterns/<slug>.md` path, SHA-256, and human-readable relevance/constraints; never invent or silently omit guidance. When a staged plan changes revisions, include the reassessed learning file in `expectedFiles`. Inspect `candidate_inspect.learning` and `memoryInputs` as well as `plans`; resolve invalid or stale memory before approval. Immediately before direct promotion, re-inspect and compare the complete approved digest, including unchanged memory inputs; changed inputs require reassessment and a corrected approval. Archive apply performs this check in the runtime. Completed and archived learning remains historical evidence, not a claim that old hashes describe current patterns.
@@ -96,7 +96,7 @@ drafting-spec -> drafting-plan -> planned -> in_progress -> ready_for_review
96
96
  - Initialization and combined track planning each use one commit. Revise, refresh, clean review and archive each use one approved-operation commit. Implementation uses one product commit per cohesive group plus one completion commit. Revert uses approved reversal commits plus one reconciliation commit. Status and standard Wisp make no commits.
97
97
  - Keep execution journals durable on disk; no automatic execution-start, phase-record, final-verification-phase or clean-evidence-only commits. An explicit handoff/blocker checkpoint is allowed. Reconciliation removes only ignored recovery state and never creates a follow-up provenance commit.
98
98
  - New plans may assign commit groups within a phase. Preserve every task's verification, authorization and handoff, execute internal dependencies in order, and approve all affected siblings before reverting a shared commit. Existing executions retain their original contract.
99
- - Candidate apply validates approved Cadre manifests and promotes state/indexes together. It cannot edit arbitrary product files or execute Git. Migration requires one approved refresh at a quiescent boundary; preserve historical evidence and immutable v1–v4 templates.
99
+ - Candidate apply validates approved Cadre manifests and promotes state/indexes together. It cannot edit arbitrary product files or execute Git. Existing 3.9.x projects with schema-2 state and template v5 continue without migration. Older project formats must be migrated with Cadre 3.9.0 before using 4.0; preserve historical evidence and approvals.
100
100
  - Active dependency-context artifacts carry curated source-linked contracts and inherited constraints under the same approval. Missing/stale coverage triggers explicit reassessment or a identified full-source fallback. Never rewrite archived learning.
101
101
  - Use 48 KiB context pages and retainedContextToken after complete retrieval; clear it after context loss. Source-section hashes permit reuse while source freshness remains independently checked. Mutations return scheduler/validation for reuse.
102
102
  - Use composite record_verification without a separate start. Complete a direct-main phase against verified HEAD in one checkpoint. Integration may fast-forward and may retain only validated owned execution state. Build outputs use the owned ignored `.cadre/.build-cache/cadre/` subtree. Other untracked files remain errors.
@@ -1,5 +0,0 @@
1
- # Cadre-managed temporary execution worktrees
2
- /.worktrees/
3
-
4
- # Disposable Wisp output
5
- /wisps/
@@ -1,6 +0,0 @@
1
- # Pattern Catalog
2
-
3
- Patterns are created only by distilling completed, cleanly reviewed tracks during archival.
4
-
5
- | Pattern | Summary | Provenance | Supersedes |
6
- | --- | --- | --- | --- |
@@ -1,26 +0,0 @@
1
- {
2
- "schemaVersion": 1,
3
- "runtimeVersion": "{{RUNTIME_VERSION}}",
4
- "templateSetVersion": "{{TEMPLATE_SET_VERSION}}",
5
- "project": {
6
- "name": "{{PROJECT_NAME}}",
7
- "context": "{{greenfield|brownfield}}"
8
- },
9
- "setup": {
10
- "status": "in_progress",
11
- "checkpoint": "approved",
12
- "commit": null,
13
- "artifactProgress": [],
14
- "operation": {
15
- "action": "create",
16
- "baseCommit": "{{BASE_COMMIT_OR_NULL}}",
17
- "expectedCommit": "cadre(create): initialize project harness",
18
- "repositoryRoot": "{{PROJECT_ROOT}}",
19
- "gitDisposition": "{{existing|initialize}}",
20
- "approvedArtifacts": [],
21
- "approvedAt": "{{APPROVED_AT}}"
22
- }
23
- },
24
- "lastRefresh": null,
25
- "history": []
26
- }