brainnet

The note network behind brain-ask. Notes are neurons and wikilinks are synapses. A query's vector hits light up a few neurons, and the activation spreads along the links to re-score the results.

A seed note fires every 3 s and the activation leaks along its links. This is personalized PageRank (PPR) in its plainest form.

+22.4%held-out link recall, Wikipedia 5%
0gain on the Brain vault
~66links per node, Wikipedia
~1.5links per note, Brain (rough count)

How it works

  • A node is a note. Its vector is the mean of its chunk vectors.
  • An edge is a wikilink (weight 1). Notes with few links get growth edges to their nearest notes (0.5). Notes that come back together in a brain-ask get a Hebbian bonus (+0.25).
  • Spread: a ← (1−L)a + L·D^-½WD^-½a, then k-winners-take-all, or PPR with α 0.5 for 10 iterations.
  • Score = stimulus + β·activation.

Code

  • newera/tools/brainnet.mojo
  • newera/tools/wikinet.mojo
  • newera/tools/bge.mojo
  • iTools brain/brain-ask

Structure

graph LR
  Q[query] --> V[bge vector]
  V --> S[top-k stimulus]
  S --> N((note graph))
  L[wikilinks] --> N
  G[growth edges] --> N
  H[Hebbian co-recall] --> N
  N --> P[PPR spread]
  P --> R[re-ranked hits]
  R --> A[brain-ask]

Experiments

2026-10-21Wikipedia 5% (177k nodes): vectors 294 → PPR 360KEEP
2026-10-21Wikipedia subset, seed 11: 815 → 907 (+11.3%)KEEP
2026-10-21Brain vault: PPR re-orders 23 of 88 lists and gains 0NOT DEFAULT
2026-11-02HyDE query rewrite: eval 34/59KILLED
2026-11-06CPU spikes: bridge cache + mmap, warm refresh 49 s → 16 s, 8.4 → 5.8 GBOPS FIX
2026-11-17Deduped alias copies: MRR 0.536 → 0.544KEEP
2026-11-22Worktree copies took 76% of hits; folded + excluded: heldout 12 → 20/30KEEP
2026-11-22Code-graph edges (+8,939) and denser PPR: recall unchanged; empty net proves wiringKILLED
2026-11-23Filter before the rank cut: paraphrase 22 → 24/29DEFAULT
2026-11-23Ornith 9B keyword expansion: paraphrase MRR 0.741, heldout 21/30, +330 msDEFAULT

Verdict table: every measured experiment

experimentmeasuredverdict
Wikipedia 5% (177k nodes), held-out links recall@10vectors 294 · k-WTA 289 · PPR 0.5/BETA 2/10 it 360 (+22.4%)KEEP dense graphs
Wikipedia subset, seed 11vectors 815 · k-WTA 816 · PPR 907 (+11.3%)KEEP
Brain vault, 29 paraphrase + 30 heldout (strict)vectors 23/29 + 17/30 · PPR same · reorders 23/88 lists, gains 0NOT DEFAULT
PaperBrain answers (BRAIN_ASK_SHOW=paper), 60-question eval, hub slots in top 5 (scored 30)0 hubs, 3.9 hits shown · 22 hubs · --hub 0.5: 9 hubs, strict 29/30, MRR unchangedADOPTED paper/all
Brain + usage synapses from transcripts (query → opened note, 128), 61 held-out opensvectors 21 · PPR 21, 0 lists moved, shuffle control 21KILLED
openai/math result network (22,438 results), held-out uses, 2 splitsvectors 581 / 594 · PPR 693 / 709 global (same-paper vectors 1,995 / 1,953 beat it) · within the paper 2,200 / 2,210 (+10 to 13%)NO VERDICT IN SOURCE
Result network + cross-paper cosine bridges, cited papers recall@10 (test 91)paper vectors 58 · PPR 68 · best statement pair 79 winsKILLED
Inside the model: kNN-LM on Qwythos-9B, datastore by graph (GP) vs vectors (P), 20 test results, NLLP 2.4288 · GP 2.4356 · LM alone 2.4136 bestKILLED
Brain vault + PaperBrain / Wikipedia 5% / both / co-commit bridges (brainnet bridge)40 in every arm (8 to 21 lists changed, 0 targets moved)KILLED
Wikipedia 20% (1.18M neurons), held-out links recall@10 (8,426)vectors 332 · spread 326 · PPR 375 (+13.0%)ALIVE
Learned synapse weights cos^g deg^-d, 20% Wikipedia, test half (8,527)vectors 335 · PPR 372 · pick 348 (-6.5%)KILLED
Hebbian plasticity (learn, ETA × a_src × a_tgt), 2000 train pairs, 20% Wikipedia test half (8,527)vectors 335 · PPR 372 · ETA 10: 372 (tune flat 82 at every ETA)KILLED
Plasticity sparse (THETA 0.005, ETA 1000): memorise trained pairs / new sources / Brain usage (61)PPR 24 / 24 / top5 16 · 34 (null 24) / 24 / 16, mean rank worseKILLED memory, no transfer
Level 3: local model reorders PPR top 30, hidden Brain wikilinks (2 splits, 637)vectors 183 · PPR 231 · model 273, +42 pooled 95% [20, 70]CONFIRMED brain-link-propose
Brain vault + code-graph edges (8,939 notes sharing a code file) / denser PPR / empty network (falsifier), 2026-11-22recall unchanged in all · empty net moves latency 1.3 → 4.0 s onlyKILLED
Brain vault, filter before the rank cut (dedupe + .coisignore before rank keeps 5), 2026-11-23paraphrase 22 → 24/29 · heldout 20/30 MRR 0.547 (iTools 8ef39d2)DEFAULT
+ Ornith 9B keyword expansion of the query (original kept), 2026-11-23paraphrase 23/29 MRR 0.741 · heldout 21/30 MRR 0.559 · +330 ms (2e3fc3c), default when :8080 upDEFAULT
Brain vault frozen eval, 2026-11-13 (merged store, PPR + MiniLM rerank, default brain-ask)verbatim 29/29 · paraphrase 23/29 · heldout 22/30 strict (was 17/30) · median 1.56 sMEASURED
Same eval 2026-11-15, BRAIN_ASK_NET=0 vs defaultnet off: heldout 21/30, paraphrase MRR .718, distinct files 3.4-4.6, median 682 ms · net on: 22/30, .736, 5.0, 1125 ms · 62/88 lists changedKEEP +1 heldout, file diversity for ~440 ms
Co-touch synapses (Brain notes an agent Read/Edit/Write within 5 touches), 2026-11-15933 pairs, +1116 directed edges on 6.38M · eval identical, 0/88 lists changedKILLED at this density

