Skip to main content

Millrace runtime rewrite baseline package

Project description

Millrace

A governed runtime for long-running agent work that needs durable state, staged execution, and recovery-aware operation.

PyPI Python 3.11+ License

Millrace is not a replacement for Codex, Claude Code, Aider, or similar raw agent harnesses. It is the runtime layer you put around them when the work is too long-running, stateful, or recovery-sensitive to trust to a single session.

Millrace is designed to be operated by a dedicated ops agent. The raw harness still does the local stage work. Millrace owns the queue, compiled plan, stage progression, runtime state, and persisted audit trail around that work.

Why Millrace Exists

Raw harnesses are excellent at bounded sessions:

  • implement a feature
  • fix a bug
  • review a diff
  • work a short plan in one sitting

Millrace starts where that model stops being enough.

Use it when the job needs to:

  • survive pauses, crashes, or context loss
  • move through explicit execution or planning stages
  • perform a final compiler-governed parity check before declaring completion
  • preserve durable queue and runtime state on disk
  • route failures into recovery work instead of just exiting
  • leave behind persisted run artifacts that an operator can inspect later

How Millrace Fits With Raw Harnesses

Think of the split this way:

  • the raw harness reasons, edits code, and emits a stage result
  • Millrace compiles the active mode and loops into a frozen plan
  • Millrace decides which stage runs next, which work item is active, and what to persist after each handoff
  • the ops agent chooses when work enters the runtime and how the workspace is configured

Millrace should be used in conjunction with raw harnesses, not instead of them. If a direct Codex or Claude Code session is enough, use the direct session.

When To Use Millrace

Use Millrace when:

  • the work will outlast a single agent session
  • you want explicit stage gates instead of "the agent said it is done"
  • recovery and resumability matter
  • you need run history, diagnostics, and durable state under <workspace>/millrace-agents/
  • a dedicated ops agent is available to operate the runtime intentionally

Do not use Millrace when:

  • the task is small and bounded
  • the work is exploratory and governance adds more overhead than value
  • single-session throughput matters more than persistence and recovery
  • no ops agent is available to manage intake, configuration, and runtime state

60-Second Proof

Install:

pip install millrace-ai

Then point Millrace at a workspace:

export WORKSPACE=/absolute/path/to/your/workspace

millrace compile validate --workspace "$WORKSPACE"
millrace run once --workspace "$WORKSPACE"
millrace status --workspace "$WORKSPACE"

That flow proves three important things quickly:

  • Millrace can bootstrap its workspace contract under millrace-agents/
  • the selected mode and loops compile into a frozen plan
  • the shipped standard_plain mode freezes completion behavior into that plan
  • the runtime can execute one deterministic tick and report persisted status

What Millrace Governs

Millrace is a real runtime, not a thin wrapper script. The current shipped core includes:

  • a compile step that freezes mode and loop assets into a persisted run plan
  • separate execution and planning loops
  • compiler-driven backlog-drain behavior that can dispatch arbiter
  • typed stage terminals rather than prose-only handoff semantics
  • file-backed runtime state and queue artifacts under millrace-agents/
  • persisted run artifacts for inspection and troubleshooting
  • runner dispatch that invokes a raw harness through a defined adapter contract

The runtime is packaged as millrace_ai. Source lives under src/millrace_ai/ and the tests mirror those domains under tests/.

Docs And Skills

If you are an agent reading this README, load docs/skills/millrace-ops-agent-manual/SKILL.md first before operating Millrace.

Primary docs:

  • docs/skills/millrace-ops-agent-manual/SKILL.md
  • docs/runtime/README.md
  • docs/runtime/millrace-arbiter-and-completion-behavior.md
  • docs/runtime/millrace-cli-reference.md
  • docs/runtime/millrace-compiler-and-frozen-plans.md
  • docs/runtime/millrace-modes-and-loops.md
  • docs/runtime/millrace-loop-authoring.md
  • docs/runtime/millrace-runner-architecture.md
  • docs/runtime/millrace-runtime-error-codes.md
  • docs/source-package-map.md

Use the CLI reference for the full command inventory. Use the compiler and loop docs when you need to understand or extend the runtime contract rather than just operate it.

Default Permission Posture

Millrace intentionally ships with maximum Codex permissions as the default workspace posture.

The default resolution order is:

  1. runners.codex.permission_by_stage
  2. runners.codex.permission_by_model
  3. runners.codex.permission_default

New workspaces are bootstrapped with permission_default = "maximum" explicitly written into millrace-agents/millrace.toml.

Existing workspace configs are preserved on bootstrap/update. If an operator has already customized Codex permission settings, Millrace does not overwrite those choices when a newer runtime version is deployed.

Verification

Authoritative local verification commands:

uv run --extra dev python -m pytest -q
uv run --with ruff ruff check src/millrace_ai tests
uv run --with mypy mypy src/millrace_ai

Status

Millrace is close to the v1.0.0 baseline, but it is still stabilizing its public documentation and some surrounding release surfaces. If you depend on a specific behavior, pin to a patch version instead of assuming the latest build is identical.

The formal CHANGELOG.md is staged for the v1.0.0 cut; until then, the changelog format is being prepared outside the package repo so the eventual move is mechanical rather than improvised.

License

See LICENSE.

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

millrace_ai-0.12.1.tar.gz (147.5 kB view details)

Uploaded Source

Built Distribution

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

millrace_ai-0.12.1-py3-none-any.whl (207.2 kB view details)

Uploaded Python 3

File details

Details for the file millrace_ai-0.12.1.tar.gz.

File metadata

  • Download URL: millrace_ai-0.12.1.tar.gz
  • Upload date:
  • Size: 147.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for millrace_ai-0.12.1.tar.gz
Algorithm Hash digest
SHA256 341c748bf081ef6f886a506e659d28d9ac809ec2e06807031c5eca0e7b364437
MD5 1b5ea1ee1d6a89c524560b42271309b2
BLAKE2b-256 912fa56908e8a2cd533c277679d0bc6261ec9802951b4abbf540932b7304a3eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for millrace_ai-0.12.1.tar.gz:

Publisher: publish-to-pypi.yml on tim-osterhus/millrace

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

File details

Details for the file millrace_ai-0.12.1-py3-none-any.whl.

File metadata

  • Download URL: millrace_ai-0.12.1-py3-none-any.whl
  • Upload date:
  • Size: 207.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for millrace_ai-0.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b440bb8a2b6a5d03f0d75bd32c314d0b6dbf622ae4605c73e0fca95b28ad8c4b
MD5 9245a7ec31ac2d944e3740100c746b81
BLAKE2b-256 a6a0b649fb58c68fb7315eca244b7fb9e69b99f62e55499bb71556561566967c

See more details on using hashes here.

Provenance

The following attestation bundles were made for millrace_ai-0.12.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on tim-osterhus/millrace

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