@bacnh85/pi-deepseek-tools
Pi extension that improves OpenCode Go DeepSeek V4 (Flash and Pro) tool selection, tool input repair, and find-misuse interception.
Package details
Install @bacnh85/pi-deepseek-tools from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@bacnh85/pi-deepseek-tools- Package
@bacnh85/pi-deepseek-tools- Version
0.5.0- Published
- Jul 7, 2026
- Downloads
- 705/mo · 705/wk
- Author
- bacnh85
- License
- MIT
- Types
- extension
- Size
- 65.8 KB
- Dependencies
- 0 dependencies · 2 peers
Pi manifest JSON
{
"extensions": [
"./extensions/index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-deepseek-tools
Improves OpenCode Go DeepSeek V4 (Flash and Pro) tool selection and fixes common tool-input mistakes in Pi.
Scope: opencode-go/deepseek-v4-flash and opencode-go/deepseek-v4-pro. Does not affect direct deepseek provider requests, GPT/OpenAI models, or any other provider/model.
The extension does not print prompts, tool schemas, API keys, or response bodies.
What it does
Tool-selection guidance — Injects concise, model-specific rules before each agent turn when relevant tools are active, so the model:
- calls exactly one Pi tool name (never invents
read_file,search_files, etc.); - prefers Serena semantic tools for code navigation, references, and refactoring;
- uses
readafter Serena identifies the relevant region, or for docs/config/non-code files; - uses
ls,grep,find, orreadfor simple file/text work instead of shelling out; - uses
bashonly for real commands (tests, builds, git, package-manager, process execution); - treats path fields as filesystem paths, never markdown links or auto-links;
- inspects with the right tool first, then calls
edit.
Tool-input repair — Wraps Pi's built-in file/shell tools to fix common recoverable argument mistakes before validation:
nullon optional fields → omitted;- JSON strings parsed where the schema expects an array/object;
{}placeholders →[]where an array is expected;- bare strings wrapped as single-item arrays;
- degenerate markdown auto-links in path fields unwrapped (e.g.
[notes.md](http://notes. md)→notes.md); readwith onlylimitdefaults tooffset: 1; with onlyoffsetdefaults tolimit: 2000.
Valid inputs pass through unchanged (except for path auto-link cleanup).
Optional strict mode — Set PI_DEEPSEEK_TOOLS_STRICT_SERENA=1 to block obvious misses (reading code files before Serena, using bash where a dedicated Pi tool is active). Strict mode is opt-in because normal workflows sometimes legitimately need read or bash.
Scope
Runtime hooks are guarded — these models are unaffected:
deepseek/deepseek-v4-flashanddeepseek/deepseek-v4-proopenai-codex/gpt-5.5- all other providers/models
Enable
Add to /Users/bacnh/.pi/agent/settings.json:
"/Volumes/Dev/agents/pi-extensions/pi-deepseek-tools"
Then restart Pi or run /reload in an existing session.
Environment variables
| Variable | Default | Effect |
|---|---|---|
PI_DEEPSEEK_TOOLS_SELECTION_GUIDANCE=0 |
on | Disable tool-selection guidance. |
PI_DEEPSEEK_TOOLS_STRICT_SERENA=1 |
off | Block obvious Serena/dedicated-tool misses. |