Skip to content

Commit e6f72c5

Browse files
committed
docs
1 parent fa4fd72 commit e6f72c5

45 files changed

Lines changed: 2091 additions & 2062 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ Additional instructions for working in this specific project:
55
* @docs/*.md
66
* `python -m pytest ...` for targeted verification
77
* `ruff [format]` for linting / style enforcement
8-
* `gmake test docs` for Markdown style verification (<1s)
9-
* `gmake test` for unit tests (takes ~10)
10-
* `gmake test integration` for unit+integration tests (~20s)
11-
* `gmake test-all` for full suite (~2m)
8+
* `gmake test` for comprehensive basic checks - docs, lint, unit (takes ~12)
9+
* `gmake test integration` for unit+integration tests (~40s)
10+
* `gmake test-all` for full suite, incl. e2e smoke tests (~2m)
1211
* This is a new, unpublished, unsupported project. The author is the only
1312
contributor, and isn't even a user yet. As such, when making changes:
1413
* Never keep old naming, docs, functionality, specs, or expectations as

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ ifeq ($(INTEGRATION),1)
8383
PYTEST_INTEGRATION_ENV := BRAIN_RUN_INTEGRATION_REAL=1
8484
endif
8585

86-
.PHONY: all deps deps-upgrade switch-python clean check format test test-only test-all docs up down ps app-up app-down app-down-all o11y-up o11y-down stack-up stack-down integration outline smoke smoke-only smoke-e2e smoke-docker
86+
.PHONY: all deps deps-upgrade switch-python clean check format test test-only test-all docs docs-check up down ps app-up app-down app-down-all o11y-up o11y-down stack-up stack-down integration outline smoke smoke-only smoke-e2e smoke-docker
8787

8888
define run_gate
8989
@set +e; \
@@ -138,17 +138,20 @@ check:
138138
format:
139139
$(PY) -m ruff format .
140140

141+
docs-check:
142+
$(call run_gate,Documentation Conventions,$(PY) scripts/check_documentation_conventions.py --check)
143+
141144
ifneq (,$(and $(filter test,$(MAKECMDGOALS)),$(filter docs,$(MAKECMDGOALS))))
142145
test:
143146
@:
144147
else
145-
test: check test-only
148+
test: docs-check check test-only
146149
endif
147150

148151
test-only:
149152
$(call run_gate,$(if $(filter 1,$(INTEGRATION)),Pytest (unit + integration),Pytest (unit)),$(PYTEST_INTEGRATION_ENV) $(PY) -m pytest --quiet tests resources services actors)
150153

151-
test-all: check
154+
test-all: docs-check check
152155
$(MAKE) test-only integration
153156
$(MAKE) smoke-only
154157
$(MAKE) smoke-e2e
@@ -168,7 +171,7 @@ smoke-e2e:
168171
smoke-docker:
169172
$(call run_gate,Smoke Docker,$(PY) scripts/smoke_docker_turn.py)
170173

171-
smoke: check smoke-only
174+
smoke: docs-check check smoke-only
172175

173176
smoke-only:
174177
$(call run_gate,Pytest Smoke,$(PY) -m pytest --quiet \
@@ -178,8 +181,7 @@ smoke-only:
178181
tests/integration/test_agent_e2e_smoke.py)
179182

180183
ifneq (,$(and $(filter test,$(MAKECMDGOALS)),$(filter docs,$(MAKECMDGOALS))))
181-
docs:
182-
$(call run_gate,Documentation Conventions,$(PY) scripts/check_documentation_conventions.py --check)
184+
docs: docs-check
183185
else
184186
docs: $(GLOSSARY_DOC) $(SERVICE_API_DOC) $(HTTP_API_DOC) $(OP_DOC) $(DIAGRAM_PNGS)
185187
endif

README.md

Lines changed: 95 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ turns it into durable memory, and takes (or proposes) bounded action on your
44
behalf.
55

66
More academically, it's an exocortex for attention, memory, and action:
7-
Cognitive infrastructure that prioritizes context, directs intent deliberately,
7+
cognitive infrastructure that prioritizes context, directs intent deliberately,
88
and closes loops.
99

1010
***NOTE:** This project is still in active development and somewhat unstable.
@@ -20,14 +20,12 @@ Don't @ me, bro.*
2020

2121
------------------------------------------------------------------------
2222
## Motivation
23-
I wanted a Siri that didn't suck; a real Jarvis. A local-first,
24-
privacy respecting, security forward, personal virtual assistant.
23+
I wanted a Siri that didn't suck; a real Jarvis.
2524

2625
My initial use case was to manage commitments: to look across messages, email,
27-
meetings, and calendars, and not just build up a todo list, but to actually
28-
capture the essence, impact, effort, and timeline of obligations and then
29-
support and facilitate timely action towards them, but without abusing my
30-
limited attention span. Think:
26+
meetings, etc. and not just build up a todo list, but actually capture the
27+
essence, impact, effort, and timeline of obligations and then facilitate timely
28+
action without abusing my limited attention span. Think:
3129

3230
> Hey boss, I know we have that project meeting next Thursday but I don't think
3331
> we've prepped yet - tomorrow looks pretty open so I've put a 90 minute focus
@@ -37,107 +35,135 @@ January 1st, 2026, I decided to start an experiment, bolting [PydanticAI] on top
3735
of [Obsidian] and piping communication through [Signal]. What exists now is a
3836
maturation & formalization of that initial prototype, redesigned from the ground
3937
up with crisp boundaries to ensure:
40-
* extensibility
41-
* observability
42-
* transparency
4338
* governance
39+
* transparency
40+
* observability
41+
* extensibility
42+
43+
------------------------------------------------------------------------
44+
## What It Does Today
45+
* Conversational interaction over [Signal] and a local console TUI.
46+
* Read/write your [Obsidian] vault with revision-safe edits, atomic moves, and
47+
trash-aware deletes.
48+
* Semantic vault search using local embeddings and [Qdrant].
49+
* Governed tool execution: every Op is policy-gated and real-world side effects
50+
flow through approval-aware gateways. Every invocation is auditable.
51+
* First-class [MCP] integration for third-party tools, with per-tool effect and
52+
approval classification.
53+
* Commitment capture, miss detection, and timing-aware operator reminders.
54+
* Scheduled and background work via the Worker actor, plus optional Subagent
55+
delegation for focused, budget-bounded subtasks.
56+
* Universal ingestion pipeline: capture &rarr; normalize &rarr; anchor &rarr;
57+
index, for arbitrary content.
58+
59+
See the [Roadmap](docs/roadmap.md) for what's next.
4460

4561
------------------------------------------------------------------------
46-
## Overview
47-
*Conceptually*, Brain has three primary domains:
62+
## Conceptual Model
63+
Brain has three primary domains:
4864
1. A **personal knowledge base**: durable, human-readable, locally-stored
4965
information. At its simplest, this could be a single (if very large) file.
5066
2. A **reasoning engine**: an LLM used to interpret context, propose actions,
5167
explain decisions, and interact with you conversationally.
52-
3. **Ops**: governed functions that interact with the real world (files,
53-
calendars, messaging, etc.) via native APIs or MCP Servers.
68+
3. **Ops**: governed, testable units of action that wrap a single capability
69+
(e.g. "create a calendar event") via native APIs or MCP Servers.
5470

55-
*Operationally*, the system takes advantage of Docker for process isolation. In
56-
an ideal world every process would be containerized, but for various reasons
57-
(security, usability, performance) there are a limited number of services that
58-
need to run directly on your host system:
71+
Internally those domains are organized along two orthogonal axes &mdash; Planes
72+
(what does it own?) and Tiers (who is allowed to talk to whom?).
73+
74+
### Planes
75+
* **State**: owns data
76+
* **Effect**: owns action
77+
* **Reason**: owns coordination
78+
79+
### Tiers
80+
* **3 (Actors)**: operator interaction surface
81+
* **2 (Services)**: internal business logic
82+
* **1 (Resources)**: integrations with the outside world
83+
84+
The Boundaries & Responsibilities diagram is a conceptual map of those axes. It
85+
is not a deployment or data flow diagram and it doesn't describe the full scope
86+
of the project, but it captures how control flow, cohesion, and decoupling are
87+
intended to work. See the full [Boundaries &
88+
Responsibilities](docs/boundaries-and-responsibilities.md) document for details.
89+
90+
![Boundaries & Responsibilities](img/boundaries-and-responsibilities.png)
91+
92+
------------------------------------------------------------------------
93+
## Runtime Topology
94+
Brain uses Docker for process isolation. In an ideal world every process would
95+
be containerized, but for security, usability, and performance reasons a
96+
limited number of services need to run directly on the host:
5997
* [Obsidian] with the [Local REST API] plugin &mdash; *required*
6098
* [Ollama] &mdash; *recommended* for embedding, *optional* for inference
99+
* Companion project [Host MCP Gateway] &mdash; a bridge to localhost APIs;
100+
*optional*
61101

62-
All other services are run in isolation with Docker Compose:
102+
All other services run in isolation under Docker Compose:
63103
* Brain Assistant, built with [PydanticAI]
64104
* Brain Core, which houses all runtime *State*, *Effect*, and *Reason*
65105
Components
66106
* Brain Worker and Subagent, for async/parallel work
67107
* Brain MCP Adapter sidecar, connecting to configured MCP servers
68108
* Secure messaging thanks to [Signal]
69-
* Durable working state and application logs are kept in [Postgres]
70-
* Caching and queueing are handled by [Valkey]
71-
* Vector search for semantic embeddings is powered by [Qdrant]
72-
* Object blobs are stored in [SeaweedFS]
109+
* Durable working state and application logs in [Postgres]
110+
* Caching and queueing handled by [Valkey]
111+
* Vector search for semantic embeddings powered by [Qdrant]
112+
* Object blobs stored in [SeaweedFS]
73113

74114
There is also an optional OpenTelemetry-based observability stack in
75115
`docker-compose.observability.yaml`. It routes Brain traces through an OTel
76116
Collector to self-hosted [Langfuse] (backed by [ClickHouse]) and [Grafana]
77-
([Prometheus], [Loki], [cAdvisor]) as well as the existing [Postgres], [Valkey],
117+
([Prometheus], [Loki], [cAdvisor]), on top of the existing [Postgres], [Valkey],
78118
and [SeaweedFS] services. See [Observability](docs/observability.md) for
79-
connection details, required secrets, environment variables, and startup checks.
119+
connection details, required secrets, environment variables, and startup
120+
checks.
80121

81122
------------------------------------------------------------------------
82-
## Architecture
83-
The most useful way to understand the system structure is the Boundaries &
84-
Responsibilities diagram — a conceptual map of _Tiers_, _Planes_, _Actors_,
85-
_Services_, and _Resources_. It is not a deployment or data flow diagram and it
86-
does not describe the full scope of the project, but it does a good job at
87-
visualizing how I think about control flow, cohesion, and decoupling.
88-
89-
### Planes
90-
* **State**: owns data
91-
* **Effect**: owns action
92-
* **Reason**: owns coordination
93-
94-
### Tiers
95-
* **3 (Actors)**: operator interaction surface
96-
* **2 (Services)**: internal business logic
97-
* **1 (Resources)**: integrations with outside world
98-
99-
See the full [Boundaries &
100-
Responsibilities](docs/boundaries-and-responsibilities.md) document for details.
101-
102-
![Boundaries & Responsibilities](img/boundaries-and-responsibilities.png)
123+
## Quickstart
124+
On macOS, with Docker, Python 3.14, and [Obsidian] + the [Local REST API]
125+
plugin already installed:
126+
```sh
127+
make deps
128+
cp .env.sample .env
129+
mkdir -p ~/.config/brain
130+
for f in config/*.yaml.sample; do
131+
cp "$f" ~/.config/brain/"$(basename "$f" .sample)"
132+
done
133+
# edit ~/.config/brain/secrets.yaml with your API keys, etc.
134+
make up
135+
```
136+
137+
See the [Development Guide](docs/development-guide.md) for full prerequisites,
138+
configuration details, and the test/lint workflow.
103139

104140
------------------------------------------------------------------------
105141
## Key Documentation
106-
- [Manifesto](docs/manifesto.md) &mdash; Design philosophy, first principles,
107-
and architectural invariants.
108-
- [Boundaries & Responsibilities](docs/boundaries-and-responsibilities.md)
109-
&mdash; Tier model, system model, service catalog, and shared infrastructure.
110-
- [Project Layout](docs/project-layout.md) &mdash; Directory structure mapped to
111-
the conceptual model.
112-
- [Glossary](docs/glossary.md) &mdash; Term definitions (generated from YAML).
113-
- [Configuration Reference](docs/configuration.md) &mdash; Config file schema,
114-
environment variable overrides, and per-section key reference.
115-
- [Service API Reference](docs/service-api.md) &mdash; Public API surface
116-
(generated from code).
117-
- [Development Guide](docs/development-guide.md) &mdash; Setup, make targets,
142+
For the full index see the [`docs/`](docs/) directory, but this is where I'd
143+
start as a gentle introduction:
144+
* [Manifesto](docs/manifesto.md) &mdash; Design philosophy and first
145+
principles.
146+
* [Boundaries & Responsibilities](docs/boundaries-and-responsibilities.md)
147+
&mdash; Tier and Plane model, service catalog, and shared infrastructure.
148+
* [Development Guide](docs/development-guide.md) &mdash; Setup, make targets,
118149
testing, and contributor workflows.
119-
- [Roadmap](docs/roadmap.md) &mdash; Phased implementation plan and current
150+
* [Roadmap](docs/roadmap.md) &mdash; Phased implementation plan and current
120151
status.
121152

122153
------------------------------------------------------------------------
123-
## See Also
124-
* [OpenClaw]: Better than Brain in a lot of ways, but wihout privacy, security,
125-
and governance as first-class architectural primitives.
126-
* [Hermes Agent]: Purportedly more dynamic and self-modifying than OpenClaw.
127-
* [Claude Cowork]: An agentic tool, but not long-lived, and largely bound by MCP
154+
## License
155+
Released under the [MIT License](LICENSE.txt).
128156

129-
------------------------------------------------------------------------
130-
## Getting Started
131-
See the [Development Guide](docs/development-guide.md) for prerequisites,
132-
environment setup, and how to build/test.
133157

134158
[Claude Cowork]: https://claude.com/product/cowork
135159
[ClickHouse]: https://clickhouse.com
136160
[Grafana]: https://grafana.com
137161
[Hermes Agent]: https://github.com/NousResearch/hermes-agent
162+
[issues]: https://github.com/cmtonkinson/brain/issues
138163
[Langfuse]: https://langfuse.com
139164
[Local REST API]: https://github.com/coddingtonbear/obsidian-local-rest-api
140165
[Loki]: https://grafana.com/oss/loki/
166+
[MCP]: https://modelcontextprotocol.io
141167
[Obsidian]: https://obsidian.md
142168
[Ollama]: https://ollama.com
143169
[OpenClaw]: https://github.com/openclaw/openclaw
@@ -149,6 +175,7 @@ environment setup, and how to build/test.
149175
[Signal]: https://signal.org
150176
[Valkey]: https://valkey.io
151177
[cAdvisor]: https://github.com/google/cadvisor
178+
[Host MCP Gateway]: https://github.com/cmtonkinson/host-mcp-gateway
152179

153180

154181
------------------------------------------------------------------------

0 commit comments

Comments
 (0)