Introduction
autocontext is a recursive self-improving harness that helps agents succeed on any task.
autocontext turns a goal written in plain language into something an agent can actually get better at. You point it at an objective, it works the problem against real evaluation, keeps what worked, discards what did not, and writes down what it learned. The next run (and the next agent) inherits that knowledge automatically.
Instead of a single prompt and a single answer, you get a loop: propose, evaluate, learn, repeat. Every run leaves behind a trace of what happened, the artifacts it produced, a playbook of durable lessons, and optionally a distilled model. That accumulated context is the product.
The loop in one paragraph
A run advances in generations. Five specialized roles divide the work: a competitor proposes a strategy, an analyst explains why it scored the way it did, a coach updates the playbook, an architect proposes new tooling, and a curator decides what is worth keeping. Strategies are scored by real evaluation (an LLM judge for open-ended tasks, tournament play with Elo for games). Weak changes roll back; strong ones persist as knowledge that carries across runs. Read the full picture in core concepts.
Try it in 30 seconds
AUTOCONTEXT_AGENT_PROVIDER=pi AUTOCONTEXT_PI_COMMAND=pi \
autoctx solve "improve customer-support replies for billing disputes" --iterations 3AUTOCONTEXT_AGENT_PROVIDER=pi \
bunx autoctx solve "improve customer-support replies for billing disputes" --iterations 5 --jsonPi is the zero-config path: no API key plumbing. autocontext also runs against Anthropic, OpenAI, local models, and other agent CLIs. See providers.
What's New in 0.17.0
The 0.17.0 release aligns the Python and TypeScript core packages around stronger evidence contracts and adds a Python-first production path for governed context promotion, durable campaigns, isolated research execution, and accelerator-aware evaluation.
Outcome-Gated Context Bundles
Immutable candidates now move through matched screening, adaptive confirmation, held-out evaluation, false-promotion control, causal attribution, and atomic activation while rejected evidence remains available for scoped retesting.
Capability-Scoped Execution
Generated research code can run in a locked-down Docker workspace, remote scenarios ship as verified content-addressed packages, and trusted-local execution remains an explicit operator choice rather than a fallback.
Durable Campaign Operations
Restart-safe scheduling, leases, heartbeats, cancellation, bounded reuse, campaign auditing, and a paid-result outbox make long-running local and remote evaluation inspectable, accountable, and recoverable without duplicate provider execution.
Correctness-First Kernel Evolution
Protected workers, fresh confirmation, finite-sample promotion gates, autonomous model-backed campaigns, and three-family transfer studies expose regressions, specialists, plateaus, and generalizing champions without averaging failures away.
Capability-Validated Accelerators
Prime requests bind immutable images, accelerator type/count, region, telemetry, idempotency, and resolved hardware identity; unsupported or drifting configurations fail before paid candidate execution.
Stronger Learning Evidence Across Runtimes
Python and TypeScript share context-bundle, attribution, and negative-result contracts, while Python training adds replayable adaptive confirmation and minimum-effect promotion artifacts.
Install Python autocontext==0.17.0 or npm autoctx@0.17.0; npm still
requires Node.js 22.19.0 or newer. The separately versioned
pi-autocontext@0.10.0 extension still declares autoctx@^0.15.0, which
accepts 0.15.x but excludes 0.16.x and 0.17.x. A separate global
autoctx@0.17.0 installation does not replace the extension's nested SDK.
Live context promotion and paid accelerator execution are opt-in and fail closed when authority, identity, telemetry, or capability checks are not satisfied. TypeScript shares the portable bundle and evidence contracts; the live promotion coordinator, campaign scheduler and auditor, research executor, and kernel-evolution runtime are Python-only in this release.
0.16 Release Highlights
The 0.16.1 release aligned the Python and TypeScript core packages on a versioned automation contract and stabilized the TypeScript-first operator TUI, image-delivery path, and live runtime-composition system introduced in npm 0.16.0.
Predictable CLI Automation
The shared paved road leads with solve, run, status, watch, show, and export; versioned JSON and NDJSON envelopes keep scripts consistent across runtimes.
pi-tui Operator Client
The TypeScript runtime provides a replayable alternate-screen client for local or remote operation, with plans, progress, receipts, run inspection, and cooperative control.
Safer Interactive Control
The 0.16.1 hotfix scopes state to each run, redacts terminal and credential data, secures remote attach, bounds WebSocket resources, and validates complete non-animated images.
Live Runtime Composition
TypeScript components can declare capabilities and effects, reconcile through a typed graph, and activate or roll back through durable transactions.
The paved-road CLI adopted --iterations and standardized status, show, and watch --ndjson for automation. Python exposed its full catalog with autoctx commands --all, while npm used autoctx --help --all. show rejects conflicting selectors instead of guessing; export defaults to JSON on stdout and supports pi-package. CLI contract v2 ships with versioned schemas and fixtures, while ratcheted dependency boundaries retain compatibility re-exports for older module paths.
0.15 Release Highlights
Provider-Aware Model Routing
Both runtimes separate endpoint hosting from model capability through AUTOCONTEXT_PROVIDER_HOSTING and related declarations. Python also preflights configured endpoints before spending generation tokens.
Structured Roles and Deep Thinking
Both provider contracts support bounded deep_think collection. Python constrains three role outputs and offers AUTOCONTEXT_CONSTRAINED_OUTPUT=false; TypeScript constrains analyst and coach only on its OpenAI-compatible path.
Offline Execution With Clear Boundaries
Python can enforce zero engine-initiated egress with AUTOCONTEXT_OFFLINE=1. TypeScript refuses that mode until equivalent enforcement exists, rather than claiming unsupported parity.
Correct Judge Score Recovery
Both engines now prefer the designated answer over scratchpad drafts, preventing a reasoning-block score such as 0.05 from replacing the judge's final 0.88.
Current Model Defaults
Unset slots move to Claude Opus 5, Claude Sonnet 5, and the GPT-5.6 family, with corrected cost attribution and provider-specific automatic tiers.
Recent capabilities
Portable Skills for Any Agent Host
Use autoctx skills list and autoctx skills export to emit focused autocontext-creator or autocontext-consumer SKILL.md instructions without host-specific guidance.
Evaluator epochs
Content-addressed evaluator identity prevents scores from different rubrics, judge providers, or judge models from being compared as if they shared one scale.
Ambient resident trainer
An opt-in, charter-governed daemon ingests traces, curates datasets, trains and evaluates candidates, and promotes models within explicit budgets.
Training at scale
Packaged Apple-silicon and Linux/CUDA workflows cover MLX, TRL, OPD, GRPO, scale profiles, and evaluator-aware training exports.
How autocontext is different
Prompt optimization is a special case of what autocontext does. autocontext takes a goal, generates or selects an evaluable scenario, runs a multi-role loop, and produces transferable artifacts the next run inherits.
| Tool | Primary shape | Difference from autocontext |
|---|---|---|
| DSPy | Prompt optimizer | Optimizes prompts against a metric. autocontext can generate the scenario and verifier, run the loop, and gate changes across generations. |
| Inspect | Evaluation framework | Runs evaluations. autocontext runs them in a loop and persists what survives as reusable knowledge. |
| TextGrad | Gradient-style textual feedback | Backprops textual feedback into prompts. autocontext keeps artifacts, datasets, and distilled knowledge, not just better prompts. |
| autocontext | Self-improving harness | Plain-language goal → scenario → multi-role loop with verifier-driven gating → playbooks, datasets, and optional distilled local models the next agent inherits. |
Repeated runs should get better, not just different. The durable product is the accumulated context: traces, artifacts, playbooks, lessons, and exported knowledge packages.
What it can evaluate
Scenario families are the reusable shapes autocontext can generate, run, score, and learn from. They are not the only surface—you can also run prompt-centric tasks, missions, simulations, and production traces—but they show the breadth of what the harness knows how to evaluate.
| Family | Evaluation | What it tests |
|---|---|---|
game | Tournament + Elo | Turn-based strategy, including built-ins such as grid_ctf and othello. |
agent_task | LLM judge | Prompt-centric tasks with evaluate-and-improve loops. |
simulation | Trace evaluation | Action traces with mock environments and fault injection. |
artifact_editing | Artifact validation | File, config, and schema edits with diff tracking. |
investigation | Evidence chains | Diagnosis accuracy, source use, and red-herring detection. |
workflow | Workflow evaluation | Transactional flows with compensation and retry behavior. |
negotiation | Negotiation evaluation | Hidden preferences, BATNA handling, and opponent modeling. |
schema_evolution | Schema adaptation | Mid-run state changes and stale-context detection. |
tool_fragility | Drift adaptation | APIs and tools that drift; strategies must adapt to changed behavior. |
operator_loop | Judgment evaluation | Escalation, clarification, and operator handoff judgment. |
coordination | Coordination evaluation | Multi-agent handoff, merge behavior, and duplicate-work avoidance. |
Read scenarios, tasks, missions, campaigns for the canonical object model, or solve & run for the CLI workflow.
Bring your own providers, runtimes, and executors
No API keys are required to start. The Pi runtime runs locally and handles its own auth; local providers and deterministic runs need no hosted key. Hosted APIs, remote sandboxes, and per-role model overrides are opt-in through environment variables.
Model providers
Shared hosted, local, and offline backends plus runtime-specific TypeScript selectors and Python MLX and Agent SDK paths.
Agent runtimes
Claude CLI, Codex, Hermes, Pi, and Pi RPC let autocontext delegate calls to an installed agent runtime that authenticates itself.
Executors
Local subprocesses, SSH, Monty, PrimeIntellect, and the reserved Gondolin microVM boundary for stronger isolation.
| Layer | Options | Notes |
|---|---|---|
| Shared model/API backends | anthropic, openai, openai-compatible, ollama, vllm, deterministic | Available in both runtimes. |
| Runtime-specific model backends | Python: mlx, agent_sdk; TypeScript: gemini, mistral, groq, openrouter, azure-openai | The hermes selector also differs by runtime: Python invokes the Hermes CLI; TypeScript targets an OpenAI-compatible Hermes gateway. |
| Agent runtimes | pi, pi-rpc, claude-cli, codex; Python also supports the Hermes CLI | The CLI owns auth; autocontext holds no key. Pi is the recommended zero-config path. |
| Executors | local, ssh, monty, primeintellect; gondolin reserved | Execution isolation is configured separately from the model provider. Use sandbox modes for the full reference. |
Drive it from your agent
The CLI is the documented default. Any agent that can run shell can drive autocontext directly. Many operational commands offer --json; those payloads go to stdout, diagnostics go to stderr, and exit code 0 means success.
autoctx solve "resolve unpaid invoice disputes from contracts and email history" --json
autoctx status <run_id> --json
autoctx export <run_id> --jsonUse MCP when your host wants typed tool discovery instead of shell commands. Install the Python MCP extra and start the server with the canonical autoctx serve mcp command; the host discovers the available catalog and exact runtime-specific tool names. The older mcp-serve spelling remains a hidden compatibility alias.
uv tool install 'autocontext[mcp]==0.17.0'
autoctx serve mcpAgent integration
Choose between a CLI-backed skill and the MCP tool catalog.
MCP tools
The Python and TypeScript tool surfaces exposed over stdio.
Command reference
Runtime-qualified command surfaces and representative flags for scripting.
Pick your track
These docs serve three kinds of reader. Start wherever you are.
CLI practitioners
Run solve and run, wire providers through environment variables, and read the traces and artifacts each run leaves behind.
Agent integrators
Wire autocontext into Claude Code, Pi, Hermes, or any MCP client so your agent can solve, judge, and improve on demand.
SDK embedders
Import the Python package or the TypeScript library and drive the loop directly from your own code.
Detailed technical tables
When you need exact names, defaults, and contracts, jump into the technical reference pages:
Environment variables
Provider selectors, roots, queue settings, sandbox controls, and tracing configuration.
Glossary
Short definitions for scenarios, runs, generations, knowledge, roles, evaluation, and artifacts.
Contracts
CLI, app settings, websocket protocol, browser exploration, and concept-model schemas.
Stay current
Follow the changelog for public website, documentation, LLM-readable docs, and launch-facing product milestones.
Next steps
New here? Go to get started and run your first solve, then read your first solve to understand the output.