Your project folder is the desk: what you are working on right now, and what a compaction is allowed to summarise away. The brain is the storage closet behind it: durable facts, decisions and gotchas that outlive the conversation, written down once so nobody has to work them out twice.
Source code, config, build output, anything the shipped product needs. Compacted freely.
What was learned, what was decided and why, what bit us. Not in the code, so nothing summarises it away.
./brain/brain serve.
Every entry as a card. Filter by project, type or tag. Add and edit without touching a file.
Every route this server answers, with a link that runs it.
The whole brain as one readable page: every project, every entry, every tag with a count.
The rules that keep it readable, and the mistake each one exists to prevent.
./brain/brain search "build command" # find something
./brain/brain add --scope myproject --type knowledge "Title" "Body"
./brain/brain list --scope myproject # everything about a project
./brain/brain doctor # is this brain healthy?
On Windows use brain\brain.cmd instead. The launcher finds Node by itself,
so it works whether or not Node is on your PATH. Every command takes --json
if something else is reading the output.
| Command | What it does |
|---|---|
add | Write an entry. --title --body --type --tags --scope --source. --body @file reads a long body from a file, which is far easier than escaping quotes in a shell. |
search | Full text across title, tags and body. Combine with --tag, --type, --scope. |
list | Everything, newest first. Same filters, plus --limit N. |
get | One entry in full. |
update | Change any field of an entry. Use this instead of writing a near-duplicate. |
delete | Remove an entry. |
tags | Every tag in use, with counts. Check here before inventing one. |
scopes | The project registry, with entry counts. |
index | Rebuild INDEX.md and index.json. --dry to see what it would write. |
doctor | Check the corpus. Exits non-zero when something is actually wrong. |
serve | Start the HTTP API and this site. --port to move it. |
info | Where this brain lives, its name and its port. |
| Path | What it is |
|---|---|
entries/ | One Markdown file per entry, with a frontmatter block. This is the source of truth. Hand-editable. |
lib/vocab.js | The project registry. Add a project here and run index. This is the only place to register one. |
lib/store.js | Reads and writes entries. Atomic writes, so two agents never corrupt one. |
lib/index.js | Builds the catalogue. |
lib/doctor.js | The health checks. |
lib/config.js | This brain's own port and name, so several brains can run at once. |
ui/ | This homepage, the visualizer and the export page. |
tools/ | normalise.js tidies old entries (dry run by default) and test-normalise.js tests its rules. |
templates/ | Entry templates. They are not entries and do not appear in search. |
INDEX.md, index.json | Generated. Read them, never edit them; brain index rewrites both. |
Four, and the choice matters because it is how a reader decides whether to trust a line.
| Type | Means |
|---|---|
knowledge | A durable fact, established by evidence. |
memory | What happened: a session outcome, current state, an open thread. |
decision | A choice, with the reason. The reason is the part nobody can re-derive. |
note | Everything else. |
The short list. Each of these exists because it was broken once, not because it reads well.
lib/vocab.js and run index, or its entries render with no name or colour.global means workspace-wide. Project facts go under the project, even the internal ones.--scope and --tag agree.templates/. Anything in entries/ is an entry, and will show up as one.doctor before you trust it. It catches what you cannot see by reading: empty titles, unregistered scopes, dangling references.The full rules, with the reason behind each one →
15 rules, the essentials:
--- block with id, type, title, scope.lib/vocab.js, then run index.entries/ or they become phantom entries.update rather than creating near-duplicates.Read the full rules with incidents →
For other tools and webviews. CORS is open and it binds to localhost only.
| Route | Purpose |
|---|---|
GET /api/index | Everything in one object: counts, projects, tag frequencies, every entry. Add ?entries=0 for just the shape. |
GET /api/scopes | The project registry, for building a picker. |
GET /api/entries | List, filtered by type, tag, scope. |
GET /api/entries/:id | One entry. |
POST /api/entries | Create. |
PATCH /api/entries/:id | Update. |
DELETE /api/entries/:id | Delete. |
GET /api/search | Search. |
GET /api/tags | Every tag with a count. |