Skip to content

Choose a context policy for a long session

Select a context policy that preserves active constraints, durable facts and a reusable prompt prefix.

Scenario

An archive migration agent works across shifts. Tool output grows every turn. During a shift change the operator updates scope, and cache writes climb. Some sessions lose the new scope after summarization.

Explanation

Edit context to remove tool-result material that is no longer useful. Compact conversation history when the running thread itself is growing. Preserve active constraints, unresolved questions and artifact references in state you can check after compaction. Re-read a hard constraint from its source and enforce it where the action runs, so a summary that drops it cannot cause the action. Store facts that must survive across sessions in durable memory with clear provenance and scope.

Keep the shared prefix stable. Prompt caching reuses a matching prefix. Put volatile task facts after a stable cache boundary when the surface and instruction authority permit it. A real policy change requiring higher-priority instructions needs an intentional version change and a new prefix. Never keep obsolete policy merely to retain a cache hit.

Defer large catalogs where the chosen surface supports tool discovery. Start with the smallest tool set that can do useful work. Pull in more definitions when needed, within the agent's permission boundary.