docs(hooks): document tee fallback and RTK_DISABLED in Claude agent template - #3454
Open
mrskwiw wants to merge 1 commit into
Open
docs(hooks): document tee fallback and RTK_DISABLED in Claude agent template#3454mrskwiw wants to merge 1 commit into
mrskwiw wants to merge 1 commit into
Conversation
`hooks/claude/rtk-awareness.md` becomes ~/.claude/RTK.md and is the only RTK documentation a Claude Code agent reliably sees. It documented neither the tee file nor the RTK_DISABLED=1 escape hatch, so an agent needing full output had no recorded option but to distrust the filtering entirely. Adds a "When You Need the Full Output" section that routes to the tee file first (byte-complete ground truth, and Read bypasses the hook) and presents RTK_DISABLED=1 second, for when raw output is needed in the same call. Docs only, no behavior change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
RTK_DISABLED=1and the tee-file fallback are both documented on the docs site(
docs/guide/getting-started/configuration.md) and inhooks/README.md, andhooks/pi/rtk.tssurfacesRTK_DISABLEDto the Pi agent directly.hooks/claude/rtk-awareness.mdmentions neither — and that file is the agent'sdocumentation.
rtk init -gwrites it to~/.claude/RTK.mdand@-referencesit into context on every session. For a Claude Code agent, it is effectively the
only RTK docs that exist: nothing else is loaded, and an agent has no reason to
go read the docs site mid-task.
The practical consequence is that an agent which hits a case genuinely needing
raw output has no recorded option. It cannot reach for
RTK_DISABLED=1(neverseen it) and does not know the tee file is byte-complete ground truth. The
fallback it does have is to distrust the filtering — which costs far more
savings than an occasional deliberate opt-out would.
#508 added a stderr warning on
RTK_DISABLED"so agents learn to stopoverusing it". That presumes agents know it exists; today the discovery path for
a Claude Code agent is reading
src/discover/registry.rs.Change
Adds a "When You Need the Full Output" section to
hooks/claude/rtk-awareness.md, documenting, in this order:Readbypasses the hook soretrieving it is free.
RTK_DISABLED=1second — for when raw output is needed in the same call,with explicit guidance to use it deliberately.
The ordering is the point. Routing agents to the tee file preserves token
savings while giving a concrete answer to "I need the full output" — which is
the actual underlying need behind most reflexive opt-outs.
Docs only; no behavior change. Note
RTK_SLIMis also written as Gemini'sGEMINI.md(src/hooks/init.rs:4238), so the Gemini template benefits too.Verification
Measured on v0.44.2, Windows 11, against this repo and a pytest fixture:
git statusls -la src/pytest(2 failures)git diff(small)curl(JSON API)jq-parseableThe pytest row is the one that motivated this. The compact output correctly
named both failing tests and their exception types, and the tee file held the
complete traceback — source lines, variable state, exact line numbers. That is
exactly the behavior the template should be telling agents about.
Escape hatch verified end to end:
Scope
Deliberately limited to the Claude template to keep the diff reviewable. The
same gap exists in
hooks/codex/rtk-awareness.md,hooks/windsurf/rules.md,hooks/cline/rules.md,hooks/antigravity/rules.md, andhooks/kilocode/rules.md. Happy to extend this PR to all of them, or follow upseparately — maintainer's preference.
Checklist
cargo fmt --all --check— cleancargo clippy --all-targets— cleancargo test— 2552 passed, 2 failed (pre-existing, see below)CHANGELOG.mdnot touched (release-please managed)Unrelated: two non-hermetic tests
cargo testfails identically on a cleandevelopcheckout with this branchstashed, so these are not from this PR:
Both assert
matches!(evaluate("git status", ...), RewriteOutcome::Ask(_)).evaluate()(src/hooks/rewrite_cmd.rs:47) callscheck_command(cmd), whichreads the developer's ambient Claude Code
settings.json. On a machine with aBash(git…)allow rule the verdict isAllow, notAsk, and both fail — sothey pass or fail depending on who runs them.
The sibling tests in
hook_cmd.rsavoid this by using the injectablecheck_command_with_rules(cmd, &[], &[], &[...]). Routing these two through thesame helper would make them hermetic. Left out of this PR to keep the diff
single-focus — happy to open a separate one if useful.