# CodeMachine

> A CLI that turns the way you drive Claude Code, Codex and other coding agents into a reusable multi-agent workflow you can run again on any project

- Category: AI Coding / Coding-Agent Harnesses & Runtimes
- Language: TypeScript
- Licence: Apache-2.0
- Repository: https://github.com/moazbuilds/CodeMachine-CLI
- Website: https://codemachine.co/
- Canonical page: https://ai-tldr.dev/tools/codemachine/
- Updated: 2026-02-02

## In short

CodeMachine is an open-source command-line tool that orchestrates AI coding agents into repeatable, long-running workflows. It sits in the Coding-Agent Harnesses & Runtimes category of the AI Coding tools and is open-source, written in TypeScript and licensed Apache-2.0. To get started: install the CLI.

## Overview

CodeMachine is an open-source command-line tool that orchestrates AI coding agents into repeatable, long-running workflows. Its starting point is that every session with a coding agent already follows a process — reproduce, analyse, plan, implement, test for a bug; research, design, code, review for a feature — but that process lives in your head and gets rebuilt from scratch each time. CodeMachine lets you capture it once as a workflow and run it again on the next project.

It does not ship its own model or agent. It is an orchestration layer over the coding CLIs you already use: it spawns each engine through the headless scripting mode that engine documents for automation, passes the arguments and flags, and handles execution, context passing and coordination between steps. The documentation lists Claude Code, Claude Code Router, Codex, OpenCode, Cursor, Mistral Vibe and Auggie CLI as engines, and each agent in a workflow can be pinned to its own engine, model and reasoning effort — so one step can plan on one engine while another implements on a different one.

A workflow is a sequence of agent steps that pass context forward. Around that core sit modules (agents that loop until a goal is met), sub-agents a main agent delegates to, tracks (selectable variants such as a quick path and a thorough one), condition groups that switch steps on or off, and an optional controller agent that gathers requirements in conversation before automation starts. The same workflow can run fully interactive, fully autonomous with the controller driving agents on your behalf, continuous with no interaction, or a hybrid of those. Execution history is kept in a local SQLite registry, workflows can pause mid-run and resume later, and workflow packages can be imported from GitHub to share them across a team. A default Ali Workflow Builder workflow helps you create your first one interactively. Written in TypeScript, Apache-2.0.

## What it does

- Orchestrates existing coding CLIs — Claude Code, Claude Code Router, Codex, OpenCode, Cursor, Mistral Vibe and Auggie CLI — through their official headless automation modes
- Per-agent engine, model and reasoning-effort settings in config/main.agents.js, so different steps can use different engines
- Four orchestration patterns: interactive, autonomous (a controller agent runs the steps), continuous auto-advance, and hybrid
- Parallel (&) and sequential (&&) agent runs from one command with codemachine run, including file inputs to an agent
- Workflow building blocks: looping modules, sub-agents, tracks, condition groups, separators and an optional specification brief
- Long-running execution with pause/resume, plus a local SQLite registry of each agent run's engine, model, timing, status and token usage
- Shareable workflow packages installed with codemachine import owner/repo, and a terminal UI showing what each agent is doing

## Getting started

You need Node.js with npm (bun, pnpm or yarn also work) and at least one supported AI engine CLI you can sign in to, such as Claude Code, Codex or OpenCode.

1. Install the CLI

   The package installs two equivalent commands, codemachine and cm.

```bash
npm install -g codemachine
```

2. Launch the interactive session

   Run it inside the project you want to work on; -d points it at another workspace directory.

```bash
codemachine
```

3. Sign in to your engines

   Inside the session, authenticate each AI engine your workflow uses (codemachine auth login does the same from the shell).

```text
/login
```

4. Pick a workflow and start it

   Choose a template — the default is the Ali Workflow Builder, which helps you design your own workflow — then start it. Workflows with tracks or conditions ask a few onboarding questions first.

```text
/templates
/start
```

5. Run agents directly from the shell

   codemachine run executes named agents without the TUI: & runs them in parallel, && in sequence.

```bash
codemachine run "code-generator 'Build login feature'"
codemachine run "frontend 'UI' & backend 'API'"
codemachine run "db 'setup' && backend 'models'"
```

6. Assign engines and models per agent

   Agents are declared in config/main.agents.js; set engine (claude, ccr, codex, opencode, cursor, mistral or auggie) and optionally model. With only engine set, that engine's default model is used.

```js
export const mainAgents = {
  'my-code-generator': {
    id: 'my-code-generator',
    promptPath: 'agents/code-generator/main.prompt.md',
    engine: 'claude',
    model: 'opus',
  },
};
```

7. Import a shared workflow package

```bash
codemachine import moazbuilds/pack-rust
codemachine import --list
```

## When to use it

- Encode your team's bug-fix or feature process once and run it the same way on every repository instead of re-prompting an agent step by step
- Split a task across engines — plan with one coding CLI, implement with another, review with a third — without copying context between them by hand
- Leave a multi-hour, multi-step build running autonomously and resume it after a pause or a crash
- Share a proven workflow with colleagues as an importable package rather than a wiki page of prompts

## Version history

- 2026-02-02 v0.8.0: Nova beta release: an autonomous mode where controller agents run whole workflows, mid-run pause/resume with crash recovery, MCP-based agent coordination, tracks and conditions, an import system for shareable workflows, and a rebuilt terminal UI.
- 2025-11-22 v0.7.0: Moved the runtime from Node.js to Bun, replaced the terminal UI with OpenTUI, swapped the JSON agent registry for SQLite, and added Auggie CLI as an engine.
