Skip to content

Memory System ​

Lifecycle ​

Every conversation turn flows through four stages:

  1. Record — user and assistant messages stored with timestamps, session IDs, platform message IDs
  2. Extract — sleep cycle pulls structured facts, preferences, entities, decisions from raw transcripts
  3. Consolidate — daily → weekly → quarterly summaries compress old knowledge into progressively denser files
  4. Recall — on each new message, relevant memories are retrieved and injected into the agent's context

Memory Types ​

TypeDescriptionExample
factExtracted statement"user lives in Budapest"
decisionA choice made"chose SQLite over Postgres for local-first"
preferenceLike/dislike"prefers dark mode"
eventSomething that happened"deployed v0.3.0 on 2026-04-15"
lessonLearned insight"never run filter-branch on live data"
feedbackCorrection or reaction"user said the summary was too long"
storyNarrative/anecdote"the time the deploy broke at 3am"
secretEncrypted at rest (class 3)API keys, passwords

Search Modes ​

ModeStages usedRequirements
hybridFTS5 + trigram + embeddings + consolidationOllama with embedding model
ftsFTS5 + trigram + consolidationNo external deps
signatureKeyword signature Hamming distanceNo external deps

Set via MEMORY_SEARCH_MODE env var. Default: hybrid.

Recall Algorithm ​

See recall.md for the full 4-layer pipeline, ranking formula, and tuning guide.

Recall rendering ​

Recall and flashback lines are plain text with an owner-built metadata prefix: type · month · emotion +3 (pride, joy) · confidence 4 · topic coding — text. Unknown fields are omitted, and the prefix counts against the recall byte budget. There is no compressed wire codec.

Darwinism (Memory Fitness) ​

Memories compete for relevance. The system tracks usage patterns and adjusts visibility:

Signals tracked ​

SignalColumnEffect
Recall countrecall_countFrequently recalled → boosted in ranking
Last recalledlast_recalled_atRecent recall → higher recency factor
Relevance scorerelevance_scoreManual or sleep-assigned importance boost
Confidenceconfidence1-5 scale, affects trust factor in scoring
Recall timestampsrecall_timestampsJSON array of last 20 recall times (spacing effect)

Promote triggers ​

  • Memory recalled ≥3 times in 30 days → relevance boost
  • Spaced recalls (intervals ≥7 days apart) → 1.3× multiplier
  • Sleep cycle identifies memory as "core" → tier promotion to core
  • User explicitly confirms → credibility rises; corrections go through the owner correct path (abmind personal --action correct), never silent edits

Demote triggers ​

  • Never recalled after 90 days → candidate for expiry (valid_to set)
  • Contradicted by newer knowledge → kept side by side; the owner resolves via abmind personal --action correct (conflicts coexist, sleep never rewrites history)
  • Sleep cycle flags as stale/redundant → consolidated or forgotten through the reviewed mechanism

Multi-user Isolation ​

Each user gets isolated memory. Configure in ~/.abmind/config/users.json:

json
{
  "users": [
    { "userId": "master", "role": "master", "maxClass": 3, "tools": ["all"] },
    { "userId": "guest-123", "role": "guest", "maxClass": 0, "tools": [] }
  ]
}
RoleCapabilities
masterFull access, all classifications, all tools
userRead/write, no secrets (class 0-2), limited tools
guestRead-only, class 0 only, no memory recording

See classification.md for the NATO Admiralty Codes system.

Consolidation Tiers ​

TierFrequencyContent
DailyEvery sleep cycleSummary of that day's conversations
WeeklyEvery 7 daysCompressed weekly themes
QuarterlyEvery 90 daysHigh-level patterns and persistent facts

Consolidation files live in ~/.abmind/memory/consolidation/{daily,weekly,quarterly}/. They're searched by the S6 stage during recall (keyword match against .md file contents).

Entity Graph ​

Durable knowledge can carry relationships between the entities it names:

alice —[works-at]→ acme
project_x —[uses]→ sqlite

Sleep extraction proposes entities and relations alongside each durable fact. Abmind validates that both names actually appear in that fact and normalizes them, then derives source-bound edges into the recall projection. Recall (S8) reads those stored edges when a known entity appears in the query; revising the fact re-derives its edges, and superseding or forgetting it removes them from serving. This uses no additional model call at recall or index time, and it respects classification and sealing: sealed or foreign content contributes no edges. Converted rows keep only their remapped historical edges until revised.