Skip to content

fix(hook): add output transparency section to RTK instructions#2718

Open
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/hook-tamper-instructions
Open

fix(hook): add output transparency section to RTK instructions#2718
guyoron1 wants to merge 1 commit into
rtk-ai:developfrom
guyoron1:fix/hook-tamper-instructions

Conversation

@guyoron1

Copy link
Copy Markdown
Contributor

Summary

When RTK is installed as a silent PreToolUse auto-rewrite hook, safety-tuned LLMs can flag RTK's filtered output as tampered because the output shape differs from what the original command produces (e.g., grep results grouped by file, diffs compacted, lists truncated with +N more).

This PR adds an "Output Transparency" section to the RTK_INSTRUCTIONS constant (injected into CLAUDE.md by rtk init). The section explicitly tells the LLM that:

  • RTK intentionally compresses and restructures output
  • Output may look different from raw commands — this is expected and correct
  • rtk proxy <cmd> is available for exact unfiltered output

This converts "unexplained output mismatch" into "expected behavior from a known tool," addressing the most common trigger for tamper heuristics.

Changes

  • src/hooks/init.rs: Add 4-line "Output Transparency" section to RTK_INSTRUCTIONS

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test --all passes
  • Existing test_init_contains_key_commands and test_init_has_version_marker tests pass
  • No changes to filter pipeline, hook processor, or output format

Fixes #2445

When RTK is installed as a silent PreToolUse hook, filtered output can
trigger LLM tamper heuristics because the output shape differs from the
raw command. Add an "Output Transparency" section to RTK_INSTRUCTIONS
explaining that RTK intentionally compresses output and pointing to
`rtk proxy` for unfiltered output.

Fixes rtk-ai#2445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent auto-rewrite hook trips Claude Code's tampering/injection heuristics → agent distrusts rtk output, burns tokens, and halts on "safety" grounds

1 participant