orchestrata_ultimate.context
Reference › orchestrata_ultimate › context
Top-level context assembly package.
The context package builds the prompt context a volk receives. It collapses several sources into one bundle under a token budget: mission and plan state from the session, memory, prior-stage artifacts, knowledge-graph code context, AST signals, semantic search results, the task pack and the user's instruction. It prepares prompt material only and never calls the LLM. The narrative is in context.
Parts, by role:
- Accounting: budget defines
ContextBudget, the per-layer reservations, andContextUsage, the spend tracker that refuses over-allocation. - Orchestration: assembler holds
UnifiedContextAssembler, whoseassemblemethod gathers each layer, trims it and counts it. It is called from the kernel's knowledge-graph pipeline. - Sources: the providers subpackage holds one renderer per layer, plus the trimming helper.
- Telemetry: usage_log appends one JSON line per assembly and aggregates the log for reports.
Flow: the caller passes a payload, subject and user message to assemble. Providers return text, trim_to_budget fits each layer to its reservation, ContextUsage records spend, and the result is a ContextAssembly with the parts and usage. The usage record is written to the log. Start reading at assembler. The package __init__ re-exports the public names.
Curated narrative
The hand-written story of this package: orchestrata_ultimate.context.
11 modules, 1,445 lines of code.
Subpackages
| Package | Modules | LOC |
|---|---|---|
providers |
7 | 753 |
Modules
| Module | Summary | LOC |
|---|---|---|
__init__ |
Top-level context assembly package. | 48 |
assembler |
Unified context assembler for volk prompts. | 358 |
budget |
Token-budget model for layered agent-context assembly. | 155 |
usage_log |
Structured context-usage logging and aggregation. | 131 |