onlyterp/prompt-cache-skills/aider-1h-ttl
Claude Code and agent skill by onlyterp/prompt-cache-skills
- community
Checking that the SKILL.md file is still in the repository.
Aider uses 5min TTL by default and works around long pauses with keepalive pings. Wire up the 1h TTL beta instead.
Install
npx vskill@latest install onlyterp/prompt-cache-skills/aider-1h-ttlSKILL.md
Aider: enable Anthropic 1-hour cache TTL
Target
aider/coders/chat_chunks.py, aider/sendchat.py, aider/args.py in Aider-AI/aider.
Symptom
Aider uses the 5-minute default cache TTL. For chat-style sessions where the user reads code, thinks for 10 minutes, then types — common flow — the cache expires between turns. The current workaround is --cache-keepalive-pings N which sends a trivial request every 5 minutes to refresh the cache, but you pay for those pings.
Anthropic's extended-cache-ttl-2025-04-11 beta extends the TTL to 1 hour for a 2x write premium (vs 1.25x for 5min). Break-even is ~4 reads, which any active chat session clears.
Fix (three parts)
Part A — accept the flag
Part B — thread it through the message builder
Part C — set the beta header when active
Wire args.extended_cache_ttl from the Coder constructor through format_messages() and send_completion().
Verify
- Run with
--cache-prompts --extended-cache-ttl --no-stream. - Capture wire.
- Request headers should include
anthropic-beta: extended-cache-ttl-2025-04-11.
- Request body cache_control blocks should be
{"type": "ephemeral", "ttl": "1h"}.
- Wait 6 minutes. Send another prompt.
- Response
usage.cache_read_input_tokensshould still cover the
prefix — proof the cache survived the >5min gap.
Background
The 1h TTL beta exists for exactly this use case: human-in-the-loop sessions with long thinking gaps. Trade-off: 2x write cost vs 1.25x. Worth it whenever the session has ≥4 turns within the hour.
Aider users who already use --cache-keepalive-pings 5 are paying for both: keepalive pings AND repeated cache writes. The 1h TTL beats this on both fronts.
See docs/concepts/anthropic.md § "TTL" and "Pricing".
Full audit: audits/aider.md.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/aider-1h-ttl/SKILL.md
Popularity
- Repository stars
- 114
- Repository forks
- 9
- 7-day trend score
- 24
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/onlyterp/prompt-cache-skills/aider-1h-ttl)