Skip to content

feat(v0.15): next-gen agentic memory (daily notes, supersession, dream, flush, entity boost, incremental recall) - #136

Merged
rlaope merged 1 commit into
masterfrom
feat/v0.15-agentic-memory-next
Dec 1, 2026
Merged

rlaope merged 1 commit into
masterfrom
feat/v0.15-agentic-memory-next

Conversation

@rlaope

@rlaope rlaope commented Dec 1, 2026

Copy link
Copy Markdown
Owner

Summary

Brings next-generation agentic memory primitives (inspired by Letta/MemGPT, Zep/Graphiti, Mem0, Claude Code Dreaming, and A-MEM) to deepseek-bot with zero new runtime dependencies:

  • Daily episodic notes (memory/YYYY-MM-DD.md via appendDailyNote / readRecentDailyNotes in core/memory.ts): channel-scoped daily logs with dynamic today+yesterday prompt injection (dailyNotes, maxDailyNoteChars) guarded by guardFetchedText + defuse (never invalidating the standing prompt-cache digest).
  • Non-destructive fact supersession & provenance (rememberMemory in core/memory.ts): replaces stale entries in place in MEMORY.md on same <topic>: with body overlap or Jaccard >= 0.65 while archiving replaced lines to memory/archive-superseded.md after write succeeds, preserving topic pointers and composite channel provenance ((ch:<id>)).
  • Sleep-time memory consolidation ("Dreaming") (core/dream.ts, chat /dream, TUI /memory dream, opt-in dreamIntervalHours): harvests old daily notes (local calendar midnight cutoff, never today/yesterday, injection-filtered) and channel-scoped recall rows (respecting tombstones), promotes & supersedes into MEMORY.md, compacts duplicates, spills over-budget topic clusters into memory/topic-<slug>.md with YAML tags: frontmatter and in-place ## Topics pointers, and merges archived daily notes safely under per-home locking.
  • Session idle/daily reset & pre-reset silent memory flush (sessionIdleResetHours, sessionDailyResetHour, preResetMemoryFlush): preserves durable facts into today's daily log on /new and automatic resets (without flushing DM/local transcripts into shared workspaces, and without slash commands defeating idle expiry).
  • Entity & YAML tag recall boosting (extractEntities in recallContext.ts for #123, PR-42, @handle, backticked symbols, snake_case, technical kebab-case in both search() and block(); YAML frontmatter tags: boost in searchNotes without leaking frontmatter lines).
  • Host-side incremental recall parse cache ($DSH_HOME/recall/parse-cache.v1.json + --full in recall/deepbot-recall.ts): skips redundant zstd decompression for unchanged logs using (mtimeMs, size, ctimeMs, ino) and lightweight cwdOnly entries for unrelated workspaces.

Verification

  • pnpm run build && pnpm run typecheck && pnpm test: all 51+ local suites passed (EXIT=0), 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 (489 files scanned).
  • Independent adversarial review completed and all 13 findings fixed and re-tested.

Still unverified

  • Live end-to-end model scenarios (test/run-scenario.ts) and multi-hour wall-clock dreamIntervalHours runs against a live model endpoint.

…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>
@rlaope
rlaope merged commit 4de77cd into master Dec 1, 2026
5 checks passed
@rlaope
rlaope deleted the feat/v0.15-agentic-memory-next branch December 1, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant