forward --append-system-prompt-file and --system-prompt-file to claude - #23
Merged
umputun merged 1 commit intoJul 31, 2026
Merged
Conversation
Claude Code accepts the system prompt either inline (--append-system-prompt, --system-prompt) or from a file (--append-system-prompt-file, --system-prompt-file). fya's forward allowlist carries only the inline pair, so passing either file variant fails fast with "unknown flag" before claude starts. The file variants matter for large assembled system prompts: an inline prompt rides argv and hits the kernel's MAX_ARG_STRLEN (128 KiB per string), failing execve with E2BIG. Delivering it via a file removes that ceiling, but under fya the flag is rejected, so the PTY path is stuck on the inline form. Both are ordinary value flags, so they belong in forwardValue next to their inline counterparts.
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.
Claude Code accepts the system prompt either inline (
--append-system-prompt,--system-prompt) or from a file (--append-system-prompt-file,--system-prompt-file). The forward allowlist inapp/options/options.gocarries only the inline pair, so passing either file variant fails fast withunknown flag: --append-system-prompt-filebefore claude is ever started.Why the file variants matter
An inline system prompt rides argv, so it is bounded by the kernel's
MAX_ARG_STRLEN— 128 KiB per string, independent ofARG_MAX. Past that,execvefails withE2BIGand the process dies before claude runs. We hit this with a large assembled system prompt (agent rules composed from several layers).Claude's file variants remove that ceiling entirely, which is the natural fix — but under
fyathe flag is rejected, so the PTY path has no way to use it and stays on the inline form.Change
Both are ordinary value flags (
--flag <path>), so they go intoforwardValuenext to their inline counterparts.--system-prompt-fileis included for symmetry, since--system-promptis already forwarded.Extended
TestParseForwardedFlagswith both flags;go build ./...andgo test ./...are green.