feat(memory): semantic memory v2 — namespaces, decay, enrichment, LLM consolidation - #22
Merged
Conversation
Implements docs/design/semantic-memory-v2.md end to end (Phases 0-4): - store v2 (semantic-memory.ts, memory-migration.ts): namespace scoping (global/repo/session/agent), meta.json schema versioning with automatic v1->v2 migration, zero-vector quarantine + lazy re-embed queue, dimension-change handling, lazy decay with capped reinforcement, composite scored retrieval (sim^1.5 x decay x confidence) with pushed-down filters, no-embedding fallback, eviction sweep + namespace caps, pinning - enrichment finally reaches prompts: awaited 250ms-budgeted hook in ws-bridge with per-session ordering chains; history keeps the original user text while the backend receives the enriched block; the UI gets a memory_enriched broadcast rendered as a collapsible recalled-context chip (with Playground mocks) - consolidation pipeline (memory-consolidation.ts): JUDGE (weight x confidence filter, near-dup dedupe, greedy clustering) -> DISTILL (OpenRouter, exact prompt contract, strict JSON validation, retry-once-with-error, concat fallback, budget caps) -> CONSOLIDATE (upsert by namespace+tag with supersession tombstones); triggers on turn boundary / 30min idle / session end / manual with in-flight guard - extraction upgrade: keyword gate replaced with recall-biased structural cues; thinking-block content scrubbed before any store or promotion - REST: overview + pin endpoints, global/session memory namespace fixes; settings gain per-namespace decay half-lives, reinforce multipliers, and recall depths (surfaced in Settings UI); MemoryPanel shows namespace counts, decayed-weight bars, and pin/unpin Tests: 159 new (store 78, pipeline 22, wiring 40, frontend 34 areas); suite 1630/1630 green; typecheck + build clean; live-server smoke of store/pin/overview round-trip verified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the full semantic-memory v2 design (docs/design/semantic-memory-v2.md), Phases 0–4 in one change:
Testing
Review provenance
🤖 Generated with Claude Code