Part II · Context, Memory, and Artifacts
Context Engineering as Content Composition
Treats context as a composed body of reasoning ground shaped by current intent. It explains how purpose, state, evidence, guidance, authority, and return conditions are selected and ordered for a particular judgment.
EVERYTHING AVAILABLE, ONLY WHAT IS COMPOSED
1. Context participates in the intelligence
For one model invocation, context defines the world within which judgment can occur. It establishes what the movement is for, which object matters, what ground bears, what standing that ground has, and what consequence the response can produce. Choosing and arranging that world is part of the intelligence architecture.
AIOS treats reasoning ground as a bounded, purpose-shaped account that makes one judgment possible while retaining the uncertainty, disagreement, authority, and routes to exact sources needed to keep the judgment honest.
The optimization target is therefore composed relevance. A strong context brings together:
- governing purpose and present bearing;
- the exact object and commissioned transformation;
- evidence, decisions, constraints, and alternatives with visible standing;
- current artifact or plan state at the required resolution;
- applicable methods, distinctions, and quality conditions;
- authority, available effects, expected product, and stopping condition;
- explicit omission, compression, and source descent.
Retrieval finds material. Composition decides what role that material plays in the judgment.
2. Every included region makes a contribution
Context is an authored argument about relevance. Each substantive region performs at least one function:
- establishes purpose, audience, scope, or consequence;
- defines the active object or question;
- supplies evidence, counterevidence, or an unresolved contradiction;
- carries an accepted decision, dependency, constraint, or commitment;
- presents artifact or plan state;
- configures the movement through relevant expertise or method;
- declares authority, expected product, return path, or stop condition.
Material that performs none of these functions consumes attention without improving the model's grasp of the situation. Semantic similarity alone does not earn inclusion.
Composition also establishes sequence. Purpose normally precedes detail. Standing appears close to the claim or decision whose meaning it governs. Exact source language remains distinct from summaries and instructions. The model encounters a deliberate situation rather than an inventory of fragments.
3. The natural order of reasoning ground
Diagram 1 · §3
Text equivalent
1. Bearing — What this movement serves → 2. Current situation — Accepted · live · contested · changed; 2. Current situation — Accepted · live · contested · changed → 3. Commission — Exact judgment and semantic product; 3. Commission — Exact judgment and semantic product → 4. Focal ground — Evidence · artifact · decisions · alternatives; 4. Focal ground — Evidence · artifact · decisions · alternatives → 5. Guidance — Method · distinctions · quality · failure boundaries; 5. Guidance — Method · distinctions · quality · failure boundaries → 6. Authority and return — What may change · what to return · when to stop; 6. Authority and return — What may change · what to return · when to stop → 7. Context warrant — Why included · what omitted · where to descend.
The sequence answers seven questions in order: Why has attention been assembled? What is true of the situation now? What judgment is being commissioned? Which material bears directly? Which developed practices improve the work? What consequence is available? Why is this selection accountable?
The object can require a different order. Exact emergency evidence may need to arrive before background, or a passage edit may present the target before a compact statement of the larger document. The composer retains the obligation to make the order intelligible.
4. Necessity, distortion, and interference
AIOS tests candidate ground through three editorial questions.
Necessity: What would the model otherwise have to reconstruct or guess? Governing purpose, a technical definition, current artifact state, an unfamiliar distinction, or a binding decision often passes this test.
Distortion: What omission would make the situation misleading? Material dissent, uncertainty, counterevidence, an important limitation, or the difference between proposal and decision belongs when its absence would change the apparent meaning.
Interference: What frame would this material import that does not belong to the present movement? Obsolete instruction, duplicated explanation, premature solutions, unrelated history, and overly broad guidance can all lower intelligence by competing with the real object.
These tests turn omission into deliberate work. The composer is not minimizing information for its own sake; it is protecting the model's finite attention for what the judgment needs.
One judgment, two contexts
Consider a synthetic evidence-review judgment: should a public brief retain the sentence, “Teams using the product complete projects 30 percent faster”?
An uncomposed retrieval dump might present:
- Analytics memo: median completion time was 30% lower for 42 completed projects.
- Interview 07: “It saved us a lot of time.”
- Draft launch copy: “Move from idea to outcome 30% faster.”
- Pricing notes from the same project folder.
- Onboarding brainstorm mentioning speed and momentum.
- Old product objective: reduce coordination delay.
- Analytics footnote: incomplete projects were excluded from the comparison.
- Research note: the two cohorts used different definitions of completion.
- Three semantically similar passages from earlier drafts.
A composed context for the same judgment might present:
Purpose: decide whether the public claim is supportable without overstating evidence.
Target: “Teams using the product complete projects 30 percent faster.”
Standing: the 30% figure is an observed difference in 42 completed projects;
it is not an accepted causal finding.
Necessary ground: exact analytics method and the current public sentence.
Material distortion risk: incomplete projects were excluded;
cohort completion definitions differed.
Relevant corroboration: Interview 07 reports perceived time savings,
but supplies no measured magnitude.
Commission: retain, narrow, or remove the sentence and explain the evidence basis.
Authority: recommend language only; do not edit the brief.
Return: decision, exact proposed wording if retained, limitations, and source descent.
Warrant: pricing, onboarding, and duplicate draft passages were withheld as interference.
The dump misses necessity because the governing decision and authority are absent. It creates distortion by placing the headline result beside caveats without expressing their standing. It adds interference through related material that cannot change this judgment. The composed version does not decide the answer in advance; it gives the model the purpose, contradiction, source relation, and consequence required to decide honestly.
5. Stable composition, freshly resolved ground
A context retains a stable semantic shape while its contents are rebuilt for every movement:
=== GUIDANCE ===
[FOCUS] — why this judgment is happening
[ROLE] — the relevant operational standpoint
=== CONTEXT ===
[PURPOSE] — current governing purpose
[SITUATION] — accepted, contested, changed, unknown
[ARTIFACT_MAP] — current structure at the needed resolution
[EXACT_GROUND] — selected source or artifact passages
[PRACTICE] — relevant workflow, method, or quality conditions
=== INPUT ===
[COMMISSION] — exact requested transformation
[MESSAGE_OR_TARGET] — present object
[RETURN] — expected product, authority, and stopping condition
The contract behind each region declares its source and revision, order, required or optional status, truthful emptiness behavior, refresh conditions, quantity limits, stale-state response, consumer, and effect on the judgment.
These labels illustrate responsibilities rather than public vocabulary. Model-facing language describes the human meaning of the ground. Mechanical identifiers appear only when exact reference matters.
6. Altitude determines resolution
| Altitude | Movement | Ground in focus | Ground normally withheld |
|---|---|---|---|
| Passage edit | Apply an exact bounded revision | Target language, seams, protected meaning, whole-document bearing | Full session history |
| Structure | Change movements and relationships | Document map, companion memory, dependencies, pending commissions | Most line-level prose until needed |
| Project | Align outcomes, plans, documents, and returns | Project purpose, decisions, relationships, document maps | Complete prose of every file |
These contrasting altitudes show the composer's distinct responsibility: withholding ground that would compete with the active judgment while keeping descent available. Chapter 04 owns the fuller resolution-by-judgment table. Metadata-first reading protects context width; exact prose returns when wording, evidence, or mutation depends on it.
7. Layered detail preserves exact descent
Context uses multiple resolutions rather than one universal summary.
Diagram 2 · §7
Text equivalent
Workspace or corpus synthesis → Project situation and relationships; Project situation and relationships → Document Home and accepted map; Document Home and accepted map → Movement contribution and anchor; Movement contribution and anchor → Exact prose, source, or evidence.
The system descends when a quotation or technical formulation matters, a summary is disputed, a claim's support requires inspection, an edit will change exact language, a compressed alternative becomes material, or a source has changed since a higher-level account was formed.
Semantic ascent restores bearing. A local edit can change a movement; the movement can change document architecture; the document can change project direction. No projection outranks the exact ground it describes.
8. Standing remains visible in language
Context says what kind of ground the model is reading. “The source states” differs from “the project currently accepts.” A prior review's inference differs from a person's decision. A candidate route differs from authorized work. A superseded conclusion can remain relevant to lineage without governing the present movement.
Structured labels reinforce these distinctions. Natural-language sentences explain their meaning in the actual case. This keeps semantic standing available to model judgment instead of leaving it implicit in storage location or interface styling.
9. Contradiction belongs when it can change the judgment
An optimizer that selects only support for the leading conclusion produces narrative consistency rather than intelligence. Contradictory and minority ground enters when it could change the object, confidence, decision criterion, plan, artifact honesty, method scope, or need for human adjudication.
Under context pressure, the composer preserves the strongest evidence for the alternative, the conditions under which it may hold, why it was not selected, and a path to the complete source. A generic statement that other views exist does not preserve a material disagreement.
This is especially important in long-horizon work. An inconvenient alternative omitted early can become the missing premise behind a costly downstream error.
10. The context warrant
Chapter 04 establishes that context selection carries a warrant; this chapter defines the composer's account of that selection. Consequential compositions record why the selected sources and resolutions fit, which material was compressed, what was withheld for independence, privacy, or bounded attention, which live alternative was preserved, what changed since a comparable judgment, and where deeper ground can be recovered.
The warrant describes the completed selection. It does not expose private chain of thought. It makes context engineering inspectable by allowing a reviewer to compare supplied context, omitted ground, source descent, and the resulting judgment.
11. Guidance is composed for the occasion
Guidance can come from a temporary scaffold, a reviewed method, a dependent sequence, a workflow stage, role or domain ground, an exemplar, a template, or accepted personal fitting. It enters only when its occasion, object, boundaries, and intended result fit the present movement.
Several resources combine only when one judgment remains primary. The receiving model gets coherent guidance, not the catalog, ranking trace, rejected candidates, or assembly machinery. Context composition turns reusable knowledge into situated expertise.
12. Dynamic controls shape the field
Depth, aperture, temporal ground, condition, selected guidance, artifact scale, risk, and judgment form influence how context expands or contracts. These controls affect recent-history width, relationship reach, exact-versus-mapped detail, alternative emphasis, and the relevance of guidance.
The model selects semantic orientation from supplied possibilities. Deterministic mechanisms resolve identities and assemble the corresponding natural-language ground. Semantic choice remains with the model; exact reference and effect remain with the host.
13. The composition pipeline
Diagram 3 · §13
Text equivalent
Current intention and object → Determine judgment and altitude; Determine judgment and altitude → Resolve canonical sources and standing; Resolve canonical sources and standing → Retrieve candidate ground; Retrieve candidate ground → Apply necessity · distortion · interference; Apply necessity · distortion · interference → Select or compose guidance; Select or compose guidance → Layer exact and compressed detail; Layer exact and compressed detail → Bind authority, product, stop condition; Bind authority, product, stop condition → Record context warrant; Record context warrant → Assemble model-visible capsule; Assemble model-visible capsule → Bounded judgment.
Different steps can be deterministic, semantic, or combined in one operation. The pipeline names obligations, not a mandatory universal context-selector agent.
14. Why composition changes the economics
The dominant alternative makes the cost of not composing appear affordable. Longer windows, broad retrieval, cached histories, and additional inference let a model search through material whose relevance and standing were never adequately settled. Compute substitutes for editorial selection.
AIOS invests before inference. It resolves purpose, standing, altitude, source, and consequence so the model receives fewer, better-chosen tokens on the model the movement actually requires. The benefit is not merely smaller context. It is reduced reconstruction burden and a more coherent object of judgment.
15. Failure conditions
Retrieval dump
A retrieval dump includes related passages without an account of their relevance or standing. The model receives fragments but must reconstruct the situation and decide which sources may govern.
Chronological transcript
A chronological transcript substitutes process order for present state. Speculation, correction, repetition, and accepted ground remain adjacent even though they no longer carry equal bearing.
Universal system prompt
A universal system prompt tries to hold purpose, domain expertise, style, workflow, and current object at once. Stable instruction expands until it competes with the actual judgment.
Hidden summary
A hidden summary becomes authority over its sources. Its omissions and framing govern later work without a visible loss statement or route to exact ground.
Token vacancy
Token vacancy treats unused capacity as a reason to add material. Context grows because space exists rather than because the judgment needs more ground.
Premature solutions
Premature solutions constrain discovery before the object is understood. They import a likely answer where the movement requires uncertainty, comparison, or reframing.
Catalog injection
Catalog injection makes the model spend attention selecting among options the system could have excluded. The catalog becomes part of the reasoning burden instead of a source from which fitted guidance is composed.
Each failure delegates composition back to inference.
16. Evaluation
Context composition can be evaluated structurally through source identity, ordering, omission behavior, standing, size, and warrant completeness; semantically through relevance, contradiction, purpose, artifact state, guidance fit, and source descent; and behaviorally through response quality, fewer reconstruction turns, calibrated uncertainty, bounded effects, resumption, and correction.
The strongest comparisons place composed context against recent transcript, generic top-k retrieval, rolling summary plus latest prompt, and a skilled human-authored briefing. Ablations can remove purpose, standing, dissent, exact descent, or the warrant to identify which relationships produce the observed effect.