Skip to main content

Module context_reset

Module context_reset 

Source
Expand description

context_reset: agent-callable Lu et al. reset (arXiv:2510.06727).

§What it does

The agent hands the harness a compressed summary of the session so far. The tool records the reset decision in the audit log and returns a marker ToolResult that the next turn’s derivation can pick up (via DerivePolicy::Reset) as the new anchor for the context window.

Unlike [session_recall], this tool does not read disk or run RLM. The summary text is supplied by the model itself — that is the whole point of Lu et al.’s semantic: the policy decides what to keep, rather than an external summariser guessing.

§When the agent should call it

  • The transcript is getting long and the model wants to proactively fold it before the next tool call.
  • The agent has just completed a sub-task and wants to hand-off a compact state to itself for the next phase.
  • The user’s next message is about to bring in a large payload (large file, long web page) and the agent wants headroom.

§Invariants

  • The tool never mutates [Session::messages]. The summary enters history naturally — as the tool’s ToolResult on the next turn.
  • The returned marker text always starts with [CONTEXT RESET] so Phase B’s derivation policies can recognise it without an out-of-band signal.

§Examples

use codetether_agent::tool::context_reset::{ContextResetTool, format_reset_marker};

// Sanity-check the stable marker format the next-turn derivation
// policy can look for.
let body = format_reset_marker("summary body", 42);
assert!(body.starts_with("[CONTEXT RESET]"));
assert!(body.contains("summary body"));
assert!(body.contains("bytes=42"));

let _ = ContextResetTool;

Structs§

ContextResetTool
Agent-callable Lu et al. reset tool.

Constants§

RESET_MARKER_PREFIX
Marker prefix that identifies a context_reset tool output in the transcript. Phase B derivations search for this literal when deciding whether a user-visible summary has already landed.

Functions§

format_reset_marker
Shape the tool-result payload carrying the agent-authored summary.