Skip to main content

Module context

Module context 

Source
Expand description

Context assembly — builds LLM prompts with token budget management.

Manages the token budget for LLM context windows:

  • System prompt (~500 tokens)
  • User model snapshot (~300 tokens)
  • Conversation history (~2000 tokens)
  • Retrieved memories (remaining budget)
  • Response buffer (~400 tokens)

Structs§

ContextAssembler
Context assembler — builds prompts respecting token budgets.
TokenBudget
Token budget allocation.
UserProfile
User profile data for context injection.

Constants§

ONBOARDING_ADDENDUM
System-prompt addendum injected while the user has fewer than 5 facts. Makes the LLM naturally curious and question-asking during onboarding.
ONBOARDING_GREETING
Hardcoded greeting for first-ever chat session (0 facts). Printed directly — no LLM call needed.
TOKEN_BUDGETS
Default token budgets.