Introduction

Patchwork is a scripting language designed to make developing AI-powered automation easy. It combines deterministic code execution with LLM reasoning through a unique feature called think blocks.

var task = "Review this code for security issues"
var files = $(find src -name "*.rs")

var analysis = think {
    The user wants to: ${task}

    Review these files for common security vulnerabilities:
    ${files}
}

print(analysis)

Patchwork uses the Agent/Client Protocol to bring a shell-like scripting experience directly to popular coding agents.

What Makes Patchwork Different?

Most LLM integrations treat AI as an API call—you send a prompt, get a response, and that's it. Patchwork treats LLM reasoning as a first-class language construct:

  • Think blocks pause execution, consult an LLM, and return a value
  • Shell integration as convenient as traditional shells but designed for portability (TODO)
  • Structured agents can delegate work to sub-agents with defined skills (TODO)
  • Deterministic execution means your code runs the same way every time—only LLM responses vary

Installation

Patchwork runs inside your IDE's AI assistant. This guide covers setup for Zed with Claude Code.

Prerequisites

You'll need:

  • Rust (for installing Patchwork tools)
  • Node.js (for Claude Code)

Install the Tools

Install the Patchwork runtime and conductor:

cargo install sacp-conductor patchwork-acp

This adds two executables to your Cargo bin directory (typically ~/.cargo/bin/).

Configure Zed

Open your Zed settings file at ~/.config/zed/settings.json and add the agent_servers configuration:

{
  "agent_servers": {
    "Patchwork": {
      "default_mode": "bypassPermissions",
      "command": "/Users/yourname/.cargo/bin/sacp-conductor",
      "args": [
        "--debug",
        "agent",
        "/Users/yourname/.cargo/bin/patchwork-acp",
        "npx -y '@zed-industries/claude-code-acp'"
      ],
      "env": {}
    }
  }
}

Note: Replace /Users/yourname with your actual home directory. You can find the correct path with which sacp-conductor.

Start a Session

  1. Reload Zed (or restart it)
  2. Open the Agent Panel
  3. Click the + button
  4. Choose Patchwork from the menu

You're ready to start agentic scripting with Patchwork!

first program

Coming soon.

values

Coming soon.

functions

Coming soon.

control flow

Coming soon.

think ulocks

Coming soon.

shell

Coming soon.

workers

Coming soon.

traits

Coming soon.

modules

Coming soon.