Skip to main content

Module assembler

Module assembler 

Source
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 Agent field mutations inside gather().
  • No channel communication inside gather().
  • All send_status calls remain in Agent::prepare_context.
  • session_digest is cached (not async) and stays in Agent::apply_prepared_context.

Structs§

ContextAssembler
Stateless coordinator for parallel context fetching.
PreparedContext
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_tail before stopping at the next non-ToolResult boundary, 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 MemoryFirst strategy is active.