Overview¶
Brain Framework (bf) turns a plain Git folder of Markdown notes, schema-validated JSONL records, and shell or Python loops into a fast, offline knowledge brain for humans and AI coding agents. Start in 2 minutes with Getting started.
It stays intentionally simple: three formats (YAML for config, Markdown for humans, JSONL for records), a clean 3x3 layout, a disposable SQLite FTS5 cache, three minimal runtime dependencies, and zero built-in LLMs. Flat JSONL stays canonical on disk so bf query, rg, jq, and DuckDB all work side by side.
The 3x3 layout¶
my-brain/
├── bf.yaml # Declarative config (notes, brains, search, concurrency, loops)
├── concepts/ # Durable knowledge (<slug>.md or <slug>/index.md bundles)
├── projects/ # Ongoing initiatives and decisions
├── actions/ # Scoped requests, deliverables, and attachments
├── sensors/ # Deterministic collectors (stdout JSONL -> memories/)
├── routines/ # Maintenance scripts and continuous daemons (when: daemon)
├── agents/ # Coding-harness or LLM tasks
├── schemas/ # Optional domain JSON Schemas (core record schema always enforced)
├── evals/ # User-owned Python/pytest contract checks
├── memories/ # Canonical JSONL (_notes.jsonl + <source>.jsonl; gitignored)
├── logs/ # Private 0700 structured JSONL loop logs (gitignored)
└── .bf/ # Private 0700 runtime: disposable cache/index.sqlite3, state/, locks/
Architecture¶
- Notes (
concepts/,projects/,actions/): YAML 1.2 frontmatter plus CommonMark Markdown, supporting flat<slug>.mdfiles and<slug>/index.mdfolder bundles. Add#idheading anchors, checklist tasks, and typed links ([Ticket](jira:WEB-1){rel=cites}). - Loops (
sensors/,routines/,agents/): Plain shell, Python, or executable scripts declared inbf.yaml. Loops readBF_*env, per-loopenv_from:secrets, and matched JSONL events onstdin; emit data or events onstdout; and log structured JSONL onstderr. - Records (
memories/_notes.jsonl,memories/<source>.jsonl,logs/<loop>.jsonl): Always validated against bundledbfandrecordschemas, with optionalschemas/<source>.jsonfiles for stricter domain checks. Read-only retrieval commands never mutate disk.
How bf compares¶
| Approach | Storage & ownership | Agent interface & retrieval | Automation & trust boundary |
|---|---|---|---|
Brain Framework (bf) |
Plain Git Markdown + canonical JSONL | Read-only CLI, offset-indexed BM25 FTS5, rg/jq/DuckDB |
Explicit loops: with per-loop env_from:, pools, bf watch |
| Plain Markdown / Obsidian | Local Markdown files (human-first) | Filename/grep search; no record schemas or staleness review | Manual upkeep or UI plugins; no structured sensor ingestion |
| Hosted / MCP memory servers | Opaque or remote DB with auto-extracted facts | Always-on MCP tool schemas + model-mediated recall | Extra service/API keys; inferred facts harder to audit in Git |
| Generic vector RAG | Chunked embeddings in a vector index | Semantic similarity over opaque chunks | Requires embedding models/pipelines; weak provenance & backlinks |
Guides¶
| Guide | What you will learn |
|---|---|
| Getting started | Create a brain, ingest records, write a linked decision, compile with bf build, and search with bf query. |
| Authoring | Structure flat notes and index.md bundles, heading #id anchors, universal refs, and optional schemas. |
| Retrieval | Orient with bf status and bf review, read sections with bf read, and search with bf query or DuckDB. |
| Operations | Configure explicit loops:, env_from: allowlists, pools, debounce:, bf watch, and security limits. |
| Reference | Look up every CLI command, exit code, BF_* variable, bf.yaml config, and bundled JSON Schema. |