Skip to main content

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:
    • problem
    • solution
    • failed_tactic
    • fact
    • preference
    • change
  • episodic evidence:
    • transcript-derived episode_event records that ground writes

It exposes four agent-facing operations:

  • read recalls durable memories related to the current problem or subproblem
  • events inspects recent episodic evidence
  • create adds new durable Shellbrain entries with explicit evidence_refs
  • update records 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

  1. 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?"
  2. Use read again during the task whenever the search shifts or a memory might become useful midway through the work.
  3. Before every evidence-bearing write, run shellbrain events --json '{"limit":10}' so you can inspect concrete episode_event ids.
  4. At session end, normalize what happened into durable memories:
    • the problem
    • each failed_tactic
    • the solution
    • any durable fact, preference, or change
    • utility_vote updates for memories that helped or misled, using a -1.0 to 1.0 scale where negative votes mean unhelpful and positive votes mean helpful

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shellbrain-0.1.0.tar.gz (112.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shellbrain-0.1.0-py3-none-any.whl (165.8 kB view details)

Uploaded Python 3

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

Hashes for shellbrain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6b13ed52cfa196fc279c147d52b833746edac06f62823e72806fb1fe5255cc44
MD5 b5414b10c3c289f6a15da79b412c84ca
BLAKE2b-256 4bebf66e409ee5301eb69aac9126113575938e1b754105933d647aa2da36f63f

See more details on using hashes here.

Provenance

The following attestation bundles were made for shellbrain-0.1.0.tar.gz:

Publisher: release.yml on cucupac/shellbrain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for shellbrain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a19bc6aed6da8ab3ddfb2449aecaaf2e265abc60ae8165ef7a3e737772c6a0f1
MD5 a3ecef6de8f28157334dd3dc4723702d
BLAKE2b-256 9471307038980f366fb3248b2f3c6fd04a26ba70b0f71856e83e2386df42997a

See more details on using hashes here.

Provenance

The following attestation bundles were made for shellbrain-0.1.0-py3-none-any.whl:

Publisher: release.yml on cucupac/shellbrain

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page