cadre-ai 3.1.0 → 3.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre-ai",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Cross-agent, human-governed software delivery harness",
5
5
  "author": {
6
6
  "name": "Vishal Kumar",
@@ -13,16 +13,16 @@ Call `project_status` first and use its embedded structured validation; do not r
13
13
 
14
14
  Build one bounded archive inventory after selection. Read every selected artifact exactly once, summarize execution journals structurally in one pass, and verify recorded commit reachability in one Git pass. Do not precede reads with line counts, rediscover the same paths, or restart full reads after truncation; continue from the first unread line. Reuse unchanged workflow/product/styleguide context already loaded in the same flow. Fetch known pattern templates directly with one `template_get_many` call; do not call `template_catalog`. The declared mutation surface is `archive_batch_preview`/`archive_batch_apply` followed by `archive_batch_record_preview`/`archive_batch_record_apply`; do not inspect the installed runtime or tool catalog for alternatives.
15
15
 
16
- Expected human decision count is one for an explicit or uniquely eligible selection and its complete batch. An ambiguous multi-track invocation may require one selection response followed by one complete batch approval. Ask again only when the selection, content, digest-bound proposal, or consequences change.
16
+ Expected human decision count is one for the complete batch. Ask again only when its selection, content, or consequences change.
17
17
 
18
- 1. Accept an explicit list of track IDs or `all completed`. If selection is omitted and exactly one track is eligible, use that unique track as the proposed selection and include it in the complete batch proposal without a selection-only approval. If multiple tracks are eligible or the request is otherwise ambiguous, list them and ask which to include. Preserve the approved order and remove duplicates.
18
+ 1. Accept an explicit list of track IDs. When selection is omitted or the human says `all completed`, omit `selectedTracks`; the server selects every eligible completed track in dependency order. Preserve an explicit order and remove duplicates.
19
19
  2. Verify the entire selection before changing anything. Every selected track must be `completed`, have clean centralized `state_validate`, and have no pending state mutation. Do not recompute its DAG, manual-verification barriers, or review evidence inside archive; those are completed-state invariants. Reject the batch without partial mutation if any selected track is ineligible. Ignore completed tracks that were not selected.
20
20
  3. If an in-progress `.cadre/operations/archive-<timestamp>.json` exists, reconcile it before accepting a new batch. Resume from its first incomplete checkpoint. If its journal, files, Git state, or expected commit disagree, stop and present the mismatch.
21
21
  4. Distill durable, evidenced learning across the selected tracks as one corpus; discard track-specific trivia. Merge, replace, split, or retire existing patterns when justified, preserving provenance to every contributing track/phase/task commit. Reconcile overlapping or conflicting learning once so batch order cannot silently change the result.
22
22
  5. Compute relevant Pattern Seed section changes in `learning.md` for every non-completed, non-archived track using the final proposed pattern set. Never seed by keyword alone; explain semantic relevance.
23
- 6. Call `archive_batch_preview` with the ordered selection and exact consolidated pattern/index and active-track seed updates. Present its complete moves, lifecycle states, operation journal, content diffs, generated `tracks.md`, and both expected commits as one batch proposal. Obtain one explicit approval for that complete digest-bound batch; a partial or changed approval requires a new preview. Do not ask separately for a uniquely eligible track.
24
- 7. After approval, pass the unchanged digest to `archive_batch_apply`. It journals before mutation, moves the selected directories, writes the approved content and exact post-archive index, and returns embedded validation. Commit all approved archive moves and derived changes together using the proposal's expected commit.
25
- 8. Pass the resulting archive commit SHA to `archive_batch_record_preview`, verify it only records the already-approved provenance in every selected track, project history, and batch journal, then call `archive_batch_record_apply` with its unchanged digest. This bookkeeping is part of the approved batch and needs no second human approval unless it differs from the original proposal. Create `cadre(archive): record batch <batch-id>`.
23
+ 6. Call `archive_batch_preview` with structured updates: `pattern` plus slug, `pattern_index`, or `active_track_seed` plus track ID. Fetch exact template IDs (`project/pattern`, `project/patterns/index`, and `track/learning`) when needed. Present its complete moves, lifecycle states, content diffs, generated index, and expected commits as one proposal and obtain one explicit approval.
24
+ 7. After approval, pass only the returned proposal token to `archive_batch_apply`. Commit all approved moves and derived changes together using the proposal's expected commit.
25
+ 8. Call `archive_batch_record_preview` with the project root and batch ID; it derives the actual current HEAD. Verify its deterministic provenance update, then pass only its proposal token to apply. This bookkeeping needs no second approval. Create `cadre(archive): record batch <batch-id>`.
26
26
  9. Use the final apply result instead of redundant `state_validate` or `project_status` calls when it is valid/current. Verify only the clean worktree and the two expected commits.
27
27
 
28
28
  If interrupted before the archive commit, reconcile the batch journal and resume its first incomplete track or artifact through the same approved input. If the worktree is clean and HEAD matches the journal's expected commit and base relationship, treat the archive commit as successful and record that SHA. If the SHA is recorded but follow-up state is uncommitted, finish only the state commit. Never repeat completed moves, redistill from a partial selection, or start a second archive batch while one is active.
@@ -18,10 +18,10 @@ At every required clarification or approval boundary, show a concise summary or
18
18
  5. Draft `product.md`, `guidelines.md`, and `tech-stack.md`. Resolve any material ambiguity through targeted questions; do not invent product behavior, constraints, or stack decisions.
19
19
  6. Identify the proposed `workflow.md` by template ID, template-set version, content hash, and a concise summary of its material rules and consequences. Do not print the complete unchanged bundled workflow unless the human asks. If changes are requested, show a focused diff and summarize the resulting behavior; show the complete revised workflow only on request. Do not create a standalone workflow approval.
20
20
  7. Call `styleguide_resolve` with the proposed technologies. Always include the general guide and resolve the applicable language, framework, markup, and build-tool guides as one set. Preserve evidenced brownfield conventions. Ask only when a material convention choice cannot be resolved from the request and repository; do not ask the human to accept each default guide or the final set separately.
21
- 8. Call `project_init_preview` with only the proposed caller-supplied files and metadata. Do not pass `patterns/index.md` or any other MCP-derived output. Expected human decision count is one when root, classification, and material configuration choices are clear. Present one complete initialization envelope containing concise product/engineering/stack summaries, workflow identity and summary, styleguide set and amendments, the complete target-path and SHA-256 manifest, generated-state summary, context classification, project root, Git disposition, consequences, and proposal digest. Identify unchanged defaults by path and hash instead of printing full contents; show changed content or focused diffs when material or requested. After explicit confirmation, call `project_init_apply` with the unchanged inputs and digest. This one approval authorizes unchanged Git initialization, validation, setup commits, derived `tracks.md`, and provenance bookkeeping; do not add later approval prompts for those deterministic consequences. The audit-only `approvedAt` timestamp may reflect the final approval and is excluded from the semantic proposal digest. The apply atomically creates mutable `.cadre` state and approved context only; it never installs a runtime or template copies there.
21
+ 8. Call `project_init_preview` with only the proposed caller-supplied files and metadata. Do not pass `patterns/index.md` or any other MCP-derived output. Expected human decision count is one when root, classification, and material configuration choices are clear. Present one complete initialization envelope containing concise product/engineering/stack summaries, workflow identity and summary, styleguide set and amendments, the complete target-path and SHA-256 manifest, generated-state summary, context classification, project root, Git disposition, and consequences. After explicit confirmation, pass only its opaque proposal token to `project_init_apply`. This one approval authorizes unchanged Git initialization, validation, setup commits, derived `tracks.md`, and provenance bookkeeping; do not add later approval prompts for those deterministic consequences. The apply atomically creates mutable `.cadre` state and approved context only; it never installs a runtime or template copies there.
22
22
  9. If Git disposition is `initialize`, run `git init` only at the approved root, verify `git rev-parse --show-toplevel` equals that root, then call `setup_record_git_initialized`. If Git is unavailable, initialization fails, or a different repository appears, stop with the setup journal intact. For an existing repository, verify its root again.
23
23
  10. Call `state_validate` and report the result. Commit the authorized setup as `cadre(create): initialize project harness` only when validation is clean and checkpoint is `commit-pending`; validation failure is a blocker, not a request to approve an exception implicitly.
24
- 11. Call `setup_record_commit` with that SHA, then call `tracks_render_preview` and `tracks_render_apply` with its unchanged digest if needed. Commit the bookkeeping as `cadre(create): record setup commit` without another prompt and report the concise final result.
24
+ 11. Call `setup_record_commit`; it records the actual current HEAD. If the index needs regeneration, call `tracks_render_preview` and pass only its proposal token to apply. Commit the bookkeeping as `cadre(create): record setup commit` without another prompt and report the concise final result.
25
25
 
26
26
  ## Resume protocol
27
27
 
@@ -22,12 +22,12 @@ Call `project_status`, `execution_graph_validate`, and `worktree_status` before
22
22
  Select and persist one approval mode independently of scheduling:
23
23
 
24
24
  - `governed`: present every regular task diff before commit, every conflict resolution, every manual-verification barrier, and every integration or other material mutation required by the approved workflow.
25
- - `phase` (default): run all regular work inside a phase autonomously, including task commits, clean integrations, conflict resolution within approved scope, worktree lifecycle, journal/index updates, and bookkeeping. Pause exactly once for that phase's final `User Manual Verification` task. The final track-level verification phase is also a phase and therefore pauses at its single verification task.
25
+ - `phase` (default): run all regular work inside a phase autonomously, but pause once for each phase's final `User Manual Verification` task.
26
26
  - `autonomous`: run regular work and phase-level verification autonomously. Pause only for the `Track-level User Manual Verification` task.
27
27
 
28
- Use `phase` unless the human explicitly requests `governed` or `autonomous`. Record the selected `approvalMode` in both the execution journal and active track operation. A mode authorizes only work already bounded by the approved spec and plan; any material ambiguity, scope divergence, failed required check, unsafe state, or need for new authority is a blocker or clarification, not an approval prompt. Changing approval mode during execution requires an approved clean boundary and a journaled update.
28
+ Use `phase` unless the human explicitly requests `governed` or `autonomous`. On resume, inherit the journaled mode. Record it in both the execution journal and active track operation. A mode authorizes only work already bounded by the approved spec and plan; any material ambiguity, scope divergence, failed required check, unsafe state, or need for new authority is a blocker or clarification, not an approval prompt. Changing approval mode during execution requires an approved clean boundary and a journaled update.
29
29
 
30
- For a new execution, the human's `implement` invocation authorizes an exact execution start using the requested modes or their documented defaults. Call `execution_start_preview` and pass its unchanged digest to `execution_start_apply`. In `phase` or `autonomous`, do not add an execution-start approval prompt; report a concise start summary and proceed. In `governed`, present the start proposal when the current workflow requires that mutation gate. The generated `tracks.md` update and execution-start bookkeeping are deterministic consequences of the same authorization: preview/apply and commit them without another human approval when unchanged. Stop for clarification if the preview exposes a material choice or consequence not covered by the approved plan and invocation. For an existing `implement` operation, reconcile it instead of creating another execution.
30
+ For a new execution, the human's `implement` invocation authorizes an exact execution start using the requested modes or their documented defaults. Call `execution_start_preview`, then pass only its opaque `proposalToken` to `execution_start_apply`. Do not add an execution-start approval prompt outside `governed`; report a concise start summary and proceed. The server derives the execution ID, timestamp, and current Git base. Generated bookkeeping is a deterministic consequence of the same authorization. For an existing `implement` operation, reconcile it instead of creating another execution.
31
31
 
32
32
  ## Resume before scheduling
33
33
 
@@ -49,9 +49,9 @@ Before creating workers, inspect the approved plan, repository scripts, lockfile
49
49
 
50
50
  ## Schedule the DAG
51
51
 
52
- The Cadre tools named in this skill are declared contracts: call them directly. Do not list the global tool catalog, rediscover schemas, or probe previews to learn legal transitions. Call `execution_status` when resuming an execution or when no mutation response is available, then use its `transitionGuidance` to construct legal transitions with the required evidence. After a successful execution mutation, use its returned `derivedStatus` instead of making a redundant status call. Every preview exposes the apply-ready digest as `proposalDigest`; pass that value unchanged instead of guessing field names.
52
+ The Cadre tools named in this skill are declared contracts: call them directly. Do not list the global tool catalog, rediscover schemas, or probe previews to learn legal transitions. Call `execution_status` when resuming or when no mutation response is available. Use `execution_checkpoint_preview` with a semantic event (`start`, `record_commit`, `record_integration`, `record_verification`, `complete`, `block`, or `resume`); it expands the event into all required legal transitions. Pass only its `proposalToken` to `execution_checkpoint_apply`, then reuse the returned `derivedStatus`.
53
53
 
54
- Use `execution_nodes_preview` and `execution_nodes_apply` when one already-approved scheduling or bookkeeping decision produces multiple immediately valid transitions. Never batch across a human approval, commit, verification, integration, conflict resolution, or other external action whose evidence does not exist at preview time. Once that evidence exists, batch the consecutive journal transitions it unlocks: for example, record verified/authorized task progress through `committed` in one batch after the commit exists, record `integrated` through `completed` after merge evidence exists, and complete a cleaned phase while starting already-ready dependents in one batch. Preview validates a constructed transition; it is never a trial request used to discover the state machine. Plan display order breaks ties only.
54
+ Never checkpoint evidence before it exists. `record_commit` consumes the verified commit and its authorization; `record_integration` consumes the merge commit and post-merge verification; `record_verification` records a manual barrier. Plan display order breaks scheduling ties only.
55
55
 
56
56
  - A root phase reads the Pattern Seed. Any other phase reads learning from all declared dependency phases.
57
57
  - Treat the track as a hierarchical DAG: phase dependencies determine active phases, task dependencies determine ready work inside each running phase, and main schedules one global ready queue subject to `maxWorkers`. Different phases may use different execution modes concurrently.
@@ -60,7 +60,7 @@ Use `execution_nodes_preview` and `execution_nodes_apply` when one already-appro
60
60
  - Create every task-worker wave from the same recorded clean phase HEAD. Merge ready tasks into the phase worktree one at a time; derive the next wave only after those merges, so downstream tasks start from the updated phase HEAD.
61
61
  - The main agent creates every worker. On Codex, use an available implementation worker subagent with the bounded prompt below. On Claude Code, prefer the plugin-provided `cadre-phase-worker` and `cadre-task-worker`. Do not use Claude agent teams.
62
62
  - If only one safe execution node is ready, execute it in main.
63
- - Phase and task worktrees are siblings. Use `worktree_create_preview` and `worktree_create_apply`; the MCP derives a task's phase from its `T<phase>.<task>` node ID, so omit redundant `phaseId`. Record the returned absolute path/branch through an execution-node batch before spawning. In `phase` and `autonomous`, these deterministic worktree and journal mutations run under the implementation authorization without another approval. In `governed`, present them when the current workflow requires an explicit mutation approval.
63
+ - Phase and task worktrees are siblings. Use `worktree_create_preview`, then apply only its proposal token. The MCP derives both the task phase and correct parent HEAD, so omit `phaseId` and `baseCommit`. Record the returned absolute path/branch with a `start` checkpoint before spawning. In `phase` and `autonomous`, these deterministic mutations run without another approval.
64
64
 
65
65
  ### Worker prompt contract
66
66
 
@@ -83,7 +83,7 @@ Provide the exact absolute worktree, track/execution/node IDs, approved outcome,
83
83
  4. For a task worker, call `integration_preview` for the exact task merge. The MCP derives its parent as the registered phase worktree when one exists, otherwise the canonical worktree. Use the canonical fallback only for an explicitly direct, single-task phase; create a phase integration worktree before delegated work in multi-task or phase-verified delivery. In `governed`, show the merge when required by the workflow. In `phase` or `autonomous`, apply a clean in-scope merge without another approval. A task executed directly by main or internally by a phase worker is already on its parent branch: verify its commit is reachable and do not invent an integration step. For a phase worktree, use the same digest gate for phase-to-canonical integration. Never squash.
84
84
  5. If integration reports conflicts, mark `conflicted`. Resolve task conflicts in the phase worktree and phase conflicts in main, read every conflicted file and both sides, and rerun combined verification. In `governed`, present the resolution for approval. In `phase` or `autonomous`, apply and record an unambiguous in-scope resolution autonomously; stop for clarification when the resolution requires a material product or scope choice.
85
85
  6. For a worker worktree, mark the node `integrated`, then preview/apply worktree cleanup. Cleanup must refuse dirty, conflicted, or unintegrated work and must not force branch deletion. Cleanups in `phase` and `autonomous` never create a separate approval prompt.
86
- 7. Mark a task complete after its worker integration, or after its approved direct/phase-worker commit is verified on the parent branch. Mark it complete in `plan.md` with its reachable task commit SHA during canonical phase bookkeeping.
86
+ 7. Mark a task complete after its worker integration, or after its approved direct/phase-worker commit is verified on the parent branch. The execution journal is the live provenance source; finalization writes the plan markers atomically.
87
87
 
88
88
  Every regular task in a phase has its own Conventional Commit and distinct recorded SHA, including tasks executed sequentially by one phase worker. Manual-verification nodes may record the approved phase-head or merge evidence instead of inventing an empty commit. A phase must remain `running` until every sibling task and its manual-verification barrier are `completed`; only then may it advance to approval, commit, integration, and cleanup.
89
89
 
@@ -101,6 +101,6 @@ Git commits are durability and provenance boundaries, not journal-transition bou
101
101
  When all journal nodes and plan tasks are complete, all phase learning/provenance is recorded, all worktrees are removed, and track verification is approved:
102
102
 
103
103
  1. Run the relevant full checks and inspect the final diff/history.
104
- 2. Call `execution_finish_preview` after the approved track-level verification. Its completed journal, `ready_for_review` transition, and derived `tracks.md` update share one digest and apply together; do not call `tracks_render_preview` as a repair step. Validation and the single `cadre(implement): ready <track-id>` checkpoint are deterministic consequences of that approval, so complete them without another prompt when unchanged.
104
+ 2. Record that approval with `record_verification`, then call `execution_finish_preview`. It derives HEAD/time and atomically proposes plan commit markers, the completed journal, `ready_for_review` state, and `tracks.md`; pass only its proposal token to apply. Do not repair markers or the index separately, and do not ask for another approval.
105
105
 
106
106
  Never mark a track `completed`; only an approved clean `review` may do that.
@@ -19,6 +19,6 @@ Expected human decision count is one on the clean path. The exact revert proposa
19
19
  4. Call `template_get_many` for `track/revert-operation`, render the approved operation into `state.json.operation`, and persist it before any Git mutation. Record the target kind/ID, safe reverse commit order, base commit, expected reconciliation commit, approved artifacts, approval time, checkpoint, and applied revert commits. Resume a matching operation; never replace it.
20
20
  5. Reach the authorized quiescent execution boundary before reverting. Use `git revert` to create additive reversal commits, using the correct mainline parent for an approved merge-commit revert. After each successful revert commit, record its SHA and advance the operation checkpoint. If a conflict has one unambiguous in-scope resolution that preserves the approved resulting semantics, resolve and verify it inside the envelope. If it introduces a material choice or changes the proposed result, stop and present one corrected proposal rather than accumulating per-file approval prompts.
21
21
  6. Reconcile plan checkboxes without erasing provenance, append a revert history entry, set the earliest affected task/phase back to pending or blocked, and mark dependent tracks for approved revision/reseed as needed.
22
- 7. Run relevant tests, report the resulting diffs, preview and apply `tracks.md` through `tracks_render_preview` and `tracks_render_apply` with its unchanged digest, and call `state_validate`. Commit Cadre bookkeeping as `cadre(revert): reconcile <track-id>`, record that commit, clear the operation, and create a follow-up record commit when the bookkeeping cannot be included safely. Do not turn these deterministic consequences into a second approval. On resume, never repeat a revert SHA already recorded by the operation.
22
+ 7. Run relevant tests, report the resulting diffs, preview `tracks.md` and pass only its proposal token to apply, then validate. Commit Cadre bookkeeping as `cadre(revert): reconcile <track-id>`, record that commit, clear the operation, and create a follow-up record commit when the bookkeeping cannot be included safely. Do not turn these deterministic consequences into a second approval. On resume, never repeat a revert SHA already recorded by the operation.
23
23
 
24
24
  If exact commit provenance is missing or commits mix unrelated work, stop with a precise manual recovery plan.
@@ -28,7 +28,7 @@ Expected human decision count is one per review cycle when the human accepts the
28
28
  - Present the findings, exact artifact/plan diff, consequences, and choices together. One response may approve both the finding disposition and the unchanged exact artifacts. The human may instead request a subset or different remediation, reject all findings while explicitly accepting their risks and approve clean completion, or stop without mutation.
29
29
  - 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.
30
30
  - If no findings exist, present clean-review evidence and the exact completion transition once, then ask approval to complete the track.
31
- 4. For approved changes, record a resumable `review` operation before changing the bug artifact, plan, or state. Increment the plan revision, set state to `in_progress`, reset review readiness, and record the review cycle. Call `tracks_render_preview`, show and apply its unchanged digest with `tracks_render_apply`, call `state_validate`, and commit `cadre(review): request changes for <track-id>`. Record that commit SHA as the new approved plan commit, clear the operation, and use `cadre(review): record changes for <track-id>` for follow-up bookkeeping when needed. The prior completed execution remains historical until `implement` starts a new execution ID for the changed graph.
32
- 5. For an approved clean review, including an explicit reject-and-complete decision, bind the clean cycle and any accepted risks to `lastExecution.executionId`, its plan revision, graph digest, and reviewed HEAD. Call `review_complete_preview` with the exact approval record, evidence, and accepted risks, then pass its unchanged digest to `review_complete_apply`; this writes the completed track state and derived index together and returns final validation. Do not repeat `tracks_render_*`, `state_validate`, or `project_status` when that result is valid/current. If the preview differs materially from the transition already shown to the human, present the correction and obtain new approval before apply. Commit `cadre(review): complete <track-id>`.
31
+ 4. For approved changes, record a resumable `review` operation before changing the bug artifact, plan, or state. Increment the plan revision, set state to `in_progress`, reset review readiness, and record the review cycle. Call `tracks_render_preview` and pass only its proposal token to apply, validate, and commit `cadre(review): request changes for <track-id>`. Record that commit SHA as the new approved plan commit, clear the operation, and use `cadre(review): record changes for <track-id>` for follow-up bookkeeping when needed. The prior completed execution remains historical until `implement` starts a new execution ID for the changed graph.
32
+ 5. For an approved clean review, call `review_complete_preview` with the range start, exact approval record, and accepted risks. It derives and verifies the current execution HEAD, range end, and timestamp. Pass only its proposal token to apply; this writes completed state and the derived index together. Do not repeat index or validation calls when its result is current. Commit `cadre(review): complete <track-id>`.
33
33
 
34
34
  Repeat review → implement → review until a human approves a clean review. Only this command may mark a track completed.
@@ -32,5 +32,5 @@ Expected human decision count is one when the requested change and partial-work
32
32
  6. Increment the track revision exactly once. Increment the specification revision only if `spec.md` changes and the plan revision only if `plan.md` changes; keep the revision values in `state.json`, `spec.md`, `plan.md`, and the marked Pattern Seed consistent. Preserve completed task provenance, update explicit regular phase/task dependencies, and restore derived manual-verification barriers. When the plan changes, call `execution_graph_validate_draft` with the complete proposed plan Markdown and the intended post-approval target status; do not validate the stale canonical plan or create a temporary project copy. A changed plan graph uses a new execution ID; never reuse a completed or superseded execution journal.
33
33
  7. Present the target revision, partial-work disposition, quiescence actions, all cascading dependent-track changes, validation evidence, lifecycle transitions, expected commits, generated index updates, and provenance bookkeeping together. Wait for one explicit approval. Partial approval narrows the change set and requires a fresh impact assessment, transition calculation, and proposal.
34
34
  8. Before changing approved artifacts, write the rendered `revise` operation into every affected track's `state.json`. Use the same expected commit, record each approved artifact and per-artifact progress, and advance the durable checkpoint after each write.
35
- 9. Apply only the authorized changes, update relevant marked Pattern Seed sections without overwriting phase learning, set the approved source-to-target states, mark the earliest affected plan nodes pending in the replacement execution graph, and append track-local history. Do not add singular active phase/task fields to track state. Preview and apply `tracks.md` through `tracks_render_preview` and `tracks_render_apply` using its unchanged digest without another prompt.
35
+ 9. Apply only the authorized changes, update relevant marked Pattern Seed sections without overwriting phase learning, set the approved source-to-target states, mark the earliest affected plan nodes pending in the replacement execution graph, and append track-local history. Do not add singular active phase/task fields to track state. Preview `tracks.md` and pass only its proposal token to apply without another prompt.
36
36
  10. Call `state_validate` and commit `cadre(revise): update <track-id>`. Reconcile interruption using the workflow journal rules. Record the commit in every revision entry, clear each completed operation, and use a follow-up `cadre(revise): record <track-id>` commit when bookkeeping cannot be part of the artifact commit. These unchanged deterministic consequences remain inside the revision authorization envelope.
@@ -16,7 +16,7 @@ Treat semantic content, scope, and consequences as proposals until the human rev
16
16
 
17
17
  Present exact content or focused diffs, consequences, unknowns, and verification evidence once at the decision boundary. Combine related decisions whenever their complete artifacts and consequences are available together. In particular, do not split create configuration from initialization, a clear track specification from its validated plan, finding disposition from prepared remediation, project refresh from its exact cascading track changes, revert intent from deterministic reconciliation, reject-all risk acceptance from clean-review completion, or a uniquely determined archive selection from its full batch proposal. A response must unambiguously approve every included semantic consequence. Require a corrected proposal and new approval only when content, scope, selection, digest-bound semantics, verification exceptions, or newly discovered consequences materially change.
18
18
 
19
- An `implement` invocation authorizes execution using its persisted `approvalMode`: `governed`, `phase`, or `autonomous`. This is scoped authorization for work already bounded by the approved specification and plan, not permission to guess through material ambiguity, expand scope, waive required checks, perform destructive or remote actions, or conceal conflicts and exceptions. `phase` is the default unless the human explicitly requests another approval mode. Starting a `phase` or `autonomous` execution from that invocation does not require a separate approval prompt.
19
+ An `implement` invocation authorizes execution using its persisted `approvalMode`: `governed`, `phase`, or `autonomous`. This is scoped authorization for work already bounded by the approved specification and plan, not permission to guess through material ambiguity, expand scope, waive required checks, perform destructive or remote actions, or conceal conflicts and exceptions. `phase` is the default unless the human explicitly requests another approval mode; a resumed execution inherits its recorded mode. Starting a `phase` or `autonomous` execution from that invocation does not require a separate approval prompt.
20
20
 
21
21
  ### Human interaction forms
22
22
 
@@ -57,7 +57,7 @@ Advance the checkpoint after each durable artifact write. Once an artifact commi
57
57
 
58
58
  During `create`, detect an existing worktree with `git rev-parse --show-toplevel` and never initialize a nested repository. If no worktree exists, record the approved project root and `initialize` disposition through the MCP initialization preview/apply gate before running `git init` there. Verify the resulting root and record that checkpoint before the setup commit. Resume a pending initialization from the journal; stop if the observed repository conflicts with the recorded disposition or root.
59
59
 
60
- For deterministic MCP mutations, call the read-only preview immediately before apply and pass its digest unchanged. Show the exact proposal to the human whenever the owning workflow and persisted approval mode require a human decision. In `phase` or `autonomous` implementation, execution start plus deterministic worktree, clean integration, cleanup, journal, index, and bookkeeping mutations already covered by the implementation invocation do not create new approval prompts. A changed digest that changes content or consequences requires a corrected proposal at the next applicable approval barrier; a stale digest caused only by an internal ordering error must be refreshed before presentation rather than forcing duplicate approval. The MCP never grants approval or replaces required repository inspection. Its Git surface is limited to constrained, digest-gated Cadre worktree creation, integration, and safe cleanup; it accepts no arbitrary command, path, force deletion, or automatic conflict resolution.
60
+ For deterministic MCP mutations, call the read-only preview immediately before apply and pass only its opaque proposal token. Do not inspect the global tool catalog or probe previews to rediscover declared contracts. Show the exact proposal whenever the owning workflow and persisted approval mode require a human decision. In `phase` or `autonomous` implementation, execution start plus deterministic worktree, clean integration, cleanup, journal, index, and bookkeeping mutations already covered by the invocation do not create new approval prompts. A stale token is refreshed before presentation rather than forcing duplicate approval. The MCP never grants approval or replaces required repository inspection. Its Git surface is limited to constrained Cadre worktree creation, integration, and safe cleanup; it accepts no arbitrary command, path, force deletion, or automatic conflict resolution.
61
61
 
62
62
  Resuming a recorded authorization envelope never requires another human approval when the operation journal has the same approval/content digest and the newly previewed artifacts are identical to the approved proposal, with only checkpoint progress changed. Any content, selection, semantic consequence, or approval-digest mismatch requires a corrected proposal and new approval.
63
63
 
@@ -106,7 +106,7 @@ Legal track statuses are `drafting-spec`, `drafting-plan`, `planned`, `in_progre
106
106
  Persist one independent implementation approval mode:
107
107
 
108
108
  - `governed`: require human approval for every regular task diff and commit, conflict resolution, manual-verification barrier, and material integration transition.
109
- - `phase` (default): execute regular task work, commits, integrations, conflict resolution within approved scope, worktree lifecycle, generated state, and bookkeeping autonomously; pause exactly once at each phase's final `User Manual Verification` task.
109
+ - `phase` (default): execute regular work autonomously but pause at each phase's final `User Manual Verification` task.
110
110
  - `autonomous`: execute regular work and phase-level verification autonomously; pause only at `Track-level User Manual Verification`.
111
111
 
112
112
  All modes stop for a material ambiguity, scope or compatibility decision, failed required check needing an exception, unsafe or mismatched state, destructive action, remote publication, or other authority not granted by the approved spec, plan, and execution. Such a stop is a clarification or blocker, not a routine approval gate. Track-level manual verification always requires the human.
@@ -124,11 +124,11 @@ Cadre worktrees use sibling namespaces because one worktree cannot safely contai
124
124
  .cadre/.worktrees/<track>/<execution>/tasks/P1--t1-1
125
125
  ```
126
126
 
127
- Git ancestry comes from the recorded base commit, not directory nesting. All independent task workers in one dependency wave branch from the same clean phase HEAD; after their merges, the next wave branches from the updated phase HEAD. A task-worker branch merges without squashing into the registered phase integration worktree when one exists. Direct canonical integration is reserved for an explicitly main-coordinated single-task phase; multi-task or phase-verified delivery creates a phase integration worktree first. Tasks executed internally by a phase worker are already on that phase branch and do not get a redundant task merge. Phase branches merge without squashing, one at a time, into the canonical branch. The main agent performs every preview/apply gate and journal transition. Cadre tool names declared by the active skill are direct contracts: do not list the global tool catalog, rediscover schemas, or probe previews to learn legal transitions. Read `execution_status.transitionGuidance`, use a mutation result's `derivedStatus`, and pass each preview's `proposalDigest` unchanged. Worktree tools derive a task's phase from its task node ID, so omit redundant `phaseId`. A worker commit is recorded immediately in the execution journal; the plan task becomes complete only after canonical integration and records that reachable worker commit SHA.
127
+ Git ancestry is derived from the current canonical or registered phase-worktree HEAD. Task branches merge without squashing into the registered phase worktree when one exists, otherwise into canonical main for explicitly main-coordinated work. Phase branches merge without squashing into canonical main. Cadre tool names are direct contracts: semantic execution events use `execution_checkpoint_preview`/`execution_checkpoint_apply`, and every apply receives only the opaque proposal token returned by preview. Worktree tools derive phase and base from the node ID and current Git state.
128
128
 
129
129
  1. Load this workflow and the full current track. Validate the DAG and reconcile the execution journal, Git worktrees, branch tips, dirty files, and recent commits before scheduling.
130
130
  2. Root phases read the marked Pattern Seed. Every other phase reads learning from all declared dependency phases; parallel sibling phases do not assume each other's learning.
131
- 3. Derive ready phases and tasks from completed dependencies, combine ready tasks from every running phase into one global queue, and allocate workers by the critical path, downstream work unblocked, then plan order. When one approved decision yields multiple transitions that are already valid, use the ordered `execution_nodes_preview`/`execution_nodes_apply` batch. Never batch across a human approval, commit, verification, integration, conflict resolution, or other external evidence boundary whose evidence does not yet exist. Once evidence exists, batch the consecutive transitions it unlocks, including verified/authorized task progress through `committed`, post-merge `integrated` through `completed`, and cleaned phase completion plus ready-dependent starts. A preview validates a constructed transition; it is not a state-machine probe.
131
+ 3. Derive ready work from the journal and allocate workers by critical path, downstream work unblocked, then plan order. Send semantic checkpoint events only after their commit, verification, integration, or approval evidence exists; the server expands each event into its complete legal transition sequence.
132
132
  4. Follow read-before-edit and keep every worker limited to its assigned node and worktree.
133
133
  5. Write/update tests and documentation required by the spec and Definition of Done.
134
134
  6. Run focused checks per task, combined phase checks after task integration, and the relevant broader suite after conflict resolution, phase integration, and before track verification. Record command, working directory, result, and verified product HEAD/tree; reuse a passing result while product files, test inputs, and policy are unchanged. `.cadre/**`-only bookkeeping does not invalidate product verification.
@@ -139,7 +139,7 @@ Git ancestry comes from the recorded base commit, not directory nesting. All ind
139
139
  11. Remove a worktree with `git worktree remove` and delete its branch without force only after clean, recorded integration. Never delete dirty, conflicted, unintegrated, or mismatched work.
140
140
  12. Append dependency-aware phase learning. Do not overwrite earlier learning.
141
141
 
142
- Product task commits remain distinct provenance boundaries. Cadre-only plan, learning, journal, and index bookkeeping is committed once per phase checkpoint and once at final ready-for-review; do not create a Git commit for each intermediate execution status or worktree metadata update. Execution finish applies the completed journal, `ready_for_review` state, and derived `tracks.md` together under one digest, so do not run a separate index-repair workflow.
142
+ Product task commits remain distinct provenance boundaries. Cadre-only learning and journal bookkeeping is committed at meaningful checkpoints, not per internal status. Execution finish derives HEAD/time and atomically applies plan evidence, the completed journal, `ready_for_review` state, and `tracks.md`, so do not run marker or index repair workflows.
143
143
 
144
144
  ## Definition of Done
145
145