# autocontext

> A recursive self-improving agent harness that runs LLM agents through structured scenarios, evaluates outputs, and accumulates validated knowledge so repeated runs get better over time.

autocontext is an open-source recursive self-improving harness for LLM agents that closes the loop between execution, evaluation, and knowledge accumulation. Instead of starting every agent run cold, autocontext persists what worked — traces, playbooks, artifacts, and distilled models — so each subsequent run builds on validated prior success. It supports Python and TypeScript surfaces, multiple LLM providers, and a structured multi-agent loop with roles for proposing, analyzing, coaching, and curating knowledge.

- **Scenario Families**: *11 reusable scenario families (game, agent_task, simulation, investigation, workflow, negotiation, coordination, and more) executable in both Python and TypeScript.*
- **Multi-Agent Loop**: *A structured internal loop with competitor, analyst, coach, architect, and curator roles that propose, evaluate, and gate knowledge persistence.*
- **Persistent Knowledge**: *Validated playbooks, hints, tools, reports, and progress snapshots accumulate across runs rather than being discarded.*
- **Multiple Surfaces**: *Access via CLI (`autoctx`), REST API server, MCP server, TypeScript/TUI operator surfaces, and external agent integration.*
- **Provider Routing**: *Supports Anthropic, OpenAI-compatible endpoints, Gemini, Mistral, Groq, OpenRouter, Azure OpenAI, MLX (Apple Silicon), Pi, and deterministic testing backends.*
- **Frontier-to-Local Distillation**: *Export stable training data and distill it into cheaper local runtimes using MLX on Apple Silicon.*
- **Replay and Analysis**: *Inspect, compare, and replay runs, simulations, investigations, and missions to understand regressions and stable wins.*
- **Notification Hooks**: *Route notifications via Slack, HTTP webhooks, stdout, or composite routing using `AUTOCONTEXT_NOTIFY_*` env vars.*
- **Quick Start**: *Install via `pip install autocontext` or `npm install autoctx`, then run `autoctx solve --description "your task" --gens 3` to hand the harness a plain-language task and let it iterate.*

## Features
- Recursive self-improving agent harness
- 11 reusable scenario families
- Structured multi-agent loop (competitor, analyst, coach, architect, curator)
- Persistent playbooks, hints, and knowledge across runs
- Staged validation and harness-aware execution
- Replays, checkpoints, and exported artifacts
- Frontier-to-local distillation with MLX on Apple Silicon
- CLI, API server, MCP, and TypeScript/TUI surfaces
- Multi-provider LLM routing (Anthropic, OpenAI-compatible, Gemini, Mistral, Groq, OpenRouter, Azure, MLX, Pi)
- Notification hooks via Slack, HTTP webhooks, stdout
- Export training data for downstream systems
- Verifier-driven missions with checkpoints and completion criteria
- Campaign coordination for multi-mission workflows
- V8 isolate codegen for secure TypeScript execution
- Subprocess-based executors for Python with SSH and sandboxed options

## Integrations
Anthropic Claude, OpenAI, Gemini, Mistral, Groq, OpenRouter, Azure OpenAI, MLX, Pi, Claude CLI, Codex CLI, Hermes CLI, vLLM, Ollama, Slack, PrimeIntellect, MCP (Model Context Protocol), OpenClaw

## Platforms
MACOS, LINUX, API, DEVELOPER_SDK, CLI

## Pricing
Open Source

## Version
0.4.3

## Links
- Website: https://github.com/greyhaven-ai/autocontext
- Documentation: https://github.com/greyhaven-ai/autocontext/blob/main/docs/README.md
- Repository: https://github.com/greyhaven-ai/autocontext
- EveryDev.ai: https://www.everydev.ai/tools/autocontext
