Skip to content

fix(agent): preserve env prefix before rtk - #3706

Closed
fu050409 wants to merge 1 commit into
rtk-ai:developfrom
fu050409:feat/env-prefix-agent-context
Closed

fu050409 wants to merge 1 commit into
rtk-ai:developfrom
fu050409:feat/env-prefix-agent-context

Conversation

@fu050409

Copy link
Copy Markdown

Summary

The existing agent instructions say to always prefix commands with rtk, which leads agents to generate commands such as rtk env X=Y cargo test. In this order, RTK handles env as the command and the inner supported command does not go through its token-saving filter. RTK already passes its environment to the commands it dispatches, so the native form env X=Y rtk cargo test preserves the required environment while still allowing RTK to filter the inner command.

  • Clarify agent instructions for commands using environment prefixes: use env X=Y rtk <command> instead of rtk env X=Y <command>.
  • Preserve the native behavior of the system env command while ensuring the wrapped command still benefits from RTK output filtering and token savings.

Resolves: #1606

Test plan

No new tests were added because this change only updates agent-facing wording, and the existing test suite does not assert the exact instructional copy.

  • cargo fmt --all --check && cargo clippy --all-targets && cargo test
  • Manually verified that env X=Y rtk <command> executes correctly.

@CLAassistant

CLAassistant commented Aug 25, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@KuSh

KuSh commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this. The per-agent rule files this PR edits (antigravity, cline, codex, kilocode, windsurf) were removed by #3372, merged on 2026-09-07, which replaced them with a shorter awareness text that no longer asks agents to prefix every command with rtk, so the env caveat no longer has a rule to attach to. Two places still carry the old 'always prefix with rtk' wording without the env note: the Copilot instructions in src/hooks/init/copilot.rs and the legacy --claude-md block in src/hooks/init/mod.rs; a narrow PR against those files, or a comment on #1606, would be welcome. If I missed a part of this change, please comment or reopen.

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.

Feature request: rtk passthrough for env -u/env VAR=val command prefix

3 participants