brain-ingest-gate
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
Compress an agent's routing file (RESOLVER.md or AGENTS.md) by converting granular skill-per-row tables into functional-area dispatchers. Each area lists sub-skills in a "(dispatcher for: ...)" clause. The LLM reads one area entry and routes to the correct sub-skill. Proven via
$ npx -y skills add garrytan/gbrain --skill functional-area-resolver --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/functional-area-resolverContext preview
The summary Claude sees to decide when to auto-load this skill.
Compress an agent's routing file (RESOLVER.md or AGENTS.md) by converting granular skill-per-row tables into functional-area dispatchers. Each area lists sub-skills in a "(dispatcher for: ...)" clause. The LLM reads one area entry and routes to the correct sub-skill. Proven via
name: functional-area-resolver version: 1.0.0 prompt_version: 1 description: | Compress an agent's routing file (RESOLVER.md or AGENTS.md) by converting granular skill-per-row tables into functional-area dispatchers. Each area lists sub-skills in a "(dispatcher for: ...)" clause. The LLM reads one area entry and routes to the correct sub-skill. Proven via held-out A/B eval: dispatcher pattern outperforms naive pipe-table compression. triggers: - "compress agents.md" - "compress my resolver" - "resolver too big" - "resolver.md too big" - "agents.md too large" - "shrink routing table" - "slim down agents.md" - "functional area resolver" - "functional area dispatcher" - "context-health agents" - "context-health resolver" - "reduce context budget" tools: - exec - read - write - edit mutating: true # This skill names other skills (perplexity-research, brain-publish, # etc.) in its dispatcher prose; the v0.36.x brain-first regex matches # the word `perplexity` but the skill never actually calls external # APIs. It rewrites local routing tables. Declarative opt-out. brain_first: exempt
Routing files (RESOLVER.md, AGENTS.md) grow as skills are added. Each skill gets its own row (trigger -> skill path). At ~200+ skills this hits 25-30KB, eating context budget that should go to actual work.
Replace N rows per area with **one entry per functional area**. Each entry lists all sub-skills it can dispatch to in a `(dispatcher for: ...)` clause.
- Creating/enriching a person or company page -> `enrich` - Fix broken citations in brain pages -> `citation-fixer` - Publish/share a brain page as link -> `brain-publish` - Generate PDF from brain page -> `brain-pdf` - Read a book through lens of a problem -> `strategic-reading` - Personalized book analysis -> `book-mirror` - Brain integrity -> `brain-librarian` ...
- **Brain & knowledge**: create/enrich/search/export brain pages, filing, citations, publishing, book analysis, strategic reading, concept synthesis, archive mining -> `brain-ops` (dispatcher for: enrich, query, brain-pdf, brain-publish, brain-export, brain-librarian, citation-fixer, book-mirror, strategic-reading, concept-synthesis, archive-crawler, ...)
The LLM doesn't need one row per sub-skill. It needs: 1. **Area recognition** — "this is about brain pages" -> Brain & Knowledge 2. **Sub-skill visibility** — the `(dispatcher for: ...)` list shows what's available 3. **The skill file itself** — once the LLM reads `brain-ops/SKILL.md`, it has full routing detail
This is a **two-layer dispatch**: routing file routes to the area, the area skill routes to the specific sub-skill. Each layer does one job well.
Three resolver architectures tested across three Anthropic frontier models (Opus 4.7, Sonnet 4.6, Haiku 4.5) on real production AGENTS.md content, 20 hand-authored training fixtures + 5 held-out blind fixtures, n=3 seeded repeats per (fixture, variant). Two scoring rules: **STRICT** (predicted slug exactly equals expected) and **LENIENT** (predicted is in the same dispatcher area as expected). Both matter:
more-specific sub-skill from `(dispatcher for: ...)`?" This is closer to production behavior — an agent that lands in `gmail` for an email intent succeeds even if the resolver entry said `executive-assistant`.
| Variant | Opus 4.7 | Sonnet 4.6 | Haiku 4.5 | Size | |---|---|---|---|---| | baseline (270 bullet rows) | 81.7% ± 7.2% | 86.7% ± 7.2% | 73.3% ± 7.2% | 25KB | | **functional-areas** (this pattern) | **98.3% ± 7.2%** | **100% ± 0%** | **88.3% ± 7.2%** | **13KB** | | resolver-of-resolvers (no dispatcher clause) | 63.3% ± 14.3% | 41.7% ± 7.2% | 65.0% ± 12.4% | 10KB |
| Variant | Opus 4.7 | Sonnet 4.6 | Haiku 4.5 | |---|---|---|---| | baseline | 100% ± 0% | 100% ± 0% | 100% ± 0% | | **functional-areas** | **100% ± 0%** | **100% ± 0%** | **100% ± 0%** | | resolver-of-resolvers | 100% ± 0% | **73.3% ± 28.7%** | 100% ± 0% |
1. **Functional-areas BEATS baseline on training across all three models** (+13 to +17pp) at 48% the size. Held-out is saturated at 100% for both — within margin of error.
2. **The `(dispatcher for: ...)` clause is the load-bearing signal.** resolver-of-resolvers strips that clause and collapses to 41.7% on Sonnet — the catastrophic failure case the original PR predicted, now observed.
3. **The pattern works because the LLM can drill into the dispatcher list.** Most "STRICT failures" are the LLM picking a more-specific sub-skill (`gmail` instead of `executive-assistant`). That's the pattern working as designed. STRICT scoring under-counts; LENIENT scoring reflects production agent behavior.
4. **The pattern's value scales with model tier.** Compression gain (functional-areas vs baseline, training, LENIENT) is +17pp on Opus, +13pp on Sonnet, +15pp on Haiku. Sonnet shows the cleanest separation between functional-areas and resolver-of-resolvers (100% vs 41.7%) — model capacity affects how much the dispatcher signal matters.
cd evals/functional-area-resolver node harness.mjs --model opus # ~225 LLM calls, ~$1.70 at Opus pricing node harness.mjs --model sonnet # ~$1.00 node harness.mjs --model haiku # ~$0.30 node rescore.mjs baseline-runs/2026-05-11-opus-4-7.jsonl # zero-cost re-score
Receipts (model, prompt_template_hash, fixtures_hash, harness_sha, ts): `evals/functional-area-resolver/baseline-runs/2026-05-11-{opus-4-7,sonnet-4-6,haiku-4-5}.jsonl`.
Give the agent you already use a memory you control. GBrain stores explicit facts with their sources, supports corrections and withdrawal, and makes the same memory available across your agents.
Repo: garrytan/gbrain
Pre-write quality gate for content entering the brain. No raw copies: a bare cp/mv into the brain repo is a bug. Before any new page lands, resolve named…
When you report a brain page to the user — created, edited, committed, or relayed from a subagent — a working link is part of the deliverable, in the SAME…
Brain knowledge base operations. The core read/write cycle: brain-first lookup, read-enrich-write loop, source attribution, ambient enrichment, back-linking.…
Deduplicate and synthesize raw concept stubs into a tiered intellectual map (T1 Canon to T4 Riff), tracing idea evolution across sources over time. Transforms…
Token-hygiene audit of the always-loaded context stack — CLAUDE.md, AGENTS.md, auto-memory MEMORY.md, and the bootstrap-rendered identity files (SOUL.md,…
When the user corrects a factual error, root-cause it immediately. Don't just note the correction — trace the error to its source, fix the source, and prevent…