Key takeaways

  • Measure what your memory metadata costs before you ship it. Two short labels per item, kind and status, added 10.5% to the average memory block in our replay of 387 blocks, and pushed 39 of 387 over our 12% limit.
  • Print a label only when it says something. Every item still carries both labels internally and is refused if either is missing, but a label that only repeats the default is not printed. That brought the cost to 2.68% on average, 3.02% at most, with 0 of 387 blocks over the limit.
  • A fixed budget turns metadata into lost memories. At an 800-token budget, the first version left one item out of 314 of 387 blocks. The second version leaves one item out of 81.
  • A random tag can break prompt caching. A memory block whose security tag changes on every render never matches the cached prompt in runtimes that rewrite the block each turn. A tag computed from the block's own content keeps it identical when the content is identical.
  • Some items must never be cut to fit. Constraints, active temporary states and fired reminders now sit in a section the budget cannot drop.

The need: an agent should know what each memory is, and whether it still holds

When an agent receives memory, it gets a block of items: things the person said earlier, answers given before, notes, and a summary of the last session. Today each item already carries an id, where it came from (a prompt, an answer, a note or a checkpoint), who wrote it, and the date. That tells the agent the source, but not two things it increasingly needs:

  • What kind of memory this is. As Yukti Memory learns more, a block will hold stated facts, preferences, temporary states such as "code freeze until Friday", reminders that have just fired, and task constraints. The agent should not have to guess which is which from the wording.
  • Whether it still holds. A preference that was later corrected, or a state whose end has passed, must never be presented as current.

So we designed a typed context packet: the same memory block, with every item labelled with a kind and a status taken from fixed lists. An item whose kind or status is unknown, or cannot be worked out, is not served at all.

Why this approach, and why not the alternatives

  • "Let the model infer the type from the text." It often can, but not reliably, and a wrong guess about whether a fact still holds is exactly the error a memory system exists to prevent. A fixed list, checked in code, cannot drift.
  • "Put everything in and let the model sort it out." Larger context windows do not remove the cost: tokens are billed, and the model's attention is shared across everything in the window. Our budget for one memory block is 800 tokens, so anything added to an item is taken from the space for another item.
  • "Shorten the label names." This was our first planned remedy, written down before the measurement. It would have made the block harder to read for the model and for anyone auditing it. The data pointed to a better fix, described below.

Three other rules came with the packet:

  • Nothing marked as history reaches the automatic lane. A corrected or ended item may be shown only when someone explicitly searches for the past. The memory pushed into the context unprompted is always current.
  • A mandatory section, never cut to fit. Constraints, active temporary states and fired reminders come first. When the budget is short, ordinary items are dropped first. If the mandatory items alone exceed the budget, the block says so instead of silently dropping one.
  • A stable tag. Each block is wrapped in a tag that stored text cannot fake or close. Until now that tag was random on every render, so two renders of the same memories differed in bytes. The packet uses a keyed hash of its own content instead: it still cannot be forged from stored text, and identical memories give an identical block.

How we tested it: lines written first, then a replay

We wrote six pass lines before writing any code, and built the packet in our Lab behind a setting that is off by default. Two of the lines matter most for this article:

  • Off means unchanged. With the setting off, every memory block must be byte for byte what it was before. We recorded today's blocks before touching any code, then compared 44 hand-written cases at 4 budgets and 1,548 blocks replayed from an earlier synthetic serving test.
  • The cost line. The new labels may add at most 12% to a block's tokens, measured on that same replay.

The replay used a synthetic serving test set from earlier this month: 387 memory blocks built from synthetic conversations, each holding the items our ranking chose for one prompt. We counted tokens the way the serve counts them, and compared each block with and without the new labels.

The other four lines covered the rest of the design: every served item typed (31 deliberately broken items, 0 served); no history on the automatic lane (0 history items in 36 blocks where history items ranked first); mandatory items never cut while ordinary ones remain (0 in 450 blocks across budgets from 50 to 2,500 tokens); and a stable tag (100 of 100 repeated renders identical, and any change to an item changes the tag). Two deliberately broken versions of the code, a "mutant" for each of two rules, had to fail their lines, and did.

