Skip to content

Pass the prompt to the Claude Code CLI via stdin - #497

Merged
codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
krllx:fix-claude-code-stdin-prompt
Sep 29, 2026
Merged

codelion merged 1 commit into
algorithmicsuperintelligence:mainfrom
krllx:fix-claude-code-stdin-prompt

Conversation

@krllx

@krllx krllx commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

The claude_code backend passes the whole prompt to claude -p as one argv string. Linux caps a single argument at 128 KiB (MAX_ARG_STRLEN), so once the prompt carries a few parent programs and artifacts, every call fails with [Errno 7] Argument list too long: 'claude' and the iteration is lost. I ran into it evolving a ~43 KB program: the first iterations worked, then all calls failed.

claude -p reads the prompt from stdin when no positional prompt is given, so the prompt now goes there. The system prompt still goes through --system-prompt.

Tests: the two tests that looked for the prompt in argv now check stdin, plus a new one with a 200 KB prompt. python -m unittest tests.test_claude_code_llm passes.

A prompt passed as a single argv string hits Linux's 128 KiB per-argument
limit (MAX_ARG_STRLEN). Once a prompt carries a few parent programs and
artifacts, every call fails with "[Errno 7] Argument list too long:
'claude'" and the iteration is lost. `claude -p` reads the prompt from
stdin when no positional prompt is given, so send it there.
@CLAassistant

CLAassistant commented Sep 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codelion
codelion merged commit 4f4b0c4 into algorithmicsuperintelligence:main Sep 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants