Skip to content

feat(prompt): add GPT narrate-before-tools family residual - #1135

Merged
TheGreatAxios merged 17 commits into
mainfrom
cl-8310-0330-promptresidual-gpt-narrate-before-tools-after-grok-row
Sep 21, 2026
Merged

TheGreatAxios merged 17 commits into
mainfrom
cl-8310-0330-promptresidual-gpt-narrate-before-tools-after-grok-row

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary:

  • Adds a gpt family to detectModelFamily (codex + gpt-* providers/models).
  • Primary and leaf prompts carry a 3-line narrate-before-tools residual exactly once when the session resolves to gpt; grok/claude prompts untouched.
  • Plumbs provider/model through runtime-assembly into buildChatSystemPrompt and appendPromptResidual on leaf runs.

Verification:

  • RED: 33 failing tests committed as 9943068 (gpt family + residual presence/absence/once).
  • GREEN: 4dedafd — 56 pass / 0 fail across src/agent/prompts.test.ts, src/subagent/provider-family.test.ts, src/agent/model-family-policy.test.ts; bun run typecheck clean (tsc --noEmit, exit 0).
  • Note: worktree needed its own bun install — without local node_modules the parent checkout's untyped semver copy breaks typecheck on vendor/intx-types (environment artifact, unrelated to this change).

Overlap: CL-8297 (parallel, unmerged lane) adds the promptResidual hook this branch consumes; this branch carries a minimal compatible hook locally so it is self-contained and green.

Fixes CL-8310

@linear-code

linear-code Bot commented Sep 18, 2026

Copy link
Copy Markdown

CL-8310

Claude-family leaf workers get one <task_guidance> XML block appended
once at the tail of the system prompt via the ModelFamilyPolicy
promptResidual seam. A prose residual did nothing; one XML block cut
Sonnet tokens. Balanced tags, leaf-only, never applied to grok/gpt —
and never a full-prompt XML renderer.
Rebuild the Claude XML residual end to end from Anthropic's prompting docs while keeping CL-7775's measured shape: rationale first, numbered approach, named output contract, one wrapper, leaf-only tail placement. Every line is positively framed and scope-explicit for Sonnet's literal instruction-following; per-line provenance in the PR body.
@TheGreatAxios
TheGreatAxios force-pushed the cl-8310-0330-promptresidual-gpt-narrate-before-tools-after-grok-row branch from 5f90153 to 044c60d Compare September 21, 2026 03:21
The anthropic/claude-sonnet-4 fixture now resolves to the claude family,
so the default column silently measured the task_guidance block. Probe
openai/gpt-4.1 instead (default family until the CL-8310 gpt row lands)
and assert the default column carries no family residual.
Primary and leaf prompts carry a 3-line narrate-before-tools residual when
the active session resolves to the gpt family (codex, gpt-*); grok and
claude prompts are untouched and the residual appears exactly once.

Fixes CL-8310
openai/gpt-4.1 now resolves to the gpt family, so the default column
measured the narrate-before-tools nudge. Probe an unrecognized provider
instead — default family regardless of shipped rows — and assert the
default column carries neither the claude block nor the gpt nudge.
@TheGreatAxios
TheGreatAxios force-pushed the cl-8310-0330-promptresidual-gpt-narrate-before-tools-after-grok-row branch from 044c60d to 2880019 Compare September 21, 2026 03:45
@TheGreatAxios
TheGreatAxios merged commit a98cf9d into main Sep 21, 2026
13 checks passed
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.

1 participant