motte

module
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT

README

motte

motte is a version control store and a set of virtual workspaces for coding agents. It is built on jj.

Status

The store service, the client, the workspace daemon and the jj backend exist. Each item below is described in docs/architecture.md.

  • Native repositories: motte repo create NAME creates one.
  • Git smart HTTP (protocol v2): clone, fetch and push.
  • The jj backend (jj motte) and the workspace daemon motte-vfsd. The daemon runs on Linux.
  • Protected refs. Only a land with a merge grant changes main.
  • The land API: it rebases a change onto the tip, answers 409 for a conflict or a stale expect_tree, and batches lands on one ref.
  • Ref events and subscriptions.
  • Metadata in PostgreSQL or SQLite, and objects in Cloud Storage, S3 or a directory, each behind an interface.
  • The service opens the pack indexes before it answers ready.
  • Per-user tokens and OIDC identities for a person (see Developing).
  • Releases: service and daemon images, and the jj binary for Linux amd64 and arm64.

Run locally

Run motte with no other service: go test ./... runs the tests that need no database, and the section Run locally of docs/architecture.md starts the service on SQLite and a directory. The service serves TLS when MOTTE_TLS_CERT and MOTTE_TLS_KEY are set, and runs behind any reverse proxy or tunnel otherwise.

Read docs/architecture.md for the design. Read AGENTS.md before you change the repository.

The GitHub repository is a read-only mirror. Changes land in the canonical motte repository through ward, which mirrors its branches and tags to GitHub. Pull requests on GitHub cannot merge. Open an issue to propose a change.

Developing

A person needs no identity provider, no workspace box and no tunnel. URL is the address of the deployment and REPO is the repository path.

An administrator who holds an operator grant (MOTTE_TOKEN; motte operator-grant --key KEYFILE --kid KID prints one) issues a token for you:

MOTTE_URL=URL MOTTE_TOKEN=... motte token create --principal you@example.test --scope write --repo native:REPO

The command prints the token once. Git sends it as the password:

git clone https://you:TOKEN@URL/git/REPO.git motte
cd motte
ward check
git switch -c my-change
git push origin my-change
ward land REPO my-change

Clone without --depth: the service does not offer shallow fetches.

motte token list shows the tokens and motte token revoke ID revokes one. motte repo create NAME creates a repository for a token with the scope admin.

ward check runs the checks of .ward/checks.json on your machine. git push writes a branch and never main: only ward land lands a branch on main.

A deployment that trusts an OIDC issuer (MOTTE_OIDC_*) lets you sign in without a token. MOTTE_OIDC_ISSUER=ISSUER MOTTE_OIDC_CLIENT_ID=ID motte login runs the OAuth device flow, which any issuer with device support offers, and saves the token in your configuration directory with mode 0600. git -c http.extraHeader="Authorization: Bearer $(motte login --print)" clone ... uses it. An identity-aware proxy that signs a JWT in its own header, such as Cloudflare Access, is one configuration of the same verifier: set MOTTE_OIDC_HEADER, MOTTE_OIDC_ISSUER, MOTTE_OIDC_AUDIENCE and MOTTE_OIDC_KEYS_URL to its values.

License: MIT. The jj/ crate is Apache-2.0, because it adapts code from jj-lib.

Benchmarking on a host

motte-loadtest bench needs a Linux host with Docker, gcloud and a bucket. It makes none of them. One way to make them:

gcloud iam service-accounts create bench --project P
gcloud storage buckets create gs://B --project P --location us-central1 --uniform-bucket-level-access --public-access-prevention
gcloud storage buckets add-iam-policy-binding gs://B --member=serviceAccount:bench@P.iam.gserviceaccount.com --role=roles/storage.objectAdmin
gcloud compute instances create bench-1 --project P --zone us-central1-a --machine-type n2-standard-16 --image-family debian-12 --image-project debian-cloud --boot-disk-size 200GB --boot-disk-type pd-ssd --service-account bench@P.iam.gserviceaccount.com --scopes storage-rw

Install Docker on the host, copy two builds of motte (static, Linux) and one of motte-loadtest, and run motte-loadtest bench pairs -a motte-old -b motte-new -bucket B -key motte.key -c 64 -n 4 -docker "sudo docker". Delete the host, the bucket and the service account when the measurement ends.

Directories

