Bundle schema
Loom Bundle Schema
Section titled “Loom Bundle Schema”The complete schema for Loom configuration bundles: the Bundle Pydantic model in
src/loom/contracts/bundle.py and every model and enum it reaches, the adapter side
(src/loom/contracts/adapter.py) included.
Refused at load
Section titled “Refused at load”A field validates only if the runtime honors it. A bundle that sets a reserved field, or a
reserved value of a live field, is refused when it loads, naming it; what is not listed here is live.
<name> stands for the value or name the bundle gave.
Bundle
- memory.policy
has no runtime reader yet - memory.policy ‘retrieval’ has no runtime reader yet
- memory.embed_cold: true has no runtime reader yet
- audit.archive_after has no runtime reader yet
- audit.erasure
has no runtime reader yet - capability
has no runtime reader yet - storage.secret_ref has no runtime reader yet
- storage.options <unread_opts> has no runtime reader yet
- inference.structured_output <structured_output> has no runtime reader yet
AdapterConfig (each adapter)
- transport ‘mcp’ has no runtime reader yet
- trigger.mode ‘stream’ has no runtime reader yet
- trigger.options has no runtime reader yet
- auth.type
: type-specific auth (encoding/refresh) is not built – declare api_token to pass the secret through - ingest.durability ‘transient’ has no runtime reader yet
- normalize.mode ‘custom’ has no runtime reader yet
- normalize.handler has no runtime reader yet
- normalize.extractor.ner has no runtime reader yet
- normalize.extractor.slm
has no runtime reader yet – only ‘inference’ (reuse the bundle’s own inference model) is honored in v1 - options
are not read by transport ‘ ’ (it reads ) – remove them
Live and reserved values
| Where | Live | Reserved (refused) |
|---|---|---|
memory.policy |
tiered, rolling_window |
entity, summary_buffer, retrieval |
audit.erasure |
none |
surface |
capabilities[].reference |
none | the field itself |
storage.options |
path |
any other key |
inference.structured_output |
prompt_fallback |
grammar, native |
adapters[].transport |
native, singer, host |
mcp |
adapters[].trigger.mode |
poll, push |
stream |
adapters[].auth.type |
none, api_token |
basic, oauth2 |
adapters[].ingest.durability |
durable |
transient |
adapters[].normalize.mode |
passthrough, declarative, envelope |
custom |
adapters[].normalize.extractor.slm |
inference |
any other value |
adapters[].options (keys, by transport) |
host: none; native: format, path, pattern, recursive, stream_from; singer: command, state_path, stream |
any other key |
adapters[].options.format (native) |
json, text |
any other value |
Combinations not built yet (each is refused naming what to remove)
MeasureSpec: ‘offset’ is not valid with ‘period’ yet: comparing against the previous day/week/month is not built (a rolling ‘window’ with an ‘offset’ shifts back by a fixed length instead) – remove offset
AdapterConfig
Section titled “AdapterConfig”Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
auth |
AuthSpec |
all defaults | The credential handed to the adapter’s tap (see AuthSpec). Only a ‘singer’ adapter reads one: ‘native’, ‘host’ and push adapters refuse any auth type but ‘none’. |
catalog |
dict[str, dict[str, Any]] |
{} |
Declared field schema per observation type: each value is a field map ({field name: type}), the type one of ‘string’, ‘number’, ‘integer’, ‘boolean’ or ‘array’ (any other spelling, ‘float’ or ‘int’ included, is refused at load). The keys are the type vocabulary the gate enforces on every record, so a literal normalize.type must be one of them, and envelope mode needs a non-empty catalog. The top-level field names across every adapter’s entries are the field vocabulary a measure’s field/group_by fields.<name> must name, refused at load otherwise (checked when every adapter declares one). A field’s type is read only by extraction, which needs ‘string’ or ‘number’ for an extract field. |
ingest |
IngestSpec | None |
null |
Persistence policy for this adapter’s records: durability + on_conflict. Set only when streams is empty (today’s single-recipe path; None there means today’s defaults); refused alongside a non-empty streams, which carries its own ingest per stream instead. |
name |
str |
required | The adapter’s identity: stamped as the source of every record it stores, and the name of a Singer tap’s bookmark file. A plain name (letters, digits, ‘’ and ‘-’, starting with a letter, digit or ‘’), never a path and never containing ‘.’ (a stored source is ‘ |
normalize |
NormalizeSpec | None |
null |
Today’s single-recipe path; set this or streams (never neither, never both). None only when streams is non-empty, which carries its own normalize per stream instead. |
options |
dict |
{} |
Per-transport settings, each typed and checked at load; a key the transport’s adapter does not read is refused (HONORED_OPTIONS). native: path (required, a directory), pattern (a relative glob, default ‘*.md’), recursive (a real boolean, default false: a quoted “no” is refused, never read as true), format (‘text’ or ‘json’, default ‘text’), stream_from (a JSONPath, set exactly when streams is). singer: command (required, a non-empty argv list of strings), stream (one Singer stream to keep; refused beside streams), state_path (the tap’s bookmark file). ‘host’ and push adapters take none. |
streams |
dict[str, StreamSpec] |
{} |
stream name -> its own normalize/ingest recipe, declared instead of the top-level normalize/ingest, never alongside them. One fetch per adapter per cycle; each record is routed to its stream’s recipe by name (Singer’s own RECORD.stream, native’s options.stream_from JSONPath, a host adapter’s own code) and stored with source ‘trigger: push adapter declares none. |
transport |
Transport |
"native" |
How records are fetched; orthogonal to normalization. ‘native’ is the built-in directory poller (needs options.path); ‘singer’ runs a Singer tap as a subprocess (needs options.command); ‘host’ is an adapter the embedding host supplies, which the command-line entry points refuse (they have no host to supply it); ‘mcp’ is refused at load. A trigger: push adapter fetches nothing (an app hands it records), so it declares none: leave this out. |
trigger |
TriggerSpec |
required | When the adapter runs: fetched every cycle (‘poll’), or handed records by an app (‘push’). See TriggerSpec. |
AgentsSpec
Section titled “AgentsSpec”The agents: entry — parent-side child policy only. Depth
and width are the tree-shape caps: max_depth bounds subtree generations
below this bundle (the engine min-composes it down the lineage: remaining = min(parent_remaining - 1, own_max_depth)); max_children
bounds concurrent live children. children is alias -> ChildRef; the alias
is a bare identifier (so it can be referenced elsewhere, e.g. instance
namespacing/tags) and is collision-safe by dict construction — no separate
duplicate check needed, unlike the list-shaped adapters/capabilities.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
children |
dict[str, ChildRef] |
{} |
alias -> ChildRef: the children this bundle may spawn, and no others. The alias is a bare identifier. |
max_children |
int |
1 |
Most children of this bundle that may be live at once; a spawn past it is refused until one is reaped. |
max_depth |
int |
1 |
Generations of children this bundle may start below itself: 1 allows children but no grandchildren. The engine min-composes it down the lineage: remaining = min(parent_remaining - 1, own_max_depth). |
Aggregation
Section titled “Aggregation”Enum: How rows in the window collapse to the scalar bound at m.<name>.
Two classes, distinguished by whether row order matters:
- Order-independent reductions (
count/sum/avg/min/max/ratio) — fold a multiset of values; which row contributed the value is irrelevant.min/maxare the extreme offield’s own values. - Order-dependent selections (
latest/earliest) — pick the row with the max/min observation timestamp (the envelope’s canonicalts) and return that row’sfield. Not the same asmax/min: those comparefield’s values, this compares when the row arrived. The order key is fixed (always the envelope ts, never a config knob); ties break by insertion order (rowid). Withgroup_bythis is last-value-per-group — “current state per entity” — the shape that motivates having it at all.
Values:
avg=avg— mean offield’s numeric valuescount=count— rows matchingfilterearliest=earliest— field of the row with min envelope ts; order-dependentlatest=latest— field of the row with max envelope ts; order-dependentmax=max— largest numericfieldvaluemin=min— smallest numericfieldvalueratio=ratio— count(filter) / count(of); not limited to rowsofmatches, so it can exceed 1sum=sum— offield; only numbers count (a boolean is 1/0, a string or absent value is skipped)
ApprovalMode
Section titled “ApprovalMode”Enum: What a capability requires before the executor may run its action.
The floor is declared per capability (Capability.approval); risk has
no runtime reader beyond load, where dangerous bars auto/parent.
Ordered auto < parent < human < deny (declaration order = rank; decided
2026-07-25). parent sits between auto and human: the
supervising agent signs off — itself a validated action through the
parent’s own registry, so it is never a rubber stamp — and on a root
bundle (no parent to ask) it escalates to the human owner. human stays
never satisfiable by an agent. Engine-side routing of parent (lineage,
escalation) is runtime work, not yet built.
Values:
auto=auto— the executor runs it with no one askeddeny=deny— refused: the proposal is rejected and the handler never runshuman=human— parks the proposal until a caller approves or rejects it through the release doorparent=parent— parks the proposal likehuman: any caller of approve releases it; no parent routing exists yet
AuditColumn
Section titled “AuditColumn”Enum: Closed vocabulary for the payload columns AuditConfig.keep may name –
exactly the columns full gates today (see AuditPayloads). Pinned to these
spelled members rather than derived from AuditPayloads, so keep does not
silently widen if the payload vocabulary grows later; naming every current
column in keep is legal, it just doesn’t float the way full does.
Values:
context_ref=context_ref— the id of the cycle that made the proposal: a reference, not the context textmodel_output=model_output— the proposal as the model emitted it ({method, params, rationale}); only aproposedrow carries it
AuditConfig
Section titled “AuditConfig”What the audit ledger keeps, not what it records. The checkpoint-stage trail
and token-usage capture are never knobs here – a config that could
silently drop the safety record must be unrepresentable. Erasure is content-level
only (never row-level) and per-surface; no key exists, so only none loads.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
archive_after |
Duration | None |
null |
Reserved: refused at load when set, because nothing archives on a schedule. Rows stay hot, and storage.retention.on_full: compact archives settled ones only when the store is over its cap. |
erasure |
ErasureScope |
"none" |
Scope of content erasure in the audit ledger. none (default) disables erasure and is the only live value; surface is refused at load until per-surface keys exist (it would also need payloads full or custom). |
keep |
list[AuditColumn] | None |
null |
The payload columns kept under custom, at least one and none twice. Required with custom and refused with any other payloads (either alone is a load error). |
payloads |
AuditPayloads |
"full" |
Which of the two payload columns each ledger row keeps: model_output (the proposal as the model emitted it, stored on its proposed row) and context_ref (the id of the cycle that made it). full keeps both; lean drops both and keeps stage, outcome, validation result, usage and cycle id; custom keeps exactly the columns named in keep. Refused at load: a human or parent capability, or inference.session: keep, with model_output dropped (a release reads the proposal back); an export row naming a dropped column. |
transcripts |
bool |
false |
Keep each model-call attempt’s exact prompt and answer text, queryable and keyed to its own inferred ledger row – never loaded wholesale. Off by default: prompts are large and can hold personal data. true requires payloads to keep model text (full, or custom with model_output in keep) – a load error otherwise. |
AuditPayloads
Section titled “AuditPayloads”Enum: How much of each audit-ledger row’s LLM payload is kept. The gen_ai.* telemetry columns and checkpoint trail
are unaffected either way – only model_output/context_ref are gated. Each
member is a curated middle, never “keep nothing”: lean still keeps metadata +
gen_ai.*, and custom still requires at least one column via keep.
Values:
custom=custom— the AuditColumn members named in AuditConfig.keep are kept, the rest droppedfull=full— model_output and context_ref kept: what an export readslean=lean— model_output and context_ref dropped: no model text stored
AuthSpec
Section titled “AuthSpec”Auth method is declared here; resolved credentials live in the vault.
Secrets storage is separate from auth method: secret_ref is a pointer into
Loom’s secret store — credentials are
never inlined in a bundle. See DESIGN.md §3.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
secret_ref |
str | None |
null |
Pointer to the stored credential, spelled vault://<namespace>/<name> (letters, digits, ‘_’ and ‘-’ in each part) and checked at load. Required when type is not ‘none’ and refused when it is. Resolved at each fetch; a secret that is missing or unreadable makes that adapter yield nothing for the cycle, logged, never a cycle failure. |
type |
AuthType |
"none" |
‘none’: no credential. ‘api_token’: at each fetch the secret_ref’s stored text is written to a private temporary file and handed to the Singer tap as its --config file, unchanged (whatever the tap reads: a token, or a JSON document); it is honored for transport ‘singer’ only and refused on ‘native’, ‘host’ and ‘push’ adapters, which read no credential. ‘basic’ and ‘oauth2’ are refused at load until type-specific auth is built. |
AuthType
Section titled “AuthType”Values:
api_token=api_token— the stored secret text is handed to a Singer tap unchanged, as its –config filebasic=basic— reserved, refused at load; type-specific auth (encoding, refresh) is not builtnone=none— no credential: nothing is resolved or handed to the adapteroauth2=oauth2— reserved, refused at load; type-specific auth (encoding, refresh) is not built
BehaviorSpec
Section titled “BehaviorSpec”How the agent carries itself — soft steering only.
Hard rules are NOT prose: they live in capabilities (risk / approval /
params_schema / condition). The length caps here are a deliberate forcing
function against dumping unenforceable rules into prose, which also wrecks a
small on-device model’s context budget. See DESIGN.md §11.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
directive |
str |
required | One-line ‘who you are / what you do’, the first line of the system message; at most 300 characters, on purpose. |
personality |
str | None |
null |
Optional tone / voice, one system-message line after the directive; at most 480 characters. |
principles |
list[str] |
[] |
Bounded soft values/heuristics the agent holds (not hard rules), one system-message line each: at most 25, each at most 240 characters. A parent’s agents.children.<name>.instructions are appended to a child’s. Imperative task steps are the engine’s job and live in the core prompt, not here. |
Bundle
Section titled “Bundle”Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
adapters |
list[AdapterConfig] |
[] |
The sources observations are read from each cycle, in order; names are unique. |
agents |
AgentsSpec |
all defaults | Parent-side policy for child agents this bundle may spawn (depth/width caps + alias -> ChildRef). The child’s own bundle stays the base truth for its goal/measures/capabilities; this is restriction only. |
audit |
AuditConfig |
all defaults | What the audit ledger keeps of each proposal’s model text. |
behavior |
BehaviorSpec |
required | The system message’s soft steering: a directive, optional principles and a personality, each length-capped. |
capabilities |
list[Capability] |
[] |
The actions the model may propose, each gated and executed through validate -> approve -> execute; methods are unique. |
channels |
list[ChatChannel] |
[] |
The ways customers reach a ‘chat’ bundle; names are unique and there is at least one. Refused at load on a bundle whose kind is ‘goal’. |
conversations |
Conversations |
all defaults | How long a chat conversation lives: idle_close and delete_after, both off by default. |
export |
dict[str, ExportProjection] |
{} |
name -> ExportProjection over the audit ledger; dict-keyed so a duplicate projection name is unspellable (same idiom as child aliases). Declaring one here runs nothing – the exporter engine (src/loom/export/engine.py) reads it by name. |
goal |
ObjectiveSpec | None |
null |
The named conditions the agent reasons toward, and how often they are re-evaluated. Required when kind is ‘goal’; refused when it is ‘chat’, whose agent has no heartbeat unless it declares schedule, whose timer runs a cycle that pulls and notifies and never asks the model. Otherwise it runs only when a consumer drives it, by a chat turn or on demand. |
handoff |
Handoff |
all defaults | Who may take a chat conversation over from the model. |
inference |
InferenceConfig |
required | Which model answers each cycle and how it is reached. |
kind |
BundleKind |
"goal" |
‘goal’ reasons toward goal and needs one; ‘chat’ serves customers turn by turn on its channels, needs at least one, and refuses goal and every field only a goal reads. The chat-only fields (channels, conversations, limits.per_customer, handoff, a capability’s customer) are refused on ‘goal’. |
limits |
Limits |
all defaults | The safety circuit breaker on model calls and tokens per rolling window. |
measures |
dict[str, MeasureSpec] |
{} |
name -> aggregate over Loom’s own logs; the name keys m. |
memory |
TieredMemory | RollingWindowMemory | SummaryBufferMemory | RetrievalMemory | EntityMemory |
all defaults | How recent observations are assembled into the model’s context each cycle, chosen by policy (default ‘tiered’). |
name |
str |
required | Stable agent identity; keys memory, audit, the hub. A plain name (letters, digits, ‘_’, ‘-’, ‘.’, not starting with ‘.’), never a path: it names the store file and the workspace folder. |
notification_channels |
dict[str, NotificationChannel] |
{"stdout": {"transport": "stdout"}} |
label -> delivery channel. Dict-keyed so a duplicate label is unspellable (same idiom as export projections/child aliases). Defaults to one ‘stdout’ channel so a notification rule can never fire into the void; a bundle that sets this without a ‘stdout’ label must name channels on every rule. |
notifications |
dict[str, NotificationRule] |
{} |
label -> code-disposed alert rule; the label is the routable semantic identity. A fired rule emits a delivery-agnostic notification object {rule, severity, text, ts, context}; the engine persists then delivers it to the rule’s channels — see notification_channels. |
observability |
ObservabilityConfig |
all defaults | Opt-in representation statistics recorded per cycle. |
output_schema |
OutputSchema |
all defaults | Shape the model must emit each cycle (validated; ‘code disposes’). Built-in recommendation/rationale plus optional typed domain fields. |
revision |
str |
"" |
System-derived content hash; never set by the user. A value other than the derived hash is refused at load. |
schedule |
Schedule | None |
null |
A timer for a ‘chat’ bundle: a cycle runs every every, pulling the adapters and evaluating notifications with their cooldown; it never asks the model. python -m loom.config --launchd renders its launchd plist from it. Refused on a bundle with a goal, whose timer is goal.evaluate_every. |
schema_version |
str |
required | Which Bundle contract this file targets. Required on every bundle (apiVersion-style) and exactly one of the versions this runtime reads (today ‘v1’). Bundle itself refuses any other spelling as not a version this runtime reads, an older-looking ‘v0’ included. The loader (load_bundle) first says which kind of wrong it is: a newer major is refused with ‘upgrade Loom’, rather than misread, and the rest as unrecognized. |
secrets |
Secrets |
all defaults | The vault namespaces the bundle may read; a secret_ref into any other is refused at load. |
storage |
StorageConfig |
all defaults | Where this agent’s observation log and audit ledger live and how its footprint stays bounded (a local SQLite file). |
timezone |
str | None |
null |
The IANA zone name (‘America/Mexico_City’, spelled as the tz database spells it, so the same bundle loads on every OS) a measure’s calendar period is read in, or ‘host’: the host embedding Loom passes the zone to run_cycle every cycle, and a cycle with none (or one for a bundle that does not declare ‘host’) is refused before it runs; python -m loom.core and python -m loom.api have no host and refuse ‘host’ at load. Required when any measure uses period; there is no silent UTC default, since a UTC day is not the person’s day. |
BundleKind
Section titled “BundleKind”Values:
chat=chat— serves customers turn by turn on itschannels; has nogoalgoal=goal— reasons toward itsgoal, re-evaluated on a timer; the default
Capability
Section titled “Capability”A registered action — the agent-specific method surface. The model may
propose it and a consumer may invoke it on-demand; either way it goes
through validate -> approve -> execute (see DESIGN.md §6). Capabilities are
coded, not one-size-fits-all built-ins (a ‘notify’ differs per device) —
handler binds the declared method to its implementation.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
approval |
ApprovalMode |
required | The floor the gate starts from: only auto runs without a person, parent and human park the proposal until someone releases it, deny refuses it. A false condition denies, and a measure with no data raises the mode to at least human, never below the floor. human and parent are refused at load where audit.payloads keeps no model_output (nothing could release it). |
approvers |
list[str] |
[] |
The roles that may approve a proposal of this method that is held. Empty keeps the rule without it. Refused at load unless approval is ‘human’, since no other mode holds a proposal for a person. |
condition |
str | None |
null |
Optional CEL over {m, actor, action}: the measures, the engine-supplied Principal (actor.id, .kind, .roles, .authenticated) and the proposal being gated (action.method, .params, .rationale). True leaves the approval floor, false denies, a measure with no data raises the mode to at least human. Refused at load: any other name (now, state), an undeclared measure, an actor field Principal lacks, and an action.params.<x> the params_schema does not list under required (the proposal may omit it, and the condition would halt the cycle). action.params.* is the model’s own report, not authenticated. See docs/decisions/0003-cel-policy-conditions.md. |
customer |
str | None |
null |
The name of the one property of params_schema that holds the customer the action is for; Loom, not the model, supplies it from the turn. Refused at load when it names no property, and on a bundle whose kind is ‘goal’. |
handler |
str | None |
null |
‘pkg.module:func’ (a dotted attribute path may follow the colon) binding the method to its coded implementation, imported when the registry is built: a spec that does not resolve to a callable fails there. Absent, every proposal for the method is refused (“no handler bound”): v1 has no built-in registry. |
method |
str |
required | The capability’s name: what the model proposes and the registry’s key. Unique in the bundle; with workspace: true it also names the folder. |
params_schema |
dict[str, Any] |
{} |
JSON Schema (Draft 2020-12; an invalid one is refused at load) for the proposal’s params. The model is shown it, a proposal that breaks it is re-asked then refused, and its top-level description is the capability’s description in the prompt. workspace (with workspace: true) and parent (unless declared) are Loom’s own keywords and may not be proposed. |
reference |
str | None |
null |
Pointer to deep usage docs for this method (a path/URL, not the docs themselves) — loaded into context only when the capability is actively being considered. Progressive disclosure, the same move BehaviorSpec’s length caps make for prose: keep the always-loaded bundle lean by keeping the bulk out of it. Refused at load until the core loop reads it. |
returns |
dict[str, Any] | None |
null |
Optional JSON Schema (Draft 2020-12; an invalid one is refused at load) for the handler’s result. The executor checks the result against it after the handler has run, so its effect has happened: a result that fails is recorded as invalid_result, not success. Shown in the definition view. |
risk |
RiskTier |
required | A load-time classification: dangerous may only be human- or deny-approved. No gate or executor reads it, and read_only and mutating differ in nothing but the label the definition view shows. |
secret_ref |
str | None |
null |
Vault pointer for the handler’s OWN outbound credential; never inline. Resolved on every call and given to the handler as the keyword secret; the handler must accept it, and secret is not a param. |
workspace |
bool |
false |
True: Loom calls the handler with workspace=<Path>, a folder it creates for this method inside the store’s own data folder (<store folder>/workspaces/<bundle name>/<method>/). The bundle names no path and the model never sees it, so it is not a param: a workspace key in params_schema is refused, and so is a method name that is not a plain name (the bundle’s own name must always be one). The handler must accept workspace=, checked when the registry is built. In a run a harness drives over a folder it was given (the native harness over a worker’s worktree), every workspace method gets that one folder instead, and the model, which works in it, may see its path. |
ChatChannel
Section titled “ChatChannel”One way a customer reaches a bundle of kind: chat: a name and the identity the
customer is known by on it.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
identity |
str |
required | How a customer is named on this channel (a phone number, a handle): a short string, up to 120 characters. |
name |
str |
required | The channel’s label, unique in channels: letters, digits, ‘_’ and ‘-’. |
CheckpointStage
Section titled “CheckpointStage”Enum: Where one proposal sits in propose -> validate -> approve -> execute.
failed covers both a validation/policy rejection and an execution error —
outcome carries which. inferred is not a proposal stage: it is the
one row a model-call attempt writes (core/loop.py), terminal on its own,
with outcome carrying the reply’s verdict — the rows the limits
breaker counts.
Values:
approved=approved— approval is given, by the gate or a release, and the handler is about to runexecuted=executed— the handler ran, and its result passed the capability’sreturnswhen one is declaredfailed=failed— the proposal was invalid or denied, or the handler or its result failed;outcomesays whichinferred=inferred— one model-call attempt, not a proposal stage;outcomecarries the reply’s verdictproposed=proposed— the model’s proposal, written before anything checks itvalidated=validated— the registry accepted it; a parked proposal gets a second row with outcomepending
ChildApproval
Section titled “ChildApproval”Enum: A per-method approval floor a parent may impose on a child’s own capability
(ChildRef.approval); the child keeps its own approval for the method when that is
stricter. auto is deliberately unrepresentable here — a parent-imposed override
is a restriction, and the widest one may grant is parent, never a bypass of
approval entirely. Excluding auto from the type (rather than validating it away
from ApprovalMode) makes the worst-case widening structurally impossible to
express.
Values:
deny=deny— the proposal is rejectedhuman=human— the proposal waits for a person’s releaseparent=parent— the proposal waits for a release, as underhuman; nothing routes it to the parent
ChildPersistence
Section titled “ChildPersistence”Enum: Whether a child’s own working state survives a reap; its audit record is
archived on reap either way, never deleted. The state of a child
lives in its own folder, named by its alias and then by the spawn’s tag or, with
no tag, by a fresh instance id.
Values:
ephemeral=ephemeral— the child’s folder is deleted after its audit record is archivedpersistent=persistent— the folder is kept; a spawn that names the same tag reopens it, one without a tag starts a new folder
ChildRef
Section titled “ChildRef”One child a parent bundle may spawn — parent-side policy only. The child’s
own bundle (referenced by bundle) stays the base truth for its goal,
measures, capabilities, etc.; this model only carries the restriction the
parent additionally imposes, never a second copy of the child’s own config.
kind is a discriminator with one value, bundle, which nothing reads: it is
present from day one so a non-bundle child kind can be added without a breaking
change.
Validation split: this model checks shape only — identifiers, durations, CEL
syntax, bounds, caps. Everything that needs the child’s own bundle (the file
loading, the revision pin matching, deny/approval keys naming a capability the
child has, extra_condition and instructions leaving a valid bundle) is checked
when the parent loads through load_bundle, which composes every declared child,
and again at each spawn. Monotonicity — a delta may tighten, never widen — is the
invariant throughout: deny only adds restrictions, approval cannot express
auto, and extra_condition is AND-composed with the child capability’s own
condition (AND can only tighten), all by construction, not by a runtime check.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
approval |
dict[str, ChildApproval] |
{} |
method -> approval floor for that capability of the child: the stricter of this and the child’s own approval applies. Each key must be a method the child declares. auto cannot be spelled. |
bundle |
str |
required | Path of the child’s own bundle file, resolved beside the parent’s file; a path that leaves that folder is refused. The file is loaded and composed when the parent loads and again at each spawn, so a child that does not load, or does not stay valid under this entry’s restrictions, refuses the parent. |
deny |
list[str] |
[] |
Capability methods removed from the child’s registry. Each must be a method the child declares, checked when the parent loads and at each spawn. |
extra_condition |
str | None |
null |
CEL, joined with AND to the condition of every capability the child keeps, those without one included, so it can only tighten. Its syntax is checked here; its m.<name> references resolve against the child’s own measures when the parent loads and at each spawn. |
instructions |
list[str] |
[] |
Lines appended to the child’s own behavior.principles at spawn: steering only, never a hard rule. At most 25 of at most 240 characters, and the child’s own principles count toward the same 25. |
kind |
Literal |
"bundle" |
The kind of child. bundle is the only one, and nothing reads it: it is reserved so another kind can be added later. |
on_parent_exit |
OnParentExit |
"reap" |
What happens to this child when the parent’s own cycle ends: reap stops it, detach leaves it running. |
persistence |
ChildPersistence |
"ephemeral" |
Whether the child’s own working state survives a reap: ephemeral deletes it after the audit record is archived, persistent keeps it, and a spawn that names the same tag reopens it. The audit record is archived on reap either way, never deleted. |
revision |
str | None |
null |
Optional pin: must equal the child bundle’s derived revision, checked when the parent loads and at each spawn. A child whose file changed since is refused. |
ttl |
Duration | None |
null |
How long after its spawn the child may live. A child past it is stopped at the next cycle boundary or spawn attempt, not by a timer. None sets no limit. |
Conversations
Section titled “Conversations”How long a chat conversation lives; both timers are off unless set.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
delete_after |
Duration | None |
null |
After this long a closed conversation’s text is deleted; its audit rows stay. Unset never deletes. Refused at load on a bundle whose kind is ‘goal’. |
idle_close |
Duration | None |
null |
After this long without a turn a conversation closes, and the customer’s next turn opens a new one. Unset never closes one. Refused at load on a bundle whose kind is ‘goal’. |
Duration
Section titled “Duration”Scalar: a string of one or more <int><unit> segments, such as 24h, 1d, 1h30m or 3mo. Units: s, m, h, d, w, mo, y (m is minutes; mo is 30 days and y is 365 days). It must be greater than zero.
EntityMemory
Section titled “EntityMemory”Per-entity running state — refused at load.
Running state per tracked entity (episodic). Context = current state of the entities the cycle touches.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
entity_key |
str |
required | Reserved: the entity policy is refused at load, so this is never read. Meant to name what identifies the entity each observation belongs to. |
max_entities |
int |
1000 |
Reserved: the entity policy is refused at load, so this is never read. Meant as the cap on distinct tracked entities. |
policy |
Literal |
required | Selects this policy, which is refused at load: no per-entity memory exists. |
token_budget |
int |
8000 |
Reserved: the entity policy is refused at load, so this is never read. Meant as the cap, in estimated tokens, on the memory block; a negative value is refused. |
ErasureScope
Section titled “ErasureScope”Enum: Scope of erasure in the audit ledger. Content-level only, never row-level.
Per-surface keys would determine which surfaces are erasable; none
exist, so surface is refused at load and none is the only live value.
Values:
none=none— erasure disabled; content preserved indefinitelysurface=surface— reserved, refused at load; no per-surface key exists to erase with; it would also need payloads full|custom
ExportColumn
Section titled “ExportColumn”Enum: The audit-ledger columns an export row may name. Left out: the row id, the erasure
key (reserved), gen_ai.provider.name,
gen_ai.client.operation.duration, gen_ai.conversation.id and cycle_id
(each export line carries the cycle id as loom.cycle_id in its meta anyway). The
four gen_ai.* members are spelled with the ledger’s own dotted column names,
which audit/ledger.py defines, so there is no second source for that vocabulary.
Values:
checkpoint_stage=checkpoint_stage— the stage the row recordscontext_ref=context_ref— on a proposal’s rows, the id of the cycle that made the proposal (a release keeps it): a reference, not text; empty on a model-call row and when the audit policy drops itgen_ai_request_model=gen_ai.request.model— the model a call asked for, on a model-call rowgen_ai_response_model=gen_ai.response.model— the model that answered, on a model-call rowgen_ai_usage_input_tokens=gen_ai.usage.input_tokens— prompt tokens the call used, on a model-call rowgen_ai_usage_output_tokens=gen_ai.usage.output_tokens— answer tokens the call used, on a model-call rowmodel_output=model_output— the proposal as the model emitted it ({method, params, rationale}); only aproposedrow carries itoutcome=outcome— how the row’s step ended (LedgerOutcome): set on a failed, executed, parked or model-call row, empty on the restproposal_id=proposal_id— ties the rows of one proposal together; a model call has its owntimestamp=timestamp— when the row was written (UTC, ISO 8601)token_usage=token_usage— the provider’s usage payload, on a model-call rowvalidation_result=validation_result— detail the stage recorded: validation errors, the handler’s result or error, or who released it
ExportFormat
Section titled “ExportFormat”Enum: Closed vocabulary for an export projection’s on-disk shape. A composition need this can’t express grows the enum additively (the same deferred-work trigger used throughout this codebase), never opens it into a template language.
Values:
prompt_completion=prompt_completion— one JSON object per line: {prompt, completion, meta}
ExportProjection
Section titled “ExportProjection”One named SFT projection over the audit ledger – to the audit
ledger what a MeasureSpec is to the observation log: named, declarative,
declared in the bundle, evaluated by core. python -m loom.export <bundle> <name>
reads the ledger and writes the JSONL; nothing else runs a projection.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
format |
ExportFormat |
"prompt_completion" |
The shape of each exported line. prompt_completion (one JSON object per line: prompt, completion, meta) is the only one; the vocabulary grows additively. |
row |
ExportRow |
required | Which ledger column each line’s prompt, completion and meta read. |
where |
ExportWhere |
all defaults | Row filter; default = no filter (every row). |
ExportRow
Section titled “ExportRow”Verbatim column mapping for one export projection – no
templating, only an ExportColumn per output position. prompt/completion
are the SFT pair; meta carries any additional columns alongside them
(duplicates rejected). No column holds prompt text: context_ref is the proposing cycle’s id.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
completion |
ExportColumn |
required | The column written as each line’s completion, in the same form as prompt. Refused at load when it names a payload column the audit policy drops. |
meta |
list[ExportColumn] |
[] |
Further columns written under meta, by column name, as typed values (a JSON column stays an object). Each line’s meta also carries six loom.* keys Loom always adds: bundle, revision, proposal id, projection, export time and cycle id. A column listed twice, or one the audit policy drops, is refused at load. |
prompt |
ExportColumn |
required | The column written as each line’s prompt, as stored text: a JSON column (model_output, validation_result, token_usage) as its JSON text, an empty one as null. Refused at load when it names a payload column the audit policy drops. |
ExportWhere
Section titled “ExportWhere”Row filter for one export projection. Each set field is an
IN-filter; multiple set fields AND-compose. min_length=1 makes an empty
filter list unspellable – it would be ambiguous between match-all and
match-none, so “no filter on this field” is expressed by leaving it unset
(None), never []. Default (both unset) = no filter at all, i.e. every row.
objective is deliberately absent: the ledger has no objective column yet;
it joins additively once that capture exists.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
checkpoint_stage |
list[CheckpointStage] | None |
null |
Keep only rows at these stages, none listed twice. Unset keeps every stage. Only a proposed row carries model_output. |
outcome |
list[LedgerOutcome] | None |
null |
Keep only rows with these outcomes, none listed twice. Unset keeps every row; a set filter drops the rows that carry no outcome, such as proposed rows. |
ExtractorCascade
Section titled “ExtractorCascade”The model-assisted fill for extract and fallback_extract fields. One shape is
built: slm: inference sends one prompt per record to the bundle’s own inference
model (whichever provider that names, of any size; on a host bundle, the host’s
transport), carrying a JSON Schema of the fields wanted, and stores a value only when the
check finds it in the text at from. There is no NER stage and no
grammar-constrained decoding: ner and any other slm are refused at load
(AdapterConfig._refuse_unhonored), and the gate refuses them too, as defence in
depth (NormalizeGate.__init__).
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
from |
str |
required | A JSONPath, compiled at load, to the raw-record text the model reads; the check verifies each extracted value against this same text. A record where it resolves to no text leaves its extract fields unextracted. Required whenever extractor is set. |
ner |
str | None |
null |
Reserved: no NER stage exists, so any value is refused at load. |
slm |
str |
required | Must be ‘inference’: the extraction call goes to the bundle’s own inference model, as a prompt carrying a JSON Schema (not grammar-constrained, and not necessarily a small model). Any other value is refused at load. |
FieldSource
Section titled “FieldSource”Per-field provenance: exactly one PRIMARY of literal | path | extract.
literal — a constant. path — projected deterministically from the raw record.
extract — an instruction the extractor cascade fills from unstructured text
(model-sourced, re-runnable). Only fields may use extract; the keystone is
never extraction-sourced.
fallback_extract is an OPTIONAL model-based fallback that modifies path: it
fires only when the path resolves to nothing (path-else-extract: take the source’s own
value, such as a mail connector’s priority label, else infer it from the text). It is
not a fourth primary provenance, so it is only valid alongside path.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
extract |
str | None |
null |
An instruction (not blank) for the extractor cascade to fill this field from the text at extractor.from, checked against that text before anything is stored. Needs normalize.extractor and a ‘string’ or ‘number’ catalog type for the field. Exactly one of literal, path, extract. |
fallback_extract |
str | None |
null |
An instruction (not blank) used only when path resolves to nothing in a record: the cascade then fills the field as extract would. Requires path, normalize.extractor and a ‘string’ or ‘number’ catalog type. |
literal |
Any | None |
null |
A constant stored as the field’s value in every record. Any JSON value except null: null is how a field says it is unset, so literal: null sets no source and is refused like an empty field. Exactly one of literal, path, extract. |
path |
str | None |
null |
A JSONPath, compiled at load, resolved against each raw record; a record it resolves nothing in simply lacks the field (unless fallback_extract is set). Exactly one of literal, path, extract. |
Handoff
Section titled “Handoff”Who may take a chat conversation over from the model.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
operators |
list[str] |
[] |
The roles that may take a conversation over and hand it back. Empty means nobody may. Refused at load on a bundle whose kind is ‘goal’. |
IdentitySpec
Section titled “IdentitySpec”Deterministic identity derivation.
content (default) hashes the whole canonical payload: never merges distinct
records, correct for append-only events. natural_key hashes a declared
combination that uniquely identifies a record — a native source id is just a
one-expression natural key. ephemeral opts out of idempotency for true
exactly-once streams with no natural key.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
key |
list[str] |
[] |
natural_key only (refused with any other strategy, and required for it): JSONPath expressions, each checked at load, whose values together identify a record. Must be genuinely unique — under-specifying silently drops distinct data. A record in which any expression resolves to nothing is rejected, never stored under a partial key. |
strategy |
IdentityStrategy |
"content" |
How Envelope.id is derived: ‘content’ hashes the whole record, ‘natural_key’ hashes the key expressions’ values, ‘ephemeral’ draws a random id so nothing dedups. ‘ephemeral’ is refused with on_conflict: ignore (no two ids collide) and on a push adapter (a resend would be stored again). Inert in envelope mode, where the tap supplies the id. |
IdentityStrategy
Section titled “IdentityStrategy”Enum: How the gate derives the deterministic Envelope.id — never model-sourced.
Values:
content=content— hash of the whole canonical payload (collision-safe default)ephemeral=ephemeral— random uuid per record: nothing dedups, so every poll stores every record again; opt-innatural_key=natural_key— hash of declared key expressions (incl. a native id)
InferenceConfig
Section titled “InferenceConfig”Which model answers and how Loom reaches it: a subprocess, an in-process model, the embedding host’s own transport, or an OpenAI-compatible HTTP server.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
endpoint |
str | None |
null |
Base URL, an http(s) URL with a host: OpenAI-compatible, or the Messages API for ‘anthropic’. Required unless the provider has a default endpoint (‘anthropic’, ‘openai’, ‘openrouter’). With provider ‘local’ its host must be loopback (localhost, 127.0.0.0/8, ::1). Refused for providers with no server (‘codex-cli’, ‘claude-cli’, ‘mlx’, ‘host’). |
location |
Locality |
"remote" |
Declared and checked at load against provider, not a runtime filter: ‘local’ admits only the known-local providers (‘local’, ‘mlx’), which cannot be ‘remote’. Under ‘host’ the host’s own transport states this instead (HostTransport.locality) – a disagreement is refused before any cycle, never trusted blind. |
model |
str | None |
null |
Required for every provider except ‘host’, where the host supplies the model; when given there anyway, it is only a ledger label (the request-model name run_cycle records), never resolved locally. |
prompt_cache |
bool |
false |
Anthropic prompt caching: the transport asks for the request prefix to be cached. Only provider ‘anthropic’ reads it; any other provider refuses it at load. |
provider |
str |
required | Which transport Loom builds: ‘claude-cli’ and ‘codex-cli’ run the coding-agent CLI as a subprocess, ‘mlx’ runs mlx-lm in process (Apple silicon), ‘host’ means the host embedding Loom supplies the model and transport, and ‘anthropic’ is Anthropic’s Messages API; any other name is an OpenAI-compatible HTTP server at endpoint: ‘anthropic’, ‘openai’ and ‘openrouter’ have a default endpoint, every other name (‘local’ too) is refused at load without one. |
secret_ref |
str | None |
null |
Vault pointer, vault://<namespace>/<name>, for the model’s own credential; never inline. Resolved when the transport is built and on every call; an HTTP provider only (the CLI and in-process providers take no key). |
session |
SessionMode |
"fresh" |
‘fresh’ makes every cycle a stateless call. ‘keep’ resumes the agent’s own last session each cycle and sends it only what arrived since; only the coding-agent providers (‘claude-cli’, ‘codex-cli’) keep one, any other is refused at load, and so is one whose audit.payloads keeps no model text. |
structured_output |
StructuredOutputMode |
"prompt_fallback" |
Generation method; mapped per provider. Only prompt_fallback has a runtime reader; the others are refused at load. |
IngestSpec
Section titled “IngestSpec”Persistence-facing ingest policy for this adapter’s records — a different seam
from normalize (raw record -> Envelope, a parse concern) and auth/trigger
(how records are fetched). identity stays under normalize because it decides
how the key is computed; ingest decides what the store does once records
with that key arrive — durability (whether Loom keeps a raw copy; only “no copy”
is built) and on_conflict (UPSERT vs IGNORE on a key collision). See
docs/decisions/0001-declarative-adapter-normalization.md and DESIGN.md §7.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
durability |
SourceDurability |
"durable" |
Whether Loom keeps a raw copy of each record. The only value that loads is ‘durable’: Loom stores each record as its recipe built it (the whole raw record under passthrough, the declared fields under declarative; an envelope-mode tap’s own raw_ref is kept as sent) and keeps no separate raw copy. ‘transient’ (a local raw copy at ingest) is refused at load until it is built. |
on_conflict |
OnConflict |
"update" |
Observation-log write policy on an (source, id) collision: ‘update’ UPSERTs (latest payload wins), ‘ignore’ keeps the first-seen row, and a record already stored under ‘ignore’ is not extracted again. ‘ignore’ is refused under identity strategy ‘ephemeral’, where no two ids collide. |
LedgerOutcome
Section titled “LedgerOutcome”Enum: The closed outcome vocabulary a ledger row carries at the failed/
parked/executed/inferred stages. invalid/rejected/
handler_error/invalid_result/pending are the five
failure/park dispositions names for
stage-4 (safety/executor.py); success is the executed path’s own
terminal outcome, the sixth member the same text implies but does not
spell. An inferred row reuses success/invalid for an
accepted/rejected reply and adds transport_error for a call that
produced no reply. Graduated from scattered string literals
per — a rule stated at every call site becomes a type.
Values:
handler_error=handler_error— the handler raisedinvalid=invalid— the proposal failed validation; on aninferredrow, the reply was rejectedinvalid_result=invalid_result— the handler’s result broke the capability’sreturnsschemapending=pending— parked: the proposal waits for a human or parent releaserejected=rejected— the gate denied the proposalsuccess=success— the handler ran and returned; on aninferredrow, the reply was acceptedtransport_error=transport_error— a model call produced no reply
Limits
Section titled “Limits”Safety circuit breaker only — not cost/billing management.
Caps count per rolling window (not lifetime), so a tripped agent resumes next
window rather than halting forever. v1 caps are max_calls and max_tokens
only — no max_cost. A USD ceiling is honest only where the provider reports
per-request cost as a captured statistic (e.g. OpenRouter’s inline
usage.cost); there cost joins tokens as a sufficient statistic needing no
price table. Where the provider doesn’t report cost (raw OpenAI/Anthropic) or the
runtime isn’t billed per token (local MLX), there is no cost signal and
max_tokens is the proxy. Loom will not maintain a price table, so max_cost
stays out of the schema until cost is captured as a provider-reported statistic.
This cap is GLOBAL to the bundle, not per-method — e.g. a self-action rate-limit like “don’t invoke the same capability more than 3x/day” is not expressible today. See docs/decisions/0004-measures-as-declarative-aggregates.md for the possible future per-method Limits this would need.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
max_calls |
int | None |
null |
Cap on the model calls of the trailing window. Every attempt counts, a retry or a failed one included; a capability the model proposes does not. Reaching it stops model calls until the window rolls on. Unset sets no call cap. |
max_tokens |
int | None |
null |
Cap on the tokens the model calls of the trailing window may use, prompt and answer together, as the provider reports them (a call that reports none adds nothing). Reaching it stops model calls until the window rolls on. Unset sets no token cap. |
per_customer |
PerCustomerLimit | None |
null |
A turn cap per customer, beside the bundle-wide caps above. Unset sets none. Refused at load on a bundle whose kind is ‘goal’, which has no customers. |
window |
str |
"1d" |
The trailing span max_calls and max_tokens count over; it rolls with the clock, so a tripped breaker resumes once old calls leave it. It also sets how recent a settled audit row must be to stay out of the cold archive. |
Locality
Section titled “Locality”Enum: Where a resource runs or lives, declared and checked at load: inference.location
must agree with its provider and storage.location with the backend. It is a
declaration refused when it is wrong, not a runtime filter on what leaves the machine.
Values:
local=local— on this machine: refused for a provider not known to run here (‘local’, ‘mlx’ are)remote=remote— off this machine: refused for ‘local’ and ‘mlx’, and for storage (no remote backend)
MeasureSpec
Section titled “MeasureSpec”A named aggregate over the agent’s observation log, recomputed each cycle and
bound into the CEL namespace m.<name> that objectives and capability conditions
read. Always scoped to this agent’s own namespace (Loom is a tenant); the adapter
that produced a row is a filterable source column, so a multi-adapter agent
narrows with filter: "source == '...'".
The human declares the counting rule; the engine runs it as SQL — an optional
window (a rolling horizon) or period (the current calendar day/week/month in
the bundle’s timezone) bounds the scan (omit both for an all-time aggregate over
the whole log) and filter pushes down (json_extract over the envelope’s fields).
SQL aggregates the set; CEL then reasons over the resulting scalar.
Measures are flat: a filter may not reference m.* (no composition — combine
measures in the objective CEL instead).
aggregation splits into order-independent reductions (fold a multiset; see
:class:Aggregation) and order-dependent selections (latest/earliest — pick
the row by envelope ts and return its field). Both classes compose the same way
with window/offset/group_by/default — no aggregation-specific
exception beyond needing field. The runtime (measures engine, Chunk 3) computes
latest/earliest with a window function ordered by the envelope’s canonical
ts column; that ordering is not expressible here because it isn’t configurable.
(Measures read only the observation log — the world the agent senses. Operational
records live elsewhere: cost/rate caps in Limits, the SFT/training dataset in the audit
subsystem — not in goal-defining measures.)
Adding a measure is a query over already-retained sufficient statistics, not a migration (CLAUDE.md “persist sufficient statistics”). See DESIGN.md §8.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
aggregation |
Aggregation |
required | How the matching rows in the window collapse to the value bound at m.<name> (a {group -> value} map with group_by). sum, avg, min, max, latest and earliest need field, count and ratio refuse it, and ratio needs filter. |
default |
float | None |
null |
Value when the window is empty / denominator is 0. Unset -> the measure is no_data, and an objective referencing it reports no_data, never failed. With group_by an empty window is an empty map and default fills only a group whose own aggregate is empty. |
field |
str | None |
null |
What to aggregate or select: a column of the observation row (one of id, ingested_at, raw_ref, source, tags, timestamp, timestamp_imputed, type) or ‘fields. |
filter |
str | None |
null |
Optional CEL over one observation row, which binds type, source (the adapter name, or ‘id, fields (the extracted values) and unextracted (field -> reason for a field held back). Any other name (timestamp, tags, ingested_at, m) is refused at load; a row the expression cannot be evaluated on (a missing field, a type mismatch) does not match. For ratio this is the numerator predicate. |
group_by |
str | list[str] | None |
null |
Column(s)/‘fields.field); at least one, and a string and a one-item list give the same keys. A key is the value when one column holds a string, else a JSON array of the columns’ values (["a", 1]). When set, m.m.x.all(k, m.x[k] <= 0.9) / .exists(...)) — the key lets a notification or action name the offending group. Paired with ‘latest’/‘earliest’ this is last-value-per-group — current state per tracked entity. |
max_groups |
int |
1000 |
Cardinality cap on distinct group_by keys, rolled-up groups included. More raises and fails the cycle, never truncates. Refused without ‘group_by’. |
of |
str | None |
null |
ratio only (refused otherwise): the denominator predicate, over the same names as filter; unset counts every row in the window. The numerator is not limited to the rows this matches, so the ratio can exceed 1. |
offset |
Duration | None |
null |
Shift the window back by this much before aggregating, so m. |
period |
Period | None |
null |
Calendar-aligned window: the current day, ISO week (Monday start) or month, from its start in the bundle’s timezone up to now (e.g. day = since local midnight; a rolling 1d window is the last 24 hours). Exclusive with ‘window’; needs a top-level timezone; ‘offset’ is not valid with it. |
window |
Duration | None |
null |
Rolling lookback over which the aggregate is computed — a property of the measure, not the objective. Omit (null) for an all-time aggregate over the agent’s entire log (no time bound). Raw rows older than the longest window plus offset of any measure roll up (storage.retention.raw_window). |
NormalizeMode
Section titled “NormalizeMode”Values:
custom=custom— reserved, refused at load; an in-process Python handler is not builtdeclarative=declarative— per-field provenance (literal | path | extract)envelope=envelope— source already emits Envelopes; the gate validates, never buildspassthrough=passthrough— the whole raw record becomes the fields;fieldsis refused
NormalizeSpec
Section titled “NormalizeSpec”Declarative record -> Envelope mapping read by one generic gate; no
code-per-adapter. The keystone (identity/timestamp/type) is deterministic
and path- or literal-sourced — never extraction-sourced. Expression language
(JMESPath/jq/JSONPath) is the engine’s concern, not the schema’s.
envelope mode is the exception, and the exception is about where the code runs,
not about relaxing the keystone: the source is a separate process that already
emits Envelopes, so the gate validates instead of building. Loom still owns
source and ingested_at, and still rejects any type outside the declared
catalog —.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
extractor |
ExtractorCascade | None |
null |
The cascade that fills extract and fallback_extract fields. Required when any field uses either, and refused when none does, since it would never run. |
fields |
dict[str, FieldSource] |
{} |
Envelope.fields by per-field provenance. Read only under mode ‘declarative’: set under ‘passthrough’ or ‘envelope’ it is refused at load, not ignored. |
handler |
str | None |
null |
Reserved: a ‘pkg.module:func’ escape hatch with no reader. Any value is refused at load. |
identity |
IdentitySpec |
all defaults | How the Envelope id is derived (see IdentitySpec); it must stay at its default in envelope mode, where the tap supplies the id. |
mode |
NormalizeMode |
"passthrough" |
How the gate builds an Envelope: ‘passthrough’ keeps the whole raw record as the fields (and refuses fields); ‘declarative’ builds them from fields; ‘envelope’ validates a source’s own Envelopes and builds nothing (every build-side field is refused, and the adapter needs a non-empty catalog); ‘custom’ is refused at load until it is built. |
source_timezone |
str | None |
null |
IANA tz used only to resolve naive source times to UTC; ignored when the source is offset-aware. Requires ‘timestamp_from’ (the event time it resolves) and a zone key spelled as the tz database spells it (‘America/Mexico_City’, not ‘america/mexico_city’: the same bundle must load on every OS). |
tags |
list[str] |
[] |
Labels copied onto every Envelope this recipe builds and stored with it (Envelope.tags). Refused in envelope mode, where the tap supplies its own. |
timestamp_from |
str | None |
null |
A JSONPath, compiled at load, to the event time: an ISO-8601 string, or epoch seconds or milliseconds. When it resolves to nothing readable the gate imputes ingested_at and flags it (Envelope.timestamp_imputed); so it does for a time with no offset when source_timezone is unset. |
type |
str | None |
null |
The observation type every record of this recipe gets (a single-type source); not blank. Exactly one of type and type_from (outside envelope mode). When the adapter declares a catalog, it must be one of its types. |
type_from |
str | None |
null |
A JSONPath, compiled at load, to each record’s type (one source, many types). A record where it resolves to no non-empty string, or to a type a declared catalog lacks, is rejected. Mutually exclusive with type. |
NotificationChannel
Section titled “NotificationChannel”One named delivery destination a NotificationRule may route to.
target/secret_ref are shape-constrained by transport (one
cross-field validator, not three transport-specific models — a bundle author
reads one field set for every channel; the correct-by-construction
preference is weighed against triplicating the shared fields,
and the validator wins here). stdout has no
destination or credential to carry; webhook requires target (the
endpoint URL) and may carry secret_ref (a vault pointer — never an
inline credential).
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
secret_ref |
str | None |
null |
Vault pointer for a delivery credential; never inline. Resolved when the notification is delivered and sent as an Authorization: Bearer header on the POST, over whatever scheme target has. Forbidden for ‘stdout’ (nothing to authenticate). |
target |
str | None |
null |
Destination the transport delivers to (e.g. a webhook URL). Required for ‘webhook’; forbidden for ‘stdout’. For ‘webhook’ must be an http(s) URL with a host, parsed the same way delivery parses it (httpx.URL) so a load-time pass guarantees delivery can parse it too. |
transport |
NotificationTransport |
required | The delivery protocol: ‘stdout’ prints a line, ‘webhook’ POSTs the notification as JSON. |
NotificationRule
Section titled “NotificationRule”A code-disposed alert.
The engine evaluates when (CEL over {m, out}, contracts/bindings.py) each
cycle; if true it emits a normalized, delivery-agnostic notification object. The model
never decides to send — so it can neither hallucinate a false alert nor forget a real
one; it influences only through validated output fields the condition may read
(e.g. a required out.severity). cooldown debounces a standing condition so it
can’t spam.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
channels |
list[str] | None |
null |
Channel labels (keys into Bundle.notification_channels) this rule delivers to when it fires; at least one, so a rule never fires into the void. None -> the default ‘stdout’ channel (DEFAULT_NOTIFICATION_CHANNEL). Every label named here, explicit or defaulted, must exist in notification_channels or the bundle fails to load. |
cooldown |
Duration | None |
null |
Minimum time between two firings of this rule: one within cooldown of the rule’s last stored firing is dropped, whether or not the condition lapsed in between. A firing is stored before it is delivered, so the count holds across restarts. None -> may fire each cycle it holds. |
message |
str | None |
null |
Text of the notification, a Python str.format template: only {out.<field>} fills (recommendation, rationale or a required output field), as its value’s own text, and {{ and }} are literal braces. An unbalanced brace, a !conversion or :format spec (what it can format depends on the value’s type) or any other name is refused at load. None -> ‘ |
severity |
Severity |
"warning" |
A label carried to the stored notification, the stdout line and the webhook body; nothing routes or branches on it. |
when |
str |
required | CEL over {m, out}: the measures and the cycle’s validated output (out.recommendation, out.rationale, and each output field declared required: true). The deterministic trigger — code disposes, never the model. A measure with no data skips the rule that cycle, and so does a cycle with no model emission for a rule that reads out. Refused at load: any other name (status, state, now), an undeclared measure or output field, and an output field that is not required (the model may omit it, and the rule could not be evaluated). |
NotificationTransport
Section titled “NotificationTransport”Enum: Closed delivery-protocol vocabulary. Exactly two members ship in core — a protocol, never a
vendor: webhook is one POST that reaches any endpoint (WhatsApp, Slack,
Discord, ntfy, a personal server), the same no-lock-in move
inference/http.py already makes. Anything with its own operational surface
(SMTP, SMS, push) is a vendor sink and waits for a separate sink contract.
Values:
stdout=stdout— one line on the process’s standard output; notarget, nosecret_refwebhook=webhook— one HTTP POST of the notification as JSON totarget
Objective
Section titled “Objective”One named goal condition. Two intents share the same CEL shape but differ in lifecycle — a distinction only the author knows, so it is declared, never inferred:
- invariant (default) — a state to maintain (
spend <= 2000). Never terminates; drives the agent perpetually; never suggested for pruning. - terminal (
terminal=True) — an achievement to reach once (debt <= 0). Once stably met it resolves tometand is retired from the active reasoning context (kept in config + still reported) so a done goal cannot confuse the model.
deadline (terminal only) is a horizon relative to activation; the engine pins a
stable absolute UTC deadline the first time it sees the objective (keyed by
condition) so an unrelated re-revision cannot reset the clock. Past the deadline
unmet, the objective resolves to expired (a reported failure, not a silent retire).
deadline is a :class:~loom.contracts.duration.Duration on the wire — a relative
horizon, not a calendar-exact date (see that module’s docstring for why a duration is
anchor-free); the engine is what turns it into the absolute UTC datetime above.
See DESIGN.md §5.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
condition |
str |
required | CEL over m alone (the measures, m.<name>), the single source of truth for any threshold: true is pass, false fail, and a measure with no data yet makes it no_data, never fail. Refused at load: any other name (now, state) and any undeclared measure. A condition that evaluates to a non-boolean fails the cycle. |
deadline |
Duration | None |
null |
Terminal only (refused on an invariant): the horizon after the objective’s activation at which, still not passing, it becomes expired. The engine pins the absolute time once under this condition, so a longer deadline in a later revision does not move it, and a changed condition starts a new clock. |
terminal |
bool |
false |
True: a reach-once achievement, met after it passes on every evaluation across at least goal.evaluate_every (one passing cycle never counts) and then retired from the model’s context. False (default): an invariant kept forever. |
ObjectiveSpec
Section titled “ObjectiveSpec”The declared goal: named, deterministic conditions the agent reasons toward.
Pairs with a runtime ObjectiveStatus (evaluated each cycle, pinned into context
exempt from the memory budget, exposed on the agent API) — spec is what a human
declares, status is what the engine computes.
Each value is either a bare CEL string (shorthand for an invariant objective —
the common case, zero extra ceremony) or a full :class:Objective (condition +
terminal + deadline). CEL is over the measures (m) alone, checked at load
against contracts/bindings.py. The label keys it for
logs/rendering and is named after its measure when 1:1. The threshold lives only in
the CEL, never duplicated in prose, so it cannot drift. Qualitative intent is not a
goal; it lives in BehaviorSpec.principles.
Lifecycle: an agent parks in a terminal served state only when nothing active
remains — i.e. every objective is terminal-and-resolved (met/expired). Any
invariant objective keeps it running. See DESIGN.md §5.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
evaluate_every |
str |
"1d" |
The heartbeat’s cadence. Loom never schedules itself (DESIGN.md §5): python -m loom.config --launchd renders it as the heartbeat plist’s StartInterval, and it is also the stability window a terminal objective must pass across to become met. |
objectives |
dict[str, str | Objective] |
required | label -> CEL string (invariant shorthand) OR an Objective {condition, terminal, deadline}; at least one. The condition is the single source of truth. |
ObservabilityConfig
Section titled “ObservabilityConfig”Representation-statistics capture (the LeJEPA research surface).
OFF by default. Flipping stats on starts recording from that point forward — no
backfill, since cycles already run un-instrumented can’t be observed. Sampling and
retention knobs do not exist.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
stats |
bool |
false |
Embed each cycle’s validated output (the recommendation, rationale and declared fields) and store the vector with running statistics in the store’s stats table, for cycles from now on only. Nothing in Loom reads the rows back; they are queried from the store. Needs an embedder: the loom[embeddings] extra supplies one, and a host that passes its own to run_cycle needs no extra. With neither, the command-line and API loaders refuse the bundle at load, and a host’s run_cycle refuses it before any model call. |
OnConflict
Section titled “OnConflict”Enum: What the observation-log store does when a new record’s (source, id)
collides with an existing row. Distinct from IdentitySpec.strategy: identity is
how the key is computed (a parse concern, stays under normalize); on_conflict
is what persistence does when two records land on the same key (a storage
concern). See docs/decisions/0001-declarative-adapter-normalization.md.
Values:
ignore=ignore— INSERT-OR-IGNORE: the first-seen row wins; later ones are droppedupdate=update— UPSERT: the new payload overwrites the existing row
OnFull
Section titled “OnFull”Enum: What the storage circuit breaker does when the store reaches max_bytes.
Checked before each observation write. Only observations compact (roll up to
sufficient statistics); the append-only audit log is archived to a cold file,
never deleted. grow, and a compact that ends still over the cap,
then stay quiet until the store grows another 10% of max_bytes; block refuses
every observation write while over. See DESIGN.md §7.
Values:
block=block— refuse every observation write while at or over the cap (raises StorageFull)compact=compact— roll observations past raw_window (zero when it is neither set nor derivable) up to sufficient statistics; if still over, move settled audit rows (terminal proposals older than limits.window) to a gzip’d JSONL cold file beside the store + warn to export it; if still over, warn.grow=grow— ignore the cap, keep writing, warn once per 10% of cap growth
OnParentExit
Section titled “OnParentExit”Enum: What happens to a live child when its parent’s own cycle ends. Reaping happens at cycle boundaries and spawn attempts, never on a timer; the engine holds the runtime behavior and this only declares the policy.
Values:
detach=detach— the child is left running;ttlstill stops it, and it is started again if it ended with the parent’s processreap=reap— the child is stopped when the parent’s cycle ends, or at the next cycle start if a crash left it
OutputField
Section titled “OutputField”One typed field the model must fill each cycle.
description is the instruction the model reads for this field: it goes into the
emission schema in the format instruction.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
description |
str |
required | The instruction the model reads for this field, sent as the field’s description in the emission schema. |
item_type |
OutputFieldType | None |
null |
The element type of an array field, one of string, integer, number, boolean or date (not array or enum); required for array and refused for any other type. |
required |
bool |
false |
Whether the field must be present. A field that is present must match its type either way (null does not), and a key no field declares is invalid. An invalid emission is re-asked up to max_retries times, then the cycle ends errored and none of its proposals run. |
type |
OutputFieldType |
required | The field’s type: string, integer, number, boolean, enum, array or date. An emission whose value is another type is invalid and re-asked. |
values |
list[str] | None |
null |
The allowed values of an enum field; required for enum and refused for any other type. |
OutputFieldType
Section titled “OutputFieldType”Enum: Closed type vocabulary for a declared output field, spelled as params_schema
spells JSON Schema types (str, int, float, bool and list are refused, naming
the new spelling).
Closed on purpose: every emission must be validatable and every out.<field>
selector in a notification rule checkable when the bundle loads. A JSON-Schema escape
hatch would be unbounded — unvalidatable in practice and impossible to typo-guard — so
we don’t open one (same discipline as the memory-policy union).
Values:
array=array— a list whose every element has the field’sitem_typeboolean=boolean— true or falsedate=date— a calendar date as text, YYYY-MM-DD; a date with a time is invalidenum=enum— text equal to one of the field’svaluesinteger=integer— a whole number, written as 3 or 3.0; a boolean is not onenumber=number— any number, a whole one included; a boolean is not onestring=string— text
OutputSchema
Section titled “OutputSchema”The structured object the model must emit each cycle — the “code disposes” gate.
This is only what the agent concludes (narrative + typed domain fields); it is not
what the agent does — capability invocations travel a separate proposals channel
governed by the registry (validate -> approve -> execute). Every emission is validated
against this shape; an invalid one is re-asked up to max_retries and then the cycle
is parked errored (logged, last-good state untouched) — never coerced or half-accepted.
Declared fields are also the domain surface the observability stats sample over.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
fields |
dict[str, OutputField] |
{} |
Typed fields the model fills beside the built-in recommendation and rationale. The key is the field name, a bare identifier other than those two; a notification rule reads the value as out.<name>. |
max_retries |
int |
2 |
Re-asks of the model after an invalid emission, each carrying the validation errors; once they are spent the cycle ends errored and none of its proposals run. Every attempt counts toward limits.max_calls. |
PerCustomerLimit
Section titled “PerCustomerLimit”A cap on how many turns one customer may take in a rolling span, in a bundle of kind: chat.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
max_turns |
int |
required | Cap on the turns one customer takes in the trailing window. Reaching it refuses that customer’s next turn until the window rolls on; every other customer is unaffected. |
window |
str |
"1h" |
The trailing span max_turns counts over; it rolls with the clock, so a tripped customer resumes once old turns leave it. |
Period
Section titled “Period”Enum: A calendar-aligned measure window: the current day, ISO week or
month, from its start in the bundle’s timezone up to now. Not a rolling
horizon – window: 1d is the last 24 hours, period: day is since local
midnight – so the two never share a spelling. Closed on purpose:
a fiscal calendar or a week-start setting waits for a consumer to define it.
Values:
day=day— local midnightmonth=month— the 1st at 00:00week=week— Monday 00:00 (ISO 8601)
Principal
Section titled “Principal”Who/what triggered this cycle — engine-supplied, never model-sourced (unlike
ActionProposal, which the model itself proposes). Bound into the policy-gate CEL as
the reserved actor.* namespace, in the capability-condition context only (there is
no actor in objectives/notifications). Gating on action.params.<identity> instead is
an anti-pattern: that field is model-self-reported, not authenticated..
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
authenticated |
bool |
false |
Whether the actor proved who it is, read as actor.authenticated. False on every cycle the CLI starts; true for an Agent API caller, whose bearer token was checked against the secret store. |
id |
str |
required | Stable identifier of the actor: cli-<8 hex> for a CLI or launchd cycle; an Agent API request carries the caller id its bearer token names. |
kind |
PrincipalKind |
required | Who or what is acting; Loom’s own entry points supply system (the CLI heartbeat) and service (the Agent API). |
roles |
list[str] |
[] |
Role names the actor holds, read as actor.roles. A cycle the CLI starts carries none; an Agent API caller’s roles are those its bearer token was issued with. |
PrincipalKind
Section titled “PrincipalKind”Enum: Who/what is acting, as a condition reads actor.kind. A human is one kind — richer
human identity (name/prefs/workspace) is out of Loom’s scope and lives in a consumer
app above it. Loom’s own entry points build three kinds, system, service and agent, and a
token issued as human carries human; the rest are values a host application may carry
(_ACTOR_FIELDS in contracts/bundle.py is read off Principal itself).
Values:
adapter=adapter— no Loom entry point builds it: no adapter-triggered cycle exists yetagent=agent— a child acts as this, under the token its parent issued it (core.children, api/tokens.py), never asservicehuman=human— a person: a token issued with--kind humanschedule=schedule— no Loom entry point builds it: the CLI heartbeat issystemservice=service— a calling app signed in by its token (the token’s caller id)system=system— the heartbeat: the CLI cycle launchd runs (idcli-<8 hex>)
RetentionSpec
Section titled “RetentionSpec”How the tenant’s footprint stays bounded — a fixed-size, downsample-old-data
model (the RRDtool / TSDB tiered-retention pattern). Old full-resolution
observations roll up into aggregates (the sufficient statistics a measure needs),
so a standing/invariant goal runs indefinitely under a fixed cap. Distinct from
memory.token_budget (context tokens, not disk bytes). See DESIGN.md §7.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
max_bytes |
ByteSize |
500000000 |
Size cap on this bundle’s one SQLite store, counting the file and its write-ahead-log files. Workspace folders and the audit archive file sit outside it. Checked before each observation write; on_full says what happens at or over the cap. Accepts human sizes (‘500MB’). |
on_full |
OnFull |
"compact" |
What happens when the store is at or over max_bytes: compact rolls observations up and archives settled audit rows, block refuses observation writes, grow keeps writing and warns. |
raw_window |
Duration | None |
null |
Keep full-resolution observations this long; beyond it they roll up to sufficient statistics (kept, bounded). None = derive from the longest MeasureSpec.reach() (a rolling window plus its offset, or a calendar period’s length plus a day), so data a live measure still needs never rolls up; with no bounded measure, rows roll up only when an over-cap compact trips. A value shorter than the longest measure reach is refused at load. |
RetrievalMemory
Section titled “RetrievalMemory”Semantic recall — refused at load.
Semantic recall over the whole observation log — the only policy that would run a query, so the only one with search knobs. It would always use vectors, and no backend has a vector index.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
fetch_k |
int |
40 |
Reserved: the retrieval policy is refused at load, so this is never read. Meant as the candidate pool fetched before the threshold and decay. |
hybrid |
bool |
false |
Reserved: the retrieval policy is refused at load, so this is never read. Meant to fuse vector similarity with keyword ranking. |
policy |
Literal |
required | Selects this policy, which is refused at load: no semantic recall exists. |
recency_half_life |
Duration | None |
null |
Reserved: the retrieval policy is refused at load, so this is never read. Meant as the half-life of an exponential time decay on scores; none would rank by similarity alone. |
score_threshold |
float | None |
null |
Reserved: the retrieval policy is refused at load, so this is never read. Meant to drop candidates below this cosine similarity. |
token_budget |
int |
8000 |
Reserved: the retrieval policy is refused at load, so this is never read. Meant as the cap, in estimated tokens, on the memory block; a negative value is refused. |
top_k |
int |
12 |
Reserved: the retrieval policy is refused at load, so this is never read. Meant as the matches assembled into context. |
RiskTier
Section titled “RiskTier”Enum: A capability’s load-time classification: its one effect is the
approval floor dangerous sets; nothing reads it at runtime.
Values:
dangerous=dangerous— may only behuman- ordeny-approved;autoandparentare refused at loadmutating=mutating— a label only: loads and runs exactly likeread_onlyread_only=read_only— a label only: loads and runs exactly likemutating
RollingWindowMemory
Section titled “RollingWindowMemory”Last N observations verbatim, time-ordered. No summarization, no search.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
policy |
Literal |
required | Selects this policy: the last window observations verbatim, with no compacted tier. |
token_budget |
int |
8000 |
Cap, in estimated tokens (characters / 4), on the memory block of a cycle’s prompt: the recent observations first, then for tiered the compacted aggregates in what is left. The system prompt, goal and measures are outside it. With inference.session: keep the same cap bounds the observations that arrived since the session’s last reply. Zero leaves the block empty; a negative value is refused at load. |
window |
int |
50 |
How many of the most recent observations the memory block shows verbatim, newest first, within token_budget: a count, not a duration. Zero shows none; a negative value is refused at load. |
Schedule
Section titled “Schedule”The timer of a bundle that has no goal (a goal’s timer is goal.evaluate_every).
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
every |
str |
required | How often the timer runs a cycle: the same Duration grammar as goal.evaluate_every. |
Secrets
Section titled “Secrets”The vault namespaces a bundle may read.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
namespaces |
list[str] |
[] |
The <namespace> part of every vault://<namespace>/<name> the bundle names (inference, capabilities, notification channels, storage, adapter auth). A reference to any other namespace is refused at load; none declared means none read. |
SessionMode
Section titled “SessionMode”Enum: Whether a coding-agent model keeps one conversation across a bundle’s cycles.
Values:
fresh=fresh— every cycle is a stateless callkeep=keep— a cycle after the first resumes the agent’s own last session; coding-agent providers only
Severity
Section titled “Severity”Enum: Semantic urgency — deliberately NOT a delivery target.
Routing is per-rule (NotificationRule.channels), never severity-based: an
info rule wanted on a phone would otherwise have to be relabelled critical
purely to reach it, which corrupts what the field means, and severity routing has
no way to typo-check a destination at load..
Values:
critical=critical— a label only, likeinfoinfo=info— a label only: stored, printed and sent; nothing branches on itwarning=warning— the default
SourceDurability
Section titled “SourceDurability”Enum: Whether Loom keeps a raw copy of each record at ingest.
Values:
durable=durable— the only value that loads: Loom stores what the recipe builds and keeps no separate raw copytransient=transient— reserved, refused at load; a local raw copy at ingest is not built
StorageBackend
Section titled “StorageBackend”Enum: The engine that holds the store: one local file per bundle. sqlite is the only
one. See DESIGN.md §7.
Values:
sqlite=sqlite— one SQLite file per bundle
StorageConfig
Section titled “StorageConfig”Pluggable persistence. Loom is a tenant (see CLAUDE.md conventions): it confines all DDL/DML to its own namespace and never touches objects it did not create. Storage owns its own version/migrations, separate from schema_version. Context: DESIGN.md §7.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
backend |
StorageBackend |
"sqlite" |
The engine that holds the store. sqlite is the only one: a single local file per bundle. |
location |
Locality |
"local" |
Where the store lives. Must be local: the only engine is an on-disk file, so remote is refused at load. |
options |
dict |
{} |
Engine settings. Only path is read: the store file’s own path (~ expanded), in place of <name>.sqlite3 in the data folder. Any other key is refused at load. |
retention |
RetentionSpec |
all defaults | How the store’s size stays bounded: the size cap, how long full-resolution observations are kept, and what happens at the cap. |
secret_ref |
str | None |
null |
Refused at load when set: the only engine takes no credentials. |
StreamSpec
Section titled “StreamSpec”One named record kind inside a multi-stream adapter: its own
normalize recipe (today’s NormalizeSpec, unchanged) and its own ingest
policy — persistence can differ per kind just as parsing does. Declared
under AdapterConfig.streams instead of the adapter’s top-level
normalize/ingest, never alongside them (AdapterConfig._streams_exclusive).
See docs/decisions/0001-declarative-adapter-normalization.md “Streams”.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
ingest |
IngestSpec |
all defaults | This stream’s own persistence policy; omitted, the defaults. |
normalize |
NormalizeSpec |
required | This stream’s own recipe, read by its own gate; records of the stream are stored with source ‘ |
StructuredOutputMode
Section titled “StructuredOutputMode”Enum: How structured output is generated, mapped per provider. Validation is mandatory regardless of method — this only reduces retries. See DESIGN.md §5.
Values:
grammar=grammar— reserved, refused at load; local: constrained decoding (XGrammar/GBNF); refused at load, unbuiltnative=native— reserved, refused at load; cloud: provider structured-output / tool-calling; refused at load, unbuiltprompt_fallback=prompt_fallback— universal: prompt -> parse -> validate -> retry
SummaryBufferMemory
Section titled “SummaryBufferMemory”Summary + recent verbatim — refused at load.
A rolling summary of everything older, plus the last N verbatim.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
policy |
Literal |
required | Selects this policy, which is refused at load: no summarizing memory exists. |
recent |
int |
20 |
Reserved: the summary_buffer policy is refused at load, so this is never read. Meant as the count of recent observations kept verbatim beside the summary. |
token_budget |
int |
8000 |
Reserved: the summary_buffer policy is refused at load, so this is never read. Meant as the cap, in estimated tokens, on the memory block; a negative value is refused. |
TieredMemory
Section titled “TieredMemory”Default. Layered fidelity: hot (recent observations, full) -> cold (aggregates).
Hot is the last hot observations verbatim; cold is the rolled-up statistics of
compacted history (all-time measures), filling what hot left of token_budget.
No warm (summarized) tier: summarization is summary_buffer’s. Cold embeddings
(embed_cold) are refused at load.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
embed_cold |
bool |
false |
Reserved: true is refused at load, because no embedding index exists; false is the only live value. |
hot |
int |
20 |
How many of the most recent observations the memory block shows verbatim, newest first, within token_budget. Zero shows none and the cold tier still renders; a negative value is refused at load. |
policy |
Literal |
"tiered" |
Selects this policy: the recent observations verbatim, then the compacted aggregates. The default when memory: is left out. |
token_budget |
int |
8000 |
Cap, in estimated tokens (characters / 4), on the memory block of a cycle’s prompt: the recent observations first, then for tiered the compacted aggregates in what is left. The system prompt, goal and measures are outside it. With inference.session: keep the same cap bounds the observations that arrived since the session’s last reply. Zero leaves the block empty; a negative value is refused at load. |
Transport
Section titled “Transport”Enum: How records are fetched — orthogonal to how they’re normalized.
Values:
host=host— the embedding host supplies the running Adaptermcp=mcp— reserved, refused at load; an MCP server subprocess is not builtnative=native— the built-in directory poller: one record per file under options.pathsinger=singer— a Singer-compatible tap run as a subprocess, once per cycle
TriggerMode
Section titled “TriggerMode”Values:
poll=poll— Loom fetches the adapter once per cycle, so goal.evaluate_every sets how oftenpush=push— an app hands records to POST /observations naming the adapter; Loom fetches nothingstream=stream— reserved, refused at load; a long-running source is not built
TriggerSpec
Section titled “TriggerSpec”When an adapter runs. There is no per-adapter cadence: a heartbeat cycle fetches
every poll adapter once, so goal.evaluate_every alone sets how often.
Fields: (named as a bundle spells them)
| Field | Type | Default | Description |
|---|---|---|---|
mode |
TriggerMode |
required | ‘poll’: Loom fetches this adapter once per cycle. ‘push’: an app hands records in (POST /observations, Commands.add_observations) and Loom fetches nothing, so the adapter sets no transport, options, streams or credential. ‘stream’ is refused at load until it is built. |
options |
dict |
{} |
Reserved, with no reader: a non-empty value is refused at load; {} is the only value that loads and does nothing. |