OpenCode plugin that adds a Librarian subagent for remote code research
npm install opencode-librarianOpenCode plugin that adds a Librarian subagent for remote code research. It is designed for deep source investigation across repositories, with long-form answers that cite evidence and point to permalinks when code details matter.
Default model configuration:
- This plugin ships with a default model defined in src/constants.ts.
- Recommended default: gemini-3-flash.
- To override it, set the agent model in your OpenCode config, for example:
``json`
{
"agent": {
"librarian": {
"model": "gemini-3-flash"
}
}
}
Example prompts:
- "Use the Librarian to look up how React's useEffect cleanup is implemented."
- "Ask the Librarian to explain why this Zod validation error occurs and show the logic causing it."
- "Use the Librarian to trace how our docs get deployed across the docs and infra repos."
`bash`
bun install
bun run build
Add the plugin to ~/.config/opencode/opencode.json:
`json`
{
"plugin": [
"file:///Users/andrew/dev/opencode-librarian"
]
}
bash
bun install
bun run build
``