MetaMach is a durable AI Software Factory OS β a bare-metal safety harness and execution engine that orchestrates autonomous AI agents (Claude Code, Codex, Aider, etc.) inside survivable engineering workflows with checkpoints, Human-in-the-Loop (HITL) approval gates, and sandboxed execution.
| Dependency | Requirement | Purpose |
|---|---|---|
| Rust | 1.88+ (Edition 2024) | Required β compiles MetaMach binaries |
| PostgreSQL | 16+ (host-native, no Docker) | Required β durable state machine & task queue |
| tmux | 3.3+ | Required β isolated PTY session engine |
| Herdr | 0.7.3+ | Optional β terminal TUI dashboard (herdr-janus) |
Note: MetaMach runs 100% standalone via
janusCLI and Web Studio (janus studio). Herdr is an optional plugin host if you want a terminal overlay.
git clone https://github.com/hughguan/MetaMach.git
cd MetaMach
make bootstrap # One command: checks prereqs, compiles binaries, initializes host PGcd my-project
janus init # Scaffolds .janus/, auto-starts daemon, validates & registers
janus start # Runs the workflow with checkpointing & safety gatesFor quick single-command executions without a TOML workflow file:
janus start --inline "cargo test" # Auto-generates a transient single-step workflowEvery project managed by MetaMach follows a simple 7-verb lifecycle:
init β plan β dry-run β start β monitor β harvest β offboard
| Step | Command | Description |
|---|---|---|
| init | janus init |
Scaffold .janus/, validate blueprint, register project database with daemon |
| plan | janus plan --description "..." |
Generate or edit a workflow definition (.janus/workflows/*.toml) |
| dry-run | janus start --dry-run |
Preview execution plan & DAG topology without running commands |
| start | janus start |
Execute workflow with automatic step checkpointing & tool reconciliation |
| monitor | janus status / stop / continue |
Check real-time progress, pause, or resume interrupted workflows |
| harvest | janus harvest list / apply |
Inspect and apply outputs from sandboxed execution tasks |
| offboard | janus offboard --blueprint <name> |
Archive audit log, generate production report, purge transient runtime data |
LLM-Assisted Planning: Generate a workflow directly from natural language:
janus plan --blueprint my-project --description "Build Rust binary, run test suite, deploy"
MetaMach uses a unified Workflow DSL (.janus/workflows/<name>.toml) supporting both linear sequential steps and multi-node DAG workflows.
# .janus/workflows/ci.toml
[workflow]
name = "ci"
description = "Build and test suite"
[[steps]]
name = "build"
agent = "builder"
command = "cargo build --release"
[[steps]]
name = "test"
agent = "tester"
command = "cargo test"
max_correction_attempts = 3 # re-dispatches with error context on failure# .janus/workflows/parallel_ci.toml
[workflow]
name = "parallel_ci"
description = "Run linter and tests concurrently after build"
[[nodes]]
id = "build"
workflow = "wf_build"
[[nodes]]
id = "lint"
needs = ["build"]
steps = [{ name = "clippy", command = "cargo clippy" }]
[[nodes]]
id = "test"
needs = ["build"]
steps = [{ name = "cargo_test", command = "cargo test" }]Nodes can declare sandbox isolation (runs in an isolated Git worktree) and allowed write paths:
# .janus/workflows/fullstack_iot.toml
[workflow]
name = "fullstack_iot"
description = "Parallel web build and firmware flashing"
[[nodes]]
id = "build_web_ui"
isolation = "sandbox" # runs in an isolated Git worktree & sandbox tmux
writes = ["apps/web/dist/"] # whitelist: post-execution guard flags writes outside this directory
steps = [{ name = "install", command = "bun install && bun run build" }]
[[nodes]]
id = "flash_esp32"
isolation = "bare_metal" # host-native, janush-protected physical execution
needs = ["build_web_ui"]
steps = [{ name = "flash", command = "esptool.py write_flash 0x0 target/firmware.bin" }]janus status # Snapshot active task status
janus status --json # Machine-readable output
janus stop --blueprint my-project # Pause active tasks for a project
janus continue --blueprint my-project # Resume paused or interrupted tasks from last checkpointLaunch the interactive web observer sidecar:
janus studio # Starts Web Studio at http://127.0.0.1:8444
janus studio -d # Launch detached in the background- π¨ Visual DAG Canvas: Drag-and-drop workflow editor and execution plan graph.
- π‘ Real-Time Stream: Live WebSocket observer streaming step state transitions.
- π‘οΈ HITL Web Interlocks: One-click human-in-the-loop approval center for high-risk operations.
Review and apply outputs from sandboxed steps without risking main workspace contamination:
janus harvest list # List all harvested sandbox refs
janus harvest apply --ref-name refs/sandbox/<id>-<step> # Apply approved sandbox output to working directory βββββββββββββββββββββββββββββββββββββββββββ
CLI Agent (Claude Code / Codex / Pi / ...)
βββββββββββββββββββββββββββββββββββββββββββ
β
β spawns on user command
βΌ
ββββββββββββββββββββββββββββββββ
β janush (Proxy Shell) β
β β’ Tool Guard reconciliation β
β β’ 30s fail-closed timeout β
β β’ 16KB streaming truncation β
ββββββββββββββββ¬ββββββββββββββββ
β UDS (Unix Domain Socket)
βΌ
ββββββββββββββββββββββββββββββββββββββββββββ
β janus-daemon (MM-CORE) β
β β’ Master state machine & UDS router β
β β’ Workflow engine & durable checkpoints β
β β’ DAG engine (topological sort) β
β β’ HITL Gateway & Webhooks β
β β’ Cold-start resume & self-healing β
ββββ¬ββββββββββββββ¬ββββββββββββββ¬βββββββββββ
β β β
ββββββββββ β ββββββββββββ
βΌ βΌ βΌ
βββββββββββββββββββββββ βββββββββββββββββββββ ββββββββββββββββββββββββ
β janus::tmux β β PostgreSQL β β janus::gateway β
β β’ tmux -L mm-tmux β β β’ catalog DB β β β’ HITL dispatch β
β β’ remain-on-exit β β β’ per-blueprint DBβ β β’ Webhook ingress β
β β’ SSH reverse tunnelβ β β’ SQLite fallback β β β’ HMAC verification β
ββββββββββββββββββββββββ βββββββββββββββββββββ ββββββββββββββββββββββββ
β² β²
β (reattach view) β UDS proxying
ββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ
β herdr-janus (TUI) β β janus-studio (Web Observer) β
β β’ Terminal dashboardβ β β’ Visual DAG Canvas Editor β
ββββββββββββββββββββββββ β β’ Real-Time WS Streamer β
ββββββββββββββββββββββββββββββββ
TL;DR:
janus-daemonowns all state in PostgreSQL whilejanushinterceptively checks every agent command before bare-metal execution. Decoupled Web Studio sidecar runs onhttp://127.0.0.1:8444.
metamach/
βββ docs/ # Technical specifications & ADR index
βββ janus/ # Core Rust workspace (~14,100 LOC)
β βββ src/bin/ # 5 Binaries: janus, janus-daemon, herdr-janus, janush, janus-studio
β βββ src/ # Engine modules (absurd, tmux, tool_guard, gateway, cognitive, workflow)
β βββ tests/ # Integration test suite (9 files, 206 tests)
βββ templates/ # Default templates for `janus init`
β βββ blueprint.toml # Default blueprint recipe
β βββ agents/ # architecture.toml, builder.toml, tester.toml
β βββ workflows/ # 15 workflow templates (linear + DAG)
βββ Makefile # Bootstrap, database setup, health check
my-project/
βββ .janus/ # Project-specific MetaMach configuration
β βββ blueprint.toml # Project recipe & default workflow selection
β βββ agents/ # Agent role overrides (architect, builder, tester)
β β βββ architecture.toml
β β βββ builder.toml
β β βββ tester.toml
β βββ workflows/ # Project workflows (linear + DAG)
β β βββ wf_architect_design.toml
β β βββ wf_builder_implement.toml
β β βββ req2spec.toml
β β βββ spec2software.toml
β βββ openwiki/ # RAG knowledge scope & production reports
βββ src/ # Your project source code
- π‘οΈ Safety First: Fail-closed 30s timeouts, post-execution file write whitelisting, sandboxed Git worktree isolation, and human approval gates for high-risk operations.
- βοΈ Uncompromising Stability: Daemon-owned state machine, transactional PostgreSQL checkpoints with SQLite fallback, and automatic cold-start task recovery.
- π Pure Decoupling: Agent-agnostic integration with any CLI tool, decoupled Web Studio sidecar, and host-native execution without container overhead.
The authoritative technical specifications live under docs/:
- PRD.md β Product Requirements & Persona Specifications
- ARCH.md β High-Level Architecture & Component Topology
- ADR.md β Architecture Decision Records Index (36 Decision Records)
- SPEC.md β Technical Contracts, Test Catalog & Deployment Matrix
- PLAN.md β Execution Roadmap & Milestone History
Daemon not reachable (janus-daemon)
If janus commands report janus-daemon not reachable, start the resident background daemon:
janus daemon # Launch daemon in foreground (Ctrl+C to stop)
make health # Verify daemon socket & PG connectionPostgreSQL database connection issues
MetaMach uses a host-native PostgreSQL instance (no Docker). If the database is down or uninitialized:
make db-init # Initialize PG cluster at ~/.metamach/db/ & run catalog migrationsIs MetaMach a replacement for Docker or CI runners?
No. MetaMach is an AI Software Factory OS designed to safely host autonomous AI coding agents on local or remote dev machines with hardware access, strong checkpoints, and human approval gates.
- 206 Workspace Tests: 100% passing (140 unit tests + 66 integration tests across 9 files).
- CI Gates: Every commit passes
cargo fmt,cargo clippy -D warnings, andcargo test --workspace. - Pre-Push Hook:
./scripts/pre-pushauto-provisions local PostgreSQL and validates E2E workflow dispatches.
MIT β see LICENSE.