Skip to content

Context Cycling

The reviewer runs in its own AI context window. On long sessions, that window fills up. Context cycling automatically resets the reviewer's context before it degrades, preserving continuity through a handoff summary.

How it works

  1. The reviewer's accumulated input tokens are tracked against its model's context limit.
  2. When token usage crosses the threshold_pct threshold, a cycle is triggered.
  3. The current reviewer writes a handoff summary — a compressed account of what it's seen and any ongoing concerns.
  4. A new reviewer session starts with the handoff summary plus a tail of recent events.
  5. The old session is deleted.

This is transparent to the client and the agent. The reviewer continues monitoring with the same profile and configuration — only its memory is refreshed.

Configuration

defaults:
  cycle:
    threshold_pct: 0.15
    tail_depth: 10
Key Type Description
threshold_pct float Fraction of context window usage that triggers a cycle (e.g., 0.15 = 15%). Lower values cycle more aggressively.
tail_depth integer Number of recent messages carried over into the fresh context after a cycle.

If omitted, server defaults apply.

Manual cycling

You can force a context reset at any time:

/z cycle

This triggers the same handoff process — the reviewer writes a summary, a new session starts, and monitoring continues with a fresh context window.

When to adjust

  • Lower threshold_pct if the reviewer seems to lose track of context on long sessions — it means the context is filling too much before cycling.
  • Higher threshold_pct if you want the reviewer to retain more history before cycling — useful for sessions where long-range context matters.
  • Higher tail_depth if the reviewer seems disoriented after a cycle — carrying more recent events helps it pick up faster.

Tip

You can check the reviewer's current state with /z spy. If the reviewer's responses seem stale or repetitive, a manual /z cycle can help.