Files
gbrain/skills/RESOLVER.md
T
7be17261bc v0.32.3.0 skill: functional-area-resolver — pattern for compressing routing tables (#859)
* skill: compress-agents-md — functional-area resolver pattern

Proven via A/B eval: 100% routing accuracy at 48% size reduction.
Converts granular per-skill resolver rows into functional-area dispatchers
with '(dispatcher for: ...)' sub-skill lists.

Includes:
- SKILL.md with full pattern docs, before/after examples, eval results
- routing-eval.jsonl with 5 fixtures
- Anti-patterns (resolver-of-resolvers pipe table = 15% accuracy)

* skill: rename compress-agents-md → functional-area-resolver, cite prior art

The contribution is a pattern (functional-area dispatcher with `(dispatcher
for: ...)` clauses), not a file. Rename describes the contribution; triggers
broaden to cover both AGENTS.md and RESOLVER.md phrasings.

SKILL.md rewrite:
- Three-model A/B table (Opus 4.7 / Sonnet 4.6 / Haiku 4.5) replaces the
  original Sonnet-only claim. Functional-areas beats baseline by +13 to +17pp
  training (lenient) across all three models at 48% the size.
- Strict + lenient scoring documented side by side. Lenient (predicted shares
  dispatcher area with expected) matches production agent behavior.
- Preconditions added: refuse to compress if file <12KB or working tree dirty.
- Multi-file routing precedence section for the v0.31.7 RESOLVER.md/AGENTS.md
  merge case.
- Mandatory verification step (≥95% via the harness).
- Daily-doctor.mjs reference scrubbed (didn't exist in gbrain).
- Three prior-art citations: AnyTool (arXiv:2402.04253), RAG-MCP
  (arXiv:2505.03275), Anthropic Agent Skills progressive disclosure. The
  pattern is the static-prompt analog of runtime hierarchical routing.

routing-eval.jsonl: 8 positive (5 original + 3 broadened triggers) + 4
adversarial negatives targeting skillify, skill-creator, book-mirror,
concept-synthesis to prove broadened triggers don't over-capture adjacent
meta-skills.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* evals: A/B harness for functional-area-resolver (gateway-routed, strict + lenient scoring)

evals/functional-area-resolver/ lives outside skills/ deliberately. The
skillpack bundler walks skills/<skill>/ recursively, so an eval surface in
there would copy harness + variants + fixtures + tests into every downstream
install. The pattern (in SKILL.md) ships everywhere; the eval evidence stays
in the gbrain repo.

What ships:
- Three variant resolvers in variants/ — baseline.md (verbose 25KB) and
  functional-areas.md (compressed 13KB) extracted from a real production
  AGENTS.md at git commits 93848ff3b^ and 93848ff3b (owner PII scrubbed).
  resolver-of-resolvers.md derived mechanically by stripping (dispatcher
  for: ...) clauses — the ablation case.
- 20 hand-authored training fixtures + 5 held-out blind fixtures.
- harness-runner.ts — TypeScript runner via gbrain gateway. Flags:
  --model {opus|sonnet|haiku|<full-id>}, --variants-dir, --variants for
  description-length sweeps, --parallel N (rate-lease bound), --limit N
  for smoke runs, --yes for non-TTY.
- Every output row carries BOTH `correct` (strict) and `correct_lenient`
  (predicted shares dispatcher area with expected). Lenient matches
  production behavior.
- Receipt header binds (model, prompt_template_hash, fixtures_hash,
  harness_sha, ts, cmd_args). Re-runs are auditable.
- harness.mjs — thin Node shim that spawns the TS runner via bun.
- rescore.mjs — zero-cost lenient re-score of an existing JSONL.
- harness-runner.test.ts — 45 unit tests (no API key needed) covering
  every pure function plus the dispatcher-list parser.

The prompt template is load-bearing: without the "drill into (dispatcher
for: ...) list" instruction, every compression variant collapses to
~30-60%. Documented in SKILL.md and README.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* evals: baseline receipts (Opus 4.7 + Sonnet 4.6 + Haiku 4.5, 2026-05-11)

Three canonical 225-row receipts (3 variants × 25 fixtures × 3 seeds per
model). Each receipt header binds (model, prompt_template_hash,
fixtures_hash, harness_sha, ts) so the published SKILL.md numbers are
reproducible.

Training corpus (n=20, lenient):
  baseline      | Opus 81.7% | Sonnet 86.7% | Haiku 73.3% | 25KB
  functional-areas | Opus 98.3% | Sonnet 100%  | Haiku 88.3% | 13KB
  resolver-of-resolvers | Opus 63.3% | Sonnet 41.7% | Haiku 65.0% | 10KB

functional-areas beats baseline by +13 to +17pp across all three models at
48% the size. resolver-of-resolvers' Sonnet collapse (41.7%) is the SKILL.md
"compression without dispatcher clause is broken" claim, observed.

Held-out (n=5, lenient) saturates at 100% across most cells (Sonnet ×
resolver-of-resolvers is 73.3% — the same failure mode visible on a smaller
sample).

~$3 API spend across all three runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* skill: wire functional-area-resolver into RESOLVER.md + manifests

skills/RESOLVER.md gets a new row in Operational, adjacent to skillify.
Triggers: "Compress my resolver", "AGENTS.md too large", "RESOLVER.md too
big", "functional area dispatcher", "shrink routing table".

skills/manifest.json adds the new entry and bumps manifest version
0.25.1 → 0.32.3.0 (loadOrDeriveManifest reads this for sync-guard).

openclaw.plugin.json adds functional-area-resolver to the skills array
and bumps version 0.25.1 → 0.32.3.0 so install receipts stop being stale
(src/core/skillpack/installer.ts:307-311 uses manifest version on every
install).

Verified:
- gbrain check-resolvable --json: 42/42 reachable, 0 errors.
- gbrain routing-eval: 70/70 pass (100% structural).
- bun test test/skillpack-sync-guard.test.ts: passes (manifest in sync).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* v0.32.3.0 skill: functional-area-resolver — pattern for compressing routing tables

Headline: compress a 25KB AGENTS.md down to 13KB without losing routing
accuracy. Pattern proven across Opus 4.7, Sonnet 4.6, and Haiku 4.5 — beats
the verbose baseline by +13 to +17pp at 48% the size.

Empirical (training, n=20, 3 seeds, lenient):
  baseline 25KB:                Opus 81.7% | Sonnet 86.7% | Haiku 73.3%
  functional-areas 13KB:        Opus 98.3% | Sonnet 100%  | Haiku 88.3%
  resolver-of-resolvers 10KB:   Opus 63.3% | Sonnet 41.7% | Haiku 65.0%

The (dispatcher for: ...) clause is the load-bearing signal. Strip it (the
resolver-of-resolvers variant) and Sonnet collapses to 41.7% — the failure
case the pattern's authors predicted, now observed.

Files in this release:
- VERSION + package.json bumped to 0.32.3.0 (4-segment per CLAUDE.md).
- CHANGELOG.md: full empirical story, cross-model table, three prior-art
  citations (AnyTool, RAG-MCP, Anthropic Agent Skills progressive
  disclosure).
- TODOS.md: nine v0.33.x follow-ups (dogfood on gbrain's own RESOLVER.md,
  CLI promotion to gbrain routing-eval --ab-compare, held-out corpus
  growth, cross-vendor Gemini+GPT verification, per-row description
  length sweep, structural compression to ~10KB, hierarchical
  area-of-areas, embedding pre-router, adversarial fixtures,
  prompt-design ablation doc).
- llms-full.txt regenerated.

Bisect-friendly history on this branch:
  502d447e  skill: rename + content rewrite + routing-eval.jsonl
  472cc686  evals: A/B harness + variants + fixtures + tests (no receipts)
  243e013e  evals: cross-model baseline receipts (Opus + Sonnet + Haiku)
  ecab180b  skill: wire-up to RESOLVER.md + manifest.json + openclaw.plugin.json
  THIS:     v0.32.3.0 release marker

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* evals: codex review fixes — accept ASCII -> arrow + provider-aware auth gate

Two P2 findings from /codex review on commit 8870c64e:

P2-2: parseDispatcherLists regex required Unicode `→`, but SKILL.md
Step 4 documents the template with ASCII `->`. Downstream-authored
resolvers following the template silently fell through to strict-only
scoring (correct_lenient == correct always), under-reporting same-area
accuracy with no warning. Regex now accepts both `→` and `->`. Two
new test cases pin the behavior — pure-ASCII variant + mixed-arrow
variant.

P2-3: main() exited with `ANTHROPIC_API_KEY is not set` even when the
user passed `--model openai:gpt-4o` with a valid OPENAI_API_KEY. The
CLI advertises full provider:model support (resolveModel tests cover
openai:* explicitly) and the gateway routes by recipe; the env check
should match the provider that will actually be called. Now extracts
the provider id from the model string and looks up the right env var
from REQUIRED_ENV_BY_PROVIDER (anthropic, openai, google, groq,
voyage, together, deepseek, minimax, dashscope, zhipu). Unknown
providers fall through to the gateway, which raises a clear
recipe-specific error.

47/47 harness unit tests pass after the change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* skill: codex review P2-1 — verification gate now tests the user's edited file

The original SKILL.md Step 6 told users to run `node harness.mjs` from the
gbrain repo as the mandatory ≥95% gate. But that runs the harness against
the COMMITTED sample variants in evals/functional-area-resolver/variants/,
not the file the user just compressed. The gate could pass while the edit
dropped a sub-skill.

Step 6 now:
- Gate 1 stays at `gbrain routing-eval --json` (structural, runs against
  the user's actual routing-eval.jsonl fixtures).
- Gate 2 is rewritten: copy the user's edited routing file into a tmp
  variants dir, then run `node harness.mjs --variants-dir <tmp>
  --variants my-edit --model opus`. This exercises the harness's existing
  --variants flag (added in commit 472cc686 / T4) but now points at the
  user's actual edit. The harness uses gbrain-bundled fixtures, so this
  is a regression check on shared skills, not a full eval of the user's
  fixture set — and the SKILL.md says so explicitly.

Also adds a "common false negatives" callout: when the user's routing
file doesn't expose the skills gbrain's bundled fixtures target (e.g.
`gmail`, `enrich`), expect strict-scoring fails on those rows; lenient
scoring remains accurate.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* evals: codex review P3 — regenerate Opus baseline with current schema

The prior Opus receipt was generated before commit 472cc686 (T4 added
harness_sha to ReceiptRow and correct_lenient to every RunRow). The
Sonnet and Haiku receipts shipped with the new schema, but Opus was
the outlier.

This run was produced with the current harness (sha ca99fbfeb, after
the P2-1 + P2-2 + P2-3 fixes). The harness_sha in the receipt header
binds the numbers to a specific harness revision so consumers can detect
schema drift.

Numbers (training, lenient, n=20, 3 seeds):
  baseline:              81.7% ± 7.2%  (unchanged — strict and lenient are equal)
  functional-areas:      100% ± 0%     (was 98.3% — one nondeterministic seed
                                         is now in-cluster; pattern continues
                                         to beat baseline at 48% the size)
  resolver-of-resolvers: 66.7% ± 7.2%  (was 63.3% — still in noise; absent
                                         dispatcher clause keeps it ~30pp
                                         behind functional-areas on training)

Held-out (n=5, 3 seeds, lenient): all variants 100% except resolver-of-
resolvers on Sonnet (committed in earlier baseline) — Opus held-out
saturates the small fixture set.

Run cost: ~$1.40 at Opus 4.7 pricing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* post-merge: scrub fork-private paths + add Contract/Output Format sections

Two CI gates landed on master after this branch was cut:

1) scripts/check-privacy.sh (v0.32.2): banned /data/brain/ and /data/.openclaw/
   in committed files. The eval variants extracted from a real production
   AGENTS.md still contained those fork-private path literals. Rewrote to
   /your/brain/path/, /your/agent/.openclaw/, /your/gbrain, /your/gstack,
   /your/tmp, /your/git-projects/. Only path strings changed — the routing
   structure (skill names, dispatcher clauses, trigger phrases) is byte-for-
   byte identical, so harness baseline-runs/ receipts are still valid.

2) test/skills-conformance.test.ts (master): added required sections
   `## Contract` and `## Output Format` to every skill. Added both to
   skills/functional-area-resolver/SKILL.md following the book-mirror
   convention (short body referencing the canonical content above + a
   conformance-test footnote). Contract notes the privacy guarantee +
   the verification-gate semantics; Output Format documents the area
   entry template (with both ASCII -> and Unicode → arrows accepted).

