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.1.tar.gz (32.6 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.1-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: living_brain-0.1.1.tar.gz
  • Upload date:
  • Size: 32.6 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.1.tar.gz
Algorithm Hash digest
SHA256 23199ab53b8596f0b41341ae060c1673f2c6d154d1dedd1e3c6fdbd9a3968008
MD5 11384d445005d7872f918b8f3898a162
BLAKE2b-256 953d190aedc3cfb36147a8ac6255dd5a48edf7b1abdefc3e974456d432b66c72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: living_brain-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c8f3c902b4be0c1f72c3577107e7718f3cd3026ebd73b2848e3232abddb4af
MD5 9899449bbcb7e60ea771316b92445400
BLAKE2b-256 ab424f76bbca7c4c13b517b05c64b53798bd7886f71a04da5205d4bb18bfa6c9

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