prxy.monster API-key BYOK is live. Start free

tool-cache

Category: cache · Cloud + Local · Status: v1.0 — observation mode

Solves the “agent reads the same file 14 times in one session” problem.

Current limitation: the module observes and records tool calls + results, and detects when a future request would hit cache (visible via metadata). It does NOT yet rewrite requests to inject cached results in place of tool_use blocks because Anthropic strictly requires every tool_use to be answered by a real tool_result from the client. Active cache injection is planned.

What it does (v1)

When to use it

Configuration

tool-cache:
  ttlSeconds: 60                          # default: short TTL — file content can change
  excludeTools:                           # never cache side-effecting tools
    - bash
    - shell_exec
    - send_email
    - write_file
  perToolTtl:                             # override TTL per tool
    read_file: 30
    git_log: 300

Default exclusions

The following tool names are always excluded, even if you don’t list them:

You can add to this list via excludeTools, but you cannot remove from it.

Metrics emitted

Safety

Failed tool calls (isError: true) are never cached — caching errors would prevent the agent from ever recovering. The TTL defaults are short (60s) because tool results are by nature time-sensitive (a file’s contents can change between calls).

Source

src/modules/tool-cache.ts