Metadata-Version: 2.4
Name: kanso-runner
Version: 0.1.0
Summary: Let a coding agent work your Kanso implementation plans step by step, one pull request per step
Keywords: ai-agents,claude-code,codex,planning,kanso,automation
Author: datenwissenschaften
Author-email: datenwissenschaften <martin.franke@datenwissenschaften.com>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development
Classifier: Typing :: Typed
Requires-Python: >=3.12, <4.0
Project-URL: Repository, https://github.com/datenwissenschaften/kanso
Project-URL: Used by, https://github.com/datenwissenschaften/retro-speedlab-suite
Description-Content-Type: text/markdown

# kanso-runner

**Let a coding agent work through your plan, one reviewed pull request per step.**

Kanso asks agents to write a plan before risky work: `docs/<task>-implementation-plan.md`, with numbered steps that each name their next action. `kanso-runner` turns that plan into a queue. It reads the plans on your main branch, picks the next open step, and gives your agent the exact prompt for that one step. The agent implements it, removes it from the plan in the same commit, and opens a pull request. Once CI is green, the next step follows.

- **One step, one pull request.** Every change stays small enough to review and to revert.
- **The plan is the state.** Finished steps leave the plan in the same commit, so no step is worked twice.
- **You stay in charge.** Steps tagged `(owner)` are never picked. You can name a plan to go first, and a plan whose step failed waits until you restart it.

## Used in production by RetroSpeedLab

[RetroSpeedLab](https://www.retrospeedlab.com) is a game studio run by AI agents ([suite](https://github.com/datenwissenschaften/retro-speedlab-suite)). Its maintainer agent works the suite's [implementation plans](https://github.com/datenwissenschaften/retro-speedlab-suite/tree/main/docs) with `kanso-runner`, one step per session, and the owner steers it from Discord with `work on suite`, `pause plans` and `resume plans`.

```markdown
## Open work, in order

1. **Typed backend:** pyright excludes the backend. Next action: TypedDicts for the Twitch payloads.
2. (owner) **Old repos:** delete the archived repos after 7 days.
```

```console
$ kanso-runner next --repository . --ref main
{"plan": "suite", "path": "docs/suite-implementation-plan.md", "step": "1. **Typed backend:** …", "prompt": "Work on the implementation plan …"}
```

## How it picks

1. Only `## Steps` and `## Open work` hold work; notes under `## Open` are never picked.
2. A plan with a `## Design` but no steps is first split into steps.
3. The plan you named goes first, then the plan in work, then the oldest plan by the commit that added it.
4. `kanso-runner next` exits with code 3 when nothing is open.

## Use it

```bash
uvx kanso-runner next --repository . --ref main --current suite --stopped music-ab
```

From Python, as RetroSpeedLab's maintainer does:

```python
from kanso_runner.plans import Progress, chosen, read_plans, request

found = chosen(read_plans(mirror, "main"), Progress(first=None, current="suite", stopped=[]))
if found is not None:
    run_agent_session(request(*found))
```

## Development

```bash
cd runner && uv sync && uv run ruff check && uv run mypy && uv run pytest
```

MIT © datenwissenschaften. Part of [Kanso](https://github.com/datenwissenschaften/kanso).
