Opencode agent/skill surgery - #7095
Open
jasnell wants to merge 4 commits into
Open
Conversation
The prompt had grown into a reference manual loaded on every turn: 22,385 characters, of which the skill-loading rules appeared four separate times and "Core Analysis Areas" restated guidance already delivered by the checklists it tells the agent to load. Sampling ten topics from the coding patterns section, nine were already covered by kj-style.md or its mandatory detail/review-checklist.md. Cut to 11,114 characters with no loss of routing information: - Collapse the four copies of the skill-loading rules into one list. - Replace Core Analysis Areas with the workerd-specific rules the loaded checklists do not cover, dropping the generic and self-duplicating bullets. - Convert the mode descriptions from paragraphs to one line each. Only one mode is ever active, but all eleven are in every request. - Point at the reference docs directly rather than at the skills that wrap them, saving a hop for identical content. The wrappers stay, since they are how other agents discover the docs by description. - Use lists rather than markdown tables, which prettier pads out. Rewrite the context-gathering section around the in-repo tools, which were mostly unmentioned: cross-reference and bazel-deps were named, while jsg-interface, compat-date-at, ci-report and next-capnp-ordinal were not. Everything it points at ships in this repository, so the guidance holds for every developer rather than depending on local MCP configuration. Two permission fixes: - 'gh api *' was 'ask' while the review workflow requires gh api to fetch prior review comments, so every PR review stalled on a prompt. Read-only pulls endpoints are now allowed; everything else still asks. - Deny cat, head, tail, find and ls. The agent is told to use the Read and Glob tools, which number lines and bound their output; allowing the shell equivalents only invited unbounded reads into a context window whose occupancy directly limits review quality.
A balanced review was a single linear pass: load five checklists, read the diff, read the dependencies, write findings. Two things go wrong. Attention is split across five orthogonal checklists at once, which covers each of them less thoroughly than a focused pass would. And by the time findings are written the checklists are tens of thousands of tokens back, in a context now full of source code. Add three read-only subagents, each loading exactly one checklist: review-safety memory safety, thread safety, lifetimes, V8/GC review-api performance, API design, compatibility, security, standards review-style KJ/C++, Rust or TypeScript conventions, by file type The architect launches them in parallel and becomes the synthesiser: merging findings, dropping cross-axis duplicates, and surfacing genuine conflicts between axes rather than silently picking a side. That last part is what the existing conflicting-recommendations rule always described but could not do, having only one reviewer to arbitrate between. Each subagent fetches the diff itself from a command the architect passes, so the diff is not re-emitted into three task prompts. Each returns findings in the shared format and nothing else, capped at fifteen, plus a "Cleared:" line so the architect can tell a clean axis from an unexamined one. They cannot edit, and cannot spawn further subagents. The fan-out is skipped where it cannot pay for itself: quick reviews, single-axis modes where the architect would only relay one reviewer's output, and changes small enough to read directly. Primary-context instruction load for a balanced C++ PR review drops from ~58,500 to ~21,300 characters, since the checklists now load inside the subagents. Total tokens billed goes up: this trades cost for review depth and for headroom in the context that writes the final report. The subagents inherit the default model; pin a cheaper one in their frontmatter if that trade stops being worth it.
This comment was marked as resolved.
This comment was marked as resolved.
jasnell
force-pushed
the
jasnell/agent-surgery
branch
from
August 22, 2026 01:34
4fc2ce5 to
bb13bbc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
jasnell
force-pushed
the
jasnell/agent-surgery
branch
from
August 22, 2026 01:50
bb13bbc to
b136d62
Compare
Collaborator
Author
|
/bonk review again |
Contributor
|
Posted 5 actionable inline findings. Time for a pun! Those reviewer permissions need to stop redirecting the conversation. |
jasnell
force-pushed
the
jasnell/agent-surgery
branch
from
August 22, 2026 02:21
b136d62 to
1d1e0da
Compare
Collaborator
Author
|
/bonk check again |
Contributor
|
Posted 1 actionable inline finding. Here's a joke for you: Why did the token avoid |
jasnell
force-pushed
the
jasnell/agent-surgery
branch
from
August 22, 2026 02:25
1d1e0da to
104ffda
Compare
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.
Cleaning up refining opencode skills, agents, and tools