Skip to content

Budgeted Context Export

The context export is DeltaMind’s primary output. It renders the working set as prioritized text that fits within a token budget, designed to be injected into LLM system prompts or context blocks.

Why budgeting matters

LLM context windows are finite and expensive. Injecting the full state wastes tokens on low-priority items. Injecting nothing wastes the session’s accumulated knowledge. The export balances these by rendering high-priority items first and truncating at the budget.

Priority ordering

The export renders sections in this order:

  1. Constraints — guardrails that govern everything else. These always survive truncation.
  2. Decisions — settled choices the model should respect.
  3. Goals — what the session is trying to achieve.
  4. Open tasks — work in progress.
  5. Unresolved branches — open questions and alternatives.
  6. Recent deltas — what changed recently (newest first).
  7. Changes since last export — incremental awareness.

If the text exceeds maxChars, it truncates from the bottom. This means constraints and decisions always survive, while recent changes are the first to be shed. This ordering reflects a deliberate priority: it’s more important to remember boundaries than to remember recent activity.

Export options

session.exportContext({
maxChars: 2000, // Default: 4000
recentDeltaCount: 10, // Default: 10
since: "2026-03-11T...", // ISO timestamp
includeSuperSeded: false, // Default: false
});
  • maxChars — the character budget. Includes section headers and formatting.
  • recentDeltaCount — how many recent deltas to include in the “Recent Changes” section.
  • since — only include items changed since this timestamp in the “Changed” section.
  • includeSuperSeded — whether to append superseded items (useful for debugging, not for injection).

Context economics

Scaling measurements across fixture classes:

TranscriptTurnsRaw charsExport charsRatio
Clean linear9698942135%
Messy real1298336337%
Pathological141,09919718%
Long linear565,10670314%
Long messy625,7831,37324%
Long pathological584,84556912%

Short transcripts can inflate (metadata overhead exceeds compression). By 56+ turns, context is 12-24% of raw. The overhead is fixed while the transcript grows linearly — this is why DeltaMind improves with session length.

Incremental context

The since option enables incremental awareness:

// First export — full state
const ctx1 = session.exportContext();
// ... more turns processed ...
// Second export — includes "changed since last export"
const ctx2 = session.exportContext();
// ctx2 includes a "Changed Since Last Export" section
// showing only items touched since ctx1

The session tracks the last export timestamp automatically. Each export’s “Changed” section shows items modified since the previous export, giving the model incremental awareness without re-reading the full state.

Export vs projection

Exports and projections serve different purposes:

ExportProjection
AudienceLLMHuman
FormatBudgeted textFull markdown
PriorityConstraints firstGrouped by kind
TruncationYes (maxChars)No
PurposePrompt injectionInspection