Skip to content

forward --append-system-prompt-file and --system-prompt-file to claude - #23

Merged
umputun merged 1 commit into
umputun:masterfrom
advix-consulting:forward-system-prompt-file
Jul 31, 2026
Merged

forward --append-system-prompt-file and --system-prompt-file to claude#23
umputun merged 1 commit into
umputun:masterfrom
advix-consulting:forward-system-prompt-file

Conversation

@Nikolo

@Nikolo Nikolo commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

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 in app/options/options.go carries only the inline pair, so passing either file variant fails fast with unknown flag: --append-system-prompt-file before 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 of ARG_MAX. Past that, execve fails with E2BIG and 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 fya the 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 into forwardValue next to their inline counterparts. --system-prompt-file is included for symmetry, since --system-prompt is already forwarded.

Extended TestParseForwardedFlags with both flags; go build ./... and go test ./... are green.

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.
@Nikolo
Nikolo requested a review from umputun as a code owner July 31, 2026 08:32
@umputun
umputun merged commit f4cf393 into umputun:master Jul 31, 2026
1 check 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.

2 participants