Skip to main content

Main Command

codemachine [options]
Launches the interactive TUI when run without subcommands.
Cannot run from home directory. Use --dir or cd into a project first.

Global Options

FlagDescriptionDefault
-d, --dir <path>Target workspace directoryCurrent directory
--spec <path>Path to planning specification file.codemachine/inputs/specifications.md
-V, --versionDisplay version-
-h, --helpDisplay help-

Commands

version

codemachine version
Display CLI version.

run

codemachine run <script>
Run agent(s) with enhanced syntax.

Options

FlagDescriptionDefault
-d, --dir <directory>Working directoryCurrent directory
The run command uses the default engine (first authenticated engine).

Script Syntax

# Runs the code-generator agent with the prompt "Build login feature"
codemachine run "code-generator 'Build login feature'"

Agent Options

Agent options are specified in brackets after the agent name:
OptionDescriptionExample
input:<file>Single input fileagent[input:spec.md]
input:<file1>;<file2>Multiple input filesagent[input:a.md;b.md]
tail:<n>Tail lines to includeagent[tail:100]

templates

codemachine templates
Interactive workflow template selection. Saves selection to .codemachine/template.json and regenerates agents folder.
codemachine templates list
List available template names (non-interactive).

auth

codemachine auth login
Authenticate with an AI engine (interactive provider selection).
codemachine auth logout
Sign out from an AI engine (interactive provider selection).

agents

codemachine agents
List all active and offline agents in tree view.
codemachine agents logs <id>
View logs for a specific agent by numeric ID.
codemachine agents export
Export agent registry to .codemachine/logs/registry-export.json.

import

codemachine import [source]
Import external workflow packages.

Options

FlagDescription
-l, --listList installed imports
-r, --removeRemove an import
-v, --verboseVerbose output

Source Formats

FormatExample
Package namecodemachine-pack-rust
GitHub owner/repomoazbuilds/codemachine-pack-rust
GitHub URLhttps://github.com/user/repo
Git SSH[email protected]:user/repo.git
Local path/path/to/folder or ./relative

Examples

codemachine import moazbuilds/pack-rust
codemachine import ./my-pack
codemachine import --list
codemachine import --remove pack-rust

export

codemachine export
Show the imports folder path.

mcp router

codemachine mcp router
Start MCP router server (stdio mode). This command is for internal agent use only.

Environment Variables

VariableDescriptionDefault
LOG_LEVELLog level: debug, info, warn, errorinfo

Engine Configuration

VariableDescription
CODEMACHINE_CLAUDE_HOMEClaude configuration directory
CODEMACHINE_ANTHROPIC_BASE_URLCustom API base URL
CODEMACHINE_ANTHROPIC_AUTH_TOKENAnthropic auth token
CODEMACHINE_ANTHROPIC_API_KEYAnthropic API key
CODEMACHINE_CLAUDE_OAUTH_TOKENClaude Code OAuth token

Examples

DEBUG=1 codemachine

Quick Reference

CommandDescription
codemachineLaunch TUI
codemachine versionShow version
codemachine run <script>Run agents
codemachine templatesSelect template
codemachine templates listList templates
codemachine auth loginLogin
codemachine auth logoutLogout
codemachine agentsList agents
codemachine agents logs <id>View agent logs
codemachine agents exportExport registry
codemachine import <source>Install package
codemachine import --listList imports
codemachine import --remove <name>Remove import
codemachine exportShow imports path
codemachine mcp routerStart MCP server