# Context inspector The context inspector describes a prepared model request. [`context_snapshot.from_request`](../src/albedo/daemon/context_snapshot.gleam) builds sections for present instructions, conversation history, and encoded tool schemas. The snapshot identifies the provider, model, protocol, and available compaction observation. See [compaction](compaction.md) for how a strategy prepares the conversation. ## Request composition The instructions section contains the request instructions. The history section represents the prepared inputs, and the tools section uses the provider's tool encoding. Section metadata includes item and byte counts. History inspection renders user text, assistant text, and tool output, but replaces images with metadata and opaque provider replay items with a marker. The inspector does not expose those payloads. See [`inspection_entry` and `input_omission`](../src/albedo/daemon/context_snapshot.gleam). A snapshot can be pending before a request has been prepared. A ready snapshot has an identity, section previews, and compaction information. Usage metadata can update the snapshot. [`session_run.gleam`](../src/albedo/daemon/session_run.gleam) captures the prepared request, and [`session.gleam`](../src/albedo/daemon/session.gleam) reads and can rebuild the snapshot. The compaction information carries the request's `size`, a [`size.Total`](../src/albedo/harness/size.gleam) the strategy reported, as an object: `tokens`, the `measured` part with its source (`count_endpoint` or `reported_usage`), and the `estimated` part with its correction. It is null while the strategy has none. Clients show each part for what it is and label the estimate; they do not recover how a number was taken from text. ## Local API The session request handler in [`http_sessions.gleam`](../src/albedo/daemon/http_sessions.gleam) supports `summary` and `section` views. A section request requires `snapshot_id`, `section_id`, and `page`. A changed snapshot returns HTTP 410 with `context_changed`. An unknown section or page returns HTTP 404 with `context_section_unknown`. Request-list pagination parameters are rejected for these views. [`context_snapshot.page`](../src/albedo/daemon/context_snapshot.gleam) numbers pages from zero and caps each page at 8,000 Unicode scalars. A pending snapshot cannot provide a page. The terminal inspector consumes this interface in [`context_inspector.go`](../cli/internal/tui/context_inspector.go). ## Related pages - [All topics](README.md) - [Change guidance](contributing.md) - [Compaction](compaction.md) - [Provider requests](provider-requests.md)