Repository navigation
feat(prompt): model-conditional prompt tiers — mechanism only, provable no-op (ent#243) - #2044
Conversation
…le no-op (ent#243) Claude 5-generation context-engineering guidance (rules → judgment, examples → interface design) applies to frontier coding-post-trained models and is actively harmful below that line — Sonnet 4.5 and Haiku 4.5 need the structure it deletes. Three vendors reached that conclusion independently, so the fault line is model class, not vendor and not harness. This lands the selection mechanism and nothing else. `_MINIMAL_PREFIXES` ships EMPTY, so every model resolves VERBOSE and the rendered prompt is byte-identical to dev (sha256 4cabe455…, 9207 bytes, verified directly against origin/dev and pinned by test over the live PRESET_MODELS list). Enabling a family is PR 2, behind per-(runtime, model-tier) evidence — a fleet-wide prompt change does not belong in the same PR as the mechanism that makes it possible. Keyed on the MODEL, not the runtime. MODEL-001 lets any turn pin any model string including free text, so a claude-code agent routinely runs Haiku 4.5; gating on the runtime label would silently degrade most of the selectable surface. `runtime` keeps its orthogonal job (Codex MCP tool naming, #1187). - services/prompt_tier.py: family-prefix classifier mirroring model_context.py. Total, pure-stdlib, unknown/empty/None → VERBOSE. That asymmetry is load bearing: over-instructing a Claude 5 model costs tokens, under-instructing a 4.5 model degrades it silently. - platform_prompt_service: PLATFORM_INSTRUCTIONS stays ONE authored literal; sections are derived by splitting on its top-level "###" headings, never re-typed into a parallel list — two full prompt strings guarantee drift, and the drift that matters is a security instruction added to only one variant. The delimiter cannot match the "####" subsections, and split/join round-trips byte-exactly. An unmapped or renamed heading renders at every tier, with the heading set CI-pinned so a rename fails loudly instead of orphaning its entry. - Operator Communication (#1402 fire-and-park contract), the shared-memory-dir leak warning, and Package Persistence render at every tier: not tool-usage guidance, no tool description to live in. - Close both model-threading gaps. pull_coordination_service omitted `model` from its ExecutionContext entirely — absent, not None — so every pull-claimed turn would have resolved VERBOSE forever with nothing to indicate why. Both degraded fallback paths pass the model too, so a context-build failure cannot silently swap the tier as well as the context block. An unpinned chat turn stays VERBOSE by design: the container picks the model (claude_code.py → claude-sonnet-4-6) AFTER composition, so the decision does not exist backend-side and cannot be threaded. That default is already correct for a 4.x model. Resolving the platform default backend-side instead would trade a known-safe gap for a hidden one, since it can diverge from the agent's own get_default_model(). Tracked as a follow-up; same split underlies #1521. Requirements: docs/memory/requirements/runtimes.md §41.
vybe
left a comment
There was a problem hiding this comment.
Shipping the mechanism as a provable no-op is the right shape, and the proof is the right one — test_every_preset_renders_the_unchanged_prompt over the live preset list plus test_minimal_prefix_set_is_empty, so the no-op is pinned rather than asserted in the description. A fleet-wide prompt change genuinely does not belong in the same PR as the mechanism enabling it.
The fail-toward-VERBOSE default is the load-bearing decision and the asymmetry argument for it is correct: over-instructing a frontier model costs tokens, under-instructing a 4.5 model degrades it silently, with no error and no signal. With MODEL-001 free-text passthrough an unknown id is routine rather than exceptional, so that default bounds the blast radius to status quo. The docstring's explicit "do NOT modernize this by defaulting unknown to MINIMAL" is worth keeping — that is exactly the change someone will propose later on plausible-sounding grounds.
Keying on the model rather than AGENT_RUNTIME is right for the reason given: a claude-code agent routinely runs Haiku 4.5, so a runtime gate would silently degrade most of the selectable surface, and runtime already has an orthogonal job (Codex MCP tool naming, #1187 F-MCP). Pinning that with test_tier_is_not_keyed_on_runtime keeps the two axes from being conflated later.
Good call stating the not-vendored contrast to Invariant #5 explicitly, with the condition under which that would change — the backend composes the prompt and ships it in the turn payload, so the agent server never resolves a tier.
The MINIMAL-path tests are the part I'd have asked for if they were missing: test_minimal_keeps_the_operator_contract_verbatim, ..._keeps_the_user_memory_leak_warning, ..._has_no_dangling_delimiters all exercise a code path unreachable today, which is what makes PR 2 a config change rather than a leap.
One thing to settle before PR 2, not here: ent#243 is on the enterprise tracker, and the standing rule is that enterprise-tracker features are entitlement-gated by default unless explicitly decided OSS-core. This PR lands ungated in src/backend/services/. That is fine as-is because it is a no-op — nothing diverges between editions today. But PR 2 is where it bites: enabling a family would mean OSS and enterprise agents get materially different system prompts, and "which edition gets the better prompt" is a product call rather than an implementation detail. Worth confirming the gating shape with @vybe before PR 2 rather than after.
What
Lands the mechanism for model-conditional platform prompts, and nothing else.
_MINIMAL_PREFIXESships empty, so every model resolvesVERBOSEand therendered prompt is byte-identical to
dev. Enabling a family is PR 2, behindevaluation evidence.
Implements ent#243 PR 1 (ACs on that issue were revised today to match the
research pass in its comment thread — the original ACs described a
runtime-scoped version this supersedes).
Why the model, not the runtime
The Claude 5 context-engineering guidance (rules → judgment, examples →
interface design) applies to frontier coding-post-trained models and is
actively harmful below that line — Sonnet 4.5 and Haiku 4.5 need the
structure it deletes. OpenAI (Codex over-prompting) and Google (Gemini 3
over-analyzing verbose prompts) reached the same conclusion independently, so
the fault line is model class, not vendor and not harness.
MODEL-001 lets any turn pin any model string, including free text, so a
claude-codeagent routinely runs Haiku 4.5. Gating onAGENT_RUNTIMEwouldsilently degrade most of the selectable surface.
runtimekeeps its orthogonaljob — Codex MCP tool naming (#1187 F-MCP) — and a test pins the signature so the
two axes can't quietly merge.
Design
services/prompt_tier.py— family-prefix classifier mirroringservices/model_context.py. Total, pure-stdlib, never raises.Unknown/empty/
None→VERBOSE. That asymmetry is load-bearing:over-instructing a Claude 5 model costs tokens, under-instructing a 4.5 model
degrades it silently. Not vendored to the agent server — the backend composes
the prompt and ships it in the turn payload.
PLATFORM_INSTRUCTIONSstays oneauthored literal; sections are derived by splitting on its top-level
###headings. Two full prompt strings guarantee drift, and the drift that matters
is a security instruction added to one variant and not the other. The delimiter
cannot match the
####subsections, andsplit/joinround-trips byte-exactly.sentinel-locked and synced to
config/trinity-meta-prompt/prompt.md), theshared-memory-dir leak warning, and Package Persistence. None is tool-usage
guidance; none has a tool description to live in.
the heading set is CI-pinned — otherwise a rename silently orphans its
drop-list entry.
Model-threading gaps closed
pull_coordination_serviceomittedmodelfrom itsExecutionContextentirely — absent, not
None— so every pull-claimed turn would haveresolved
VERBOSEforever with nothing to indicate why. Both degraded fallbackpaths now pass the model too, so a context-build failure cannot silently swap the
prompt tier as well as the context block.
An unpinned chat turn stays
VERBOSEby design: the container picks the model(
claude_code.py→claude-sonnet-4-6) after composition, so the decision doesnot exist backend-side and cannot be threaded. That default is already correct for
a 4.x model. Resolving the platform default backend-side would trade a known-safe
gap for a hidden one, since it can diverge from the agent's own
get_default_model(). Tracked as a follow-up; the same split underlies #1521'scontext-window safe floor.
Verification
origin/dev—PLATFORM_INSTRUCTIONShashes
sha256 4cabe4557f2580580d154476406ace31525bdde4354a9ef77d6884affba2158e,9207 bytes, on both sides. Identical, not merely equivalent.
tests/unit/test_ent243_prompt_tier.py), including aparametrized no-op proof over the live
PRESET_MODELSlist parsed fromModelSelector.vue— a preset added later is covered without anyone updatingthe test — plus a guard against that parse silently breaking.
test_1402_prompt_contract.py,test_1535_report_prompt_guidance.py,test_platform_prompt_runtime.py,test_public_channel_prompt.pyall green. 351 passed across theprompt/chat/pull/task-execution selection.
tests/lint_sys_modules.py: 194 violations vs baseline 240 — no new.Pre-existing failure, not from this PR
The full local unit suite fails
test_1081_physical_meter.py::TestPerAgentMeter::test_available_floors_at_zero_over_ceiling[sqlite].Clean
origin/dev@47f8843bfails the identical test with the identicalcommand, so this branch inherits it rather than causing it. It is an
order-dependent
sys.modulesleak surfaced bypytest-randomly; the file passes14/14 in isolation. Filed separately.
Requirements
docs/memory/requirements/runtimes.md§41 (written before implementation perRoE #1).
🤖 Generated with Claude Code