[BUG] Mods tool.call: PowerShell results never carry isReadOnly (Bash does)

Status Open
Reported on v2.1.296
Maintainer reply None cached
Activity 0 comments · opened Oct 11, 2026

Summary

In a hooks module (Mods), the result that next(e) resolves to in a tool.call hook never carries isReadOnly for the PowerShell tool, even for trivially read-only commands such as Get-Location. The same field is set for read-only Bash commands.

The types (index.d.ts, tool.call result) document isReadOnly as "present only when the tool held the input it executed read-only by its own check (the one its permissions use)". The 2.1.296 changelog says PowerShell has read-only detection ("allow rules and read-only detection now apply up to 32 KB"). So the PowerShell permission check appears to know the command is read-only, but tool.call does not expose it.

Environment

  • Claude Code 2.1.296, Windows 11, PowerShell 7 as the PowerShell tool's shell
  • Interactive session, auto mode
  • A plugin hooks module that registers on('tool.call', ...) and reads r.isReadOnly from await next(e)

Reproduction

  1. A hooks module with:

``js
export function register(on) {
on('tool.call', async ($, e, next) => {
const r = await next(e)
if (e.tool === 'Bash' || e.tool === 'PowerShell') $.ui.status(
${e.tool}: isReadOnly=${r.isReadOnly === true})
return r
})
}
``

  1. Have the model run Bash git status --short → status shows Bash: isReadOnly=true.
  2. Have the model run PowerShell Get-Location → status shows PowerShell: isReadOnly=false.
  3. Same for PowerShell Get-ChildItem -Name docs | Select-Object -First 3 → false.

The module above is a minimal form. The observation itself came from a plugin status line that counts the shell calls whose result lacks isReadOnly: Bash cd <repo> && git status --short did not count, while PowerShell Get-Location alone and Get-ChildItem ... | Select-Object ... alone each counted once (each step isolated after a reset).

Expected

isReadOnly: true on the PowerShell tool.call result whenever the PowerShell tool's own read-only check (the one used for permissions) classifies the command as read-only — the same contract Bash follows.

Impact

A module that uses isReadOnly to tell "something may have changed" from "only reads happened" cannot do so on Windows sessions where PowerShell is the primary shell: every PowerShell call has to be treated as a possible write.

View original on GitHub ↗