Repository navigation
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>
|
|
|
Thanks for this, and for the measurements in the description. The file this patches, hooks/claude/rtk-awareness.md, was removed by #3372 (merged 2026-09-07), which replaced the per-agent rules files with three shared templates: hooks/rtk-awareness.md, rtk-awareness-high.md and rtk-awareness-full.md. The escape hatch you wanted recorded is in the new text already, as |
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.