Repository navigation
fix(cli): make a committed .brain/ faithful and fix two layer misfires - #1
Merged
Merged
Conversation
init told you to commit .brain/, then handed you a directory git could not carry faithfully. Lock files went in — effectiveness/.lock and trust/trust.yml.lock are flock targets holding no memory, so a clone got another machine's runtime state. The empty layer directories stayed out, since git carries files, so "created facts/" was a promise a commit silently broke. init now writes a .gitignore covering *.lock and a .gitkeep in each layer directory. Neither is load-bearing — every write path already creates its own parent — so this only makes a committed .brain/ match the one init reports creating. ensureConfig generalises to ensureFile, keeping the O_EXCL write that stops a second init clobbering a file you edited.
Two misfires, both from signal lists that were too blunt.
"We chose Go over Rust for the CLI" landed in facts, because the only
decision signal for that verb was "chose to" — but the object of a choice
is usually the thing chosen, not an infinitive. Broadened to "chose ",
with "picked " and "went with" alongside the existing "going with".
"Never run migrations without a backup" landed in corrections, because
"never " was a correction signal. It is a lesson: a rule drawn from
something that happened. The layers have opposite lifetimes — a lesson
retires after a clean streak, a correction is permanent and immutable —
so filing one as the other creates a rule that can never be forgotten,
which is the failure brAIn exists to avoid.
Corrections now key on overriding the tool's behaviour ("stop ",
"override", "don't flag", "do not suggest"); bare prohibitions fall
through to lessons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two defects found while running the shipped binary end-to-end:
brain initscaffolds a directory git cannot carry faithfully, and the layer classifier misfiles decisions and lessons.Changes
init — git hygiene
.brain/.gitignorecovering*.lock. Lock files (effectiveness/.lock,trust/trust.yml.lock) are flock targets holding no memory, so committing one shipped another machine's runtime state to everyone who clones..gitkeepin each layer directory. git carries files, not directories, so every empty layer vanished on the way through a commit andcreated facts/was a promise git silently broke.ensureConfiggeneralises toensureFile, keeping the O_EXCL write so a secondinitnever clobbers a file you edited.engine — classification
"We chose Go over Rust for the CLI"filed as a fact. The only decision signal for that verb was"chose to", but the object of a choice is usually the thing chosen. Broadened to"chose ", plus"picked "and"went with"."Never run migrations without a backup"filed as a correction. It is a lesson. Corrections now key on overriding the tool's behaviour ("stop ","override","don't flag","do not suggest"); bare prohibitions fall through to lessons.Architecture Highlights
Corrections and lessons have opposite lifetimes: a lesson retires after a clean streak, a correction is permanent and immutable (
.doc/definition/03-data-model.md). Filing a lesson as a correction creates a rule that can never be forgotten — the failure brAIn exists to avoid — so an ambiguous prohibition now resolves to the layer that can retire.Neither
.gitignorenor.gitkeepis load-bearing: every write path already creates its own parent, and commands work fine against a.brain/missing its empty directories. This only makes a committed.brain/match the oneinitreports creating.Test Plan
.gitignorecovers both lock names, verified through a realgit add -A— lock files unstaged, memory files stagedinitleaves an edited.gitignorealonemake cipasses (build + test + lint, 0 issues)init→ threeremembercalls land indecisions/,lessons/,corrections/