small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs context.md

Context inspector #

The context inspector describes a prepared model request. context_snapshot.from_request builds sections for present instructions, conversation history, and encoded tool schemas. The snapshot identifies the provider, model, protocol, and available compaction observation. See compaction 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.

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 captures the prepared request, and session.gleam reads and can rebuild the snapshot.

Local API #

The session request handler in 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 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.