Repository navigation
feat(v0.15): next-gen agentic memory (daily notes, supersession, dream, flush, entity boost, incremental recall) - #136
Merged
Conversation
…m, flush, entity boost, incremental recall)
What was missing:
- Long-running conversations accumulated facts only in a flat MEMORY.md with no episodic daily log, no non-destructive supersession when facts changed, no sleep-time consolidation or topic spilling, no pre-reset flush on /new or idle/daily session expiry, no exact entity or YAML tag recall boosting, and full re-decompression of every zstd session log on each recall refresh.
What changed:
- core/memory.ts, core/prompt.ts: added channel-scoped daily episodic notes (memory/YYYY-MM-DD.md via appendDailyNote/readRecentDailyNotes with DST-safe yesterday calculation), non-destructive fact supersession (same topic-key with body overlap or Jaccard >= 0.65 archiving replaced entries to memory/archive-superseded.md after writeInside succeeds, skipping topic pointers), composite channel provenance (ch:<id>), YAML frontmatter tag boosting in searchNotes (stripping frontmatter from hits and preserving it in forgetMemory, skipping archive-superseded.md in searchNotes and memoryIndex), and session reset/flush helpers (shouldResetSession, extractFlushFacts).
- core/dream.ts: added sleep-time consolidation (consolidateMemory) harvesting old daily notes (local calendar midnight cutoff, never today/yesterday, respecting channel isolation and injection scanning) and channel-scoped recall rows (respecting tombstones), promoting and superseding into MEMORY.md, compacting duplicates, spilling over-budget topic clusters into memory/topic-<slug>.md with YAML frontmatter tags and in-place ## Topics pointers, and merging archived daily notes into memory/archive/ only when all candidates were persisted.
- index.ts, core/commands.ts, transports/local.ts, tui/{protocol,cli,strings}.ts: wired dynamic dailyNotes injection (through guardFetchedText + defuse), /dream chat command, TUI /memory dream, opt-in background dreamIntervalHours with per-home serialization lock, automatic session idle/daily reset (sessionIdleResetHours, sessionDailyResetHour) evaluated at turn start before fetchHistory without commands defeating idle expiry, and preResetMemoryFlush on /new and auto-reset (refusing to flush DM/local transcripts into shared workspaces and filtering prompt-injection patterns).
- recallContext.ts: added exact entity extraction (#123, PR-42, @handle, backticked symbols, snake_case, technical kebab-case) and boosting in both search() (including pure-entity queries) and block().
- recall/deepbot-recall.ts: added host-side incremental parse caching ($DSH_HOME/recall/parse-cache.v1.json) validated by (mtimeMs, size, ctimeMs, ino), lightweight cwdOnly entries for unrelated workspaces, and --full rebuild flag.
- test/v15-agentic-memory.test.ts, package.json, .github/workflows/ci.yml, CHANGELOG.md: added 34-check cross-platform regression suite wired into local and GitHub CI (Ubuntu + Windows).
How it was checked:
- pnpm run build && pnpm run typecheck && pnpm test passed locally (all 51+ suites including test/v15-agentic-memory.test.ts 34/34, test/core.test.ts 673/673, test/local.test.ts 206/206, and test/secrets.test.ts across 489 files; EXIT=0).
- Independent adversarial review pass completed and all 13 findings fixed and re-tested.
Still unverified:
- Live end-to-end model scenarios (test/run-scenario.ts) and scheduled background dream execution over multi-hour wall-clock intervals were not run against a live LLM endpoint here.
Signed-off-by: rlaope <rlaope@users.noreply.github.com>
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
Brings next-generation agentic memory primitives (inspired by Letta/MemGPT, Zep/Graphiti, Mem0, Claude Code Dreaming, and A-MEM) to
deepseek-botwith zero new runtime dependencies:memory/YYYY-MM-DD.mdviaappendDailyNote/readRecentDailyNotesincore/memory.ts): channel-scoped daily logs with dynamic today+yesterday prompt injection (dailyNotes,maxDailyNoteChars) guarded byguardFetchedText+defuse(never invalidating the standing prompt-cache digest).rememberMemoryincore/memory.ts): replaces stale entries in place inMEMORY.mdon same<topic>:with body overlap or Jaccard >= 0.65 while archiving replaced lines tomemory/archive-superseded.mdafter write succeeds, preserving topic pointers and composite channel provenance ((ch:<id>)).core/dream.ts, chat/dream, TUI/memory dream, opt-indreamIntervalHours): harvests old daily notes (local calendar midnight cutoff, never today/yesterday, injection-filtered) and channel-scoped recall rows (respecting tombstones), promotes & supersedes intoMEMORY.md, compacts duplicates, spills over-budget topic clusters intomemory/topic-<slug>.mdwith YAMLtags:frontmatter and in-place## Topicspointers, and merges archived daily notes safely under per-home locking.sessionIdleResetHours,sessionDailyResetHour,preResetMemoryFlush): preserves durable facts into today's daily log on/newand automatic resets (without flushing DM/local transcripts into shared workspaces, and without slash commands defeating idle expiry).extractEntitiesinrecallContext.tsfor#123,PR-42,@handle, backticked symbols,snake_case, technical kebab-case in bothsearch()andblock(); YAML frontmattertags:boost insearchNoteswithout leaking frontmatter lines).$DSH_HOME/recall/parse-cache.v1.json+--fullinrecall/deepbot-recall.ts): skips redundant zstd decompression for unchanged logs using(mtimeMs, size, ctimeMs, ino)and lightweightcwdOnlyentries for unrelated workspaces.Verification
pnpm run build && pnpm run typecheck && pnpm test: all 51+ local suites passed (EXIT=0), includingtest/v15-agentic-memory.test.ts(34/34),test/core.test.ts(673/673),test/local.test.ts(206/206), andtest/secrets.test.ts(489 files scanned).Still unverified
test/run-scenario.ts) and multi-hour wall-clockdreamIntervalHoursruns against a live model endpoint.