sanitize_command
Rewrites shell commands stage by stage to prune lockfiles and cap verbose git, Docker, Kubernetes, and search output, cutting token use while preserving compound operators.
Instructions
Per-stage shell command rewrites: prunes lockfiles, caps unbounded git log/show/blame/rg and docker/kubectl logs, quiets npm/pip installs, bounds cat/curl output. Compound commands (a && b ; c) are optimized per stage without breaking operators. For unit-test runs prefer the tests CLI wrapper (tokensafe tests [pytest]) over raw python3 -m unittest discover. Pass cwd for test-runner commands: the guard reads /package.json to force jest/vitest into run-once mode (CI=true, --watch=false, --forceExit) so agents never hang on watch mode.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"command": "<command>"
},
"name": "sanitize_command"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional working directory the command will run in; enables the package.json peek that identifies the runner behind opaque yarn/npm test scripts | |
| command | Yes | Raw bash command line |