Agent Brain is a local-first, review-gated knowledge runtime for coding agents. It keeps reusable knowledge in ordinary files and Git repositories while separating reviewed facts from unreviewed candidates.
The alpha release is intentionally small: one dependency-free Python CLI, one local pack created by default, explicit promotion and deprecation, semantic federation locks, adapter fingerprints, and a fail-closed session preflight.
Alpha software. Back up important data and inspect commands before adopting it in a production workflow.
Long agent sessions accumulate decisions, corrections, and procedures. Copying all of that into every prompt creates noise; silently treating every note as truth creates risk. Agent Brain provides a narrow lifecycle:
candidate -> inbox -> explicit review -> accepted -> active index
\-> rejected (negative sample)
accepted -> explicit deprecation -> deprecated (preserved, inactive)
Only accepted/ content is an active knowledge source. inbox/, rejected/, and deprecated/ remain outside the active read path.
- Python 3.11 or newer
- Git
- A local filesystem that supports atomic rename
The runtime has no third-party Python dependencies.
python3 -m venv .venv
. .venv/bin/activate
python -m pip install .
brain --helpChoose a new path that does not exist:
brain init --root "$HOME/my-agent-brain" --reviewer example-maintainer
export BRAIN_ROOT="$HOME/my-agent-brain"
brain lintinit creates brain-core plus a brain-general Git repository. The general pack is local-only: it has no remote and receives a blocking pre-push hook. Initialization does not create a commit or configure a remote.
Add the generated adapter file from brain-core/adapters/generated/ to the matching agent configuration location, or adapt its generic instructions to your own tool.
At session start:
brain preflightPreflight validates the semantic lock and refreshes only the short-lived session marker. It never accepts drift. When an intentional pack commit changes the lock input, run the explicit reconciliation command:
brain session-checkPlace a candidate in the matching inbox/*-candidates/ directory, then run:
brain dedupe-check /absolute/path/to/candidate.md
brain review accept /absolute/path/to/candidate.md
brain index
brain syncThe reviewer recorded in MANIFEST.yaml is written into accepted frontmatter. Review is a local policy gate, not identity verification or cryptographic approval.
The public surface is:
init,sync,lint,preflight,session-checkindex,adapter-buildreview,dedupe-check,deprecate,stale
See command contracts, the configuration grammar, and the privacy and threat model.
Agent Brain does not provide cloud sync, encryption, authentication, autonomous fact verification, prompt-injection isolation, semantic vector search, or multi-user authorization. A local-only hook is defense in depth, not a substitute for careful remote configuration and filesystem permissions.
python -m unittest discover -s tests -v
python scripts/public_release_gate.py --repo .The maintainer's release process adds private deny rules outside the repository and scans the worktree, staged snapshot, reachable Git history, and Git metadata before publication.
Apache License 2.0. See LICENSE.