Skip to content

pipeline: management-role system prompts sit below Anthropic's minimum cacheable prefix — every management call reads 0% cache #1855

Description

@macanderson

Problem

Every management role (triage/verdict/guidance/plan/conversational) dispatches through metered_raw_call with tools: Vec::new() and a role-specific instruction block as the system message (crates/stella-pipeline/src/pipeline/raw_usage.rs, management_prompt.rs). The Anthropic adapter stamps cache_control on that system block, but e.g. TRIAGE_INSTRUCTIONS is ~600 tokens — below Anthropic's ≥1024-token minimum cacheable prefix (management_prompt.rs:18-23 admits this) — so no cache entry is ever created. With the deck defaulting to pipeline mode, several such calls ride every turn, adding input tokens with 0% cache read. This is likely the largest single contributor to Stella's 76% aggregate cache ratio vs Claude Code's 93%: it moves the denominator without ever moving the numerator.

Fix direction

Options, roughly in order of leverage:

  1. Fold the fixed instruction blocks into ONE shared ≥1024-token system prefix reused byte-identically across all management roles (role-specific instruction rides as the first user message), so all roles share one cache entry.
  2. Route management calls to a cheap model tier by default (their tokens then stop dominating the cost side even uncached) — the routing plumbing exists (role router).
  3. Both.

Verify

Measure before/after on a recorded pipeline run (the cache_insight surface); adapter-level witness that all management roles serialize the identical system prefix bytes.

Constraints

Prompt changes affect triage/verdict quality — keep the per-role output contracts (PASS/FAIL token etc.) intact and diff behavior on the replay fixtures (crates/stella-pipeline/tests). Related: PR #1811 (output side), #1840 (conversational input side).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Important — next in linearea:pipelinestella-pipeline — triage→…→judge orchestration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions