Types of AI agent memory, mapped to code
Working, procedural, semantic and episodic memory, mapped to the files a coding agent uses: CLAUDE.md, skills, facts, decisions, transcripts and git.
On this page
The types of AI agent memory are usually given as four: working memory (what’s in the context right now), procedural memory (how to act), semantic memory (what’s true) and episodic memory (what happened). For a coding agent, each one is already a file in or beside your repository. Working memory is the context window. Procedural memory is CLAUDE.md, AGENTS.md, rules, skills and hooks. Semantic memory is the code itself, plus the facts and decisions the code can’t hold. Episodic memory is session transcripts, git history and session notes.
The details below are as of November 2026, from Claude Code’s own documentation and the research papers, linked where they’re used. Claude Code memory: what it keeps, and where maps everything Claude Code remembers, and every guide on it.
| Type | Holds | For a coding agent | Written by | Seen by the agent |
|---|---|---|---|---|
| Working | The task at hand | The context window | The session | Always, until compaction or the end |
| Procedural | How to work | CLAUDE.md, AGENTS.md, rules, skills, hooks |
You | Instruction files at start, skills when relevant |
| Semantic | What’s true | The code, facts with a source, decisions | You and the agent | Code when read, facts and decisions when searched or briefed |
| Episodic | What happened | Transcripts, git history, session notes, logs | The tools and the agent | Only when looked up |
Where the four types come from
The names come from cognitive psychology. For language agents, the usual reference is Cognitive Architectures for Language Agents (CoALA, Sumers, Yao, Narasimhan and Griffiths, 2023). It splits an agent’s memory into a short-lived working memory and three long-term stores. In its words, episodic memory “stores experience from earlier decision cycles” and semantic memory “stores an agent’s knowledge about the world and itself”. Procedural memory comes in two forms: what’s in the model’s weights, and “explicit knowledge written in the agent’s code”.
LangChain’s memory docs use the same three long-term types and add a practical point: agents rarely change their weights or code, so the procedural memory an agent actually updates is its prompt.
Most articles on this query stop at the definitions and an example from a chatbot. The useful question for you is narrower: where does each type live when the agent is writing your code?
Working memory is the context window
Working memory is everything in the current session: your messages, the files the agent read, command output, its own plans. It’s fast and complete, and it’s gone when the session ends. Claude Code’s docs put it plainly: each session “begins with a fresh context window”.
It can also shrink in the middle of a session. When the window fills, Claude Code compacts the conversation into a summary, and details said once and early can be lost. Why Claude Code forgets after compaction covers what survives. The rule that follows from it applies to every type below: anything that must outlast the session has to be written to a file.
Is CLAUDE.md procedural memory?
Yes. CLAUDE.md is procedural memory in the sense CoALA means: explicit instructions for how the agent should act, loaded into every session. So are AGENTS.md, rules in .claude/rules/, and skills. They differ in when they load. Claude Code reads CLAUDE.md whole at the start of a session, loads a rule with paths: only when a matching file is touched, and loads a skill only when it’s invoked or matches the task (the .claude directory).
Hooks are procedural memory too, of the strictest kind. Claude Code treats CLAUDE.md “as context, not enforced configuration”, and its docs point to a hook for anything that must happen whatever the agent decides. A rule an agent keeps breaking is a candidate for a hook.
Two things follow for coding work.
- You should write it, not the agent. CoALA warns that writing to procedural memory “is significantly riskier than writing to episodic or semantic memory”, because it can introduce bugs or let an agent work around what you intended. An instruction an agent wrote for itself is followed in every later session, unread. Memorinth’s guide What goes where draws the same line: the instructions file is written by you, and agents write to the knowledge store.
- Keep facts out of it. A
CLAUDE.mdgrows long because semantic memory creeps in: where things are, what was tried, why a library was dropped. Those belong in the next type, where they can be searched instead of loaded every time.
Semantic memory: the code, facts and decisions
The largest semantic store a coding agent has is the repository. The code says what exists, how it’s called and how it fits together, and it’s never out of date. That’s why good memory leaves it alone: Claude Code’s auto memory skips “anything it can derive from the codebase”, and Memorinth’s agents are told not to record what the code or git history already says.
What the code can’t hold is the rest of what’s true:
- Facts outside the code, such as which staging host to use or a limit in a third-party API. In Memorinth, each one is a note in
facts/with a source, and it comes up for a recheck after 180 days, so a fact written in spring doesn’t read as settled in winter. See Facts. - Decisions and their reasons. “We parse dates by hand on purpose” is semantic knowledge the agent needs before it “fixes” the parser. Memorinth keeps these as numbered records in
decisions/that are superseded, never edited, so the current choice is clear and the old one is kept. See Decisions, and Decisions and facts: ADRs for AI agents for why.
A decision is the one note type with a foot in two stores. The accepted choice is semantic: it’s what holds now. The chain of superseded records behind it is episodic: what was believed, and when it changed.
Where do session logs fit?
Session logs are episodic memory: a record of what happened, in order. A coding agent has three kinds.
- Transcripts. Claude Code saves each session as a JSONL file under
~/.claude/projects/<project>/, with every message and tool result. They’re complete, but by default they’re deleted after 30 days (cleanupPeriodDays), and a new session doesn’t load them unless you resume one (application data). - Git history. For code, this is the best episodic record there is: durable, shared with your team, timestamped, and tied to the exact change. If a commit message says why, it’s already memory.
- Session notes and logs that the agent writes on purpose. In Memorinth, an
eventmemory records something that happened (“Shipped the first beta”), and a running log grows withappend_to_note, one timestamped entry at a time (Memory).
Raw episodes are rarely what a later session needs. It doesn’t need the two hours spent on a bug. It needs the cause, which is semantic, and maybe the steps to avoid it next time, which is procedural. The useful habit is to turn episodes into the other types at the end of a task: the cause becomes an insight or a fact, a settled question becomes a decision, and a repeated correction becomes a line in CLAUDE.md.
How Claude Code’s memory and Memorinth map onto the types
Neither tool names its notes after the four types, but both cover them.
| Procedural | Semantic | Episodic | |
|---|---|---|---|
| Claude Code, built in | CLAUDE.md, rules, skills, hooks; auto memory’s feedback notes |
Auto memory’s project, reference and user notes |
Transcripts, kept 30 days by default |
| Memorinth | howto and preference memories |
Facts, accepted decisions, insight memories |
event memories, logs, superseded decisions |
Claude Code’s built-in memory is enough for many people. If you use one agent on one machine, CLAUDE.md, auto memory and git cover all four types with nothing installed. Auto memory is machine-local, and loads the first 200 lines or 25 KB of its MEMORY.md index at the start of each session.
Memorinth earns its place when the semantic and episodic stores outgrow an index: when you want them searched by meaning, shared by several agents, and given a lifecycle so stale facts and replaced decisions don’t mislead. Claude Code memory: built in, or a server? goes through that choice.
Start with what goes where
You don’t need a framework to use the four types. Sort what you’d tell a new agent: how to work goes in CLAUDE.md, what’s true goes in facts and decisions, what happened goes in git and short notes, and the code speaks for itself. What goes where is that sorting as a checklist, and How agents use it shows when a connected agent reads and writes each kind.