Skip to main content

Living Brain — agent-native CLI for a markdown-backed personal knowledge and task store.

Project description

brain — Living Second Brain (MVP)

Agent-native CLI for a markdown-backed event store. See CONTEXT.md for the product vision and principles.

This is the MVP covering the two foundational pieces: the capture path + event schema, and the timeline retrieval surface.

Install

uv sync                 # create .venv and install deps
uv pip install -e .     # install the `brain` CLI into the venv
source .venv/bin/activate

Or with pip:

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

Quickstart

brain init ./my-vault               # scaffold a vault
export BRAIN_DIR=./my-vault          # point the CLI at it (or use --vault)

brain add "reviewed the hugentobler essay" --type note --tags research,agents
echo "use ULID for event ids" | brain add --type decision
brain add --file notes/meeting.md --type note

brain timeline --last 7d             # recent events
brain timeline --format md --write   # writes renders/timelines/<range>.md

CLI contract (for agents)

Every command returns a JSON envelope when an agent is detected (--agent flag, or env var: CLAUDECODE, CURSOR_TRACE_ID, COPILOT_AGENT_ENABLED, AIDER_*, OPENCODE). Humans get a clean text view; under the hood it's the same data.

Success envelope

{
  "ok": true,
  "command": "brain add",
  "result": { "...": "command-specific payload" },
  "next_actions": [
    { "command": "brain show <id>", "description": "...",
      "params": { "id": { "value": "01K..." } } }
  ],
  "metrics": { "duration_ms": 34, "cost_usd": 0.0 }
}

Error envelope

{
  "ok": false,
  "command": "brain add",
  "error": { "code": "INVALID_TYPE", "message": "...", "retryable": false },
  "fix": "plain-language suggested fix",
  "next_actions": [ ... ],
  "metrics": { "duration_ms": 3, "cost_usd": 0.0 }
}

Exit codes

  • 0 — success
  • 2 — validation / user error (retryable=false)
  • 3 — transient / retryable error
  • 4 — vault not found / not initialized
  • 1 — unexpected error

Event file shape

vault/
├── events/YYYY/MM/DD/<ulid>-<slug>.md
├── renders/timelines/<range>.md
├── audit/YYYY-MM-DD.jsonl
└── .brain/
    ├── config.toml
    └── cache.sqlite          # derivative, rebuildable with `brain reindex`

An event file:

---
id: 01K...ULID
schema: 1
type: note
created_at: 2026-04-24T14:32:11Z
ingested_at: 2026-04-24T14:32:12Z
source: cli
agent: unknown
tags: [research, agents]
links: []
hash: sha256:...
---

the actual markdown body

Event types (v0)

note · task · decision · fact · link

Add via --type. Classification subagent is deferred; current MVP requires explicit type (or defaults to note).

Development

uv run pytest          # run the test suite
uv run ruff check      # lint
uv run ruff format     # format

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

living_brain-0.1.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

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

living_brain-0.1.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file living_brain-0.1.0.tar.gz.

File metadata

  • Download URL: living_brain-0.1.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for living_brain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1b0757cfea6ba080455164638cf0a9b2aa0e3a841429ae80bc7cda566dabca02
MD5 8cd2b22435a0842cee3f9998c79a83ac
BLAKE2b-256 8a582b3d70fcab658a1557d4eb9fe490180e3bb203ffb78bc5c65ac2f064d200

See more details on using hashes here.

File details

Details for the file living_brain-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: living_brain-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for living_brain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 efae8cafcdc9c570ce677916ea350744821ea013dd6ef668e6ecd6159c343f49
MD5 6c593b89192364734683901bb4627482
BLAKE2b-256 981b59d0789613dfae59d7ae1c8a395e6a1bc7bdc33427af2c48c3f8551bd8bf

See more details on using hashes here.

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