Module context

Module context 

Source
Expand description

CELLSTATE Context - Context Assembly

Provides intelligent context assembly with token budget management. Combines all inputs into a single coherent prompt following the Context Conveyor pattern.

Structs§

AssemblyDecision
Decision made during context assembly for audit trail.
ContextAssembler
Context assembler that builds context windows from packages. Adds sections by priority until budget is exhausted.
ContextOutline
Lightweight outline of a context package for progressive disclosure.
ContextPackage
Context package - all inputs for assembly. Similar to ContextPackage in the TypeScript CRM pattern.
ContextPageDiff
Diff between two context windows after re-paging.
ContextSection
A section of the assembled context.
ContextWindow
Assembled context window with token budget management.
GraphLink
Graph link hint for context assembly (from SQL adjacency projection).
KernelConfig
Kernel configuration for persona and behavior.
ScopeSummary
Summary of a scope for context assembly.
SegmentUsage
Segment usage tracking.
SessionMarkers
Session markers for tracking active context.
SourceRef
Reference to a source entity.
TokenBudget
Segment-based token budget allocation.
TokenBudgetBuilder
Builder for constructing TokenBudget with custom ratios.

Enums§

AssemblyAction
Action taken during context assembly.
ContextSegment
Context segment types for budget tracking.
SectionType
Type of context section.
SegmentBudgetError
Error type for segment budget violations.

Functions§

estimate_tokens 🔒
Estimate tokens using the default heuristic tokenizer.
truncate_to_token_budget
Truncate text to fit within token budget. Prefers sentence boundaries, falls back to word boundaries.