Inspiration

Working with LLMs has fundamentally changed how I build software, like it has for so many developers. But as context windows have scaled to handle massive conversations and agent runs, there is a new problem. Time and time again, I’d be many tokens deep into a task, then I might need to make a pivot or fix a misassumption. I would end up trapping in what felt like a rigid "waterfall" context model filled with stale noise and dead ends. So I often split down large tasks into multiple scoped sessions (plan, develop, test, review). If ever trying to complete a large task in a single session, results in a waste of time fighting the model's built-up momentum to steer it, experiencing worse and worse performance, before ultimately I clear the session entirely and lose time and progress.

Long AI conversations degrade. Context accumulates assumptions, noise, and dead ends. Expanding context windows let you fit more tokens, but they don't help you organise them. Developers end up clearing memory or restarting sessions to regain coherence and model performance, losing progress. I wanted to make a way to manage your context to achieve lower cost, more steerable, higher performant chats and agentic tasks (without changing the models used).


What it does

Out of Context treats AI working context like code: you can branch to explore an idea without polluting the main thread, commit when you reach a stable checkpoint, diff to see what changed, merge validated outcomes back in, and abandon dead ends without losing the audit trail.

Under the hood, a directed acyclic graph (DAG) of immutable context commits serves as the source of truth. Every branch is a named pointer to a commit. Every agent run receives an explicit context manifest compiled from that branch head.


Core operations

Operation Behaviour
Branch Create an isolated context pointer with only the task-relevant context exposed.
Commit Save an immutable context checkpoint with a message and compact result summary.
Diff Show changes to the effective context: instructions, assumptions, messages, summaries, and artifacts.
Merge Review and selectively promote validated branch outcomes into the target branch.
Abandon Preserve a branch for auditability while closing it to new messages and runs.
Revert Resume work from an earlier clean context commit.
Rebase When upstream premises change, mark affected descendants stale and regenerate from revised context.
Compress Select nodes in a branch and collapse them into a single summarized node to stay under context limits.

Agent Mechanics

Developed using OpenAI agent SDK

The system runs agents through five specialist roles, coordinated by an orchestrator.

  1. Research — Read-only exploration of the workspace. Reads files, lists directories, searches code, and captures findings as structured result snapshots. No shell, network, or write access.
  2. Planning — Takes resolved research snapshots and produces a structured implementation plan: steps, affected paths, validation strategy, risks, and required approvals. Read-only.
  3. Implementation — Executes a resolved plan inside an isolated worktree. Typed tools for file reads, patch application, validation commands, and diff inspection. Requires explicit path scope, command allowlist, and write budget. Validation results and user approval required before merge.
  4. Validation — Runs the plan's validation commands against the implementation output and reports results.
  5. Orchestrator — Sequences the full pipeline, enforces fan-out/depth/token/time budgets, and gates progress at approval checkpoints for destructive or externally visible actions.

Every run stores its parent run, branch, source node, compiled manifest, role, model, budget limits, structured result, and trace reference. Every agent acts through typed application-owned tools.


Key benefits

  • Context stays clean. Isolated branches prevent debug noise, failed attempts, and dead-end reasoning from contaminating the main thread. Only validated results are merged back.
  • Work is auditable. Every branch, commit, run, and result snapshot is persisted. You can inspect exactly which findings informed a decision and replay the chain of evidence.
  • Resumable workflows. Run state is durable. A paused, failed, or cancelled pipeline can be inspected and resumed from the last checkpoint.
  • Compact context. The compress operation and resolved-snapshot composition mean long investigations don't blow out the context window — you pass summaries, not raw transcripts.

How GPT 5.6 Accelerated My Workflow

In developing Out of Context,GPT-5.6 and Codex served as the primary development model. During the initial planning phase, GPT-5.6 accelerated early decisions by exploring the challenge of context pollution into a focused product thesis, defining core primitive operations, narrowing the runtime scope to the OpenAI Agents SDK, and designing an intuitive multi-branch demo strategy.

Transitioning to development, Codex served as the primary development partner within VS Code through a prompt-and-review workflow. It significantly accelerated development by being able to apply full-stack updates (across React, Fastify, TypeScript, and SQLite). Key technical decisions, such as making branching user-invoked rather than model-suggested, treating context compression as auditable state, and decoupling durable graph persistence from future orchestration, were refined iteratively. Codex was able to find and resolve issues ranging from graph-rendering collapses to state-parsing edge cases. It was always able to validating code using TypeScript checks and using a test suite, greatly accelerating the development of this prototype.


Architecture

Web UI (React/Vite)
  └─ HTTP + SSE events
       └─ Fastify API
            ├─ SQLite graph, run, result, and event records (Drizzle ORM)
            ├─ Policy and approval checks
            └─ Worker queue
                 └─ OpenAI Agents SDK runtime
                      ├─ Orchestrator
                      ├─ Research agent
                      ├─ Planning agent
                      ├─ Implementation agent
                      └─ Validation agent

Future Outlook

Transitioning Out of Context from a demo into a context management framework, the goal is to scale to work in complex development environments and large enterprises where it would work together with specialised agent networks.

Built With

Share this project:

Updates