[93m[1m! [0m agent "general" is a subagent, not a primary agent. Falling back to default agent
{"type":"step_start","timestamp":1777303155374,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf85f2a800113YAUsfiCgoZHX","messageID":"msg_dcf85d3d8001Ut8AJkN03PhiFr","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","snapshot":"7c76d840b164ba0ca7f88fd1d2ea451b178c89ff","type":"step-start"}}
{"type":"tool_use","timestamp":1777303160738,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf8600800011couBWpEGk6sDs","messageID":"msg_dcf85d3d8001Ut8AJkN03PhiFr","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"tool","tool":"spec_kit_memory_memory_match_triggers","callID":"call_00_BEa0d5hXk3Ug6hgakSv6BHZS","state":{"status":"completed","input":{"prompt":"SPECKIT_SAVE_PLANNER_MODE decision in spec 026 003 004"},"output":"{\n  \"summary\": \"Matched 3 memories via trigger phrases\",\n  \"data\": {\n    \"matchType\": \"trigger-phrase\",\n    \"count\": 3,\n    \"results\": [\n      {\n        \"memoryId\": 2305,\n        \"specFolder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/003-continuity-refactor-gates\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/003-continuity-refactor-gates/handover.md\",\n        \"title\": \"...tem-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/003-continuity-refactor-gates/handover]\",\n        \"matchedPhrases\": [\n          \"spec\",\n          \"026\",\n          \"003\"\n        ],\n        \"importanceWeight\": 0.5\n      },\n      {\n        \"memoryId\": 80,\n        \"specFolder\": \"system-spec-kit/026-graph-and-context-optimization/002-continuity-memory-runtime/003-continuity-refactor-gates\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/002-continuity-memory-runtime/003-continuity-refactor-gates/handover.md\",\n        \"title\": \"...tem-spec-kit/026-graph-and-context-optimization/002-continuity-memory-runtime/003-continuity-refactor-gates/handover]\",\n        \"matchedPhrases\": [\n          \"spec\",\n          \"026\",\n          \"003\"\n        ],\n        \"importanceWeight\": 0.5\n      },\n      {\n        \"memoryId\": 2025,\n        \"specFolder\": \"system-spec-kit/024-compact-code-graph/004-cross-runtime-fallback\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/024-compact-code-graph/004-cross-runtime-fallback/spec.md\",\n        \"title\": \"Phase 4: Cross-Runtime Fallback [system-spec-kit/024-compact-code-graph/004-cross-runtime-fallback/spec]\",\n        \"matchedPhrases\": [\n          \"spec\",\n          \"004\"\n        ],\n        \"importanceWeight\": 0.8\n      }\n    ],\n    \"degradedMatching\": null,\n    \"cognitive\": null\n  },\n  \"hints\": [\n    \"Auto-surface hook: injected 2 constitutional and 5 triggered memories (695ms)\"\n  ],\n  \"meta\": {\n    \"tool\": \"memory_match_triggers\",\n    \"tokenCount\": 1439,\n    \"latencyMs\": 86,\n    \"cacheHit\": false,\n    \"triggerSignals\": [],\n    \"autoSurface\": {\n      \"constitutionalCount\": 2,\n      \"triggeredCount\": 5,\n      \"surfaced_at\": \"2026-04-27T15:19:20.638Z\",\n      \"latencyMs\": 695\n    },\n    \"autoSurfacedContext\": {\n      \"constitutional\": [\n        {\n          \"id\": 2574,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-tool-routing.md\",\n          \"title\": \"TOOL ROUTING - Search & Retrieval Decision Tree\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: TOOL ROUTING - Search & Retrieval Decision Tree | Prioritize when: task context aligns with \\\"TOOL ROUTING - Search & Retrieval Decision Tree\\\"\"\n        },\n        {\n          \"id\": 415,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-enforcement.md\",\n          \"title\": \"GATE ENFORCEMENT - Edge Cases & Cross-Reference\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: GATE ENFORCEMENT - Edge Cases & Cross-Reference | Prioritize when: task context aligns with \\\"GATE ENFORCEMENT - Edge Cases & Cross-Reference\\\"\"\n        }\n      ],\n      \"triggered\": [\n        {\n          \"memory_id\": 2305,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/003-continuity-refactor-gates\",\n          \"title\": \"...tem-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/003-continuity-refactor-gates/handover]\",\n          \"matched_phrases\": [\n            \"spec\",\n            \"026\",\n            \"003\"\n          ]\n        },\n        {\n          \"memory_id\": 80,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/002-continuity-memory-runtime/003-continuity-refactor-gates\",\n          \"title\": \"...tem-spec-kit/026-graph-and-context-optimization/002-continuity-memory-runtime/003-continuity-refactor-gates/handover]\",\n          \"matched_phrases\": [\n            \"spec\",\n            \"026\",\n            \"003\"\n          ]\n        },\n        {\n          \"memory_id\": 2025,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph/004-cross-runtime-fallback\",\n          \"title\": \"Phase 4: Cross-Runtime Fallback [system-spec-kit/024-compact-code-graph/004-cross-runtime-fallback/spec]\",\n          \"matched_phrases\": [\n            \"spec\",\n            \"004\"\n          ]\n        },\n        {\n          \"memory_id\": 2020,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph/003-stop-hook-tracking\",\n          \"title\": \"Phase 3: Stop Hook + Token Tracking [system-spec-kit/024-compact-code-graph/003-stop-hook-tracking/spec]\",\n          \"matched_phrases\": [\n            \"spec\",\n            \"003\"\n          ]\n        },\n        {\n          \"memory_id\": 1564,\n          \"spec_folder\": \"system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/004-type-consolidation\",\n          \"title\": \"Feature Specificat [system-spec-kit/022-hybrid-rag-fusion/009-perfect-session-capturing/004-type-consolidation/spec]\",\n          \"matched_phrases\": [\n            \"spec\",\n            \"004\"\n          ]\n        }\n      ],\n      \"surfaced_at\": \"2026-04-27T15:19:20.638Z\",\n      \"latencyMs\": 695\n    },\n    \"tokenBudget\": 3500\n  }\n}","metadata":{"truncated":false},"title":"","time":{"start":1777303159938,"end":1777303160737},"attachments":[]}}}
{"type":"tool_use","timestamp":1777303162841,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf86066d001xxdu8t5puoAlhe","messageID":"msg_dcf85d3d8001Ut8AJkN03PhiFr","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"tool","tool":"spec_kit_memory_memory_search","callID":"call_01_JyTFy6zu5jKz30Zp1KpxVT3j","state":{"status":"completed","input":{"query":"SPECKIT_SAVE_PLANNER_MODE decision rationale","includeContent":true,"limit":10},"output":"{\n  \"summary\": \"> **[EVIDENCE GAP DETECTED]: Retrieved context has low mathematical confidence (Z=0.96). Consider first principles.**\\n\\nFound 5 memories (1 constitutional)\",\n  \"data\": {\n    \"searchType\": \"hybrid\",\n    \"count\": 1,\n    \"constitutionalCount\": 1,\n    \"requestQuality\": {\n      \"label\": \"gap\"\n    },\n    \"recovery\": {\n      \"status\": \"low_confidence\",\n      \"reason\": \"knowledge_gap\",\n      \"suggestedQueries\": [\n        \"speckit_save_planner_mode decision\",\n        \"speckit_save_planner_mode decision rationale\"\n      ],\n      \"recommendedAction\": \"ask_user\"\n    },\n    \"citationPolicy\": \"do_not_cite_results\",\n    \"responsePolicy\": {\n      \"requiredAction\": \"broaden_or_ask\",\n      \"noCanonicalPathClaims\": true,\n      \"citationRequiredForPaths\": true,\n      \"safeResponse\": \"Retrieval quality is weak. Broaden the query or ask the user for disambiguation before citing any path.\"\n    },\n    \"stateStats\": {\n      \"minState\": \"\",\n      \"before\": {\n        \"UNKNOWN\": 5\n      },\n      \"after\": {\n        \"UNKNOWN\": 5\n      },\n      \"removed\": 0\n    },\n    \"featureFlags\": {\n      \"trmEnabled\": true,\n      \"multiQueryEnabled\": true,\n      \"stateLimitsApplied\": false\n    },\n    \"pipelineMetadata\": {\n      \"stage1\": {\n        \"searchType\": \"hybrid\",\n        \"channelCount\": 1,\n        \"activeChannels\": 2,\n        \"candidateCount\": 12,\n        \"constitutionalInjected\": 2,\n        \"durationMs\": 294\n      },\n      \"stage2\": {\n        \"sessionBoostApplied\": \"off\",\n        \"causalBoostApplied\": \"applied\",\n        \"intentWeightsApplied\": \"off\",\n        \"artifactRoutingApplied\": \"applied\",\n        \"feedbackSignalsApplied\": \"off\",\n        \"graphContribution\": {\n          \"killSwitchActive\": false,\n          \"causalBoosted\": 1,\n          \"coActivationBoosted\": 0,\n          \"communityInjected\": 0,\n          \"graphSignalsBoosted\": 0,\n          \"totalGraphInjected\": 0,\n          \"rolloutState\": \"bounded_runtime\"\n        },\n        \"qualityFiltered\": 0,\n        \"durationMs\": 4,\n        \"recencyFusionApplied\": true,\n        \"recencyFusionBoosted\": 11,\n        \"coActivationApplied\": true,\n        \"graphSignalsApplied\": true\n      },\n      \"stage3\": {\n        \"rerankApplied\": true,\n        \"rerankProvider\": \"cross-encoder\",\n        \"chunkReassemblyStats\": {\n          \"collapsedChunkHits\": 0,\n          \"chunkParents\": 0,\n          \"reassembled\": 0,\n          \"fallback\": 0\n        },\n        \"durationMs\": 278\n      },\n      \"stage4\": {\n        \"stateFiltered\": 0,\n        \"constitutionalInjected\": 2,\n        \"evidenceGapDetected\": true,\n        \"durationMs\": 0\n      },\n      \"timing\": {\n        \"stage1\": 294,\n        \"stage2\": 4,\n        \"stage3\": 278,\n        \"stage4\": 0,\n        \"total\": 576\n      }\n    },\n    \"lexicalPath\": \"fts5\",\n    \"fallbackState\": \"ok\",\n    \"evidenceGapWarning\": \"> **[EVIDENCE GAP DETECTED]: Retrieved context has low mathematical confidence (Z=0.96). Consider first principles.**\",\n    \"intent\": {\n      \"type\": \"find_decision\",\n      \"confidence\": 0.3214048531120873,\n      \"description\": \"Finding decision records or rationale\",\n      \"weightsApplied\": \"off\"\n    },\n    \"artifactRouting\": {\n      \"strategy\": {\n        \"artifactClass\": \"decision-record\",\n        \"semanticWeight\": 0.6,\n        \"keywordWeight\": 0.4,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"decision-record\",\n      \"confidence\": 0.3333333333333333\n    },\n    \"artifact_routing\": {\n      \"strategy\": {\n        \"artifactClass\": \"decision-record\",\n        \"semanticWeight\": 0.6,\n        \"keywordWeight\": 0.4,\n        \"recencyBias\": 0.2,\n        \"maxResults\": 5,\n        \"boostFactor\": 1\n      },\n      \"detectedClass\": \"decision-record\",\n      \"confidence\": 0.3333333333333333\n    },\n    \"graphContribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 1,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"graph_contribution\": {\n      \"killSwitchActive\": false,\n      \"causalBoosted\": 1,\n      \"coActivationBoosted\": 0,\n      \"communityInjected\": 0,\n      \"graphSignalsBoosted\": 0,\n      \"totalGraphInjected\": 0,\n      \"rolloutState\": \"bounded_runtime\"\n    },\n    \"rerankMetadata\": {\n      \"reranking_enabled\": true,\n      \"reranking_requested\": true,\n      \"reranking_applied\": true\n    },\n    \"sourceContract\": {\n      \"version\": \"gate-d-reader-ready-v1\",\n      \"archivedTierEnabled\": false,\n      \"legacyFallbackEnabled\": false,\n      \"includeArchivedCompatibility\": \"not_requested\",\n      \"preferredDocumentTypes\": [\n        \"spec_doc\",\n        \"continuity\"\n      ],\n      \"retainedResults\": 5,\n      \"droppedNonCanonicalResults\": 0,\n      \"countsBySourceKind\": {\n        \"spec_doc\": 4,\n        \"continuity\": 0,\n        \"constitutional\": 1\n      }\n    },\n    \"retrievalTrace\": {\n      \"traceId\": \"tr_mohcewpz_mp6fxd\",\n      \"query\": \"SPECKIT_SAVE_PLANNER_MODE decision rationale\",\n      \"intent\": \"find_decision\",\n      \"stages\": [\n        {\n          \"stage\": \"candidate\",\n          \"timestamp\": 1777303162445,\n          \"inputCount\": 1,\n          \"outputCount\": 12,\n          \"durationMs\": 294,\n          \"metadata\": {\n            \"searchType\": \"hybrid\",\n            \"mode\": null,\n            \"channelCount\": 1,\n            \"deepExpansion\": false,\n            \"r12EmbeddingExpansion\": true\n          }\n        },\n        {\n          \"stage\": \"fusion\",\n          \"timestamp\": 1777303162449,\n          \"inputCount\": 12,\n          \"outputCount\": 5,\n          \"durationMs\": 4,\n          \"metadata\": {\n            \"sessionBoostApplied\": \"off\",\n            \"causalBoostApplied\": \"applied\",\n            \"intentWeightsApplied\": \"off\",\n            \"artifactRoutingApplied\": \"applied\",\n            \"feedbackSignalsApplied\": \"off\",\n            \"graphContribution\": {\n              \"killSwitchActive\": false,\n              \"causalBoosted\": 1,\n              \"coActivationBoosted\": 0,\n              \"communityInjected\": 0,\n              \"graphSignalsBoosted\": 0,\n              \"totalGraphInjected\": 0,\n              \"rolloutState\": \"bounded_runtime\"\n            },\n            \"searchType\": \"hybrid\",\n            \"isHybrid\": true\n          }\n        },\n        {\n          \"stage\": \"rerank\",\n          \"timestamp\": 1777303162725,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 276,\n          \"metadata\": {\n            \"rerankApplied\": true,\n            \"provider\": \"cross-encoder\"\n          }\n        },\n        {\n          \"stage\": \"final-rank\",\n          \"timestamp\": 1777303162727,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 1,\n          \"metadata\": {\n            \"collapsedChunkHits\": 0,\n            \"chunkParents\": 0,\n            \"reassembled\": 0,\n            \"fallback\": 0\n          }\n        },\n        {\n          \"stage\": \"filter\",\n          \"timestamp\": 1777303162727,\n          \"inputCount\": 5,\n          \"outputCount\": 5,\n          \"durationMs\": 0,\n          \"metadata\": {\n            \"stateFiltered\": 0,\n            \"evidenceGapDetected\": true,\n            \"trmEnabled\": true,\n            \"applyStateLimits\": false,\n            \"minState\": \"\"\n          }\n        }\n      ],\n      \"totalDurationMs\": 575,\n      \"finalResultCount\": 5\n    },\n    \"appliedBoosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"applied_boosts\": {\n      \"session\": {\n        \"applied\": \"off\"\n      },\n      \"causal\": {\n        \"applied\": \"applied\"\n      }\n    },\n    \"progressiveDisclosure\": {\n      \"summaryLayer\": {\n        \"count\": 5,\n        \"digest\": \"5 weak\"\n      },\n      \"results\": [\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2316\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"415\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"2317\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"92\"\n        },\n        {\n          \"snippet\": \"\",\n          \"detailAvailable\": false,\n          \"resultId\": \"94\"\n        }\n      ],\n      \"continuation\": null\n    },\n    \"results\": [\n      {\n        \"id\": 2316,\n        \"specFolder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\",\n        \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan.md\",\n        \"title\": \"Implemen [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan]\",\n        \"similarity\": 75.99,\n        \"isConstitutional\": false,\n        \"importanceTier\": \"important\",\n        \"triggerPhrases\": [],\n        \"createdAt\": \"2026-04-26T14:30:22.365Z\",\n        \"isChunk\": false,\n        \"parentId\": null,\n        \"chunkIndex\": null,\n        \"chunkLabel\": null,\n        \"chunkCount\": null,\n        \"contentSource\": \"file_read_fallback\",\n        \"trustBadges\": {\n          \"confidence\": 0.9,\n          \"extractionAge\": \"yesterday\",\n          \"lastAccessAge\": \"never\",\n          \"orphan\": false,\n          \"weightHistoryChanged\": false\n        },\n        \"content\": \"---\\ntitle: \\\"Implemen [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/plan]\\\"\\ndescription: \\\"Milestoned delivery (M1-M10) for the planner-first /memory:save contract: audit + retirement of the legacy [spec]/memory/*.md write path, 20-iteration relevance research, planner contract + fallback implementation, routing/quality/reconsolidation/enrichment trim, follow-up API extraction, verification, release alignment, and deep-review remediation.\\\"\\ntrigger_phrases:\\n  - \\\"implementation plan\\\"\\n  - \\\"memory save planner first\\\"\\n  - \\\"planner-first memory save plan\\\"\\n  - \\\"save flow trim plan\\\"\\n  - \\\"retirement audit to planner-first\\\"\\nimportance_tier: \\\"important\\\"\\ncontextType: \\\"planning\\\"\\n_memory:\\n  continuity:\\n    packet_pointer: \\\"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\\\"\\n    last_updated_at: \\\"2026-04-15T10:00:01Z\\\"\\n    last_updated_by: \\\"cli-copilot\\\"\\n    recent_action: \\\"Folder renamed; plan rewritten as M1-M10 planner-first delivery\\\"\\n    next_safe_action: \\\"Packet complete\\\"\\n    blockers: []\\n    key_files:\\n      - \\\"plan.md\\\"\\n      - \\\"spec.md\\\"\\n      - \\\"tasks.md\\\"\\n      - \\\"checklist.md\\\"\\n      - \\\"decision-record.md\\\"\\n      - \\\"implementation-summary.md\\\"\\n    session_dedup:\\n      fingerprint: \\\"sha256:014-planner-first-plan-2026-04-15\\\"\\n      session_id: \\\"014-planner-first-plan-2026-04-15\\\"\\n      parent_session_id: \\\"014-planner-first-seed\\\"\\n    completion_pct: 100\\n    open_questions: []\\n    answered_questions:\\n      - \\\"The planner-first default + explicit fallback architecture preserves the canonical writer while eliminating the default-path overreach.\\\"\\n      - \\\"Delivery spanned M1-M10 across audit, research, implementation, verification, release alignment, and deep-review remediation.\\\"\\ntemplate_source_hint: \\\"<!-- SPECKIT_TEMPLATE_SOURCE: plan-core | v2.2 -->\\\"\\n---\\n# Implementation Plan: /memory:save Planner-First Default\\n\\n<!-- SPECKIT_LEVEL: 3+ -->\\n<!-- SPECKIT_TEMPLATE_SOURCE: plan-core | v2.2 -->\\n\\n---\\n\\n<!-- ANCHOR:summary -->\\n## 1. SUMMARY\\n\\n### Technical Context\\n\\n| Aspect | Value |\\n|--------|-------|\\n| **Language or Stack** | TypeScript save-flow handlers, CLI wrapper, routing, validation, indexing, and follow-up APIs; markdown packet docs + release notes |\\n| **Framework** | system-spec-kit MCP server + spec-folder workflow |\\n| **Storage** | Canonical spec docs, vector DB, routed record identity, graph metadata, optional follow-up indexing |\\n| **Testing** | `validate_document.py`, `validate.sh --strict`, vitest suites, transcript prototypes, env-flag orthogonality tests |\\n| **Runtime Surface** | TypeScript save-flow handlers, CLI wrapper, routing, validation, indexing, and follow-up APIs described in `spec.md §3` |\\n\\n### Overview\\n\\nThe plan delivers a planner-first default for `/memory:save` while preserving the canonical atomic writer as an explicit fallback. It retires the legacy `[spec]/memory/*.md` write path end-to-end, gates four previously default-on save-path behaviors behind explicit env flags, and extracts freshness into three explicit follow-up APIs. Delivery runs through 10 sequential milestones: audit surface + classification, retirement cutover, relevance research, planner contract build-out, routing + quality trim, verification + transcript prototypes, release alignment, and deep-review remediation.\\n\\n### Full Delivery Summary\\n\\n| Milestone | Theme | Main Output | Why It Matters |\\n|-----------|-------|-------------|----------------|\\n| M1 | Audit kickoff | Classification rules + iteration plan | Establishes the audit frame |\\n| M2 | Audit convergence | 25-finding audit report + half-migrated diagnosis | Proves the default contract is broken |\\n| M3 | Retirement cutover | v3.4.1.0 removes legacy memory-file write path + aligns docs | Bridges audit to planner work |\\n| M4 | Research kickoff | Q1-Q10 relevance questions | Sets the classification scope |\\n| M5 | Research convergence | 15-subsystem classification + trim-targeted verdict | Decides what survives the default path |\\n| M6 | Planner contract | Planner-first default + flag plumbing + type surface + shared types | Ships the new operator contract |\\n| M7 | Routing and quality trim | Tier 3 + quality-loop + reconsolidation + enrichment leave the default path | Aligns runtime to verdict |\\n| M8 | Verification + transcripts | Targeted tests, transcript prototypes, packet validation | Grounds planner behavior in real operator flows |\\n| M9 | Release alignment | v3.4.1.0 release note + env reference + template updates | Runtime contract documented honestly |\\n| M10 | Deep-review remediation | 9-finding closure (3 P0, 5 P1, 1 P2) | Closes the last correctness + honesty gaps |\\n\\n---\\n\\n<!-- /ANCHOR:summary -->\\n<!-- ANCHOR:quality-gates -->\\n## 2. QUALITY GATES\\n\\n### Definition of Ready\\n\\n- [x] Audit classification rules and dimension plan defined before iteration started.\\n- [x] Q1-Q10 relevance questions agreed before M4 kickoff.\\n- [x] Load-bearing core and candidate trim targets defined before M6 kickoff.\\n- [x] Packet scope limited to the planner contract, retirement of legacy write path, subsystem gating, follow-up APIs, and docs alignment.\\n\\n### Definition of Done\\n\\n- [x] Packet canonical docs exist and agree on the planner-first contract.\\n- [x] Audit, research, deep-review, and transcript snapshots copied into the packet.\\n- [x] Every copied Markdown file begins with the required snapshot note.\\n- [x] `description.json`, `graph-metadata.json`, and packet-local nested changelog exist.\\n- [x] All primary docs pass `validate_document.py`.\\n- [x] Packet passes `validate.sh --strict` with no blocking errors.\\n- [x] Planner-default runtime tests prove the default path is non-mutating.\\n- [x] Full-auto fallback tests prove atomic mutation + rollback + `POST_SAVE_FINGERPRINT` parity.\\n- [x] Follow-up APIs (`refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`) have execution-level coverage.\\n- [x] Deep-review findings F001-F009 closed.\\n\\n---\\n\\n<!-- /ANCHOR:quality-gates -->\\n<!-- ANCHOR:architecture -->\\n## 3. ARCHITECTURE\\n\\n### Pattern\\n\\nPlanner-first wrapper around the preserved canonical atomic writer. The default path computes route + legality + advisory data and returns structured planner output without mutating files. An explicit fallback path activates the canonical writer with full atomic semantics intact. Freshness work lives in callable follow-up APIs.\\n\\n### Key Components\\n\\n- **Planner-first handler (`memory-save.ts`)**: Default execution path returning planner output (routes, blockers, advisories, follow-up actions). No mutation on default.\\n- **Canonical atomic writer (preserved: `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `post-insert.ts`)**: Fallback path when `SPECKIT_SAVE_PLANNER_MODE=full-auto`. Rollback, promotion, same-path identity, `POST_SAVE_FINGERPRINT` parity intact.\\n- **Content router (`content-router.ts`)**: Eight-category contract preserved. Scoped exception: Tier 3 default-disable + manual-review guard.\\n- **Quality gate (`quality-loop.ts`, `save-quality-gate.ts`)**: Hard blockers preserved. Auto-fix retries gated behind `SPECKIT_QUALITY_AUTO_FIX=true`.\\n- **Reconsolidation (`reconsolidation-bridge.ts`)**: Gated behind `SPECKIT_RECONSOLIDATION_ENABLED=true` or explicit fallback.\\n- **Post-insert enrichment (`post-insert.ts`)**: Gated behind `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED=true` or follow-up API.\\n- **Follow-up indexing APIs (`api/indexing.ts`, `graph-metadata-parser.ts`)**: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`.\\n- **Env reference + command docs + release notes**: Aligned to describe default/opt-in/reserved/fallback consistently.\\n\\n### Data Flow\\n\\n```text\\nCaller invokes /memory:save\\n    |\\n    v\\nResolve SPECKIT_SAVE_PLANNER_MODE\\n    |\\n    |-- default or plan-only or hybrid(reserved) -->\\n    |       Compute route + legality + advisories\\n    |       Respect env flags for deferred helpers\\n    |       Return structured planner output (no mutation)\\n    |\\n    +-- full-auto -->\\n            Canonical atomic writer\\n            Promotion + rollback + same-path identity\\n            POST_SAVE_FINGERPRINT parity\\n            Gated subsystems run only when their env flag is true\\n```\\n\\n### File-Level Change Map\\n\\nSee `spec.md §3 Files to Change` for the consolidated table covering legacy write-path retirement, planner contract core, canonical writer preservation, content router scoped exception, quality gate updates, reconsolidation gating, enrichment deferral, freshness APIs, command + reference + env docs, release notes, test surfaces, and packet metadata.\\n\\n### Runtime Surface Summary\\n\\n| Area | Files | Role |\\n|------|-------|------|\\n| Legacy write path retirement | `directory-setup.ts`, `workflow.ts`, `file-writer.ts`, `memory-indexer.ts`, `memory-metadata.ts` | Removed from runtime |\\n| Load-bearing core preserved | `memory-save.ts`, `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `content-router.ts`, `post-insert.ts`, `reconsolidation-bridge.ts`, `workflow.ts` | Writer core + continuity + routing |\\n| Planner contract | `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts`, `/memory:save` docs | Default non-mutating output |\\n| Follow-up APIs | `api/indexing.ts`, `graph-metadata-parser.ts` | Deferred freshness + enrichment |\\n| Remediation surfaces | `content-router.ts`, `memory-save.ts`, `post-insert.ts`, `../../../../skill/system-spec-kit/mcp_server/ENV_REFERENCE.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` | Deep-review closure + honesty fixes |\\n\\n---\\n\\n<!-- /ANCHOR:architecture -->\\n<!-- ANCHOR:phases -->\\n## 4. IMPLEMENTATION PHASES\\n\\n### Milestone Flow\\n\\n```text\\nM1 Audit kickoff\\n  -> M2 Audit convergence\\n  -> M3 Retirement closure (v3.4.1.0 legacy write-path removal)\\n  -> M4 Research kickoff\\n  -> M5 Research convergence (15-subsystem classification + trim-targeted verdict)\\n  -> M6 Planner contract\\n  -> M7 Routing + quality + reconsolidation + enrichment trim\\n  -> M8 Verification and transcripts\\n  -> M9 Release alignment\\n  -> M10 Deep-review remediation\\n```\\n\\n### M1 — Audit kickoff\\n\\nOpen the audit with a narrow question: does any active file still write, read, or assume `[spec]/memory/*.md` in contradiction to the retirement claim? Define classification rules and the iteration plan. Evidence: `research/013-audit-snapshot/primary-docs/spec.md`, `research/013-audit-snapshot/deep-review-strategy.md`.\\n\\n### M2 — Audit convergence\\n\\nRun the audit to convergence across 7 iterations. Document the half-migrated state in concrete families: runtime write path, runtime read path, doc contradiction, phantom dedup contract, test drift, and template drift. 25 active findings across 9 P0, 9 P1, and 7 P2 produce three closure paths (A retire, B rescind, C dedup redesign). Evidence: `research/013-audit-snapshot/iterations/`, `research/013-audit-snapshot/review-report.md`.\\n\\n### M3 — Retirement closure\\n\\nRemove the live memory-file write path, clean up templates and docs, and align the runtime with the intended canonical-doc model. v3.4.1.0 records the cutover. Evidence: `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`.\\n\\n### M4 — Research kickoff\\n\\nAfter the retirement cutover, open relevance research with Q1-Q10 covering load-bearing core, planner-first feasibility, quality-check classification, reindex vs freshness, graph-metadata refresh, entity extraction, reconsolidation cost, router classifier overfitting, trigger harmonization, and continuity ownership. Evidence: `research/014-research-snapshot/primary-docs/spec.md`, `research/014-research-snapshot/deep-research-strategy.md`.\\n\\n### M5 — Research convergence\\n\\nRun 20 iterations of relevance research. Classify 15 subsystems into load-bearing (canonical atomic writer, routed record identity, content-router core, thin continuity validation), candidate trim targets (Tier 3 routing, reconsolidation-on-save, heavy quality-loop auto-fix, post-insert enrichment), and other categories. Reach the `trim-targeted` verdict: keep the writer, trim the oversized default-path stack. Evidence: `research/014-research-snapshot/research.md`, `research/014-research-snapshot/findings-registry.json`.\\n\\n### M6 — Planner contract\\n\\nBuild the planner-first default, CLI defaults, docs, and type surfaces:\\n\\n- [x] T001-T005 Add planner-default and fallback flag definitions; planner response interfaces; response serialization helpers; planner blocker and advisory response helpers.\\n- [x] T006-T008 Make `generate-context.ts` request planner-first behavior by default; update `/memory:save` docs; make `memory-save.ts` return planner output by default with explicit fallback.\\n- [x] T009-T012 Update aggregate and handler tests for planner-default behavior; focused planner-first regression coverage.\\n\\n### M7 — Routing and quality trim\\n\\nTrim Tier 3 routing, quality-loop auto-fix, reconsolidation-on-save, and post-insert enrichment from the default hot path while preserving the category contract and hard blockers:\\n\\n- [x] T013-T017 Trim default Tier 3 participation while preserving category contract; reduce Tier 2 prototype library; update content-router tests for Tier 1/Tier 2 deterministic default; update runtime routing + intent-routing tests.\\n- [x] T018-T022 Retire default-path auto-fix retries; preserve hard structural blockers; update quality-loop + save-quality-gate + pipeline-enforcement tests.\\n- [x] T023-T026 Gate reconsolidation behind explicit flag/fallback; move default-path enrichment to explicit follow-up behavior; preserve same-path lineage; keep chunking as size-driven fallback.\\n- [x] T027-T034 Move unconditional graph refresh + spec-doc reindex out of planner-default saves; expose explicit follow-up indexing entry points; keep graph refresh callable as explicit follow-up; update reconsolidation-bridge, reconsolidation, assistive-reconsolidation, chunking, graph-refresh tests.\\n\\n### M8 — Verification and transcripts\\n\\nProve the planner-first model holds up against real session evidence:\\n\\n- [x] T035-T037 Memory-save integration tests for planner-default plus fallback end-to-end; planner UX regression tests for readable output; thin-continuity tests for normalization + upsert parity.\\n- [x] T038 Prototype planner-first behavior against three real session transcripts. Evidence: `scratch/transcripts-snapshot/`.\\n- [x] T039-T040 Run per-file doc validation + strict packet validation; capture follow-on defects.\\n- [x] T041-T043 Review structural parity between `/memory:save` + `AGENTS.md` + system-spec-kit skill doc; review fallback safety against `atomic-index-memory.ts` + `create-record.ts`; review transcript mismatches and convert unresolved issues into follow-on tasks.\\n\\n### M9 — Release alignment\\n\\nDocument the shipped contract in `v3.4.1.0` release notes and closeout docs, including the explicit follow-up APIs, the scoped router exception, and the reserved state of `hybrid`. Evidence: `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`.\\n\\n### M10 — Deep-review remediation\\n\\nClose the 9 findings from the deep-review pass (3 P0, 5 P1, 1 P2):\\n\\n- **F001 [P0]**: router-preservation contradiction → resolved by documenting the scoped `content-router.ts` exception (ADR-007).\\n- **F002 [P0]**: fallback safety parity → resolved by reinstating `POST_SAVE_FINGERPRINT`.\\n- **F003 [P0]**: template-contract failures hidden as advisories → resolved by promoting them to planner blockers.\\n- **F004 [P1]**: deferred enrichment returning success-shaped status → resolved by returning explicit `deferred` status.\\n- **F005 [P2]**: `hybrid` assumed live → resolved by marking reserved and documenting `plan-only`-equivalent behavior.\\n- **F006 [P1]**: follow-up API coverage → resolved by adding execution-level coverage for `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`.\\n- **F007 [P1]**: follow-up tool names in packet docs → resolved by aligning docs to shipped names.\\n- **F008 [P1]**: env reference drift → resolved by documenting `hybrid` honestly in `ENV_REFERENCE.md`.\\n- **F009 [P1]**: release-note honesty → resolved by describing router scope and `hybrid` state accurately in `v3.4.1.0.md`.\\n\\n---\\n\\n<!-- /ANCHOR:phases -->\\n<!-- ANCHOR:testing -->\\n## 5. TESTING STRATEGY\\n\\n| Test Type | Scope | Tools | Source |\\n|-----------|-------|-------|--------|\\n| Audit validation | Verify runtime + doc contradictions | Deep-review iterations + synthesis report | `research/013-audit-snapshot/**` |\\n| Research convergence | Verify Q1-Q10 answers + 15-subsystem verdicts | Deep-research iterations + findings registry | `research/014-research-snapshot/**` |\\n| Runtime contract tests | Planner-default + fallback parity + router + quality + follow-up APIs | Vitest suites + targeted sweeps | `review/015-deep-review-snapshot/primary-docs/tasks.md`, `review/015-deep-review-snapshot/primary-docs/checklist.md`, `review/015-deep-review-snapshot/primary-docs/implementation-summary.md` |\\n| Transcript validation | Planner-first behavior against real sessions | Transcript markdown + planner-output JSON + transcript reviews | `scratch/transcripts-snapshot/` |\\n| Review convergence | Deep-review isolation of real defect set | Review report + findings registry + iteration ledger | `review/015-deep-review-snapshot/**` |\\n| Remediation confirmation | All 9 review findings resolved | Remediated docs + tests + changelog + implementation summary | `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\\n| Packet validation | Packet structural soundness | `validate_document.py`, `validate.sh --strict` | This packet |\\n\\n### Audit Approach (M1-M3)\\n\\n- Focused deep-review loop over runtime, docs, tests, and templates.\\n- Classification rule applied each iteration.\\n- Convergence threshold tracked and documented.\\n- Retirement cutover delivered as part of v3.4.1.0; docs aligned to the canonical-doc model.\\n\\n### Research Approach (M4-M5)\\n\\n- 20 iterations with explicit subsystem questions.\\n- Research document and findings registry used as the canonical synthesis.\\n- Minimal replacement design evaluated against live code surfaces.\\n- Final report explicitly ruled out a full writer redesign.\\n\\n### Implementation Approach (M6-M8)\\n\\n- Planner-first contract built before trim work.\\n- Routing, quality, reconsolidation, enrichment, and follow-up APIs covered by targeted tests.\\n- Transcript prototypes used to validate real operator narratives.\\n- Packet-local doc validation and strict packet validation used as release gates.\\n\\n### Remediation Approach (M10)\\n\\n- Deep review split concerns into runtime correctness, follow-up API integrity, coverage, and documentation honesty.\\n- Remediation closed all 9 findings and aligned packet docs and release notes.\\n- Packet docs reflect the remediated state as the final truth.\\n\\n---\\n\\n<!-- /ANCHOR:testing -->\\n<!-- ANCHOR:dependencies -->\\n## 6. DEPENDENCIES\\n\\n| Dependency | Type | Status | Impact if Blocked |\\n|------------|------|--------|-------------------|\\n| Audit evidence | Documentation source | Ready | Audit truth cannot be grounded |\\n| Research synthesis | Documentation source | Ready | Verdicts and Q1-Q10 would be underspecified |\\n| Canonical atomic writer | Runtime core | Preserved | Fallback path depends on it |\\n| Eight-category router contract | Runtime core | Preserved | Target authority depends on it |\\n| Vitest suites | Verification tooling | Ready | Runtime contract evidence |\\n| Transcript fixtures | Verification input | Ready | Real-operator-flow evidence |\\n| v3.4.1.0 changelog | Release artifact | Ready | Release-state truth |\\n| `validate_document.py` | Tooling | Pass recorded | Docs could ship with structural defects |\\n| `validate.sh --strict` | Tooling | Pass recorded | Packet could ship with blocking issues |\\n| `generate-description.js` | Tooling | Run | Packet metadata complete |\\n| Nested changelog generator | Tooling | Run | Packet-local change trace complete |\\n\\n---\\n\\n<!-- /ANCHOR:dependencies -->\\n<!-- ANCHOR:rollback -->\\n## 7. ROLLBACK PLAN\\n\\n- **Trigger**: Planner-default mutates under some branch, fallback loses atomic safety parity, router preservation claim contradicts code, or remediation reopens a closed finding.\\n- **Procedure**: Revert runtime changes + docs + env reference + release note as one batch. Re-run vitest suites + strict validation + transcript prototypes.\\n- **Data reversal**: No data migrations. Vector DB schema unchanged; saves still use the canonical atomic writer when fallback is active.\\n\\n### Per-Milestone Rollback\\n\\n| Milestone | Trigger | Rollback Action | Data Reversal |\\n|-----------|---------|-----------------|---------------|\\n| M3 retirement cutover | Legacy memory-file surface regression | Revert the retirement commit; re-run audit fixtures | None |\\n| M6 planner contract | Planner output schema drift or default mutation | Revert planner commits; re-enable prior handler default | None |\\n| M7 trim milestones | Opt-in flag cascade activates unintended subsystems | Revert trim commits for affected subsystem | None |\\n| M8 verification | Transcript prototype breaks unexpectedly | Patch surface; re-run validator | None |\\n| M9 release alignment | Release notes drift from runtime | Patch release notes + env reference | None |\\n| M10 remediation | Reopened finding | Apply targeted patch; re-run closure tests | None |\\n\\n### Consolidated Rollback Note\\n\\nBecause the canonical atomic writer is preserved, rollback means reverting the planner-first wrapper + env-flag gates + follow-up API exports. Fallback behavior continues to work with full atomic semantics intact.\\n\\n---\\n\\n<!-- /ANCHOR:rollback -->\\n## L2: PHASE DEPENDENCIES\\n\\n```text\\nM1 Audit kickoff\\n  -> M2 Audit convergence\\n  -> M3 Retirement closure\\n  -> M4 Research kickoff\\n  -> M5 Research convergence\\n  -> M6 Planner contract\\n  -> M7 Routing and quality trim\\n  -> M8 Verification and transcripts\\n  -> M9 Release alignment\\n  -> M10 Remediation\\n```\\n\\n| Phase | Depends On | Blocks |\\n|-------|------------|--------|\\n| M1 | None | M2-M10 |\\n| M2 | M1 | M3-M10 |\\n| M3 | M2 | M4-M10 |\\n| M4 | M3 | M5-M10 |\\n| M5 | M4 | M6-M10 |\\n| M6 | M5 | M7-M10 |\\n| M7 | M6 | M8-M10 |\\n| M8 | M7 | M9-M10 |\\n| M9 | M8 | M10 |\\n| M10 | M9 | Packet closeout |\\n\\n---\\n\\n## L2: EFFORT ESTIMATION\\n\\n| Phase | Complexity | Estimated Effort |\\n|-------|------------|------------------|\\n| Audit + retirement | High | 1-2 days |\\n| Research convergence | High | 1 day |\\n| Planner contract | High | 0.5-1 day |\\n| Routing + quality + reconsolidation + enrichment trim | High | 1-1.5 days |\\n| Verification + transcripts | Medium | 0.5 day |\\n| Release alignment | Medium | 0.5 day |\\n| Deep-review remediation (9 findings) | High | 0.5-1 day |\\n| **Total** | **High** | **~5-7 implementation days** |\\n\\n### Historical Effort Context\\n\\n| Area | Effort Shape | Why It Matters |\\n|------|--------------|----------------|\\n| Audit loop | Multi-iteration review + release alignment | Explains depth of the original contradiction |\\n| Research loop | 20-iteration classification | Explains trim-targeted verdict trustworthiness |\\n| Implementation | 43 tasks across planner + trim + verification | Explains why the contract cannot be summarized as a small one-line change |\\n\\n---\\n\\n## L2: ENHANCED ROLLBACK\\n\\n### Pre-release Checks\\n\\n- [x] Snapshot tree complete (audit + research + review + transcripts)\\n- [x] Planner-default runtime tests pass\\n- [x] Full-auto fallback tests pass with `POST_SAVE_FINGERPRINT` parity\\n- [x] Follow-up API coverage in place\\n- [x] Release notes + env reference aligned to runtime\\n\\n### Rollback Procedure\\n\\n1. Revert planner commits atomically; fallback behavior continues via canonical writer.\\n2. Revert env-flag gates for any subsystem that regressed.\\n3. Re-run vitest suites + strict validation + transcript prototypes.\\n4. If v3.4.1.0 release note needs adjustment, patch the release note and env reference.\\n\\n### Data Reversal\\n\\n- **Has data migration?** No\\n- **Reversal procedure**: Runtime-level revert only\\n\\n---\\n\\n## L3: DEPENDENCY GRAPH\\n\\n```text\\n┌──────────────┐\\n│ Audit (M1-M2)│\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Retirement   │\\n│ cutover (M3) │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Research     │\\n│ (M4-M5)      │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Planner +    │\\n│ trim (M6-M7) │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Verification │\\n│ (M8)         │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Release      │\\n│ alignment M9 │\\n└──────┬───────┘\\n       v\\n┌──────────────┐\\n│ Remediation  │\\n│ (M10)        │\\n└──────────────┘\\n```\\n\\n### Dependency Matrix\\n\\n| Component | Depends On | Produces | Blocks |\\n|-----------|------------|----------|--------|\\n| Audit | None | Half-migrated evidence | Retirement cutover |\\n| Retirement cutover | Audit | Canonical-doc-aligned runtime | Research |\\n| Research | Retirement cutover | Trim-targeted verdict | Planner contract |\\n| Planner contract | Research | Non-mutating default + fallback | Trim milestones |\\n| Trim milestones | Planner contract | Gated subsystems + follow-up APIs | Verification |\\n| Verification | Trim milestones | Targeted tests + transcript evidence | Release |\\n| Release alignment | Verification | v3.4.1.0 + env reference + templates | Remediation |\\n| Remediation | Release alignment | 9-finding closure + honest router scope | Closeout |\\n\\n---\\n\\n## L3: CRITICAL PATH\\n\\n1. **Audit the half-migrated state** — critical because every later claim depends on grounded evidence.\\n2. **Retire the legacy write path** — critical so research and implementation do not inherit the contradiction.\\n3. **Classify the 15 subsystems** — critical so the trim targets are objective.\\n4. **Ship the planner-first default + full-auto fallback** — critical because it is the operator-facing contract.\\n5. **Gate Tier 3 + quality + reconsolidation + enrichment** — critical so the default path actually trims.\\n6. **Expose follow-up APIs** — critical so deferred work remains callable.\\n7. **Align docs + release notes + env reference** — critical so the shipped contract is documented honestly.\\n8. **Close all 9 deep-review findings** — critical because the first review verdict was remediation-required.\\n\\n**Total Critical Path**: Audit → Retirement → Research → Planner + Trim → Verification → Release → Remediation\\n\\n---\\n\\n## L3: MILESTONES\\n\\n| Milestone | Description | Success Criteria | Target |\\n|-----------|-------------|------------------|--------|\\n| M1 | Audit kickoff | Classification rules + iteration plan published | Audit spec + strategy |\\n| M2 | Audit convergence | 25-finding audit report + half-migrated diagnosis | Audit synthesis |\\n| M3 | Retirement cutover | Legacy memory-file write path removed | v3.4.1.0 release |\\n| M4 | Research kickoff | Q1-Q10 published | Research spec + strategy |\\n| M5 | Research convergence | 15-subsystem classification + trim-targeted verdict | Research synthesis |\\n| M6 | Planner contract | Planner-first default + fallback + shared types | Runtime handler |\\n| M7 | Routing + quality trim | Four subsystems behind env flags | Runtime handlers |\\n| M8 | Verification + transcripts | Targeted tests + transcript prototypes + packet validation | Vitest + transcripts |\\n| M9 | Release alignment | v3.4.1.0 + `/memory:save` docs + env reference + templates | Release artifacts |\\n| M10 | Remediation | 9 findings closed | Review report + ADR-007 |\\n\\n---\\n\\n### Architecture Decision Record Summary\\n\\n| ADR | Summary |\\n|-----|---------|\\n| ADR-001 | Trim-targeted verdict: keep the core writer, trim the oversized default-path stack |\\n| ADR-002 | Planner-first output becomes the default `/memory:save` contract |\\n| ADR-003 | Reconsolidation-on-save becomes explicit opt-in |\\n| ADR-004 | Post-insert enrichment becomes deferred or standalone |\\n| ADR-005 | Router categories stay while Tier 2 or Tier 3 scope narrows |\\n| ADR-006 | Hard checks remain while quality-loop auto-fix leaves the default path |\\n| ADR-007 | Router preservation claim becomes \\\"core preserved with one scoped exception\\\" |\\n\\n---\\n\\n## L3+: AI EXECUTION FRAMEWORK\\n\\n### Pre-Task Checklist\\n\\n- [x] Confirm the canonical atomic writer stays intact\\n- [x] Confirm env flags stay orthogonal\\n- [x] Confirm planner default stays non-mutating\\n\\n### Task Execution Rules\\n\\n| Rule | Description |\\n|------|-------------|\\n| EXEC-SEQ | Ship planner contract before trim work |\\n| EXEC-EVIDENCE | Every trim target maps to an audit/research finding |\\n| EXEC-SCOPE | Do not touch canonical atomic writer internals |\\n\\n### Status Reporting Format\\n\\nReport task state as `P###-ID [x] - description` using the packet-prefixed IDs in `tasks.md`.\\n\\n### Blocked Task Protocol\\n\\nIf a runtime change regresses fallback safety, revert and patch the specific subsystem before re-running the verification sweep.\\n\\n### Tier 1: Runtime Core\\n\\n**Files**\\n- `memory-save.ts`, `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts`\\n- `content-router.ts`, `quality-loop.ts`, `save-quality-gate.ts`\\n- `reconsolidation-bridge.ts`, `post-insert.ts`\\n- `api/indexing.ts`, `graph-metadata-parser.ts`\\n\\n**Goal**\\n- Preserve the canonical atomic writer + routing + continuity; move default-path overreach behind env flags; expose follow-up APIs.\\n\\n### Tier 2: Docs + Release\\n\\n| Workstream | Output | Notes |\\n|------------|--------|-------|\\n| Runtime contract docs | `/memory:save` docs + `ENV_REFERENCE.md` + templates | Align to shipped contract |\\n| Release notes | `v3.4.1.0.md` | Scoped exception + reserved `hybrid` honestly |\\n| Packet docs | `spec.md`, `plan.md`, `tasks.md`, `checklist.md`, `decision-record.md`, `implementation-summary.md` | Tell the end-to-end story |\\n\\n### Tier 3: Validation\\n\\n**Goal**\\n- Packet behaves like a normal spec packet: validators pass, metadata generated, packet-local changelog emitted.\\n\\n**Actions**\\n- Run `validate_document.py`\\n- Run `validate.sh --strict`\\n- Generate `description.json`\\n- Author or verify `graph-metadata.json`\\n- Generate nested changelog\\n\\n---\\n\\n## L3+: WORKSTREAM COORDINATION\\n\\n| ID | Name | Scope | Output |\\n|----|------|-------|--------|\\n| W-A | Audit + retirement | Half-migrated evidence + legacy write-path removal | `research/013-audit-snapshot/**` + v3.4.1.0 retirement |\\n| W-B | Research | 15-subsystem classification + trim-targeted verdict | `research/014-research-snapshot/**` |\\n| W-C | Planner contract + trim | Runtime handlers + env flags + follow-up APIs | Runtime TypeScript |\\n| W-D | Verification + transcripts | Targeted tests + three transcript prototypes | Vitest + `scratch/transcripts-snapshot/` |\\n| W-E | Docs + release alignment | `/memory:save` docs + env reference + release notes + packet docs | Docs surface |\\n| W-F | Remediation | 9-finding closure + ADR-007 | `review/015-deep-review-snapshot/**` |\\n\\n### Sync Points\\n\\n| Sync ID | Trigger | Participants | Output |\\n|---------|---------|--------------|--------|\\n| SYNC-001 | Audit complete | W-A + W-B | Research grounded in audit reality |\\n| SYNC-002 | Research complete | W-B + W-C | Trim targets objective |\\n| SYNC-003 | Runtime complete | W-C + W-D | Tests cover default + fallback + gated subsystems |\\n| SYNC-004 | Verification complete | W-D + W-E | Docs + release + env reference aligned to runtime |\\n| SYNC-005 | Release aligned | W-E + W-F | Remediation targets documented findings |\\n\\n---\\n\\n## L3+: COMMUNICATION PLAN\\n\\n### Checkpoints\\n\\n- **Checkpoint 1**: Audit truth grounded.\\n- **Checkpoint 2**: Retirement cutover shipped.\\n- **Checkpoint 3**: Research verdict published.\\n- **Checkpoint 4**: Planner + trim + follow-up APIs merged.\\n- **Checkpoint 5**: Verification + transcripts validated.\\n- **Checkpoint 6**: v3.4.1.0 released with aligned docs.\\n- **Checkpoint 7**: All 9 deep-review findings closed.\\n\\n### Escalation Path\\n\\n1. If audit findings conflict with research, prefer audit evidence over summary.\\n2. If release-note wording conflicts with the remediated state, preserve the remediated state and adjust the release note.\\n3. If validation rules conflict with the shipped structure, preserve validation compliance and document the exact warning.\\n\\n### Governance Notes\\n\\n- The packet is a runtime change with documented operator-facing contract; changelog honesty matters.\\n- The canonical atomic writer is the single mutation mechanism; fallback preserves atomic semantics.\\n- The deep-review pass is part of the delivery record; remediation closure is load-bearing.\\n\\n---\\n\\n### Governance and Compliance Notes\\n\\n### Governance Sign-Off Targets\\n\\n| Sign-Off | Status | Basis |\\n|----------|--------|-------|\\n| Runtime correctness | Complete | Planner default non-mutating + fallback atomic parity |\\n| Documentation alignment | Complete | `/memory:save` docs + env reference + release notes agree |\\n| Spec-packet compliance | Complete | `validate.sh --strict` pass |\\n| Metadata completeness | Complete | `description.json`, `graph-metadata.json`, nested changelog |\\n\\n### Compliance Notes\\n\\n- No secrets, credentials, or third-party systems involved.\\n- Packet stores only copied internal project artifacts plus new documentation and runtime changes.\\n- Canonical atomic writer unchanged outside the scoped router Tier 3 guard.\\n\",\n        \"confidence\": {\n          \"label\": \"medium\",\n          \"value\": 0.448,\n          \"drivers\": [\n            \"multi_channel_agreement\"\n          ]\n        },\n        \"why\": {\n          \"summary\": \"Ranked first because semantic similarity\",\n          \"topSignals\": [\n            \"semantic_match\"\n          ]\n        }\n      }\n    ],\n    \"evidenceDigest\": \"5 results retrieved; avg score 0.74.\",\n    \"followUps\": []\n  },\n  \"hints\": [\n    \"Some files could not be read - check file paths\",\n    \"[code-graph] Symbols near mentioned files: function:closeIndexingRuntime, function:initializeIndexingRuntime, function:reindexSpecDocs\",\n    \"Auto-surface hook: injected 2 constitutional and 5 triggered memories (1ms)\",\n    \"Token budget enforced: truncated 5 → 1 results to fit 3500 token budget\"\n  ],\n  \"meta\": {\n    \"tool\": \"memory_search\",\n    \"tokenCount\": 11912,\n    \"latencyMs\": 583,\n    \"cacheHit\": false,\n    \"responseProfile\": \"research\",\n    \"autoSurface\": {\n      \"constitutionalCount\": 2,\n      \"triggeredCount\": 5,\n      \"surfaced_at\": \"2026-04-27T15:19:22.140Z\",\n      \"latencyMs\": 1\n    },\n    \"autoSurfacedContext\": {\n      \"constitutional\": [\n        {\n          \"id\": 2574,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-tool-routing.md\",\n          \"title\": \"TOOL ROUTING - Search & Retrieval Decision Tree\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: TOOL ROUTING - Search & Retrieval Decision Tree | Prioritize when: task context aligns with \\\"TOOL ROUTING - Search & Retrieval Decision Tree\\\"\"\n        },\n        {\n          \"id\": 415,\n          \"specFolder\": \"system-spec-kit\",\n          \"filePath\": \"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/skills/system-spec-kit/constitutional/gate-enforcement.md\",\n          \"title\": \"GATE ENFORCEMENT - Edge Cases & Cross-Reference\",\n          \"importanceTier\": \"constitutional\",\n          \"retrieval_directive\": \"Always surface when: GATE ENFORCEMENT - Edge Cases & Cross-Reference | Prioritize when: task context aligns with \\\"GATE ENFORCEMENT - Edge Cases & Cross-Reference\\\"\"\n        }\n      ],\n      \"triggered\": [\n        {\n          \"memory_id\": 2355,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/005-code-graph/001-code-graph-upgrades\",\n          \"title\": \"Deci [system-spec-kit/026-graph-and-context-optimization/005-code-graph/001-code-graph-upgrades/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2317,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\",\n          \"title\": \"Feature [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec]\",\n          \"matched_phrases\": [\n            \"speckit_save_planner_mode\"\n          ]\n        },\n        {\n          \"memory_id\": 2289,\n          \"spec_folder\": \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/001-cache-warning-hooks\",\n          \"title\": \"...em-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/001-cache-warning-hooks/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2222,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph\",\n          \"title\": \"Decision Record: Hybrid Context Injection [system-spec-kit/024-compact-code-graph/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        },\n        {\n          \"memory_id\": 2218,\n          \"spec_folder\": \"system-spec-kit/024-compact-code-graph/034-workflow-split-and-token-insight-contracts\",\n          \"title\": \"Decision Record [system-spec-kit/024-compact-code-graph/034-workflow-split-and-token-insight-contracts/decision-record]\",\n          \"matched_phrases\": [\n            \"decision\"\n          ]\n        }\n      ],\n      \"surfaced_at\": \"2026-04-27T15:19:22.140Z\",\n      \"latencyMs\": 1\n    },\n    \"tokenBudget\": 3500,\n    \"tokenBudgetTruncated\": true,\n    \"originalResultCount\": 5,\n    \"returnedResultCount\": 1\n  }\n}","metadata":{"truncated":false},"title":"","time":{"start":1777303162137,"end":1777303162839},"attachments":[]}}}
{"type":"step_finish","timestamp":1777303163051,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf860fd9001oOFMdosrFSfjB2","reason":"tool-calls","snapshot":"d458144de1b1daf8f274213653db207584419d6f","messageID":"msg_dcf85d3d8001Ut8AJkN03PhiFr","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"step-finish","tokens":{"total":39983,"input":60,"output":154,"reasoning":89,"cache":{"write":0,"read":39680}},"cost":0.0015254}}
{"type":"step_start","timestamp":1777303166377,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf861da6001wyTBli0NFP7a5y","messageID":"msg_dcf861169001yxGyGFGxLQT4oQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","snapshot":"bc52cc45a7b74371dabdc2b2075e55b63b9013e9","type":"step-start"}}
{"type":"tool_use","timestamp":1777303174466,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf8634fb001YDgAiouZkNv6vE","messageID":"msg_dcf861169001yxGyGFGxLQT4oQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"tool","tool":"read","callID":"call_00_dDr8wdx6qn96HRiHtLRb776x","state":{"status":"completed","input":{"filePath":"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/decision-record.md"},"output":"<path>/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/decision-record.md</path>\n<type>file</type>\n<content>\n1: ---\n2: title: \"...em-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/decision-record]\"\n3: description: \"ADR ledger for the planner-first /memory:save contract: the trim-targeted verdict, planner-first default output, reconsolidation opt-in, enrichment deferral, router category contract, hard-blocker preservation, and the scoped content-router.ts exception.\"\n4: trigger_phrases:\n5:   - \"decision record\"\n6:   - \"memory save planner first adr\"\n7:   - \"planner-first save\"\n8:   - \"trim-targeted verdict\"\n9:   - \"content-router scoped exception\"\n10: importance_tier: \"important\"\n11: contextType: \"planning\"\n12: _memory:\n13:   continuity:\n14:     packet_pointer: \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\"\n15:     last_updated_at: \"2026-04-15T10:00:01Z\"\n16:     last_updated_by: \"cli-copilot\"\n17:     recent_action: \"Rewrote ADR ledger as cohesive planner-first decision sequence\"\n18:     next_safe_action: \"Packet complete\"\n19:     blockers: []\n20:     key_files:\n21:       - \"decision-record.md\"\n22:       - \"spec.md\"\n23:       - \"implementation-summary.md\"\n24:     session_dedup:\n25:       fingerprint: \"sha256:014-planner-first-adr-2026-04-15\"\n26:       session_id: \"014-planner-first-adr-2026-04-15\"\n27:       parent_session_id: \"014-planner-first-seed\"\n28:     completion_pct: 100\n29:     open_questions: []\n30:     answered_questions:\n31:       - \"All ADRs reframed under the planner-first delivery arc.\"\n32: template_source_hint: \"<!-- SPECKIT_TEMPLATE_SOURCE: decision-record | v2.2 -->\"\n33: ---\n34: # Decision Record: /memory:save Planner-First Default\n35: \n36: <!-- SPECKIT_LEVEL: 3+ -->\n37: <!-- SPECKIT_TEMPLATE_SOURCE: decision-record | v2.2 -->\n38: \n39: ---\n40: \n41: <!-- ANCHOR:adr-001 -->\n42: ## ADR-001: Trim-Targeted Verdict — Preserve the Writer Core, Trim the Default-Path Stack\n43: \n44: ### Metadata\n45: \n46: | Field | Value |\n47: |-------|-------|\n48: | **Status** | Accepted |\n49: | **Date** | 2026-04-15 |\n50: | **Deciders** | Relevance research synthesis |\n51: \n52: ### Context\n53: \n54: The retirement cutover removed the legacy `[spec]/memory/*.md` write path, but it did not answer whether the remaining save-flow backend was still proportionate. The research pass had to decide whether the system should keep its full automation stack, redesign the whole writer, or trim around the proven core.\n55: \n56: ### Decision\n57: \n58: **We chose**: Keep the canonical atomic writer, routed record identity, content-router core, and thin continuity validation, then trim or defer the save-time work that no longer earns default-path cost.\n59: \n60: **How it works**: The research classifies the remaining subsystems into load-bearing, partial-value, and over-engineered. Implementation then ships the trim-targeted path instead of rebuilding the writer from scratch.\n61: \n62: ### Consequences\n63: \n64: **Pros**\n65: - Preserved the proven mutation core.\n66: - Created a narrow and testable implementation target.\n67: \n68: **Cons**\n69: - Required precise classification of what was truly core versus optional. Mitigation: research answered Q1 through Q10 explicitly.\n70: \n71: **Neutral**\n72: - The legacy CLI wrapper kept partial value but stopped being treated as the write engine.\n73: \n74: ### Alternatives\n75: \n76: | Option | Why Not Chosen |\n77: |--------|----------------|\n78: | Keep the whole stack untouched | Research showed the default path was heavier than the remaining contract |\n79: | Replace the writer completely | Rebuilt safety logic that already worked |\n80: \n81: ### Related ADRs\n82: \n83: - ADR-002\n84: - ADR-003\n85: - ADR-004\n86: - ADR-005\n87: - ADR-006\n88: \n89: ---\n90: \n91: ### ADR-002: Planner-First Output Contract for `/memory:save`\n92: \n93: ### Metadata\n94: \n95: | Field | Value |\n96: |-------|-------|\n97: | **Status** | Accepted |\n98: | **Date** | 2026-04-15 |\n99: | **Deciders** | Implementation lead |\n100: \n101: ### Context\n102: \n103: Research showed that the default save path already had enough information to tell the AI what canonical doc to edit, what legality checks applied, and what follow-up actions remained. The question was whether the system should keep mutating by default or return a plan first.\n104: \n105: ### Decision\n106: \n107: **We chose**: Make planner-first output the default `/memory:save` contract and preserve `full-auto` as explicit fallback.\n108: \n109: **How it works**: The handler computes the same route and legality data as before, but the default path stops short of mutation and returns structured planner output instead.\n110: \n111: ### Consequences\n112: \n113: **Pros**\n114: - Made the default path reviewable and non-mutating.\n115: - Removed default-path dependence on multiple optional subsystems.\n116: \n117: **Cons**\n118: - Required schema stability between handler, CLI, and docs. Mitigation: shared types plus focused tests.\n119: \n120: **Neutral**\n121: - The full writer remained in the codebase for explicit fallback.\n122: \n123: ### Alternatives\n124: \n125: | Option | Why Not Chosen |\n126: |--------|----------------|\n127: | Keep full-auto as default | Preserved unnecessary hot-path cost |\n128: | Replace the save system with a new planner service | Wider scope and safety risk |\n129: \n130: ### Related ADRs\n131: \n132: - ADR-001\n133: - ADR-003\n134: - ADR-004\n135: - ADR-005\n136: - ADR-006\n137: \n138: ---\n139: \n140: ### ADR-003: Keep Reconsolidation-on-Save Behind Explicit Opt-In Behavior\n141: \n142: ### Metadata\n143: \n144: | Field | Value |\n145: |-------|-------|\n146: | **Status** | Accepted |\n147: | **Date** | 2026-04-15 |\n148: | **Deciders** | Implementation lead |\n149: \n150: ### Context\n151: \n152: Reconsolidation depended on flags, embeddings, and checkpoints, yet it was not a write-core correctness requirement. Research classified it as over-engineered for the default save path.\n153: \n154: ### Decision\n155: \n156: **We chose**: Remove reconsolidation from the default path and keep it available only through explicit opt-in or fallback behavior.\n157: \n158: **How it works**: Planner mode surfaces reconsolidation as follow-up capability. `full-auto` or explicit flags preserve access when operators want it.\n159: \n160: ### Consequences\n161: \n162: **Pros**\n163: - Reduced default-path cost.\n164: - Preserved a niche maintenance capability.\n165: \n166: **Cons**\n167: - Added some operator choice and documentation complexity. Mitigation: planner follow-up guidance and env-reference alignment.\n168: \n169: **Neutral**\n170: - Same-path identity remained protected by the core writer and lineage logic.\n171: \n172: ### Alternatives\n173: \n174: | Option | Why Not Chosen |\n175: |--------|----------------|\n176: | Keep reconsolidation on every save | Cost too high for the remaining contract |\n177: | Delete reconsolidation entirely | Removed a capability some operators still may want |\n178: \n179: ### Related ADRs\n180: \n181: - ADR-001\n182: - ADR-002\n183: - ADR-004\n184: \n185: ---\n186: \n187: ### ADR-004: Defer Post-Insert Enrichment into Follow-Up or Standalone Execution\n188: \n189: ### Metadata\n190: \n191: | Field | Value |\n192: |-------|-------|\n193: | **Status** | Accepted |\n194: | **Date** | 2026-04-15 |\n195: | **Deciders** | Implementation lead |\n196: \n197: ### Context\n198: \n199: Post-insert enrichment already behaved like optional work. Each step was flag-guarded and wrapped so failures would not block the save, which meant the runtime already treated it as non-core behavior.\n200: \n201: ### Decision\n202: \n203: **We chose**: Take enrichment out of the default save path and represent it as explicit follow-up or standalone work.\n204: \n205: **How it works**: The planner surfaces enrichment opportunities, and the follow-up APIs or explicit fallback path handle the actual execution when it is wanted.\n206: \n207: ### Consequences\n208: \n209: **Pros**\n210: - Reduced default-path latency and complexity.\n211: - Matched runtime behavior to the real importance of enrichment.\n212: \n213: **Cons**\n214: - Immediate graph richness can arrive later. Mitigation: follow-up actions stay explicit.\n215: \n216: **Neutral**\n217: - The write core did not change because enrichment was not its safety mechanism.\n218: \n219: ### Alternatives\n220: \n221: | Option | Why Not Chosen |\n222: |--------|----------------|\n223: | Keep enrichment on every save | Preserved cost without strengthening correctness |\n224: | Keep only one enrichment step on the default path | Hard to justify a special case |\n225: \n226: ### Related ADRs\n227: \n228: - ADR-001\n229: - ADR-002\n230: - ADR-005\n231: \n232: ---\n233: \n234: ### ADR-005: Keep the Eight-Category Router Contract While Trimming Classifier Scope\n235: \n236: ### Metadata\n237: \n238: | Field | Value |\n239: |-------|-------|\n240: | **Status** | Accepted |\n241: | **Date** | 2026-04-15 |\n242: | **Deciders** | Implementation lead |\n243: \n244: ### Context\n245: \n246: Research judged the eight-category contract useful, but it judged the wider classifier stack too large for the simplified save problem. The implementation had to keep target authority while reducing default-path routing complexity.\n247: \n248: ### Decision\n249: \n250: **We chose**: Preserve the eight routing categories and deterministic Tier 1 or Tier 2 behavior, while removing Tier 3 from the default path and trimming Tier 2 scope.\n251: \n252: **How it works**: Category-to-target mapping stays intact. Only classifier participation changes.\n253: \n254: ### Consequences\n255: \n256: **Pros**\n257: - Preserved target authority and compatibility.\n258: - Made the default path more deterministic.\n259: \n260: **Cons**\n261: - Borderline cases can now require manual review more often. Mitigation: transcript validation and explicit warnings.\n262: \n263: **Neutral**\n264: - Route overrides and audit behavior stayed part of the router contract.\n265: \n266: ### Alternatives\n267: \n268: | Option | Why Not Chosen |\n269: |--------|----------------|\n270: | Keep all classifier tiers untouched | Too heavy for the new default path |\n271: | Replace the router with only handcrafted rules | Risked category coverage loss without proof |\n272: \n273: ### Related ADRs\n274: \n275: - ADR-001\n276: - ADR-002\n277: - ADR-006\n278: \n279: ---\n280: \n281: ### ADR-006: Keep Hard Legality Checks While Retiring Quality-Loop Auto-Fix from the Default Path\n282: \n283: ### Metadata\n284: \n285: | Field | Value |\n286: |-------|-------|\n287: | **Status** | Accepted |\n288: | **Date** | 2026-04-15 |\n289: | **Deciders** | Implementation lead |\n290: \n291: ### Context\n292: \n293: The save path mixed hard legality checks with score-heavy or auto-fix behavior. Research concluded that only the first part was required to protect canonical docs.\n294: \n295: ### Decision\n296: \n297: **We chose**: Keep structural and legality checks as blockers and move quality-loop auto-fix out of the default path.\n298: \n299: **How it works**: The planner reports advisory quality issues, but malformed or unsafe saves still block.\n300: \n301: ### Consequences\n302: \n303: **Pros**\n304: - Preserved correctness guarantees.\n305: - Removed surprise mutation-time rewrites from the default path.\n306: \n307: **Cons**\n308: - Some fixes now require explicit edits. Mitigation: planner output shows them clearly.\n309: \n310: **Neutral**\n311: - Opt-in quality automation can still exist later if evidence supports it.\n312: \n313: ### Alternatives\n314: \n315: | Option | Why Not Chosen |\n316: |--------|----------------|\n317: | Keep auto-fix on every save | Preserved hot-path complexity the research rejected |\n318: | Remove both blockers and auto-fix | Unsafe for canonical docs |\n319: \n320: ### Related ADRs\n321: \n322: - ADR-001\n323: - ADR-002\n324: - ADR-005\n325: \n326: ---\n327: \n328: ### ADR-007: Record the Scoped `content-router.ts` Preservation Exception\n329: \n330: ### Metadata\n331: \n332: | Field | Value |\n333: |-------|-------|\n334: | **Status** | Accepted |\n335: | **Date** | 2026-04-15 |\n336: | **Deciders** | Remediation pass |\n337: \n338: ### Context\n339: \n340: Implementation initially claimed the four load-bearing files stayed unchanged, but deep review showed that `content-router.ts` now contained a real control-flow guard for Tier 3 default-disable and manual-review return behavior.\n341: \n342: ### Decision\n343: \n344: **We chose**: Keep the guard in `content-router.ts` and document it as a scoped preservation exception instead of pretending the whole file remained unchanged.\n345: \n346: **How it works**: The eight-category switch, Tier 1 logic, Tier 2 matching, and target selection remain the preserved contract. The documented exception is the Tier 3 default-disable and manual-review guard.\n347: \n348: ### Consequences\n349: \n350: **Pros**\n351: - Fixed the documentation and changelog honesty gap.\n352: - Kept route-selection authority in one place.\n353: \n354: **Cons**\n355: - We lost the simpler \"bit-for-bit preserved\" story. Mitigation: ADR-007 and release-note updates preserve the honest story.\n356: \n357: **Neutral**\n358: - Other core files stayed unchanged.\n359: \n360: ### Alternatives\n361: \n362: | Option | Why Not Chosen |\n363: |--------|----------------|\n364: | Move the guard outside the router | Added coordination complexity and duplicated control flow |\n365: | Ignore the contradiction | Left packet docs and release notes inaccurate |\n366: \n367: ### Related ADRs\n368: \n369: - ADR-005\n370: <!-- /ANCHOR:adr-001 -->\n\n(End of file - total 370 lines)\n</content>","metadata":{"preview":"---\ntitle: \"...em-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/decision-record]\"\ndescription: \"ADR ledger for the planner-first /memory:save contract: the trim-targeted verdict, planner-first default output, reconsolidation opt-in, enrichment deferral, router category contract, hard-blocker preservation, and the scoped content-router.ts exception.\"\ntrigger_phrases:\n  - \"decision record\"\n  - \"memory save planner first adr\"\n  - \"planner-first save\"\n  - \"trim-targeted verdict\"\n  - \"content-router scoped exception\"\nimportance_tier: \"important\"\ncontextType: \"planning\"\n_memory:\n  continuity:\n    packet_pointer: \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\"\n    last_updated_at: \"2026-04-15T10:00:01Z\"\n    last_updated_by: \"cli-copilot\"\n    recent_action: \"Rewrote ADR ledger as cohesive planner-first decision sequence\"\n    next_safe_action: \"Packet complete\"\n    blockers: []\n    key_files:","truncated":false,"loaded":[]},"title":".opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/decision-record.md","time":{"start":1777303174457,"end":1777303174466}}}}
{"type":"tool_use","timestamp":1777303176903,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf863e50001Uo8NABKeLORSd7","messageID":"msg_dcf861169001yxGyGFGxLQT4oQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"tool","tool":"read","callID":"call_01_ugbn3vnP4x1g9dyysseJt22P","state":{"status":"completed","input":{"filePath":"/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec.md"},"output":"<path>/Users/michelkerkmeester/MEGA/Development/Code_Environment/Public/.opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec.md</path>\n<type>file</type>\n<content>\n1: ---\n2: title: \"Feature [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec]\"\n3: description: \"Make /memory:save planner-first (non-mutating) by default while preserving full-auto as an explicit fallback, retire the legacy [spec]/memory/*.md write path, and decouple freshness (graph-metadata refresh, spec-doc reindex, enrichment) from the hot save path via explicit follow-up APIs.\"\n4: trigger_phrases:\n5:   - \"004-memory-save-rewrite\"\n6:   - \"014-memory-save-rewrite\"\n7:   - \"memory save planner first\"\n8:   - \"planner-first memory save\"\n9:   - \"full-auto fallback\"\n10:   - \"speckit_save_planner_mode\"\n11:   - \"memory folder retirement\"\n12:   - \"content-router scoped exception\"\n13:   - \"refreshgraphmetadata reindexspecdocs runenrichmentbackfill\"\n14:   - \"v3.4.1.0 save flow\"\n15:   - \"026-graph-and-context-optimization\"\n16: importance_tier: \"important\"\n17: contextType: \"implementation\"\n18: _memory:\n19:   continuity:\n20:     packet_pointer: \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\"\n21:     last_updated_at: \"2026-04-15T10:00:01Z\"\n22:     last_updated_by: \"cli-copilot\"\n23:     recent_action: \"Folder renamed; spec rewritten under planner-first framing\"\n24:     next_safe_action: \"Packet complete\"\n25:     blockers: []\n26:     key_files:\n27:       - \"spec.md\"\n28:       - \"plan.md\"\n29:       - \"tasks.md\"\n30:       - \"checklist.md\"\n31:       - \"decision-record.md\"\n32:       - \"implementation-summary.md\"\n33:       - \"research/013-audit-snapshot/review-report.md\"\n34:       - \"research/014-research-snapshot/research.md\"\n35:       - \"review/015-deep-review-snapshot/review-report.md\"\n36:     session_dedup:\n37:       fingerprint: \"sha256:014-planner-first-default-2026-04-15\"\n38:       session_id: \"014-planner-first-default-2026-04-15\"\n39:       parent_session_id: \"014-planner-first-default-closeout\"\n40:     completion_pct: 100\n41:     open_questions: []\n42:     answered_questions:\n43:       - \"The runtime was half-migrated: the legacy [spec]/memory/*.md write path was still live even after v3.4.0.0 docs claimed retirement.\"\n44:       - \"Research classified 15 save-flow subsystems and concluded that the writer core earns its cost while Tier 3 routing, reconsolidation, heavy quality automation, and enrichment do not.\"\n45:       - \"Implementation shipped planner-first default with explicit full-auto fallback; freshness work moved to explicit follow-up APIs.\"\n46:       - \"Deep review found 9 issues (3 P0, 5 P1, 1 P2); all resolved.\"\n47: template_source_hint: \"<!-- SPECKIT_TEMPLATE_SOURCE: spec-core + level2-verify + level3-arch + level3plus-gov | v2.2 -->\"\n48: ---\n49: # Feature Specification: /memory:save Planner-First Default\n50: \n51: <!-- SPECKIT_LEVEL: 3+ -->\n52: <!-- SPECKIT_TEMPLATE_SOURCE: spec-core + level2-verify + level3-arch + level3plus-gov | v2.2 -->\n53: \n54: ---\n55: \n56: ## EXECUTIVE SUMMARY\n57: \n58: `/memory:save` was doing too much on every invocation. The runtime still created, wrote, indexed, and read `[spec]/memory/*.md` even though v3.4.0.0 docs claimed that artifact was retired; on top of that legacy write path, every save triggered Tier 3 routing, a heavy quality-loop auto-fix, reconsolidation-on-save, post-insert enrichment, unconditional graph-metadata refresh, and unconditional spec-doc reindex — regardless of whether the caller actually wanted mutation. Auditing the code proved the system was half-migrated, turning vague drift into 25 concrete findings. Classifying the remaining 15 save-flow subsystems proved which ones still earned runtime cost (the canonical atomic writer, routed record identity, the content-router category contract, and thin continuity validation) and which ones did not belong on the default path.\n59: \n60: This packet delivers the end state implied by that analysis. `/memory:save` is planner-first by default: the handler computes the same route and legality data as before but stops short of mutation and returns structured planner output instead. `full-auto` is preserved as an explicit fallback via `SPECKIT_SAVE_PLANNER_MODE=full-auto`, with canonical atomic mutation, `POST_SAVE_FINGERPRINT` safety parity, same-path identity, and rollback intact. The legacy `[spec]/memory/*.md` write path is retired. Four previously default-on behaviors become explicit opt-in: `SPECKIT_ROUTER_TIER3_ENABLED`, `SPECKIT_QUALITY_AUTO_FIX`, `SPECKIT_RECONSOLIDATION_ENABLED`, `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED`. Freshness becomes follow-up work via three new APIs: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`. `hybrid` is documented as reserved and currently behaves like `plan-only`. The content-router category contract is preserved with one honest, scoped exception: a Tier 3 default-disable and manual-review guard inside `content-router.ts`. 43 implementation tasks shipped under v3.4.1.0. A deep-review pass flagged 3 P0, 5 P1, and 1 P2 findings on router honesty, fallback safety parity, blocker classification, deferred-helper coverage, and changelog accuracy; all 9 were resolved before closeout.\n61: \n62: ---\n63: \n64: <!-- ANCHOR:metadata -->\n65: ## 1. METADATA\n66: \n67: | Field | Value |\n68: |-------|-------|\n69: | **Level** | 3+ |\n70: | **Priority** | P1 |\n71: | **Status** | Complete |\n72: | **Created** | 2026-04-14 |\n73: | **Completed** | 2026-04-15 |\n74: | **Branch** | `026-014-memory-save-rewrite` |\n75: | **Phase Folder** | `004-memory-save-rewrite` (historical alias: `014-memory-save-rewrite`) |\n76: | **Parent Packet** | `026-graph-and-context-optimization` |\n77: | **Release Context** | `v3.4.1.0` |\n78: \n79: ---\n80: \n81: | **Parent Spec** | ../spec.md |\n82: | **Parent Plan** | ../plan.md |\n83: | **Predecessor** | ../003-continuity-refactor-gates/spec.md |\n84: | **Successor** | None |\n85: <!-- /ANCHOR:metadata -->\n86: <!-- ANCHOR:problem -->\n87: ## 2. PROBLEM & PURPOSE\n88: \n89: ### Problem Statement\n90: \n91: `/memory:save` mutated by default, did work that had nothing to do with the caller's intent, and still honored an artifact family that had supposedly been retired. The audit produced 25 concrete findings across runtime write path, runtime read path, indexing, documentation contradictions, template drift, test drift, and a phantom save-side dedup contract. Relevance research then classified the remaining 15 save-flow subsystems and showed that four core pieces earned their cost (canonical atomic writer, routed record identity, content-router category contract, thin continuity validation) while four others (Tier 3 routing, reconsolidation-on-save, heavy quality-loop auto-fix, post-insert enrichment) did not belong on the default path. That combined picture made the default contract untenable: operators got mutation they didn't ask for, freshness work they didn't need, and an artifact surface docs claimed was gone.\n92: \n93: ### Purpose\n94: \n95: Ship a `/memory:save` contract that matches the evidence: planner-first by default so operators see the plan before anything changes, full-auto preserved as an explicit fallback for the cases that still need it, and freshness work moved to callable follow-up APIs so every save doesn't pay for work it doesn't need. Retire the legacy `[spec]/memory/*.md` write path end-to-end. Make four previously default-on behaviors opt-in via per-subsystem env flags, preserve `hybrid` as a reserved value, and record the scoped router exception honestly so docs match the code.\n96: \n97: ---\n98: \n99: <!-- /ANCHOR:problem -->\n100: <!-- ANCHOR:scope -->\n101: ## 3. SCOPE\n102: \n103: ### In Scope\n104: \n105: - Make `/memory:save` planner-first by default: the default path computes route + legality data, returns structured planner output, does not mutate files.\n106: - Preserve the `full-auto` writer path as an explicit fallback activated via `SPECKIT_SAVE_PLANNER_MODE=full-auto` with canonical atomic mutation, promotion, rollback, and same-path identity intact.\n107: - Retire the legacy `[spec]/memory/*.md` write and read path runtime-wide: remove the write path, update dedup and causal-link behavior to use canonical docs + the routed record, stop indexing `memory/*.md` into the vector DB.\n108: - Introduce three explicit follow-up APIs for freshness: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill`. Remove their unconditional participation in every save.\n109: - Gate four previously default-on save-path behaviors behind explicit env flags: `SPECKIT_ROUTER_TIER3_ENABLED` (default OFF), `SPECKIT_QUALITY_AUTO_FIX` (default OFF), `SPECKIT_RECONSOLIDATION_ENABLED` (default OFF), `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED` (default OFF).\n110: - Preserve the content-router eight-category contract. Record the single scoped exception inside `content-router.ts`: Tier 3 default-disable + manual-review return behavior.\n111: - Preserve hard legality checks and structural blockers in the save-quality gate; remove default-path quality-loop auto-fix retries while keeping advisory output.\n112: - Reserve `hybrid` as a valid value for `SPECKIT_SAVE_PLANNER_MODE` that currently behaves like `plan-only`; document it as reserved honestly.\n113: - Restore `POST_SAVE_FINGERPRINT` parity on the full-auto path.\n114: - Promote template-contract failures from advisories to planner blockers.\n115: - Make deferred helpers return explicit deferred status when skipped (no success-shaped status when nothing ran).\n116: - Update packet docs, `ENV_REFERENCE.md`, release notes, and test fixtures so the documented contract matches the shipped behavior (router scope, hybrid reserved state, follow-up tool names, freshness as explicit follow-up).\n117: - Update tests across `memory-save`, `content-router`, `quality-loop`, `save-quality-gate`, reconsolidation-bridge, reconsolidation, assistive-reconsolidation, chunking, graph-refresh, thin-continuity, planner UX, CLI target authority, and memory-save integration to prove planner-default + fallback end-to-end behavior.\n118: - Validate planner-first behavior against three real session transcripts before closeout.\n119: \n120: ### Out of Scope\n121: \n122: - Changes to the canonical atomic writer internals; reuse as-is.\n123: - Changes to the eight-category router contract; reuse as-is.\n124: - Replacing the save system with a new planner service; the existing handler owns the contract.\n125: - Changes to embedding backends, vector-DB schemas, or checkpoint/restore internals.\n126: - Packet 012's canonical intake work or packet 013's advisor phrase-booster work — unrelated scope.\n127: \n128: ### Files to Change\n129: \n130: | Surface | File Path | Change Type | Why It Matters |\n131: |---------|-----------|-------------|----------------|\n132: | Legacy write path retirement | `workflow.ts`, `file-writer.ts`, `memory-indexer.ts`, `memory-metadata.ts`, `directory-setup.ts` | Retire | Audit proved the runtime still created, wrote, indexed, and read `[spec]/memory/*.md` in contradiction to v3.4.0.0 retirement claim |\n133: | Planner contract core | `memory-save.ts`, `types.ts`, `response-builder.ts`, `validation-responses.ts`, `generate-context.ts` | Modify | Introduce planner-first default + shared types + blocker/advisory separation |\n134: | Canonical writer reuse | `create-record.ts`, `atomic-index-memory.ts`, `thin-continuity-record.ts`, `post-insert.ts` | Reuse/preserve | Core writer earns its cost; fallback path depends on stable interfaces |\n135: | Content router | `content-router.ts` | Modify (scoped) | Preserve eight-category contract; add Tier 3 default-disable + manual-review guard |\n136: | Quality gate | `quality-loop.ts`, `save-quality-gate.ts` | Modify | Preserve hard blockers; retire default-path auto-fix retries; keep advisory output |\n137: | Reconsolidation | `reconsolidation-bridge.ts` | Gate | Move behind explicit opt-in or fallback |\n138: | Freshness API | `api/indexing.ts`, `graph-metadata-parser.ts` | Create/expose | Follow-up APIs: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill` |\n139: | Command docs | `../../../../command/memory/save.md`, `../../../../command/memory/manage.md` | Modify | Document planner-first default, fallback, and follow-up freshness actions |\n140: | Reference docs | `../../../../skill/system-spec-kit/references/memory/save_workflow.md`, `../../../../skill/system-spec-kit/references/memory/memory_system.md`, templates | Modify | Align operator-facing references with shipped contract |\n141: | Env reference | `../../../../skill/system-spec-kit/mcp_server/ENV_REFERENCE.md` | Modify | Document `SPECKIT_SAVE_PLANNER_MODE`, per-subsystem flags, reserved `hybrid` honestly |\n142: | Release notes | `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` | Author | Record shipped contract, router scoped exception, reserved `hybrid`, follow-up APIs |\n143: | Test surfaces | See tasks.md §Testing — broad vitest + transcript prototype sweep | Modify | Prove planner-default, fallback parity, gate behavior, continuity upserts |\n144: | Packet metadata | `description.json`, `graph-metadata.json`, packet-local changelog | Generate | Packet discovery + graph visibility |\n145: | Packet docs | `spec.md`, `plan.md`, `tasks.md`, `checklist.md`, `decision-record.md`, `implementation-summary.md` | Create | Tell the complete story end-to-end |\n146: \n147: ### Research and Review Evidence\n148: \n149: The packet carries packet-local snapshots of the audit report, research synthesis, deep-review report, and planner-first transcript prototypes so a reader can inspect the most important artifacts without leaving the folder. Those snapshots live under `research/013-audit-snapshot/`, `research/014-research-snapshot/`, `review/015-deep-review-snapshot/`, and `scratch/transcripts-snapshot/` inside this flattened `004-memory-save-rewrite` packet.\n150: \n151: ---\n152: \n153: <!-- /ANCHOR:scope -->\n154: <!-- ANCHOR:requirements -->\n155: ## 4. REQUIREMENTS\n156: \n157: ### P0 — Blockers\n158: \n159: | ID | Requirement | Acceptance Criteria |\n160: |----|-------------|---------------------|\n161: | REQ-001 | The default `/memory:save` path must be planner-first and non-mutating. | Default invocation returns structured planner output (route, legality, blockers, advisories, follow-up actions) and mutates no files on disk. |\n162: | REQ-002 | Explicit `full-auto` must remain available as fallback. | Setting `SPECKIT_SAVE_PLANNER_MODE=full-auto` runs the canonical atomic writer with promotion, rollback, and same-path identity intact. |\n163: | REQ-003 | The legacy `[spec]/memory/*.md` write path must be retired. | `workflow.ts`, `file-writer.ts`, `memory-indexer.ts`, `memory-metadata.ts`, and `directory-setup.ts` no longer create, write, index, or read that surface. |\n164: | REQ-004 | Tier 3 routing must be default-off with a scoped, auditable exception. | `SPECKIT_ROUTER_TIER3_ENABLED=false` is default; `content-router.ts` contains the scoped default-disable + manual-review guard; the eight-category contract is otherwise unchanged. |\n165: | REQ-005 | Quality-loop auto-fix must leave the default path while hard blockers remain. | Default path emits advisory output only; structural/legality blockers still fail the save; `SPECKIT_QUALITY_AUTO_FIX=false` is default. |\n166: | REQ-006 | Reconsolidation-on-save must be explicit opt-in. | Default path never triggers reconsolidation; `SPECKIT_RECONSOLIDATION_ENABLED=false` is default; opt-in via env flag or fallback execution. |\n167: | REQ-007 | Post-insert enrichment must leave the default save path. | Default path emits no enrichment calls; `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED=false` is default; opt-in via env flag or follow-up API. |\n168: | REQ-008 | Unconditional graph refresh and spec-doc reindex must leave planner-default saves. | Planner-default saves no longer trigger these; explicit follow-up APIs handle the work when wanted. |\n169: | REQ-009 | `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill` must exist as explicit follow-up APIs. | All three are callable independently of the save path; each has execution-level test coverage. |\n170: | REQ-010 | Fallback safety parity must be preserved. | `POST_SAVE_FINGERPRINT` parity is restored on the full-auto path; fallback tests prove atomic mutation + rollback semantics match the pre-packet writer. |\n171: | REQ-011 | Template-contract failures must be planner blockers. | Template-contract misses surface as `blocker` entries in planner output, not as advisories. |\n172: | REQ-012 | Deferred helpers must return explicit deferred status. | When default-path skips reconsolidation, enrichment, Tier 3 routing, or quality auto-fix, the planner response records `deferred` rather than success-shaped output. |\n173: | REQ-013 | `hybrid` must be documented as reserved. | `SPECKIT_SAVE_PLANNER_MODE=hybrid` is recognized; current behavior matches `plan-only`; docs and env reference describe it as reserved for future behavior. |\n174: | REQ-014 | Shipped documentation must match the runtime contract. | `/memory:save` docs, `ENV_REFERENCE.md`, release notes, and templates describe planner-first default, explicit fallback, follow-up APIs, reserved `hybrid`, and the scoped router exception honestly. |\n175: | REQ-015 | Canonical atomic writer, routed record identity, content-router category contract, and thin continuity validation must remain intact. | Fallback path plus continuity upserts still run through the preserved core; tests prove no behavior regression outside the documented gated flags. |\n176: \n177: ### P1 — Required\n178: \n179: | ID | Requirement | Acceptance Criteria |\n180: |----|-------------|---------------------|\n181: | REQ-016 | Planner output must preserve blocker/advisory separation. | Types and helpers distinguish `blocker` entries (must fix) from `advisory` entries (informational) in all code paths and tests. |\n182: | REQ-017 | CLI target authority must stay deterministic. | Planner-default CLI tests prove the same target selection as full-auto for identical inputs. |\n183: | REQ-018 | Same-path identity must remain deterministic after the refactor. | Record identity tests confirm identical path semantics for the same-target save case across planner and full-auto paths. |\n184: | REQ-019 | `/spec_kit:resume` recovery ladder must stay intact. | Recovery ladder tests show no regression when the save path is planner-first. |\n185: | REQ-020 | Transcript prototypes must ground planner behavior. | Three real session transcripts are exercised; no unexpected drops, wrong-anchor outcomes, or unsafe target exposures are produced. |\n186: | REQ-021 | Planner output must not expose unsafe file targets. | Target authority tests verify the planner emits only caller-authorized paths. |\n187: | REQ-022 | Fallback flags must not silently widen mutation scope. | Env-flag documentation + tests prove that enabling any single opt-in flag does not cascade other opt-ins. |\n188: | REQ-023 | Continuity upserts must still use validated helpers. | Thin continuity + upsert tests pass unchanged expectations. |\n189: | REQ-024 | Follow-up APIs must be execution-level test-covered. | `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill` have vitest suites covering at least happy-path + one failure branch each. |\n190: | REQ-025 | Four trim targets must stay aligned across packet docs. | Tier 3 routing, quality-loop auto-fix, reconsolidation-on-save, and post-insert enrichment are each documented consistently as default-off + opt-in. |\n191: \n192: ### P2 — Nice to Have\n193: \n194: | ID | Requirement | Acceptance Criteria |\n195: |----|-------------|---------------------|\n196: | REQ-026 | Transcript backlog captured. | If a transcript prototype surfaces an issue that is not fixed in this packet, it is logged rather than lost. |\n197: | REQ-027 | No new network dependency on the default path. | Planner-default never depends on new network calls introduced by this packet. |\n198: | REQ-028 | Env reference diagrams and tables stay readable. | Env reference uses consistent wording for default/opt-in, reserved, and fallback. |\n199: | REQ-029 | Chunking stays a size-driven fallback. | Chunking remains a fallback behavior for oversized inputs; not a default dependency. |\n200: | REQ-030 | Follow-up actions surface consistently. | Planner output surfaces follow-up actions in a single consistent schema across router, quality, reconsolidation, enrichment, and indexing scenarios. |\n201: \n202: ---\n203: \n204: <!-- /ANCHOR:requirements -->\n205: <!-- ANCHOR:success-criteria -->\n206: ## 5. SUCCESS CRITERIA\n207: \n208: - **SC-001**: `/memory:save` with no env override returns structured planner output and mutates no files.\n209: - **SC-002**: `SPECKIT_SAVE_PLANNER_MODE=full-auto` runs the canonical atomic writer with `POST_SAVE_FINGERPRINT` parity, promotion, and rollback intact.\n210: - **SC-003**: `[spec]/memory/*.md` is no longer created, written, indexed, or read at runtime; audit evidence (F001-F007) resolved.\n211: - **SC-004**: `SPECKIT_ROUTER_TIER3_ENABLED=false` is the default; Tier 3 routing only runs when explicitly enabled; `content-router.ts` Tier 3 guard is the single documented exception.\n212: - **SC-005**: `SPECKIT_QUALITY_AUTO_FIX=false` is the default; hard blockers still fire on malformed saves; advisory output remains available.\n213: - **SC-006**: `SPECKIT_RECONSOLIDATION_ENABLED=false` is the default; reconsolidation is available via opt-in or fallback.\n214: - **SC-007**: `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED=false` is the default; enrichment is available via opt-in or follow-up API.\n215: - **SC-008**: `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill` are callable APIs with execution-level test coverage.\n216: - **SC-009**: `hybrid` is recognized as reserved for `SPECKIT_SAVE_PLANNER_MODE`; documented as currently behaving like `plan-only`.\n217: - **SC-010**: Deferred helpers return explicit `deferred` status instead of success-shaped output when the default path skips them.\n218: - **SC-011**: Template-contract failures produce `blocker` entries in planner output.\n219: - **SC-012**: Docs (`/memory:save`, `ENV_REFERENCE.md`, release notes, templates) match the shipped contract; router scope is described honestly.\n220: - **SC-013**: 43 of 43 implementation tasks completed; 0 blocked tasks at closeout.\n221: - **SC-014**: Deep-review findings F001-F009 (3 P0, 5 P1, 1 P2) are resolved.\n222: - **SC-015**: Canonical atomic writer, routed record identity, content-router category contract, and thin continuity validation are unchanged outside the documented Tier 3 guard.\n223: - **SC-016**: Packet 014 primary docs pass `validate_document.py`.\n224: - **SC-017**: Packet passes `validate.sh --strict`.\n225: - **SC-018**: `description.json`, `graph-metadata.json`, and packet-local changelog exist.\n226: - **SC-019**: Three real session transcripts validate planner-first behavior with no wrong-anchor or unsafe-target outcomes.\n227: \n228: ---\n229: \n230: <!-- /ANCHOR:success-criteria -->\n231: <!-- ANCHOR:risks -->\n232: ## 6. RISKS & DEPENDENCIES\n233: \n234: | Type | Item | Impact | Mitigation |\n235: |------|------|--------|------------|\n236: | Dependency | Canonical atomic writer stability | High | Preserve as-is; fallback path relies on it |\n237: | Dependency | Eight-category router contract | High | Preserve; record scoped Tier 3 exception only |\n238: | Dependency | Vitest + transcript fixtures | High | Broad test sweep covers planner, fallback, router, quality, reconsolidation, enrichment, follow-up APIs, continuity |\n239: | Dependency | `ENV_REFERENCE.md` + release notes alignment | High | Update both in the same packet as the runtime changes |\n240: | Risk | Default path still mutates on some branch | High | Planner-default tests assert non-mutation; CI catches regression |\n241: | Risk | Full-auto fallback loses `POST_SAVE_FINGERPRINT` parity | High | Explicit remediation (P015-R002) restores parity; fallback tests prove it |\n242: | Risk | Docs drift from runtime after release | High | Changelog honesty remediation (P015-R009) aligns release notes to the scoped router exception and reserved `hybrid` state |\n243: | Risk | Borderline router cases silently widen Tier 3 use | Medium | Tier 3 is default-disable + manual-review guard inside `content-router.ts`; env flag is opt-in only |\n244: | Risk | Deferred helpers appear to have \"succeeded\" when they ran nothing | Medium | Explicit `deferred` status in planner output (P015-R004) |\n245: | Risk | Template-contract misses hide as advisories | Medium | Promote to planner blockers (P015-R003) |\n246: | Risk | `hybrid` mode assumed to be a live mixed-flow behavior | Medium | Reserved state documented explicitly in docs and release notes |\n247: | Risk | Follow-up APIs ship without execution-level coverage | Medium | Remediation (P015-R006) adds coverage before closeout |\n248: | Risk | Packet docs understate what the deep review caught | Medium | Implementation summary records 9-finding remediation closeout with status per finding |\n249: \n250: ---\n251: \n252: ## 7. NON-FUNCTIONAL REQUIREMENTS\n253: \n254: ### Correctness\n255: \n256: - **NFR-C01**: The planner-default path must not mutate any file on disk.\n257: - **NFR-C02**: The full-auto fallback must match pre-packet writer behavior for atomic mutation and rollback.\n258: - **NFR-C03**: Router target authority must be identical between planner and fallback paths for the same inputs.\n259: \n260: ### Safety\n261: \n262: - **NFR-SA01**: Hard legality blockers must still fire on malformed saves regardless of mode.\n263: - **NFR-SA02**: Planner output must expose only caller-authorized file targets.\n264: - **NFR-SA03**: `POST_SAVE_FINGERPRINT` parity must be restored on the full-auto path.\n265: \n266: ### Traceability\n267: \n268: - **NFR-T01**: Every planner output item must map to a typed entry (`blocker` or `advisory` or `deferred`) with a source reason.\n269: - **NFR-T02**: Env flags must be named consistently across code, docs, and env reference.\n270: - **NFR-T03**: Deferred helpers must name the gated subsystem explicitly when skipping.\n271: \n272: ### Maintainability\n273: \n274: - **NFR-M01**: The canonical atomic writer must remain the single mutation mechanism used by the fallback path.\n275: - **NFR-M02**: The eight-category router contract must remain the single route-target mapping.\n276: - **NFR-M03**: Opt-in flags must be orthogonal so enabling one does not cascade others.\n277: \n278: ### Governance\n279: \n280: - **NFR-G01**: Level 3+ structure with governance and compliance sections present.\n281: - **NFR-G02**: Packet passes `validate_document.py` and `validate.sh --strict`.\n282: - **NFR-G03**: Release notes, `/memory:save` docs, and `ENV_REFERENCE.md` must agree on the same default/opt-in/reserved vocabulary.\n283: \n284: ### Usability\n285: \n286: - **NFR-U01**: Planner output must be human-readable and action-oriented.\n287: - **NFR-U02**: Operator docs must describe planner-first default, explicit fallback, and follow-up APIs in consistent language.\n288: - **NFR-U03**: Follow-up action names must match the shipped tool names in packet docs.\n289: \n290: ### Reliability\n291: \n292: - **NFR-R01**: The default path must not introduce any new network dependency.\n293: - **NFR-R02**: Known limitations carried from the release and remediation pass must be preserved in packet docs.\n294: - **NFR-R03**: Packet metadata must support packet discovery and graph traversal.\n295: \n296: ### Transcript Snapshot Hygiene\n297: \n298: - **NFR-TH01**: Transcript snapshots retained in packet-local `scratch/` or `review/` directories must not contain raw API keys, bearer tokens, or user credentials. The planner and fallback paths must strip or redact credential-shaped strings before writing any transcript artifact to disk.\n299: - **NFR-TH02**: Transcript artifacts exceeding 500 KB must be truncated or chunked with a deterministic hash pointer so the full content can be reconstructed from the source session without bloating the packet.\n300: \n301: ---\n302: \n303: ## 8. EDGE CASES\n304: \n305: ### Runtime Edge Cases\n306: \n307: - Caller invokes `/memory:save` with no args → planner-default; returns plan; does not mutate.\n308: - Caller explicitly requests `full-auto` → atomic mutation + rollback path.\n309: - Caller explicitly enables `SPECKIT_ROUTER_TIER3_ENABLED` → Tier 3 routing participates; manual-review return flag is surfaced when triggered.\n310: - Caller enables any single opt-in flag → only that subsystem activates; no cascade.\n311: - Malformed template-contract save → planner output contains at least one `blocker` entry.\n312: - Default-path call that would otherwise run reconsolidation → planner returns a `deferred` entry naming reconsolidation explicitly.\n313: - `SPECKIT_SAVE_PLANNER_MODE=hybrid` → behaves like `plan-only`; documented as reserved.\n314: - Follow-up API called independently → executes without touching the save path.\n315: \n316: ### Documentation Edge Cases\n317: \n318: - A reader assumes \"planner-first\" means `full-auto` was deleted → docs must be explicit that `full-auto` remains available as fallback.\n319: - A reader assumes \"content-router preserved\" means zero file-level edits → docs must surface the scoped Tier 3 guard honestly.\n320: - A reader assumes `hybrid` is a live mixed-flow mode → docs must describe it as reserved with current `plan-only` behavior.\n321: - A reader expects every save to reindex docs → docs must describe `reindexSpecDocs` as an explicit follow-up action.\n322: \n323: ---\n324: \n325: ## 9. COMPLEXITY ASSESSMENT\n326: \n327: | Dimension | Score | Notes |\n328: |-----------|-------|-------|\n329: | Scope | 23/25 | 15-subsystem save-flow audit, 43-task implementation, 9-finding deep-review remediation, plus docs + env reference + release note alignment |\n330: | Risk | 21/25 | High narrative + correctness risk because the packet changes the default save contract and must preserve fallback safety parity |\n331: | Research | 18/20 | Requires grounding on audit evidence, research classification, implementation scope, deep-review findings, and release notes |\n332: | Multi-Agent | 12/15 | cli-codex led the main build-out; cli-copilot finished late-stage M5 closeout; parallel Opus agents for remediation |\n333: | Coordination | 14/15 | Runtime changes + docs + env reference + release notes + packet metadata must all stay aligned |\n334: | **Total** | **88/100** | **Level 3+** |\n335: \n336: ---\n337: \n338: ## 10. RISK MATRIX\n339: \n340: | Risk ID | Description | Impact | Likelihood | Mitigation |\n341: |---------|-------------|--------|------------|------------|\n342: | R-001 | Default path mutates under a hidden branch | High | Low | Planner-default non-mutation tests |\n343: | R-002 | Fallback loses atomic safety parity | High | Low | `POST_SAVE_FINGERPRINT` restored (ADR-007) |\n344: | R-003 | Router preservation claim contradicts code | High | Medium | Scoped exception documented (ADR-007) |\n345: | R-004 | Remediation underplayed after deep review | High | Low | 9-finding closure section in tasks, checklist, implementation summary |\n346: | R-005 | Release notes drift from runtime contract | Medium | Medium | Changelog honesty remediation P015-R009 |\n347: | R-006 | Opt-in flag cascade activates unintended subsystems | High | Low | Env reference + orthogonality tests |\n348: | R-007 | Template-contract failures hide as advisories | Medium | Medium | Promoted to blockers (P015-R003) |\n349: | R-008 | Deferred helpers appear \"successful\" when skipped | Medium | Medium | Explicit `deferred` status (P015-R004) |\n350: \n351: ---\n352: \n353: ## 11. USER STORIES\n354: \n355: ### US-001: Planner-first default\n356: \n357: **As an** operator running `/memory:save`, **I want** the default path to show me a plan before anything changes, **so that** I can review routing, legality, and follow-up actions without committing to mutation.\n358: \n359: **Acceptance Criteria**\n360: 1. Given a caller invokes `/memory:save` with no args, when the handler runs, then it returns structured planner output and mutates nothing.\n361: 2. Given a caller sees a planner blocker, when they correct the blocker, then a subsequent planner call shows the blocker resolved.\n362: \n363: ### US-002: Full-auto fallback\n364: \n365: **As an** operator who still wants mutation, **I want** `SPECKIT_SAVE_PLANNER_MODE=full-auto` to run the canonical writer, **so that** automation workflows that depended on in-save mutation keep working.\n366: \n367: **Acceptance Criteria**\n368: 1. Given `SPECKIT_SAVE_PLANNER_MODE=full-auto`, when the handler runs, then canonical atomic mutation + rollback + same-path identity behave exactly as before.\n369: 2. Given a full-auto run fails mid-write, when rollback fires, then `POST_SAVE_FINGERPRINT` parity is preserved.\n370: \n371: ### US-003: Explicit freshness follow-up\n372: \n373: **As an** operator who wants freshness on demand, **I want** `refreshGraphMetadata`, `reindexSpecDocs`, and `runEnrichmentBackfill` as callable APIs, **so that** I only pay for that work when I actually need it.\n374: \n375: **Acceptance Criteria**\n376: 1. Given a planner-default save completes, when I call `refreshGraphMetadata`, then graph metadata refreshes without mutating saved records.\n377: 2. Given an explicit follow-up action surfaces `reindexSpecDocs`, when I invoke the API, then spec docs reindex independently of the save path.\n378: \n379: ### US-004: Reserved `hybrid`\n380: \n381: **As an** operator reading env docs, **I want** `hybrid` described as reserved, **so that** I don't assume it is a live mixed-flow behavior that I should rely on.\n382: \n383: **Acceptance Criteria**\n384: 1. Given `SPECKIT_SAVE_PLANNER_MODE=hybrid`, when the handler runs, then behavior matches `plan-only`.\n385: 2. Given I read `ENV_REFERENCE.md`, when I look up `hybrid`, then the doc describes it as reserved with current `plan-only` behavior.\n386: \n387: ### US-005: Honest router scope\n388: \n389: **As a** reviewer or release historian, **I want** the content-router preservation claim to match the code, **so that** future refactors don't assume bit-for-bit preservation when the Tier 3 guard exists.\n390: \n391: **Acceptance Criteria**\n392: 1. Given I diff `content-router.ts` against the prior release, when I look at the changes, then I see the scoped Tier 3 default-disable + manual-review guard documented in ADR-007.\n393: 2. Given I read release notes, when I look for router scope, then the notes describe the scoped exception rather than claiming zero edits.\n394: \n395: ### US-006: Blocker classification\n396: \n397: **As a** save caller with a malformed save, **I want** template-contract failures surfaced as blockers, **so that** I can't silently ship content that misses the contract.\n398: \n399: **Acceptance Criteria**\n400: 1. Given a template-contract miss, when the planner runs, then the output contains at least one `blocker` entry naming the contract.\n401: 2. Given a `blocker` entry, when I fix the miss and rerun, then the blocker is gone and the advisory tier is empty (or names non-blocking issues only).\n402: \n403: ### US-007: Deferred status honesty\n404: \n405: **As an** operator reading planner output, **I want** `deferred` status on skipped subsystems, **so that** I don't misread the result as \"everything ran and succeeded.\"\n406: \n407: **Acceptance Criteria**\n408: 1. Given `SPECKIT_RECONSOLIDATION_ENABLED=false`, when the planner runs, then reconsolidation shows `deferred` in the output (not success-shaped).\n409: 2. Given multiple subsystems are deferred, when the planner returns, then each appears as its own `deferred` entry naming the subsystem.\n410: \n411: ---\n412: \n413: ## 12. APPROVAL WORKFLOW\n414: \n415: | Checkpoint | Approver | Status | Date |\n416: |------------|----------|--------|------|\n417: | Audit scope review | Auditor | Complete | 2026-04-14 |\n418: | Research verdict review | Researcher | Complete | 2026-04-14 |\n419: | Implementation scope review | Implementation author | Complete | 2026-04-15 |\n420: | Deep review | Reviewer | Complete | 2026-04-15 |\n421: | Remediation closure review | Remediation author | Complete | 2026-04-15 |\n422: | Archive-readiness review | Orchestrator | Complete | 2026-04-15 |\n423: \n424: ---\n425: \n426: ## 13. COMPLIANCE CHECKPOINTS\n427: \n428: ### Documentation Governance\n429: \n430: - [x] Level 3+ packet structure present.\n431: - [x] Snapshot notes added to copied Markdown files that carry source evidence.\n432: - [x] Primary docs authored as unified narrative rather than copied duplicates.\n433: - [x] Runtime contract described consistently across `/memory:save` docs, `ENV_REFERENCE.md`, release notes, and templates.\n434: \n435: ### Accuracy Governance\n436: \n437: - [x] Audit truth preserved: runtime was half-migrated before this packet shipped.\n438: - [x] Research verdict preserved: trim-targeted path classified four subsystems as default-off.\n439: - [x] Implementation truth preserved: planner-first default + explicit fallback + follow-up APIs.\n440: - [x] Remediation closure preserved: 9 deep-review findings resolved.\n441: \n442: ### Tooling Governance\n443: \n444: - [x] `validate_document.py` pass recorded for the six primary docs.\n445: - [x] `validate.sh --strict` pass recorded.\n446: - [x] `description.json` and `graph-metadata.json` generated.\n447: \n448: ---\n449: \n450: ## 14. STAKEHOLDER MATRIX\n451: \n452: | Stakeholder | Role | Interest | Communication Need |\n453: |-------------|------|----------|--------------------|\n454: | Save-flow maintainers | Runtime and docs owners | High | Need one accurate packet for future change planning |\n455: | Release maintainers | Changelog and archive owners | High | Need packet-level alignment with v3.4.1.0 |\n456: | Future reviewers | Audit and remediation readers | High | Need source-backed narrative without packet hopping |\n457: | Tooling operators | `/memory:save` users | Medium | Need clear default, fallback, and follow-up behavior |\n458: | AI orchestrators | Session continuity readers | High | Need the planner-first contract documented end-to-end |\n459: \n460: ---\n461: \n462: ## 15. CHANGE LOG\n463: \n464: ### v1.0 (2026-04-15)\n465: \n466: - Shipped planner-first default for `/memory:save` with explicit `full-auto` fallback.\n467: - Retired legacy `[spec]/memory/*.md` write path.\n468: - Gated Tier 3 routing, quality-loop auto-fix, reconsolidation-on-save, and post-insert enrichment behind per-subsystem env flags.\n469: - Introduced `refreshGraphMetadata`, `reindexSpecDocs`, `runEnrichmentBackfill` as explicit follow-up APIs.\n470: - Documented `hybrid` as reserved with current `plan-only` behavior.\n471: - Recorded the scoped `content-router.ts` Tier 3 guard as ADR-007.\n472: - Remediated all 9 deep-review findings (3 P0, 5 P1, 1 P2).\n473: \n474: ---\n475: \n476: ### Acceptance Scenarios\n477: \n478: ### Scenario 1: Planner-first default is the shipped contract\n479: \n480: **Given** the reader opens packet docs\n481: **When** they read the executive summary, implementation summary, and checklist\n482: **Then** they understand that `/memory:save` now returns a structured planner response by default and no longer mutates files on the default path.\n483: \n484: ### Scenario 2: Full-auto fallback remains available\n485: \n486: **Given** the reader wants to know whether automation was removed entirely\n487: **When** they inspect the unified requirements and implementation summary\n488: **Then** they see that `SPECKIT_SAVE_PLANNER_MODE=full-auto` still preserves canonical atomic mutation, promotion, rollback, and same-path identity.\n489: \n490: ### Scenario 3: Deferred enrichment is not removal\n491: \n492: **Given** the reader looks for graph refresh, reindex, and enrichment behavior\n493: **When** they read the packet docs\n494: **Then** they understand that these behaviors moved to explicit follow-up actions or fallback mode rather than disappearing.\n495: \n496: ### Scenario 4: `SPECKIT_SAVE_PLANNER_MODE` is the primary planner flag\n497: \n498: **Given** a maintainer is checking the rollout model\n499: **When** they inspect the implementation and verification sections\n500: **Then** they see `plan-only` as default, `full-auto` as explicit fallback, and `hybrid` as reserved.\n501: \n502: ### Scenario 5: `SPECKIT_ROUTER_TIER3_ENABLED` stays opt-in\n503: \n504: **Given** a reader wants to know whether Tier 3 routing still participates by default\n505: **When** they inspect the acceptance and decision sections\n506: **Then** they see that Tier 3 routing is default-off and guarded as a scoped exception inside `content-router.ts`.\n507: \n508: ### Scenario 6: `SPECKIT_QUALITY_AUTO_FIX` stays opt-in\n509: \n510: **Given** a reader wants to know what happened to quality-loop auto-fix\n511: **When** they read the requirements and ADR set\n512: **Then** they see that hard checks remain blockers while auto-fix retries moved behind explicit opt-in behavior.\n513: \n514: ### Scenario 7: `SPECKIT_RECONSOLIDATION_ENABLED` stays opt-in\n515: \n516: **Given** a reader wants to know what happened to reconsolidation-on-save\n517: **When** they inspect the implementation and verification sections\n518: **Then** they see that reconsolidation remains available only through explicit opt-in or fallback behavior.\n519: \n520: ### Scenario 8: `SPECKIT_POST_INSERT_ENRICHMENT_ENABLED` stays opt-in\n521: \n522: **Given** a reader wants to know whether post-insert enrichment still exists\n523: **When** they inspect the requirement, decision, and summary sections\n524: **Then** they see that post-insert enrichment remains available but is no longer part of the default save path.\n525: \n526: ---\n527: \n528: <!-- /ANCHOR:risks -->\n529: <!-- ANCHOR:questions -->\n530: ### Questions\n531: \n532: | Area | Question | Answer | Evidence |\n533: |------|----------|--------|----------|\n534: | Audit | Was the legacy memory-file surface truly retired when the audit began? | No. The audit found the runtime still created, wrote, indexed, and read `[spec]/memory/*.md`. | `research/013-audit-snapshot/review-report.md`, `research/013-audit-snapshot/iterations/iteration-001.md` |\n535: | Audit | Was the contradiction limited to docs? | No. The contradiction existed in runtime code, docs, templates, and tests. | `research/013-audit-snapshot/review-report.md` |\n536: | Audit | How large was the original active finding set? | 25 active findings across 9 P0, 9 P1, and 7 P2. | `research/013-audit-snapshot/review-report.md` |\n537: | Audit | What closure paths did the audit identify? | Path A retire, Path B rescind, Path C dedup redesign. | `research/013-audit-snapshot/review-report.md` |\n538: | Audit | Which outcome became historical truth in v3.4.1.0? | The retirement path landed and release notes aligned the runtime with the intended canonical-doc model. | `../../../../changelog/01--system-spec-kit/v3.4.1.0.md`, `research/013-audit-snapshot/deep-review-strategy.md` |\n539: | Research | Which save-flow pieces remained load-bearing? | Canonical atomic writer, routed record identity, content-router core, thin continuity validation. | `research/014-research-snapshot/research.md`, `research/014-research-snapshot/findings-registry.json` |\n540: | Research | Which save-flow pieces were over-engineered on the default path? | Tier 3 routing, reconsolidation-on-save, heavy quality-loop auto-fix, post-insert enrichment. | `research/014-research-snapshot/research.md`, `research/014-research-snapshot/findings-registry.json` |\n541: | Research | Could the save system be redesigned without replacing the core writer? | Yes. The research recommended a planner-first wrapper around the existing canonical prep and fallback writer. | `research/014-research-snapshot/research.md`, `research/014-research-snapshot/iterations/iteration-020.md` |\n542: | Research | Did the research support decoupling reindex and graph refresh? | Yes. Both were classified as freshness or derived-state concerns rather than write-core correctness. | `research/014-research-snapshot/research.md` |\n543: | Research | Did the research require deleting the CLI wrapper? | No. The wrapper retained partial value for explicit target authority and structured input normalization. | `research/014-research-snapshot/iterations/iteration-001.md`, `research/014-research-snapshot/findings-registry.json` |\n544: | Implementation | What became the new default operator contract? | Planner-first `/memory:save` with structured non-mutating output. | `review/015-deep-review-snapshot/primary-docs/spec.md`, `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\n545: | Implementation | Was the old full-auto path deleted? | No. It remained available as explicit `full-auto` fallback. | `review/015-deep-review-snapshot/primary-docs/spec.md`, `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\n546: | Implementation | How many implementation tasks shipped? | 43 of 43 tasks. | `review/015-deep-review-snapshot/primary-docs/tasks.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\n547: | Implementation | Which follow-up APIs became explicit? | `refreshGraphMetadata`, `reindexSpecDocs`, and `runEnrichmentBackfill`. | `review/015-deep-review-snapshot/primary-docs/tasks.md`, `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\n548: | Review | What did the first deep-review pass find? | 3 P0, 5 P1, and 1 P2 findings across router honesty, fallback parity, blocker classification, coverage, and doc drift. | `review/015-deep-review-snapshot/review-report.md`, `review/015-deep-review-snapshot/deep-review-findings-registry.json` |\n549: | Remediation | Did the packet close every deep-review finding? | Yes. All 9 findings were resolved. | `review/015-deep-review-snapshot/primary-docs/implementation-summary.md`, `review/015-deep-review-snapshot/deep-review-findings-registry.json` |\n550: | Remediation | What became the honest router story after remediation? | Router core preserved with one scoped Tier 3 default-disable and manual-review exception recorded in the ADR set. | `review/015-deep-review-snapshot/primary-docs/decision-record.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\n551: | Release | What does `hybrid` mean after remediation? | It remains reserved and currently behaves like `plan-only`. | `review/015-deep-review-snapshot/review-report.md`, `../../../../changelog/01--system-spec-kit/v3.4.1.0.md` |\n552: \n553: ---\n554: \n555: ## 16. OPEN QUESTIONS\n556: \n557: None. The packet records the shipped and remediated state of `/memory:save` as of 2026-04-15.\n558: \n559: ---\n560: \n561: <!-- /ANCHOR:questions -->\n562: ## RELATED DOCUMENTS\n563: \n564: - **Implementation Plan**: `plan.md`\n565: - **Task Inventory**: `tasks.md`\n566: - **Verification Checklist**: `checklist.md`\n567: - **Decision Record**: `decision-record.md`\n568: - **Implementation Summary**: `implementation-summary.md`\n569: - **Audit Evidence Snapshot**: `research/013-audit-snapshot/`\n570: - **Research Evidence Snapshot**: `research/014-research-snapshot/`\n571: - **Deep-Review Evidence Snapshot**: `review/015-deep-review-snapshot/`\n572: - **Transcript Evidence Snapshot**: `scratch/transcripts-snapshot/`\n\n(End of file - total 572 lines)\n</content>","metadata":{"preview":"---\ntitle: \"Feature [system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec]\"\ndescription: \"Make /memory:save planner-first (non-mutating) by default while preserving full-auto as an explicit fallback, retire the legacy [spec]/memory/*.md write path, and decouple freshness (graph-metadata refresh, spec-doc reindex, enrichment) from the hot save path via explicit follow-up APIs.\"\ntrigger_phrases:\n  - \"004-memory-save-rewrite\"\n  - \"014-memory-save-rewrite\"\n  - \"memory save planner first\"\n  - \"planner-first memory save\"\n  - \"full-auto fallback\"\n  - \"speckit_save_planner_mode\"\n  - \"memory folder retirement\"\n  - \"content-router scoped exception\"\n  - \"refreshgraphmetadata reindexspecdocs runenrichmentbackfill\"\n  - \"v3.4.1.0 save flow\"\n  - \"026-graph-and-context-optimization\"\nimportance_tier: \"important\"\ncontextType: \"implementation\"\n_memory:\n  continuity:\n    packet_pointer: \"system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite\"","truncated":false,"loaded":[]},"title":".opencode/specs/system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite/spec.md","time":{"start":1777303176896,"end":1777303176902}}}}
{"type":"step_finish","timestamp":1777303177510,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf864859001xVMLZuel9qVd0f","reason":"tool-calls","snapshot":"5c98141f333aee6cf427a3fb45b6ab05e2ddd672","messageID":"msg_dcf861169001yxGyGFGxLQT4oQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"step-finish","tokens":{"total":54656,"input":14349,"output":193,"reasoning":178,"cache":{"write":0,"read":39936}},"cost":0.026837412}}
{"type":"step_start","timestamp":1777303180646,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf865563001FSf1oo04x024yf","messageID":"msg_dcf8649e4002uix03byHnU5ZsQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","snapshot":"6f18969286ff9fa4af49de757c41a0c637db4744","type":"step-start"}}
{"type":"text","timestamp":1777303199495,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf866b37001jk1ka7jd0m0Rq8","messageID":"msg_dcf8649e4002uix03byHnU5ZsQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"text","text":"Here are the results. All decisions about `SPECKIT_SAVE_PLANNER_MODE` live in a single packet:\n\n**Spec folder**: `system-spec-kit/026-graph-and-context-optimization/003-continuity-memory-runtime/004-memory-save-rewrite`\n\n---\n\n### ADR-002: Planner-First Output Contract for `/memory:save`\n\n**Source**: `decision-record.md:91-137` (anchor `adr-001`)\n\n**Rationale**: Research showed the default save path already computed enough information (route, legality, follow-up actions) to tell the AI what to edit without actually mutating. Keeping full-auto as default preserved unnecessary hot-path cost.\n\n**Decision**: Make planner-first the default (`plan-only`), preserve `full-auto` as explicit fallback via `SPECKIT_SAVE_PLANNER_MODE=full-auto`. The handler computes the same route and legality data but stops short of mutation and returns structured planner output instead.\n\n**Consequences**: Default path became reviewable and non-mutating. The full writer remained in the codebase for explicit fallback. Required schema stability between handler, CLI, and docs (mitigated via shared types + focused tests).\n\n**Rejected alternatives**:\n- Keep `full-auto` as default → \"Preserved unnecessary hot-path cost\"\n- Replace save system with new planner service → \"Wider scope and safety risk\"\n\n---\n\n### Supporting context from `spec.md`\n\n- **Line 60**: `full-auto` is preserved as explicit fallback via `SPECKIT_SAVE_PLANNER_MODE=full-auto`, with canonical atomic mutation, `POST_SAVE_FINGERPRINT` parity, same-path identity, and rollback intact.\n- **Line 112**: `hybrid` is documented as reserved and currently behaves like `plan-only`.\n- **`plan.md:56-73`** (anchor `architecture`): Documents the three-plan mode data flow — `default`/`plan-only`/`hybrid(reserved)` → compute route + legality + advisories → return structured output (no mutation), vs `full-auto` → canonical atomic writer with full mutation semantics.","time":{"start":1777303199491,"end":1777303199491}}}
{"type":"step_finish","timestamp":1777303199734,"sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","part":{"id":"prt_dcf869f08001DntTno3KTIlj7F","reason":"stop","snapshot":"2c49177383e7ca9b18770edd3c4e38f91d44025f","messageID":"msg_dcf8649e4002uix03byHnU5ZsQ","sessionID":"ses_2307a2e35ffeBeVOJyWiqoKVPD","type":"step-finish","tokens":{"total":71263,"input":15955,"output":461,"reasoning":191,"cache":{"write":0,"read":54656}},"cost":0.030823172}}
