Route Context Just in Time
Durable knowledge can be much larger than an agent’s active working set. Keep the larger environment searchable, tell the worker what kind of context exists and where to find it, and let the task pull in the next relevant slice. The harness manages attention by making retrieval reliable across long trajectories and repeated compaction.
Disk is an infinite context sink describes the underlying move: externalize state, inspect a bounded preview, and let the agent use code to select the rest. A local disk is a durable, searchable working store. Mounted corpora and connectors make other authoritative sources addressable without transferring their ownership. The target repository retrieves relevant slices and keeps its local contracts and routes.
Larger context windows reduce capacity pressure. Attention, retrieval quality, conflicting guidance, and deciding which fact matters at the current step remain scarce. Deterministic context stuffing fails once work crosses many compactions; the worker must be able to recover the route again.
The two-part context economy places nonfunctional requirements in a space where they can be pulled into context, then minimizes the context required to apply them well. Domain modeling gives each requirement a durable owner and representation. Just-in-time routing selects the relevant slice when a task reaches the decision it governs.
Route across distinct knowledge layers
Different bodies of knowledge enter a trajectory through different interfaces.
| Layer | Material | Agent interface |
|---|---|---|
| Authoritative systems | Current records, events, permissions, and operational history | Search, connectors, queries, and bounded tools |
| Shared context stores | Curated cross-project ontology, operating principles, and source routes that preserve links to live owners | Mounted corpora, search, or a knowledge service |
| Target repository | Local architecture, schemas, decisions, critical journeys, runbooks, guardrails, and source routes | Files, nested guidance, search, commands, and failing checks |
| Active context | The task, current observations, plan, proof, unresolved decisions, and the slices selected from the other layers for the current run | Prompt, retrieval results, tool output, and summaries |
Deploy Into the Private Process-Data Iceberg develops why operational and organizational knowledge keep authoritative owners outside a product repository. Just-in-time routing composes those sources for one task and leaves the broader corpora in place.
Curate the route beside each goal
Pair a goal-bearing parent worker with a context sidecar: a separate worker that continuously manages small Git repositories the parent can grep and search. The parent owns the outcome. The sidecar maintains the context projection for that goal.
Publication separates observations from context approved for later work. The parent emits questions, retrieval failures, unresolved terms, outcome evidence, and other context gaps into a candidate channel isolated from the parent’s retrieval tree. MISTAKES.md, LEARNINGS.md, and DESIRES.md are agent-emitted telemetry for the harness builder. Corroborate those self-reports before publishing them as context.
Completed work remains a rich source of candidates. Aakash Gupta’s interview describes a context library that interviews users and learns from completed tasks. The Latent Space interview separately describes collecting agent trajectories and distilling a team knowledge base. Reviewed work supplies candidates for the same reconciliation path. The sidecar stages and reconciles those observations; the responsible domain owner approves context that encodes judgment or policy.
Candidate material remains untrusted and excluded from the parent’s retrieval path. It cannot trigger publication directly. The curator proposes a claim-and-evidence diff in an isolated staging area, preserving source, classification, and audience metadata. Sensitive material remains with its authoritative owner. A publication policy names the responsible reviewers, the mechanical updates that validators may accept, and the distinct identity allowed to publish.
Ryan's private homelab repository provides a narrower analogue in a scheduled documentation-freshness role. The repository-wide role compares operator docs with the configuration and monitoring files that define current behavior. A finding must name the stale page, the local evidence that disagrees with it, a concrete edit, and any unresolved judgment. It is report-only by default; a person explicitly authorizes the follow-up that changes the repository.
The proposed goal-sidecar adds the isolated staging and publication boundary. Feedback changes its curator as well as its projection. Human responses to candidate reports, pull-request review, and failed validation update the sidecar's versioned contract. Its own comments carry a stable marker and are excluded from the human-feedback channel. That distinction prevents the curator from treating its prior output as independent supervision while still letting lived outcomes improve later sweeps.
The curator reconciles each candidate against authoritative sources and the currently published projection. It records provenance, freshness, audience, and unresolved contradictions. Accepted changes are published as an atomic commit. Every projection read in a trajectory resolves through one immutable commit hash. A normal refresh adopts a new hash between trajectories; a forced mid-run refresh creates an explicit phase boundary and records the old and new hashes. Live-query results remain outside the pinned projection by default. A reviewed bounded snapshot may enter when source, audience, and retention policy permit it. The maintained-document system in Aakash Gupta’s interview likewise records the repository revision where guidance is current and archives guidance when it becomes irrelevant.
flowchart LR
parent["Parent worker"] --> candidates["Isolated candidate channel"]
outcomes["Reviewed outcomes"] --> candidates
candidates --> reconcile["Sidecar stages and reconciles claims"]
systems["Authoritative systems"] --> reconcile
current["Projection at immutable commit N"] --> reconcile
reconcile --> review["Responsible review and validation"]
review --> publisher["Trusted publisher identity"]
publisher --> next["Projection at immutable commit N+1"]
next --> retrieval["Pinned, task-sized retrieval"]
retrieval --> parentScheduled refreshes handle known volatility. A parent request can force a freshness check when the current decision depends on newer state. The parent still chooses which routes and slices the work requires. Agents that garden the Git repositories used to bootstrap tasks are an adjacent example of automated repository maintenance.
The publication contract makes failures legible:
| Condition | Curator behavior |
|---|---|
| stale route | mark its last-known revision and retrieve from the live owner before serving it as current |
| contradictory sources | preserve the conflict and route it to the owner whose judgment can resolve it |
| unavailable source | report the source as unavailable and label the prior copy historical |
| excessive context | improve the index and retrieval route; keep the served slice task-sized |
| curation lag | serve the last published revision and report candidate queue status without exposing candidate contents |
| insufficient permission | return an explicit access gap and leave the material with its authoritative owner |
| compromised publication | revoke the trusted reference, quarantine the revision, restore the last-known-good hash, and notify affected parent trajectories |
Fresh-session trials test whether the parent retrieves and applies the new route. Ablation tests whether the context change caused the improvement, and reviewed task outcomes determine whether the change remains published. Track retrieval frequency, repository size, and commit count as operating signals; judge success by task outcomes. The active window receives only the slice needed for the current decision, while durable commits let later trajectories recover the route after compaction.
The sidecar is a harness component with its own behavior. Version its selected model and agent, prompts, tools, and permissions. Record the producing configuration with each publication, and requalify the curation path when that configuration changes.
Pair Each Goal With a Context Curator develops the deployment boundary, projection ownership, and lifecycle.
Use AGENTS.md as a map
A root guide should contain:
- what the repository is and which compatibility surfaces matter;
- the operating loop expected for all work;
- a small set of task classes or golden paths; and
- links to the domain documents, commands, and proof appropriate to each class.
Architecture, dependency posture, generation contracts, runbooks, and domain decisions belong beside the work they govern. Nested guides narrow the route as the worker enters a package or domain. A task-oriented repository maintenance layout can pair that map with human onboarding, durable automation runbooks, and guardrails recovered from project history.
The canonical harness-engineering essay describes a monolithic agent manual that grew too large to be useful. A short root table of contents backed by indexed design documents, product specifications, execution plans, and references made progressive disclosure an owned repository feature. Link and freshness checks kept those routes trustworthy.
Deliver context in three phases
The AI Native DevCon talk develops an operating trajectory in which context arrives during grounding, the messy middle, and review and landing.
Grounding
Begin with a terse map: task class, relevant architecture and decisions, critical journeys, and the commands that establish current state. The worker should understand what it is changing and where to look while preserving routes to deeper sources.
The messy middle
Let code, tool output, test failures, browser state, logs, and diagnostics reveal the next context. Errors should identify the violated invariant and the likely repair. This phase is exploratory; a fixed step list cannot predict every branch.
Review and landing
Reapply role-specific reviewers, acceptance criteria, proof requirements, and delivery policy after the artifact has a stable shape. The outcome bar and critical journeys remain visible from grounding; landing brings their detailed review lenses back to the completed artifact. Compress the trajectory into a decision-ready packet that a person can review directly.
This timing keeps global context small and presents specificity where it can change a decision.
Let the worker discover the next layer
Files, search, ordinary CLIs, --help, and bounded structured output are strong context interfaces because models already know how to explore them. A tool description should state what capability exists and why it might matter. Deeper schemas, examples, or manuals can load after the worker chooses it.
Guidance should set expectations for seeking context: what the worker is doing, why it matters, what kinds of material to seek, and how the available tools expose them. The agent can then reason about the local route as the task and active window change.
Tool output is phase-specific context. Make Capabilities Legible and Operable develops quiet success, bounded results, actionable errors, and repair hints.
In a long Codex trajectory, this placement also affects compaction. High-signal user intent can retain influence while older tool results are summarized or discarded. Surface narrow guidance through repository reads, diagnostics, and tool output at the decision point, then rely on durable routes to retrieve it again. Keep the user message focused on the outcome, acceptance bar, and authority that should survive the whole job. The exact retention policy belongs to the chosen worker and must be requalified when that worker changes.
Place context at the latest reliable point
Every global instruction spends attention and narrows the worker’s choices. Keep judgment in discoverable prose while the agent can retrieve and apply it reliably. Use phase-specific reviewers and checks to present narrower guidance only when the artifact or action makes it relevant.
Repeated misses, consequential risk, or retrieval failure across compactions are evidence that a rule needs stronger placement. Turn Feedback Into Infrastructure owns that promotion decision and the progression from late guidance into durable controls.
Use skills to teach and runbooks to preserve work
A skill teaches an approach to the job. Its description advertises what the skill is and why it might matter, and the full instructions load when the trajectory needs them. Long imperative skills can overfit one path and make the worker refuse sensible exceptions.
Repositories can keep a broad skill library outside the location scanned by the agent. A gitignored linking area can expose a small task-relevant set for one trajectory, allowing many contributors to check in specialized skills without loading all of them for every worker. Teams can still converge on a shared core through repeated use and refinement.
A runbook is a versioned contract for repeatable work. It records intent, preconditions, steps, safety boundaries, evidence, escalation, and rollback. An automation can stay thin by pointing to the repository-owned runbook.
Enabling Codex to Upgrade My Robot Vacuum shows both boundaries in a consequential maintenance job. A scheduled prompt routes to a checked-in automation contract that owns candidate selection and build-only authority. A separate deployment runbook owns canary and production phases. The durable work lives beside the tool and safety boundary, where people and agents can review it.
Garden the routes and the corpus
Context routes have carrying cost. Keep cross-links machine-checkable, record ownership and freshness where readers need them, and replace obsolete routes with a canonical successor or an explicit tombstone.
Test a curated knowledge base in a fresh session to learn whether the worker retrieves the right source and changes its behavior. The presence of a document proves only that it was written. Feedback infrastructure owns ablation and distillation; Run Known Work as a Continuous Loop develops recurring gardening and retirement.