Smart tools: cut Claude Code’s needless reads and output
Most of the tokens an agent spends come not from the code it writes but from the files and command output it reads. AgentVera’s smart tools run as hooks between Claude Code and its tools and stop what isn’t needed before it reaches the model. All four are on by default and can be turned off one by one under Settings → Token savings.
Block needless file reads
If a file already read in the conversation, and unchanged since, is read again with cat, head, tail or sed -n, the request is refused and the agent is told the content is already in its context. On the first full read of a file over 800 lines and 24 KB, the agent gets the file’s outline from the project map instead and reads only the line ranges it needs. Repeating the same request goes through; /compact or /clear resets this memory.
Run only the affected tests
A command that runs the whole test suite, such as “npx vitest run”, “jest” or an “npm test” whose script is vitest or jest, is narrowed to the tests of the uncommitted changes and of files importing them, up to two levels. If more than 40 test files are affected, the whole suite runs. The agent is told what was narrowed and can run everything with AGENTVERA_ALL_TESTS=1.
Error check right after an edit
Before a TS/JS file is edited, the current errors of that file and of up to 8 files importing it are recorded. After the edit they are checked again with the project’s own TypeScript and ESLint, and only new errors go back to Claude in the same turn. Warnings are left out and the check is capped at 8 seconds.
Shared results between agents
When the same lint, type check, test or build command runs again in the same folder on exactly the same code, whether this agent or a parallel one ran it, the earlier output comes back and the agent is told who ran it and how many minutes ago.
- Covered: eslint, tsc, vitest run, jest, biome, ruff, mypy, pytest, cargo, go vet, test and build, and npm, pnpm and yarn lint, typecheck, check, test and build scripts.
- Chained commands, --watch, --fix and --write aren’t cached; results are kept for 30 minutes.
- Running the command again right after a cached answer forces a fresh run.
Questions
Which agents do they work with?
All four run on Claude Code hooks, so only local Claude Code agents. For Codex there is RTK and the project map.
Where do I see the savings?
The smart tools block under Settings → Token savings and the “Smart tools savings” tile in the AI ROI tab show the total for this computer. The estimate is based on the length of output that never reached the model.
Are Verify or pre-commit checks narrowed too?
No. Test narrowing applies only to commands the agent runs itself.
Can I turn them off?
Yes. Each has its own switch under Settings → Token savings, and changes take effect right away.
Related features
Related terms:Claude Code hooksContext windowToken
Bring your agents to one desk.
Start on the free plan. Download it, add a project folder and open your first agent.