opencode-tsindex-guidance
v0.2.0
Published
An opencode plugin that nudges agents toward tsindex MCP code navigation and warns on costly full-file reads.
Maintainers
Readme
opencode-tsindex-guidance
An opencode plugin that adds tsindex code-navigation guidance to each session and nudges agents away from expensive full-file reads when mcp__tsindex__* tools are a better fit.
Problem
When a workspace has tsindex MCP tools available, agents can navigate code more precisely by asking for file outlines, symbols, references, and enclosing symbols instead of reading whole files. Without a reminder in the active system prompt, agents may fall back to broad Read calls and miss the faster structural workflow.
How it works
The plugin registers two hooks:
experimental.chat.system.transformappends concise tsindex navigation guidance to the chat system prompt once per session.tool.execute.beforeprepends the same guidance to subagenttaskprompts, writes a stderr hint when an agent attempts a full-filereadon a tsindex-supported file type, and writes a stderr hint when an agent runsediton one — surfacingreplace_symbolfor whole-symbol rewrites.
The read and edit hints are advisory only. They do not block or rewrite the tool call.
Installation
Add the package to your opencode config:
{
"plugin": [
"opencode-tsindex-guidance"
]
}Then restart opencode so the plugin is loaded.
Supported file types
The full-file read hint applies to common source and documentation files, including TypeScript, JavaScript, Python, Rust, Go, Java, Kotlin, C/C++, CSS, shell scripts, JSON, YAML, and Markdown.
Development
npm install
npm run typecheck
npm run pack:dry-runPublishing
npm login # one-time, opens browser to authenticate with npmjs.org
npm publishThe package is unscoped, so it publishes publicly by default. Bump the version in package.json before each release.
