A Claude Code plugin that caches full Bash command outputs and lets you retrieve them via MCP tools.
Claude Code truncates long command outputs to fit its context window — often appending | tail or only showing the last few hundred lines. When you later need the beginning of that output (where errors often are), the only option is to re-run the command.
This plugin fixes that by caching every Bash command's complete output and exposing MCP tools to selectively re-read it: paginated, grepped, or in full.
[Claude Code] --PostToolUse hook--> [cache writer] --> /tmp/claude-output-cache/*.json
[Claude Code] --MCP tools-------> [cache reader] --> /tmp/claude-output-cache/*.json
- A PostToolUse hook fires after every Bash command, capturing the full output to a JSON file
- An MCP server exposes tools to list, read, grep, and inspect cached outputs
- Claude can use these tools to revisit any output without re-running commands
# Install
git clone https://github.com/youruser/claude-output-cache ~/Projects/claude-output-cache
cd ~/Projects/claude-output-cache
uv tool install -e .
# Setup (adds hook + registers MCP server)
claude-output-cache setup
# Restart Claude Code| Tool | Description |
|---|---|
list_cached_outputs |
Browse recent cached command outputs (metadata only) |
read_cached_output |
Read full or partial output with line-based pagination |
grep_cached_output |
Search cached outputs with regex, with context lines |
cache_status |
Cache stats: entry count, total size, age range |
Environment variables (all optional):
| Variable | Default | Description |
|---|---|---|
CLAUDE_OUTPUT_CACHE_DIR |
/tmp/claude-output-cache |
Cache directory path |
CLAUDE_OUTPUT_CACHE_MAX_AGE_HOURS |
4 |
Auto-evict entries older than this |
CLAUDE_OUTPUT_CACHE_MAX_SIZE_MB |
100 |
Max total cache size before eviction |
CLAUDE_OUTPUT_CACHE_MAX_OUTPUT_BYTES |
5242880 (5MB) |
Max single output size (truncates) |
claude-output-cache setup # Install hook + MCP server
claude-output-cache status # Show cache stats
claude-output-cache clean # Force eviction
claude-output-cache remove # Uninstall hook + MCP serverclaude-output-cache remove
uv tool uninstall claude-output-cacheMIT