Part II · Context, Memory, Files, and Composition
Continuous Context Optimization and Deliberate Compression
Continuous context optimizationDeliberate compressionEmergency compressionMeaningful absence
1. The central distinction
AIOS distinguishes:
- reactive compression: a transcript or scratchpad grows until the system must summarize it to continue;
- continuous optimization: each judgment begins from a fresh composition of durable semantic ground;
- use-shaped compression: a specific projection preserves what a future use requires, states what was lost, and retains a path to exact source.
The goal is to remove dependence on the first, make the second normal, and govern the third explicitly. Imported transcripts and legacy streams may still require emergency compression, but that compression remains a provisional projection with visible loss and a route back to source. It does not silently become a canonical source or artifact or acquire accepted standing.
Continuous recomposition is how a distributed intelligence system can remain coherent without one central prompt or memory object. Human purpose sets the bearing; local files and relationships preserve continuity; the present cognitive movement determines the active resolution; the model performs bounded judgment; and reintegration changes the durable ground for what follows.
2. The spiral, not the scratchpad
A conventional long-running agent often behaves like this:
prompt
→ output
→ observation
→ append to history
→ reread growing history
→ compress when context pressure becomes severe
AIOS instead aims for:
durable ground
→ compose current situation
→ perform one judgment
→ integrate useful semantic product and delta
→ refresh durable ground
→ compose the next situation from what now matters
Recomposition replaces transcript accumulation
AIOS renews context from integrated durable ground after each judgment instead of extending history until pressure forces an emergency summary.
Text equivalent
History → More history; More history → Pressure; Pressure → Emergency summary; Durable semantic ground → Purpose-shaped capsule; Purpose-shaped capsule → Judgment and delta; Judgment and delta → Integrated artifact and memory; Integrated artifact and memory → Purpose-shaped capsule.
The upper path is a tape whose only relief is reactive shortening. The lower path is a loop: a purpose-shaped capsule produces a judgment and delta, their useful consequences land in artifacts and memory, and the next capsule is composed from that changed ground.
The loop spirals because each pass returns to changed ground. It does not simply move forward along a tape.
3. What “always optimized” can responsibly mean
“Always optimized” should be interpreted as a design discipline, not an absolute guarantee.
It means:
- the current object and purpose organize every context;
- previous process is not included merely because it happened;
- accepted results are represented in appropriate durable forms;
- irrelevant or stale ground is removed from routine attention;
- exact sources remain available for descent;
- compression is shaped by intended use;
- the operation and evidence budget shape what enters and at what resolution;
- context can expand, contract, or change resolution as the judgment changes;
- the system knows what standing a supplied item has.
It does not mean:
- every context is mathematically optimal;
- all relevant information is always known;
- no summary or compression occurs;
- no model call ever lacks needed ground;
- smaller context is always better;
- prior material cannot re-enter.
The claim should be tested as a comparative system property: does continuous recomposition produce better long-horizon work than reactive history management?
4. Use-shaped compression
One universal summary cannot serve all future judgments. AIOS instead defines different projections for different uses.
| Compression | Preserves | Intended use |
|---|---|---|
| Resumption account | Current state, last consequential change, decisions, open lines, next movement | Return after interruption |
| Decision account | Alternatives, evidence, criteria, rationale, dissent, authority, reopen conditions | Reconsider or apply a decision |
| Delegation account | Parent purpose, accepted ground, source grant, scope, limits, return need | Commission independent work |
| Artifact account | Purpose, audience, architecture, contribution of parts, outstanding repairs | Compose, edit, or review a document |
| Audit account | Provenance, authority, changes, sources, revisions, supersession | Verify or investigate |
| Promotion account | Recurring method, evidence, scope, counterexamples, future effect | Review reusable knowledge |
| Navigation account | High-level objects, relations, status, and descent paths | Orient without opening everything |
Each is a projection of the same durable situation, not a competing canonical account.
5. Compression integrity
Consequential compression should preserve:
- governing purpose and scope;
- claims and strength of support;
- material alternatives and contradiction;
- decision rationale and authority;
- uncertainty type, not only a confidence score;
- dependencies and conditions;
- source and supersession paths;
- the expected consequence of the compressed account.
It should also include two explicit controls.
Loss statement
What nuance, detail, examples, argument, or minority evidence did the compression omit?
Re-entry condition
When must the exact source or deeper layer be loaded again?
Example:
loss_statement:
- exact interview wording
- two weak counterexamples
- full chronology of the decision discussion
reentry_when:
- a claim is quoted publicly
- the audience segmentation assumption is challenged
- the decision is reopened
6. Multi-resolution context
Six levels of recoverable context
Judgments can move from one-line bearing to exact sources and full lineage, with lower-level evidence correcting the compressed views above.
Text equivalent
L0 — One-line bearing → L1 — Situation or resumption brief; L1 — Situation or resumption brief → L2 — Project / artifact / decision account; L2 — Project / artifact / decision account → L3 — Movement map and selected evidence; L3 — Movement map and selected evidence → L4 — Exact source or artifact prose; L4 — Exact source or artifact prose → L5 — Full lineage and operation evidence.
The downward ladder adds resolution rather than authority. The dotted return paths make compression revisable: exact prose or lineage can correct a movement map, which can then update the project, artifact, or decision account used at higher levels.
The active level is chosen by the judgment:
- orientation may need L0–L2;
- planning may need L1–L3;
- exact editing may need L2–L4;
- source audit may need L2–L5;
- high-stakes correction may move repeatedly among levels.
Optimization is therefore partly a resolution-selection problem.
7. Context expansion and contraction
The context field should breathe with the work.
Contract when
- the object is precise;
- the operation is local;
- purpose and decisions are stable;
- exact target text is available;
- unrelated alternatives would interfere;
- the person seeks speed or a light movement.
Expand when
- the object is unclear;
- a decision has distant consequences;
- sources conflict;
- a summary is contested;
- the work changes altitude;
- a cross-file relationship bears;
- a previously parked branch reaches its re-entry condition;
- completion or promotion is being judged.
Depth, aperture, ground, condition, artifact scale, risk, and judgment form can all influence the expansion policy.
8. Relevance is temporal
Material can become stale without becoming false.
Foreground standing should decrease when:
- the source changes;
- a time condition expires;
- contradictory evidence accumulates;
- purpose or scope changes;
- the artifact materially diverges;
- repeated use reveals counterexamples;
- a later decision supersedes it.
Staleness should trigger review, a visible label, or omission from routine context. It should not silently rewrite meaning.
9. Attention ecology
Continuous optimization requires different attentional regions.
| Region | Function | Inclusion behavior |
|---|---|---|
| Foreground | One active judgment or tightly related set | Included at required detail |
| Near background | Dependencies, open decisions, likely next bearings | Selectively included or prepared |
| Durable background | Accepted ground and sources retained for later use | Retrieved by relevance and standing |
| Parked field | Unresolved material with re-entry conditions | Omitted until trigger bears |
| Superseded field | Lineage that no longer governs | Omitted unless history or comparison matters |
| Released material | Temporary context intentionally not retained for routine recovery | Recovered only from source or archive if still available |
Recency is one signal. Purpose, dependency, risk, contradiction, and open commitments usually matter more.
10. Parking is an optimization operation
A durable branch should record:
- the question or alternative preserved;
- why it was separated;
- current standing;
- source and decision relationships;
- re-entry condition;
- disposition: active, parked, rejected, integrated, superseded, or released.
Parking prevents every unresolved thought from occupying the foreground while preserving an honest path back.
11. Purposeful forgetting
Forgetting is not indiscriminate deletion. It is governed removal from expected future attention.
Level 1 — Release from foreground
The material remains near and easy to compose but no longer competes with the active line.
Level 2 — Dormancy
Only a compact identity and re-entry condition remain in routine navigation.
Level 3 — Archival custody
Exact sources remain available, while temporary summaries, annotations, or process material are no longer maintained.
Level 4 — Deletion
Exact content is removed only under explicit person authority with known provenance and recovery consequences.
Contrary evidence, decision rationale, source custody, and the only lineage of accepted ground should not disappear merely to save context.
12. Predictive preparation without contamination
The system can prepare likely next-turn materials in an anticipatory runway:
- candidate movements;
- relevant ground;
- fitted guidance;
- alternative paths;
- provisional context compositions.
The runway remains non-authoritative. Fresh input must validate object continuity, fit, currency, authority, and contraindications. If the person moves elsewhere, the preparation can be discarded without contaminating accepted ground.
This separates low-latency preparation from hidden decision-making.
13. Comparison with common strategies
| Strategy | Strength | Failure at long horizon | AIOS response |
|---|---|---|---|
| Full transcript | Complete local process history | Noise, scale, recency bias, poor standing | Preserve results and reconstruct situation |
| Rolling summary | Compact and simple | One projection becomes universal; loss hidden | Use-shaped projections plus loss/re-entry |
| Generic retrieval | Broad source access | Similarity is not relevance, authority, or altitude | Purpose-shaped selection and standing |
| Large memory profile | Persistent personalization | Can overfit or harden stale assumptions | Scoped, revisable, evidence-linked memory |
| Autonomous scratchpad | Supports multi-step work | Hidden state, difficult audit, fragile restart | Durable files, bounded seats, explicit returns |
| Manual briefing | Often high quality | High user reconstruction cost | Compose from durable semantic records |
14. Optimization metrics
Context optimization should be measured across more than token count.
Relevance
- fraction of supplied ground used materially;
- omitted ground later required;
- irrelevant ground that distorted or distracted.
Fidelity
- preservation of source standing and contradiction;
- citation or source-descent accuracy;
- absence of invented authority.
Continuity
- resumption quality after interruption;
- consistency of purpose, decisions, and artifact state;
- correct use of updated or superseded ground.
Efficiency
- latency to useful foreground movement;
- model-context size;
- number of reconstruction or clarification turns;
- human effort needed to restate prior work.
Adaptivity
- ability to expand when risk or ambiguity increases;
- ability to contract for local work;
- correct re-entry of parked or exact ground;
- resistance to stale or over-promoted context.
Outcome quality
- factual and editorial quality;
- decision calibration;
- artifact coherence;
- task completion evidence;
- correction after contradiction.
15. Falsifiable predictions
The model predicts that, relative to transcript continuation and generic retrieval:
- long-horizon work will require fewer user restatements;
- decisions will retain more rationale and reopen conditions;
- contradictory evidence will be less likely to disappear during summarization;
- local edits will exhibit fewer unrelated changes;
- resumption after model or session change will be more accurate;
- context size can remain bounded without equivalent loss of project coherence;
- failures will be more diagnosable because context selection and source descent are inspectable.
These predictions can fail. For example, the overhead of maintaining semantic state may exceed its value for short or weakly structured work. The research program should identify that boundary.
16. Relation to the whole
Context composition defines what one bounded movement needs. Continuous optimization defines how that ground stays usable as the work grows. It depends on memory ecology to preserve exact sources, accepted results, temporal state, and open branches outside the active window. It also depends on reintegration: if a result is not given an honest standing and durable landing, the next context must reconstruct the work or inherit a misleading summary.
The chapters therefore describe one loop rather than three context techniques:
compose from durable ground
→ perform one bounded movement
→ review and reintegrate its result
→ compose again from the changed whole
The Context Composition research brief provides the nearest evidence on effective context, interference, memory policy, and system scaffolding. It does not validate continuous optimization as an integrated system.