@@ -12,6 +12,102 @@ It explicitly separates branch-level implementation status from mainline integra
1212 - route/runtime layer (` src/server.ts ` ),
1313 - executable tests.
1414
15+ ## Code-vs-Requirements Deep Comparison (2026-04-27)
16+
17+ Each prior solution document sets requirements. This section compares those requirements against actual shipped code.
18+
19+ ### Comparison: Knowledge Mastery Evolution Roadmap
20+
21+ | Phase | Requirement | Code Evidence | Status |
22+ | -------| -------------| ---------------| --------|
23+ | P1: Backbone | Unified ingest + staleness rebuild | ` POST /api/knowledge/ingest-diff ` in ` src/server.ts ` , ` KnowledgeLearningPlatform.ingestDiff() ` | ** Shipped** |
24+ | P1: Backbone | Relation + temporal graph contracts | ` src/learning/types.ts ` — ` KnowledgeRelation ` , ` TemporalEvidence ` types | ** Shipped** |
25+ | P1: Backbone | Store abstraction (file/memory/graphdb) | ` src/learning/store.ts ` — ` KnowledgeGraphStore ` interface, ` SqliteKnowledgeGraphStore ` (default), ` FileBackedKnowledgeGraphStore ` (fallback) | ** Shipped** — graphdb not integrated yet |
26+ | P1: Backbone | Query backend comparability | ` src/learning/queryBackend.ts ` — ` local_hybrid ` vs ` keyword_only ` , request-level override via ` queryBackend ` field | ** Shipped** |
27+ | P2: Mastery | Mastery diagnostics + misconception tracking | ` POST /api/knowledge/mastery/misconceptions ` in ` src/server.ts ` , ` MasteryPath ` / ` DivergencePath ` types in ` src/learning/types.ts ` | ** Shipped** (API), UI gated |
28+ | P2: Mastery | Dual path outputs in session planning | ` POST /api/knowledge/session/plan ` → ` masteryPaths ` + ` divergencePaths ` , ` includeDivergence ` flag | ** Shipped** (API) |
29+ | P2: Mastery | Quality trend + threshold checks | ` POST /api/knowledge/quality/snapshot ` , ` /quality/history ` , ` /quality/trend ` | ** Shipped** |
30+ | P3: Tutor | Pluggable tutor actions under evidence-first | ` src/learning/tutorAdapter.ts ` , ` TutorAction ` type with ` evidence ` + ` verificationStatus ` fields | ** Shipped** (API), provider integration gated |
31+ | P3: Memory | Memory policy diagnostics + trend governance | ` POST /api/knowledge/memory-policy/* ` , ` memoryLayer: session/unit/long_term ` | ** Shipped** |
32+ | P3: Runtime | Runtime capability runbook + remediation | ` /api/knowledge/operator/agent-workspace-diagnostics/triage/* ` , ` primaryRunbookAction ` contract | ** Shipped** |
33+
34+ ### Comparison: Local Backend Sufficiency and Escalation Plan
35+
36+ | Requirement | Code Evidence | Status |
37+ | -------------| ---------------| --------|
38+ | sqlite as system of record | ` DEFAULT_KNOWLEDGE_GRAPH_STORE_KIND = 'sqlite' ` (` src/learning/store.ts:59 ` ) | ** Compliant** |
39+ | Local embeddings + ANN pruning | ` vectorAccelerationAdapter.ts ` — ` mode = local_ann ` , ` vectorAdapterSignalKind = embedding_ann ` | ** Compliant** |
40+ | Backend sufficiency control surface | ` GET /api/knowledge/backend/sufficiency ` , ` verify:backend:baseline:sufficiency ` script | ** Compliant** |
41+ | Measurement hardening before backend replacement | Query-latency observation upgrades to ` measured ` when runtime history exists; rebuild/recovery duration also observed | ** Compliant** (partial — most top-level modes still ` policy_default ` ) |
42+ | Escalation trigger: measured pressure | Sufficiency route exposes observation modes; no automated escalation yet | ** Gate intact** |
43+ | Product/memory work takes priority | M8.20-M8.53 (34 increments) shipped, all frontend-bounded, no backend expansion | ** Compliant** |
44+
45+ ### Comparison: Foundation Re-entry Readiness Checklist
46+
47+ | Gate | Code Evidence | Status |
48+ | ------| ---------------| --------|
49+ | sqlite persistence merged to main | ` src/learning/store.ts ` — ` SqliteKnowledgeGraphStore ` class, ` CREATE TABLE IF NOT EXISTS ` | ** Pass** |
50+ | Query-backend separation merged to main | ` src/learning/queryBackend.ts ` — ` local_hybrid ` and ` keyword_only ` backends | ** Pass** |
51+ | Vector acceleration independent | ` src/learning/vectorAccelerationAdapter.ts ` — ` mode = local_ann ` | ** Pass** |
52+ | Foundation contract tests passing | ` src/foundation.readiness.contract.test.ts ` , ` src/learning/KnowledgeLearningPlatform.test.ts ` (80KB) | ** Pass** (7/7 promotion criteria) |
53+ | Readiness route operational | ` GET /api/knowledge/backend/sufficiency ` — returns live observation data | ** Pass** |
54+ | No foundation blockers | ` promotionBlockers = [] ` | ** Pass** |
55+
56+ ### Comparison: Agent Conversation Focus Mode Plan (M1-M8)
57+
58+ | Milestone | Requirement | Code Evidence | Status |
59+ | -----------| -------------| ---------------| --------|
60+ | M1 Baseline | ` AgentConversationAPI ` contract | ` src/learning/api.ts ` — ` runAgentConversation() ` , ` src/learning/types.ts ` — conversation types | ** Shipped** |
61+ | M2 Runtime | Agent workspace dock panel | ` src/frontend/agent_workspace.js ` + ` agent_workspace_runtime.js ` + ` index.html ` dock wiring | ** Shipped** |
62+ | M3 CI Gates | Migration-gates workflow suites | ` .github/workflows/migration-gates.yml ` — 3 agent-workspace suites | ** Shipped** |
63+ | M4-M6 | Capability expansion (study, history, quality, tutor, memory) | 11 typed conversation actions in ` src/learning/types.ts ` , all wired through ` runAgentConversation() ` | ** Shipped** |
64+ | M7 CI Stabilization | CI hardening + post-M7 direction | ` docs/brainstorms/2026-04-16-mainline-ci-stabilization-and-m7-direction-requirements.md ` | ** Shipped** |
65+ | M8.20-M8.52 | Conversation-product hardening (33 increments) | All verified in ` src/frontend/agent_workspace_runtime.js ` , ` src/server.ts ` , contract tests | ** Shipped** |
66+ | M8.53 | Primary runbook consumer adoption | ` resolvePrimaryRunbookAction() ` in ` agent_workspace_runtime.js ` , tests in ` agent_workspace.runtime.behavior.test.ts ` | ** Shipped** (2026-04-27) |
67+
68+ ### Architecture Advancement Summary
69+
70+ | Layer | v1.7.0 Baseline (2026-03-31) | Current (2026-04-27) | Delta |
71+ | -------| -----------------------------| ---------------------| -------|
72+ | Graph persistence | File snapshots only | sqlite (default) + file (fallback), ` KnowledgeGraphStore ` interface | ** Independent** |
73+ | Query backend | Lexical-only (` keyword_only ` ) | ` local_hybrid ` with ANN + keyword + relation scoring, per-request override | ** Independent** |
74+ | Vector acceleration | Not present | ` mode = local_ann ` , deterministic embeddings, benchmark parity with WASM | ** New capability** |
75+ | Learning API surface | Basic ingest + query | Full ingest/session/tutor/memory/quality/governance API (15+ endpoints) | ** 3x expansion** |
76+ | Conversation surface | Not present | Agent workspace with dock panel, capability execution, 11 action types | ** New capability** |
77+ | Active-atom continuity | Not present | Focus rail, pane-state, summary cards, history drill-down, follow-up ranking (M8.24-M8.33) | ** New capability** |
78+ | History explanation | Not present | Tradeoff/drift/stability explanation, confidence signals (M8.34-M8.37) | ** New capability** |
79+ | Managed-memory continuity | Not present | Gap follow-up, continuity rollups, transition explanation (M8.38-M8.46) | ** New capability** |
80+ | Operator triage/runbook | Not present | Continuity-aware triage, severity calibration, prioritization, primary action contract (M8.47-M8.53) | ** New capability** |
81+ | Spec/guidelines | Not present | 11 filled spec files, development plan, session journal | ** New governance** |
82+
83+ ### Current Gaps vs. Roadmap Target
84+
85+ | Gap | Priority | Blocked By | Next Action |
86+ | -----| ----------| ------------| -------------|
87+ | Graphdb backend not integrated | Medium | Measured sqlite pressure | Keep dormant; escalate only if ` backend/sufficiency ` shows degradation |
88+ | Standalone vector index not integrated | Medium | ANN parity verified | Keep dormant; local ANN is sufficient for current product scope |
89+ | Mastery loop UI not yet shipped | Medium | M8.53 pattern validated | Apply bounded consumer pattern to mastery/divergence surfaces |
90+ | Tutor provider integration not yet shipped | Low | Evidence-first gate | Provider adapter exists; full integration gated behind mastery loop |
91+ | ` server.ts ` (499KB) monolithic | Tech debt | No test failures | Schedule refactor as separate task; not blocking any lane |
92+ | ` agent_workspace_runtime.js ` (217KB) large | Tech debt | All tests pass | Monitor; split only when a second consumer forces module extraction |
93+
94+ ## Subsequent Direction (Post-2026-04-27)
95+
96+ ### Active Lane: Conversation-Product Continuity
97+ - ** Current** : M8.53 shipped — ` primaryRunbookAction ` consumer live in diagnostics report.
98+ - ** Next** : Evaluate whether single-consumer adoption unlocks enough operator value before broadening.
99+ - ** Decision gate** : If the diagnostics report consumer proves sufficient → gate stays; consider mastery-loop UI next. If operator feedback demands broader visibility → add one more bounded consumer (still no dashboard shell).
100+
101+ ### Next Lane: Mastery & Divergence Loop (Phase 2)
102+ - ** API ready** : Mastery diagnostics, misconception tracking, dual-path session planning, quality trends.
103+ - ** UI gap** : No rich operator-facing UI beyond the learning workbench.
104+ - ** Approach** : Apply the M8.53 pattern — one bounded consumer reusing shipped API contracts, no new persistence or routes.
105+
106+ ### Dormant Lanes
107+ - ** Backend escalation** : sqlite + ANN sufficient. Wake only on measured pressure.
108+ - ** Broader operator dashboards** : Stay behind consumer-adoption seam.
109+ - ** Markdown reader work** : Not ahead of mastery loop unless it directly compounds the operator/study loop.
110+
15111## Current Delivery Focus
16112
17113The conversation-product hardening lane (M8.20-M8.52) is ** complete** . All 33 increments ship on ` main ` with passing CI.
0 commit comments