Repo-scoped Shellbrain CLI with explicit evidence-backed writes.
Project description
Building a Brain
shellbrain is a repo-scoped long-term context system for agent sessions.
Think of it as a case-based memory system with two layers:
- durable memories:
problemsolutionfailed_tacticfactpreferencechange
- episodic evidence:
- transcript-derived
episode_eventrecords that ground writes
- transcript-derived
It exposes four agent-facing operations:
readrecalls durable memories related to the current problem or subproblemeventsinspects recent episodic evidencecreateadds new durable Shellbrain entries with explicitevidence_refsupdaterecords utility, links, and lifecycle changes on existing entries
Install Once Per Machine
Treat shellbrain as a machine-level CLI, not a per-repo dependency. The normal product path is a one-time global install, then shellbrain init from any repo you want to register.
Preferred install with pipx:
pipx install shellbrain
Secondary install path:
python3 -m pip install shellbrain
Editable installs remain a development/operator path and are intentionally omitted from the normal user-facing flow.
Bootstrap
From the repo you are working in:
shellbrain init
shellbrain admin doctor
shellbrain init is the normal bootstrap and repair path. In the managed-local happy path it owns Docker, Postgres provisioning, migrations, grants, embedding prewarm, repo registration, and Claude integration when eligible.
Claude integration is conservative. Shellbrain installs the repo-local Claude hook automatically only when the repo looks Claude-managed and init is running with a real Claude runtime signal. Otherwise it does nothing unless you pass --host claude.
When running Shellbrain from Codex Desktop or a similar tool shell, if direct calls fail in the current session, retry through a login shell first:
zsh -lc 'source ~/.zprofile >/dev/null 2>&1; shellbrain --help'
Then use the same wrapper shape for actual invocations if needed:
zsh -lc "source ~/.zprofile >/dev/null 2>&1; shellbrain read --json '{\"query\":\"Have we seen this migration lock timeout before?\",\"kinds\":[\"problem\",\"solution\",\"failed_tactic\"]}'"
If doctor reports repair_needed, rerun shellbrain init.
Typical Workflow
- Start with focused retrieval queries about the concrete problem, subsystem, constraint, or decision you are working on. Do not start with vague prompts like "what should I know about this repo?"
- Use
readagain during the task whenever the search shifts or a memory might become useful midway through the work. - Before every evidence-bearing write, run
shellbrain events --json '{"limit":10}'so you can inspect concreteepisode_eventids. - At session end, normalize what happened into durable memories:
- the
problem - each
failed_tactic - the
solution - any durable
fact,preference, orchange utility_voteupdates for memories that helped or misled, using a-1.0to1.0scale where negative votes mean unhelpful and positive votes mean helpful
- the
Never invent evidence_refs. If events returns nothing useful or the evidence is ambiguous, skip the write and try again later.
Use --repo-root when your current working directory is not the repo you want to target.
Repo identity is remote-first. Shellbrain prefers the normalized origin fetch URL. If origin is absent but there is exactly one remote, it uses that. If there are multiple remotes and none is origin, init stops and asks for --repo-id. If there is no usable remote, Shellbrain falls back to a weak-local identity tied to the current path.
Backups and Recovery
Shellbrain exposes first-class logical backups:
shellbrain admin backup create
shellbrain admin backup list
shellbrain admin backup verify
shellbrain admin backup restore --target-db shellbrain_restore_001
shellbrain admin doctor
Backups default to $SHELLBRAIN_HOME/backups, which is ~/.shellbrain/backups unless SHELLBRAIN_HOME is set. The Docker bind-mounted Postgres data dir protects against container loss, but it is not a backup strategy by itself.
Advanced / Operator Notes
The normal product path should not require users to think about:
- raw DSNs
- manual
docker compose up - manual
shellbrain admin migrate - editable installs
- manual Claude hook edits
Those topics belong in the advanced/operator guide: docs/external-quickstart.md
More
- Advanced/operator guide:
docs/external-quickstart.md - Session-start skill:
skills/shellbrain-session-start/SKILL.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shellbrain-0.1.0.tar.gz.
File metadata
- Download URL: shellbrain-0.1.0.tar.gz
- Upload date:
- Size: 112.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b13ed52cfa196fc279c147d52b833746edac06f62823e72806fb1fe5255cc44
|
|
| MD5 |
b5414b10c3c289f6a15da79b412c84ca
|
|
| BLAKE2b-256 |
4bebf66e409ee5301eb69aac9126113575938e1b754105933d647aa2da36f63f
|
Provenance
The following attestation bundles were made for shellbrain-0.1.0.tar.gz:
Publisher:
release.yml on cucupac/shellbrain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shellbrain-0.1.0.tar.gz -
Subject digest:
6b13ed52cfa196fc279c147d52b833746edac06f62823e72806fb1fe5255cc44 - Sigstore transparency entry: 1143580222
- Sigstore integration time:
-
Permalink:
cucupac/shellbrain@dabc967728b0aaf27834e71afa0df474b3e644b9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cucupac
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dabc967728b0aaf27834e71afa0df474b3e644b9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file shellbrain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shellbrain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 165.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a19bc6aed6da8ab3ddfb2449aecaaf2e265abc60ae8165ef7a3e737772c6a0f1
|
|
| MD5 |
a3ecef6de8f28157334dd3dc4723702d
|
|
| BLAKE2b-256 |
9471307038980f366fb3248b2f3c6fd04a26ba70b0f71856e83e2386df42997a
|
Provenance
The following attestation bundles were made for shellbrain-0.1.0-py3-none-any.whl:
Publisher:
release.yml on cucupac/shellbrain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shellbrain-0.1.0-py3-none-any.whl -
Subject digest:
a19bc6aed6da8ab3ddfb2449aecaaf2e265abc60ae8165ef7a3e737772c6a0f1 - Sigstore transparency entry: 1143580271
- Sigstore integration time:
-
Permalink:
cucupac/shellbrain@dabc967728b0aaf27834e71afa0df474b3e644b9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/cucupac
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@dabc967728b0aaf27834e71afa0df474b3e644b9 -
Trigger Event:
push
-
Statement type: