Skip to content

Claude Code's human-free attempt at an agent-native VCS

License

Notifications You must be signed in to change notification settings

re-cinq/patchwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patchwork

Agent-native version control. Built from scratch for AI agents editing code simultaneously.

Patchwork replaces Git's snapshot-and-merge model with an append-only operation log, composable views, and a built-in speculative submit queue. It is designed for the scenario where dozens of automated agents are modifying the same codebase in parallel, and the system itself keeps everything coherent.

Why not Git?

Concept Git Patchwork
Unit of change Commit (tree snapshot) Operation (single file op)
Grouping Branch Change (with versions)
Workspace Working directory + checkout View (composable projection)
History DAG of commits Append-only operation log
Collaboration Clone + merge Shared server, real-time events
CI External (GitHub Actions etc.) Built-in submit queue
Conflict detection At merge time Continuous, during materialization

Key ideas

  • Operations, not commits. Every file-level edit is recorded immediately in a shared, append-only log. Total ordering means no merge ambiguity.
  • Changes with versions. Work is organized into changes (like PRs) with numbered versions, not branches that drift apart.
  • Composable views. Each agent sees main + their changes + optionally other agents' changes, with real-time conflict detection.
  • Speculative submit queue. Changes are tested in parallel, Zuul-style. If A, B, C, D are queued, all four test simultaneously -- each assuming the ones before it pass.

Quick start

# Build
go build -o patchwork ./cmd/patchwork

# Initialize a repository
./patchwork init

# Create a change and start working
./patchwork change create "my-feature"
./patchwork workspace create my-feature ./workspace

# Edit files in ./workspace, then capture changes
./patchwork workspace scan ws-my-feature
./patchwork version create my-feature "ready for review"

# Submit to the queue
./patchwork submit my-feature

# Start the API server (HTTP + gRPC)
./patchwork serve --addr :8080 --grpc-addr :9090

Documentation

Document Audience What it covers
Overview Anyone What Patchwork is, the problems it solves, key concepts in plain English
Technical Guide Senior engineers Architecture, data model, code examples, API reference, CLI reference
Architecture System architects Algorithms, SQL schemas, complexity analysis, data flow, invariants

API

Patchwork exposes two API transports, both backed by the same server:

  • REST on :8080 -- JSON over HTTP, SSE for event streaming
  • gRPC on :9090 -- Protobuf, server streaming for events

Proto definition: proto/patchwork/v1/patchwork.proto

Go client libraries:

  • HTTP: github.com/re-cinq/patchwork/pkg/client
  • gRPC: github.com/re-cinq/patchwork/pkg/grpcclient

Project structure

cmd/patchwork/       CLI entry point
pkg/
  api/               REST/HTTP API handler
  grpcapi/           gRPC API server
  grpcclient/        gRPC Go client
  client/            HTTP Go client
  server/            Core server, submit queue, rebase
  log/               Append-only operation log (SQLite)
  blob/              Content-addressed blob store
  change/            Change lifecycle management
  view/              View materialization engine
  diff/              Diff and 3-way merge
  events/            Event bus (pub/sub)
  workspace/         Filesystem-synced workspaces
  gitbridge/         Git compatibility layer
  config/            Persistent configuration
  types/             Core type definitions
proto/               Protobuf service definition
gen/                 Generated protobuf/gRPC code
docs/                Documentation

Tests

go test ./...

146 tests across 14 packages.

License

AINAL v2.0

About

Claude Code's human-free attempt at an agent-native VCS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages