# What a context compiler does

Guide · Unforgetter · written 2026-08-27

Include, exclude, scope, freshness and a single write path. The mechanism behind 'the right context for every agent task', explained without hand-waving.

Canonical: https://unforgetter.com/blog/what-a-context-compiler-does

"Context compiler" is the phrase Unforgetter uses for the part of the product that turns a maintained record into what one agent receives for one task. It is a deliberate borrowing. A compiler takes a large, structured source and produces a small, specific output, and it refuses inputs that break the rules. This guide describes the current mechanism step by step, with the boundaries stated.

## Input: the working truth

The compiler does not read raw material. It reads a maintained record, the working truth, which already has structure:

| Kind | Example | Why it is structured |
| --- | --- | --- |
| Decision | Fee measures against the original booking date, 6 Aug | Carries a date and what it supersedes |
| Open thread | Capacity split unresolved | Must not be closed by implication |
| Rejected proposal | The 22 July fee draft | Kept so it is not re-proposed |
| Method | Money in minor units, never floats | Applies to every task of a kind |
| Policy | Customer copy never implies a price | Protected; agents cannot change it |
| Provenance | Source, date, actor per line | Traceable and citable |

If your record is a folder of notes, the compiler has nothing to compile. Building the record is the first job. A guide on that is [Memory is not context](https://unforgetter.com/blog/memory-is-not-context).

## Step 1: establish who is asking

Every request arrives with a token, and the token carries the workspace, the actor, the trust zone and a catalogue of allowed projects. The compiler does not take a "which project" parameter on faith. The agent selects a project from its catalogue, and a project outside it is refused with a specific error. Selection cannot widen authority.

This matters because scope is the one thing that cannot be left to relevance ranking. Relevant material from another client is still another client's material.

## Step 2: include what applies now

For the selected project and the stated task, the compiler assembles:

- decisions that currently apply, each with its reason and supersession date
- open threads the task could touch
- methods relevant to the task's kind (writing, engineering, research)
- policies that are always included where relevant, because they are protected
- provenance for every line

Supersession is applied here. The 22 July draft exists in the record, but it is marked superseded, so it does not enter the bundle as a candidate. The agent never sees two rules and has to choose.

## Step 3: exclude on purpose

Exclusion is not a side effect of a size limit. It is a rule. The current bundle for the fee task leaves out:

- the rejected 22 July proposal, because it is superseded
- four months of session transcripts, because they are history, not truth
- every other project, because they are out of scope

The homepage demo lists what was left out next to what went in. That is deliberate. A compiler that hides its exclusions cannot be trusted; one that shows them can be corrected.

## Step 4: mark freshness

The bundle carries two timestamps: when the record was last compiled, and when the serving replica received it. If they differ by more than the publish cadence, the bundle is marked stale rather than served as current. An agent can then cite freshness or wait, instead of proceeding on a record that may already have changed.

In the current deployment the canonical writer publishes every 15 minutes and immediately after each consolidation, so staleness is bounded and attributable.

## Step 5: bound the output

A context response is small: identity, relevant policies, current facts, open threads, methods, freshness, provenance and pointers for deeper retrieval. The whole workspace is never returned. If the agent needs more, it searches, and the search is scoped by the same token.

Bounding is what makes the bundle usable. An agent that receives forty items to find four will find the wrong four often enough to matter.

## The write path is part of the compiler

A compiler that only reads would drift. The record has to be maintained, and the way it is maintained decides whether the silos come back.

Agents cannot write the record. They propose. A proposal carries the actor, the evidence, the target and what it would supersede. It is append-only, attested and delivered exactly once to a single consolidator, which validates scope, protected targets, conflicts and taint, and then publishes or rejects. Rejected proposals are kept as rejected.

Untrusted evidence raises scrutiny and never lowers it. A proposal from a lower-trust zone is quarantined for stricter review. This is what stops one agent's session from becoming everyone's truth by accident.

## What the compiler does not do

- It does not run agents or relay tasks between them.
- It does not read every source in your life. Sources are allowlisted; raw inboxes, secrets and private notes are excluded by default.
- It does not decide what is true. The consolidator publishes, but the owner's corrections and protected policies are the authority.

The tools an agent sees are four: list projects, get context, search, propose. The [MCP reference](https://unforgetter.com/docs/mcp) documents them with their errors. Everything else in this guide is what happens behind those four calls.
