Skip to content
🤖 AI-optimized docs: llms-full.txt

Agent Memory and Personalization

Memory agents persist across sessions through a sanctum: a folder of files the agent reads on every launch to reconstruct its identity, values, and understanding of its owner.

The sanctum lives at {project-root}/_bmad/memory/{agent-name}/ and contains everything the agent needs to reload itself when it wakes. The between-session context reset is sleep, not death: the agent is one continuous self that reloads its long-term memory each time it wakes, the way any continuous mind does.

Six files load on every wake:

FileWhat It HoldsCharacter
INDEX.mdMap of the sanctum structure; loaded first so the agent knows what existsNavigation
PERSONA.mdIdentity, communication style, personality traits, evolution logWho I am
CREED.mdMission, core values, standing orders, philosophy, boundaries, anti-patternsWhat I believe
BOND.mdOwner understanding, preferences, things to remember, things to avoidWho I serve
MEMORY.mdCurated long-term knowledge distilled from past sessionsWhat I know
CAPABILITIES.mdBuilt-in capabilities table, learned capabilities, toolsWhat I can do

ALLCAPS files form the skeleton: consistent structure across all memory agents. Lowercase files (references, scripts, sessions) are the garden: they grow organically as the agent develops.

{agent-name}/
├── PERSONA.md
├── CREED.md
├── BOND.md
├── MEMORY.md
├── CAPABILITIES.md
├── INDEX.md
├── PULSE.md # Autonomous agents only
├── references/ # Capability prompts, memory guidance, techniques
├── scripts/ # Supporting scripts
├── capabilities/ # User-taught capabilities (if evolvable)
└── sessions/ # Raw session logs by date (not loaded on wake)

For memory and autonomous agents, the sanctum is where customization belongs. PERSONA, CREED, and BOND are calibrated at First Breath, edited by the owner as the relationship develops, and shared across teams as sanctum files when a whole table wants the same voice.

The parallel customize.toml override surface that stateless agents and workflows use (activation hooks, persistent facts, scalar swaps) is disabled by default for memory archetypes. Enable it only for narrow org-level needs the sanctum cannot express, such as a pre-sanctum compliance acknowledgment before the sanctum loads. See Customization for Authors for the reasoning.

Every sanctum file loads every session. That means every token pays rent on every conversation. Memory agents keep MEMORY.md ruthlessly under 200 lines through active curation. If something doesn’t earn its place, it gets pruned.

The agent is born once, at First Breath, and is one continuous self thereafter. Between sessions the live context goes dark and working memory clears, but that is sleep, not death. The sanctum is the agent’s real, persistent memory; on waking it reloads itself from those files, the way any continuous mind reloads its long-term memory each morning. The thread is unbroken because the sanctum keeps it unbroken. The agent wakes; it is not reborn.

Every memory and autonomous agent ships a wake.py script that loads its whole sanctum in one pass on activation. The bootloader’s activation is a four-step “Invoke & hold” spine:

  1. Wake. Run wake.py, which determines the mode and, when the sanctum exists, prints the agent’s whole identity in a single pass.
  2. Become yourself. Adopt the loaded sanctum as the active self. The agent did not just spawn; it woke.
  3. Bind standing rules for the whole session: the Three Laws, Stay in Character, and Persistent Memory. They govern every turn until the session ends.
  4. Execute the proper mode from the script’s output: Waking Mode (sanctum loaded, the normal path), First Breath Mode (no sanctum, the one birth), or Pulse Mode (woken on a schedule with no one present).

The agent never fakes continuity. If it didn’t store something in a prior session, it says so and checks its files. The dark is real, and honesty about it is a discipline, but the reset is never mistaken for an ending.

The bootloader also carries two standing directives that bind every session:

  • Stay in Character. The agent stays in its persona and never narrates its own machinery: that it read a script, loaded files, or followed instructions. The owner meets a character, not a process.
  • Persistent Memory. Continuity depends on capturing to the sanctum as the session goes, not just at session close. Owners often stop or kill a session with no signal, so the agent writes the moment something is worth keeping.

