You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add fine-grained system prompt customization (customize mode)
Add a new 'customize' mode for systemMessage configuration, enabling
SDK consumers to selectively override individual sections of the CLI
system prompt while preserving the rest. This sits between the existing
'append' and 'replace' modes.
9 configurable sections: identity, tone, tool_efficiency,
environment_context, code_change_rules, guidelines, safety,
tool_instructions, custom_instructions.
4 override actions per section: replace, remove, append, prepend.
Unknown section IDs are handled gracefully: content-bearing overrides
are appended to additional instructions with a warning, and remove
on unknown sections is silently ignored.
Types and constants added to all 4 SDK languages (TypeScript, Python,
Go, .NET). Documentation updated across all READMEs and getting-started
guide.
Companion runtime PR: github/copilot-agent-runtime#4751
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Each override supports four actions: `replace`, `remove`, `append`, and `prepend`. Unknown section IDs are handled gracefully — content is appended to additional instructions and a warning is emitted; `remove` on unknown sections is silently ignored.
1277
+
1278
+
See the language-specific SDK READMEs for examples in [TypeScript](../nodejs/README.md), [Python](../python/README.md), [Go](../go/README.md), and [C#](../dotnet/README.md).
[SystemPromptSections.Tone] =new() { Action=SectionOverrideAction.Replace, Content="Respond in a warm, professional tone. Be thorough in explanations." },
[SystemPromptSections.Guidelines] =new() { Action=SectionOverrideAction.Append, Content="\n* Always cite data sources" },
488
+
},
489
+
Content="Focus on financial analysis and reporting."
490
+
}
491
+
});
492
+
```
493
+
494
+
Available section IDs are defined as constants on `SystemPromptSections`: `Identity`, `Tone`, `ToolEfficiency`, `EnvironmentContext`, `CodeChangeRules`, `Guidelines`, `Safety`, `ToolInstructions`, `CustomInstructions`.
495
+
496
+
Each section override supports four actions: `Replace`, `Remove`, `Append`, and `Prepend`. Unknown section IDs are handled gracefully: content is appended to additional instructions, and `Remove` overrides are silently ignored.
497
+
498
+
#### Replace Mode
499
+
472
500
For full control (removes all guardrails), use `Mode = SystemMessageMode.Replace`:
-`ReasoningEffort` (string): Reasoning effort level for models that support it ("low", "medium", "high", "xhigh"). Use `ListModels()` to check which models support this option.
149
149
-`SessionID` (string): Custom session ID
150
150
-`Tools` ([]Tool): Custom tools exposed to the CLI
151
-
-`SystemMessage` (\*SystemMessageConfig): System message configuration
151
+
-`SystemMessage` (\*SystemMessageConfig): System message configuration. Supports three modes:
152
+
-**append** (default): Appends `Content` after the SDK-managed prompt
153
+
-**replace**: Replaces the entire prompt with `Content`
154
+
-**customize**: Selectively override individual sections via `Sections` map (keys: `SectionIdentity`, `SectionTone`, `SectionToolEfficiency`, `SectionEnvironmentContext`, `SectionCodeChangeRules`, `SectionGuidelines`, `SectionSafety`, `SectionToolInstructions`, `SectionCustomInstructions`; values: `SectionOverride` with `Action` and optional `Content`)
152
155
-`Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
The SDK auto-injects environment context, tool instructions, and security guardrails. The default CLI persona is preserved, and your `content` is appended after SDK-managed sections. To change the persona or fully redefine the prompt, use `mode: "replace"`.
446
+
The SDK auto-injects environment context, tool instructions, and security guardrails. The default CLI persona is preserved, and your `content` is appended after SDK-managed sections. To change the persona or fully redefine the prompt, use `mode: "replace"` or `mode: "customize"`.
447
+
448
+
#### Customize Mode
449
+
450
+
Use `mode: "customize"` to selectively override individual sections of the prompt while preserving the rest:
// Additional instructions appended after all sections
469
+
content: "Focus on financial analysis and reporting.",
470
+
},
471
+
});
472
+
```
473
+
474
+
Available section IDs: `identity`, `tone`, `tool_efficiency`, `environment_context`, `code_change_rules`, `guidelines`, `safety`, `tool_instructions`, `custom_instructions`. Use the `SYSTEM_PROMPT_SECTIONS` constant for descriptions of each section.
475
+
476
+
Each section override supports four actions:
477
+
-**`replace`** — Replace the section content entirely
478
+
-**`remove`** — Remove the section from the prompt
479
+
-**`append`** — Add content after the existing section
480
+
-**`prepend`** — Add content before the existing section
481
+
482
+
Unknown section IDs are handled gracefully: content from `replace`/`append`/`prepend` overrides is appended to additional instructions, and `remove` overrides are silently ignored.
483
+
484
+
#### Replace Mode
447
485
448
486
For full control (removes all guardrails), use `mode: "replace"`:
0 commit comments