Path Synopsis
Package api holds the wire types and error codes of the /v1 routes.
Package api holds the wire types and error codes of the /v1 routes.
Package bucket is the object store seam of the store service.
Package bucket is the object store seam of the store service.
buckettest
Package buckettest is the conformance suite of bucket.Store.
Package buckettest is the conformance suite of bucket.Store.
fs
Package fs backs the bucket seam with a directory.
Package fs backs the bucket seam with a directory.
gcs
Package gcs backs the bucket seam with Google Cloud Storage.
Package gcs backs the bucket seam with Google Cloud Storage.
s3
Package s3 backs the bucket seam with an S3-compatible object store: AWS S3, Cloudflare R2 or MinIO.
Package s3 backs the bucket seam with an S3-compatible object store: AWS S3, Cloudflare R2 or MinIO.
Package client is the typed Go client of the motte store and control planes.
Package client is the typed Go client of the motte store and control planes.
cmd
motte command
Command motte is the store service.
Command motte is the store service.
motte-loadtest command
Command motte-loadtest builds a synthetic large repository in a motte service and drives concurrent clients against it.
Command motte-loadtest builds a synthetic large repository in a motte service and drives concurrent clients against it.
motte-vfsd command
Command motte-vfsd is the node daemon of the virtual workspace.
Command motte-vfsd is the node daemon of the virtual workspace.
Package grant signs and verifies the bearer grants of the store.
Package grant signs and verifies the bearer grants of the store.
internal
clock
Package clock aliases the quartz Clock and adds Real, Or and Wait.
Package clock aliases the quartz Clock and adds Real, Or and Wait.
devicelogin
Package devicelogin signs a person in with the OAuth device authorization grant (RFC 8628) against any OIDC issuer, and keeps the token in a file that only the user reads.
Package devicelogin signs a person in with the OAuth device authorization grant (RFC 8628) against any OIDC issuer, and keeps the token in a file that only the user reads.
gitpack
Package gitpack reads git pack files and v2 pack indexes by ranged reads.
Package gitpack reads git pack files and v2 pack indexes by ranged reads.
gitproto
Package gitproto speaks the git smart HTTP protocol over an object reader: ref advertisement, protocol v2 fetch and ls-refs, and the commands and report of receive-pack.
Package gitproto speaks the git smart HTTP protocol over an object reader: ref advertisement, protocol v2 fetch and ls-refs, and the commands and report of receive-pack.
identity
Package identity maps the credential of a request to the claims of a grant.
Package identity maps the credential of a request to the claims of a grant.
identity/identitytest
Package identitytest holds the conformance suite of identity.Authenticator and a signer of Access JWTs.
Package identitytest holds the conformance suite of identity.Authenticator and a signer of Access JWTs.
identity/oidc
Package oidc authenticates a request by a signed OIDC JWT from any issuer, and maps a claim of the JWT to a scope on a repository with rules.
Package oidc authenticates a request by a signed OIDC JWT from any issuer, and maps a claim of the JWT to a scope on a repository with rules.
identity/token
Package token authenticates a request by a signed grant.
Package token authenticates a request by a signed grant.
identity/usertoken
Package usertoken authenticates a request by a per-user token that an administrator issued.
Package usertoken authenticates a request by a per-user token that an administrator issued.
land
Package land rebases a linear range of commits onto the tip of a ref by applying its tree changes, with a file-level conflict check.
Package land rebases a linear range of commits onto the tip of a ref by applying its tree changes, with a file-level conflict check.
leaklint command
Command leaklint fails when a tracked file or a commit message holds a term of the denylist.
Command leaklint fails when a tracked file or a commit message holds a term of the denylist.
linemerge
Package linemerge merges two edits of one text file, made from a common base, by lines.
Package linemerge merges two edits of one text file, made from a common base, by lines.
lint/cmd/lint command
Command lint runs the repository analyzers.
Command lint runs the repository analyzers.
lint/paralleltests
Package paralleltests reports a top-level test that does not call t.Parallel and is not listed in testdata/serial-tests.txt.
Package paralleltests reports a top-level test that does not call t.Parallel and is not listed in testdata/serial-tests.txt.
lint/wallclock
Package wallclock reports time.Sleep and time.After in test files outside a testing/synctest.Test bubble.
Package wallclock reports time.Sleep and time.After in test files outside a testing/synctest.Test bubble.
midx
Package midx is the layered multi-pack index of a repository: one sorted lookup structure over many packs, the manifest that lists the layers of a repository, and the geometric rules that merge layers and compact packs.
Package midx is the layered multi-pack index of a repository: one sorted lookup structure over many packs, the manifest that lists the layers of a repository, and the geometric rules that merge layers and compact packs.
pgtest
Package pgtest gives a test a pool on a private migrated schema.
Package pgtest gives a test a pool on a private migrated schema.
pktline
Package pktline reads and writes the pkt-line framing of the git wire protocols.
Package pktline reads and writes the pkt-line framing of the git wire protocols.
refname
Package refname holds the ref name rule of the store.
Package refname holds the ref name rule of the store.
release/cmd/release command
Command release builds and publishes release artifacts with no CI provider.
Command release builds and publishes release artifacts with no CI provider.
release/publish
Package publish is the seam of the release destination.
Package publish is the seam of the release destination.
release/publish/dir
Package dir publishes release artifacts to a directory, such as a mounted bucket.
Package dir publishes release artifacts to a directory, such as a mounted bucket.
release/publish/github
Package github publishes release artifacts as assets of a GitHub release through the gh CLI.
Package github publishes release artifacts as assets of a GitHub release through the gh CLI.
release/publish/publishtest
Package publishtest is the conformance suite of publish.Publisher.
Package publishtest is the conformance suite of publish.Publisher.
repos
Package repos holds the rules of a repository that the store keeps.
Package repos holds the rules of a repository that the store keeps.
seams
Package seams enforces the provider seam rules of AGENTS.md.
Package seams enforces the provider seam rules of AGENTS.md.
server
Package server is the HTTP surface of the store: the store plane that the node daemon and the jj backend call, and the control plane of the caller.
Package server is the HTTP surface of the store: the store plane that the node daemon and the jj backend call, and the control plane of the caller.
store
Package store keeps the git objects of a repository in packs and the operation objects of a workspace, in one object store.
Package store keeps the git objects of a repository in packs and the operation objects of a workspace, in one object store.
testcount
Package testcount counts the expensive operations that test helpers start and prints the counts of a package at the end of its test run, for internal/testtime to check against testdata/test-time-budget.txt.
Package testcount counts the expensive operations that test helpers start and prints the counts of a package at the end of its test run, for internal/testtime to check against testdata/test-time-budget.txt.
testtime command
Command testtime reads the output of go test -json on standard input, prints the readable test log, and fails when a test or a package is slower than the budget of testdata/test-time-budget.txt.
Command testtime reads the output of go test -json on standard input, prints the readable test log, and fails when a test or a package is slower than the budget of testdata/test-time-budget.txt.
vfs/ctl
Package ctl serves the control protocol of a workspace: one JSON object for each line over a unix socket.
Package ctl serves the control protocol of a workspace: one JSON object for each line over a unix socket.
vfs/lower
Package lower is a lazy read-only file system over one commit of the version control store: the lower layer of a kernel overlay, with the dirty set read from the upper directory.
Package lower is a lazy read-only file system over one commit of the version control store: the lower layer of a kernel overlay, with the dirty set read from the upper directory.
vfs/nodegrant
Package nodegrant mints the node grants of the CSI plugin.
Package nodegrant mints the node grants of the CSI plugin.
vfs/tel
Package tel carries the correlation attributes, spans and log records of the node daemon.
Package tel carries the correlation attributes, spans and log records of the node daemon.
vfs/upperdir
Package upperdir reads the upper directory of the kernel overlay that serves a mount-mode workspace and reports which paths differ from the base tree that the read-only lower layer serves.
Package upperdir reads the upper directory of the kernel overlay that serves a mount-mode workspace and reports which paths differ from the base tree that the read-only lower layer serves.
Package meta is the metadata seam of the store service: repositories, workspaces and their epoch fence, op heads, refs and the pack listing.
Package meta is the metadata seam of the store service: repositories, workspaces and their epoch fence, op heads, refs and the pack listing.
metatest
Package metatest is the conformance suite of meta.Store.
Package metatest is the conformance suite of meta.Store.
postgres
Package postgres is the PostgreSQL backend of meta.Store.
Package postgres is the PostgreSQL backend of meta.Store.
sqlite
Package sqlite is the SQLite backend of meta.Store, for tests and for a service that runs with no other process.
Package sqlite is the SQLite backend of meta.Store, for tests and for a service that runs with no other process.
Package testserver starts a real motte server in the process of a caller's test.
Package testserver starts a real motte server in the process of a caller's test.
Package volume is the contract between a caller's sandbox driver and the node plugin: the volume attributes of a workspace.
Package volume is the contract between a caller's sandbox driver and the node plugin: the volume attributes of a workspace.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL