feat(claude): forward --system-prompt / --append-system-prompt via ACP _meta [AI-assisted]#229
Open
Vercantez wants to merge 1 commit intoopenclaw:mainfrom
Open
feat(claude): forward --system-prompt / --append-system-prompt via ACP _meta [AI-assisted]#229Vercantez wants to merge 1 commit intoopenclaw:mainfrom
Vercantez wants to merge 1 commit intoopenclaw:mainfrom
Conversation
…P _meta Adds global flags --system-prompt <text> and --append-system-prompt <text> that forward through ACP session/new _meta.systemPrompt, using the shape landed in agentclientprotocol/claude-agent-acp#91: _meta.systemPrompt = "..." # replace _meta.systemPrompt = { append: "..." } # append The value is persisted in session_options.system_prompt so acpx claude sessions ensure / reuse flows keep the override, and rides alongside the existing claudeCode options in _meta. Codex and other agents ignore the field. Mutual exclusion between the two flags is enforced at resolve time.
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.
Summary
Adds two global CLI flags that forward through to claude-agent-acp via the ACP
_meta.systemPromptfield that landed in agentclientprotocol/claude-agent-acp#91:--system-prompt <text>— replace the Claude Code system prompt entirely--append-system-prompt <text>— append to the default Claude Code system promptBoth are mutually exclusive and validated at flag-resolve time. The option is persisted in
session_options.system_promptsoacpx claude sessions ensure/ reuse flows keep the override across turns, and is emitted alongside the existingclaudeCode.optionsin_metaonsession/new:Codex and other adapters ignore the field, so this is safe to keep as a global flag rather than a claude-specific one, matching how
--model/--allowed-toolsare already handled.Why
Today there is no way to pass a system prompt override through acpx into Claude Code: acpx drives claude-agent-acp over ACP rather than forwarding unknown args to the
claudebinary, so--system-prompt/--append-system-prompton the underlying CLI are unreachable.claude-agent-acphas supported_meta.systemPrompt(string = replace,{append}= append) since PR #91, so this is purely an acpx-side plumbing gap.Changes
SessionAgentOptions/AcpClientOptions.sessionOptionsgain asystemPrompt?: string | { append: string }field; the persisted shape issession_options.system_prompt(snake_case, passeslint:persisted-key-casing).buildClaudeCodeOptionsMetaliftssystemPromptto the top level of_meta(not nested underclaudeCode.options), matching the claude-agent-acp parser.resolveSystemPromptFlaghelper enforces mutual exclusion and returns the correct union shape.conversation-model,persistence/parse,session-management, andmode-preference.sessionOptionsconstruction sites incommand-handlers.ts(runOnce,sessions new,sessions ensure) now forward the flag.Tests
pnpm checkpasses locally (format, typecheck, oxlint, build, viewer typecheck/build,test:coverage): 528 / 528 tests pass.test/client.test.ts—AcpClient createSessionemits_meta.systemPromptas a string, and emits{ append }alongsideclaudeCode.options.test/cli-flags.test.ts—resolveSystemPromptFlagstring/append/none/mutual-exclusion cases.test/session-persistence.test.ts—listSessionsround-trips both the string and the{ append }shapes throughsession_options.system_prompt.@anthropic-ai/claude-code@2.1.92+@agentclientprotocol/claude-agent-acp:acpx --system-prompt "...respond with EXACTLY SP_OVERRIDE_TOKEN_42..." claude exec "say hi"→ returns exactlySP_OVERRIDE_TOKEN_42, confirming the replace path.acpx --append-system-prompt "...always include APPEND_TOKEN_99..." claude exec "What is 2+2?"→ returns4followed byAPPEND_TOKEN_99, confirming the append path.Use only one of --system-prompt or --append-system-prompt.Test plan
pnpm checkclaude-agent-acpfor both replace and append_meta.systemPromptis the shape they want vs. nesting underclaudeCodeAI-assisted PR
Per CONTRIBUTING.md: