fix(bash): honor explicit working directories

This commit is contained in:
jb
2026-09-04 16:47:41 -04:00
parent 3d68f7c6bf
commit 328faa03e0
13 changed files with 316 additions and 21 deletions
@@ -100,7 +100,7 @@ Reuse rather than wrap:
- `artifact-presenter`: plan and long-artifact review.
- Git worktrees and normal project commands: isolation, commits, verification, rebase, and integration.
Known harness defects are workflow constraints, not footnotes. Until fixed, launch subagents directly rather than through `multi_tool_use.parallel`; never park the parent solely on an expected callback; and verify that each result was delivered. For shell work inside hidden worktrees, use explicit `cd <worktree> && ...` or `git -C <worktree> ...`, then verify `pwd` or Git's top-level path before mutation because the Bash tool has previously ignored its configured working directory.
Known harness defects are workflow constraints, not footnotes. Until fixed, launch subagents directly rather than through `multi_tool_use.parallel`; never park the parent solely on an expected callback; and verify that each result was delivered. `@jbcode/pi-bash-cwd` adds validated per-call Bash working directories on Pi 0.84.x. Shell mutations inside hidden worktrees still use explicit `cd <worktree> && ...` or `git -C <worktree> ...`, followed by `pwd` or Git top-level verification, as defense-in-depth.
Before starting the full path, preflight required capabilities. Git worktree operations, a writable retained record, an explicit human interaction channel, target-interface validation when applicable, and a Git-capable independent reviewer are mandatory. Todo-herdr and artifact-presenter may degrade to the retained record and a reported artifact path, but their absence cannot bypass a gate. In print or JSON mode, or whenever a mandatory gate or validator cannot run, emit the pending decision or validation instructions and stop before product mutation.
@@ -144,7 +144,7 @@ When uncertain, use the full path. Record why the light path is safe when a chan
1. Read repository instructions, relevant docs, ADRs, tests, and current Git state.
2. Record the source branch and exact base commit.
3. Create `./.worktrees/<feature>` on a descriptive feature branch before feature edits.
4. Prove every subsequent shell command's location with explicit `cd` or `git -C`; do not rely on the Bash tool's configured `cwd` until its tracked defect is fixed.
4. Prove every subsequent shell command's location with explicit `cd` or `git -C`; treat the Bash cwd override as protection against fallback execution, not a replacement for the location proof.
5. If the source checkout is dirty, explain exactly which changes the new worktree omits and ask before proceeding.
6. Atomically create the unique workflow record in the worktree and create a task tree in the session.
7. Run applicable documentation checks, then commit the initial record as a pre-mutation recovery checkpoint.