Skip to main content

Module env

Module env 

Source
Expand description

The environment data a system-prompt template renders, and the built-in default template that renders it.

The runtime exposes what it knows as data and the shape lives in a template, so the same knobs an operator has (loops, conditions, limits, field access) are the ones the built-in default uses. Nothing the default renders is reachable only from Rust.

§The ordering is a cache decision, not a taste one

Providers cache on the literal prefix of a request, so a section that changes between turns invalidates the cache for everything after it. The default template is therefore ordered by VOLATILITY:

  1. persona + instruction — change only on reload
  2. workflows, services, streams, subagent templates — configuration
  3. skills catalogue — configuration, plus per-context bodies
  4. peers, signals, memory — live state, changing turn to turn

A custom template that puts {{#each signals.waiting}} near the top will still work; it will just miss the cache on most turns, which on a busy instance is real money.

Constants§

DEFAULT_TEMPLATE
The built-in template. It is written in the same language an operator gets, and agentd --context-template prints it — so overriding starts from a copy rather than from a guess.