Documentation/Experimental context strategies
v2.0.0-beta.1Snapshot bebdcd1Markdown ↗

Experimental context strategies

Experimental context strategies

For independent plugin/history controls with provider-native continuation, see Native compaction. It is separately opted in through the existing strategy-instance field; Existing evidence-backed strategy behavior and the algorithmic default remain unchanged.

Native compaction binds the provider's construction-time endpoint/account selection; changing it requires a new compatible Agent or fresh context. Known hosted-tool/server-token conflicts stop before compaction. Supported raw OpenAI prompt controls participate in provider counts, and selected contributions retain their shared timeout across plugin/history phases. See the native recipe for exact support and recovery boundaries.

Automatic and explicit native composition preserve the existing beforeCompaction memory-writing hook: plugin content/revision changes receive one bounded refresh before reduction. Manual targets retain the same lifecycle and measured compaction events, including with automatic: false. Read-only native source proofs stop waiting on cancellation/ModelTask deadlines, and late reads cannot resume a cancelled turn. Admitted archival writes retain ownership until settled. Anthropic top-level Responses reasoning is explicitly unsupported on this opted-in path; it is rejected before counting or archival. Nested thinking must also have replay fields supported by the selected provider; foreign/incomplete opaque blocks reject before reduction or archival. Run npm run example:native-hooks or npm run example:native-hooks-manual offline, or add -- --live=openai / -- --live=anthropic for bounded actual calls. Manual live Anthropic mode demonstrates an 8192-token fixed-thinking budget. Native output defaults to that fixed budget plus 4096 summary tokens (bounded by model capacity); explicit host caps are never raised. Known cap conflicts reject before archival. Internal streaming supports large native output limits; main thinking remains unchanged. See the native recipe for matching reservation/source bounds.

Algorithmic remains the default; the alternatives remain experimental.

Use ObservationMaskingStrategy for helper-free masking of older acknowledged read observations, or StructuredSummaryStrategy for a bounded compactor summary plus masking. Both require enabled evidence storage and preserve user messages, call arguments/receipt metadata, recent turns, pending dependencies, write/unknown effects and opaque state. Summary capsules remain assistant data. The algorithmic default and existing explicit rollover/custom strategy contracts are unchanged.

Read Context Strategies for verified constructors, settings/defaults, source-policy matching, scope, canonical JSON, save/load, cancellation, revisions, fallback, diagnostics and support boundaries. A source must remain acknowledged before replacement; source storage failure does not trigger action repetition. References are process-local with the default store; use stable file/custom storage for restart recovery. A valid schema/reference does not establish semantic truth. Final preparation explicitly fails if protected content still cannot fit.

npm run example:context-strategies compares identical deterministic offline workflows. --live --held-out opts into billable OpenAI main/helper calls; the three-provider live test additionally covers Anthropic and Google. The bounded pilot is not statistical proof of quality preservation or lower total cost. AMOS /context strategy selects/inspects the policy; /helpers usage shows actual task accounting. Selection itself makes no helper request. See the Version 2 adoption record for branch/release availability.

Documentation snapshot · 2026-11-02Suggest a correction ↗

Search documentation

Type to search the v2 documentation.