Repository navigation
Ship only SKILL.md frontmatter in the per-turn workspace agent-context read - #8119
Merged
ymichael merged 1 commit intoNov 24, 2026
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/per-turn-agent-context-skill-frontmatter-only-thr_jiws95vae4
branch
November 24, 2026 22:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Before every turn, and on every slash-menu open, the server makes one
host.read_workspace_agent_contextRPC. That RPC returned the full text of every project.bb/skills/*/SKILL.md, with a 32 MiB budget. The server only runsparseSkillMetadataon each file to getnameanddescription. It then sends the skill toturn.submitas aworkspace-pathsource, so the provider reads the file from disk itself. Every SKILL.md body made a daemon → server trip and was never used. On the bb repo (9 project skills) that comes to 73 KB per turn. This is finding #4 of the server → daemon RPC audit. I confirmed the call pattern inapps/server/src/services/threads/workspace-agent-context.tsandthread-runtime-config.tsbefore changing anything.What changed
Wire change:
HOST_DAEMON_PROTOCOL_VERSION281 → 282.host.read_workspace_agent_context:kind: "file"project skill entry now carriesfrontmatterinstead ofcontent.projectSkillRead.maxContentBytesis renamed tomaxFrontmatterBytes.skillFrontmatterBlock(content)is new in@bb/skill-index/metadata, next toparseSkillMetadata. It returns the file only through its closing---delimiter. Parsing that block gives the same result as parsing the whole file, because gray-matter's data and the opening-delimiter check depend only on text before the first\n---after the opener. A file with no---returns""and gets the same "must start with a plain --- delimiter" error. An unterminated block returns the whole file, as before.command-handlers/workspace-agent-context.ts):oversized.maxFrontmatterBytes: 4 MiB, which is about 1,000 skills × 4 KiB, instead of 32 MiB. It parsesskill.frontmatterwith the sameresolveProjectSkillSourceFromContent. The budget-exceeded warning now names the frontmatter budget.docs/debugging-and-qa.md("Workspace Context Read Limits") describes the new policy.Not done (from the report's optional steps): the per-(host, workspace) digest cache and daemon-pushed invalidation. The serial round trip before
turn.submitremains; only its payload shrinks.How you verified
Tests
packages/skill-index/test/metadata.test.ts(new): for 16 SKILL.md shapes, the block is a prefix of the file andparseSkillMetadata(block)deep-equalsparseSkillMetadata(content). The shapes are plain, CRLF, BOM,---yaml, an empty block, a-----closer, a multiline description, unterminated, leading whitespace (closed and unclosed), no opener, no delimiter at all, a----opener, invalid YAML,---only, and empty.apps/host-daemon/.../workspace-agent-context.test.ts: asserts only frontmatter is returned. A new budget case gives each file a 5 KB body to show the body never counts against the budget.pnpm exec turbo run typecheck lint --filter=@bb/host-daemon --filter=@bb/server --filter=@bb/host-daemon-contract --filter=@bb/skill-indexturbo run testfor@bb/skill-index,@bb/host-daemon(workspace-agent-context),@bb/host-daemon-contract, and@bb/server(thread-runtime-config, public-project-commands, skills/, public-project-workspace-routing).Real servers, main (
af25b0b5a6) vs this branch, same inputSetup:
pnpm start --perf-diagnosticson its own fresh data dir under thread storage, never~/.bb.daemon-bundle.mjs, separate data dir) behind a TCP proxy that adds 100 ms each way (200 ms RTT).host-rpc.requests and response sizes per action.af25b0b5a6(9 project skills, 70.6 KB of SKILL.md).GET /projects/:id/commands?provider=claude-code&hostId=…(slash menu), 1.5 s apart, and 8 real Claude Code (haiku) turns per host viaPOST /threads/:id/send. Turn timings come from the server'sTurn tracelog.read_workspace_agent_context,turn.submit)turn.submitsent 35.3 / 45.2 → 34.5 / 49.5 msturn.submitsent 251.5 / 272.5 → 253.1 / 279.3 mslist_commands,read_workspace_agent_context);plugin.host.callandprovider.list_commandsjoin on cache expiry, same on bothturn.submitrequest is 19,755 B on both builds, so the agent gets the same skill sources.🤖 Generated with Claude Code