Sort any column by clicking its header. The page filter (all / pass / miss / pending) at the top also applies to these rows.

Eval over time

paraphrase (of 29)heldout (of 30)gaps = not measured in the sources

    Steps are not one continuous run. The 2026-11-13 heldout 22/30 and the 2026-11-22 "12 → 16/30" baseline come from different store states, so read direction, not exact slope. Gains are 1 to 2 queries on n=30.

    Recall path now

    graph LR
      Q[question] --> X[Ornith keywords]
      X --> B[BM25 + vectors k20]
      B --> F[dedupe + .coisignore]
      F --> R[brainnet rank 5]
      R --> S[shown]
    

    Pipeline: tap a stage

    → → → → →
    stage

    Tap a stage to see what it does, its file and its measured effect.

    Store facts

    1,640,443neurons in the merged store (net-index, 2026-11-13)
    7,382Brain neurons
    1,151PaperBrain neurons
    22,438openai/math result neurons
    1,609,472neurons in 63 text stores (code 1.07M, arxiv 184k)
    5,990,192directed synapses, 19,263 isolated
    7,219,311Wikipedia p10 neurons, 79.4M synapses
    9,900Brain vault notes, 18,234 wikilinks (1.84 per note), 4,334 with no link
    154,441Brain vq2 rows; 104,482 (68%) were worktree copies
    52 · 122 · 2.4 GBnet.bin · net.paths · net.vecs

    Stores: merged $COIOS_DATA/merged (Brain + PaperBrain, rebuilt by refresh.sh); vq2 coios-brain/vq2; Wikipedia newera/.work/wikinet/p10. The older 552k-neuron merged figure (2026-10-30) is superseded.

    Rules

    Commands (all 19)

    groupcommandwhat
    queryask STORE Q.f32 K [BETA] [--ppr A I] [--show TAG] [--eps E]query vector as stimulus (top 20 by cosine); score = stimulus + BETA (2) × PPR activation; brain-ask --net
    queryrank STORE [K] [BETA] [--ppr A I] [--hub G]stdin brainvec hits re-ranked by spread; brain-ask default path
    queryspread STORE K SHOW PATH... [--hub G]PPR 0.5/10 from given neurons; K most activated others; brain-spread
    querypropose STORE NOTE KK best notes NOTE does not link yet; brain-link-propose
    buildbuild STORE VAULT [CUT]vault to net.bin + net.paths (CUT: unix seconds)
    buildgraph STORE EDGES.tsvnet.bin from "U TAB V" path pairs (weight 1, both ways)
    buildbridge A B OUT K MINCOS [--edges F]union of A and B stores; each A neuron wired to its top-K cosine B neurons
    buildknn STORE K MINCOSeach neuron's top-K cosine neighbours in other groups
    buildreweight STORE OUT GAMMA DELTAcopy with w = max(cos,0)^GAMMA × (deg u deg v)^-DELTA
    buildbits STOREnet.bits sign-bit prefilter (48 B a row) that ask scans first
    evalpredict STORE HIDDEN.tsv [BETA] [SOURCES] [--ppr A I] [--same] [--dump F]held-out link recall@10, vectors vs vectors + network
    evalhide STORE OUT PCT SEEDsplit: net.bin minus PCT % of weight-1 synapses; hidden.tsv lists them
    evalhalves HIDDEN.tsv OUTpick / test halves by FNV-1a parity of the source
    evalcites STORE CITES.tsv HALFheld-out group links (citations) recall@10: group vectors, best pair, PPR
    evalreach STORE CASES.tsvhops from candidates to the target per case
    evalcheck STOREGPU only, via tools/brainnet-check.sh STORE [K]
    inspectstats STOREneurons, synapses by kind, categories
    inspectkcore STOREcore numbers: dense planets vs sparse clouds per category
    inspectview STORE OUT.svgthe network drawn, last rank query lit

    B = newera/.work/brainnet/brainnet (build: mojo build -I lib tools/brainnet.mojo). Also: serve STORE SOCK [IDLE_S] keeps the net resident; rank then takes 0.093 s at ~0.5 GB RSS.

    Next

    Density was not the lever on the Brain: misses are words the index never heard. Remaining misses never reach the 20 candidates, so the next lever is first-stage: a stronger embedder (GPU re-embed) or synthetic questions per note.