AI Agent Memory Types
Every AI coding tool handles memory differently — and most of them forget everything the second your session ends. This lesson explains the seven memory models you'll encounter, the trade-offs each one makes, and how to compensate when your tool has no real memory between sessions (which is most of them).
Why this matters
The seven memory models
These appear in our compatibility matrix on the Templates page. Here's what each one actually means and where it shines.
Knowledge Base
Examples:Antigravity .agent/ folder, OpenClaw skills/
A structured, file-based collection the agent treats as authoritative reference. Auto-discovered or explicitly indexed, queried as needed during a task.
- +Compounds over time — every entry is reusable
- +Version-controlled with the project
- +Works offline; no vendor lock-in
- +Reviewable by humans like any other code
- −Requires discipline to maintain (stale entries are worse than none)
- −Discovery cost — agent must learn what's there
- −No automatic refresh; you decide when to update
Best for
Long-lived projects with stable conventions and a small team that maintains them.
Persistent Memory
Examples:OpenClaw, ChatGPT projects, Claude Projects
Vendor-managed long-term memory that survives sessions. The agent decides what to remember, or you tell it explicitly.
- +Zero setup — just talk to the agent
- +Carries across chats automatically
- +Often surfaces useful facts you'd forget to write down
- −Opaque — you can't always see what's stored
- −Vendor lock-in; export is rarely clean
- −Drift risk: outdated facts persist silently
- −Privacy concerns — review provider's data policy
Best for
Personal workflows and exploratory work where speed beats auditability.
Session Only
Examples:Cursor, Cline, Claude Code, Codex CLI/VS Code, Gemini CLI, Windsurf, Continue, Roo Code
The agent remembers everything in the current chat/session and forgets it the moment the session ends. The default mode for most editor agents.
- +Predictable — what you see is what the agent knows
- +Privacy by default — nothing leaks across sessions
- +No stale-memory bugs
- −You re-explain the same context every time
- −Hard-won insights vanish at session end
- −Quality degrades on long projects without external memory
Best for
Anything serious — but only when paired with a file-based knowledge base (this is the gap the Learner Brain fills).
Git-Based
Examples:Aider (every change is a commit)
The repository's git history IS the memory. Every change, decision, and conversation is captured as a commit you can replay.
- +Perfect audit trail by construction
- +Time-travel debugging via git log/blame
- +Memory survives any tool change
- +Works with existing dev workflow
- −Pollutes commit history if not curated
- −Doesn't help mid-session; only between sessions
- −Requires good commit messages to be searchable
Best for
Teams that already practice strict commit hygiene and want zero new infrastructure.
Always Active
Examples:Lovable Project Knowledge
Instructions injected into every prompt automatically. There's no 'discovery' step — the agent literally cannot ignore them.
- +Highest reliability — context is guaranteed loaded
- +No file paths to remember
- +Great for hard constraints (security, design tokens)
- −Eats context window on every request
- −No conditional loading — applies even when irrelevant
- −Bloat is invisible until quality drops
Best for
Universal rules that must apply to 100% of work (e.g., 'never store secrets in code').
Project Memory
Examples:Claude Projects, ChatGPT Projects
Files you upload to a project folder that the agent searches when relevant. Lives between sessions but is scoped to one project.
- +Better than session-only for static reference docs
- +Bigger than the prompt window — agent retrieves snippets
- +Easy to add: just drag in a PDF or markdown file
- −Web-only; not synced with your local repo
- −Search quality varies; relevant chunks aren't always retrieved
- −Manual to keep in sync with code changes
Best for
Spec documents, style guides, or onboarding material that doesn't change every day.
Memory Feature (LLM-managed)
Examples:ChatGPT Memory, Claude memory beta
The model autonomously decides what's worth remembering across all your conversations — preferences, recurring facts, working style.
- +Frictionless — no setup
- +Personalises responses over weeks/months
- +Captures preferences you'd never bother writing down
- −Cross-project leakage (work facts in personal chats)
- −Hard to audit or edit precisely
- −Vendor-controlled; can be wiped or changed without notice
Best for
Personal assistant use cases — NOT shared codebases.
The "no cron" problem
Most AI coding tools — Cursor, Cline, Codex, Claude Code, Gemini CLI, Windsurf — run inside VS Code or your terminal. There is no background process, no scheduler, no cron job that can update your memory between sessions. So how does the brain stay alive?
The answer: humans are the cron. Memory updates happen at natural checkpoints in your workflow — end of session, end of PR, end of feature — not on a clock. The Learner Brain methodology is built around this constraint.
Three triggers that replace cron
Run the Brain Harvest prompt before closing the chat. Captures what the agent learned while it's still fresh in context.
Add a "brain review" step to your PR template. Any new patterns, anti-patterns, or rules go into the brain folder as part of the same PR.
5-minute pass over .agent/ (or equivalent) to delete stale entries and consolidate duplicates. See the Brain Audit Checklist.
Mitigations: how to fix what your tool gets wrong
For every common memory failure, there's a Learner Brain mitigation. Most of them are one file or one habit.
Session-only agent forgets your stack between chats
Commit a project-root instruction file (AGENTS.md / CLAUDE.md / .cursor/rules/) the agent auto-loads at session start. This is the Learner Brain's core move.
Example
Add `package manager: pnpm` once to AGENTS.md → never re-asked across all future sessions.
No cron / no background process to update memory
Trigger updates on natural human checkpoints instead of time. Run a 'Brain Harvest' prompt at end-of-session, end-of-PR, or end-of-feature. The harvest IS your cron.
Example
Bind a keybinding or slash command to your harvest prompt so it's one keystroke after every meaningful session.
Knowledge base goes stale silently
Treat memory like code: add it to PR review. Every brain edit is a commit; every commit is reviewed. Run a weekly Brain Audit (5 min) to delete dead entries.
Example
See the Brain Audit Checklist resource — it's a 7-step pass over .agent/ that catches drift early.
Always-active rules bloat the prompt window
Reserve always-active for true universals (security, never-do rules). Move conditional guidance into Skills or scoped rule files (e.g., `.cursor/rules/*.mdc` with globs).
Example
`globs: ['**/*.tsx']` on a Tailwind rule means it only loads when editing TSX — saving tokens on backend work.
Persistent vendor memory drifts and you can't see why
Mirror critical facts into your repo. Treat vendor memory as a cache, not the source of truth. If a fact matters, write it to AGENTS.md.
Example
When ChatGPT remembers 'we use Vitest', also add it to your project's AGENTS.md so a teammate (or another tool) inherits it.
Agent re-asks the same clarifying questions every session
That's the repetition trigger. Promote the answer to a permanent rule. Two repeats = file an upgrade.
Example
User explains 'always use shadcn Button, never raw <button>' twice → add it to AGENTS.md under Coding Standards.
Multi-step workflows you keep re-typing
Promote them to Skills (.agents/skills/<name>/SKILL.md). The agent matches the description against new tasks and follows the steps deterministically.
Example
'Add a new page' workflow → SKILL.md with frontmatter description, numbered steps, expected outputs.
Quick reference: what does my tool use?
A condensed view of memory model by platform. Click through for the full template and mitigation pattern.
| Platform | Memory model | Template |
|---|---|---|
| Lovable | Always Active (Project Knowledge) | Get → |
| Antigravity | Knowledge Base (.agent/) | Get → |
| OpenClaw | Persistent + Knowledge Base | Get → |
| Aider | Git-Based | Get → |
| Cursor | Session Only (mitigate with .cursor/rules/) | Get → |
| Cline | Session Only (mitigate with .clinerules) | Get → |
| Claude Code | Session Only (mitigate with CLAUDE.md) | Get → |
| Codex CLI / VS Code | Session Only (mitigate with AGENTS.md) | Get → |
| Gemini CLI | Session Only (mitigate with GEMINI.md) | Get → |
| Windsurf | Session Only (mitigate with .windsurfrules) | Get → |
| Continue | Session Only (mitigate with .continue/rules/) | Get → |
| Zed | Session Only (mitigate with .rules / AGENTS.md) | Get → |
The single principle
Memory you can read, edit, diff, and review is always better than memory you can't. Vendor memory features are great for personal flow; file-based memory in your repo is what survives team handovers, tool migrations, and your own future forgetfulness.
Pick a tool with whatever memory model fits your workflow — but never rely on it alone. Always pair it with a versioned brain folder. That's the entire Learner Brain bet.
Next steps
Pick a template for your tool →
Each template is the file-based memory layer your tool is missing.
Run a Brain Audit →
The 5-minute weekly pass that keeps your memory from rotting.
Learn the Upgrade Protocol →
The exact format for turning friction into permanent memory.
Write rules that stick →
How to phrase memory entries so the agent actually follows them.
This template was last reviewed in April 2026 against the official Learner Brain platform templates. Spot something out of date? Let us know.