Autonomous AI sales agent powered by Claude Code or Codex. Finds prospects, writes cold emails, sends campaigns, handles replies, books meetings. No API keys needed — runs on your Claude or Codex subscriptions.
Pass long prompts to claude via stdin to fix Windows training
keepuaheadb6cc0e71ba2c
diff --git a/harvey/brain.py b/harvey/brain.pyindex 095e8ea..305ac17 100644--- a/harvey/brain.py+++ b/harvey/brain.py@@ -20,6 +20,7 @@ SKILLS_DIR = PROJECT_ROOT / "skills"DEFAULT_TIMEOUT_SECONDS = 300 # a single Claude call should never hang foreverDEFAULT_MAX_RETRIES = 2 # retries on transient failures (non-zero exit, timeout)RETRY_BASE_DELAY = 5.0 # seconds; doubles per attempt+_MAX_ARGV_PROMPT_CHARS = 8000 # longer prompts go via stdin (Windows argv limit)# stderr fragments that indicate retrying is pointless_NON_RETRYABLE_PATTERNS = (@@ -56,8 +57,13 @@ class Brain:``agent``/``task`` label the call in the usage_events ledger so thedashboard can attribute tokens and cost to specific work."""- cmd = [- "claude", "-p", prompt,+ # Windows caps a command line at ~32k chars and surfaces the overflow+ # as FileNotFoundError (WinError 206), so long prompts go via stdin.+ prompt_via_stdin = len(prompt) > _MAX_ARGV_PROMPT_CHARS+ cmd = ["claude", "-p"]+ if not prompt_via_stdin:+ cmd.append(prompt)+ cmd += [# JSON output carries exact token/cost accounting per call."--output-format", "json","--dangerously-skip-permissions",@@ -90,13 +96,17 @@ class Brain:*cmd,# DEVNULL: the CLI reads inherited stdin as prompt input,# stealing the terminal (and any piped answers) from Harvey.- stdin=asyncio.subprocess.DEVNULL,+ stdin=(asyncio.subprocess.PIPE if prompt_via_stdin+ else asyncio.subprocess.DEVNULL),stdout=asyncio.subprocess.PIPE,stderr=asyncio.subprocess.PIPE,)try:stdout, stderr = await asyncio.wait_for(- process.communicate(), timeout=timeout+ process.communicate(+ prompt.encode("utf-8") if prompt_via_stdin else None+ ),+ timeout=timeout,)except asyncio.TimeoutError:logger.error(f"Claude call timed out after {timeout:.0f}s. Killing process.")