You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. Custom instructions — .github/copilot-instructions.md is loaded at every session start and instructs Copilot to prefix commands with rtk. Zero setup needed.
2. preToolUse hook — .github/hooks/rtk-rewrite.json intercepts raw bash tool calls. Since Copilot CLI hooks can only allow/deny (not rewrite like Claude Code), it uses a deny-with-suggestion pattern:
git status → denied: "Token savings: use `rtk git status` instead"
cargo test → denied: "Token savings: use `rtk cargo test` instead"
Copilot reads the reason and re-runs with the rtk prefix.
What about using "bashEnv": true in ~/.copilot/config/json, and pointing $BASH_ENV to a shell init file which generates shell aliases for commands supported by RTK?
Here's an example of generating a shell init file
cat >~/.copilot/shell-init.sh << 'EOF'command -v rtk &>/dev/null || return 0for cmd in git gh ls tree grep find diff wc cargo go npm npx pnpm pip \ docker kubectl curl wget vitest pytest tsc lint prettier ruff \ mypy prisma next aws psql dotnet rubocop rspec rake; do alias "$cmd=rtk $cmd"doneEOF
The challenge would be how to apply $BASH_ENV to only Copilot CLI sessions – e.g. with a wrapper script or a shell alias.
Love the tool and the deny-with-suggestion approach works well as a fallback.
Just wanted to share that Copilot CLI's preToolUse hook actually does support transparent command rewrites via modifiedArgs in the output JSON. The official docs confirm this:
I tested this with a thin wrapper script that extracts the bash command, calls rtk rewrite, and returns the result via modifiedArgs, it works transparently, no retry round-trip needed.
Happy to share the wrapper script or submit a PR if that would be helpful!
GitHub Copilot support landed in #605 as the native rtk hook copilot subcommand (VS Code Copilot Chat and Copilot CLI, Windows included), and the transparent rewrite path requested later in this thread is implemented too: the hook now answers with permissionDecision: allow plus modifiedArgs/updatedInput instead of deny-with-suggestion. Please reopen or comment if the hook does not behave that way for you on the latest version.
Activity
jeziellopes commentedon Mar 15, 2026
PR #605 implements this: #605
Two-layer integration:
1. Custom instructions —
.github/copilot-instructions.mdis loaded at every session start and instructs Copilot to prefix commands withrtk. Zero setup needed.2.
preToolUsehook —.github/hooks/rtk-rewrite.jsonintercepts raw bash tool calls. Since Copilot CLI hooks can only allow/deny (not rewrite like Claude Code), it uses a deny-with-suggestion pattern:Copilot reads the reason and re-runs with the
rtkprefix.Measured gains (validated Copilot CLI session)
rtk cargo testrtk cargo clippy --all-targetsrtk git diff HEAD~1rtk gh pr listpszymkowiak commentedon Mar 20, 2026
🔍 Automated Triage
featurelowSummary
Feature request to add support for GitHub Copilot CLI as a wrapped/handled command; minimal detail provided but intent is clear.
Triaged automatically by wshm · This is an automated analysis, not a human review.
akaihola commentedon Apr 8, 2026
What about using
"bashEnv": truein~/.copilot/config/json, and pointing$BASH_ENVto a shell init file which generates shell aliases for commands supported by RTK?Here's an example of generating a shell init file
The challenge would be how to apply
$BASH_ENVto only Copilot CLI sessions – e.g. with a wrapper script or a shell alias.Here's an example wrapper script
mvilrokx commentedon May 5, 2026
Love the tool and the deny-with-suggestion approach works well as a fallback.
Just wanted to share that Copilot CLI's
preToolUsehook actually does support transparent command rewrites viamodifiedArgsin the output JSON. The official docs confirm this:https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-hooks-reference#pretooluse-decision-control
So instead of returning a deny-with-suggestion, the hook can return:
{"permissionDecision": "allow", "modifiedArgs": {"command": "rtk git status"}}I tested this with a thin wrapper script that extracts the bash command, calls rtk rewrite, and returns the result via modifiedArgs, it works transparently, no retry round-trip needed.
Happy to share the wrapper script or submit a PR if that would be helpful!
mvilrokx commentedon May 5, 2026
Created a PR for 👆
feat(hooks): use modifiedArgs for transparent Copilot CLI rewrites
zul-hypefast commentedon May 13, 2026
@jeziellopes @pszymkowiak Any plan to integrate this for Copilot CLI using the new method?
KuSh commentedon Sep 5, 2026
GitHub Copilot support landed in #605 as the native
rtk hook copilotsubcommand (VS Code Copilot Chat and Copilot CLI, Windows included), and the transparent rewrite path requested later in this thread is implemented too: the hook now answers withpermissionDecision: allowplusmodifiedArgs/updatedInputinstead of deny-with-suggestion. Please reopen or comment if the hook does not behave that way for you on the latest version.