Context Routing
The level-1 mechanism that makes a file-and-folder AI Second Brain actually retrievable: a
top-level instruction file (CLAUDE.md, or
AGENTS.md for Codex) used as a router, not
just as a system prompt. Alongside "who you are / how you work," it
carries "where things live" rules — if you need
info about X, look in this folder; for quarter-one priorities, look
here — so the agent knows where to go. This matters because an
agent will not, and should not, blind-search your whole
store: doing so wastes time and tokens, and if it isn't told
something lives somewhere, it usually won't find it. Properly routed,
you stop re-explaining yourself; the agent "just knows where to look and
why." The design test is dual: does the routing make sense to you
and to your AI?
Routing also makes the brain tool-agnostic: because
it's plain files, you can duplicate CLAUDE.md →
AGENTS.md (or reference one from the other) and point both
at a shared memory.md, so different harnesses read the same
store. And a router can point at live sources in a fallback
order (project file → wiki → transcripts → the source system) — a brain
that knows where to look and in what order is still a
second brain even when the answer lives outside it. There is no single
proven-best folder layout; what matters is that routing exists and is
legible to both reader and agent.
Claims
- The
CLAUDE.mdis a router, not just a system prompt — it holds "where things live" rules. best practice — context: file-and-folder knowledge stores; routing is the "best" retrieval substrate precisely because the agent won't blind-search, so absent routing the model can't find files it isn't pointed to. - An agent won't (and shouldn't) auto-search your whole store — that wastes time and tokens. observation — a factual constraint that makes routing load-bearing rather than optional.
- Routing must make sense to both you and your AI. principle — durable: a store legible to only one of the two fails; the interface is shared. (This is the Agent-Computer Interface (ACI) reflex aimed at the folder layout.)
- There is no single proven-best folder architecture — only whether routing exists and is legible. observation — honest limitation; don't copy someone's layout as gospel.
- Keep it tool-agnostic: duplicate
CLAUDE.md→AGENTS.md, point both at a sharedmemory.md. best practice — context: switching between agent harnesses; the portable routing is "best" when avoiding lock-in matters. - A router that points at live sources in fallback order is still a second brain. observation — "second brain" is the routing intelligence, not necessarily an ingested copy of the data.
- Classify the request against a compact tag registry, then
emit the exact reference list to load — routing as an explicit plan-time
step, not just a static "where things live" file.
best practice — context: a
large bundled knowledge pack an agent draws on; a second source
(Buildable) matches the prompt against one small
archetype-registry.jsoninstead of reading every archetype file, then writes a reference-loading contract naming the exact files to load. Corroborates "the agent won't blind-search; route it," here with the routing decision computed per request rather than authored once. See Search-Then-Get. - "Claude Code is basically a router" — the whole job of
CLAUDE.mdis to let the agent crawl a multi-wiki store efficiently and land on the right spot without wasting time or tokens. observation — an independent source (Nate Herk) restates the token/time argument as the definition of the harness: the router points across past projects, business context, and multiple wikis so the agent finds the answer without reading everything. For a compiled Compiled Knowledge Base the sameCLAUDE.mdadditionally owns the wiki's structure, ingestion, and lint rules — routing plus the ingest contract.
Related
- AI Second Brain — routing is what makes the plain-files brain retrievable.
- Retrieval Maturity Levels — level 1, and the substrate every higher level still sits on.
- Query-Shaped Storage — routing is the storage-time answer to "how will this be retrieved?"
- Agent-Computer Interface (ACI) — "make it make sense to the AI" is ACI applied to the folder and routing layout, not just tools.
- Decision Log — a routed-to artifact
(
decisions/log.md) inside the L1 layout. - Self-Improving System — the
CLAUDE.mdof "rules" that serves as the framework's consistent reminder is context routing keeping a self-improving system legible. - Distillate: Every Level of a Claude Second Brain Explained
- Distillate: How to
Build a Self-Improving System with Claude Code —
CLAUDE.mdas the "consistent reminder" that enforces the raw/wiki/outputs folder rules. - Distillate: Buildable — A Local, Build-Verified App-Builder Brain for Coding Agents — classify against a compact tag registry, then emit a per-request reference-loading contract; routing computed at plan time over a shipped pack.
- Distillate: Fable 5 +
Karpathy's LLM Wiki is Basically Cheating — "Claude Code is
basically a router"; the
CLAUDE.mdowns structure/ingestion/lint for a compiled wiki. - Distillate: Building Great Agent Skills: The Missing Manual — the same "point, don't inline; the agent loads only what it's pointed to (and may not follow the pointer)" mechanism at the intra-skill scale: a skill's description and its external references are context pointers. See Minimal Skill Surface, Skill Invocation Trigger.
- Compiled Knowledge Base —
the store a wiki-routing
CLAUDE.mdpoints at and compiles into.
Linked from
- Agent Rituals
- AI Second Brain
- Building Great Agent Skills: The Missing Manual
- Capture-Storage-Retrieval Pipeline
- Compiled Knowledge Base
- Context Substrate
- Decision Log
- Dynamic Retrieval
- Evergreen vs Volatile Context
- Every Level of a Claude Second Brain Explained
- Fable 5 + Karpathy's LLM Wiki is Basically Cheating
- Golden Templates
- How AI Agents Search Their Memory — Hybrid Retrieval, in Practice (OpenClaw)
- How to Build a Self-Improving System with Claude Code
- Minimal Skill Surface
- Query-Shaped Storage
- Repo-Local Capability Binding
- Retrieval Maturity Levels
- Search-Then-Get
- Skill Invocation Trigger
- Buildable — A Local, Build-Verified App-Builder Brain for Coding Agents