rtk-ai/rtk

[FEATURE] Add Claude Code PowerShell hook compatibility

Open

#1,319 opened on Apr 15, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Rust (2,914 forks)batch import
area:clieffort-largeenhancementhelp wantedplatform:windowspriority:medium

Repository metrics

Stars
 (48,085 stars)
PR merge metrics
 (Avg merge 11d 1h) (45 merged PRs in 30d)

Description

Summary

Add first-class Claude Code PowerShell compatibility when CLAUDE_CODE_USE_POWERSHELL_TOOL=1 is enabled.

Problem

RTK already supports Claude's Bash hook flow, but Claude Code on Windows can route shell calls through the PowerShell tool instead. In that mode RTK currently misses several integration points:

  • rtk init -g on Windows falls back to --claude-md instead of installing a compatible hook
  • settings.json cannot be patched with a matcher entry that covers both Bash and PowerShell tool names on Windows
  • rtk session / rtk discover only account for Bash tool-use extraction
  • hook diagnostics and status reporting do not surface a PowerShell hook path

Proposed solution

  • add an embedded hooks/claude/rtk-rewrite.ps1 hook script
  • support rtk init -g --shell powershell
  • auto-detect CLAUDE_CODE_USE_POWERSHELL_TOOL=1 on Windows during global init
  • patch and remove settings.json entries with a Bash|PowerShell matcher for the .ps1 hook
  • include PowerShell hooks in hook status and config reporting
  • extract PowerShell tool calls in session/discover analytics the same way as Bash
  • cover the new behavior with focused unit tests

Acceptance criteria

  • rtk init -g --shell powershell installs a .ps1 hook and patches Claude settings
  • Windows global init can route to the PowerShell hook flow when the Claude env var is set
  • hook health checks recognize either Bash or PowerShell Claude hooks
  • discover/session analytics count both Bash and PowerShell Claude tool calls
  • the PowerShell path is covered by unit tests for parsing, settings mutation, and embedded hook content

Related issues

  • Related: #1248

Contributor guide