built-in-tool-renderer example removes the tools from the model's system prompt
AI-assisted: drafted by my coding agent, reviewed by me.
What happened?
The example packages/coding-agent/examples/extensions/built-in-tool-renderer.ts is meant to change only how read, bash, edit and write look. Loading it also changes what the model is told: the system prompt's tool list becomes (none) and the 7 usage guidelines for these tools disappear.
Cause: the example builds its tools with createReadTool() etc. and copies only name, description, parameters and execute. createReadTool() has no promptSnippet/promptGuidelines; createReadToolDefinition() has them. minimal-mode.ts does the same.
Why it matters: people copy these examples. At least two published rendering extensions have the same drop (pi-claude-code-ui, pi-cc-style-tools), so anyone installing a "display only" extension silently gets a model with different instructions. I noticed while building one and comparing requests.
Related: #3701
Steps to reproduce
- Save as
capture.ts:import { writeFileSync } from "node:fs"; export default function (pi) { pi.on("before_provider_request", (e) => writeFileSync(process.env.OUT, JSON.stringify(e.payload.system, null, 1))); } OUT=stock.json pi -p -ne -e ./capture.ts "hi"OUT=example.json pi -p -ne -e ./capture.ts -e packages/coding-agent/examples/extensions/built-in-tool-renderer.ts "hi"- Compare: the second has
Available tools: (none)and no tool guidelines.
Expected behavior
Same system prompt with and without the example. The examples could spread create…ToolDefinition(cwd) instead of create…Tool(cwd).
Version
0.87.1
Source: earendil-works/pi