Skip to content

feat(coding-agent/prompts): added a model-family prompt overlay#2669

Open
metaphorics wants to merge 1 commit into
can1357:mainfrom
metaphorics:ultra/model-overlay
Open

feat(coding-agent/prompts): added a model-family prompt overlay#2669
metaphorics wants to merge 1 commit into
can1357:mainfrom
metaphorics:ultra/model-overlay

Conversation

@metaphorics

Copy link
Copy Markdown
Contributor

Summary

Adds a pure model-family overlay module (resolveModelOverlay) wired into buildSystemPrompt: a short family-specific tuning section (GPT-5, Claude Opus, or Kimi K2) is appended to the system prompt based on the active model, controlled by the prompt.modelOverlay setting (auto/off/forced-family, default auto).

Tests

Family-detection module test + a buildSystemPrompt integration test (overlay lands in block 0 for a matching model, omitted when off/unmatched, forceable); bun check green.

Note: touches config/settings-schema.ts and docs/settings.md alongside #2655 and #2660; rebase if flagged.

Closes #2661

- Added a pure prompts/model-overlay module: resolveModelOverlay(model, mode) detects the model family (GPT-5, Claude Opus, Kimi K2) and returns a short family-specific tuning section, with omp tool names; off disables and a named mode forces a family.
- Wired it into buildSystemPrompt (appends the section to block 0 when a family matches and the mode is not off) and threaded the prompt.modelOverlay setting through the sdk system-prompt rebuild.
- Added the prompt.modelOverlay enum setting (auto/off/gpt-5/claude-opus/kimi-k2, default auto) plus an integration test that the overlay lands in block 0 for a matching model, is omitted when off or unmatched, and can be forced.
Copilot AI review requested due to automatic review settings June 15, 2026 13:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a configurable “model-family prompt overlay” feature that appends a short family-specific tuning section to the generated system prompt.

Changes:

  • Introduces model-family detection + overlay section rendering (GPT‑5 / Claude Opus / Kimi K2).
  • Wires overlay resolution into buildSystemPrompt and the agent session settings plumbing.
  • Adds unit + integration tests, docs, and changelog entry for the new prompt.modelOverlay setting.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/coding-agent/src/system-prompt.ts Appends resolved model overlay section to system prompt block 0
packages/coding-agent/src/system-prompt-model-overlay.test.ts Integration test ensuring buildSystemPrompt wiring appends/omits overlay correctly
packages/coding-agent/src/sdk.ts Passes prompt.modelOverlay setting into buildSystemPrompt
packages/coding-agent/src/prompts/model-overlay/sections.ts Defines overlay section text per model family
packages/coding-agent/src/prompts/model-overlay/model-overlay.ts Implements ModelOverlayMode and resolveModelOverlay()
packages/coding-agent/src/prompts/model-overlay/model-overlay.test.ts Unit tests for overlay detection + forcing behavior
packages/coding-agent/src/prompts/model-overlay/index.ts Re-exports overlay API
packages/coding-agent/src/prompts/model-overlay/detect.ts Adds model string → family detection
packages/coding-agent/src/config/settings-schema.ts Adds prompt.modelOverlay enum setting with UI metadata
packages/coding-agent/CHANGELOG.md Documents the new overlay feature
docs/settings.md Mentions prompt.* group including the overlay setting

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +31
export function getModelOverlaySection(family: ModelOverlayFamily): string {
if (family === "gpt-5") {
return GPT5_OVERLAY_SECTION;
}
if (family === "claude-opus") {
return CLAUDE_OPUS_OVERLAY_SECTION;
}

return KIMI_K2_OVERLAY_SECTION;
}
Comment on lines +15 to +16
workspaceTree: {
rootPath: process.cwd(),
const rendered = prompt.render(resolvedCustomPrompt ? customSystemPromptTemplate : systemPromptTemplate, data);
const systemPrompt = [rendered];
const overlaySection = resolveModelOverlay(model, modelOverlay);
const systemPrompt = [overlaySection ? `${rendered}\n\n${overlaySection}` : rendered];

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c98cc6c93a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 2189 to +2191
model: settings.get("includeModelInPrompt") ? getActiveModelString() : undefined,
personality: agentKind === "sub" ? "none" : settings.get("personality"),
modelOverlay: settings.get("prompt.modelOverlay"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Decouple overlay detection from model-name rendering

When includeModelInPrompt is false, the model argument passed to buildSystemPromptInternal is undefined, so the newly added prompt.modelOverlay: auto path has no active model to inspect and silently omits the default overlay. This affects users who hide the literal model name but leave the overlay at its default/auto setting; force modes still work, but auto does not match the documented setting. Pass a separate active model value for overlay detection (and rebuild on model switches) instead of reusing the rendered model field.

Useful? React with 👍 / 👎.

@@ -0,0 +1,31 @@
import type { ModelOverlayFamily } from "./detect";

export const GPT5_OVERLAY_SECTION = `## Model overlay: GPT-5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move model overlay copy into prompt files

These constants are provider-facing prompt text, but the repo-level AGENTS.md requires prompts to live in static .md files and be imported with with { type: "text" }, not built as inline strings/template literals. Keeping the overlay copy in TS violates that prompt-file contract and bypasses the same prompt asset workflow used by the rest of prompts/system, so please move each section to .md and import it.

Useful? React with 👍 / 👎.

- Preserve the full requested scope: words like every, all, and for each apply to the complete set, not the first matching item.
- Follow ordered instructions in order; if asked to do X then Y, do not invert or merge the sequence.
- Maintain precise state across long tool workflows without drifting from the original goal.
- Use task for parallelizable multi-file work, and keep edits narrow and grounded in observed files.`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render overlay tool advice conditionally

This overlay hard-codes task (and sibling bullets hard-code other tool names) without checking the active tool set or wire-visible names. In contexts such as subagents at task.maxRecursionDepth where task is not registered, read-only sessions with edit/bash disabled, or modes where a tool has a custom wire name, the system prompt now tells the model to call tools it cannot use; the existing Handlebars prompt avoids this by gating tool advice on availability and rendering through toolRefs.

Useful? React with 👍 / 👎.

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.

prompts: model-family prompt overlay

2 participants