Minibrain is a minimal AI helper with a distinct personality, built around a small agentic loop in Go.
- Keep the core loop tiny and understandable
- Make it easy to iterate on prompting and actions
- Leave a clean path to a TUI later
From source (recommended):
git clone https://github.com/chrishannah/minibrain.git
cd minibrain
go install ./cmd/minibrainEnsure your GOBIN (or GOPATH/bin) is on your PATH:
export PATH="$PATH:$(go env GOPATH)/bin"Or install directly:
go install github.com/chrishannah/minibrain/cmd/minibrain@latestexport OPENAI_API_KEY=...
# optional: export OPENAI_MODEL=gpt-4.1
# optional: export MINIBRAIN_HOME=~/.minibrain
# optional: export MINIBRAIN_ALLOW_READ=1 # allow reading mentioned files by default
# optional: export MINIBRAIN_ALLOW_WRITE=1 # allow applying writes/deletes by default
minibrainexport OPENAI_API_KEY=...
# optional: export OPENAI_MODEL=gpt-4.1
# optional: export MINIBRAIN_HOME=~/.minibrain
# optional: export MINIBRAIN_ALLOW_READ=1
# optional: export MINIBRAIN_ALLOW_WRITE=1
minibrain -cli "I want you to build X" @docs/plan.mdDefault location: ~/.minibrain (override with MINIBRAIN_HOME).
MINIBRAIN.md: core config/initial prompt glueSOUL.md: personality traits and operating stylecortex/NEO.md: long-term memory (durable facts, constraints, preferences)cortex/PREFRONTAL.md: short-term memory (session context, condensed when large)cortex/CONTEXT.md: rolling conversation summaryconfig.json: user-level config (supportsopenai_api_key,model)
On startup, missing files are created automatically. Repo defaults are used only if present; otherwise built-in defaults are used.
File contents are only read when the user approves.
- In TUI: when a prompt includes
@file, approve with/yes(session) or/always(persist), or deny with/no(session). - In CLI: set
MINIBRAIN_ALLOW_READ=1to allow reading. - Persistent decisions are stored in
.minibrain/config.jsonat the project root.
Writes and deletes require approval unless allowed:
/applyapply changes and allow writes for this session/apply-alwaysalways apply changes (persist)/denydeny writes for this session/deny-alwaysalways deny changes (persist)- CLI: set
MINIBRAIN_ALLOW_WRITE=1to auto-apply Patches (PATCH) follow the same approval flow.
/helpshow commands/clearclear short-term memory/condensecondense short-term memory/retryretry last prompt/modelshow or set model/usageshow memory and token usage/actionstoggle action log
- Messages are left-aligned; prompts are prefixed with
>and use a secondary color. - "Thinking/plan" lines are rendered in a secondary color when detected.
- Conversation text is constrained to ~80% of the width.
- Streaming responses are rendered as they arrive.
- Status bar includes an estimated context token budget.
cmd/minibrain/: CLI + TUI entrypointinternal/agent/: core loop, memory, mentions, writesinternal/llm/: OpenAI API integration
- Loads long-term memory from
cortex/NEO.md. - Loads core config from
MINIBRAIN.mdand personality fromSOUL.md. - Provides a relevant file shortlist to the model (based on prompt).
- Includes recent short-term memory context and a rolling conversation summary.
- Loads file contents only when explicitly mentioned and approved.
- Short-term memory persists across runs and is condensed when large or on request.
- Calls OpenAI Responses API, then optionally writes files if the model emits
WRITE,EDIT,DELETE, orPATCHinstructions.
Apache-2.0. See LICENSE and NOTICE.
