Memory & RAG
~8 min readUpdated: October 2026

The Four Types of Agent Memory (And How to Make an Agent That Learns)

The four types of agent memory — persistent memory architecture in Smoke Monkey

An agent without memory starts from zero every session, repeating mistakes and relearning your codebase. The fix is a memory architecture, and the clearest model comes from cognitive science: **working**, **procedural**, **episodic**, and **semantic** memory. This guide explains each type, how they map onto an agent runtime, and how [Smoke Monkey Harness](/solutions/what-is-an-ai-agent-harness) persists them while **Smoke Monkey Canvas** lets you inspect what your agents have learned.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

The Four Types of Agent Memory (And How to Make an Agent That Learns): An agent without memory starts from zero every session, repeating mistakes and relearning your codebase. The fix is a memory architecture, and the clearest model comes from cognitive science: **working**, **procedural**, **episodic**, and **semantic** memory. This guide explains each type, how they map onto an agent runtime, and how [Smoke Monkey Harness](/solutions/what-is-an-ai-agent-harness) persists them while **Smoke Monkey Canvas** lets you inspect what your agents have learned. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Exampleagent-memory.ts
agent-memory.tstypescript
import { createAgent } from 'smoke-monkey-harness';
// Memory that persists across sessions: semantic + episodic + procedural
const agent = createAgent({
provider: 'anthropic',
model: 'claude-sonnet-5',
workspacePath: process.cwd(),
memory: {
semantic: { store: './.agent/memory/facts.json', retrieve: 'embeddings' },
episodic: { store: './.agent/memory/runs.jsonl' },
procedural: { skills: ['./.agent/skills'] },
},
context: { maxTokens: 120000, compaction: { threshold: 0.75 } },
});
await agent.run('Continue the migration you started last session and recall prior decisions');
Video Guides

Watch: Related Video Guides

Anthropic Just Built an Agentic OS — Open Source Harness Breakdown

Smoke Monkey

The Four Types of Memory Every AI Agent Needs

IBM Technology

Working Memory Is the Context Window

The agent's working memory is the context window: what it can see right now. It is fast and immediate, and it is also the most fragile — overflow it and the earliest messages, including your original goal, fall out. This is why context window management is the foundation of any memory design: compaction and subcontexts keep working memory coherent so the other three memory types have something stable to build on. Smoke Monkey Harness manages working memory automatically, and Smoke Monkey Canvas shows its live size per agent.

A bigger window is not memory

Throwing tokens at the problem just delays overflow and inflates cost. Real memory lives outside the window and is loaded selectively.

Episodic and Semantic Memory

Episodic memory is the record of what happened: which runs, which decisions, which failures and fixes. Semantic memory is durable facts: your architecture, conventions, and domain rules. Together they answer "have we been here before?" and "what is true about this system?" In practice that means an append-only run log plus a retrieval store over your code and docs. Smoke Monkey persists both to disk, so a new session starts with context rather than amnesia, and it retrieves only the relevant slice instead of dumping everything into the window. Smoke Monkey Canvas surfaces which memories an agent loaded on each run.

episodic-semantic.tstypescript
import { createAgent } from 'smoke-monkey-harness';
const agent = createAgent({
provider: 'anthropic',
model: 'claude-sonnet-5',
workspacePath: process.cwd(),
memory: {
// semantic: durable facts retrieved by similarity
semantic: { store: './.agent/facts.json', retrieve: 'embeddings', topK: 8 },
// episodic: an append-only record of past runs and decisions
episodic: { store: './.agent/runs.jsonl', summarize: true },
},
});
// This run can recall decisions from previous sessions
await agent.run('Apply the same auth pattern we standardized on last week');

Procedural Memory and Making an Agent Learn

Procedural memory is *how* to do things: a skill, a reusable tool, a refined prompt for a recurring task. This is where an agent that merely recalls becomes an agent that improves. When a workflow succeeds, capture it as a stored skill; next time, the agent invokes it instead of rediscovering the steps. In Smoke Monkey, procedural knowledge lives as tools and skill files the runtime loads, and the deterministic state machine makes those skills reproducible. Combine it with context compaction so learned procedures survive long sessions and knowledge-base retrieval for project facts. Review and curate learned skills per agent on Smoke Monkey Canvas before they spread.

learning-loop.tstypescript
import { createAgent, defineTool } from 'smoke-monkey-harness';
// Procedural memory: capture a successful workflow as a reusable skill
const deploySkill = defineTool({
name: 'deploy_checklist',
description: 'Run the team\'s proven pre-deploy checklist',
parameters: { type: 'object', properties: { service: { type: 'string' } } },
handler: async ({ service }) => runChecklist(service),
});
const agent = createAgent({
provider: 'anthropic',
model: 'claude-sonnet-5',
workspacePath: process.cwd(),
tools: [deploySkill], // learned procedure, reused every run
memory: { episodic: { store: './.agent/runs.jsonl' } },
});

Inspecting Memory on the Canvas

Memory you cannot see is memory you cannot trust. Smoke Monkey Canvas (npx @smoke-monkey/canvas start) makes an agent's memory a visible part of the workspace: each card shows what the agent currently recalls, which past runs it drew on, and which skills it loaded. That transparency is how you catch a wrong "fact" before it spreads across a fleet. With 300+ MCP tools, Canvas also lets you route memory operations — read, write, forget — through the same permission gates as any other action. Related reading: subcontext memory architecture and agent knowledge base. All four memory types are persisted by Smoke Monkey Harness and rendered by Smoke Monkey Canvas.

Google Search Questions & Answers

Frequently Asked Questions

Q:What are the four types of agent memory?

Working memory (the context window), episodic memory (the record of past runs and decisions), semantic memory (durable facts about the system), and procedural memory (reusable skills and how-to knowledge). Effective agents combine all four.

Q:How does Smoke Monkey Harness persist agent memory?

You configure semantic and episodic stores plus a skills directory in `createAgent()`. The runtime writes and retrieves them to disk, so a new session starts with relevant context instead of a blank slate.

Q:What is the difference between RAG and agent memory?

RAG retrieves documents for a single answer; agent memory persists experience and facts across many sessions and tasks. Smoke Monkey supports both, and routes retrieval through MCP tools.

Q:Can I inspect what an agent has learned?

Yes. Smoke Monkey Canvas renders each agent's recalled facts, past runs, and loaded skills on its card, so you can verify and correct memory before it propagates across a fleet.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness