Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Swarm v3: Windows agents report quota from Claude Code's status line too (#4164) (#3455)

harness-for-autonomous[bot]3a043feb53a9
diff --git a/cli/hook/statusline.mjs b/cli/hook/statusline.mjs
index db7729e57..9f0d4292e 100644
--- a/cli/hook/statusline.mjs
+++ b/cli/hook/statusline.mjs
@@ -7,6 +7,7 @@
* (`__STATUS_LINE_SCRIPT__`), so an installed CLI needs nothing beside cli.js.
*
* node statusline.mjs --data <harness data folder> [--then <base64url of the person's own status line command>]
+ * [--bash <the Git Bash Claude Code runs status lines in, on Windows>]
*
* Claude Code hands its status line command a JSON status on stdin, with the plan's rate limits in it
* (`rate_limits.five_hour` / `seven_day`: `used_percentage` 0-100, `resets_at` in epoch seconds; null for an API key).
@@ -19,7 +20,7 @@
import { spawn } from 'node:child_process'
import { createHash, randomBytes } from 'node:crypto'
import { mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs'
-import { join } from 'node:path'
+import { delimiter, dirname, join } from 'node:path'
// Claude Code closes stdin once it has written the status. Should it not, the person's line still shows, a little late.
const INPUT_WAIT_MS = 2000
@@ -107,13 +108,49 @@ function ownCommand() {
}
}
+/**
+ * [command] as Claude Code 2.1.316 runs a status line in Git Bash on Windows (task #4164): a line whose first word, unquoted,
+ * is a `.sh` file runs as `bash <line>`.
+ */
+function asGitBashRunsIt(command) {
+ const line = command.trim()
+ let first = ''
+ for (let i = 0; i < line.length;) {
+ const c = line[i]
+ if (c === '"' || c === "'") {
+ const end = line.indexOf(c, i + 1)
+ if (end === -1) { first += line.slice(i + 1); break }
+ first += line.slice(i + 1, end)
+ i = end + 1
+ } else if (c === '\\' && i + 1 < line.length) {
+ first += line[i + 1]
+ i += 2
+ } else if (/\s/.test(c)) {
+ break
+ } else {
+ first += c
+ i++
+ }
+ }
+ return first.endsWith('.sh') ? `bash ${command}` : command
+}
+
+/** [env] with [folder] first on its PATH, whatever its key's case, as Claude Code starts Git Bash. */
+function firstOnPath(env, folder) {
+ const key = Object.keys(env).find((name) => name.toUpperCase() === 'PATH') ?? 'PATH'
+ return { ...env, [key]: env[key] ? folder + delimiter + env[key] : folder }
+}
+
async function main() {
const input = await readInput()
try { record(input, option('--data')) } catch { /* never in the way of the person's own line */ }
const command = ownCommand()
if (!command) process.exit(0)
// Through the shell, as Claude Code runs a status line command. No window on Windows, and no `detached`.
- const child = spawn(command, { shell: true, stdio: ['pipe', 'inherit', 'inherit'], windowsHide: true })
+ const bash = option('--bash')
+ const child = bash
+ ? spawn(asGitBashRunsIt(command), { shell: bash, env: firstOnPath(process.env, dirname(bash)), stdio: ['pipe', 'inherit', 'inherit'], windowsHide: true })
+ : spawn(command, { shell: true, stdio: ['pipe', 'inherit', 'inherit'], windowsHide: true })
child.on('error', () => process.exit(1))
child.on('exit', (code, signal) => process.exit(code ?? (signal ? 1 : 0)))
// A command that does not read its input closes the pipe early.
diff --git a/cli/src/engines/claude/statusLine.spec.ts b/cli/src/engines/claude/statusLine.spec.ts
index e62aa7580..a9aaa9d74 100644
--- a/cli/src/engines/claude/statusLine.spec.ts
+++ b/cli/src/engines/claude/statusLine.spec.ts
@@ -6,15 +6,18 @@
*/
import { spawnSync } from 'node:child_process'
import { createHash } from 'node:crypto'
-import { existsSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs'
+import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
-import { afterEach, beforeEach, describe, expect, it } from 'vitest'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { env } from '../../config/env.js'
import { joinedInstructions } from '../../lib/agentAttribution.js'
import { claudeReportPath, readClaudeReport } from '../../lib/quotaReports.js'
import { agentInstructionArgs } from '../launches.js'
+import { statusLineSetting } from '../kit/statusLine.js'
+import { managedNodePath } from '../../lib/nodeRuntime.js'
+import { launch as claudeLaunch } from './launch.js'
const SCRIPT = fileURLToPath(new URL('../../../hook/statusline.mjs', import.meta.url))
const posix = process.platform !== 'win32'
@@ -201,3 +204,68 @@ describe.skipIf(!posix)('a Claude launch\'s status line (a POSIX shell line)', (
expect(JSON.parse(readFileSync(reportPath(env.ADAPTER_DATA_DIR, configDir), 'utf8')).five_hour.used_percentage).toBe(42.5)
})
})
+
+// Task #4164: on Windows, Claude Code 2.1.316 runs its status line in Git Bash when it finds one (lib/windows/claudeCodeGitBash.ts), and in
+// PowerShell otherwise. Harness's line is written for that shell, and the person's own line runs in it as Claude Code would run
+// it, so a Windows agent reports its quota and the person sees their line as before.
+describe('a Claude launch\'s status line on Windows', () => {
+ const CONTRACT = claudeLaunch.statusLine!
+ const HOME = '/home/jo/.claude'
+ const BASH = 'C:\\Program Files\\Git\\bin\\bash.exe'
+ const files = (statusLine?: Record<string, unknown>) => ({ home: HOME, personal: '/home/jo', cwd: null, folder: false,
+ read: (path: string) => path === join(HOME, CONTRACT.file) && statusLine ? JSON.stringify({ statusLine }) : null })
+ /** A data folder with a space in its path, as a Windows account named "Jo Smith" has. */
+ const spaced = () => { const dir = join(root, 'Jo Smith', 'harness'); mkdirSync(dir, { recursive: true }); return dir }
+ const slashes = (path: string) => path.replace(/\\/g, '/')
+ const lineOf = (setting: Record<string, unknown> | null) => (setting?.statusLine as { command: string } | undefined)?.command
+
+ it('in Git Bash, quotes Harness\'s line as a POSIX shell reads it, a path with a space too, and names that bash', () => {
+ const dir = spaced()
+ const line = lineOf(statusLineSetting(CONTRACT, files(), dir, 'win32', () => BASH))
+ expect(line).toBe(`'${slashes(managedNodePath())}' '${slashes(join(dir, 'statusline', 'statusline.mjs'))}' --data '${slashes(dir)}' --bash 'C:/Program Files/Git/bin/bash.exe'`)
+ })
+
+ it('in Git Bash, passes the person\'s own line along, kept as it is', () => {
+ const setting = statusLineSetting(CONTRACT, files({ type: 'command', command: 'bash ~/.claude/line.sh', padding: 1 }), spaced(), 'win32', () => BASH)
+ expect(setting!.statusLine).toMatchObject({ type: 'command', padding: 1 })
+ expect(lineOf(setting)).toContain(` --then ${b64('bash ~/.claude/line.sh')} --bash 'C:/Program Files/Git/bin/bash.exe'`)
+ })
+
+ it('in PowerShell, writes Harness\'s line as PowerShell runs a program', () => {
+ const dir = spaced()
+ const line = lineOf(statusLineSetting(CONTRACT, files(), dir, 'win32', () => null))
+ expect(line).toBe(`& '${managedNodePath()}' '${join(dir, 'statusline', 'statusline.mjs')}' --data '${dir}'`)
+ })
+
+ it('in PowerShell, leaves the person\'s own line as it is, and says that session reports no quota', () => {
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
+ try {
+ expect(statusLineSetting(CONTRACT, files({ type: 'command', command: 'pwsh -File line.ps1' }), spaced(), 'win32', () => null)).toBeNull()
+ expect(warn.mock.calls.flat().join(' ')).toMatch(/PowerShell.*no quota/)
+ } finally {
+ warn.mockRestore()
+ }
+ })
+})
+
+// The person's own line, run by the script in the Git Bash Claude Code runs status lines in, as Claude Code would run it there:
+// with that bash, its folder first on PATH, and a line whose first word is a `.sh` file as `bash <line>`. Run here with this
+// computer's bash, which stands in for Git Bash.
+describe.skipIf(!posix)('hook/statusline.mjs with --bash', () => {
+ it('runs the person\'s line in that bash, its folder first on PATH', () => {
+ const out = run(['--data', data, '--then', b64('echo "$BASH" "${PATH%%:*}"'), '--bash', '/bin/bash'], STATUS)
+ expect(out).toMatchObject({ stdout: '/bin/bash /bin\n', status: 0 })
+ expect(readClaudeReport(data, configDir)?.five_hour?.used_percentage).toBe(42.5)
+ })
+
+ it('runs a line whose first word is a .sh file as bash runs it, as Claude Code does', () => {
+ const script = join(root, 'my line.sh')
+ writeFileSync(script, 'echo "line $1"\n', { mode: 0o644 })
+ const out = run(['--data', data, '--then', b64(`"${script}" one`), '--bash', '/bin/bash'], STATUS)
+ expect(out).toMatchObject({ stdout: 'line one\n', status: 0 })
+ })
+
+ it('keeps the person\'s line\'s exit status', () => {
+ expect(run(['--data', data, '--then', b64('echo partial; exit 3'), '--bash', '/bin/bash'], STATUS)).toMatchObject({ stdout: 'partial\n', status: 3 })
+ })
+})
diff --git a/cli/src/engines/kit/statusLine.ts b/cli/src/engines/kit/statusLine.ts
index c1de56ed0..9a9d88060 100644
--- a/cli/src/engines/kit/statusLine.ts
+++ b/cli/src/engines/kit/statusLine.ts
@@ -11,6 +11,8 @@ import type { StatusLineContract } from '../facets/launch.js'
import { managedNodePath } from '../../lib/nodeRuntime.js'
import { shellSingleQuote } from '../../lib/shellQuote.js'
import { isRecord, jsonObject, merged, type AttributionFiles } from './attribution.js'
+import { quoteHookCommand } from './notifyHooks.js'
+import { claudeCodeGitBash } from '../../lib/windows/claudeCodeGitBash.js'
declare const __STATUS_LINE_SCRIPT__: string | undefined
@@ -60,25 +62,30 @@ function scriptIn(dataDir: string): string | null {
}
}
-/** A word every shell a status line may run in reads as itself. */
+/** A word a POSIX shell reads as itself. */
const BARE_WORD = /^[A-Za-z0-9_-]+$/
-const WINDOWS_WORD = /^[A-Za-z0-9_:/.-]+$/
+
+let leftAlone = false
/**
- * [argv] as one shell line. Off Windows a POSIX shell reads it, so a word that is not bare is single-quoted. On Windows
- * the engine runs it in Git Bash or PowerShell, which no one quoting serves (kit/notifyHooks.ts `quoteHookCommand`), and a
- * status line has no exec form: paths go with forward slashes, which both read as themselves, and a word that would need
- * quoting gives no line.
+ * [argv] as the line the shell that runs it reads: a POSIX shell off Windows; on Windows the one Claude Code runs its status
+ * line in (lib/windows/claudeCodeGitBash.ts, task #4164), Git Bash with its paths in forward slashes, else PowerShell (`& 'program' …`).
+ * Null for a word PowerShell would not pass whole.
*/
-function commandLine(argv: string[], platform: NodeJS.Platform): string | null {
- if (platform !== 'win32') return argv.map((arg) => BARE_WORD.test(arg) ? arg : shellSingleQuote(arg)).join(' ')
- const words = argv.map((arg) => arg.replace(/\\/g, '/'))
- return words.every((word) => WINDOWS_WORD.test(word)) ? words.join(' ') : null
+function commandLine(argv: string[], platform: NodeJS.Platform, bash: string | null): string | null {
+ if (platform === 'win32' && !bash) {
+ try { return quoteHookCommand('powershell', argv) as string } catch { return null }
+ }
+ const words = platform === 'win32' ? argv.map((arg) => arg.replace(/\\/g, '/')) : argv
+ return words.map((arg) => BARE_WORD.test(arg) ? arg : shellSingleQuote(arg)).join(' ')
}
-/** The settings object that gives the launch Harness's status line, or null where it cannot have one. */
+/**
+ * The settings object that gives the launch Harness's status line, or null where it cannot have one. [gitBash] is the Git
+ * Bash Claude Code runs it in on Windows, null where that is PowerShell.
+ */
export function statusLineSetting(contract: StatusLineContract, files: StatusLineFiles, dataDir: string,
- platform: NodeJS.Platform = process.platform): Record<string, unknown> | null {
+ platform: NodeJS.Platform = process.platform, gitBash: () => string | null = claudeCodeGitBash): Record<string, unknown> | null {
const paths = [join(files.home, contract.file), ...(files.cwd && files.folder ? contract.folder.map((name) => join(files.cwd!, name)) : [])]
let theirs: unknown
for (const path of paths) {
@@ -86,12 +93,17 @@ export function statusLineSetting(contract: StatusLineContract, files: StatusLin
if (settings && Object.hasOwn(settings, contract.key)) theirs = merged(theirs, settings[contract.key])
}
const own = isRecord(theirs) && theirs.type === contract.type && typeof theirs.command === 'string' && theirs.command.trim() ? theirs : null
- // On Windows the script would run the person's command in another shell than the engine does: theirs is left as it is.
- if (own && platform === 'win32') return null
+ const bash = platform === 'win32' ? gitBash() : null
+ // In PowerShell the script could not run the person's line as Claude Code runs it there: theirs is left as it is.
+ if (own && platform === 'win32' && !bash) {
+ if (!leftAlone) console.warn('[statusline] Claude Code runs status lines in PowerShell here (no Git Bash), so a session with the person\'s own status line reports no quota')
+ leftAlone = true
+ return null
+ }
const script = scriptIn(dataDir)
if (!script) return null
const command = commandLine([managedNodePath(), script, '--data', dataDir,
- ...(own ? ['--then', Buffer.from(own.command as string, 'utf8').toString('base64url')] : [])], platform)
+ ...(own ? ['--then', Buffer.from(own.command as string, 'utf8').toString('base64url')] : []), ...(bash ? ['--bash', bash] : [])], platform, bash)
if (!command) return null
const { type: _type, command: _command, ...kept } = own ?? {}
return { [contract.key]: { ...kept, type: contract.type, command } }
diff --git a/cli/src/engines/launches.ts b/cli/src/engines/launches.ts
index e5c6d21aa..53bcdf89c 100644
--- a/cli/src/engines/launches.ts
+++ b/cli/src/engines/launches.ts
@@ -5,6 +5,7 @@ import { launch as codex } from './codex/launch.js'
import { attributionArgsIn, attributionInstruction, instructionsArgsIn, type Instruction } from './kit/attribution.js'
import { contextArgsOf, envArgsOf, fill, ownProviderArgs, readConfig } from './kit/launchArgs.js'
import { joinedSettings, statusLineSetting } from './kit/statusLine.js'
+import { claudeCodeGitBash } from '../lib/windows/claudeCodeGitBash.js'
import { env } from '../config/env.js'
import { launchHome, launchHomeOf, launchPersonalHome } from '../lib/engineHomes.js'
@@ -123,6 +124,7 @@ function statusLineArgs(contract: StatusLineContract | undefined, place: Attribu
if (!contract) return []
const files = { home: launchHomeOf(contract.home, place.profile, place.environment), personal: launchPersonalHome(place.environment),
cwd: place.cwd, read: place.read ?? readConfig, folder: !place.swarmInstructions }
- const setting = statusLineSetting(contract, files, env.ADAPTER_DATA_DIR)
+ const setting = statusLineSetting(contract, files, env.ADAPTER_DATA_DIR, process.platform,
+ () => claudeCodeGitBash({ env: place.environment ?? process.env }))
return setting ? contract.args.map((arg) => fill(arg, 'settings', JSON.stringify(setting))) : []
}
diff --git a/cli/src/lib/windows/claudeCodeGitBash.spec.ts b/cli/src/lib/windows/claudeCodeGitBash.spec.ts
new file mode 100644
index 000000000..16fd6e544
--- /dev/null
+++ b/cli/src/lib/windows/claudeCodeGitBash.spec.ts
@@ -0,0 +1,43 @@
+/**
+ * On Windows, Claude Code 2.1.316 runs its status line in Git Bash when it finds one, and in PowerShell otherwise (task #4164).
+ * Harness's status line is written for the shell Claude Code will run it in, so the Git Bash is found as Claude Code finds it.
+ */
+import { describe, expect, it } from 'vitest'
+import { claudeCodeGitBash } from './claudeCodeGitBash.js'
+
+const there = (...paths: string[]) => (path: string) => paths.includes(path)
+const PROGRAM_FILES = 'C:\\Program Files\\Git\\bin\\bash.exe'
+const PROGRAM_FILES_X86 = 'C:\\Program Files (x86)\\Git\\bin\\bash.exe'
+
+describe('the Git Bash Claude Code runs its status line in on Windows', () => {
+ it('is CLAUDE_CODE_GIT_BASH_PATH when it names a bash or sh that is there', () => {
+ for (const path of ['D:\\Git\\bin\\bash.exe', 'D:\\Git\\bin\\sh.exe', 'D:\\msys\\usr\\bin\\bash']) {
+ expect(claudeCodeGitBash({ env: { CLAUDE_CODE_GIT_BASH_PATH: path }, isFile: there(path, PROGRAM_FILES) })).toBe(path)
+ }
+ })
+
+ it('looks further when CLAUDE_CODE_GIT_BASH_PATH names something else, or nothing there', () => {
+ expect(claudeCodeGitBash({ env: { CLAUDE_CODE_GIT_BASH_PATH: 'D:\\Tools\\zsh.exe' }, isFile: there('D:\\Tools\\zsh.exe', PROGRAM_FILES) })).toBe(PROGRAM_FILES)
+ expect(claudeCodeGitBash({ env: { CLAUDE_CODE_GIT_BASH_PATH: 'D:\\Gone\\bash.exe' }, isFile: there(PROGRAM_FILES) })).toBe(PROGRAM_FILES)
+ })
+
+ it('is then Git for Windows in Program Files, then in Program Files (x86), before the git on PATH', () => {
+ const env = { PATH: 'C:\\Tools\\Git\\cmd' }
+ const onPath = 'C:\\Tools\\Git\\bin\\bash.exe'
+ expect(claudeCodeGitBash({ env, isFile: there(PROGRAM_FILES, PROGRAM_FILES_X86, 'C:\\Tools\\Git\\cmd\\git.exe', onPath) })).toBe(PROGRAM_FILES)
+ expect(claudeCodeGitBash({ env, isFile: there(PROGRAM_FILES_X86, 'C:\\Tools\\Git\\cmd\\git.exe', onPath) })).toBe(PROGRAM_FILES_X86)
+ })
+
+ it('is then the bash two folders up from the git on PATH', () => {
+ const env = { PATH: 'C:\\Windows\\System32;C:\\Tools\\Git\\cmd', PATHEXT: '.COM;.EXE;.BAT;.CMD' }
+ expect(claudeCodeGitBash({ env, isFile: there('C:\\Tools\\Git\\cmd\\git.exe', 'C:\\Tools\\Git\\bin\\bash.exe') })).toBe('C:\\Tools\\Git\\bin\\bash.exe')
+ // WSL's bash in System32 is no Git Bash: only the git is looked for on PATH.
+ expect(claudeCodeGitBash({ env, isFile: there('C:\\Windows\\System32\\bash.exe') })).toBeNull()
+ })
+
+ it('is none without Git for Windows, where Claude Code runs it in PowerShell', () => {
+ expect(claudeCodeGitBash({ env: { PATH: 'C:\\Windows\\System32' }, isFile: there() })).toBeNull()
+ // MinGit has a git but no bash.
+ expect(claudeCodeGitBash({ env: { PATH: 'C:\\MinGit\\cmd' }, isFile: there('C:\\MinGit\\cmd\\git.exe') })).toBeNull()
+ })
+})
diff --git a/cli/src/lib/windows/claudeCodeGitBash.ts b/cli/src/lib/windows/claudeCodeGitBash.ts
new file mode 100644
index 000000000..18814c768
--- /dev/null
+++ b/cli/src/lib/windows/claudeCodeGitBash.ts
@@ -0,0 +1,36 @@
+/**
+ * The Git Bash Claude Code runs its status line in on Windows, found as Claude Code 2.1.316 finds it (task #4164): its status
+ * line goes through its hook runner, which runs a command in this bash, or in PowerShell when there is none. Harness's status
+ * line is written for that shell (kit/statusLine.ts), so this follows Claude Code's own order, not gitBash.ts's.
+ */
+import { statSync } from 'node:fs'
+import { win32 } from 'node:path'
+
+export interface ClaudeGitBashSearch {
+ env?: NodeJS.ProcessEnv
+ isFile?: (path: string) => boolean
+}
+
+const SHELLS = new Set(['bash.exe', 'sh.exe', 'bash', 'sh'])
+const INSTALLED = ['C:\\Program Files\\Git\\bin\\bash.exe', 'C:\\Program Files (x86)\\Git\\bin\\bash.exe']
+
+/** The bash's path, or null where Claude Code runs its status line in PowerShell. */
+export function claudeCodeGitBash({ env = process.env, isFile = fileExists }: ClaudeGitBashSearch = {}): string | null {
+ const named = env.CLAUDE_CODE_GIT_BASH_PATH
+ if (named && SHELLS.has(win32.basename(named).toLowerCase()) && isFile(named)) return named
+ const installed = INSTALLED.find((path) => isFile(path))
+ if (installed) return installed
+ // `where git`: the first git on PATH, by PATHEXT; its bash is two folders up, in bin (<root>\cmd\git.exe: <root>\bin\bash.exe).
+ const extensions = (env.PATHEXT || '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean)
+ for (const dir of (env.PATH ?? env.Path ?? '').split(';').filter(Boolean)) {
+ const git = extensions.map((extension) => win32.join(dir, `git${extension.toLowerCase()}`)).find((path) => isFile(path))
+ if (!git) continue
+ const bash = win32.join(git, '..', '..', 'bin', 'bash.exe')
+ return isFile(bash) ? bash : null
+ }
+ return null
+}
+
+function fileExists(path: string): boolean {
+ try { return statSync(path).isFile() } catch { return false }
+}
diff --git a/docs/plans/2026-11-07-windows-quota-status-line-plan.md b/docs/plans/2026-11-07-windows-quota-status-line-plan.md
new file mode 100644
index 000000000..66d9797d9
--- /dev/null
+++ b/docs/plans/2026-11-07-windows-quota-status-line-plan.md
@@ -0,0 +1,47 @@
+# Windows agents report quota from Claude Code's status line too: implementation plan
+
+> Written by the project's Engineer way of working (project instructions, Engineer): plan first, then each task test first,
+> the failing test committed before its code. No Execution Handoff.
+
+**Goal:** task #4164 (requested by Dee through Harness, Swarm v3). Quota comes only from the CLIs' own reports (#4137, PR #3451).
+On Windows, Harness's status line was left out whenever the person had a status line of their own, and whenever a path held a
+character that needed quoting (`C:\Users\Jo Smith`), so a Windows Claude agent reported no quota and the router could not tell
+whether it had any left. Codex's app-server read already runs on Windows (lib/codexRateLimits.ts, no window: `ownProcessGroup`).
+
+**How Claude Code 2.1.316 runs a status line on Windows** (read from its bundle: the status line goes through its hook runner):
+
+- In Git Bash when it finds one: `CLAUDE_CODE_GIT_BASH_PATH` (a `bash`/`sh` that exists), else `C:\Program Files\Git\bin\bash.exe`,
+ else `C:\Program Files (x86)\Git\bin\bash.exe`, else the `git` on PATH's `..\..\bin\bash.exe`. It runs the line with that bash
+ as Node's `shell` (`bash -c`), that bash's folder first on PATH, and a line whose first word ends in `.sh` as `bash <line>`.
+- Otherwise in PowerShell (`-Command`).
+
+**Architecture:**
+
+- `lib/windows/claudeCodeGitBash.ts`: the Git Bash Claude Code runs its status line in, found as it finds it.
+- `kit/statusLine.ts` on Windows:
+ - With that Git Bash: Harness's line is quoted for it as on a Mac (POSIX quotes, forward slashes), so a path with a space
+ works, and the script is given `--bash <path>`. The person's own line is passed along as on a Mac.
+ - Without one (PowerShell): Harness's line in PowerShell's form (kit/notifyHooks.ts `quoteHookCommand`). A person's own line is
+ left as it is, and the CLI says so once in its log: this session reports no quota.
+- `hook/statusline.mjs` with `--bash`: the person's own line runs in that bash exactly as Claude Code would run it (its folder
+ first on PATH, the `.sh` rule). Without `--bash` nothing changes, so macOS and Linux run as before.
+- No window: the person's line is a child of the status line, which Claude Code starts hidden; `windowsHide`, no `detached`.
+- No login or credential file is read anywhere on this path.
+
+**Tech Stack:** TypeScript CLI, the self-contained `hook/statusline.mjs`, vitest.
+
+## Design
+
+N/A because nothing is stored, synced or exposed beyond #4137's report file, which is unchanged.
+
+## Platforms
+
+Windows (the change), macOS and Linux (unchanged: their line is byte for byte as before, pinned by the existing specs). A Windows
+Tester runs it on a Windows machine with Git for Windows, with and without the person's own status line.
+
+## Tasks (all test first)
+
+- [x] `claudeCodeGitBash` finds the Git Bash Claude Code finds, in its order, and none without one.
+- [x] Windows with Git Bash: Harness's line quoted for bash (a path with a space), the person's own line passed with `--bash`.
+- [x] Windows without Git Bash: Harness's line in PowerShell's form; a person's own line left alone, said in the log.
+- [x] The script with `--bash` runs the person's line in that bash, its folder first on PATH, and a `.sh` line as `bash <line>`.