Memory
Reactive Agents provides a four-tier memory architecture inspired by cognitive science.
Memory Types
Section titled “Memory Types”Working Memory
Section titled “Working Memory”Short-term, capacity-limited (default 7 items). Automatically evicts based on FIFO or importance policy.
// Items are automatically managed during agent execution.// Working memory holds the current conversation context,// recent tool results, and active reasoning state.Semantic Memory
Section titled “Semantic Memory”Long-term factual knowledge stored in SQLite with FTS5 full-text search.
// Semantic entries have importance scores, access counts,// and support Zettelkasten-style linking between concepts.Episodic Memory
Section titled “Episodic Memory”Event log of agent actions and experiences. Supports session snapshots for conversation continuity.
Procedural Memory
Section titled “Procedural Memory”Stored workflows and learned procedures with success rate tracking. Agents improve their strategies over time.
Memory Tiers
Section titled “Memory Tiers”| Tier | Storage | Search | Use Case |
|---|---|---|---|
| 1 | bun:sqlite WAL | FTS5 full-text | Most applications |
| 2 | bun:sqlite WAL + sqlite-vec | FTS5 + KNN vector | Semantic similarity |
Tier 1 (Default)
Section titled “Tier 1 (Default)”const agent = await ReactiveAgents.create() .withMemory("1") // FTS5 search, no embeddings needed .build();Tier 2 (Vector Search)
Section titled “Tier 2 (Vector Search)”Requires an embedding provider:
EMBEDDING_PROVIDER=openaiEMBEDDING_MODEL=text-embedding-3-smallconst agent = await ReactiveAgents.create() .withMemory("2") // FTS5 + KNN vector search .build();Memory Bootstrap
Section titled “Memory Bootstrap”At the start of each task, the memory layer bootstraps context:
- Loads recent semantic entries for the agent
- Retrieves the last session snapshot
- Generates a markdown projection of relevant knowledge
- Injects this into the agent’s system prompt
This gives agents continuity across conversations without explicit context management.