Skip to content

Commit 7342d71

Browse files
committed
pi: move subagent system prompts out of argv for the Windows command-line cap
Pi subagents (historian/dreamer/sidekick) spawn a pi subprocess and passed the system prompt (~60KB for the historian) as a single --system-prompt argv token. Windows CreateProcess caps the entire command line at 32,767 characters, so every such spawn failed with ENAMETOOLONG before Pi started — on Windows the historian never ran at all, and sessions grew past the context limit unchecked. The existing large-prompt fallback only rerouted the user message to stdin (calibrated for Linux's 128KB per-argument limit) and never covered the system prompt. The runner now writes the system prompt to a per-run temp file and passes the absolute path (Pi reads an existing path as the replacement prompt file), on every platform, so the argv-size failure class is gone rather than special-cased. The file is cleaned up on settle and on spawn failure. On win32 the user message is additionally always delivered via stdin, keeping the child command line small regardless of prompt sizes; other platforms keep the >96KB stdin fallback. buildArgs also passes --no-context-files so hidden one-shot subagents receive exactly the system prompt we built instead of having project AGENTS.md/CLAUDE.md appended by Pi. Fixes #209
1 parent 6704568 commit 7342d71

2 files changed

Lines changed: 349 additions & 58 deletions

File tree

0 commit comments

Comments
 (0)