Skip to main content

Module environment

Module environment 

Source
Expand description

The startup environment report: machine facts for the system prompt, probed once before the first model call so no turn is spent rediscovering them. The claw’s daemon writes the same report at boot (ENVIRONMENT.md); here the report renders straight into the prompt’s environment section.

Every text the report carries is data: environment.yaml at the crate root — beside SYSTEM.md — holds the OS name mapping, the probe inventory, and the report, notice, and unavailable texts as Jinja templates over the facts this module gathers. The Rust here is mechanics alone: run the probe, shape the facts, render the template. The file is baked in (include_str!), not read at runtime: the report must not turn machine-dependent, and the cloud frontends have no filesystem to read it from anyway.

The probe is synchronous on purpose — agent construction is sync — and best-effort: one bash -c under a short budget on a fixed script, a failure degrading to the unavailable text, never a failed startup. It describes the host, which is where commands run unless a sandbox re-points them; a sandboxed session takes remote_notice instead, because host facts would be lies about a container. The report’s date is stamped once at construction: it rides the system prompt, which stays byte-stable for a session’s life.

Structs§

Manifest
The report’s data: the inventory, the OS name mapping, and the texts (Jinja templates) the report renders.
Probe
One inventoried tool.

Functions§

host_report
The host report: what bash on this machine, rooted at workspace, would answer at startup — carrying model, the model the session runs, and harness, the frontend assembling it. Never fails: a probe that cannot run renders the unavailable text.
manifest
The baked-in manifest (environment.yaml at the crate root), parsed once. A manifest that does not parse falls to [fallback_report]: the drift test is where that break belongs, never a startup.
remote_notice
The section a sandboxed session renders instead of host facts: the report’s honesty rule — commands run somewhere a host probe cannot see, so it claims none and names the kind. The sandbox-side workspace is carried — where the model’s commands run is not a host fact.