Brain & Memory
Brain & Memory
Persistent agent memory and per-project knowledge base
Overview
The SDK provides three related resources for AI agent memory and project intelligence:
r.memory— Persistent facts and decisions that survive across sessions. Network-scoped.r.brain— Send messages to the Brain AI (response streams via WebSocket).r.projectBrain— Per-project dashboard: tasks, milestones, team activity, usage stats.
Memory (r.memory)
Facts
Store and retrieve facts — things worth remembering across sessions such as patterns, conventions, preferences, and gotchas.
Store a fact
Input fields:
Memory rejects facts that appear to contain secrets (API keys, passwords, tokens). Store secrets in environment variables instead.
List facts
Filter parameters:
Remove a fact
Decisions
Log architectural, strategic, or technical decisions with context. Decisions are searchable and shared across the organization.
Log a decision
Input fields:
List decisions
Search memory
Search across all memory types (facts, decisions, and conversations) with relevance ranking.
Input fields:
Returns: SingleResponse<MemorySearchResult[]>
Build context injection
Build a formatted context block from relevant memories for a given message. Use this to enrich system prompts with past knowledge.
Input fields:
Purge memory
Delete all memory (facts and decisions) for a project. This is irreversible.
Purging memory is irreversible. All facts and decisions for the project will be permanently deleted.
Brain (r.brain)
Send messages to the Brain AI. The response streams back via WebSocket.
Project Brain (r.projectBrain)
Per-project intelligence dashboard with tasks, milestones, team activity, and usage stats.
List tasks
Get project stats
List milestones
List project decisions
List project agents
Team activity
Complete a task
Get usage stats
Golden path: agent with persistent memory
Here is a complete example of an agent that uses memory to maintain context across sessions: