Plan: brush leaves the distribution

Closes: #907. Relates to: #884 (the audit that ruled it), #782 (the upstream patches, which stay parked and open), #652 and #772 (the plans this reverses), #650 (the Git Bash start cost, which stays open). Branch: refactor/remove-brush. Status: Done (2026-11-24) — brush removed; Windows rows on #907 (branch equal to main in every suite, PI_WINDOWS_SHELL unread)

Context

The operator ruled on #907 (2026-11-22): "We are going to drop brush as not ready for primetime (not even opt-in) so brush language can come out everywhere." On 2026-11-24 he ruled the two things #907 left open:

  • The 19 in-tree brush issues (#755, #759, #777, #781, #796, #805, #806, #809, #810, #815, #818 to #826, #829) close as not planned, each pointing at #907. #782 stays open and parked: its patches are for brush’s upstream and do not depend on this distribution.

  • A box that had opted in gets no transitional code. The two variables stop being read and Git Bash runs. The release note says what to remove by hand.

brush was opt-in (PI_WINDOWS_SHELL=brush or PI_BRUSH=<path>) and never the default. The one seat known to have run it is panther.

Design

One rule decides every edit: after this change the tree knows one shell for the bash tool on Windows, Git Bash, as a box that never opted in has today. Where a function took a shell and branched, it keeps the "git-bash" branch as its whole behaviour.

pi-workspace

Deleted whole: windows-shell.ts, brush-shell-dir.ts, brush-refusals.ts, brush-prelude.ts, and their tests test/windows-shell.test.ts, test/brush-shell-dir.test.ts, test/brush-refusals.test.ts, test/brush-prelude.test.ts.

Four names other code needs are moved first, each into the one file that uses it:

  • bashQuoted (exported from windows-shell.ts) moves into command-file.ts, which imports it at line 29, and is no longer exported.

  • ListDirectory, listDirectory and pathDirectories (exported from brush-prelude.ts) move into real-git.ts, which imports them at line 17. index.ts re-exports the three from real-git.ts, under the same names. Their tests move with them: the two pathDirectories cases (brush-prelude.test.ts lines 90 to 92) and the two listDirectory cases (lines 159, 160) go into real-git.test.ts, unchanged in what they assert. real-git.test.ts also imports preludeKey and preludeText from brush-prelude.ts (line 4) for a brush case; that case and the import go.

command-file.ts: withCommandFile loses its fourth parameter (shell?: ShellChoice), the brush branch, BrushWithoutShellDirError and shellDirOf. Its body becomes: return options when needsCommandFile(platform, local.config(options.shellPath)) is false, else { …​options, operations: sourcingFromFile(local.operations(options.shellPath)) }. sourcingFromFile, needsCommandFile and withBasicRepl are unchanged.

bash.ts: BASH_SHELL_CHANNEL, claimBashShell, bashShell and the ShellQuery interface go. claimBash, bashOwner and shellOptions stay.

output-cap.ts: the SHIM_PRELUDE pattern (line 30) and its clause in maxAgeOf (line 87) go, so that line reads if (COMMAND_SCRIPT.test(name)) return SCRIPT_MAX_AGE_MS;. The sweeps of pi’s output logs and the transport’s scripts stay.

index.ts: the export blocks for brush-prelude.ts (except the three moved names), brush-refusals.ts, brush-shell-dir.ts and windows-shell.ts go, with BrushWithoutShellDirError, BASH_SHELL_CHANNEL, bashShell and claimBashShell.

pinned-binary.ts keeps its code: pi-ssh’s rg and fd and pi-shellcheck’s shellcheck use it. Its header comment (line 4) stops naming brush.

The guards' shell switch (pi-modes, pi-workflow)

The type ShellKind ("git-bash" | "brush") goes with windows-shell.ts. Every parameter and field that carried it is removed, and each condition shell === "git-bash" (or shellKind === "git-bash") is deleted from its expression, leaving the rest of the condition:

  • pi-modes/authorize.ts: the shell parameter of writesAtHome (line 334), readAtHome (356) and shellTarget (394); the shell field of the deps (471); the arguments at lines 268, 339, 358, 821 and 824. shellTarget becomes platform === "win32" ? gitBashPath(target, temp) : target, and its doc comment (lines 385 to 389) loses the sentence that begins "Under brush".

  • pi-modes/judge-wiring.ts: the shell dep (line 385), its wiring (1620) and the import of bashShellKind and ShellKind (14).

  • pi-workflow/commit-message.ts: the shell parameters at lines 471, 545, 591 and 639. The function at 591 becomes platform === "win32" && !isRemote ? gitBashPath(raw, temp) : raw.

  • pi-workflow/commit-pause.ts: the shell field (line 131) and `commitShape’s parameter (229).

  • pi-workflow/git-guard.ts: shellKind at lines 494 and 517 and the shell field at 729. Line 522 becomes process.platform === "win32" && !ws.isRemote.

  • pi-workflow/index.ts (lines 35, 170) and pi-modes/index.ts (34, 79): the bashShellKind(pi.events) calls and imports.

pi-modes/mode-policy.ts destinationSpellings (line 388) keeps its behaviour: a redirect to f::$DATA is still read as f too. The rule also holds under Git Bash, where it only restricts. Its doc comment (lines 385 to 387) and modes.adoc line 431 lose the sentence that names brush as the reason.

The bash tool’s registration (pi-workflow, pi-ssh)

pi-workflow/batch-order.ts sequentialBash (line 154): the coreutils parameter, the registerBashShell call and the BRUSH_DESCRIPTION spread go; withCommandFile is called with three arguments. registerBatchOrder, which calls it (line 186), loses its own coreutils parameter (line 182) and the doc line about it (176); only batch-order.test.ts passes that argument. The imports of BashShellDeps, BRUSH_DESCRIPTION and registerBashShell go.

pi-ssh/extension.ts: switchedBash (line 295) drops the registerBashShell call and the description spread; localBash (283) loses its shell parameter; the bashShell field of RemoteToolsDeps (82) goes. Line 380 reads the platform from process.platform. pi-ssh/remote-tools.ts line 18’s comment stops naming brush. pi-ssh/test/brush-shell.test.ts is deleted.

Erratum (2026-11-24): line 380 reads deps.platform ?? process.platform, bashShell giving way to a platform field, because tools.test.ts registers for win32 and linux on one host to cover both PowerShell branches.

pi-shellcheck

The refused-tool rule goes:

  • table.ts: REFUSED_TOOL (line 17) is removed, and with it its entries in OWN_RULES (18), ID_FORM (21) and DEFAULT_BLOCK (27).

  • rules.ts: refusedTools (line 258) and the import of REFUSED_TOOL (19).

  • extension.ts: the shell dep (line 45), its use at 167, its wiring at 252, the imports of bashShellKind and refusalLine (20) and of refusedTools (24), and the waiver note’s mention of refused-tool.

The two delete rules and the shellcheck codes are unchanged. A settings file (gadhs-pi-shellcheck.json) naming refused-tool is then refused by config.ts idList (line 34), whose message already says what an id is: "which is not an id (SC and four digits, delete-variable or cd-then-delete)". The guard then runs on its defaults, as for any bad settings file.

The recap (pi-modes)

recap.ts: the shell?: "brush" field (line 75), the ledger’s shellOf field and constructor parameter (149 to 157), line 237, and the on brush part of formatRecap (340) go. In recapOf, the shell read (282) and the clause (shell === undefined || shell === "brush") (289) go, so a stored record that carries shell: "brush" passes the check as any record with an extra field does, and renders without the part.

Tooling, tests and CI

Deleted whole: tools/brush/ (pin.json, ci-setup.sh, 23 files in patches/, 3 in crate-patches/), tools/brush-build.mjs, tools/shell-spike/, tools/lib/suite-env.mjs with its type file tools/lib/suite-env.d.mts, and the tests tools/lib/test/brush-build.test.mjs, brush-build-crates.test.mjs, shell-field.test.mjs and suite-env.test.mjs.

tools/lib/shell-field.mjs is deleted too, after two of its five exports move: tools/lib/plain-line-field.mjs (line 17) imports bashCalls and sessionFiles from it for #888’s field count. Both, with the private resultText that bashCalls uses, move into a new tools/lib/session-calls.mjs (same names, same bodies, an SPDX header, and a header comment saying they read a session file’s bash calls), and plain-line-field.mjs imports them from there. The other three exports (sessionCounts, refusalCounts, shellFieldReport) are brush telemetry and go with the file.

  • tools/task.mjs: the shell-field verb (line 582), its import (38) and its header line (25).

  • vitest.config.ts: the import of suite-env.mjs (line 3), the msys constant, the loop over exportedFunctionNames, and the PI_WINDOWS_SHELL and MSYS entries of test.env. suite-env.mjs exports exactly three names (msysWithoutNoglob, SUITE_WINDOWS_SHELL, exportedFunctionNames), each for a test run started from a brush session, and vitest.config.ts is their only user.

  • .gitlab-ci.yml: the brush-build job (lines 234 to 255) with its comment. The RUNNER_2XLARGE variable stays: four other jobs use it.

  • packages/pi/test/distribution.test.ts: the describe block "CI builds the pinned brush only when asked to (#772)" (from line 327).

  • packages/pi-bash/test/bash-oracle.ts: BRUSH and BRUSH_PRESENT (lines 20, 21) and their comment. differential.test.ts: the second differentialSuite call (110), the import, the comment at 23, and the half of `differentialSuite’s doc comment (lines 74, 75) that names brush as a second oracle.

Tests that mix brush cases with others lose the brush cases and keep the rest:

  • pi-workspace: command-file.test.ts, bash.test.ts, output-cap.test.ts, real-git.test.ts, pinned-binary.test.ts (one mention, a comment).

  • pi-shellcheck: extension.test.ts, rules.test.ts and table.test.ts (the refused-tool cases).

  • pi-modes: recap.test.ts, authorize.test.ts (the shellTarget brush case at lines 1072 to 1075), rule-precedence.test.ts.

  • pi-workflow: batch-order.test.ts, git-guard.test.ts, git-guard-repo.test.ts. commit-message.ts has no test file of its own; these suites cover it.

  • pi-ssh: tools.test.ts, connection.test.ts.

  • tools: tools/lib/test/public-surface.test.mjs.

Docs

  • workflow-guards.adoc: the passage from the [#windows-shell] anchor (line 48) to the line before "Monitors, jobs and ! keep Git Bash" (about line 338) is replaced, under the same anchor, by: "On Windows the bash tool runs Git Bash. From #652 to #907 a box could opt in to brush, a native bash-compatible shell; it was removed as not ready." The sentence before the anchor ends at "and pays its start." The "Monitors, jobs" paragraph stays without "keep".

  • tuning.adoc: the section "The bash tool’s shell on Windows" (lines 1242 to 1263) keeps its anchor and heading and the same two sentences.

  • ssh.adoc (line 159) and tools.adoc (line 177): each sentence that says "where the bash tool runs brush" is cut to what holds under Git Bash; their links to #windows-shell go with the clause. ssh.adoc line 173 loses "and brush’s shim preludes (#757)", as the sweep no longer removes them.

  • shell-guard.adoc: the refused-tool row (line 75) and its two other mentions.

  • session.adoc: the on brush clause.

  • security.adoc (lines 356 to about 391): the brush build’s paragraphs; the pinned-release sentence names rg, fd and shellcheck.

  • testing.adoc (lines 204 to 216): the brush differential and brush-shell.test.ts.

  • packages.adoc (lines 127 to 132), public-surface.adoc (the PI_BRUSH and PI_WINDOWS_SHELL rows; MSYS and PI_OFFLINE lose their windows-shell.ts mention; pi-workspace’s export list), modes.adoc (line 431), vertex.adoc (line 20, "brush not tried").

  • local-dev.adoc: no brush mention; unchanged.

  • Plans are records. plans/brush-windows-shell.adoc and plans/brush-own-build.adoc each get Status N/A and a first line "Erratum (date): brush was removed by #907." nav.adoc keeps listing them. plans/shell-guard.adoc and plans/public-surface.adoc mention brush in passing and are not edited.

What the release note says

Under Removed: brush is gone; the bash tool on Windows runs Git Bash. A box that had opted in should unset PI_WINDOWS_SHELL and PI_BRUSH, which are no longer read, and may delete <agentDir>/gadhs-pi-shell/. A gadhs-pi-shellcheck.json that names refused-tool must drop it. The shell-field task verb is gone.

Not in this plan

  • The brush package uploads in GitLab’s generic package registry and the protected brush-* tag rule. They are project settings, the operator’s to remove.

  • #650 (Git Bash’s start cost under load). brush was its proposed cure; the issue stays open without one.

  • #782’s upstream patches.

Scope

One branch, one MR, five commits. Each leaves the tree passing validate.

  1. pi-workspace: move the four names; delete the four files and their tests; trim command-file.ts, bash.ts, output-cap.ts, index.ts. In the same commit, because they import the removed names: the shell switch in pi-modes and pi-workflow, the registration in batch-order.ts and pi-ssh, refused-tool in pi-shellcheck, on brush in the recap, and each package’s tests.

  2. Tooling: tools/brush/, tools/brush-build.mjs, tools/shell-spike/, shell-field (after session-calls.mjs takes its two shared exports), suite-env and its type file, vitest.config.ts, pi-bash’s second oracle.

  3. CI: the brush-build job and `distribution.test.ts’s block.

  4. Docs, the two plans' Status, the release note.

  5. This plan’s Status to Done.

Erratum (2026-11-24): the CI commit comes before the tooling commit, because distribution.test.ts reads tools/brush/pin.json.

Erratum (2026-11-24): public-surface.adoc’s rows for `PI_BRUSH, PI_WINDOWS_SHELL, MSYS (read only by windows-shell.ts) and gadhs:bash-shell move into the first commit, because public-surface.test.mjs fails while the page names what the code no longer reads.

After the merge: close the 19 issues, each with one line pointing at #907.

Risks

Risk Mode Mitigation

A Git Bash path stops being translated on Windows, because a removed shell parameter is collapsed the wrong way

fail-open

Each edit deletes only the === "git-bash" clause, named line by line above. The Git Bash cases of authorize.test.ts (lines 1058 to 1065), git-guard.test.ts and git-guard-repo.test.ts pass unchanged; pi-win runs pi-modes and pi-workflow on Windows, main against the branch.

A box with PI_WINDOWS_SHELL=brush gets Git Bash with no word

silent

Accepted by the operator’s ruling (no transitional code). The release note names the variables; panther, the one known seat, is told on the bus.

A gadhs-pi-shellcheck.json naming refused-tool makes the shell guard refuse its settings and run on defaults

fail-closed

config.ts reports the id by name. A regression test feeds that file. The release note says to drop the id.

A stored recap with shell: "brush" no longer validates, and the recap is not shown

silent

recapOf stops checking the field. A regression test feeds a stored record that carries it.

A moved helper is missed and a package fails to load after install, or a tool imports a deleted file

fail-closed

tsc over every package, then consumer-sim, which loads every extension from the installed tree. For the tools, which tsc does not cover: the search for imports of each deleted file named under Tests, and tools/lib’s suite, where `plain-line-field.test.mjs imports the moved names.

Deleting suite-env.mjs lets a test run inherit a caller’s shell setting again

silent

Its three guards existed for a run started from a brush session. With no brush there is no such session; GADHS_PI_DIAGNOSTICS: "off" stays in test.env.

The redirect rule for f::$DATA is removed with the brush language around it

fail-open

The plan keeps destinationSpellings and edits only its comment. Its cases in authorize.test.ts (lines 705 to 730) pass unchanged.

Tests

  • Regression:

    • a recap record stored with shell: "brush" is accepted by recapOf and rendered without an "on brush" part (recap.test.ts);

    • parseConfig({ block: ["refused-tool"] }) is refused, with "refused-tool" in the message (pi-shellcheck/test/extension.test.ts, beside its other parseConfig cases);

    • withCommandFile on win32 with Git Bash’s config returns operations that source from a file, and on linux returns the options as given (command-file.test.ts).

  • Contract:

    • public-surface.test.mjs: the page and the code agree, and neither lists PI_BRUSH or PI_WINDOWS_SHELL;

    • distribution.test.ts holds no brush-build expectation, and .gitlab-ci.yml no such job;

    • listDirectory and pathDirectories keep their behaviour: their four cases, moved into real-git.test.ts, pass unchanged;

    • plain-line-field.test.mjs passes unchanged, importing nothing from a deleted file: its two session-file rows ("3 bash call(s)", "1 bash call(s)") are what bashCalls and sessionFiles produce from their new home;

    • no import in the tree names a deleted file: a search for shell-field, suite-env, windows-shell, brush-prelude, brush-refusals and brush-shell-dir finds no import line, and tsc and the tools' suites agree.

  • Unchanged, the proof nothing else moved: the Git Bash cases of authorize.test.ts, git-guard.test.ts, git-guard-repo.test.ts, batch-order.test.ts, pi-ssh’s tools.test.ts, the ::$DATA cases, and pi-bash’s bash differential.

  • Removed with the feature: the brush-only suites named under Design. Each tested brush itself, so none is a weakened test.

  • Windows: pi-win runs pi-workspace, pi-modes, pi-workflow, pi-ssh and pi-shellcheck on panther, main against the branch, and one real session’s bash call on a staged install.

  • Whole: validate (both runs) and consumer-sim, 27 rows.

  • The one-shell rule, checked by a search after the change: brush appears in the tree only in CHANGELOG.adoc, the plans directory, nav.adoc’s two plan lines, and the two-sentence note under `#windows-shell in workflow-guards.adoc and tuning.adoc.

Erratum (2026-11-24): the recap regression above stores shell: "brush" by its nature, so recap.test.ts is a sixth place the search finds it.

Delivery

  • Canonical page: workflow-guards.adoc (the #windows-shell anchor), with the pages listed under Docs.

  • CHANGELOG, Removed: the release note above.

  • The plan is committed to docs/modules/ROOT/pages/plans/remove-brush.adoc on approval and listed in nav.adoc.

  • MR with Closes #907; the merge SHA noted on #907; then the 19 issues closed with a pointer. Released as a minor: pi-workspace, pi-modes, pi-workflow, pi-ssh and pi-shellcheck change, and their dependents move with them.

Edit this page · latest