Repository navigation
docs: add prompt caching FAQ (RTK does not break cache) - #560
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a dedicated FAQ-style explanation to address whether RTK interferes with Claude prompt caching, and cross-links it from the main docs and README so the answer is easy to find.
Changes:
- Added a new canonical doc (
docs/PROMPT_CACHING.md) explaining what RTK changes, how caching works turn-by-turn, and how to verify viartk gain. - Added a new top troubleshooting entry linking to the full prompt-caching explanation.
- Added a one-line README FAQ blurb near “How It Works”, plus corrected the architecture module total.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| docs/TROUBLESHOOTING.md | Adds a new top “Problem/Short Answer/Details” entry and links to the full prompt caching doc. |
| docs/PROMPT_CACHING.md | New standalone explanation of prompt caching behavior and RTK’s impact, with examples and a cost comparison. |
| README.md | Adds a prominent FAQ blockquote linking to the new prompt caching doc. |
| ARCHITECTURE.md | Updates the module count total line. |
Comments suppressed due to low confidence (1)
ARCHITECTURE.md:301
- The updated total (64 = 38 command + 26 infrastructure) conflicts with the breakdown immediately below (Command Modules: 34, Infrastructure Modules: 20). Please reconcile these counts so the section is internally consistent.
**Total: 64 modules** (38 command modules + 26 infrastructure modules)
### Module Count Breakdown
- **Command Modules**: 34 (directly exposed to users)
- **Infrastructure Modules**: 20 (utils, filter, tracking, tee, config, init, gain, toml_filter, verify_cmd, etc.)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This PR has merge conflicts with git fetch upstream develop
git rebase upstream/develop
git push --force-with-leaseLabeling |
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
|
Hey @FlorianBruniaux , i think a mention about this in the root README.md "FAQ" section is enough, TROUBLESHOOTING as well for deeper explanation. Could we clean to only keep in FAQ + Troubleshooting ? I do not think a dedicated markdown file is necesarry for this |
Users asked whether RTK breaks Claude's prompt cache. Short answer: no. RTK filters output once, the result is cached normally. Smaller outputs also improve cache economics (cheaper writes and reads). - Add FAQ blockquote in README after 'How It Works' section - Add TROUBLESHOOTING.md with Problem/Short Answer/Details pattern Signed-off-by: Florian BRUNIAUX <[email protected]>
bee819b to
cd9f1a9
Compare
The section landed in docs/TROUBLESHOOTING.md, a flat file removed in a94e949 when the docs were consolidated. Content there does not reach the published guide, and the copy reintroduced install guidance that develop had already pinned to --branch master. Move the answer into docs/guide/resources/troubleshooting.md and drop the duplicated Type Kit collision section, which that guide already covers. The cache write/read breakdown is reported by `rtk cc-economics`, not by `rtk gain`, so point readers at the command that actually shows it. Co-Authored-By: Claude Opus 5 <[email protected]>
KuSh
left a comment
There was a problem hiding this comment.
Round 1 of 3 — APPROVED (fixup pushed)
Claim: answer the recurring "does RTK break Claude's prompt cache?" question in the README and the troubleshooting docs.
Scope: accept. The answer is correct and worth publishing — the placement and one command name were wrong, and both are now fixed on the branch. No competing PR or maintainer branch touches these files.
Ran: built the merged head against current develop; rtk gain, rtk gain --help and rtk cc-economics against a real 190k-command database; the weight constants in cc_economics.rs; path, link and anchor checks across develop. Docs-only, so the savings floor does not apply.
Thanks for this — the question comes up often enough that having a canonical answer is genuinely useful, and the reasoning in it is right.
Blocks merge (2, frozen at round 1) — both closed by c81c0977
1. rtk gain does not report cache metrics. The doc's one actionable step named the wrong command:
$ rtk gain
Total commands / Input tokens / Output tokens / Tokens saved / Total exec time
-> no cache line at all
$ rtk cc-economics
Cache writes: 215.2M
Cache reads: 8645.4M
Routing confirms it: Commands::CcEconomics -> src/analytics/cc_economics.rs (cc_cache_create_tokens / cc_cache_read_tokens), while gain --help exposes no cache flag and src/analytics/gain.rs never mentions cache. In the one doc written to settle a credibility question, a sceptic following the verification step would have found nothing. Checked every .md on develop — no other doc makes this claim, so it was a single site, not a class.
2. docs/TROUBLESHOOTING.md is a deleted path. It was removed (337 lines) in a94e9493 "consolidate to user-facing guide, remove duplicates and legacy flat docs"; the live page is docs/guide/resources/troubleshooting.md, which is what the pipeline ships to rtk-ai.app and what docs/guide/index.md links. Content added there never reaches the docs site — so the answer, which is the point of the PR, would not have been published.
It also re-published install guidance develop had deliberately corrected:
develop: cargo install --git https://github.com/rtk-ai/rtk --branch master ("pinned to the release branch")
this PR: cargo install --git https://github.com/rtk-ai/rtk
What I pushed
Two commits, no force-push — your commit is untouched:
faaa446bmergedevelopinto the branch (clears the conflict flagged in March)c81c0977move the answer intodocs/guide/resources/troubleshooting.md, point the README at it, namertk cc-economics, and drop the duplicated Type Kit collision section that the guide already covers in a fuller version
README.md | 2 ++
docs/guide/resources/troubleshooting.md | 17 +++++++++++++++++
cargo fmt --all --check, clippy --all-targets, cargo test --all (3359 passed, 0 failed), clean merge into develop, README anchor resolves, frontmatter intact.
One thing worth recording, because it nearly bit me too: my first attempt used a relative link to docs/guide/troubleshooting.md, which resolved on the branch but 404s after merge, since develop had moved the file into resources/. Rename detection carried the content edit across but left the link text on the old path — the same failure as finding 2, reintroduced by the fix for it. Merging develop in first is what removed it.
Rolled into the fixup rather than filed as threads
- The README blockquote pointed at a second, local troubleshooting destination while
README.md:20and:457already route to the guide. - "RTK does not alter the prefix" is falsifiable as written —
rtk initinjects@RTK.mdintoCLAUDE.md(src/hooks/init.rs:151), which is cached prefix. Reworded to the accurate and stronger claim: RTK's contribution is stable, written once and cached thereafter. Worth keeping precise, since this doc exists to convince a sceptic. - The duplicated collision section had further problems that vanish with it: the fix omitted
cargo uninstall rtk, so it aborts with "binary already exists" in exactly the scenario it addresses; and it gave the symptom ascommand not found, which is the separate PATH failure — Rust Type Kit actually printsrtk: 'gain' is not a rtk command.
Checked and correct — no need to re-verify
- "cache writes 1.25x, reads 0.1x" matches
WEIGHT_CACHE_CREATE/WEIGHT_CACHE_READincc_economics.rs:20-21and Anthropic's published ratios. - The core argument is sound: filtered output is written into history once and never recomputed, so nothing already cached is rewritten.
- All CI green;
BLOCKEDwas onlyREVIEW_REQUIRED.
Hypotheses built and dropped
rtk cc-economicsbreaks the docs contract's "onlyrtk gain/init/verify/proxyare user-typed". Dropped —docs/guide/already usesrtk telemetry(12),rtk discover(10),rtk session(5),rtk trust(3),rtk config(2). The list is stale, not enforced.- The
doc reviewCI job should have caught the dead path. Dropped — it is an AI reviewer overCONTRIBUTING.mdrules and does not validate link targets.
Your questions
- @aeppling — "Could we clean to only keep in FAQ + Troubleshooting? I do not think a dedicated markdown file is necessary": done, by the author at
cd9f1a98.docs/PROMPT_CACHING.mdis gone; README + troubleshooting only. The one gap was that "TROUBLESHOOTING" was read as the old flat path, which the fixup retargets. Your instruction is fully satisfied. - @pszymkowiak — "merge conflicts with
develop": resolved byfaaa446b. Theawaiting-changeslabel can come off. - Copilot's thread on
docs/PROMPT_CACHING.md("12.5x doesn't match the numbers"): no longer relevant, that file does not exist at head. Resolving it.
Separately, the PR description still describes docs/PROMPT_CACHING.md and an ARCHITECTURE.md count fix that are not in the diff — worth a quick edit, not a blocker.
Six other files (INSTALL.md, README_es/fr/ja/ko/zh.md) still carry 12 links to the deleted docs/TROUBLESHOOTING.md. Pre-existing and outside this PR; it is being folded into the wider documentation review rather than filed separately.
Next
Nothing — approving. Merges as-is.
Rounds: 1/3. Threads: 1 resolved this round (fixup-closed and outdated included).
Summary
Closes a recurring question (raised publicly by Mathieu GRENIER): does RTK break Claude's prompt cache and make input 10x more expensive?
docs/guide/resources/troubleshooting.md, the guide published at rtk-ai.app/guide/troubleshooting: the answer, why smaller tool results make caching cheaper (writes bill at 1.25x, reads at 0.1x), andrtk cc-economicsas self-serve proofREADME.mdafter "How It Works": one-liner answer with a link, for scannersReview changes
The first version added
docs/PROMPT_CACHING.md; per review feedback it was reduced to README + troubleshooting only. Two follow-up commits were pushed during review:faaa446bmergedevelopinto the branch, clearing the merge conflictc81c0977move the answer fromdocs/TROUBLESHOOTING.mdinto the published guidedocs/TROUBLESHOOTING.mdis a flat file removed ina94e9493when the docs were consolidated, so content added there never reaches the docs site, and the copy reintroduced an unpinnedcargo install --gitthatdevelophad already pinned to--branch master. The same commit correctsrtk gaintortk cc-economics—rtk gainreports token savings only, the cache write/read breakdown lives incc-economics— and drops a duplicated Type Kit collision section that the guide already covers more fully.Test plan
docs/guide/resources/troubleshooting.mdrenders correctly (frontmatter intact, section lands before "Run the diagnostic script")README.mdblockquote renders, and its#does-rtk-break-claudes-prompt-cacheanchor resolves against the target filedocs/TROUBLESHOOTING.mdpath in the touched filescargo fmt --all --check,cargo clippy --all-targets,cargo test --all(3359 passed, 0 failed)develop🤖 Generated with Claude Code