cadre-ai 3.7.0 → 3.7.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "A human-governed, Git-aware product delivery harness for Codex, Claude Code, and Zed Agent.",
5
5
  "author": {
6
6
  "name": "Cadre contributors"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "A human-governed, Git-aware product delivery harness for Codex, Claude Code, and Zed Agent.",
5
5
  "author": {
6
6
  "name": "Cadre contributors"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## [3.7.1] - 2026-09-07
6
+
7
+ - Fix finding-bearing review and scope-revision candidate inspection using the old `ready_for_review` status and execution graph instead of the proposed lifecycle transition. Canonical state and completed journals remain unchanged before approval.
8
+ - Preserve completed historical track-verification phases and their original dependencies when remediation adds a new final gate; replacement executions retain completed provenance.
9
+ - Keep `context_read` available between approved remediation and replacement execution: label retained completed handoffs as historical evidence, with their recorded revision and graph, instead of treating them as a current-graph mismatch.
10
+ - Reject staged state/plan target conflicts, terminal-track reopening, empty approved plans, and malformed staged plan syntax. Retain active execution and journal integrity checks.
11
+ - Add temporary-project regressions for repeated review, replacement execution, nested revisions, and structured/text MCP responses for Codex, Claude, and Zed client identities.
12
+
5
13
  ## [3.7.0] - 2026-09-06
6
14
 
7
15
  ### Memory, context, and recovery
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Cadre
2
2
 
3
- **Cadre 3.7.0** adds durable task handoffs, freshness-checked learning, selective context with session reuse, and compact status. New projects use template set **v3**; existing projects remain readable and require one approved refresh before delivery. Published v1/v2 templates remain available.
3
+ **Cadre 3.7.1** fixes review and revision proposals that could not obtain an approval digest, preserves completed verification phases when remediation is appended, and keeps historical handoffs readable before replacement execution. It retains durable memory, selective context, and template set **v3**. Existing projects remain readable and use an approved refresh to record the new runtime before delivery; published templates remain unchanged.
4
4
 
5
5
  Cadre is a human-governed, Git-aware delivery harness for Codex, Claude Code,
6
6
  and Zed Agent. Codex and Claude Code support is stable; native Zed Agent support
@@ -407,6 +407,6 @@ pnpm --filter cadre-ai validate
407
407
 
408
408
  ### Memory format upgrade
409
409
 
410
- Cadre 3.7.0 uses template set v3 and requires an approved refresh of older projects before delivery. It preserves v1/v2 templates and terminal learning. Active Pattern Seeds record revisions and exact pattern fingerprints; changed guidance requires reassessment. Task handoffs preserve decisions, failed approaches, uncertainty, and next actions alongside existing checkpoints. Use all `context_read` pages before acting, and retain source inspection and approval gates. Routine `project_status` uses summaries; request `detail: "full"` for history/graph diagnostics. Filtered/paged listings never narrow validation coverage.
410
+ Cadre 3.7.1 uses template set v3 and requires an approved refresh of older projects before delivery. It preserves v1/v2 templates and terminal learning. Active Pattern Seeds record revisions and exact pattern fingerprints; changed guidance requires reassessment. Task handoffs preserve decisions, failed approaches, uncertainty, and next actions alongside existing checkpoints. Use all `context_read` pages before acting, and retain source inspection and approval gates. Routine `project_status` uses summaries; request `detail: "full"` for history/graph diagnostics. Filtered/paged listings never narrow validation coverage.
411
411
 
412
412
  Release preparation includes regression tests, package inspection, and documentation checks. Publishing still requires native installer/discovery/activation checks for Codex, Claude Code, and Zed. Local model tests and byte benchmarks do not establish universal token savings or semantic correctness of generated learning.
@@ -74,7 +74,7 @@ import { dirname, extname, join as join2, relative, resolve as resolve2, sep } f
74
74
  import { fileURLToPath } from "node:url";
75
75
 
76
76
  // src/domain/version.ts
77
- var CADRE_RUNTIME_VERSION = "3.7.0";
77
+ var CADRE_RUNTIME_VERSION = "3.7.1";
78
78
  var TEMPLATE_SET_VERSION = "v3";
79
79
 
80
80
  // src/domain/templates.ts
@@ -21749,7 +21749,10 @@ function findCycles(nodes, owner, errors) {
21749
21749
  for (const node of nodes) visit(node.id, []);
21750
21750
  }
21751
21751
  function validatePlanGraph(path, graph, status, errors) {
21752
- if (!graph.phases.length) return;
21752
+ if (!graph.phases.length) {
21753
+ if (!["drafting-spec", "drafting-plan"].includes(status)) errors.push(`${path}: approved plan must contain phases`);
21754
+ return;
21755
+ }
21753
21756
  if (!Number.isInteger(graph.specRevision) || (graph.specRevision ?? 0) < 1) {
21754
21757
  errors.push(`${path}: Spec revision must be a positive integer`);
21755
21758
  }
@@ -21761,8 +21764,11 @@ function validatePlanGraph(path, graph, status, errors) {
21761
21764
  graph.phases.forEach((phase, phaseIndex) => {
21762
21765
  if (phase.number !== phaseIndex + 1) errors.push(`${path}: phases must be sequential from 1`);
21763
21766
  if (!phase.tasks.length) errors.push(`${path}: ${phase.id} has no tasks`);
21764
- if (phase.trackVerification && phase !== finalPhase) {
21765
- errors.push(`${path}: Track-level User Manual Verification must be the final phase`);
21767
+ if (phase.trackVerification) {
21768
+ phase.dependencies = graph.phases.slice(0, phaseIndex).map((previous) => previous.id);
21769
+ if (phase !== finalPhase && (!phase.completionCommit || !phase.tasks.length || phase.tasks.some((task) => !task.checked))) {
21770
+ errors.push(`${path}: historical Track-level User Manual Verification must be completed with commit provenance`);
21771
+ }
21766
21772
  }
21767
21773
  if (!phase.trackVerification && !phase.dependencyDeclared) {
21768
21774
  errors.push(`${path}:${phase.line}: ${phase.id} must declare phase dependencies`);
@@ -21812,7 +21818,6 @@ function validatePlanGraph(path, graph, status, errors) {
21812
21818
  findCycles(phase.tasks, `${path}:${phase.id}`, errors);
21813
21819
  });
21814
21820
  if (!finalPhase.trackVerification) errors.push(`${path}: final phase must be Track-level User Manual Verification`);
21815
- finalPhase.dependencies = graph.phases.slice(0, -1).map((phase) => phase.id);
21816
21821
  findCycles(graph.phases, path, errors);
21817
21822
  if (["ready_for_review", "completed", "archived"].includes(status)) {
21818
21823
  const pending = graph.phases.flatMap((phase) => phase.tasks).filter((task) => !task.checked);
@@ -21999,13 +22004,14 @@ function collectContext(input) {
21999
22004
  errors.push(`${path}: ${error51 instanceof Error ? error51.message : String(error51)}`);
22000
22005
  }
22001
22006
  }
22002
- const executionId = input.executionId ?? state.operation?.executionId ?? state.lastExecution?.executionId;
22007
+ const executionId = contextInputSchema.shape.executionId.parse(input.executionId ?? state.operation?.executionId ?? state.lastExecution?.executionId);
22003
22008
  if (executionId) {
22004
- contextInputSchema.shape.executionId.parse(executionId);
22005
22009
  const path = `${trackPath}/executions/execution-${executionId}.json`, body = read(path);
22006
22010
  const journal = JSON.parse(body);
22007
22011
  if (journal.trackId !== input.trackId || journal.executionId !== executionId) throw new Error("execution identity mismatch");
22008
- if (journal.graphDigest !== graph.digest) errors.push("execution handoffs belong to a different plan graph; reconcile before use");
22012
+ const differentGraph = journal.graphDigest !== graph.digest || journal.planRevision !== graph.planRevision;
22013
+ const historical = differentGraph && ["planned", "in_progress"].includes(state.status) && journal.status === "completed" && state.lastExecution?.executionId === executionId && state.lastExecution.journal === `executions/execution-${executionId}.json` && state.lastExecution.graphDigest === journal.graphDigest && state.lastExecution.planRevision === journal.planRevision && state.lastExecution.headCommit === journal.headCommit;
22014
+ if (differentGraph && !historical) errors.push("execution handoffs belong to a different plan graph; reconcile before use");
22009
22015
  for (const node of Object.values(journal.nodes)) {
22010
22016
  if (phases && !phases.has(node.phaseId)) continue;
22011
22017
  const handoff = node.handoff === void 0 ? null : handoffSchema.parse(node.handoff);
@@ -22013,10 +22019,18 @@ function collectContext(input) {
22013
22019
  const content = JSON.stringify({
22014
22020
  nodeId: node.id,
22015
22021
  handoff,
22016
- note: handoff ? "Persisted evidence, not authorization" : "not recorded",
22022
+ ...historical ? { historical: true, planRevision: journal.planRevision, graphDigest: journal.graphDigest } : {},
22023
+ note: (historical ? "Historical execution; reassess for the current plan. " : "") + (handoff ? "Persisted evidence, not authorization" : "not recorded"),
22017
22024
  sources: handoff?.sources.map((reference) => ({ ...reference, freshness: sourceFreshness(root, reference, read) })) ?? []
22018
22025
  });
22019
- sources.push({ path, sha256: contentHash(body), section: node.id, reason: "persisted handoff; reconcile journal/Git before resuming", format: "handoff", content });
22026
+ sources.push({
22027
+ path,
22028
+ sha256: contentHash(body),
22029
+ section: node.id,
22030
+ reason: historical ? "historical handoff from retained completed execution; not current execution state" : "persisted handoff; reconcile journal/Git before resuming",
22031
+ format: "handoff",
22032
+ content
22033
+ });
22020
22034
  }
22021
22035
  }
22022
22036
  const identity = {
@@ -23461,8 +23475,8 @@ import { existsSync as existsSync9, lstatSync as lstatSync5, readdirSync as read
23461
23475
  import { isAbsolute as isAbsolute2, join as join8, relative as relative2, resolve as resolve7 } from "node:path";
23462
23476
 
23463
23477
  // src/domain/version.ts
23464
- var CADRE_RUNTIME_VERSION = "3.7.0";
23465
- var LEGACY_RUNTIME_VERSIONS = ["3.6.0", "3.5.1", "3.5.0", "3.4.0", "3.3.0"];
23478
+ var CADRE_RUNTIME_VERSION = "3.7.1";
23479
+ var LEGACY_RUNTIME_VERSIONS = ["3.7.0", "3.6.0", "3.5.1", "3.5.0", "3.4.0", "3.3.0"];
23466
23480
  var TEMPLATE_SET_VERSION = "v3";
23467
23481
  var LEGACY_TEMPLATE_SET_VERSIONS = ["v1", "v2"];
23468
23482
 
@@ -24071,8 +24085,9 @@ function writeTracks(projectRoot, proposalDigest, preparedPreview) {
24071
24085
  }
24072
24086
 
24073
24087
  // src/domain/staged-state.ts
24074
- function validateStagedState(root, candidateId, files) {
24088
+ function validateStagedState(root, candidateId, files, planValidations = []) {
24075
24089
  const canonical = (path) => candidateArtifactPath(candidateId, path);
24090
+ const targets = new Map(planValidations.map((validation) => [canonical(validation.path), validation.targetStatus]));
24076
24091
  const overlay = new Map(files.map((file2) => [canonical(file2.path), file2.content]));
24077
24092
  if (overlay.size !== files.length) throw new Error("Candidate paths alias the same canonical artifact; use one path per artifact");
24078
24093
  const read = (path) => overlay.get(path) ?? readSafeArtifact(root, `.cadre/${path}`);
@@ -24116,13 +24131,36 @@ function validateStagedState(root, candidateId, files) {
24116
24131
  validateTrackOperation(state, path, errors);
24117
24132
  const key = (absolute) => absolute.slice(join9(root, ".cadre").length + 1);
24118
24133
  const plan = `${parent}/plan.md`;
24119
- const graph = overlay.has(plan) || existsSync10(join9(root, ".cadre", plan)) ? parsePlanContent(read(plan), plan) : null;
24120
- if (graph) validatePlanGraph(plan, graph, state.status, errors);
24121
- validateExecutionJournal(join9(root, ".cadre", parent), state, graph, errors, {
24134
+ const graph = overlay.has(plan) || existsSync10(join9(root, ".cadre", plan)) ? parsePlanContent(read(plan), plan, errors) : null;
24135
+ const target = targets.get(plan) ?? state.status;
24136
+ const inspection = {
24122
24137
  read: (absolute) => JSON.parse(read(key(absolute))),
24123
24138
  exists: (absolute) => overlay.has(key(absolute)) || existsSync10(absolute),
24124
24139
  journalPaths: [...paths]
24125
- });
24140
+ };
24141
+ if (overlay.has(path) && target !== state.status) {
24142
+ errors.push(`${path}: staged status ${state.status} conflicts with plan targetStatus ${target}`);
24143
+ }
24144
+ let proposedState = state;
24145
+ if (!overlay.has(path) && target !== state.status) {
24146
+ const workflow = candidateId.split("-")[0];
24147
+ const allowed = workflow === "review" && state.status === "ready_for_review" && target === "in_progress" || workflow === "revise" && ["planned", "in_progress", "ready_for_review"].includes(state.status) && ["planned", "in_progress"].includes(target) || workflow === "track" && ["drafting-spec", "drafting-plan"].includes(state.status) && target === "planned";
24148
+ if (!allowed) errors.push(`${path}: cannot infer ${state.status} -> ${target}; include the proposed state in the candidate`);
24149
+ else {
24150
+ const previous = ["drafting-spec", "drafting-plan"].includes(state.status) ? null : parsePlanContent(readSafeArtifact(root, `.cadre/${plan}`), plan, errors);
24151
+ if (previous) validatePlanGraph(plan, previous, state.status, errors);
24152
+ validateExecutionJournal(join9(root, ".cadre", parent), state, previous, errors);
24153
+ proposedState = { ...state, status: target };
24154
+ }
24155
+ }
24156
+ if (existsSync10(join9(root, ".cadre", path))) {
24157
+ const previous = JSON.parse(readSafeArtifact(root, `.cadre/${path}`));
24158
+ if (["completed", "archived"].includes(previous.status) && !["completed", "archived"].includes(target)) {
24159
+ errors.push(`${path}: terminal tracks cannot be reopened; propose a successor track`);
24160
+ }
24161
+ }
24162
+ if (graph) validatePlanGraph(plan, graph, target, errors);
24163
+ validateExecutionJournal(join9(root, ".cadre", parent), proposedState, graph, errors, inspection);
24126
24164
  if (errors.length) throw new Error(`${path}: ${errors.join("; ")}`);
24127
24165
  }
24128
24166
  }
@@ -36471,7 +36509,6 @@ function createCadreServer() {
36471
36509
  try {
36472
36510
  const root = safeProjectRoot(projectRoot);
36473
36511
  const candidates = readCandidateFiles(root, candidateId, files);
36474
- validateStagedState(root, candidateId, candidates);
36475
36512
  const manifest = candidateManifest(candidates);
36476
36513
  const actualPaths = listCandidatePaths(root, candidateId);
36477
36514
  const expectedPaths = manifest.map((file2) => file2.path);
@@ -36502,6 +36539,7 @@ function createCadreServer() {
36502
36539
  `Candidate planValidations must exactly match staged plan files; expected ${candidatePlanPaths.join(", ") || "none"}, found ${validationPaths.join(", ") || "none"}`
36503
36540
  );
36504
36541
  }
36542
+ validateStagedState(root, candidateId, candidates, normalizedPlanValidations);
36505
36543
  const plans = normalizedPlanValidations.map((validation) => {
36506
36544
  const candidate = candidates.find((file2) => file2.path === validation.path);
36507
36545
  if (Buffer.byteLength(candidate.content, "utf8") > MAX_DRAFT_PLAN_CHARACTERS) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cadre-ai",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "Cross-agent, human-governed software delivery harness",
5
5
  "author": {
6
6
  "name": "Vishal Kumar",
@@ -25,7 +25,9 @@ Expected human decision count is one per review cycle when the human accepts the
25
25
  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.
26
26
  3. Prepare one decision-ready proposal before asking for approval:
27
27
  - 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.
28
+ - 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.
28
29
  - 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.
30
+ - Inspection validates that target status without changing canonical state. Keep the canonical track `ready_for_review` and its completed execution unchanged until approval. If a staged state is included, its status must agree with `targetStatus`; an active execution still requires reconciliation at a safe boundary.
29
31
  - 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
32
  - If no findings exist, present clean-review evidence and the exact completion transition once, then ask approval to complete the track.
31
33
  4. For approved changes, record a resumable `review` operation containing the approved manifest digest and path/hash entries before changing the bug artifact, plan, or state. Promote only those staged files, verify their canonical hashes, increment the plan revision, set state to `in_progress`, reset review readiness, and record the review cycle. Call `tracks_render` once, validate, and commit `cadre(review): request changes for <track-id>` without staging `.cadre/stage/`. 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. Remove only the matching candidate stage after its canonical hashes and commits are recorded. The prior completed execution remains historical until `implement` starts a new execution ID for the changed graph.
@@ -30,6 +30,7 @@ Expected human decision count is one when the requested change and partial-work
30
30
  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.
31
31
  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.
32
32
  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.
33
+ 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.
33
34
  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.
34
35
  8. Before changing approved artifacts, write the rendered `revise` operation into every affected track's `state.json`. Use the same expected commit, record the approved manifest digest and path/hash entries, record per-artifact progress, and advance the durable checkpoint after each promoted staged file.
35
36
  9. Promote only the authorized staged changes, verify their canonical hashes, 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. Call `tracks_render` once without another prompt. Never stage `.cadre/stage/`; remove only the matching candidate stage after its canonical hashes and commits are recorded.