Skip to main content

How the prompt is ordered

Mantle builds the system prompt in a fixed order so a provider can cache the part that stays the same. Sections that rarely change come first, and the turn-varying ones come last. The date, time, and memory notice are separate system messages, and they follow the conversation. Providers that keep message order reuse the unchanged prefix on their own. There is no setting for this order. System Prompt lists each section and when it appears.

Claude routes

Claude does not reuse a prefix unless the request marks it, so Mantle adds those marks on routes that accept them. The model group in integrations.yml decides which marks a route gets. A route must name its adapter, either with provider or with a model prefix such as anthropic/claude-sonnet-4-5. A bare model name with no provider, such as claude-sonnet-4, gets no mark. Add provider: anthropic to get one.

Which marks a route gets

Automatic caching needs a direct call to Anthropic’s API. A router member gets it only when its model string carries the anthropic/ prefix. A member with provider: anthropic and a bare model name gets the system-prompt mark only. The ANTHROPIC_API_BASE and ANTHROPIC_BASE_URL environment variables count as a custom endpoint, because LiteLLM reads them for a route with no base of its own. A router gets a mark only when every route qualifies. A router that includes a provider other than Claude gets neither mark. A router that mixes Anthropic’s API with Bedrock, Vertex AI or Azure AI Foundry gets the system-prompt mark only.

What to expect

  • Trailing notes. On Claude routes, LiteLLM moves every system message into the top-level system field. The date, time, and memory notice therefore sit before the conversation history. A change in them, such as a new minute or a memory update, misses the cached history, while the system-prompt entry still hits.
  • The first system message. The mark covers the whole first system message. That includes the current-turn notice, the acknowledgement, the active skill or routing catalogue, and any pending confirmation. A change in any of them misses both cache entries.
  • Environment variables. Mantle reads ANTHROPIC_API_BASE and ANTHROPIC_BASE_URL when the agent starts. Restart the agent after you change either one.
  • Cost. A cache write costs 1.25 times the input price, and a read costs 0.1 times. Entries last 5 minutes and are refreshed on each read. A conversation that is idle for more than 5 minutes pays the write again. Whether caching lowers your cost depends on how often conversations reuse the cached content.
  • Data. Anthropic holds cached content under its prompt caching terms. On a direct Anthropic route, the cached content includes the conversation history.
  • Turning it off. There is no setting to turn either mark off.

See also