Skip to content

Commit 7df8549

Browse files
MackinnonBuckCopilot
authored andcommitted
Add last_instructions configurable section
Expose lastInstructions as a customizable section across all 4 SDKs, addressing review feedback about duplicate tool-efficiency blocks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4fc09a1 commit 7df8549

File tree

9 files changed

+14
-7
lines changed

9 files changed

+14
-7
lines changed

docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ const session = await client.createSession({
12611261
});
12621262
```
12631263

1264-
Available section IDs: `identity`, `tone`, `tool_efficiency`, `environment_context`, `code_change_rules`, `guidelines`, `safety`, `tool_instructions`, `custom_instructions`.
1264+
Available section IDs: `identity`, `tone`, `tool_efficiency`, `environment_context`, `code_change_rules`, `guidelines`, `safety`, `tool_instructions`, `custom_instructions`, `last_instructions`.
12651265

12661266
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.
12671267

dotnet/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ var session = await client.CreateSessionAsync(new SessionConfig
531531
});
532532
```
533533

534-
Available section IDs are defined as constants on `SystemPromptSections`: `Identity`, `Tone`, `ToolEfficiency`, `EnvironmentContext`, `CodeChangeRules`, `Guidelines`, `Safety`, `ToolInstructions`, `CustomInstructions`.
534+
Available section IDs are defined as constants on `SystemPromptSections`: `Identity`, `Tone`, `ToolEfficiency`, `EnvironmentContext`, `CodeChangeRules`, `Guidelines`, `Safety`, `ToolInstructions`, `CustomInstructions`, `LastInstructions`.
535535

536536
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.
537537

dotnet/src/Types.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,8 @@ public static class SystemPromptSections
10331033
public const string ToolInstructions = "tool_instructions";
10341034
/// <summary>Repository and organization custom instructions.</summary>
10351035
public const string CustomInstructions = "custom_instructions";
1036+
/// <summary>End-of-prompt instructions: parallel tool calling, persistence, task completion.</summary>
1037+
public const string LastInstructions = "last_instructions";
10361038
}
10371039

10381040
/// <summary>

go/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Event types: `SessionLifecycleCreated`, `SessionLifecycleDeleted`, `SessionLifec
153153
- `SystemMessage` (\*SystemMessageConfig): System message configuration. Supports three modes:
154154
- **append** (default): Appends `Content` after the SDK-managed prompt
155155
- **replace**: Replaces the entire prompt with `Content`
156-
- **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`)
156+
- **customize**: Selectively override individual sections via `Sections` map (keys: `SectionIdentity`, `SectionTone`, `SectionToolEfficiency`, `SectionEnvironmentContext`, `SectionCodeChangeRules`, `SectionGuidelines`, `SectionSafety`, `SectionToolInstructions`, `SectionCustomInstructions`, `SectionLastInstructions`; values: `SectionOverride` with `Action` and optional `Content`)
157157
- `Provider` (\*ProviderConfig): Custom API provider configuration (BYOK). See [Custom Providers](#custom-providers) section.
158158
- `Streaming` (bool): Enable streaming delta events
159159
- `InfiniteSessions` (\*InfiniteSessionConfig): Automatic context compaction configuration
@@ -218,7 +218,7 @@ session, err := client.CreateSession(ctx, &copilot.SessionConfig{
218218
})
219219
```
220220

221-
Available section constants: `SectionIdentity`, `SectionTone`, `SectionToolEfficiency`, `SectionEnvironmentContext`, `SectionCodeChangeRules`, `SectionGuidelines`, `SectionSafety`, `SectionToolInstructions`, `SectionCustomInstructions`.
221+
Available section constants: `SectionIdentity`, `SectionTone`, `SectionToolEfficiency`, `SectionEnvironmentContext`, `SectionCodeChangeRules`, `SectionGuidelines`, `SectionSafety`, `SectionToolInstructions`, `SectionCustomInstructions`, `SectionLastInstructions`.
222222

223223
Each section override supports four actions:
224224
- **`replace`** — Replace the section content entirely

go/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const (
122122
SectionSafety = "safety"
123123
SectionToolInstructions = "tool_instructions"
124124
SectionCustomInstructions = "custom_instructions"
125+
SectionLastInstructions = "last_instructions"
125126
)
126127

127128
// SectionOverride defines an override operation for a single system prompt section.

nodejs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ const session = await client.createSession({
501501
});
502502
```
503503

504-
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.
504+
Available section IDs: `identity`, `tone`, `tool_efficiency`, `environment_context`, `code_change_rules`, `guidelines`, `safety`, `tool_instructions`, `custom_instructions`, `last_instructions`. Use the `SYSTEM_PROMPT_SECTIONS` constant for descriptions of each section.
505505

506506
Each section override supports four actions:
507507
- **`replace`** — Replace the section content entirely

nodejs/src/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ export type SystemPromptSection =
285285
| "guidelines"
286286
| "safety"
287287
| "tool_instructions"
288-
| "custom_instructions";
288+
| "custom_instructions"
289+
| "last_instructions";
289290

290291
/** Section metadata for documentation and tooling. */
291292
export const SYSTEM_PROMPT_SECTIONS: Record<SystemPromptSection, { description: string }> = {
@@ -298,6 +299,7 @@ export const SYSTEM_PROMPT_SECTIONS: Record<SystemPromptSection, { description:
298299
safety: { description: "Environment limitations, prohibited actions, security policies" },
299300
tool_instructions: { description: "Per-tool usage instructions" },
300301
custom_instructions: { description: "Repository and organization custom instructions" },
302+
last_instructions: { description: "End-of-prompt instructions: parallel tool calling, persistence, task completion" },
301303
};
302304

303305
/**

python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ session = await client.create_session(
258258
)
259259
```
260260

261-
Available section IDs: `"identity"`, `"tone"`, `"tool_efficiency"`, `"environment_context"`, `"code_change_rules"`, `"guidelines"`, `"safety"`, `"tool_instructions"`, `"custom_instructions"`. Use the `SYSTEM_PROMPT_SECTIONS` dict for descriptions of each section.
261+
Available section IDs: `"identity"`, `"tone"`, `"tool_efficiency"`, `"environment_context"`, `"code_change_rules"`, `"guidelines"`, `"safety"`, `"tool_instructions"`, `"custom_instructions"`, `"last_instructions"`. Use the `SYSTEM_PROMPT_SECTIONS` dict for descriptions of each section.
262262

263263
Each section override supports four actions:
264264
- **`replace`** — Replace the section content entirely

python/copilot/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ class Tool:
228228
"safety",
229229
"tool_instructions",
230230
"custom_instructions",
231+
"last_instructions",
231232
]
232233

233234
SYSTEM_PROMPT_SECTIONS: dict[SystemPromptSection, str] = {
@@ -240,6 +241,7 @@ class Tool:
240241
"safety": "Environment limitations, prohibited actions, security policies",
241242
"tool_instructions": "Per-tool usage instructions",
242243
"custom_instructions": "Repository and organization custom instructions",
244+
"last_instructions": "End-of-prompt instructions: parallel tool calling, persistence, task completion",
243245
}
244246

245247

0 commit comments

Comments
 (0)