AI Starter Package
Architecture

AI Memory System Guide

AI agents are stateless by default — every session starts from zero. A well-designed memory system changes that. Here is how to build one.

Why AI Agents Need Persistent Memory

Without memory, every conversation with an AI agent starts from scratch. It doesn't know your codebase conventions, your past decisions, or what you were working on yesterday. Every session requires re-establishing context — which wastes tokens and produces lower-quality output.

Persistent memory means your agent knows your project, remembers why architectural decisions were made, and picks up where it left off. The quality of output improves over time as the memory accumulates real context about how you work.

7 tiers
From session context to permanent knowledge
Plain text
All storage is markdown files — readable, version-controlled
No lock-in
Works with any AI model, any tool, any workflow

The 7-Tier Memory Architecture

1

Session Memory

Context window~200k tokens

Everything in the current conversation. Fast but limited — once the session ends or the window fills, this is gone.

Retention: Current session only
2

Working Memory

MEMORY.md fileMax 100 lines

A curated markdown file of facts, decisions, and context that the agent reads at the start of every session.

Retention: Permanent until pruned
3

Long-Term Memory

memory/archive/ directoryUnlimited

Compressed historical summaries. When working memory fills up, old entries are compressed and moved here.

Retention: Permanent
4

Agent Memory

.claude/agent-memory/Per agent file

Each specialist agent maintains its own memory. The Code Reviewer remembers patterns it has flagged before.

Retention: Permanent per agent
5

Knowledge Base

knowledge-base.mdMax 200 lines

System-wide learned rules. Only promoted here by the Auditor agent after validation. High signal, low noise.

Retention: Permanent, auditor-gated
6

Daily Notes

memory/YYYY-MM-DD.mdOne file per day

Chronological session history. What happened today, what was decided, what was left unfinished.

Retention: Permanent

Knowledge Graph & RAG (Retrieval-Augmented Generation)

Beyond flat files, you can use an MCP knowledge graph for structured entity storage — this is a form of RAG (Retrieval-Augmented Generation). Instead of stuffing everything into the context window, the graph stores entities (people, decisions, components) and retrieves only what's relevant at query time via semantic search.

File-based memory

  • • Fast to set up, zero infrastructure
  • • Version-controlled with your codebase
  • • Human-readable and editable
  • • Best for narrative context and decisions

Graph-based memory (MCP)

  • • Semantic search across all stored entities
  • • Relationships between people, code, decisions
  • • Better for large, complex knowledge bases
  • • Requires MCP server installation

Most teams start with file-based memory and add graph memory when they have hundreds of entities to track. Both can coexist — they serve different retrieval patterns.

Memory Maintenance Rituals

Memory without maintenance becomes stale noise. These rituals keep the system clean:

/syncMid-session

Refresh memory from files, prune stale items, compress old entries into archive

/wrap-upEnd of day

Write daily notes, update working memory, archive completed tasks, plan tomorrow

/morningSession start

Load fresh context, read daily notes, surface priorities, check pending items

/safe-clearWhen context degrades

Flush context window, save state, reload minimal fresh context

Memory Hygiene Best Practices

  • 1
    Keep MEMORY.md under 100 lines — ruthlessly prune stale entries
  • 2
    Every memory entry should be dated so you know when to expire it
  • 3
    Decisions > facts: prefer recording why something was decided over what was decided
  • 4
    Use the auditor agent to gate entries into knowledge-base.md — not everything belongs there
  • 5
    Archive does not mean delete — compressed history is still searchable
  • 6
    Agent memory is separate from project memory — keep agent-specific patterns in agent files

Get the Full Memory System Pre-Built

The AI Starter Package ships with all 6 memory tiers configured, maintenance rituals pre-wired as commands, and an auditor agent to keep the knowledge base clean.

View Pricing