Repository navigation
feat(skills): gosym answers a Go symbol question in one shell call - #17
Open
sebastian-iancu wants to merge 2 commits into
Open
sebastian-iancu wants to merge 2 commits into
sebastian-iancu wants to merge 2 commits into
Conversation
A week of agent sessions showed reviewers and workers asking gopls for a
symbol's uses in under one run in six, and grepping Go files for identifiers
about 3,400 times instead. The shell route took two steps (workspace_symbol,
then copy its position into references), and its first step was flaky:
`gopls workspace_symbol -matcher casesensitive <Name>` lists at most 100
symbols and, past that cap, does not reliably keep the exact one (`Validate`
came back in one run of four on a mid-sized module).
The router now bundles skills/go-coding/scripts/gosym:
gosym [-C <checkout>] def|refs|impl|calls <Name> [<path part>]
It queries workspace_symbol anchored at the name's end ('<Name>$', which
stays under the cap for all but the commonest method names, and says so
when it does not), keeps the exact name inside the checkout, asks
references, implementation or call_hierarchy at each definition, and prints
paths relative to the checkout. Exit 1 (no definition) or 3 (gopls missing
or failing) means: use grep and say so.
The symbol-question procedure in the router, the Cursor rule, go-layout and
go-reviewer now names gosym, with the anchored query as the by-hand route;
the session-start banner names it; install.md gives the allow rule
`Bash(*/skills/go-coding/scripts/gosym *)`, since the path carries the plugin
version. scripts/gosym-test.sh runs it against a stub gopls, and CI runs that.
go-reviewer's tools stay Read, Grep, Glob, Bash and Skill: gopls runs through
Bash. The LSP tool is not added, since the Claude Code docs do not say
whether a deferred tool in an agent's allowlist is callable, nor that the
LSP tool follows a worktree.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Over a week of agent sessions,
go-reviewerand implementation workers asked gopls for a symbol's uses in under one run in six. They grepped Go files for identifiers about 3,400 times instead. Two things got in the way:gopls workspace_symbol, then copied a position by hand intogopls references.gopls workspace_symbol -matcher casesensitive <Name>lists at most 100 symbols and, past that cap, does not reliably keep the exact one. On a mid-sized module,Validatecame back in one run of four.This PR bundles
skills/go-coding/scripts/gosym, which turns a symbol question into one call:workspace_symbolanchored at the name's end ('<Name>$'). That stays under the cap, and is stable across runs, for all but the commonest method names; for those it warns and asks forType.Methodor a path part.references,implementationorcall_hierarchyat each definition, with paths printed relative to the checkout.The symbol-question procedure in the router, the Cursor rule,
go-layoutandgo-reviewernow namesgosym, and keeps the anchored query as the route by hand. The session-start banner names it too.install.mdadds the allow ruleBash(*/skills/go-coding/scripts/gosym *); the leading*matters because the path carries the plugin version.go-reviewer's tools. They stay
Read, Grep, Glob, Bash, Skill, and gopls already runs throughBash. I did not add theLSPtool: the Claude Code docs do not say whether a deferred tool listed in an agent'stools:can be called, and they say an agent whose listed tools do not resolve may fail to launch, as it would in a session without gopls-lsp. Nor do they say thatLSPanswers for a git worktree, where most reviews run.Verification
./scripts/gosym-test.sh: 16 cases ok against a stubgopls. Can-fail: disabling the inside-the-checkout filter fails "def drops a definition outside the checkout".def,refs … <path part>,impl,callsand-Canswered in 1–9 s.def Validatewas stable over three runs, anddef Closeprinted the cap warning../scripts/validate.shand--selftestOK;./scripts/hooks-test.shOK with the banner case updated;claude plugin validate .passed.Checklist
./scripts/validate.shpassesclaude plugin validate .passes🤖 Generated with Claude Code