Results

The first version failed the cost line (30 Nov 2026):

First version Second version
Mean token increase per block 10.5% 2.68%
Largest increase 14.4% 3.02%
Blocks over the 12% line 39 of 387 0 of 387
Blocks showing one item fewer at 800 tokens 314 of 387 81 of 387

The line did not say whether "at most 12%" meant on average or for every block. We recorded the stricter reading, every block, as the result, so the first version failed.

Why it cost so much. Each item gained kind="prompt" status="current": 31 bytes, about 10 tokens, on every item. Looking at the measurement, every item in today's memory has a kind equal to its source, and a status of current. The labels were correct, but on today's items they carried no information.

The fix. Our memory block already had a convention: some marks, such as "this part of a long message" or "this item was cut short", appear only when they apply. We applied the same rule to the new labels:

  • kind is printed only when it differs from the item's source: a fact, a preference, a temporary state, a reminder or a constraint;
  • status is printed only when the item is not current;
  • the block says once, in its opening line, that items are current and of their source's kind unless marked.

Every item is still checked for both labels before it is rendered, and still refused if either is missing or unknown. Only what is printed changed. The second version passed the cost line under both readings, and the other five lines still held.

What it did not do yet. The packet is a Lab build, off by default. It does not serve anything to anyone. Turning it on changes what an agent receives, so it goes to our review council first, and then needs an explicit yes before any install. Some choices made in the build, such as the order of mandatory items and how the "active" status is computed, are listed for that review.

Why the tag matters for prompt caching

Prompt caching lets a model provider reuse the work already done on the unchanged start of a prompt. It only helps if those bytes are identical from one request to the next.

How memory reaches the model decides whether a random tag hurts. Where each memory block is added once and then stays in the conversation as fixed history, a random tag costs nothing: once sent, the block's bytes never change. But some agent runtimes keep a memory slot near the top of the prompt and rewrite it on every turn. There, a tag that changes on every render means that slot, and everything after it, never matches the cache, even when the memories themselves are the same. A tag computed from the block's content keeps the bytes identical whenever the memories are identical.

What's next

  • The packet is the frame our newer memory types render through. Reminders that fire when a condition is met and temporary states with an end both need the kind and status labels and the mandatory section.
  • It feeds our context-bloat measures. We are measuring how much of what a memory system injects actually helps an answer, and how that changes as the store grows. A label that costs tokens on every item is exactly the kind of quiet bloat those measures exist to catch.

What we'd suggest

  • Put a number on your metadata before shipping it. Replay real or synthetic blocks with and without it, count tokens the way your system counts them, and decide what share you are willing to spend.
  • Write the cost line before the measurement, and say which reading counts: average or every block.
  • Print defaults once, not on every item. If most items share a value, say so in the header and mark only the exceptions.
  • Check that your tags and ordering are deterministic if your runtime rewrites memory in place, or you will pay for cache misses you never see.
  • Keep a section that the budget cannot cut for constraints and active states, and make overflow visible rather than silent.

Frequently asked questions

How much does metadata in an AI agent's context window cost?

In our replay, two labels on every memory item added 10.5% to each block on average. Printing them only when they carried information brought that to 2.68%.

Does a bigger context window remove the cost of memory metadata?

No. Tokens are still billed, and the model's attention is shared across everything in the window. With a fixed memory budget, extra metadata also pushes real memories out: in our first version, 314 of 387 blocks lost an item.

Why does a random tag break prompt caching?

Prompt caching reuses work only when the start of the prompt is byte-identical. If a memory block near the top is rewritten every turn with a new random tag, it never matches, even when its memories have not changed.

What should never be cut from an agent's memory to fit a budget?

In our design: constraints the task must respect, temporary states that are still active, and reminders that have just fired. Ordinary memories are dropped first, and if the essential ones alone overflow, the block says so.