Skip to main content
When sending memories to an LLM, you often face a token budget. Mneno’s Context Builder helps you select the most relevant memories that fit within a specified budget, while explaining why each was included or excluded.

Building Context

Use the build_context() method to generate a ContextPackage.

Presets

Mneno comes with several built-in presets for common use cases:
  • cheap: Smallest useful context, optimized for cost. (max 400 tokens)
  • balanced: Default tradeoff between quality and cost. (max 1200 tokens)
  • high_recall: Includes more context to avoid missing useful memories. (max 2500 tokens)
  • agent_state: Prioritizes operational state, goals, constraints, and preferences.

Custom Policies

For full control, you can define a ContextPolicy.

Policy Parameters

Explainable Context

The ContextPackage contains detailed lists of included and excluded items, each with a reason.
This transparency is crucial for debugging why an LLM might have missed specific information. Conflicted memories remain eligible by default and are marked with an explicit conflict warning in both their inclusion reason and formatted context text.