This commit is contained in:
h z
2026-04-12 14:05:56 +01:00
parent 9cd90f7213
commit 49af2129ae

View File

@@ -17,7 +17,8 @@ export type OpenAITool = {
export type ClaudeDispatchOptions = {
prompt: string;
/** System prompt passed via --system-prompt on every invocation (stateless, not stored in session) */
/** Appended to Claude Code's built-in system prompt via --append-system-prompt on every invocation.
* Stateless: not persisted in session file, fully replaces any prior appended content on resume. */
systemPrompt?: string;
workspace: string;
agentId?: string;
@@ -115,11 +116,12 @@ export async function* dispatchToClaude(
"--dangerously-skip-permissions",
];
// --system-prompt is stateless (not persisted in session file) and fully
// replaces any prior system prompt on each invocation, including resumes.
// We pass it every turn so skills/persona stay current.
// --append-system-prompt appends to Claude Code's built-in system prompt rather
// than replacing it, preserving the full agent SDK instructions (tool use behavior,
// memory management, etc.). The appended bootstrap (persona + skills) is stateless:
// not persisted in the session file, takes effect every invocation including resumes.
if (systemPrompt) {
args.push("--system-prompt", systemPrompt);
args.push("--append-system-prompt", systemPrompt);
}
if (resumeSessionId) {