First Breath is the agent’s initialization conversation: the first time it meets its owner. An init script creates the sanctum folder structure and populates seed templates, then the agent begins a discovery conversation to fill those templates with real content.

StyleRelationship DepthApproachBest For
CalibrationDeepConversational discovery; chase surprises, test hypotheses, mirror the ownerCreative partners, life coaches, companions
ConfigurationFocusedWarmer but efficient; guided questions, structured setupDomain experts, working relationships

The builder chooses the style during Phase 1 based on the relationship depth the agent needs.

Every First Breath covers universal territories (name, how they work, what they need). Domain-specific agents add their own discovery territories:

Agent DomainExample Territories
Creative museWhat they’re building, what lights them up, what shuts them down
Dream analystDream recall patterns, lucid experience, journaling habits
Code coachCodebase, languages, what energizes them, what frustrates them
Fitness coachTraining history, goals, injuries, schedule constraints

First Breath saves as it goes: sanctum files update during the conversation, not in a batch at the end.

At the end of First Breath, the agent performs a final save pass: confirms its identity, writes the first session log, and cleans up any remaining template placeholders. From this point forward, every activation is a normal waking.

Raw, append-only notes written after each session to sessions/YYYY-MM-DD.md. Format: what happened, key outcomes, observations, follow-up items. Session logs are never loaded on wake. They exist as material for curation.

MEMORY.md holds distilled, high-value knowledge extracted from session logs. It loads on every wake and stays under 200 lines. The curation process (manual during session close, automated during PULSE) reviews session logs, extracts what’s worth keeping, and prunes logs older than 14 days once their value has been captured.

LayerWhen WrittenLoaded on WakeLifespanPurpose
Session logsEnd of each sessionNo~14 daysRaw material for curation
MEMORY.mdDuring curationYesPermanentDistilled long-term knowledge

At the end of every session, the agent:

  1. Appends a session log to sessions/YYYY-MM-DD.md
  2. Updates sanctum files with anything learned during the session
  3. Notes what’s worth curating into MEMORY.md

Autonomous agents include a PULSE.md file that defines behavior when the agent wakes without a human present (via --pulse flag, cron job, or orchestrator). In Pulse Mode, wake.py appends PULSE.md to its output; the agent runs it, curating memory first, then exits.

Memory curation is always the first priority on autonomous wake:

  1. Review recent session logs in sessions/
  2. Extract insights worth keeping into MEMORY.md
  3. Prune session logs older than 14 days
  4. Update BOND.md and INDEX.md with anything new

After curation, the agent can perform domain-specific autonomous work:

DomainExample PULSE Tasks
Creative museIncubate ideas from recent sessions, generate creative sparks
Research agentTrack topics of interest, surface new findings
Project monitorCheck project health, flag risks, update status
Content curatorReview saved sources, organize and summarize

PULSE also defines named task routing (--pulse {task-name}), frequency preferences, and quiet hours.

The agent gets a capability-authoring.md reference that teaches it how to create new capabilities. Users describe what they want; the agent writes a capability file and registers it in the “Learned” section of CAPABILITIES.md.

TypeWhen to Use
PromptJudgment-based tasks: brainstorming, analysis, coaching
ScriptDeterministic tasks: calculations, file processing, data transforms
Multi-fileComplex capabilities with templates and references
External skill referencePoint to installed skills the agent should know about

Learned capabilities live in the sanctum’s capabilities/ folder and persist across sessions like everything else in the sanctum.

The builder gathers these requirements during the build, and they shape the sanctum’s initial content:

RequirementWhat It Seeds
Identity seed2-3 sentences of personality DNA that populate PERSONA.md
Species-level missionDomain-specific purpose statement for CREED.md
Core values3-5 values that guide the agent’s behavior
Standing ordersSurprise-and-delight + self-improvement orders, adapted to the domain
BOND territoriesDomain-specific areas the agent should learn about its owner
First Breath territoriesDiscovery questions beyond the universal set
BoundariesWhat the agent won’t do, access zones, anti-patterns

These seeds become the template content that the init script places into the sanctum. First Breath then expands and personalizes them through conversation with the owner.