@fahrizkyputra/pi-fast-tools
Fewer and faster tool calls for Pi: recursive grep skips node_modules/build output, tests and builds get a timeout, tsc gets a bigger heap, and the model is told to batch calls and use rg/fd. Optional codemode auto-enable.
Package details
Install @fahrizkyputra/pi-fast-tools from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@fahrizkyputra/pi-fast-tools- Package
@fahrizkyputra/pi-fast-tools- Version
0.3.0- Published
- Oct 27, 2026
- Downloads
- 812/mo · 261/wk
- Author
- fahrizkyputra
- License
- MIT
- Types
- extension
- Size
- 50.1 KB
- Dependencies
- 0 dependencies · 1 peer
Pi manifest JSON
{
"extensions": [
"./extensions/fast-tools.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-fast-tools
Fewer and faster tool calls for Pi.
In long coding sessions most of the wall time goes to two things: the model taking one small step per turn (one grep, one read, one test), and slow or hung shell commands. This extension attacks both.
What it does
1. Guards model-issued bash calls
| Command | Rewrite | Why |
|---|---|---|
grep -r / -R / egrep -r / command grep -r |
adds --exclude-dir= for node_modules, .git, .next, .turbo, .worktrees, dist, build, out, coverage, storybook-static, .venv, __pycache__ |
same results without walking dependencies and build output (4.5 s → 0.8 s on a large Next.js repo) |
vitest, jest, bun test, tsc, eslint, pytest, playwright test, next build, npm/pnpm/yarn/bun run build|test|lint|typecheck, verify*.mjs |
sets bash timeout to 600 s |
a hung test run cannot block the session |
tsc / tsgo |
prefixes NODE_OPTIONS=--max-old-space-size=8192 |
large projects abort on the default heap |
Your explicit choices always win: an existing timeout, NODE_OPTIONS, or --exclude-dir is never overridden. A grep that targets an excluded directory on purpose (grep -r x node_modules/next) is left alone. Dev servers and watchers (nohup, next dev, vite, --watch, -w, trailing &) never get a timeout.
grep is deliberately not rewritten to rg. Their flags differ (-r, -E, --include), and a silent mistranslation would return wrong results.
2. Adds tool-speed rules to the system prompt
A <tool_speed> section tells the model to:
- batch independent reads and searches in one message (parallel tool calls)
- use
codemodefor fan-out when it is active - search with
rg/fdinstead ofgrep -r/find - read with
read+offset/limitinstead of repeatedsed -n/cat - run only the tests the change touches, with a timeout and filtered output
- run full typechecks once at the end, and long-lived processes in the background
Lines that name a tool only appear when that tool is active.
The section opens by deferring to project instructions: when a repo's AGENTS.md / CLAUDE.md forbids running tests without permission, or requires build/lint/typecheck through a specific subagent or command, the model follows the project instead of these generic rules.
3. Optionally enables codemode
Pi's built-in codemode tool lets the model run many tool calls from one script in parallel and return only a filtered result. Turn it on with fastTools.codemode: true, or natively with "defaultTools": ["+codemode"].
Install
pi install npm:@fahrizkyputra/pi-fast-tools
Then /reload in a running session, or start a new one. Guard and rules are on right away; codemode is off until you turn it on.
Commands
/fast-tools show the effective configuration
/fast-tools status same
/fast-tools codemode-on activate codemode now and save fastTools.codemode: true
/fast-tools codemode-off deactivate codemode now and save fastTools.codemode: false
/fast-tools guard-on|off bash rewrites (grep excludes, timeout, tsc heap)
/fast-tools rules-on|off the <tool_speed> prompt section
Toggles apply to the next tool call or model request without a reload, and are saved to the user settings file (~/.pi/agent/settings.json) so new sessions start the same way. Only fastTools.<key> is written; every other setting is kept. Tab completes the arguments.
Two things can still override a saved toggle in new sessions, and the command tells you when it sees them:
- a project
.pi/settings.jsonwith its ownfastToolsvalue; "defaultTools": ["+codemode"], which turns codemode on regardless offastTools.codemode. Remove it if you wantcodemode-offto stick.
Configure
All keys are optional. Put them in ~/.pi/agent/settings.json, or in a project's .pi/settings.json to override them for that project.
{
"fastTools": {
"guard": true,
"rules": true,
"codemode": false,
"timeoutSeconds": 600,
"tscHeapMb": 8192,
"extraExcludeDirs": ["vendor"]
}
}
| Key | Default | Meaning |
|---|---|---|
guard |
true |
rewrite bash calls (section 1) |
rules |
true |
add the <tool_speed> prompt section |
codemode |
false |
activate codemode at session start |
timeoutSeconds |
600 |
automatic timeout; 0 disables it |
tscHeapMb |
8192 |
tsc heap; 0 disables it |
excludeDirs |
list above | replaces the exclude list |
extraExcludeDirs |
[] |
appended to the exclude list |
Settings are read on every call, so edits apply without a restart.
jcode
The same package also works in jcode. jcode has no in-process extensions, so the jcode side is a tool-input hook plus a prompt overlay:
npx -y @fahrizkyputra/pi-fast-tools jcode install # needs Node 22.18+
| Pi | jcode |
|---|---|
| bash guard: grep excludes, tsc heap | same, as a [hooks] pre_tool_transform command in ~/.jcode/config.toml (live within seconds) |
| bash timeout 600 s on tests/builds | not added: jcode already bounds every bash call (120 s default) and moves an overrun to the background |
<tool_speed> prompt section |
a "Tool speed" block in ~/.jcode/prompt-overlay.md, phrased for jcode's tools (batch, agentgrep, read start_line, timeout in ms); new sessions |
/fast-tools … |
jcode-fast-tools status | guard-on|off | rules-on|off (settings in ~/.jcode/pi-fast-tools.json) |
| codemode toggle | not offered: in jcode it is [tools] codemode = true |
The installer copies the code to ~/.jcode/plugins/pi-fast-tools/ (Node will not run TypeScript from node_modules), and links jcode-fast-tools into ~/.local/bin when that is on PATH and free. It edits only its own command in [hooks] and its own marked block in the overlay; the first edit keeps config.toml.pi-fast-tools.bak. A broken hook fails open: jcode runs the call unchanged.
Update: run the install line again. Remove: jcode-fast-tools uninstall.
More speed, outside this package
- Thinking level. Each turn at
xhighis much slower than athigh. UsehighasdefaultThinkingLeveland raise it only for hard problems. - Project-specific notes (which test command is right, how long the full typecheck takes) belong in that repo's
AGENTS.md.
Develop
npm install
npm test # unit + wiring tests
npm run typecheck
npm run test:e2e # real pi process with a scripted faux model, no API key
node scripts/e2e-rpc.mjs --without-extension # must fail: proves the e2e bites
node scripts/e2e-toggle.mjs --without-extension # must fail too
License
MIT