Expand description
Stateless context assembler.
ContextAssembler gathers all memory-sourced context for a single agent turn by running
all async fetch operations concurrently. It takes only borrowed references via
ContextAssemblyInput and returns a PreparedContext ready for injection.
Invariants:
- No
Agentfield mutations insidegather(). - No channel communication inside
gather(). - All
send_statuscalls remain inAgent::prepare_context. session_digestis cached (not async) and stays inAgent::apply_prepared_context.
Structs§
- Context
Assembler - Stateless coordinator for parallel context fetching.
- Prepared
Context - Result of one context-assembly pass.
Constants§
- CORRECTIONS_
PREFIX - Prefix for past-correction injections.
- CROSS_
SESSION_ PREFIX - Prefix for cross-session context injections.
- DOCUMENT_
RAG_ PREFIX - Prefix for document RAG injections.
- GRAPH_
FACTS_ PREFIX - Prefix for knowledge graph fact injections.
- MAX_
KEEP_ TAIL_ SCAN - Maximum number of messages scanned backward by
memory_first_keep_tailbefore stopping at the next non-ToolResultboundary, to avoid O(N) scans on long sessions. - RECALL_
PREFIX - Prefix for semantic recall injections.
- SUMMARY_
PREFIX - Prefix for past-session summary injections.
Functions§
- effective_
recall_ timeout_ ms - Clamp recall timeout to a safe minimum.
- memory_
first_ keep_ tail - Compute how many tail messages to keep when the
MemoryFirststrategy is active.