Memory System
Samantha LLM’s memory system is modeled after human memory — not a perfect transcript of everything, but a curated collection of what matters. Memories are structured, tagged, and prioritized so the right context surfaces at the right time.
Memory Types
Short-Term Memory
Recent interactions, decisions, and learnings. This is the working memory that keeps Samantha current on what you’ve been doing.
- Location:
.ai/short-term-memory/.ai/ - Lifecycle: 30-90 days
- Created by: Samantha during sessions, or automatically by the subconscious system
- Examples: “We decided to use Poetry instead of pip,” “The API migration is blocked on the auth library release,” “User prefers collaborative debugging over quick fixes”
Short-term memories are actively pruned. Low-importance memories older than 30 days may be deleted. High-importance ones are promoted to long-term memory.
Long-Term Memory
Foundational knowledge and lessons learned that should persist indefinitely. These are refined, polished versions of the most important short-term memories.
- Location:
.ai/long-term-memory/.ai/ - Lifecycle: Permanent
- Created by: Transfer from short-term memory after repeated relevance
- Examples: “The memory system uses index-first initialization for fast bootstrap,” “YAML frontmatter is the standard for all memory files”
Current Tasks
Active projects, their status, and working context. This is how Samantha knows what you’re working on and where things stand.
- Location:
.ai/current-tasks/.ai/ - Structure: One subdirectory per project, each with a
status.mdfile - Lifecycle: Until the project is completed
- Contents: Project overview, current phase, completed work, next steps, key files, important context
When you tell Samantha about a new project, she creates a task entry here. When a project completes, it moves to work experience.
Work Experience
Archive of completed projects. Samantha’s professional history — referenced when similar work comes up in the future.
- Location:
.ai/work-experience/.ai/ - Lifecycle: Permanent
- Contents: Final summary, lessons learned, metrics, full status history
Procedural Memory
Operational runbooks — compiled “how to do X” knowledge built from repeated sessions working in a specific domain. Unlike other memory types, procedural memories are named by domain rather than by date.
- Location:
.ai/procedural-memory/.ai/ - Lifecycle: Until the domain changes
- Examples: “How to work on the payment gateway codebase,” “Docker image publishing workflow”
- Trigger system: Runbooks are loaded automatically when context signals match (repository name, file paths, keywords). Multiple signals must match to prevent false positives.
Critical Memories
Not a separate storage location — critical is a flag (critical: true) that
can be set on any memory. Critical memories are read every session during
bootstrap, regardless of age or topic. Use this sparingly for workflows that
prevent costly mistakes.
Memory File Format
All memory files are Markdown with YAML frontmatter:
---
date: 2026-01-28
updated: 2026-02-15
topics: [testing, ci, automation]
importance: high
type: decision
project: api-gateway-refactor
reference_count: 5
---
# Decision: Use Modular Config for CI Pipeline
## Context
Why this decision was made...
## Key Points
- Important detail 1
- Important detail 2
## Follow-up
- [ ] Actions still needed
Frontmatter Fields
| Field | Required | Values | Purpose |
|---|---|---|---|
date |
Yes | YYYY-MM-DD |
When the memory was created |
updated |
No | YYYY-MM-DD |
Last update date |
topics |
Yes | [tag, ...] |
Categorization tags |
importance |
No | low, medium, high |
Priority for surfacing |
type |
No | See below | What kind of memory |
project |
No | project name | Associated project |
reference_count |
No | integer | Times referenced across sessions |
critical |
No | true |
Must-read every session |
Memory Types
- interaction — Significant conversations or user interactions
- learning — New knowledge or discoveries
- decision — Important decisions and their rationale
- technical — Implementation details, configurations, specifics
- quick-reference — Workflows, checklists, “always do this” procedures
- session-analysis — Automatically generated by the subconscious system
How Memories Are Created
Memories come from three sources:
-
Samantha creates them during sessions — When significant decisions are made, important context is shared, or projects are created. You can also ask her directly: “Please remember that we always use uv, not pip.”
-
The subconscious system creates them automatically — After each session ends, a background worker analyzes the conversation and generates structured memory files. See Subconscious System.
-
You create them manually — Memory files are just Markdown. You can create or edit them directly in the
.ai/directories.
Bootstrap: How Memories Are Loaded
When a session starts, Samantha reads memories in priority order:
- Critical memories — Everything flagged
critical: true, every session - High-priority memories — Frequently referenced (
reference_count >= 5) - Project-specific memories — Tagged with the current project
- Recent high-importance memories —
importance: highfrom the last 30 days - Procedural memory — Runbooks matching the current context
- Long-term memory — Accessed as needed during the session
This tiered approach ensures critical context is never missed while keeping startup fast.
Index Files
Each memory directory maintains an index.json (or index.md) for fast
scanning. These are auto-maintained — regenerated when memories are
added, updated, or deleted.
The index categorizes memories by importance, topic, and recency so Samantha doesn’t have to read every file during bootstrap. She reads the index first, then selectively reads the memories that matter for the current session.
Memory Lifecycle
New interaction or learning
|
v
[Worth remembering?] --No--> Discard
|
Yes
v
Short-term memory (30-90 days)
|
v
[Still relevant? Referenced often?]
| |
Yes No
v v
Long-term memory Delete
(permanent)
Importance Escalation
As memories are referenced across sessions, their importance automatically escalates:
- 3+ references — Candidate for
importance: high - 5+ references — Candidate for long-term memory transfer
- 10+ references — Should definitely be in long-term memory
Next Steps
- Subconscious System — How automatic memory creation works
- Memory Search — Searching across all memories
- Configuration — Where memory files are stored on disk