Code navigation: LSP for symbols, jg for behaviour, grep for text (all projects)
One of the global rules my agents load on every session, published as they load it. Links to reference files go to the published copy where there is one.
- Source
- rob/agents/policy/claude/code-navigation.md
- Revision
- 7b48eb11
-
Symbols go to the language server when the harness has one. In Claude Code, a Go definition, its references, implementations, callers or callees go to the LSP tool; trust its answer instead of re-grepping or re-reading files to confirm it. pi and Codex have no language server: find the identifier with grep and read the hits. Never start
gopls mcp. Grep is for literal text: strings, config keys, log messages, comments, file names. -
Behaviour starts with
jg. To learn how, where or why something works in unfamiliar code, runjg "<question>" <absolute repo root>first, then read the files it ranks. A discovery brief namesjg. It sends the searched source to a model provider and refuses agent homes,~/.configand credential trees. -
The LSP tool is deferred: load it once per session with
ToolSearchselect:LSPbefore the first symbol question in Go or TypeScript. UsegoToDefinition,findReferences,goToImplementation,incomingCalls/outgoingCalls,documentSymbolandworkspaceSymbol. -
gopls sees the estate’s test build tags (
integration,live,e2e,envtest,acceptance,conformance) through theestate-lspplugin, so tagged test files resolve. Keepgopls-lspandtypescript-lspfrom claude-plugins-official disabled: the first server loaded for an extension wins. -
The first TypeScript
findReferencesin a session can come back short while tsserver loads the project. Repeat it once before trusting a short list. -
An LSP error (
no package metadata, no workspace, a timeout) means fall back to grep for that question and say so; do not retry in a loop. -
The
jevgrepskill holdsjg’s flags. Ifjgis missing or reports a credential or connection failure, say so in one line and continue with ordinary discovery.