Repository navigation
fix(llm): pass long Claude Code system prompts through a file - #2456
Merged
pancacake merged 1 commit intoNov 5, 2026
Merged
Conversation
The Claude Agent SDK turns a string system prompt into
`--system-prompt <text>` on the CLI command line. Windows caps the whole
command line at 32,767 characters, so Mastery Path (about 45K characters)
failed to spawn with WinError 206. Python raises that as
FileNotFoundError, and the SDK reports it as "Claude Code not found".
Prompts over 8,000 characters are now written to a content-addressed file
in the provider's temp workspace and passed as the SDK's
`{"type": "file", "path": ...}` option. Shorter prompts stay inline.
Fixes HKUDS#2333
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On Windows, the Claude Code provider fails for any capability with a system prompt over about 32K characters. Mastery Path (about 45K) is the first one users hit.
Cause:
_build_optionspassedsystem_promptas a string. The SDK puts that on the command line as--system-prompt <text>.CreateProcesscaps the whole command line at 32,767 characters. The spawn fails with WinError 206.FileNotFoundError, and the SDK reports it as "Claude Code not found at: ...", which points at the wrong problem.Changes:
system-prompt-<sha256[:16]>.mdin the provider's existing temp workspace. They are passed as the SDK's{"type": "file", "path": ...}option (SystemPromptFile, present in the pinnedclaude-agent-sdk>=0.2.174).replace, so concurrent sessions with the same prompt never read a partial file.The approach follows the fix proposed in the issue by the reporter.
Related Issues
Module(s) Affected
services/llmtestsChecklist
dev(notmain).deeptutor-repo-hygiene, which callspython3and fails only on Windows.python scripts/check_repo_hygiene.pypasses.Additional Notes
tests/services/llm/test_claude_code_provider.py: a long prompt becomes a file option with the full text and no leftover.tmp, and a prompt exactly at the limit stays inline.test_claude_code_provider.py: 15 passed.SystemPromptFileexists inclaude-agent-sdk==0.2.174. Not run against a realclaude.exehere.🤖 Generated with Claude Code