11

Record commits (CI/CD)

Close the loop: when code merges, the commit lands back on the nodes it touched — no manual bookkeeping.

Umtri does not run your jobs or write your code. A small CI step hands the server a commit sha and the list of changed files; the server matches those files against each node’s metadata.implements and appends the commit to the matching nodes’ metadata.commits. The result is a tree where every node shows the real commits that shaped it.

How matching works

When an agent realizes a plan node, it records the files it wrote in metadata.implements (see umtri://rules/plan). record_commit compares each changed file in a commit against those implements entries — a node is credited when one of its files appears in the commit. Nodes with no matching file are left untouched, so unrelated commits never pollute the tree.

GitHub Actions

The repository ships a ready-made workflow at .github/workflows/umtri-record-commit.yml. It runs on every push to main, computes the changed files for the push range, and POSTs them to the record-commit endpoint. It skips silently until you set two things in the repository Settings:

SettingKindValue
UMTRI_PATSecretA write-scope Umtri PAT (used as a Bearer token).
UMTRI_GROUND_SLUGVariableThe ground slug this repo maps to (e.g. umtri).

Add them under Settings → Secrets and variables → Actions, then push to main.

The step calls git diff --name-only BEFORE..SHA (falling back to the single commit on a fresh branch), turns the file list into JSON, and POSTs it. No changed files, or missing secret/var → it exits 0 without calling the API.

Any other CI

The workflow is just a thin wrapper around one HTTP call. From any pipeline that can run curl, do the same:

curl -sS -X POST \
  "https://api.umtri.io/api/projects/<slug>/record-commit" \
  -H "Authorization: Bearer $UMTRI_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "sha": "9f2c1ab",
    "message": "feat(payments): add refund flow",
    "files": ["server/routes/payments.js", "www/src/pages/Refund.jsx"]
  }'

The endpoint is idempotent per sha — re-sending the same commit will not duplicate it on a node. The same call is exposed to MCP clients as the record_commit tool, so an agent can record a commit directly when CI is not wired up.

Scope & safety. The PAT needs the write scope. Store it as a secret, never in committed YAML. Revoke and rotate it from app.umtri.io if it leaks.