Skip to content

ConaryLabs/Lathe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lathe

A declarative build system for AI-assisted development. Lathe reads pass definitions from your project, computes an optimized execution DAG based on dependencies and file-scope conflicts, and outputs phased plans that Claude Code (or any AI coding tool) executes.

Lathe is the build system. Claude Code is the compiler.

.lathe/passes/*.md  ->  lathe plan  ->  DAG (JSON + ASCII)  ->  /lathe:run  ->  Claude executes
     (config)          (Rust CLI)      (deterministic)        (plugin)        (AI does work)

Quick Start

As a Claude Code plugin (recommended)

claude plugin install lathe

The plugin auto-installs the binary on first use. Then ask Claude:

"Set up lathe for my project"

That's it. Claude reads the plugin's built-in guide and handles everything — creating passes, configuring the pipeline, and running it.

From source

git clone https://github.com/ConaryLabs/Lathe.git
cd Lathe
cargo build --release
# Binary at target/release/lathe

Standalone CLI

lathe init          # Scaffold .lathe/ directory with example passes
lathe plan          # Show the execution plan
lathe validate      # Check for errors
lathe list          # List all passes

What Lathe Does

Lathe's job Claude Code's job
What passes exist Spawning agents
What order they run in Worktree isolation
What file scopes they're limited to Actually writing code
Whether gates pass File-locking
Tracking metrics Context management
Showing the plan before execution Tool execution

How It Works

1. Define passes

Each pass is a markdown file with YAML frontmatter:

---
name: security-audit
description: Review code for OWASP Top 10 vulnerabilities
reads:
  - "src/**"
writes:
  - "docs/security-report.md"
depends_on:
  - implementation
gate: true
---

Review all source files for security vulnerabilities.
Focus on SQL injection, XSS, and auth flaws.
Output findings to docs/security-report.md.

2. Lathe builds the DAG

$ lathe plan

Pipeline: my-project (5 passes)

Phase 1 ----------
  analysis          reads: src/**  writes: docs/plan.md

Phase 2 ----------
  implementation    reads: docs/plan.md, src/**  writes: src/**

Phase 3 (parallel, 2 passes) ----------
  security-audit    reads: src/**  writes: docs/security-report.md
  tests             reads: src/**  writes: tests/**

Phase 4 ----------
  review [gate]     reads: src/**, tests/**  writes: -

Critical path: analysis -> implementation -> tests -> review
Parallel speedup: 1.25x over sequential

Lathe computes ordering from three sources:

  • Explicit dependenciesdepends_on declarations
  • Implicit read-write — if pass A writes src/** and pass B reads src/**, B runs after A
  • Write conflicts — overlapping write scopes are sequenced automatically

3. Claude executes

Run /lathe:run in Claude Code. It validates, shows the plan, and executes phase by phase — spawning parallel subagents where possible, enforcing write scopes, and pausing at gates for your approval.

Key Features

  • Automatic parallelization — passes with no conflicts run concurrently
  • Write-scope enforcement — a PreToolUse hook blocks writes outside declared scope
  • Conditional passes — only run when relevant files have changed (when.files_changed)
  • Gated passes — pause for human approval before continuing
  • Model routing — assign different models to different passes (model: claude-sonnet-4-6)
  • Resume support — pick up where a failed run left off (lathe plan --resume)
  • Tag filtering — run subsets of the pipeline (lathe plan --tags review)
  • Shared pass libraries — import passes from shared directories (extends)

Pass Definition

Field Required Description
name yes Unique identifier (kebab-case)
description yes What this pass does
reads no Glob patterns for readable files
writes no Glob patterns for writable files
depends_on no Passes that must complete first
tags no Labels for filtering
gate no Pause for approval after completion
model no Suggested model for execution
when no Conditional execution (files_changed globs)

Pipeline Configuration

.lathe/pipeline.toml:

[pipeline]
name = "my-project"
parallel_limit = 4          # Max concurrent passes
default_gate = false         # Gate all passes by default

extends = [                  # Import shared passes
  "~/shared-passes/reviews"
]

CLI Reference

Command Purpose
lathe init Scaffold .lathe/ directory
lathe plan ASCII execution plan
lathe plan --json Machine-readable JSON
lathe plan --mermaid Mermaid flowchart diagram
lathe plan --tags X,Y Filter by tags
lathe plan --from X Plan from pass X forward
lathe plan --all Ignore when conditions
lathe plan --resume Skip completed passes
lathe validate Check for errors
lathe list Show all passes
lathe stats Run history and metrics
lathe scope-check Check file against write scope

Documentation

  • Complete Guide — Full reference for passes, pipelines, DAG mechanics, recipes, and troubleshooting
  • Design Document — Architecture and rationale

License

MIT

About

A declarative build system for AI-assisted development. Computes optimized execution DAGs from pass definitions with dependency and file-scope conflict analysis.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors