Getting started¶
In five minutes you will create a brain, link a Markdown decision to an external brief, search it offline, watch bf review catch a stale decision when the brief changes, and connect your AI coding agent.
Prerequisites¶
- Linux or macOS
- uv (Python 3.12+)
- Optional UNIX tools for direct JSONL inspection:
ripgrep(rg),jq, and DuckDB
1. Install and initialize a brain¶
No API key, database server, or cloud account is required:
uv tool install brain-framework
bf init ~/brain
cd ~/brain
bf status --format text
Output on a fresh brain:
Brain: brain [HEALTHY]
notes=1 memories=0 loops=0 events=1
If BF_BRAIN is already set
bf checks BF_BRAIN before the current directory. Unset BF_BRAIN or pass --brain ~/brain while trying out a new brain.
bf init creates the 3x3 layout, starter note schemas in schemas/, a smoke test in evals/smoke.py, and the local search cache.
2. Ingest a record and write a linked decision¶
First, ingest a brief from an external tool into the workspace memory source. Every record is checked automatically against the built-in record schema:
bf ingest workspace <<'EOF'
{
"id": "brief",
"title": "Website brief",
"type": "doc",
"text": "Start with one clear product page before signup.",
"created": "2026-11-10T09:00:00Z",
"updated": "2026-11-10T09:00:00Z"
}
EOF
Next, write a decision note in projects/launch.md that cites workspace:brief, then compile and verify the brain:
cat > projects/launch.md <<'EOF'
---
type: project
status: active
created: 2026-11-12
updated: 2026-11-15
tags: [launch, web]
description: Launch one focused product page.
---
# Launch site
## Decision {#decision owner=product}
Ship one product page first ([Website brief](workspace:brief){rel=cites}).
## Next actions
- [ ] Draft the hero copy.
EOF
bf build
bf check --format text
Output:
Check: brain [OK]
notes=2 memories=1 errors=0 warnings=0
3. Search, trace backlinks, and read one section¶
Search offline with bf query, follow backlinks from a source record, and load just the #decision section with bf read:
# Ranked offline search (your curated notes rank ahead of raw records)
bf query "product page" --format text
# Backlinks: see every note that cites workspace:brief
bf query --links-to workspace:brief --format text
# Inspect heading sizes first, then read only the #decision section
bf read projects/launch.md --outline --format text
bf read "projects/launch.md#decision" --format text
Expected search output:
Query (fts5): 2 result(s) for 'product page'
projects/launch.md#decision Launch site [active, 2026-11-15]
Launch site Decision Ship one product page first (Website brief). Next actions [ ] Draft the hero copy.
workspace:brief Website brief [2026-11-10]
Start with one clear product page before signup.
4. Catch a stale decision automatically¶
Now imagine the brief changes five days later. Re-ingest the updated brief and run read-only bf review:
bf ingest workspace <<'EOF'
{
"id": "brief",
"title": "Website brief",
"type": "doc",
"text": "Add a pricing table before signup.",
"created": "2026-11-10T09:00:00Z",
"updated": "2026-11-20T14:00:00Z"
}
EOF
bf review --format text
Output:
Review: brain [STALE (1)]
stale=1 open_tasks=1
REF REASONS DETAIL
projects/launch.md newer_evidence newer: workspace:brief
Why this matters
Instead of trusting notes that quietly went out of date months ago, you and your coding agents immediately see which decisions need a fresh look.
5. Connect your AI coding agent¶
Brain Framework works with Claude Code, Codex, GitHub Copilot, Antigravity, Gemini CLI, OpenCode, and any terminal agent without running an MCP server.
bf uses zero global config and finds your brain in a predictable order: --brain PATH, then BF_BRAIN, then the nearest parent bf.yaml, and finally ~/brain.
- Inside your brain folder: Coding agents read the folder's
AGENTS.md, check health withbf status, edit Markdown directly, and verify withbf buildandbf check. - From any other repository: Export
BF_BRAIN="$HOME/brain"(or keep your brain at~/brain) and install the/bfskill:
# Fetch the skill pinned to your installed bf release tag (recommended)
curl -fsSL --create-dirs -o ~/.agents/skills/bf/SKILL.md \
"https://raw.githubusercontent.com/fmind/brain-framework/refs/tags/v$(bf --version)/skills/bf/SKILL.md"
# Or install via the skills CLI
npx skills add fmind/brain-framework --skill bf
Next steps¶
- Authoring: Organize flat notes and folder bundles, use frontmatter and typed links, and add optional schemas.
- Retrieval: Master filters, backlinks, section reads, and direct
rg,jq, and DuckDB queries. - Loops: Write a sensor script, wire event-driven triggers, and run live daemons and always-on agents.
- Operations: Supervise loops 24/7 with
bf watch, control live runs, upgrade versions, and recover state. - Security: Review per-loop secret allowlists, filesystem confinement, untrusted-evidence rules, and hard limits.
- Example brain: Explore a complete runnable offline brain with notes, loops, optional schemas, and evals.