Skip to main content

Module pages

Module pages 

Source
Expand description

Typed pages for chat-history entries (ClawVM §3).

§Role

ClawVM (arXiv:2604.10352) demonstrates that fault elimination in stateful agent harnesses comes from the enforcement layer — typed pages with minimum-fidelity invariants and a validated writeback protocol — not from the upgrade heuristic (their LRU ablation proves this). This module is the Phase A scaffolding for that enforcement layer: every entry in [Session::messages] is tagged with a PageKind that declares what it is and how far it can degrade under budget pressure without violating a load-bearing invariant.

§Scope in Phase A

In Phase A we populate the parallel pages: Vec<PageKind> sidecar and expose classify so every new entry picks up a kind at append-time. Enforcement consumers (experimental strategies, compression) come online in Phase B and consult this sidecar before degrading any page.

§Examples

use codetether_agent::provider::{ContentPart, Message, Role};
use codetether_agent::session::pages::{PageKind, classify};

let system = Message {
    role: Role::System,
    content: vec![ContentPart::Text { text: "you are…".into() }],
};
assert_eq!(classify(&system), PageKind::Bootstrap);

let tool_result = Message {
    role: Role::Tool,
    content: vec![ContentPart::ToolResult {
        tool_call_id: "call-1".into(),
        content: "file contents".into(),
    }],
};
assert_eq!(classify(&tool_result), PageKind::Evidence);

Enums§

PageKind
ClawVM page classification for a single chat-history entry.
ResidencyLevel
Residency level of a page inside the derived context.

Functions§

classify
Classify a single chat-history entry.
classify_all
Classify every entry in messages and return the parallel array.