From 3d7c1f936e2f1cee8d850b88a43bb0d325b5e29b Mon Sep 17 00:00:00 2001 From: catchingknives <35201177+catchingknives@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:34:17 +0100 Subject: [PATCH] Add --bare flag to algorithm.ts subprocess spawns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Algorithm loop mode spawns `claude -p` subprocesses for both parallel workers and sequential iterations. Without `--bare`, each subprocess loads all hooks, LSP, plugins, and walks skill directories — overhead that compounds with parallel agents and causes unintended side-effects (voice notifications, session state writes, rating capture) in headless automation context. `--bare` (added in Claude Code v2.1.81) skips hooks, LSP init, plugin sync, and skill directory walks for scripted `-p` calls. Interactive mode (line 1227) is intentionally left unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) --- Releases/v4.0.3/.claude/PAI/Tools/algorithm.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Releases/v4.0.3/.claude/PAI/Tools/algorithm.ts b/Releases/v4.0.3/.claude/PAI/Tools/algorithm.ts index 3d40be0f9..b2947822c 100644 --- a/Releases/v4.0.3/.claude/PAI/Tools/algorithm.ts +++ b/Releases/v4.0.3/.claude/PAI/Tools/algorithm.ts @@ -666,7 +666,7 @@ async function runParallelIteration( const processes = assignments.map(assignment => { const criterion = assignment.criteriaDetails[0]; // One criterion per agent const prompt = buildWorkerPrompt(prdPath, assignment.agentId, criterion, iteration); - const proc = Bun.spawn(["claude", "-p", prompt, + const proc = Bun.spawn(["claude", "-p", "--bare", prompt, "--allowedTools", "Edit,Write,Bash,Read,Glob,Grep,WebFetch,WebSearch,NotebookEdit", ], { cwd: dirname(prdPath), @@ -1112,7 +1112,7 @@ async function runLoop(prdPath: string, maxOverride?: number, agentCount: number const prompt = buildIterationPrompt(absPath, newIteration, max); const result = spawnSync("claude", [ - "-p", prompt, + "-p", "--bare", prompt, "--allowedTools", "Edit,Write,Bash,Read,Glob,Grep,WebFetch,WebSearch,Task,TaskCreate,TaskUpdate,TaskList,NotebookEdit", ], { stdio: ["pipe", "pipe", "pipe"],