Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .brain/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Machine-local lock files, recreated on demand.
*.lock
52 changes: 52 additions & 0 deletions .brain/brain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# brAIn configuration
#
# Every setting below is shown at its built-in default and commented out.
# Uncomment a line to override it. Deleting this file is safe — brAIn runs
# on the defaults with no config at all.
#
# Precedence, lowest to highest: built-in defaults, this file, environment
# variables. Run "brain config" to see where each value is coming from.

# Storage backend. Only "markdown" is available today; "pg" is planned.
# Override with $BRAIN_STORAGE.
# storage: markdown

# PostgreSQL connection, used only when storage is "pg".
# Override with $BRAIN_DATABASE_URL.
# database:
# url: postgres://brain:secret@localhost:5432/brain_dev

# Embedding model for semantic recall, used only when storage is "pg".
# Providers: openai, anthropic, ollama.
# Override with $BRAIN_EMBEDDING_PROVIDER and $BRAIN_EMBEDDING_MODEL.
# embeddings:
# provider: openai
# model: text-embedding-3-small

# Trust ladder: clean outcomes needed to climb each rung. The counter resets
# to zero at every promotion, so these are per-level, not cumulative.
#
# These gate the edges BETWEEN levels, not the levels themselves. Raising a
# threshold does not demote a domain that is already past it — a domain at
# auto_ship stays there no matter what you set promote_to_notify to. Use
# "brain trust override" to move a domain down deliberately.
# trust:
# promote_to_notify: 10
# promote_to_auto_ship: 30
# promote_to_full_auto: 100
# # Total to reach full_auto: 140

# How long a fact stays fresh. Stamped onto each fact when it is written,
# so changing this affects new facts only — facts already on disk keep the
# expiry they were created with.
# facts:
# stale_after_days: 30

# Clean-outcome streak at which a lesson retires. A lesson can override
# this with its own retire_after frontmatter field.
#
# Retirement is permanent. Raising this does nothing for lessons the old,
# lower value already retired. Lowering it can retire several lessons at once
# on the next clean outcome.
# lessons:
# retire_after_streak: 20
Empty file added .brain/corrections/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: correction
domain: workflow
created: 2026-09-18T08:16:52.051511Z
source: human
---
No AI or Claude attribution in commit messages
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: correction
domain: workflow
created: 2026-09-18T08:16:52.054917Z
source: human
---
No placeholders or stubs — if a piece is unbuildable, surface it in the pitch scope rather than faking it
Empty file added .brain/decisions/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: cli
created: 2026-09-18T08:16:43.927566Z
source: human
---
brAIn prints editor configuration and never writes it; merging into a settings file the user owns is not a memory tool's job
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: workflow
created: 2026-09-18T08:16:43.917673Z
source: human
---
Commits follow conventional commit types with imperative subjects of 72 characters or less
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: config
created: 2026-09-18T08:16:43.910867Z
source: human
---
Configuration resolves built-in defaults first, then brain.yml, then BRAIN_* environment variables
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: workflow
created: 2026-09-18T08:16:43.914258Z
source: human
---
Design docs, pitches, and decisions live in .doc/, which is gitignored and stays out of the public repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: workflow
created: 2026-09-18T08:16:43.920987Z
source: human
---
Docs-only changes land on main directly; anything touching code goes through a branch and a PR
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: storage
created: 2026-09-18T08:16:43.93096Z
source: human
---
Effectiveness files carry no title heading — the display title is derived from persona and domain so there is only one copy of it
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: architecture
created: 2026-09-18T08:16:43.899489Z
source: human
---
Go, compiled to a single static binary with minimal dependencies, so installing brAIn is downloading one file
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: storage
created: 2026-09-18T08:16:43.903653Z
source: human
---
Markdown files are the default store; PostgreSQL with pgvector is an optional upgrade and never a requirement
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: config
created: 2026-09-18T08:16:43.907156Z
source: human
---
Trust, fact, and lesson thresholds are settable only in brain.yml, never by environment variable — a threshold set by an invisible variable is a trust ladder nobody can audit
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: decision
domain: trust
created: 2026-09-18T08:16:43.924238Z
source: human
---
Trust promotion is evaluated only inside Record on a clean outcome — loading trust state never promotes, so reads never become locked writes
Empty file added .brain/effectiveness/.gitkeep
Empty file.
Empty file added .brain/facts/.gitkeep
Empty file.
Empty file added .brain/lessons/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: lesson
domain: cli
created: 2026-09-18T08:16:52.036925Z
source: human
---
A session-start hook that exits non-zero blocks the session, and brain recall exits 2 on an empty store — every hook consumer must absorb both
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: lesson
domain: docs
created: 2026-09-18T08:16:52.040788Z
source: human
---
Definition-doc examples drift from the CLI: 06-mcp-and-cli documents brain recall --for council, a flag that never existed. Verify every command in a template against the real command tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: lesson
domain: cli
created: 2026-09-18T08:16:52.048041Z
source: human
---
git carries files, not directories: an empty layer directory vanishes from a clone unless something occupies it
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layer: lesson
domain: engine
created: 2026-09-18T08:16:52.044478Z
source: human
---
Prescriptive rules read like corrections but behave like lessons — filing one as a correction makes it permanent and impossible to retire
Empty file added .brain/trust/.gitkeep
Empty file.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Not a vector database. Not a knowledge graph. Not an AI memory product. The ligh

## Status

Pre-alpha. The memory engine, CLI, MCP server, trust ladder, effectiveness tracking, and configuration are implemented. The PostgreSQL adapter and editor integrations are coming in future pitches.
Pre-alpha. The memory engine, CLI, MCP server, trust ladder, effectiveness tracking, configuration, and editor integration are implemented. The PostgreSQL adapter is coming in a future pitch.

## Install

Expand Down Expand Up @@ -38,6 +38,34 @@ brain config # what's in effect, and where each value came from

Commit `.brain/` to git so your memory travels with the project.

## Editor Setup

Everything above is something you have to remember to run, which is the one
thing memory should not depend on. To make the loop run by itself:

```bash
brain hooks # Claude Code: settings.json block, then CLAUDE.md rules
brain hooks --tool cursor # Cursor: .cursor/rules/brain.mdc
```

brAIn prints; you paste. It never edits your settings, your `CLAUDE.md`, or
anything else you own — merging into a file you have already customised is
not a memory tool's job.

In Claude Code the hook loads your highest-authority memories into every new
session, and again after a `/clear` or a compaction. Compaction is the one
that matters most: it is where a correction gets summarised away and the
model quietly loses the thing it was told not to do.

The rules cover what no hook can. A hook cannot know which domain you are
touching, so per-domain recall, acting on the trust level, and restraint
about what gets written down are all instructions to the model rather than
automation.

Memories are committed, so they travel with the repository. The hook
configuration is per-developer: everyone who clones runs `brain hooks` once
on their own machine.

## Configuration

Everything works with no configuration. To change a default, uncomment the
Expand Down
Loading
Loading