Full unit suite: 5578 pass / 0 fail. bun run verify clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* docs: surface functional-area-resolver in CLAUDE.md + README.md for v0.32.3.0

CLAUDE.md — adds a "Routing-table compression (v0.32.3.0)" entry under Skills,
covering the two-layer dispatch pattern, the load-bearing (dispatcher for: ...)
clause, the eval surface at evals/functional-area-resolver/, the three
cross-model baseline receipts, the 25KB → 13KB compression numbers, and the
nine v0.33.x follow-up TODOs. Cites AnyTool / RAG-MCP / Anthropic Agent Skills
prior art so the pattern's position in the literature is discoverable from the
agent entry point.

README.md — adds a "New in v0.32.3.0" callout in the intro section so users
landing on the repo see the new skill before scrolling to the skills list.
Links the SKILL.md and eval directory; states the cross-model gain (+13 to
+17pp at 48% the size) so the reason to apply the pattern is one click away.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: garrytan-agents <garrytan-agents@users.noreply.github.com>
Co-authored-by: Garry Tan <garrytan@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 20:39:00 -07:00

8.1 KiB

GBrain Skill Resolver

This is the dispatcher. Skills are the implementation. Read the skill file before acting. If two skills could match, read both. They are designed to chain (e.g., ingest then enrich for each entity).

