Skip to content

fix(init): scope guidance to external commands - #4175

Merged
KuSh merged 4 commits into
rtk-ai:developfrom
Ha1baraA11:codex/fix-rtk-guidance-builtins
Nov 3, 2026
Merged

KuSh merged 4 commits into
rtk-ai:developfrom
Ha1baraA11:codex/fix-rtk-guidance-builtins

Conversation

@Ha1baraA11

@Ha1baraA11 Ha1baraA11 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Scope RTK awareness guidance to external programs instead of every shell command.
  • Leave shell builtins and keywords unprefixed, and keep full, legacy, and Copilot guidance in sync.

Test plan

  • cargo fmt --all && cargo clippy --all-targets && cargo test
  • Manual testing: rtk <command> output inspected
  • Guidance regression, formatting, diff validation, the full binary suite, and Clippy pass.
  • The two existing Git-output compatibility assertions still fail on pristine develop; they are unrelated to this change.

Fixes #3969

@CLAassistant

CLAassistant commented Sep 21, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@rtk-wshm-sync-bot

Copy link
Copy Markdown

wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Scopes the 'prefix commands with rtk' guidance to external programs only, explicitly excluding shell builtins/keywords and names that collide with RTK subcommands (test, read, env). Updates the generated full, legacy, and Copilot guidance text to stay consistent and adds a regression test to lock in the new wording.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #3969


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

Ha1baraA11 and others added 3 commits October 13, 2026 05:56
Resolves the two conflicts with develop's `rtk proxy` -> `rtk bypass` rename
in docs/guide/getting-started/configuration.md and src/core/config.rs by
keeping develop's `bypass` and this branch's `full` wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The prefix-rule test checked that each payload scopes the rule and has an
exclusion paragraph, but a payload could drop `cd` from its list, or put
"the prefix is always safe" back, and every test still passed. One shared
assertion now covers the full awareness file, the legacy --claude-md block
and the Copilot instructions: the nine builtins in the exclusion list,
`env` in the same paragraph, and none of the three old promises in any
case or line wrapping.

The Cline, Windsurf and Kilo Code READMEs described the payload as the
instruction to prefix every shell command; they now describe the scoped
rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@KuSh KuSh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 of 3 — APPROVED, follow-ups filed

Claim: the agent guidance tells agents to prefix external programs with rtk and to leave shell builtins unprefixed, in the full awareness file, the legacy --claude-md block and the Copilot instructions.
Scope: accept (round 1, frozen); maintainer PRs: checked against #4269 (KuSh): merges clean, both test sets pass; #4894, #4653, #3875, #4458 and #4402 touch the same files but none of the three payloads, their tests or the RTK.md recognition.
Ran: develop 45e4f89 vs this PR merged onto it × 11 init modes (cline, windsurf -g, kilocode, kimi, codex, copilot, --claude-md, claude at full, antigravity, gemini -g, vibe -g) × fresh install, re-init over a develop install, uninstall of a develop install, second init; 12 builtin names run with the rtk prefix; 8 commands through rtk rewrite; invariants: under the hook | every decision; savings: not applicable (no filter changed).
Pins: 9 decisions, 9 mutated, 4 survived on the PR head (the old "always safe" promise put back in the full or the legacy payload; cd dropped from the full or the Copilot list). The fixup's test kills all 9, plus 5 mutations of its own checks.
Matrix: never — ran this round; pin check: never — ran this round.
CI @380d2130d: all green (15/15, including test on ubuntu, macos, windows msvc and gnu)

Blocks merge (0, frozen at round 1)

None.

Optional — will not hold merge

  • "so prefixing from PATH is safe" (hooks/rtk-awareness-full.md) and "This is safe for programs you would run from PATH" (RTK_INSTRUCTIONS) are still wrong for programs on PATH that RTK has its own command for: rtk trust list exits 2 (/usr/bin/trust is p11-kit on Debian/Fedora), and rtk log show --last 1m exits 127 (macOS log). Stopping the sentence at "run as-is" would avoid the claim.
  • env is placed differently: the full file has it in the list ("or shadowed env"), while the legacy and Copilot blocks name it in the sentence after the list. Both readings say to leave it unprefixed.
  • [, echo and printf exit 0 with the prefix (they run the /usr/bin programs), so listing them does no harm. help, . and unset exit 127 and are not listed.
  • The "About RTK" paragraph in rtk-awareness-full.md was joined into one 117-character line. That has nothing to do with the claim.

Filed as follow-ups

  • #3406: comment added. Existing Cline/Windsurf/Kilo Code installs never get this wording, because re-running rtk init finds "rtk" in the rules file and stops. Outside this PR's hunks.
  • #4958 Docs and this repo's own Copilot instructions still promise the rtk prefix is always safe (docs/usage/FEATURES.md:55, :1568, .github/copilot-instructions.md:7). Outside this PR's hunks.

Checked and correct — no need to re-verify

  • On a fresh install, every mode that writes a payload carries the new rule and the exclusion paragraph, and none carries the old rule. Vibe writes the configured level, which is default here.
  • Re-running init over a develop install rewrites the rule for kimi, codex, copilot, --claude-md, claude, antigravity and gemini.
  • Uninstalling a develop install with this build leaves the same files that develop's own uninstall leaves, in all 11 modes. Running init a second time is byte-identical in every mode.
  • The src/hooks/init/codex.rs hunk disappears in the merge. Develop had already replaced those assertions with frozen payload digests, and the merged file is byte-identical to develop's.
  • The hook agrees with the new wording: cd backend && cargo test becomes cd backend && rtk cargo test, and the same holds for export …, test -f …, source .env && pytest and env FOO=1 cargo test. The guidance's own chain example is left as it is.
  • rtk cd, rtk export, rtk source and rtk eval still exit 127. The PR changes guidance, not behaviour.
  • Merged onto develop: cargo fmt --check, clippy --all-targets and cargo test --all are clean, with 5475 passed and 0 failed. The same holds with #4269 merged in.

Your questions

None asked. The note in the description about two Git-output tests failing on develop no longer applies: the suite is green on develop 45e4f89.

Next

Fixup 380d213 pushed and code-reviewed. It merges develop (two conflicts with the rtk proxy → rtk bypass rename, resolved by keeping bypass). It pins the builtin list and the dropped "always safe" promise with one test covering all three payloads. It updates the Cline/Windsurf/Kilo Code READMEs, which still described the old rule. Approving.
Rounds: 1/3. Threads: 0 open, 0 resolved this round.

@KuSh
KuSh merged commit a9cd4eb into rtk-ai:develop Nov 3, 2026
15 checks passed
@rtk-release-bot rtk-release-bot Bot mentioned this pull request Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent guidance tells agents to prefix shell builtins with rtk, and promises it is safe — rtk cd exits 127 and aborts the compound

3 participants