Skip to content

RTK guidance confuses agents and sidesteps allowlist #3186

Closed

Description

@karldreher

User Story

As a Claude Code user with RTK's auto-rewrite hook installed, I want RTK's own docs/RTK.md to avoid modeling literal rtk <cmd> invocations for hook-covered commands, so Claude doesn't start typing rtk-prefixed commands itself and trigger avoidable permission prompts.

Background

Claude Code's permissions.allow check runs against the literal Bash command the model writes, before the PreToolUse hook rewrites it. So git status (plain) matches an existing allow rule and runs silently — the hook then rewrites it to rtk git status after the fact, invisibly. But if Claude itself writes rtk git status (already prefixed), that string doesn't match the user's plain-command allow rules, and the user gets a permission prompt every time — defeating the "zero-friction" promise of the hook.

In practice, Claude sessions frequently do type the prefixed form themselves. The likely cause is RTK.md: it has a "Meta Commands (always use rtk directly)" section, immediately followed by an example — git status → rtk git status — meant to illustrate the hook's automatic rewrite. The visual pattern is easy for an LLM to key on as "the command to type" rather than "what the hook produces for you," especially since the doc never explicitly says "do not type this form yourself." The generated RTK.md ships with no distinction in formatting or emphasis between the two categories.

The potential confusion for agents interferes with the user's configured command allow-list, because e.g. rtk git might not be on the allow list even if git is.

Acceptance Criteria

  • RTK.md (and any other agent-facing rtk docs) clearly distinguishes "commands you must type as rtk ..." (meta commands) from "commands the hook rewrites for you — type the plain form" (git/gh/cargo/etc.)
  • The illustrative X → Y example is reworded or annotated so it can't be read as an instruction to type Y
  • No regression to existing meta-command guidance (rtk gain, rtk discover, rtk proxy, etc. still explicitly called out as requiring the rtk prefix)

Technical Notes

  • Relevant file: the RTK.md template generated by rtk init -g (installed to ~/.claude/RTK.md)
  • Per the hook docs, an already-rtk-prefixed command passes through unmodified ("commandes deja prefixees par rtk passent sans modification") — so this isn't a hook bug, it's a documentation/prompting issue causing Claude to bypass the hook unnecessarily

Activity

  1. added
    documentation
    good first issue
    on Jul 24, 2026
  2. pszymkowiak commented on Jul 24, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    📋 Category docs
    🟡 Priority medium
    🎯 Confidence 72%

    Summary

    RTK.md's example formatting causes agents to type rtk-prefixed commands themselves, bypassing plain-command allowlists and causing unnecessary permission prompts; reword/annotate the doc to distinguish meta-commands from hook-rewritten commands.

    This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.

    📁 Relevant files
    • RTK.md

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  3. nightcityblade commented on Jul 24, 2026

    @nightcityblade

    Hi, I'd like to work on this. I'll submit a PR shortly.

  4. added
    resolved-pending-close
    on Sep 9, 2026
  5. KuSh commented on Sep 9, 2026

    @KuSh
    Collaborator

    Fixed on develop, not yet in a release — labelled resolved-pending-close rather than closed.

    The awareness.level split (aefea91a, then #3372) resolves this. AwarenessLevel::Default is #[default] (src/core/config.rs:37), and hooks/rtk-awareness.md at that level is the whole file below — no prefixing rule, no "Meta Commands" section, and no git status → rtk git status example. Its only rtk mention is rtk proxy <cmd> as a recovery path:

    Command output here is condensed to save tokens, keeping every signal and dropping costly noise. Treat it as the complete result: run commands normally, and batch related commands into one call to avoid extra turns. Truncated results state their recovery path in their own output. Re-run a command as rtk proxy <cmd> only when its result is unusable […]

    Against the acceptance criteria:

    • Criterion 1 (distinguish "type rtk …" from "type the plain form") — met by removal; there is no meta-command section left to misread.
    • Criterion 2 (the X → Y example) — the example is gone entirely.
    • Criterion 3 (no regression to meta-command guidance) — moot. init.rs:6355 asserts !RTK_AWARENESS_DEFAULT.contains("rtk gain") deliberately, with meta commands moved to high/full. Those are commands for humans, not agents, and nothing is lost by omission: awareness.level is user-selectable, so anyone wanting the fuller guidance asks for high or full. A minimal default is the design.

    Two things this does not cover, both tracked elsewhere:

  6. KuSh commented on Sep 13, 2026

    @KuSh
    Collaborator

    Fixed by the awareness-level rework in #3372, shipped in v0.49.0. The file installed by default no longer has a meta-commands section or the git status -> rtk git status example, so there is nothing left for the model to read as an instruction to type the prefixed form; the rtk-prefix guidance now only appears at the higher awareness levels meant for agents without hook support. Please comment if you still see agents typing rtk ... themselves on v0.49.0 or later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:docsdocumentationgood first issuepriority:mediumresolved-pending-close

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions