Citations
Claims in brain files get receipts. Receipts are git-backed.
When an agent writes a lesson or a decision, citations record where the claim came from. The sources ride along in the brain and can be rendered into commit footers, so memory and evidence travel together.
Record a source
const citations = require('./lib/citations');
citations.addSource('abc1234', 'lessons.md#sync-race');
The first argument is the commit hash the claim came from; the second is any context string your convention agrees on (a file, a file and anchor, a note). Recording is lock-protected, so concurrent writers cannot drop each other’s rows.
Render
List everything recorded:
citations.getAll();
Format a single citation:
citations.formatCitation(source);
Get the footer block for a commit message:
citations.getCommitFooter();
Appending that footer to git commit -m puts the evidence trail directly into history, where git blame finds it again.
Verify and clean up
Check citations across the whole brain stack:
citations.getStackCitations();
Verify a commit has been cited (takes a commit hash):
citations.verify('abc1234'); // true when that commit is in the ledger
Clear the current set:
citations.clear();
Relationship to the brain
Citations are metadata about brain content, not a memory system of their own. They live with the claims they support, and pruning the corpus does not silently orphan them: generate a receipts file before a prune if you want a point-in-time record:
citations.generateReceipts();
Related
- Brain Search - the retrieval layer receipts answer for
- The Brain - what receipts ground their claims in
- Memory - the section overview