Skip to main content

ai-workflow

ai-workflow is a file-based workflow orchestrator for repositories where AI coding agents such as Codex work through milestones, tasks, ADRs, generated prompts, Git branches, commits, PRs, and sequential handoffs.

It is designed to be installed once and initialized inside any Git repository:

python -m pip install aiw
aiw init

If aiw is installed globally on your machine, bare aiw ... commands remain compatible. Repository-generated examples use uv run aiw ... as the canonical form so the package and project environment are resolved consistently.

Core idea

  • Tool logic lives in the installed Python package.
  • Package entrypoints use clean module paths only: CLI commands use ai_workflow.cli.main, and rendering entrypoints live under focused ai_workflow.rendering.* modules.
  • Project state lives in .ai-workflow.yaml and docs/ai/workspace.
  • JSON state is canonical.
  • Durable handoff Markdown files are repository-owned; runtime Markdown reports and mirrors are generated.
  • One milestone maps to one branch.
  • One task maps to one logical commit.
  • One finished milestone maps to one pull request.
  • AI work is sequential: one active milestone and one active task run through the core execution context.

Quick start

cd my-project
uv run aiw init
uv run aiw doctor
uv run aiw backlog promote BLG-001 --output docs/ai/plan/milestones.md
uv run aiw agent run --lane core --mode queue

Plan With ChatGPT Or Gemini

For a new workpackage, let a general planning model produce the local execution plan before Codex starts coding:

  1. Print the milestone-builder prompt:
uv run aiw agent plan-prompt --target milestones --print
  1. Paste that prompt into ChatGPT or Gemini with the product goal, repository context, screenshots, constraints, or backlog notes.
  2. Paste the returned Markdown into docs/ai/plan/milestones.md. The output must start with # Milestones.
  3. Validate and optionally optimize the local plan:
uv run aiw plan validate docs/ai/plan/milestones.md
uv run aiw plan optimize docs/ai/plan/milestones.md --dry-run
  1. Import or bootstrap it:
uv run aiw plan import docs/ai/plan/milestones.md
uv run aiw agent bootstrap --plan docs/ai/plan/milestones.md --lane core

docs/ai/plan/milestones.md should contain commit-shaped tasks. A commit-shaped task is one logical commit with observable acceptance criteria and clear conflict scopes. Avoid tiny checklist steps such as "add import", "rename variable", "run formatter", or "write one assertion"; merge those details into the nearest reviewable task.

Bad micro-task plan:

# Milestones

## M01 - Parser cleanup

Tasks:
- Add import
  Acceptance: Import exists.
  Conflict: src/parser.py
- Rename helper
  Acceptance: Helper is renamed.
  Conflict: src/parser.py
- Write assertion
  Acceptance: Assertion exists.
  Conflict: tests/test_parser.py

Optimized workpackage-shaped plan:

# Milestones

## M01 - Parser cleanup

Goal: Make parser cleanup reviewable as one implementation slice.

Tasks:
- Consolidate parser cleanup behavior
  Acceptance: Parser uses the renamed helper through the intended import path.
  Acceptance: Parser behavior is covered by focused tests.
  Conflict: src/parser.py, tests/test_parser.py
- Update parser documentation
  Acceptance: Parser docs describe the cleanup behavior.
  Conflict: docs/parser.md

Open the generated prompt:

docs/ai/workspace/prompts/next-core.md

After the AI finishes the task:

uv run aiw agent finish --lane core --task TASK-001 --commit
uv run aiw agent run --lane core --mode queue

When the final task in a milestone passes checks, uv run aiw agent finish --commit attempts automatic milestone closeout:

uv run aiw agent finish --lane core --commit

The closeout flow finishes the milestone, pushes the milestone branch, creates or reuses the PR, checks mergeability when available, merges when safe, regenerates reports, and records exact blockers when push, PR, merge, credentials, branch protection, or cleanup fail.

Important commands

uv run aiw init
uv run aiw doctor
uv run aiw status
uv run aiw report all

uv run aiw backlog promote BLG-001 --output docs/ai/plan/milestones.md
uv run aiw plan import docs/ai/plan/milestones.md
uv run aiw milestone list
uv run aiw agent run --lane core --mode queue
uv run aiw agent finish --lane core --task TASK-001 --commit
uv run aiw git cleanup --dry-run

Repository-owned files

These files are intended to be durable project files:

.ai-workflow.yaml
docs/ai/START_HERE.md
docs/ai/README.md
docs/ai/plan/backlog.md
docs/ai/workspace/adr/*.md
docs/operator/operator.md
docs/operator/codex-agent.md
docs/ai/workspace/active-roadmap.md
docs/ai/workspace/current-status.md
docs/ai/workspace/next-handoff.md

Runtime/generated files

These files are local execution state or generated artifacts and can be regenerated by aiw:

docs/ai/plan/milestones.md
docs/ai/workspace/state/**/*.json
docs/ai/workspace/locks/
docs/ai/workspace/runs/
docs/ai/workspace/tasks/*.md
docs/ai/workspace/milestones/*.md
docs/ai/workspace/prompts/
docs/ai/workspace/reports/*.md
docs/ai/workspace/archive/
docs/ai/workspace/generated-packs/
docs/operator/queue-run.md

docs/ai/plan/milestones.md is a local execution plan. Keep it ignored by default and commit it only by explicit user opt-in; new workpackages can generate a fresh plan starting again at M01.

Development

uv run python -m pytest

Release files for aiw 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiw 0.1.0
File Size Uploaded
aiw-0.1.0.tar.gz 125.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aiw 0.1.0
File Interpreter ABI Platform
aiw-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 228.0 kB

Release files / aiw-0.1.0.tar.gz

Download URL aiw-0.1.0.tar.gz
Size 125.9 kB
Tags Source
SHA-256 checksum
How to use checksums
cf63e27e544560dcdf7adadfdb0a9774fe43338b88e07e21108c5978b98017c9
BLAKE2b-256 checksum
How to use checksums
fe45eac3134b95a89033fbfb5647eb0b545c7bdfda10c582325a4ced76739166
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2026.

Transparency log

Release files / aiw-0.1.0-py3-none-any.whl

Download URL aiw-0.1.0-py3-none-any.whl
Size 102.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7521a251e909d86192de37f2f806f55513d45345a933e83456c765fea78f2de8
BLAKE2b-256 checksum
How to use checksums
691a55881f5311ee928248fb11262274fdcf04f0e6df822c0cfec6ea80f8b7df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page