Add a message history and prompt cache topic guide to `agent_docs`, with matching `CI Review` checks
Merged
DO
10d ago+158+158+012345678901234567890123456789-4-4-0123456789
Adds agent_docs/message-history-and-caching.md, a topic guide with the rules that keep message history byte-stable for the prompt cache and keep content in the channel that matches who wrote it. Each rule has a one-line reason and names the mechanism to use:
- History is append-only outside compaction; changed instructions and tools are appended as deltas.
- Request-scoped (
SystemPromptPart(scope='request')viactx.enqueue) is not request-only (request_context.messages); links the decision table indocs/capabilities/custom.mdinstead of copying it. - Trust tiers map to channels and nothing is promoted: no untrusted content in system voice, no framework voice via
ctx.enqueue(str). - One voice tag (
<system>), and every wrapper escapes its payload. - Framework records are identified by type or metadata, never by visible text.
- Every computed instruction block has a stable id.
- Projection is deterministic (canonicalize on send, deterministic id remaps).
- UI round trips are faithful for everything the model sees, verified with the real JS reducers.
Rules that rely on mechanisms still in review carry a (pending #N) marker (#8188, #9405, #7891 for the framing helper, #8954) so a follow-up can drop it.
Also:
- links the guide from
agent_docs/index.mdand adds one-line pointers in the coreAGENTS.md,capabilities/,models/,toolsets/,ui/and harnessAGENTS.mdfiles plus the harnessagent_docs/index.md; - replaces the
capabilities/AGENTS.mdadvice to put per-turn content "in the user message, tool results, or after the lastCachePoint", which contradicts rules 2 and 3, and the "during a run" scoping of the no-mutation rule (the cache spans runs); - adds a "Message history and prompt cache" targeted check to the
CI Reviewprompt and an Example 6 calibration pair to its review instructions.douwebotreadsAGENTS.mdandagent_docs/directly, so it picks the guide up without a prompt change.
No issue: requested by a maintainer as review guardrails.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.
🤖 Generated with Claude Code