feat: Extended Memory module (P0-P2)#47
Open
jkyberneees wants to merge 20 commits into
Open
Conversation
…nd 80.5% coverage - Add opt-in Extended Memory atom store, vector recall, and retention-decay eviction - Wire dedicated/fallback memory LLM and forward MemoryConfig in run/continue - Fix loop dedup for extended context injection - Implement quarantine store with TTL and scan tainted atoms before persistence - Add promote/pin/list_quarantine tool actions and CLI commands - Harden size cap accounting, vector file permissions, and anti-injection framing - Update MEMORY.md, EXTENDED_MEMORY.md, and CONFIG.md docs Delete docs/EXTENDED_MEMORY_IMPLEMENTATION_PLAN.md
- Evictor.SelectForEviction now returns (ids, freed, ok) so callers know whether the requested bytes could be covered by non-pinned atoms. - enforceCap uses per-atom effective size (chunk + atoms.json share + amortized vector cost) instead of raw store+index disk size, avoiding double-counting and making fail-closed checks reliable. - After eviction, if the evictor reports it cannot free enough, AddAtom returns an error and the atom is not written. - Add ExtendedMemory.Close() and atomVectorIndex.Wait() so tests can drain background compaction goroutines before TempDir cleanup.
The odek memory extended * subcommands (forget, promote, pin, quarantine, compact) construct ExtendedMemory using DefaultConfig, which has Enabled = false, so all operations silently failed. Force Enabled = true for the CLI surface only; the agent tool surface still does not expose promote.
- Cap tests now use mock embedder, small per-test caps via testCapBytes, smaller atoms, and defer em.Close() so race tests run quickly and TempDir cleanup succeeds reliably. - TestEvictionAllPinned now expects AddAtom to fail when pinned atoms fill the cap, matching the fail-closed behavior. - Add TestCapFailClosedWhenAllPinned. - Add coverage tests for SetEmbedder, SetEmbedderFactory, MarkDirty, Compact, UserModel, Associations, and AddAtoms batch failure path.
- Move eviction after the ok check so atoms are only removed when the cap can be satisfied. - gofmt changed files in internal/memory/extended.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
odek | 93ba487 | Commit Preview URL Branch Preview URL |
Jul 10 2026, 08:39 PM |
- P3: user-state model with pending-review queue and background inference - P4: predictive intent generation, atom associations, predictive recall augmentation - P5: return-after-break summaries, anaphora resolution, follow-up anticipation, style mirroring - Add memory tool actions and CLI commands for pending review, promotion, and pinning - Update docs in MEMORY.md, EXTENDED_MEMORY.md, and CONFIG.md
… predictor wiring, and context propagation - Replace only the first pronoun when the top atom's semantic score is above SemanticSearchMinScore; return (resolved, bool). - Guard triggerBackgroundInference with a closed flag and lock to prevent starting goroutines after Close. - Add a 10-message recent-user buffer and pass it plus UserState to the Predictor in Recall.Query. - Thread context.Context through AnaphoraResolve, FormatExtendedContext, FormatUserStateContext, and FormatReturnAfterBreak; update loop engine callbacks and MemoryManager callers to use caller-provided contexts with timeouts. - Add TestExtendedMemoryCloseRace.
…e promote lock - Scan every string value in UserState on Load; drop fields/entries that fail ScanContent so a tampered user_model.json cannot poison prompts. - Scan the formatted Summary() output before returning it. - Use Lock instead of RLock in Quarantine.Promote because loadLocked may call saveLocked during eviction.
…turnAfterBreak - Remove SourceInferred from TrustBoost (treated as tainted/quarantined until promotion), matching IsTaintedSourceClass. - Wrap the return-after-break summary with wrapUntrusted before injecting it as a system message in odek continue; attach the audit recorder early so the ingestion is recorded. - Update docs to mark inferred as tainted/quarantined and document the first-pronoun, score-gated anaphora behavior.
…d branch - Update EXTENDED_MEMORY.md to reflect implemented P3-P5 features - Add inferred to tainted source classes in MEMORY.md - Remove dead no-op branch in UserModel.Update
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.
This PR introduces the opt-in Extended Memory module for odek.
What is included
internal/memory/extended/package with atom-based semantic memory.user_saidsource).retention_decayeviction.add_atom,search_atoms,forget_atom,pin_atom,list_quarantine.odek memory extended promote|pin|forget|quarantine|compact.docs/EXTENDED_MEMORY.md,docs/MEMORY.md, anddocs/CONFIG.md.Trust model
SourceInferredis treated as tainted until promotion exists.Tests
go test ./... -count=1passes.go test -race ./internal/memory/extended/... -count=1passes.internal/memory/extendedcoverage: 82.3%.Design docs
docs/EXTENDED_MEMORY.mdThis is P0-P2 of the Extended Memory roadmap; P3-P5 (user-state model, predictive recall, proactive behaviors) are reserved for follow-up work.