For: AITEAM-X dashboard users
Updated: 2026-03-24
Version: 3.0
By default, every time you open a conversation with an agent, it starts from scratch — remembering nothing from earlier discussions. The memory system fixes that.
It automatically records what happens in each session and injects that context back into the agent the next time you talk to them. The result: the agent remembers past decisions, open tasks, and problems already solved — without you having to explain everything again.
Each agent has its own memory vault, organized into five categories:
| Category | What it stores | Examples |
|---|---|---|
| Decisions | Technical or project choices that were made | "We chose SSE instead of WebSockets", "Naming convention: kebab-case for agent IDs" |
| Lessons | Fixed bugs, solved problems, insights discovered | "spawn() timeout does not work on Windows — use manual setTimeout", "The tag must be embedded in the text to survive updateEntry()" |
| Handoffs | Summary of what was done last session and what comes next | "We implemented the /sleep endpoint and the badge component. Next: integration tests" |
| Tasks | Open items in checklist format | "- [ ] Review handoffs after critical sessions", "- [x] Migrate handoff flow" |
| Project | General context — stack, architecture, goals | "Next.js 15 App Router, no Tailwind, VT323 pixel font, Cursor Agent CLI required" |
Besides each agent’s individual vault, there is a shared _project.md file, injected into all agents. That is the right place for information any agent needs to know.
There are three ways:
When you close an agent’s chat window (× on the bubble or in the drawer), the system:
- Saves a conversation checkpoint
- Generates an automatic handoff from the last 6 messages
- Saves the handoff in the vault with tags
auto-handoffandsession-close
The next time you open a session with that agent, they receive that handoff as context.
Click the 🧠 icon in the top bar to open Memory Vault. From there you can:
- View all memories per agent by category
- Create new entries manually
- Edit or delete existing entries
- Search free text (BM25 search)
To import decisions and lessons from old conversations that have not been processed yet:
node scripts/import-conversations.mjsThe script analyzes conversation text using keywords and distributes relevant snippets into the correct vault categories.
Understanding the full cycle helps you know what the agent will remember — and what might be lost.
Open chat
│
├─ [auto-save 30s] → conversation saved to .memory/conversations/{agentId}.json
│
├─ [checkpoint 30s] → snapshot saved to .vault/checkpoints/{agentId}.json
│
├─ [close via ×]
│ │
│ ├─ 1. Final checkpoint saved
│ ├─ 2. Handoff generated (last 6 messages)
│ ├─ 3. Decisions and lessons extracted from conversation (PT+EN heuristic)
│ └─ 4. Everything saved to vault → injected on next session
│
├─ [unexpected close (tab/browser)]
│ │
│ └─ sendBeacon saves checkpoint + conversation (handoff NOT generated)
│
└─ [next session]
│
└─ Automatic context injection (see section below)
The automatic checkpoint every 30s protects conversation content. Even if the window closes unexpectedly, history is preserved on disk for up to 7 days.
This is the core mechanism: exactly what the agent receives when you start a new conversation.
- Project context — full contents of
_project.md - Last session handoff — the most recent summary, highest priority
- Relevant decisions — up to 3 decisions selected by text search (BM25) based on what you are asking
- Relevant lessons — up to 2 lessons selected the same way
- All open tasks — items with
[ ]not marked done - Recovery snapshot — if there is a valid checkpoint, the last 3 messages are included
The system uses BM25 (text search) to select the most relevant entries. BM25 compares your message text with stored memory content and returns the most similar ones.
In practice: if you ask to "review the authentication flow", the system injects decisions and lessons that mention authentication, session, tokens — not memories about CSS or deploy.
Injected context has a limit of 2,000 tokens (estimated as text_length / 4). If selected memories exceed that limit, the system prioritizes in this order:
- Handoff — always included, highest priority
- Open tasks — always included
- Relevant decisions — trimmed if needed
- Relevant lessons — trimmed first among BM25 results
- Project context — included last
The agent does not remember everything — it remembers what is most relevant to the current conversation. For specific topics you want guaranteed recall, use the right vault category (e.g. important decisions under "Decisions", not under "Project").
The file .memory/_project.md is special: it is injected into all agents, in every session.
Use _project.md for information any agent needs to know without asking:
- Project tech stack
- Team code conventions
- Current sprint goals
- Architectural decisions that affect everyone
- Environment constraints (e.g. "deploys only on Fridays")
- Agent-specific information — use the individual vault
- Tasks — use the "Tasks" category in each agent’s vault
- Conversation history — that lives in checkpoints
# AITEAM-X project
**Stack:** Next.js 15 App Router, React 19, TypeScript, no Tailwind
**Font:** VT323 (pixel art), styles in app/globals.css
**Required runtime:** Cursor Agent CLI
## Conventions
- Agent IDs: kebab-case (bmad-master, game-designer)
- API routes: REST for CRUD, SSE for streaming
## Current sprint
- Focus: memory system v3.0
- Documentation in /docs required for new featuresTip: Keep _project.md under ~500 words. A very long file can hit the token budget and push more relevant information (decisions, handoffs) out of injected context.
Memory Vault (🧠 in the top bar) is the main UI for managing memories.
- Agent selector (top): choose which agent to view
- Category tabs: Decisions / Lessons / Handoffs / Tasks / Project
- Search field: real-time BM25 search (300ms debounce, up to 15 results)
- Select the agent
- Select the category
- Click + New entry
- Enter content (markdown supported)
- Save
Manual entries persist until you delete them.
Click the pencil icon next to the entry. Content becomes inline-editable. Save with Enter or the check icon.
Click × next to the entry. Deleted entries cannot be recovered.
Each vault entry can have tags associated with them. Tags:
- Are extracted automatically from text (words preceded by
#) - Appear next to the entry in Memory Vault
- Affect BM25 search: a memory tagged
#authcan show up in authentication-related searches even if the main text does not mention it explicitly
| Tag | Source | Meaning |
|---|---|---|
#auto-handoff |
Frontend | Handoff generated automatically when closing session |
#session-close |
Frontend | Marks entries created on session close |
#compacted |
Compaction | Entry created during automatic compaction |
#auto-extract |
Compaction | Insight extracted by heuristic from trimmed conversations |
- Be specific: "We chose SSE" is vague. Better: "Adopt SSE instead of WebSockets — deploy environment does not support persistent bidirectional connections."
- Include the reason: A decision without context is hard to revisit. Always explain why.
- One decision per entry: Grouping many decisions in one entry hurts BM25 retrieval.
- Use relevant hashtags:
#sse #architecture #deployhelp recover the decision in future contexts.
- Focus on the problem, not only the solution: Start with the symptom: "spawn() on Windows does not report a reliable exit code when the process is killed via timeout." Then the solution.
- Include where it applies: "On Windows", "in production", "when the config file is missing" — context for when the lesson applies.
- Record anti-patterns: If you found a bad solution, record it too so it is not repeated.
- The system generates automatically: Closing the session with × creates a handoff from the last 6 messages.
- Create manually for critical sessions: If the session was very important or long, open the vault and add a more detailed manual handoff.
- Include the next step: "We implemented X. Next: Y." is more useful than only "We implemented X."
- Use the standard format:
- [ ] task description(open) /- [x] description(done) - Mark when done: Tasks with
[ ]appear in all future sessions for that agent. If irrelevant, delete or mark[x]. - One action per task: "Implement X and Y and test Z" should be three separate tasks.
- Stable information: The Project category is for context that changes rarely.
- Do not duplicate
_project.md: If something matters for all agents, put it in_project.md. If it is agent-specific, use that agent’s Project category in the vault.
Project context is injected in every session for every agent. A long file consumes token budget that could go to more relevant decisions and lessons. Target: under 500 words.
Closing via × is the only path that generates automatic handoffs. Closing the tab or browser only saves the checkpoint via sendBeacon — no handoff.
Automatic handoff is based on the last 6 messages. If the conversation was long and critical decisions were in the middle, the handoff may miss them. Add a complementary manual handoff in the vault.
Tags like #api, #performance, #bug connect memories so BM25 can retrieve them. When the agent receives "optimize API performance", memories with #api and #performance are more likely to be injected.
Tasks with [ ] are injected in every session. A long open-task list consumes tokens and clutters context. Mark [x] or delete when done.
Granular entries are retrieved more precisely by BM25 than entries mixing several topics. "We chose SSE" and "We adopted kebab-case for IDs" should be separate entries.
The system runs automatic compaction every 10 minutes while the dashboard is open. It:
- Clears checkpoints older than 7 days
- Trims long conversations (> 20 messages)
- Consolidates categories with more than 30 entries
To force manually:
curl -X POST http://localhost:3000/api/memory/compactFrequently used agents accumulate memories quickly. Periodically check for:
- Duplicate or contradictory entries
- Whether old handoffs are still relevant
- Lessons that were incorporated into code (and can be removed)
Over time the vault grows, conversations get long, and old checkpoints use space. Automatic compaction addresses this without manual cleanup.
| Step | What it does | Result |
|---|---|---|
| Expired checkpoints | Removes checkpoints older than 7 days | Disk space freed |
| Long conversations | Trims conversations with more than 20 messages, keeps only the most recent | Decisions and lessons extracted from removed messages are saved to the vault |
| Overfull vault | Consolidates categories with more than 30 entries — keeps the 20 newest and summarizes the rest | Leaner vault without losing information |
| Search index | Rebuilds the BM25 index after changes | Search stays current |
| Legacy files | Removes migration .bak and flat .md files already migrated |
Disk cleanup |
The dashboard runs compaction automatically every 10 minutes. On load it also checks whether the last compaction was more than 10 minutes ago — if so, it runs immediately.
Trimming is not destructive. Before removing old messages, the system:
- Analyzes text for decision patterns (e.g. "we decided", "we will use", "opted for") and lesson patterns (e.g. "we learned", "important", "we discovered")
- Saves found insights as vault entries with tags
#compactedand#auto-extract - Generates a summary (handoff) of the last removed messages with tag
#auto-handoff
Those entries are marked in the vault so you know they came from compaction, not manual entry.
curl http://localhost:3000/api/memory/compactCompaction can only run from localhost. Requests from external IPs get 403 Forbidden.
Situation: You spent an hour on Friday finding that Node.js spawn() does not fire the close event with a reliable exit code on Windows when the process is killed by timeout. You fixed it with a timedOut boolean + manual setTimeout + proc.kill(). On Monday you open a new session and no longer remember why the code looks that way.
With the memory system:
- Closing Friday’s session (×) generates a handoff automatically
- You add a manual vault lesson: "spawn()
closeon Windows does not report a reliable exit code when the process is terminated via timeout. Solution: manual setTimeout + timedOut boolean + proc.kill()." - On Monday, opening a new session about the same code injects that lesson via BM25
- The agent understands context immediately without you re-explaining
Tip: For important technical lessons, add them manually to the vault — more reliable than automatic handoff alone.
Situation: Three weeks ago the team decided not to use WebSockets and to adopt SSE for streaming because the deploy environment does not support persistent bidirectional connections. Today a new developer proposes WebSockets.
With the memory system:
- The decision was recorded under "Decisions" for bmad-master: "Adopt SSE instead of WebSockets — deploy environment does not support persistent bidirectional connections. #sse #architecture"
- Starting a session about streaming, BM25 retrieves that decision and injects it
- The agent proactively mentions the constraint
Situation: You are implementing a large system over several weeks. Each session makes partial progress.
With the memory system:
- Each closed session generates an automatic handoff
- Open tasks stay visible: "- [ ] Implement processPending() with retry", "- [ ] Add --dry-run flag"
- Opening the next session, the agent knows where you left off and what is left
- When a task is done, mark
[x]— it stops appearing in future sessions
Situation: You need to talk to game-designer for the first time. They know nothing about the project.
With the memory system:
_project.mdcontains stack, conventions, project constraints- It is injected automatically on the first session with any agent
- The agent understands the environment immediately
- You do not need to explain context on every new conversation
Likely cause: The memory was never created, or is not relevant enough for BM25.
What to do:
- Open Memory Vault (🧠)
- Check the memory exists in the right category
- If missing: create it manually
- If present but unused: rewrite to include keywords more specific to the context where you expect injection
- Add relevant tags to widen search coverage
Likely cause: The session ended unexpectedly (not via ×).
What to do:
- Always close sessions with ×
- If the session already passed: create a manual handoff in the vault summarizing what was discussed
Likely cause: An old memory in the vault still has incorrect information.
What to do:
- Open Memory Vault
- Search for the outdated term
- Edit or delete the old entry
- Create a new entry with correct information
Likely cause: Many sessions without recent compaction.
What to do:
- Check whether the dashboard has been open recently (automatic compaction needs an active dashboard)
- Force compaction:
curl -X POST http://localhost:3000/api/memory/compact - Or review manually: delete old handoffs, merge similar lessons
- Completed tasks (
[x]) can be deleted — they are no longer injected but clutter the UI
Likely cause: The file is too long and exceeds the 2,000-token budget.
What to do:
- Review
_project.mdand remove information not relevant to all agents - Move agent-specific context to that agent’s vault
- Keep the file under ~500 words (~2,000 characters)
Likely cause: The index may be stale after manual filesystem edits.
What to do:
- Force compaction (rebuilds index):
curl -X POST http://localhost:3000/api/memory/compact - Ensure entries use consistent vocabulary — BM25 is sensitive to exact words
- Files and images sent in the conversation
- Sessions closed without × — closing the tab or browser saves the checkpoint via
sendBeacon, but does not generate a handoff - Tool call content — if the agent used a tool, the tool result is not extracted as memory
- Internal messages — messages marked
internal(system-generated) are not saved in checkpoints or used for handoffs
The agent is not remembering something important — what do I do?
Open Memory Vault (🧠), go to the right category, and add the entry manually. It will be injected on the next session if relevant to BM25, or always if it is a handoff or open task.
Can I wipe everything and start fresh?
Yes — delete entries via Memory Vault. _project.md can be edited as plain text. Checkpoints live under .memory/.vault/checkpoints/ and can be deleted manually.
Does one agent’s memory affect other agents?
Not directly. Each agent has an isolated vault. The only shared memory is _project.md.
How do I know what the agent will get next session?
The agent receives: latest handoff + decisions/lessons relevant to your command + all open tasks + _project.md. You can inspect those entries in Memory Vault before starting the conversation.
How many handoffs are kept?
Only the most recent handoff is injected into context. Older handoffs remain in the vault for reference but are not injected automatically — unless relevant in BM25 search.
Can compaction lose important information?
Compaction tries to extract decisions and lessons from removed messages using pattern matching. For truly critical information, record it manually in the vault — the most reliable way to ensure the agent remembers.
What if the dashboard stays closed for a long time?
Checkpoints expire after 7 days. Vault memories (decisions, lessons, handoffs, tasks, projects) persist indefinitely. Compaction only runs while the dashboard is open — after long idle periods, the first open may trigger a heavier compaction.
Can I edit _project.md directly in a text editor?
Yes. The file is at .memory/_project.md as plain markdown. Changes apply on the next session for any agent.