feat: Phase 5 — Autonomous Knowledge Architecture (7 features)#129
feat: Phase 5 — Autonomous Knowledge Architecture (7 features)#129salishforge wants to merge 3 commits into
Conversation
1. Epistemic Confidence Model — calibrated uncertainty (established/ provisional/contested/inferred) with evidence counting, auto-promotion via sleep Phase 5.12, and query-time epistemic filtering 2. Explainable Memory Operations — every retrieval returns WHY via ExplanationFactor[] (rank score, epistemic status, search mode, temporal decay). New memforge_explain tool for per-memory state audit 3. Causal Memory Graph — inferred cause→effect chains from temporal patterns via sleep Phase 6.1, recursive CTE traversal, and memforge_predict tool for "what typically follows X?" 4. Hierarchical Abstraction Engine — auto-extract principles from meta-reflections via sleep Phase 5.11, memforge_principles and memforge_mental_models tools 5. Adaptive Sleep Intelligence — per-phase analytics tracking, auto-skip phases with 3 consecutive zero-change cycles 6. Memory Sentiment Tagging — keyword-inferred urgency/sentiment/ session_type context signals on hot and warm tiers 7. Cross-Agent Transfer Learning — memforge_bootstrap copies established knowledge between agents with confidence discounting and provenance tracking Schema: migration-v3.8.sql (epistemic columns, causal_edges, abstractions, sleep_phase_analytics, context_signals) New MCP tools: memforge_certainty, memforge_explain, memforge_causal_chain, memforge_predict, memforge_principles, memforge_mental_models, memforge_bootstrap New REST endpoints: /epistemic, /causal, /predict, /principles, /abstractions, /bootstrap https://claude.ai/code/session_0116EhmLb79eeBTN8P4wwFC1
…orts - Add epistemic_status, evidence_count, context_signals columns to canonical hot_tier and warm_tier definitions - Add causal_edges, abstractions, sleep_phase_analytics tables - Add RLS policies for new tables - Remove unused EpistemicStatus, EpistemicFilter, PhaseAnalytics imports Fixes CI lint errors and integration test failures from missing columns. https://claude.ai/code/session_0116EhmLb79eeBTN8P4wwFC1
- Memory Sentiment Tagging (F6): infer urgency/sentiment/session_type from content at add and consolidation time. New context_signals JSONB column on hot_tier and warm_tier. During consolidation, signals from all contributing hot rows are merged: urgency = max, sentiment = majority, session_type = majority. query() returns context_signals on each QueryResult. New types UrgencyLevel, SentimentTag, SessionType, ContextSignals. - Adaptive Sleep Intelligence (F5): per-phase telemetry in new sleep_phase_analytics table. Two new methods on SleepCycleEngine: recordPhaseAnalytics() and shouldSkipPhase() (skips phases whose last 3 runs had zero changes_made). Index + RLS policy included. Migration: schema/migration-v3.8.sql (idempotent ADD COLUMN IF NOT EXISTS) Tests: 29 sentiment + 18 adaptive-sleep (unit/integration/migration) Split from #129 (PR-A). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Calibrated uncertainty levels (established/provisional/contested/inferred) on warm-tier memories with auto-promotion via new sleep cycle Phase 5.12. New columns: epistemic_status, evidence_count, last_corroborated_at on warm_tier. New endpoint GET /memory/:id/epistemic and MCP tools memforge_certainty + memforge_epistemic_profile. Phase 5.12 promotes provisional rows with evidence_count >= 3 and multi-namespace positive retrievals to established, stamps last_corroborated_at, and demotes stale established rows back to provisional. Epistemic filter on query() restricts results to the desired confidence tier. TypeScript SDK, Python SDK, tool-definitions, and OpenAPI spec updated. Migration: schema/migration-v3.9.sql Split from #129 (PR-B of 6). Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolves two months of drift: features 1 (epistemic confidence), 5 (adaptive sleep intelligence), and 6 (sentiment tagging) from this PR were re-landed on main via #136-#138 with instrumented, tested implementations, so main wins everywhere both sides implement the same feature. This PR keeps only its unique features: 2 (explainable memory ops), 3 (causal memory graph), 4 (hierarchical abstraction), 7 (transfer learning), plus sleep phases 5.11 and 6.1. Resolution notes: - PR's omnibus migration-v3.8.sql replaced by main's v3.8; the PR-unique DDL (causal_edges, abstractions + RLS + grants) moved to new migration-v3.10.sql; schema.sql synced. - Removed duplicates the auto-merge produced: second /epistemic route, second inferContextSignals(), second mergedSignals block, duplicated type declarations in types.ts. - memforge_certainty MCP executor takes main's version (the PR built an epistemicOpts object it never passed; main forwards the epistemic filter correctly). - Phases 5.11/6.1 wrapped in runPhase() following main's drift-snapshot convention so they record sleep_phase_analytics. - Query cache key now includes the explain flag alongside epistemic. Verified: type-check and build clean; full test suite matches the origin/main baseline exactly (190/219 pass, same 29 pre-existing environment failures); smoke-tested all new endpoints against a fresh schema load. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EWrtbDnaYoDtJKEG49ACkG
|
Resolved merge conflicts with Resolution rule: main wins wherever both sides implement the same feature (epistemic confidence, adaptive sleep, sentiment tagging); this PR keeps its unique features — 2 explainable ops, 3 causal graph, 4 hierarchical abstraction, 7 transfer learning, plus sleep phases 5.11/6.1. Structural changes:
Verification: type-check/build clean; full suite identical to origin/main baseline (190/219 — the 29 failures pre-exist on main in this environment); all new endpoints smoke-tested against a fresh schema load (add → consolidate → query?explain=true, /epistemic, /causal, /predict, /principles, /abstractions, /bootstrap). Pre-existing gaps in this PR surfaced during an adversarial review pass (none are merge regressions; all are byte-identical to this PR's original code — worth addressing before landing):
Also noting: main's CI is currently red at aa9fd9c ( 🤖 Generated with Claude Code |
|
Closing: all 7 Phase 5 features have been re-landed as reviewable slices, each carried through type-check/lint/full test gates and a multi-agent adversarial review. Feature map:
Merge order for the open stack: #160 → #163 → #164 → #165 → #166 (each retargets automatically). 🤖 Generated with Claude Code |
Phase 5: Autonomous Knowledge Architecture
7 features that push MemForge beyond any competitor — from remembering to understanding.
New capabilities
memforge_certaintymemforge_explainmemforge_causal_chain,memforge_predictmemforge_principles,memforge_mental_modelsmemforge_bootstrapNew sleep cycle phases
New REST endpoints
GET /memory/:id/epistemic— epistemic profileGET /memory/:id/causal— causal chain traversalPOST /memory/:id/predict— predictive queryGET /memory/:id/principles— learned principlesGET /memory/:id/abstractions— all abstraction levelsPOST /memory/:id/bootstrap— transfer learningStats
migration-v3.8.sqlTest plan
tsc --noEmit— 0 errorshttps://claude.ai/code/session_0116EhmLb79eeBTN8P4wwFC1