Repository navigation
feat(memory): make effectiveness ranking and three fields reachable - #3
Merged
Merged
Conversation
confidence was written on every correction from brain trust override, always as "high", and read by nothing — not ranking, not recall, not the MCP tools. A field set to one constant that nothing consumes carries no information. source: refresh was documented as one of three sources and appeared in no code path at all. - Frontmatter parsing ignores unknown keys, so corrections already carrying "confidence:" keep loading; nothing to migrate - Also picks up pre-existing gofmt alignment drift in the edited struct
RecallOptions.UseEffectiveness was never set true by anything, so the persona ranking 01-06 built ran in no process brAIn ships. The option is deleted rather than exposed: 01-06 settled that effectiveness surfaces the same way for everyone, and a flag would reopen that. Scores are per-domain, so a recall naming no domain loads nothing and the session-start hook's path is untouched. Two validations ride along, sharing the same test file: - A persona that is not a lower-kebab-case slug is rejected. It would otherwise store fine and then never match a score — a silent failure. - A supersedes path that does not resolve is rejected before anything is written. Previously the memory was written with a warning, leaving the old decision live and the new one claiming to have replaced it: two active decisions contradicting each other over a typo.
Three fields the data model defines and no interface could write. brain remember set domain, layer and tags; the model defines twelve. --persona is what makes effectiveness ranking mean anything, since nothing else could attribute a memory to a reviewer. - revisit_if surfaces in recall --json, recall text, and the session-start injection. The rules brAIn ships tell a model to reopen a decision when its condition is met, and models read the text — a field the reader cannot see is a field that does not exist. - --supersedes retires the memory it replaces; a path that does not resolve exits 3 with nothing written - An end-to-end test drives the loop through the CLI: track outcomes, attribute memories, watch the overridden persona's newer lesson sink
An AI tool writing through MCP had strictly less reach than a shell: no persona, no revisit condition, no supersession. Anything it cannot set is, for it, a field that does not exist. - brain_remember accepts persona, revisit_if and supersedes; validation is inherited from the engine, so neither interface duplicates the rule - brain_recall returns revisit_if so a tool can read back what it wrote - Corrects the brain_track description, which referenced an option that no longer exists
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
brAIn had built capability it never gave anyone a handle on: effectiveness ranking
that nothing could switch on, and data-model fields that no interface could write.
This connects them, and removes two fields that were decoration.
Pitch
.doc/pitches/02-05-ranking-and-fields.md— local only, since.doc/stays out ofthe public repo.
Changes
Engine
RecallOptions.UseEffectivenessdeleted; every domain-scoped recall ranks onpersona acceptance rates. Scores are per-domain, so a recall naming no domain
loads nothing
silently never matched
supersedespath that does not resolve is rejected before anything is writtenCLI
brain remembergains--persona,--revisit-ifand--supersedesrevisit_ifsurfaces inrecall --json,recalltext, and the session-startinjection
MCP
brain_rememberacceptspersona,revisit_ifandsupersedesbrain_recallreturnsrevisit_ifData model
confidenceandsource: refreshremovedArchitecture Highlights
effectiveness "surfaces in recall results the same way for everyone"; adding a flag
would reopen a closed question, and a capability nothing can switch on is what this
replaced.
--personais what makes the ranking mean anything. Found while building, notwhile auditing:
ranking.go:95scores onPersona, and onlybrain trackeverwrote that field. Switching ranking on without this reorders nothing.
duplicating it.
confidenceremoval is safe because frontmatter parsing is lenient — and thatsame leniency means a hand-written
confidence:now silently does nothing. Chosenknowingly; brAIn is pre-alpha and the alternative is keeping a field alive so that
setting it can appear to work.
Breaking Changes
supersedeswith an unresolvable path now errors instead of warning. Itpreviously wrote the memory and attached a warning, leaving the superseded decision
live and the replacement claiming to have replaced it. Anything relying on
write-anyway behaviour now gets exit 3 and no write.
Memories attributed to a persona with a high acceptance rate now rank above newer
memories from a persona with a low one. Domains with no outcomes are unaffected.
New corrections no longer carry
confidence: high. Existing files that have it keeploading unchanged.
Test Plan
to each, confirm the overridden persona's newer lesson ranks below the
accepted persona's older one — mutation-verified by stripping the assignment
path is unchanged
revisit_ifreaches all four readers: frontmatter,recall --json,recalltext, session-start injection; and no empty line when unset
--supersedesretires the replaced decision; an unresolvable path exits 3 withnothing written
confidence:field loads without errorgo test ./...standalone, verified ina separate worktree
make cipasses; coverageinternal/cmd83.8%,internal/engine87.5%,internal/mcp89.3%,internal/memory62.5%Follow-ups
StaleAfteris still unreachable, and it is the same class of bug.engine.go:142documents caller-set staleness as a feature — "including one alreadyin the past, which is how a memory can be written pre-expired" — and no interface can
set it. The audit that opened this pitch found two such fields and missed this one; a
sweep for the class would beat another hunt for instances.
(
ranking.go:90), so they tie and fall through to recency.--personais accepted on every layer, including facts.