Memory Governance
Agent Brain is designed for long-lived memory. Without maintenance, the store will accumulate:
- Duplicates
- Outdated decisions
- Contradictions
Governance keeps memory accurate and useful over time. The audit system is the primary tool for this.
Audit scopes
brain_audit accepts a scope parameter that controls what gets analyzed:
| Scope | What it analyzes |
|---|---|
project | Memories within a single project — conflicts, redundancy, and staleness scoped to one codebase |
global | Global memories across all projects — conventions, preferences, and cross-cutting rules |
cross | Cross-project analysis — detects when agents have written contradictory memories in different projects |
Recommended use:
- Run
projectaudits regularly - Run
globalaudits when recall quality starts degrading - Run
crossaudits before major releases or when onboarding a new agent
Finding types
Audit results include one or more findings, each with a type:
| Finding type | What it means | Recommended action |
|---|---|---|
conflict | Two memories contradict each other | Archive the stale one, confirm the current one is accurate |
redundancy | Near-duplicate memories covering the same ground | Merge the content into one memory, archive the other |
staleness | Memory hasn't been accessed and predates a known major change | Review and archive if the information is no longer valid |
gap | A topic is frequently recalled but not well-covered by existing memories | Write a new memory with a clear, durable statement |
skill_conflict | Skills directory contains conflicting instructions (e.g., two skills tell the agent to handle the same trigger differently) | Review the relevant skill files and consolidate |
config_conflict | Config directory has contradictory settings | Review the config files and resolve the conflict |
escalation | A pattern that appears across multiple projects warrants promotion to global scope | Promote to global with brain_remember and archive the project-scoped copies |
Running an audit
Via MCP
brain_audit({ "scope": "project", "project_id": "my-app" })
Via REST
curl -X POST http://localhost:9090/api/v1/memories/audit \
-H 'Content-Type: application/json' \
-d '{"scope": "project", "project_id": "my-app"}'
For a global audit:
curl -X POST http://localhost:9090/api/v1/memories/audit \
-H 'Content-Type: application/json' \
-d '{"scope": "global"}'
The response includes:
- Memory IDs
- Finding types
- Human-readable descriptions
Review findings before taking action. The audit surfaces issues but does not modify memories automatically.
Suppressing a finding
Some flagged conflicts are intentional. For example, two projects may deliberately use different auth patterns, which an audit would flag as a conflict. Suppress the finding by storing an audit_suppression memory:
brain_remember({
"content": "Suppressing conflict finding for memory abc123 — the difference between my-app and legacy-app auth patterns is intentional. my-app uses short-lived JWTs; legacy-app uses session cookies for backwards compatibility.",
"type": "fact",
"tags": ["audit_suppression", "abc123"]
})
On the next audit run:
- Findings referencing
abc123will be skipped - The suppression record remains part of the audit trail
Use this sparingly. Too many suppressions weaken the value of audits.
Merging duplicate memories
When an audit returns a redundancy finding, merge the duplicates via REST:
curl -X POST http://localhost:9090/api/v1/memories/audit/merge \
-H 'Content-Type: application/json' \
-d '{"memory_ids": ["uuid-1", "uuid-2"]}'
The merge operation:
- Combines the content into one record
- Preserves the union of tags
- Archives the source records
Review the merged result with brain_get_by_id to confirm it is coherent.
Importing existing memories
Use the desktop app's Import wizard (Settings → Import) to seed Agent Brain from existing Claude, Gemini, Codex, or Aider memory files. The wizard accepts JSON, YAML, Markdown, and plain text, and shows a preview before committing.
For scripted imports, use the MCP tools:
brain_import— import a structured brainpack or JSON exportbrain_import_foreign— import unstructured memory files from other agents (Claude memory JSONs, Aider chat history, etc.)
Both tools support dry_run: true so you can:
- Preview the import
- Validate the source data
- Avoid unintended writes
Recommended cadence
| Audit type | Recommended frequency |
|---|---|
project audit per active project | Weekly |
global audit | Monthly |
cross audit | Before major releases; when adding a new agent to the fleet |
To keep audits manageable:
- Set a recurring reminder or schedule
- Review findings while they are still fresh
- Avoid letting multiple audit cycles pile up