The Brain-Agent Loop
The read-write cycle that makes a knowledge base compound over time. Every signal that flows through an agent should touch the wiki in both directions - read before responding, write after learning. An agent without this loop answers from stale context. An agent with it gets smarter every conversation. Source: wiki brain-agent-loop pattern
The Core Loop
Two invariants:
- Every READ improves the response. If you answered a question without checking the wiki first, you gave a worse answer than you could have.
- Every WRITE improves future reads. If a conversation surfaced a new connection and you didn't update the relevant pages, you created a gap that will bite later.
Brain-First Lookup Protocol
Before calling any external API, searching the web, or answering from memory:
qmd search "term"- keyword match, fast, always worksqmd query "what do we know about X"- hybrid semantic searchqmd get <path>- direct page read when you know the slug- External sources as fallback only
The wiki almost always has something relevant. External APIs fill gaps - they don't start from scratch. An agent that reaches for the web before checking its own wiki is wasting tokens and giving worse answers.
Retrieval Routing
Brain-first does not mean one tool for every memory question:
| Question | First retrieval lane |
|---|---|
| What does Kevin already know, prefer, or decide? | qmd / wiki pages |
| What touches what in this repo? | project AGENTS.md repo-graph block + Graphify |
| What did Hermes remember across sessions? | Hindsight, then write back if durable |
| What profile/user model should personalize the answer? | Honcho, then write back if durable |
| What is true inside this project right now? | project AGENTS.md + nearest SKILL.md |
The writeback rule is the unifying invariant: runtime memory may help choose an action, but durable memory is still the wiki, skills, automations, config, logs, and agent docs.
Compiled Truth + Timeline
Every substantial wiki page should have two layers:
Above the line - compiled truth. The current best understanding, rewritten when new evidence changes the picture. If you read only this section, you know the state of play.
Below the line - timeline. Append-only evidence log. Never rewritten, only added to. Each entry has a date, source, and what happened.
The compiled truth is the answer. The timeline is the proof. The synthesis is pre-computed - unlike RAG, where the LLM re-derives knowledge from scratch every query, the wiki has already done the work.
Source Attribution
Every fact written to a wiki page should be traceable. The discipline:
- Inline
[Source: ...]citations with provenance - Source hierarchy: user's direct statements > primary sources > API data > web search
- When sources conflict, note the contradiction - don't silently pick one
This matters at scale. Six months from now, someone reads a page and can trace every claim back to where it came from.
The Compounding Thesis
From gbrain: "Most tools help you find things. A brain makes you smarter over time."
The difference between a folder of notes and a brain:
| Folder of notes | Brain |
|---|---|
| Knowledge re-derived every query | Knowledge compiled once, kept current |
| Cross-references built at query time | Cross-references pre-built |
| Contradictions discovered by accident | Contradictions flagged during ingest |
| Maintenance burden grows faster than value | Maintenance cost is near zero (LLM does it) |
| Human abandons it after 3 months | System compounds because agent handles bookkeeping |
Boil the Lake
"AI-assisted coding makes the marginal cost of completeness near-zero."
When ingesting a source, do the complete thing - update all affected pages, not just the obvious one. A single source typically touches 5-15 pages. The extra effort costs seconds with an LLM. "Ship the shortcut" is legacy thinking from when human time was the bottleneck.
| Task | Human team | AI-assisted | Compression |
|---|---|---|---|
| Cross-reference 15 wiki pages | 2 hours | 2 minutes | ~60x |
| Weekly lint pass | 4 hours | 5 minutes | ~48x |
| Write comparison page from 5 sources | 1 hour | 3 minutes | ~20x |
Three Layers of Knowledge
From gstack's Search Before Building ethos:
- Tried and true - standard patterns, battle-tested. The risk isn't that you don't know them - it's assuming the obvious answer is right without checking.
- New and popular - current best practices, blog posts, ecosystem trends. Search for these but scrutinize - the crowd can be wrong about new things.
- First principles - original observations from reasoning about the specific problem. The most valuable. The best work both avoids reinventing the wheel (Layer 1) while making brilliant observations that are out of distribution (Layer 3).
Deterministic Collectors
From gbrain Skillpack Section 16: when an LLM keeps failing at a mechanical task despite repeated prompt fixes, stop fighting the LLM. Move the mechanical work to code.
┌─────────────────────────┐ ┌──────────────────────────┐
│ Deterministic Script │────>│ LLM Agent │
│ │ │ │
│ • Pull data from API │ │ • Classify and judge │
│ • Generate URLs/links │ │ • Add commentary │
│ • Track state │ │ • Run wiki enrichment │
│ • Output markdown │ │ • Draft responses │
│ │ │ │
│ CODE - 100% reliable │ │ AI - judgment, context │
└─────────────────────────┘ └──────────────────────────┘
The wiki's scripts/ directory already follows this pattern. Freshness checks, index
building, and linting are deterministic scripts. The LLM handles synthesis, cross-referencing,
and answering questions.
The Dream Cycle
From gbrain: the most important maintenance job runs during downtime. Periodically:
- Sweep recent conversations for entities and concepts mentioned
- Check each against the wiki - create or enrich thin pages
- Fix broken cross-references, stale claims, orphan pages
- Consolidate: ephemeral context becomes durable knowledge
In this wiki, the scripts/check-freshness.ts and weekly lint automation serve this
purpose. The wiki gets smarter between sessions because the maintenance infrastructure
catches what slips through during fast conversations.
The Memex Vision
Vannevar Bush described the memex in 1945: a personal knowledge store with associative trails between documents. Bush's vision was closer to this wiki than to what the web became - private, actively curated, with the connections between documents as valuable as the documents themselves.
The part Bush couldn't solve was maintenance. LLM agents handle that. The wiki stays maintained because the cost of maintenance is near zero. The human's job: curate sources, direct analysis, ask good questions, think about what it all means. The LLM's job: everything else.
Concept Position
| Field | Value |
|---|---|
| Concept family | Brain, memory, and retrieval |
| Concept owned | The read-write cycle that makes a knowledge base compound over time. Every signal that flows through an agent should touch the wiki in both... |
| Category map | Concept System Map |
Timeline
- 2026-07-01 | Concepts category refresh added this page to the Brain, memory, and retrieval family, linked it to Concept System Map, and kept it standalone because it owns this reusable mental model: The read-write cycle that makes a knowledge base compound over time. Every signal that flows through an agent should touch the wiki in both... Source: User request, 2026-07-01