Parent: #66345 — GPT 5.4 Enhancement v3: Hermes Parity Sprint
Priority: P1 — MEDIUM
Type: Architecture / Refactor
Problem
PR 1 (#66346) adds mandatory tool-use categories for GPT-5. Currently, the only way to inject this is via stablePrefix (a flat string) or by hardcoding it into the execution_bias section override. Neither is clean:
stablePrefix doesn't participate in the section override system, so providers can't selectively replace tool enforcement without touching execution bias.
- Stuffing it into
execution_bias conflates two concerns: how the agent executes (bias) vs when it must use tools (enforcement).
Proposed Implementation
Architecture
┌──────────────────────────────────────────────────────┐
│ System Prompt Section Pipeline │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ interaction_style│ │ tool_call_style │ │
│ │ (personality) │ │ (narration rules)│ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ ┌─────────────────┐ ┌─────────────────┐ │
│ │ execution_bias │ │ tool_enforcement │ ← NEW │
│ │ (act first, │ │ (mandatory tool │ │
│ │ don't plan) │ │ categories) │ │
│ └─────────────────┘ └─────────────────┘ │
│ │
│ Each section: provider can override via │
│ sectionOverrides, or fall back to default │
└──────────────────────────────────────────────────────┘
File: src/agents/system-prompt-contribution.ts
Add "tool_enforcement" to the section ID union:
export type ProviderSystemPromptSectionId =
| "interaction_style"
| "tool_call_style"
| "execution_bias"
| "tool_enforcement"; // ← NEW
File: src/agents/system-prompt.ts
Add a new buildOverridablePromptSection call after execution_bias:
...buildOverridablePromptSection({
override: providerSectionOverrides.execution_bias,
fallback: buildExecutionBiasSection({ isMinimal }),
}),
...buildOverridablePromptSection({
override: providerSectionOverrides.tool_enforcement, // ← NEW
fallback: [], // empty by default — only providers that need it inject content
}),
File: extensions/openai/prompt-overlay.ts
Move tool enforcement from stablePrefix to sectionOverrides:
sectionOverrides: {
execution_bias: OPENAI_GPT5_EXECUTION_BIAS,
tool_enforcement: OPENAI_GPT5_TOOL_ENFORCEMENT, // ← moved here
...(params.mode === "friendly" ? { interaction_style: ... } : {}),
},
Benefits
- Separation of concerns: Execution bias and tool enforcement are distinct prompt concerns
- Provider extensibility: Google, Anthropic, or custom providers can inject their own tool enforcement via the same mechanism
- Testability: Each section can be tested independently
- Future-proofing: New providers (e.g., Google Gemini in PR 6) can use
tool_enforcement without modifying core
Verification
- Unit test: GPT-5 models receive tool enforcement section in system prompt
- Unit test: Non-GPT-5 models receive empty tool enforcement section
- Unit test: Custom provider can override tool enforcement independently of execution bias
Parent: #66345 — GPT 5.4 Enhancement v3: Hermes Parity Sprint
Priority: P1 — MEDIUM
Type: Architecture / Refactor
Problem
PR 1 (#66346) adds mandatory tool-use categories for GPT-5. Currently, the only way to inject this is via
stablePrefix(a flat string) or by hardcoding it into theexecution_biassection override. Neither is clean:stablePrefixdoesn't participate in the section override system, so providers can't selectively replace tool enforcement without touching execution bias.execution_biasconflates two concerns: how the agent executes (bias) vs when it must use tools (enforcement).Proposed Implementation
Architecture
File:
src/agents/system-prompt-contribution.tsAdd
"tool_enforcement"to the section ID union:File:
src/agents/system-prompt.tsAdd a new
buildOverridablePromptSectioncall afterexecution_bias:File:
extensions/openai/prompt-overlay.tsMove tool enforcement from
stablePrefixtosectionOverrides:Benefits
tool_enforcementwithout modifying coreVerification