motor / amp

Get this repository

amp clone https://gauss.motor.dev/motor/amp

Amp

Amp is a distributed version control system built for parallel coding agents. Humans can use it too, though it's designed around agent workflows. It's a Go fork of Pijul based on Pijul's patch theory: a channel is a set of changes, not a linear history. Changes recorded in parallel commute, so you can apply them in any order and get the same result. Conflicts are part of the data model too: a conflict is just a file state that a later change resolves, and that resolution travels like any other change.

Install

curl -fsSL https://gauss.motor.dev/motor/amp/artifacts/install.sh | sh

install.sh requires curl or wget and openssl. It verifies the downloaded binary against the release's signed manifest before installing.

Agents should run amp learn and read its output before using Amp.

You can also install the CLI with Go (or import Amp as a Go module): go install gauss.motor.dev/motor/amp/cmd/amp@latest.

To build from source: amp clone https://gauss.motor.dev/motor/amp, then go build -o amp ./cmd/amp.

Quick start

amp init                       # create a repository on channel main
echo hello > hello.txt         # create files with ordinary tools
amp status                     # new, modified, moved, and deleted files
amp record -m "Add hello"      # record a change; no `add` step
amp log

Each recorded change stores its author: an agent name, a model, and optionally the human it's working for. These come from amp record flags, workspace defaults (amp workspace identity), or Amp's config (amp config). A harness can also pass per-process config via $AMP_CONFIG_FILE.

Amp doesn't verify attribution, and naming a human doesn't mean they reviewed or approved the change.

Amp automatically tracks every file not excluded by .gitignore. Binary files and text files of 10 MiB or more are stored as object files: changes record only their SHA-256 digest and size, and clones and pulls download only the versions they actually write (see objects.min_bytes and objects.line_diff in amp config). Create, move, and delete files normally; Amp detects moves on its own. Use amp track to force-track an ignored file, and amp untrack to stop tracking a file without deleting it.

Parallel agents

Give each agent its own workspace. A workspace is a working directory on its own channel that shares the repository's change storage:

# Keep workspaces in a single ignored directory.
echo "workspaces/" >> .gitignore
# Create a channel `task-42`, forked from the current channel.
amp workspace add workspaces/task-42
# Do some work.
cd workspaces/task-42 && ...edit... && amp record -m "Fix the parser"
# Pull task-42's changes along with their dependencies.
cd .. && amp pull task-42

New workspaces are populated from a cache of rendered states. On APFS and Linux filesystems with reflinks (Btrfs, XFS), files share disk blocks with the cache until an agent modifies them.

Applying a change is idempotent, and changes from different workspaces commute, so agents can pull each other's work in any order. Unrecorded edits survive amp pull. If two agents edit the same lines, Amp writes conflict markers to the files and amp conflicts lists them. Editing the markers and recording a change resolves the conflict for every channel that applies it.

See docs/agents.md for the full workflow.

Commands

Every command accepts --json for machine-readable output.

Command What it does
init, clone Create a repository or clone a remote one
status, diff Show unrecorded changes (using the same selection as record)
record -m <msg> [-- paths] Record changes across the workspace, or only for the given paths
log, change <hash>, credit <file> Inspect history
apply <hash or file> Apply changes along with their dependencies
unrecord <hash> [--reset] Remove changes from the channel
revert <hash> Record a new change that undoes an earlier one
reset [-- paths] Discard unrecorded edits
track, untrack Override automatic tracking
conflicts List conflicts in the workspace
channel list/new/rename/delete/switch Manage channels
workspace add/list/remove Manage workspaces
workspace identity Show or update workspace authorship
maintenance cache status/prune/verify Inspect, prune, and verify the workspace snapshot cache
maintenance gc Remove unreferenced change metadata and old pristine files, and pack change files
maintenance objects status/prune Check which object versions the default remote keeps and prune local copies (they re-download on demand)
tag create/list/show/delete Name exact sets of changes
object cat/status/fetch Read object file versions and download missing ones
export Write a recorded state's files into a new directory
remote add/list/remove, push, pull Sync with other repositories
serve Serve repositories over HTTP
learn Print the agent guide and full command reference
update [--check] Install the latest Amp release
import git <source>, import map <commit> Import Git history

Documentation

  • docs/agents.md: how agents use Amp (printed by amp learn).
  • docs/design.md: the data model, core algorithms, and differences from Pijul.
  • docs/storage.md: how pristine storage and multi-process coordination work.
  • docs/protocol.md: the HTTP protocol used by amp serve.

Development

go test ./...
scripts/package VERSION OUT_DIR    # build a release: gzipped binaries for each target and manifest.json

License

Amp is licensed under the GNU General Public License, version 3 or (at your option) any later version; see LICENSE. It is derived from Pijul; see NOTICE. Run amp licenses to print Amp's license and third-party licenses.