mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
fix: write system prompts to file to avoid Windows command line limit
Changes: - Write system prompts to CLAUDE.md file instead of passing inline - Use setting_sources=["project"] to load prompts from file - Affects spec_chat_session.py and assistant_chat_session.py Why: - Windows has ~8191 character command line limit - System prompts (e.g., create-spec.md at ~19KB) exceeded this limit - The SDK serializes system_prompt as a CLI argument - Writing to file and using setting_sources bypasses the limit This completes the fix for GitHub issue #33 (Windows "Command Line Too Long"). The previous commit removed **os.environ from MCP configs; this commit addresses the larger system prompt issue. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,6 +154,13 @@ class SpecChatSession:
|
||||
project_path = str(self.project_dir.resolve())
|
||||
system_prompt = skill_content.replace("$ARGUMENTS", project_path)
|
||||
|
||||
# Write system prompt to CLAUDE.md file to avoid Windows command line length limit
|
||||
# The SDK will read this via setting_sources=["project"]
|
||||
claude_md_path = self.project_dir / "CLAUDE.md"
|
||||
with open(claude_md_path, "w", encoding="utf-8") as f:
|
||||
f.write(system_prompt)
|
||||
logger.info(f"Wrote system prompt to {claude_md_path}")
|
||||
|
||||
# Create Claude SDK client with limited tools for spec creation
|
||||
# Use Opus for best quality spec generation
|
||||
# Use system Claude CLI to avoid bundled Bun runtime crash (exit code 3) on Windows
|
||||
@@ -167,7 +174,9 @@ class SpecChatSession:
|
||||
options=ClaudeAgentOptions(
|
||||
model="claude-opus-4-5-20251101",
|
||||
cli_path=system_cli,
|
||||
system_prompt=system_prompt,
|
||||
# System prompt loaded from CLAUDE.md via setting_sources
|
||||
# This avoids Windows command line length limit (~8191 chars)
|
||||
setting_sources=["project"],
|
||||
allowed_tools=[
|
||||
"Read",
|
||||
"Write",
|
||||
|
||||
Reference in New Issue
Block a user