Always-on (every message)

Trigger Skill
Every inbound message (spawn parallel, don't block) skills/signal-detector/SKILL.md
Any brain read/write/lookup/citation skills/brain-ops/SKILL.md

Brain operations

Trigger Skill
"What do we know about", "tell me about", "search for", "who is", "background on", "notes on" skills/query/SKILL.md
"Who knows who", "relationship between", "connections", "graph query" skills/query/SKILL.md (use graph-query)
Creating/enriching a person or company page skills/enrich/SKILL.md
Where does a new file go? Filing rules skills/repo-architecture/SKILL.md
Fix broken citations in brain pages skills/citation-fixer/SKILL.md
"citation audit", "check citations", "fix citations" skills/citation-fixer/SKILL.md (focused fix). For broader brain health, chain into skills/maintain/SKILL.md
"Research", "track", "extract from email", "investor updates", "donations" skills/data-research/SKILL.md
Share a brain page as a link skills/publish/SKILL.md
"validate frontmatter", "check frontmatter", "fix frontmatter", "frontmatter audit", "brain lint" skills/frontmatter-guard/SKILL.md

Content & media ingestion

Trigger Skill
User shares a link, article, tweet, or idea skills/idea-ingest/SKILL.md
"watch this video", "process this YouTube link", "ingest this PDF", "save this podcast", "process this book", "summarize this book", "PDF book", "ingest it into my brain", "what's in this screenshot", "check out this repo" skills/media-ingest/SKILL.md
Meeting transcript received skills/meeting-ingestion/SKILL.md
Generic "ingest this" (auto-routes to above) skills/ingest/SKILL.md

Thinking skills (from GStack)

Trigger Skill
"Brainstorm", "I have an idea", "office hours" GStack: office-hours
"Review this plan", "CEO review", "poke holes" GStack: ceo-review
"Debug", "fix", "broken", "investigate" GStack: investigate
"Retro", "what shipped", "retrospective" GStack: retro

These skills come from GStack. If GStack is installed, the agent reads them directly. If not, brain-only mode still works (brain skills function without thinking skills).

Operational

Trigger Skill
Task add/remove/complete/defer/review skills/daily-task-manager/SKILL.md
Morning prep, meeting context, day planning skills/daily-task-prep/SKILL.md
Daily briefing, "what's happening today" skills/briefing/SKILL.md
Cron scheduling, quiet hours, job staggering skills/cron-scheduler/SKILL.md
Save or load reports skills/reports/SKILL.md
"Create a skill", "improve this skill" skills/skill-creator/SKILL.md
"Skillify this", "is this a skill?", "make this proper" skills/skillify/SKILL.md
"Compress my resolver", "AGENTS.md too large", "RESOLVER.md too big", "functional area dispatcher", "shrink routing table" skills/functional-area-resolver/SKILL.md
"Is gbrain healthy?", morning health check, skillpack-check skills/skillpack-check/SKILL.md
Post-restart health + auto-fix, "did the container restart break anything", smoke test skills/smoke-test/SKILL.md
Cross-modal review, second opinion skills/cross-modal-review/SKILL.md
"Validate skills", skill health check skills/testing/SKILL.md
Webhook setup, external event processing skills/webhook-transforms/SKILL.md
"Spawn agent", "background task", "parallel tasks", "steer agent", "pause/resume agent", "gbrain jobs submit", "submit a gbrain job", "submit a shell job", "shell job" skills/minion-orchestrator/SKILL.md
"present options", "ask before proceeding", "choice gate", "user decision" skills/ask-user/SKILL.md

Setup & migration

Trigger Skill
"Set up GBrain", first boot skills/setup/SKILL.md
"Now what?", "fill my brain", "cold start", "bootstrap", "import my data", "what should I import first" skills/cold-start/SKILL.md
"Migrate from Obsidian/Notion/Logseq" skills/migrate/SKILL.md
Brain health check, maintenance run skills/maintain/SKILL.md
"Extract links", "build link graph", "populate timeline" skills/maintain/SKILL.md (extraction sections)
"Run dream", "process today's session", "synthesize my conversations", "consolidate yesterday's conversations", "what patterns did you see", "did the dream cycle run" skills/maintain/SKILL.md (dream cycle section)
"Brain health", "what features am I missing", "brain score" Run gbrain features --json
"Set up autopilot", "run brain maintenance", "keep brain updated" Run gbrain autopilot --install --repo ~/brain
Agent identity, "who am I", customize agent skills/soul-audit/SKILL.md
"Populate links", "extract links", "backfill graph" skills/maintain/SKILL.md (graph population phase)
"Populate timeline", "extract timeline entries" skills/maintain/SKILL.md (graph population phase)

Identity & access (always-on)

Trigger Skill
Non-owner sends a message Check ACCESS_POLICY.md before responding
Agent needs to know its identity/vibe Read SOUL.md
Agent needs user context Read USER.md
Operational cadence (what to check and when) Read HEARTBEAT.md

Disambiguation rules

When multiple skills could match:

  1. Prefer the most specific skill (meeting-ingestion over ingest)
  2. If the user mentions a URL, route by content type (link → idea-ingest, video → media-ingest)
  3. If the user mentions a person/company, check if enrich or query fits better
  4. Chaining is explicit in each skill's Phases section
  5. When in doubt, ask the user (see skills/ask-user/SKILL.md for the choice-gate pattern)

Conventions (cross-cutting)

These apply to ALL brain-writing skills:

  • skills/conventions/quality.md — citations, back-links, notability gate
  • skills/conventions/brain-first.md — check brain before external APIs
  • skills/conventions/brain-routing.md — which brain (DB) and which source (repo) to target; cross-brain federation is latent-space only
  • skills/conventions/subagent-routing.md — when to use Minions vs inline work
  • skills/ask-user/SKILL.md — choice-gate pattern for human input at decision points
  • skills/_brain-filing-rules.md — where files go
  • skills/_output-rules.md — output quality standards

Uncategorized

Trigger Skill
"personalized version of this book", "mirror this book", "two-column book analysis", "apply this book to my life", "how does this book apply to me" skills/book-mirror/SKILL.md
"enrich this article", "enrich brain pages", "batch enrich", "make brain pages useful" skills/article-enrichment/SKILL.md
"strategic reading", "read this through the lens of", "apply this to my problem", "what can I learn from this about", "extract a playbook from" skills/strategic-reading/SKILL.md
"concept synthesis", "synthesize my concepts", "find patterns across my notes", "build my intellectual map", "trace idea evolution" skills/concept-synthesis/SKILL.md
"perplexity research", "what's new about", "current state of", "web research", "what changed about" skills/perplexity-research/SKILL.md
"crawl my archive", "find gold in my archive", "archive crawler", "scan my dropbox for", "mine my old files for" skills/archive-crawler/SKILL.md
"verify this academic claim", "check this study", "academic verify", "validate citation", "is this study real" skills/academic-verify/SKILL.md
"make pdf from brain", "brain pdf", "convert brain page to pdf", "publish this page as pdf", "export brain page" skills/brain-pdf/SKILL.md
"voice note", "ingest this voice memo", "transcribe and file", "voice note ingest", "save this audio note" skills/voice-note-ingest/SKILL.md