Skip to main content

autocontext control plane for iterative strategy evolution.

Project description

autocontext

autocontext is a control plane for improving agent behavior over repeated runs. It combines multi-agent candidate generation, staged validation, scenario execution, knowledge accumulation, optional local distillation, and OpenClaw-facing APIs.

Working Directory

Run the commands in this README from the autocontext/ directory. The Python package, CLI entrypoint, tests, migrations, and dashboard assets all live here.

What It Does

  • Runs iterative generation loops against game scenarios and agent-task scenarios
  • Persists playbooks, hints, tools, reports, and snapshots across runs
  • Supports staged validation, harness synthesis, and harness-aware routing
  • Exports training data and runs autoresearch-style local training loops
  • Exposes evaluation, validation, artifact, and discovery operations over MCP and HTTP

Quick Start

From the repo root:

cd autocontext
uv venv
source .venv/bin/activate
uv sync --group dev

Use the repo-level .env.example as the reference for available AUTOCONTEXT_* settings.

Run a deterministic local scenario:

AUTOCONTEXT_AGENT_PROVIDER=deterministic \
uv run autoctx run --scenario grid_ctf --gens 3 --run-id quickstart

Run with Anthropic:

AUTOCONTEXT_AGENT_PROVIDER=anthropic \
AUTOCONTEXT_ANTHROPIC_API_KEY=... \
uv run autoctx run --scenario grid_ctf --gens 3

Start the API server and dashboard:

uv run autoctx serve --host 127.0.0.1 --port 8000

Open http://127.0.0.1:8000 after the server starts.

Start the MCP server:

uv sync --group dev --extra mcp
uv run autoctx mcp-serve

Main CLI Commands

uv run autoctx run --scenario grid_ctf --gens 3
uv run autoctx list
uv run autoctx status <run_id>
uv run autoctx replay <run_id> --generation 1
uv run autoctx benchmark --scenario grid_ctf --runs 5
uv run autoctx serve --host 127.0.0.1 --port 8000
uv run autoctx mcp-serve

Useful variants:

AUTOCONTEXT_AGENT_PROVIDER=anthropic AUTOCONTEXT_ANTHROPIC_API_KEY=... \
uv run autoctx run --scenario grid_ctf --gens 3

AUTOCONTEXT_AGENT_PROVIDER=deterministic AUTOCONTEXT_RLM_ENABLED=true \
uv run autoctx run --scenario grid_ctf --gens 3

Training Workflow

Export JSONL training data from completed runs:

uv run autoctx export-training-data \
  --scenario grid_ctf \
  --all-runs \
  --output training/grid_ctf.jsonl

Launch the autoresearch-style training loop:

uv sync --group dev --extra mlx
uv run autoctx train \
  --scenario grid_ctf \
  --data training/grid_ctf.jsonl \
  --time-budget 300

MLX training is host-only. It must run on an Apple Silicon macOS machine with Metal access. It will not run correctly inside a Docker sandbox on macOS.

If you only want to inspect generated training data first, export without training and open the JSONL directly.

For host setup details and OpenClaw automation via a file-based watcher bridge, see docs/mlx-training.md.

Configuration

Configuration is loaded from AUTOCONTEXT_* environment variables in src/autocontext/config/settings.py.

Common settings:

  • AUTOCONTEXT_AGENT_PROVIDER
  • AUTOCONTEXT_EXECUTOR_MODE
  • AUTOCONTEXT_MODEL_COMPETITOR
  • AUTOCONTEXT_MATCHES_PER_GENERATION
  • AUTOCONTEXT_MAX_RETRIES
  • AUTOCONTEXT_JUDGE_PROVIDER
  • AUTOCONTEXT_RLM_ENABLED
  • AUTOCONTEXT_HARNESS_PREFLIGHT_ENABLED
  • AUTOCONTEXT_STAGED_VALIDATION_ENABLED

See the repo-level .env.example for a working starting point.

Repository Structure

autocontext/
  src/autocontext/   Python package
  tests/             Pytest suite
  dashboard/         Static dashboard assets
  docs/              Package-specific documentation
  migrations/        SQLite migrations
ts/                  TypeScript package
tui/                 Interactive terminal UI
infra/               Docker, Fly.io, bootstrap scripts

Validation and Development

uv run ruff check src tests
uv run mypy src
uv run pytest

If you change protocol messages, regenerate the derived protocol artifacts from the repo root:

cd ..
uv run --directory autocontext python scripts/generate_protocol.py

OpenClaw / ClawHub

autocontext exposes:

  • artifact contracts for harnesses, policies, and distilled models
  • REST and MCP operations for evaluate, validate, publish, import, and discover
  • ClawHub skill manifests and scenario discovery metadata
  • an adapter layer for running OpenClaw agents inside the harness

Additional Docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoctx-0.1.1.tar.gz (782.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autoctx-0.1.1-py3-none-any.whl (434.1 kB view details)

Uploaded Python 3

File details

Details for the file autoctx-0.1.1.tar.gz.

File metadata

  • Download URL: autoctx-0.1.1.tar.gz
  • Upload date:
  • Size: 782.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for autoctx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 10076472869b61cf2089ac2031ddfb8d2596459d658f0f05b2040c588e31f49b
MD5 9b21237de444b1d1339cebf436e15e04
BLAKE2b-256 aeb071fe1060c5f580c2484aa4e60c819176c7177ff13858a39383f9a35279d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for autoctx-0.1.1.tar.gz:

Publisher: publish.yml on greyhaven-ai/autocontext

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autoctx-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: autoctx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 434.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for autoctx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b80be83a3c470c7f914949947e7a77ffe8770f07b52af050427bcc434da960d4
MD5 48bacc787e8ab3c1314f713058537989
BLAKE2b-256 c3463a08dd05eba211611d71ec88afcc9ff3334ad332b44d2a04a49a6a9c80bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for autoctx-0.1.1-py3-none-any.whl:

Publisher: publish.yml on greyhaven-ai/autocontext

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page