Thanks to visit codestin.com
Credit goes to github.com

Skip to content

hook does not recognize Claude Code PowerShell tool (tool_name "PowerShell") — no compression on Windows CC >= 2.1.126 #26

@LDozen

Description

@LDozen

Summary

On Windows, Claude Code exposes a PowerShell tool (tool_name "PowerShell") in addition to Bash. Since CC v2.1.126 (May 2026), when the PowerShell tool is enabled Claude Code treats PowerShell as the primary shell (Git Bash, when installed, keeps both tools available).

sqz hook claude does not recognize this tool name, so it passes the tool call through unchanged and rewrites nothing. As a result no command output is compressed — sqz silently misses the majority of shell traffic on Windows Claude Code.

Repro (sqz v1.0.9, Windows x86_64)

# PowerShell tool call -> passed through unchanged (NOT rewritten):
$ echo '{"session_id":"t","tool_name":"PowerShell","tool_input":{"command":"Get-Content big.log"}}' | sqz hook claude
{"session_id":"t","tool_name":"PowerShell","tool_input":{"command":"Get-Content big.log"}}

# Bash tool call -> correctly rewritten:
$ echo '{"session_id":"t","tool_name":"Bash","tool_input":{"command":"cat big.log"}}' | sqz hook claude
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","permissionDecisionReason":"sqz: command output will be compressed for token savings","updatedInput":{"command":"cat big.log 2>&1 | sqz compress --cmd cat"}}}

Root cause

The shell-tool allowlist only matches bash / shell / terminal / run_shell_command (sqz_engine/src/tool_hooks.rs); powershell is absent. The installed PreToolUse hook matcher is also hard-coded to "Bash".

Suggested fix

Recognize powershell (and pwsh) as shell tools and rewrite with a shell-neutral pipe. The --cmd flag is already shell-neutral (per the #10 fix), and ... 2>&1 | sqz compress --cmd <c> runs fine in PowerShell, so the rewrite should work once the tool name is allowlisted. The installed hook config also needs a PowerShell matcher in addition to Bash.

Notes

The compression engine itself works fine on Windows (a one-shot sqz compress gives ~49% reduction + dedup hits); the problem is purely tool-name recognition in the hook path.

Environment

  • sqz 1.0.9, Windows 11 (x86_64)
  • Claude Code with the PowerShell tool enabled (tool_name "PowerShell"), v2.1.126+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions