Expand description
Sub-agent context contracts (GL#450).
A briefing pack is the contract between a parent agent and a sub-agent:
task, token budget, the facts the sub-agent needs, and the return format
it must produce. Packs are deterministic — same input, byte-identical
output — so they can be diffed, cached, and replayed. The return channel
is the inverse: a sub-agent reports category/key: value lines, which the
parent distills into recallable knowledge facts instead of raw transcript.
Structs§
- Contract
Fact - SubAgent
Contract V1 - Versioned briefing pack. Field order is fixed by this struct; serialization
uses
serde_json::to_string_prettywhich preserves struct order, keeping the bytes stable across runs.
Constants§
- RETURN_
FORMAT_ V1 - Instruction embedded in every pack telling the sub-agent how to report.
Functions§
- build_
briefing_ pack - Build a deterministic briefing pack: task + the most relevant current
facts, greedily filled (in stable relevance order) until
budget_tokensis reached. The task itself is always included; the budget governs facts. - parse_
return_ lines - Parse sub-agent return lines (
category/key: value) into structured facts. Lines that don’t match the contract format are reported back as rejects instead of being silently dropped. - serialize_
pack - Serialize a pack with stable formatting (struct field order, pretty JSON).