[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7575AMCVHPV6RG2RSY37P6F":3,"skill-same:01M7575AMCVHPV6RG2RSY37P6F":72},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":14,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":65},"01M7575AMCVHPV6RG2RSY37P6F","functional-area-resolver",null,"Compress an agent's routing file (RESOLVER.md or AGENTS.md) by converting\ngranular skill-per-row tables into functional-area dispatchers. Each area\nlists sub-skills in a \"(dispatcher for: ...)\" clause. The LLM reads one\narea entry and routes to the correct sub-skill. Proven via held-out\nA\u002FB eval: dispatcher pattern outperforms naive pipe-table compression.","Ninatuzi\u002Fgbrain","Ninatuzi","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F234898825?v=4","01M75736J1JJ7Y7ES4AF751XC7","Nina","01M75736K5D98W2SRJ696K7992",0,"MIT","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Fskills\u002Ffunctional-area-resolver\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: functional-area-resolver\nversion: 1.0.0\nprompt_version: 1\ndescription: |\n  Compress an agent's routing file (RESOLVER.md or AGENTS.md) by converting\n  granular skill-per-row tables into functional-area dispatchers. Each area\n  lists sub-skills in a \"(dispatcher for: ...)\" clause. The LLM reads one\n  area entry and routes to the correct sub-skill. Proven via held-out\n  A\u002FB eval: dispatcher pattern outperforms naive pipe-table compression.\ntriggers:\n  - \"compress agents.md\"\n  - \"compress my resolver\"\n  - \"resolver too big\"\n  - \"resolver.md too big\"\n  - \"agents.md too large\"\n  - \"shrink routing table\"\n  - \"slim down agents.md\"\n  - \"functional area resolver\"\n  - \"functional area dispatcher\"\n  - \"context-health agents\"\n  - \"context-health resolver\"\n  - \"reduce context budget\"\ntools:\n  - exec\n  - read\n  - write\n  - edit\nmutating: true\n---\n\n# Functional-Area Resolver — Pattern for Compressing Routing Tables\n\n## Problem\n\nRouting files (RESOLVER.md, AGENTS.md) grow as skills are added. Each skill\ngets its own row (trigger -> skill path). At ~200+ skills this hits 25-30KB,\neating context budget that should go to actual work.\n\n## Solution: Functional-Area Dispatchers\n\nReplace N rows per area with **one entry per functional area**. Each entry\nlists all sub-skills it can dispatch to in a `(dispatcher for: ...)` clause.\n\n### Before (270 rows, 25KB)\n```\n- Creating\u002Fenriching a person or company page -> `enrich`\n- Fix broken citations in brain pages -> `citation-fixer`\n- Publish\u002Fshare a brain page as link -> `brain-publish`\n- Generate PDF from brain page -> `brain-pdf`\n- Read a book through lens of a problem -> `strategic-reading`\n- Personalized book analysis -> `book-mirror`\n- Brain integrity -> `brain-librarian`\n...\n```\n\n### After (13 rows, 13KB)\n```\n- **Brain & knowledge**: create\u002Fenrich\u002Fsearch\u002Fexport brain pages, filing,\n  citations, publishing, book analysis, strategic reading, concept synthesis,\n  archive mining -> `brain-ops` (dispatcher for: enrich, query, brain-pdf,\n  brain-publish, brain-export, brain-librarian, citation-fixer, book-mirror,\n  strategic-reading, concept-synthesis, archive-crawler, ...)\n```\n\n## Why It Works\n\nThe LLM doesn't need one row per sub-skill. It needs:\n1. **Area recognition** — \"this is about brain pages\" -> Brain & Knowledge\n2. **Sub-skill visibility** — the `(dispatcher for: ...)` list shows what's available\n3. **The skill file itself** — once the LLM reads `brain-ops\u002FSKILL.md`, it has full routing detail\n\nThis is a **two-layer dispatch**: routing file routes to the area, the area\nskill routes to the specific sub-skill. Each layer does one job well.\n\n## A\u002FB Eval Results\n\nThree resolver architectures tested across three Anthropic frontier models\n(Opus 4.7, Sonnet 4.6, Haiku 4.5) on real production AGENTS.md content,\n20 hand-authored training fixtures + 5 held-out blind fixtures, n=3 seeded\nrepeats per (fixture, variant). Two scoring rules: **STRICT** (predicted\nslug exactly equals expected) and **LENIENT** (predicted is in the same\ndispatcher area as expected). Both matter:\n\n- STRICT measures: \"does the LLM return the exact slug?\"\n- LENIENT measures: \"does the LLM land in the right area, even if it picks a\n  more-specific sub-skill from `(dispatcher for: ...)`?\" This is closer to\n  production behavior — an agent that lands in `gmail` for an email intent\n  succeeds even if the resolver entry said `executive-assistant`.\n\n### Training corpus (n=20, 3 seeds × 3 variants × 3 models, LENIENT)\n\n| Variant | Opus 4.7 | Sonnet 4.6 | Haiku 4.5 | Size |\n|---|---|---|---|---|\n| baseline (270 bullet rows) | 81.7% ± 7.2% | 86.7% ± 7.2% | 73.3% ± 7.2% | 25KB |\n| **functional-areas** (this pattern) | **98.3% ± 7.2%** | **100% ± 0%** | **88.3% ± 7.2%** | **13KB** |\n| resolver-of-resolvers (no dispatcher clause) | 63.3% ± 14.3% | 41.7% ± 7.2% | 65.0% ± 12.4% | 10KB |\n\n### Held-out blind corpus (n=5, 3 seeds, LENIENT)\n\n| Variant | Opus 4.7 | Sonnet 4.6 | Haiku 4.5 |\n|---|---|---|---|\n| baseline | 100% ± 0% | 100% ± 0% | 100% ± 0% |\n| **functional-areas** | **100% ± 0%** | **100% ± 0%** | **100% ± 0%** |\n| resolver-of-resolvers | 100% ± 0% | **73.3% ± 28.7%** | 100% ± 0% |\n\n### What the data shows\n\n1. **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.\n\n2. **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.\n\n3. **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.\n\n4. **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.\n\n### Reproduce\n\n```bash\ncd evals\u002Ffunctional-area-resolver\nnode harness.mjs --model opus    # ~225 LLM calls, ~$1.70 at Opus pricing\nnode harness.mjs --model sonnet  # ~$1.00\nnode harness.mjs --model haiku   # ~$0.30\nnode rescore.mjs baseline-runs\u002F2026-05-11-opus-4-7.jsonl  # zero-cost re-score\n```\n\nReceipts (model, prompt_template_hash, fixtures_hash, harness_sha, ts):\n`evals\u002Ffunctional-area-resolver\u002Fbaseline-runs\u002F2026-05-11-{opus-4-7,sonnet-4-6,haiku-4-5}.jsonl`.\n\n### Methodology caveats\n\n- **Production prompt matters.** With a naive \"return the skill slug\" prompt\n  (no instruction about `(dispatcher for: ...)`), every compression variant\n  collapses to ~30-60% on Opus. The dispatcher-aware prompt is in\n  `evals\u002Ffunctional-area-resolver\u002Fharness-runner.ts:PROMPT_TEMPLATE`. Use it\n  as the template for your agent's harness; without it, compression breaks.\n- **Training corpus and variants were authored by the same release.** Held-out\n  corpus was written before the variants and never adjusted; this mitigates\n  but does not eliminate overfitting.\n- **Confidence intervals via t-distribution across n=3 seeded repeats.** Hold the\n  n=3 lower-bound: high CIs mean the underlying sample is noisy.\n- **Single-vendor result.** All three models are Anthropic. Cross-vendor\n  verification (Gemini, GPT) is a v0.33.x follow-up.\n- **Held-out blind set is small (n=5).** Saturated at 100% across most cells —\n  the harness can't distinguish between \"100%\" and \"95% with one nondeterministic\n  miss.\" Expanding to ≥20 is a v0.33.x follow-up.\n\n### Prior work and citations\n\nThe pattern is a **static-prompt analog of hierarchical agent routing**, a\n2024-2025 research direction:\n\n- **AnyTool** ([arXiv:2402.04253](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.04253)) showed\n  meta-agent → category-agent → tool-agent hierarchy on 16K APIs beats flat\n  retrieval by +35.4pp. The `(dispatcher for: ...)` clause is the\n  meta-agent's view collapsed into a single LLM pass.\n- **RAG-MCP** ([arXiv:2505.03275](https:\u002F\u002Farxiv.org\u002Fhtml\u002F2505.03275v1))\n  reports 49.2% prompt-token reduction at 3.2× accuracy gain via\n  embedding-based pre-retrieval. The token-reduction story matches ours\n  (48% smaller), via a different mechanism (RAG vs static dispatcher).\n- **Anthropic Agent Skills**\n  ([engineering blog](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fequipping-agents-for-the-real-world-with-agent-skills))\n  promotes progressive disclosure: frontmatter (~80 tokens) always loaded,\n  SKILL.md body loaded on match. This skill applies the same principle at\n  the routing-table level, not the per-skill body level.\n\nThe 2025-2026 literature has no published benchmark for **static-prompt\nhierarchical routing** (every published hierarchical scheme resolves the\nhierarchy at runtime via a second LLM call). Our finding — that the\nhierarchy can be inlined into a single-LLM-pass dispatcher list and retain\nrouting accuracy — is the open contribution. See\n`evals\u002Ffunctional-area-resolver\u002FREADME.md` for methodology details.\n\n## How To Compress\n\n### Step 1: Preconditions\n\nRefuse to compress if either gate fails:\n- Source routing file is under 12KB (compression overhead exceeds benefit).\n- `git status` shows uncommitted changes to the routing file (the\n  compressor's edit would entangle with whatever the user was doing).\n\nIf a user wants to override either gate, they ask explicitly with `--force`.\n\n### Step 2: When to compress which file\n\nGBrain workspaces often have TWO routing files merged at runtime (per\n`src\u002Fcore\u002Fcheck-resolvable.ts` v0.31.7): `skills\u002FRESOLVER.md` and a sibling\n`..\u002FAGENTS.md`. Choose which to compress:\n\n- Only one is fat (>12KB): compress that one; leave the small one alone.\n- Both are fat: compress them separately, in order: AGENTS.md first\n  (usually the larger one in OpenClaw-style deployments), then RESOLVER.md.\n- Only the small one is fat (rare): same rule — compress it.\n\nIf the deployment uses only one routing file, this section is a no-op —\ncompress that one.\n\n### Step 3: Identify functional areas\n\nGroup skills by domain. Typical areas (adjust per deployment):\n\n- **Brain & Knowledge** — brain-ops as dispatcher\n- **Content Ingestion** — ingest as dispatcher\n- **Calendar & Scheduling** — google-calendar as dispatcher\n- **Email & Comms** — executive-assistant as dispatcher\n- **Research & Investigation** — perplexity-research as dispatcher\n- **X\u002FTwitter & Social** — x-ingest as dispatcher\n- **Places & Travel** — checkin as dispatcher\n- **Product & Building** — acp-coding as dispatcher\n- **Infrastructure** — healthcheck as dispatcher\n- **Tasks & Logistics** — daily-task-manager as dispatcher\n- **People & Contacts** — google-contacts as dispatcher\n\n### Step 4: Build the area entry format\n\nEach area entry follows this template:\n\n```\n- **{Area Name}**: {comma-separated trigger phrases} -> `{dispatcher-skill}`\n  (dispatcher for: {comma-separated sub-skill names})\n```\n\nRules:\n- Trigger phrases should be broad enough to catch intent (\"brain pages, enrich,\n  search, filing, citations, book analysis\")\n- Sub-skill list should be comprehensive — this is how the LLM knows what's available\n- The dispatcher skill file should have its own internal routing table\n\n### Step 5: Keep always-on entries separate\n\nGates and always-on entries (acknowledge, multi-user, entity-detector, etc.)\nstay as individual rows — they're checked on every message, not dispatched.\n\n### Step 6 (MANDATORY): Verify routing accuracy\n\nRun two gates before committing the compressed file. Do NOT commit if either\nfails.\n\n**Gate 1: Structural verification.** Confirms your `routing-eval.jsonl`\nfixtures still resolve to the right skills under the compressed routing file.\nRun from the workspace whose routing file you just edited:\n\n```bash\ngbrain routing-eval --json\n```\n\nIf accuracy on your fixtures drops below 95%, revert and tune the area\nentries before re-running.\n\n**Gate 2: LLM A\u002FB verification on YOUR edited file.** Confirms a frontier\nLLM can still drill into the dispatcher list and reach sub-skills under\nyour specific compression. Requires a gbrain repo checkout because the\nharness lives there. Copy your edited routing file into the harness's\nvariants directory, then invoke the harness with `--variants` pointing\nat it:\n\n```bash\n# In your agent workspace, identify the routing file you just compressed.\nEDITED=\u002Fpath\u002Fto\u002Fyour\u002FAGENTS.md       # or skills\u002FRESOLVER.md, whichever you edited\n\n# In your gbrain repo checkout:\ncd \u002Fpath\u002Fto\u002Fgbrain\u002Fevals\u002Ffunctional-area-resolver\nTMP=$(mktemp -d)\u002Fvariants && mkdir -p \"$TMP\"\ncp \"$EDITED\" \"$TMP\u002Fmy-edit.md\"\n\n# Run the harness against your file (sequential, ~75 calls × $0.0076 ≈ $0.57 on Opus).\nANTHROPIC_API_KEY=... node harness.mjs --variants-dir \"$TMP\" --variants my-edit \\\n                                       --model opus --parallel 3 --yes\n```\n\nThe harness uses gbrain's bundled fixture set, so this verifies \"did the LLM\nland in the right sub-skill for routing intents the gbrain-bundled fixtures\ncover\" — a regression check on shared skills, not a full re-eval of YOUR\nfixture set. For full eval coverage, mirror this skill's\n`fixtures.jsonl` + `fixtures-held-out.jsonl` setup with intents specific\nto your skills.\n\nIf the lenient (same-area) score on your variant drops below 95%, revert the\ncompression and tune. Common causes:\n- A sub-skill was omitted from the `(dispatcher for: ...)` list.\n- Trigger phrases for an area are too narrow (LLM can't recognize intent).\n- Areas were collapsed too aggressively (too few areas — see Anti-Patterns).\n- ASCII `->` vs Unicode `→` mismatch — the harness now accepts both, but\n  earlier versions only matched Unicode. Pin gbrain to v0.32.3.0+.\n\nCommon false negatives on the harness eval (NOT bugs in your compression):\n- The gbrain-bundled fixtures target skill names like `enrich`, `query`,\n  `gmail`, `executive-assistant`. If your routing file doesn't expose\n  those skills at all, expect strict-scoring failures on those fixtures.\n  Lenient scoring stays accurate for any sub-skill present in your\n  `(dispatcher for: ...)` lists.\n\n### Step 7: Review the diff before committing\n\nShow the user the proposed edit (or the actual git diff) and wait for\nexplicit approval before staging. Same convention as `skills\u002Fbook-mirror\u002FSKILL.md`.\n\n## Contract\n\nThis skill guarantees:\n\n- Routing matches the canonical triggers in the frontmatter.\n- Compression is only performed when the preconditions in Step 1 pass (file ≥12KB AND clean working tree, or `--force`).\n- The mandatory verification gate in Step 6 fires on the user's edited file, not on sample variants. The user runs `gbrain routing-eval --json` AND the gbrain-repo harness (`node harness.mjs --variants-dir \u003Ctmp> --variants my-edit`) before committing the compressed file.\n- Privacy contract preserved: no fork-specific filesystem path literals (server-side brain home, OpenClaw fork home) leak into the compressed output.\n\nThe full behavior contract is documented in the body sections above; this section exists for the conformance test.\n\n## Output Format\n\nThe compressed routing file follows the area-entry template documented in Step 4 (\"Build the area entry format\"). Each entry: `- **{Area Name}**: {trigger phrases} -> \\`{dispatcher-skill}\\` (dispatcher for: {sub-skill list})`. The dispatcher arrow may be either ASCII `->` (default in this template) or Unicode `→` (used in some production deployments); the gbrain harness accepts both.\n\n## Anti-Patterns\n\n- **Resolver-of-resolvers with pipe tables.** Tested and failed (see eval\n  table). The LLM picks area names from the table instead of drilling into\n  sub-skills.\n\n- **Removing sub-skill names.** Without the `(dispatcher for: ...)` list,\n  the LLM can't route to specific sub-skills. The list is the routing signal.\n\n- **Too few areas.** Collapsing to \u003C5 areas makes each area too broad.\n  12-15 areas is the sweet spot.\n\n- **Too many areas.** Defeats the purpose. If you have 50 areas, just keep\n  individual rows.\n\n## Maintenance\n\nWhen adding a new skill:\n1. Identify its functional area.\n2. Add the skill name to that area's `(dispatcher for: ...)` list.\n3. Update the area's skill file with routing detail.\n4. Run the routing eval (Step 6) to verify.\n\nWhen adding a new functional area:\n1. Create the dispatcher skill with internal routing.\n2. Add the area entry to the routing file.\n3. Run the routing eval (Step 6) to verify.\n\n## Changelog\n\n### v1.0.0 — 2026-05-11\n- Initial version. Pattern shipped in gbrain v0.32.3.0 with a held-out A\u002FB\n  eval (see `evals\u002Ffunctional-area-resolver\u002F`).\n- Skill renamed from `compress-agents-md` to `functional-area-resolver`\n  pre-release; the contribution is the pattern, not the filename.\n","# Functional-Area Resolver — Pattern for Compressing Routing Tables\n\n## Problem\n\nRouting files (RESOLVER.md, AGENTS.md) grow as skills are added. Each skill\ngets its own row (trigger -> skill path). At ~200+ skills this hits 25-30KB,\neating context budget that should go to actual work.\n\n## Solution: Functional-Area Dispatchers\n\nReplace N rows per area with **one entry per functional area**. Each entry\nlists all sub-skills it can dispatch to in a `(dispatcher for: ...)` clause.\n\n### Before (270 rows, 25KB)\n```\n- Creating\u002Fenriching a person or company page -> `enrich`\n- Fix broken citations in brain pages -> `citation-fixer`\n- Publish\u002Fshare a brain page as link -> `brain-publish`\n- Generate PDF from brain page -> `brain-pdf`\n- Read a book through lens of a problem -> `strategic-reading`\n- Personalized book analysis -> `book-mirror`\n- Brain integrity -> `brain-librarian`\n...\n```\n\n### After (13 rows, 13KB)\n```\n- **Brain & knowledge**: create\u002Fenrich\u002Fsearch\u002Fexport brain pages, filing,\n  citations, publishing, book analysis, strategic reading, concept synthesis,\n  archive mining -> `brain-ops` (dispatcher for: enrich, query, brain-pdf,\n  brain-publish, brain-export, brain-librarian, citation-fixer, book-mirror,\n  strategic-reading, concept-synthesis, archive-crawler, ...)\n```\n\n## Why It Works\n\nThe LLM doesn't need one row per sub-skill. It needs:\n1. **Area recognition** — \"this is about brain pages\" -> Brain & Knowledge\n2. **Sub-skill visibility** — the `(dispatcher for: ...)` list shows what's available\n3. **The skill file itself** — once the LLM reads `brain-ops\u002FSKILL.md`, it has full routing detail\n\nThis is a **two-layer dispatch**: routing file routes to the area, the area\nskill routes to the specific sub-skill. Each layer does one job well.\n\n## A\u002FB Eval Results\n\nThree resolver architectures tested across three Anthropic frontier models\n(Opus 4.7, Sonnet 4.6, Haiku 4.5) on real production AGENTS.md content,\n20 hand-authored training fixtures + 5 held-out blind fixtures, n=3 seeded\nrepeats per (fixture, variant). Two scoring rules: **STRICT** (predicted\nslug exactly equals expected) and **LENIENT** (predicted is in the same\ndispatcher area as expected). Both matter:\n\n- STRICT measures: \"does the LLM return the exact slug?\"\n- LENIENT measures: \"does the LLM land in the right area, even if it picks a\n  more-specific sub-skill from `(dispatcher for: ...)`?\" This is closer to\n  production behavior — an agent that lands in `gmail` for an email intent\n  succeeds even if the resolver entry said `executive-assistant`.\n\n### Training corpus (n=20, 3 seeds × 3 variants × 3 models, LENIENT)\n\n| Variant | Opus 4.7 | Sonnet 4.6 | Haiku 4.5 | Size |\n|---|---|---|---|---|\n| baseline (270 bullet rows) | 81.7% ± 7.2% | 86.7% ± 7.2% | 73.3% ± 7.2% | 25KB |\n| **functional-areas** (this pattern) | **98.3% ± 7.2%** | **100% ± 0%** | **88.3% ± 7.2%** | **13KB** |\n| resolver-of-resolvers (no dispatcher clause) | 63.3% ± 14.3% | 41.7% ± 7.2% | 65.0% ± 12.4% | 10KB |\n\n### Held-out blind corpus (n=5, 3 seeds, LENIENT)\n\n| Variant | Opus 4.7 | Sonnet 4.6 | Haiku 4.5 |\n|---|---|---|---|\n| baseline | 100% ± 0% | 100% ± 0% | 100% ± 0% |\n| **functional-areas** | **100% ± 0%** | **100% ± 0%** | **100% ± 0%** |\n| resolver-of-resolvers | 100% ± 0% | **73.3% ± 28.7%** | 100% ± 0% |\n\n### What the data shows\n\n1. **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.\n\n2. **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.\n\n3. **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.\n\n4. **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.\n\n### Reproduce\n\n```bash\ncd evals\u002Ffunctional-area-resolver\nnode harness.mjs --model opus    # ~225 LLM calls, ~$1.70 at Opus pricing\nnode harness.mjs --model sonnet  # ~$1.00\nnode harness.mjs --model haiku   # ~$0.30\nnode rescore.mjs baseline-runs\u002F2026-05-11-opus-4-7.jsonl  # zero-cost re-score\n```\n\nReceipts (model, prompt_template_hash, fixtures_hash, harness_sha, ts):\n`evals\u002Ffunctional-area-resolver\u002Fbaseline-runs\u002F2026-05-11-{opus-4-7,sonnet-4-6,haiku-4-5}.jsonl`.\n\n### Methodology caveats\n\n- **Production prompt matters.** With a naive \"return the skill slug\" prompt\n  (no instruction about `(dispatcher for: ...)`), every compression variant\n  collapses to ~30-60% on Opus. The dispatcher-aware prompt is in\n  `evals\u002Ffunctional-area-resolver\u002Fharness-runner.ts:PROMPT_TEMPLATE`. Use it\n  as the template for your agent's harness; without it, compression breaks.\n- **Training corpus and variants were authored by the same release.** Held-out\n  corpus was written before the variants and never adjusted; this mitigates\n  but does not eliminate overfitting.\n- **Confidence intervals via t-distribution across n=3 seeded repeats.** Hold the\n  n=3 lower-bound: high CIs mean the underlying sample is noisy.\n- **Single-vendor result.** All three models are Anthropic. Cross-vendor\n  verification (Gemini, GPT) is a v0.33.x follow-up.\n- **Held-out blind set is small (n=5).** Saturated at 100% across most cells —\n  the harness can't distinguish between \"100%\" and \"95% with one nondeterministic\n  miss.\" Expanding to ≥20 is a v0.33.x follow-up.\n\n### Prior work and citations\n\nThe pattern is a **static-prompt analog of hierarchical agent routing**, a\n2024-2025 research direction:\n\n- **AnyTool** ([arXiv:2402.04253](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.04253)) showed\n  meta-agent → category-agent → tool-agent hierarchy on 16K APIs beats flat\n  retrieval by +35.4pp. The `(dispatcher for: ...)` clause is the\n  meta-agent's view collapsed into a single LLM pass.\n- **RAG-MCP** ([arXiv:2505.03275](https:\u002F\u002Farxiv.org\u002Fhtml\u002F2505.03275v1))\n  reports 49.2% prompt-token reduction at 3.2× accuracy gain via\n  embedding-based pre-retrieval. The token-reduction story matches ours\n  (48% smaller), via a different mechanism (RAG vs static dispatcher).\n- **Anthropic Agent Skills**\n  ([engineering blog](https:\u002F\u002Fwww.anthropic.com\u002Fengineering\u002Fequipping-agents-for-the-real-world-with-agent-skills))\n  promotes progressive disclosure: frontmatter (~80 tokens) always loaded,\n  SKILL.md body loaded on match. This skill applies the same principle at\n  the routing-table level, not the per-skill body level.\n\nThe 2025-2026 literature has no published benchmark for **static-prompt\nhierarchical routing** (every published hierarchical scheme resolves the\nhierarchy at runtime via a second LLM call). Our finding — that the\nhierarchy can be inlined into a single-LLM-pass dispatcher list and retain\nrouting accuracy — is the open contribution. See\n`evals\u002Ffunctional-area-resolver\u002FREADME.md` for methodology details.\n\n## How To Compress\n\n### Step 1: Preconditions\n\nRefuse to compress if either gate fails:\n- Source routing file is under 12KB (compression overhead exceeds benefit).\n- `git status` shows uncommitted changes to the routing file (the\n  compressor's edit would entangle with whatever the user was doing).\n\nIf a user wants to override either gate, they ask explicitly with `--force`.\n\n### Step 2: When to compress which file\n\nGBrain workspaces often have TWO routing files merged at runtime (per\n`src\u002Fcore\u002Fcheck-resolvable.ts` v0.31.7): `skills\u002FRESOLVER.md` and a sibling\n`..\u002FAGENTS.md`. Choose which to compress:\n\n- Only one is fat (>12KB): compress that one; leave the small one alone.\n- Both are fat: compress them separately, in order: AGENTS.md first\n  (usually the larger one in OpenClaw-style deployments), then RESOLVER.md.\n- Only the small one is fat (rare): same rule — compress it.\n\nIf the deployment uses only one routing file, this section is a no-op —\ncompress that one.\n\n### Step 3: Identify functional areas\n\nGroup skills by domain. Typical areas (adjust per deployment):\n\n- **Brain & Knowledge** — brain-ops as dispatcher\n- **Content Ingestion** — ingest as dispatcher\n- **Calendar & Scheduling** — google-calendar as dispatcher\n- **Email & Comms** — executive-assistant as dispatcher\n- **Research & Investigation** — perplexity-research as dispatcher\n- **X\u002FTwitter & Social** — x-ingest as dispatcher\n- **Places & Travel** — checkin as dispatcher\n- **Product & Building** — acp-coding as dispatcher\n- **Infrastructure** — healthcheck as dispatcher\n- **Tasks & Logistics** — daily-task-manager as dispatcher\n- **People & Contacts** — google-contacts as dispatcher\n\n### Step 4: Build the area entry format\n\nEach area entry follows this template:\n\n```\n- **{Area Name}**: {comma-separated trigger phrases} -> `{dispatcher-skill}`\n  (dispatcher for: {comma-separated sub-skill names})\n```\n\nRules:\n- Trigger phrases should be broad enough to catch intent (\"brain pages, enrich,\n  search, filing, citations, book analysis\")\n- Sub-skill list should be comprehensive — this is how the LLM knows what's available\n- The dispatcher skill file should have its own internal routing table\n\n### Step 5: Keep always-on entries separate\n\nGates and always-on entries (acknowledge, multi-user, entity-detector, etc.)\nstay as individual rows — they're checked on every message, not dispatched.\n\n### Step 6 (MANDATORY): Verify routing accuracy\n\nRun two gates before committing the compressed file. Do NOT commit if either\nfails.\n\n**Gate 1: Structural verification.** Confirms your `routing-eval.jsonl`\nfixtures still resolve to the right skills under the compressed routing file.\nRun from the workspace whose routing file you just edited:\n\n```bash\ngbrain routing-eval --json\n```\n\nIf accuracy on your fixtures drops below 95%, revert and tune the area\nentries before re-running.\n\n**Gate 2: LLM A\u002FB verification on YOUR edited file.** Confirms a frontier\nLLM can still drill into the dispatcher list and reach sub-skills under\nyour specific compression. Requires a gbrain repo checkout because the\nharness lives there. Copy your edited routing file into the harness's\nvariants directory, then invoke the harness with `--variants` pointing\nat it:\n\n```bash\n# In your agent workspace, identify the routing file you just compressed.\nEDITED=\u002Fpath\u002Fto\u002Fyour\u002FAGENTS.md       # or skills\u002FRESOLVER.md, whichever you edited\n\n# In your gbrain repo checkout:\ncd \u002Fpath\u002Fto\u002Fgbrain\u002Fevals\u002Ffunctional-area-resolver\nTMP=$(mktemp -d)\u002Fvariants && mkdir -p \"$TMP\"\ncp \"$EDITED\" \"$TMP\u002Fmy-edit.md\"\n\n# Run the harness against your file (sequential, ~75 calls × $0.0076 ≈ $0.57 on Opus).\nANTHROPIC_API_KEY=... node harness.mjs --variants-dir \"$TMP\" --variants my-edit \\\n                                       --model opus --parallel 3 --yes\n```\n\nThe harness uses gbrain's bundled fixture set, so this verifies \"did the LLM\nland in the right sub-skill for routing intents the gbrain-bundled fixtures\ncover\" — a regression check on shared skills, not a full re-eval of YOUR\nfixture set. For full eval coverage, mirror this skill's\n`fixtures.jsonl` + `fixtures-held-out.jsonl` setup with intents specific\nto your skills.\n\nIf the lenient (same-area) score on your variant drops below 95%, revert the\ncompression and tune. Common causes:\n- A sub-skill was omitted from the `(dispatcher for: ...)` list.\n- Trigger phrases for an area are too narrow (LLM can't recognize intent).\n- Areas were collapsed too aggressively (too few areas — see Anti-Patterns).\n- ASCII `->` vs Unicode `→` mismatch — the harness now accepts both, but\n  earlier versions only matched Unicode. Pin gbrain to v0.32.3.0+.\n\nCommon false negatives on the harness eval (NOT bugs in your compression):\n- The gbrain-bundled fixtures target skill names like `enrich`, `query`,\n  `gmail`, `executive-assistant`. If your routing file doesn't expose\n  those skills at all, expect strict-scoring failures on those fixtures.\n  Lenient scoring stays accurate for any sub-skill present in your\n  `(dispatcher for: ...)` lists.\n\n### Step 7: Review the diff before committing\n\nShow the user the proposed edit (or the actual git diff) and wait for\nexplicit approval before staging. Same convention as `skills\u002Fbook-mirror\u002FSKILL.md`.\n\n## Contract\n\nThis skill guarantees:\n\n- Routing matches the canonical triggers in the frontmatter.\n- Compression is only performed when the preconditions in Step 1 pass (file ≥12KB AND clean working tree, or `--force`).\n- The mandatory verification gate in Step 6 fires on the user's edited file, not on sample variants. The user runs `gbrain routing-eval --json` AND the gbrain-repo harness (`node harness.mjs --variants-dir \u003Ctmp> --variants my-edit`) before committing the compressed file.\n- Privacy contract preserved: no fork-specific filesystem path literals (server-side brain home, OpenClaw fork home) leak into the compressed output.\n\nThe full behavior contract is documented in the body sections above; this section exists for the conformance test.\n\n## Output Format\n\nThe compressed routing file follows the area-entry template documented in Step 4 (\"Build the area entry format\"). Each entry: `- **{Area Name}**: {trigger phrases} -> \\`{dispatcher-skill}\\` (dispatcher for: {sub-skill list})`. The dispatcher arrow may be either ASCII `->` (default in this template) or Unicode `→` (used in some production deployments); the gbrain harness accepts both.\n\n## Anti-Patterns\n\n- **Resolver-of-resolvers with pipe tables.** Tested and failed (see eval\n  table). The LLM picks area names from the table instead of drilling into\n  sub-skills.\n\n- **Removing sub-skill names.** Without the `(dispatcher for: ...)` list,\n  the LLM can't route to specific sub-skills. The list is the routing signal.\n\n- **Too few areas.** Collapsing to \u003C5 areas makes each area too broad.\n  12-15 areas is the sweet spot.\n\n- **Too many areas.** Defeats the purpose. If you have 50 areas, just keep\n  individual rows.\n\n## Maintenance\n\nWhen adding a new skill:\n1. Identify its functional area.\n2. Add the skill name to that area's `(dispatcher for: ...)` list.\n3. Update the area's skill file with routing detail.\n4. Run the routing eval (Step 6) to verify.\n\nWhen adding a new functional area:\n1. Create the dispatcher skill with internal routing.\n2. Add the area entry to the routing file.\n3. Run the routing eval (Step 6) to verify.\n\n## Changelog\n\n### v1.0.0 — 2026-05-11\n- Initial version. Pattern shipped in gbrain v0.32.3.0 with a held-out A\u002FB\n  eval (see `evals\u002Ffunctional-area-resolver\u002F`).\n- Skill renamed from `compress-agents-md` to `functional-area-resolver`\n  pre-release; the contribution is the pattern, not the filename.\n",{"name":5,"tools":24,"version":29,"mutating":30,"triggers":31,"description":44,"prompt_version":45},[25,26,27,28],"exec","read","write","edit","1.0.0",true,[32,33,34,35,36,37,38,39,40,41,42,43],"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","Compress an agent's routing file (RESOLVER.md or AGENTS.md) by converting\ngranular skill-per-row tables into functional-area dispatchers. Each area\nlists sub-skills in a \"(dispatcher for: ...)\" clause. The LLM reads one\narea entry and routes to the correct sub-skill. Proven via held-out\nA\u002FB eval: dispatcher pattern outperforms naive pipe-table compression.\n",1,"docs\u002Fmerge-phantoms-design","a37e628443dd4ca65bc82f491ff974c91545f9b3","skills\u002Ffunctional-area-resolver","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain","https:\u002F\u002Fgithub.com\u002FNinatuzi","l am Nina, a student in National University of Malaysia, “l want to learn on GitHub and\r\ncontribute my part to this community","2026-06-02 15:11:10",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":30},[55,58,61],{"tool":56,"command":57},"npx","npx skills add Ninatuzi\u002Fgbrain --skill functional-area-resolver",{"tool":59,"command":60},"bunx","bunx skills add Ninatuzi\u002Fgbrain --skill functional-area-resolver",{"tool":62,"command":63},"pnpm","pnpm dlx skills add Ninatuzi\u002Fgbrain --skill functional-area-resolver","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Fskills\u002Ffunctional-area-resolver\u002FSKILL.md",[66],{"path":67,"resourceType":68,"resourceTypeDesc":69,"sizeBytes":70,"sourceHtmlUrl":71},"routing-eval.jsonl","OTHER","其他",2297,"https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Fskills\u002Ffunctional-area-resolver\u002Frouting-eval.jsonl",[73,80,87,94,101,108],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M75788KPJYS39X1S5G040ADQ","signal-detector","Always-on ambient signal capture for the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fsignal-detector\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M75787ADPHGYCVHSTQAV16S5","query","Look up brain pages in the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fquery\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M75785XJMKBGTBJBWZABZRVF","context-now","ALWAYS-ON time-sensitivity discipline for the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fcontext-now\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M75784DGMEWJCVKGCY99PPPE","brain-ops","Core read\u002Fwrite cycle for the OpenClaw reference fixture.","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Ftest\u002Ffixtures\u002Fopenclaw-reference-minimal\u002Fskills\u002Fbrain-ops\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":19},"01M75780F68HTP3TF97F5ENDQ4","webhook-transforms","Generic framework for converting external events (SMS, meetings, social mentions)\ninto brain-ingestible signals. Define a transform function, register a webhook URL,\nand incoming events get processed through the brain pipeline.","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Fskills\u002Fwebhook-transforms\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":19},"01M7577XC8H31ZRYDVXMT4VJJ7","voice-note-ingest","Ingest a voice note with exact-phrasing preservation (never paraphrased). Routes content to originals\u002F, concepts\u002F, people\u002F, companies\u002F, ideas\u002F, personal\u002F, or voice-notes\u002F based on a decision tree. The user's exact words are the signal.","https:\u002F\u002Fgithub.com\u002FNinatuzi\u002Fgbrain\u002Fblob\u002Fdocs\u002Fmerge-phantoms-design\u002Fskills\u002Fvoice-note-ingest\u002FSKILL.md",[],[]]