jig-harness/jig
Reference · Protocol

The Jig Protocol

Jig’s parts agree on a few closed lists and shapes: the way a drive reports how it ended, the records Jig writes, the labels and hidden comment markers it reads, the commands a repository supplies. Programs outside Jig’s skills read them too: a dashboard, a workspace app, a repository’s own scripts, another agent harness. The Jig Protocol is the one statement of each such contract, one chapter per contract, written for a reader that acts on the values without reading Jig’s code.

You can trust a chapter because it is not written by hand where it matters. Its values, and the meaning of each, are generated from the tables Jig’s own code reads, and Jig’s build fails when a chapter and the code disagree. Only the explanation around them is prose. Each chapter carries its own version and says whether it is:

  • stable: within one version it only grows. A value is never removed or given another meaning (a withdrawn value stays listed as a tombstone), and a field is never removed, retyped or made required. A change that breaks this raises the chapter’s version, and the release notes say what a reader must change.
  • provisional: it states what the code does in the release that ships it, and names the plan items that may still change it.

Each chapter’s values are also in a JSON file under data/, with the chapter’s version, status and a description of each field, for a program in any language. These files describe the plugin release they ship in.

A field’s comparedAs says what a stable chapter promises, within one version, about the field on a value the chapter lists and that holds it, null included. An exact field keeps its content. A prose field may be reworded, but what it states stays stated and a null stays null. A names field, a comma-separated list, may gain a name and never loses one, in any order. A carriers field lists what carries a value, each with always or sometimes: what always carried it still does, a carrier already named elsewhere in the field joins or leaves only as sometimes, and a new one, such as a new kind of line, may join as always. An optional field a value does not hold may appear on it.

JSON documents also have draft 2020-12 JSON Schemas in schemas/. Their $id identifies the owning chapter and its version. The descriptions that generate them also supply the readers’ field checks and TypeScript types. Tests validate records from the writers with an independent schema validator. Marker lines that carry text rather than JSON have no schema.

These schemas describe structural acceptance. Calendar-time validity, relationships between fields (such as a record’s pull-request number and its envelope key), repository-specific names and author trust are checked by the readers too. Optional telemetry that a reader ignores or normalizes when unusable remains permissive in its schema. Passing a schema never authorizes an action.

Earlier versions are withdrawn

The site publishes each chapter’s data file and schemas at addresses that carry its version (/protocol/<chapter>/v<version>/data.json and /protocol/<chapter>/v<version>/schemas/<filename>.json), for the chapter’s current version only. When a chapter’s version is raised, the previous version’s addresses are withdrawn: from the site’s first deploy after the change reaches Jig’s main branch they answer not found. None redirects to the new version, whose shape a reader of the old one does not read.

The release notes tell you to move: the change that raises a chapter’s version is marked Breaking:, names the chapter’s file and says what a reader must change. The notes come with the release that follows that change, so the old addresses are withdrawn without advance notice. The chapter’s page and the table below show the current version. To stay on an earlier version for a while, keep your own copy of its files: the plugin release you installed carries them in its protocol/ folder, and Jig’s repository holds them at each release’s tag. Load a schema from that copy rather than from its $id, which is withdrawn with the rest.

Chapters

ChapterWhat it coversVersionStatusData file
Drive end states and exit codesHow a drive, or one round of it, ended: each state and the exit code drive-status.ts and drive.ts report it with.2stabledata/drive-exits.json
The drive mailboxWhat a person or a tool may tell a running drive, and how the drive answers: the messages, directives and acknowledgements in a working tree’s mailbox files.1stabledata/mailbox.json
Pull-request labels Jig writes and readsThe labels that show where a pull request’s drive or follow-up stands, and the labels a person adds to tell the dispatcher what to do with it.1stabledata/pr-labels.json
Hidden comment markers on the forge and the trackerThe hidden markers Jig writes and reads in comments and bodies on the forge and the tracker: what record each marks, who writes it, its version and what it means.5stabledata/comment-markers.json
Commands a repository suppliesThe settings whose value is a command Jig runs: what each command is given, what it answers with, its deadline and the exits its caller reads.1stabledata/repo-commands.json
The follow-up claim and its resultThe marker that claims a merged pull request’s follow-up: who took it, a dispatcher’s tick or a person’s run, and how it ended.1stabledata/followup-claim.json
Rule matchers in configurationThe configuration fields that select by an item’s or a change’s facts: the facts a rule may test, how each is compared, how a rule combines its values, and how a field’s rules resolve.1stabledata/rule-matchers.json
Addresses and the verbs of jig sendThe stations an address names on a piece of work, what each one’s key is, and the verbs jig send tells a station.1provisional, moved by plan item 36, plan item 42data/addresses.json
Forge claims: takeover, launch and merge-readyThe claims a driver and a dispatcher post on a pull request: a driver’s takeover of another clone’s drive, a dispatching host’s launch of a drive, and a driver’s announcement that a head is safe to merge.1provisional, moved by plan item 40, plan item 49data/forge-claims.json
Tracker facets: type, priority and sizeThe facts every issue carries beside its labels, the numbers of the priorities, the stores a facet may be kept in and which each tracker adapter holds, and why a facet’s store is the one in force.1provisional, moved by plan item 41data/tracker-facets.json
Needs and structured answersA decision waiting for a person and the answers to it: the decision record’s fields, the forms and lines of a structured answer and how it is normalized, the acts a need asks for, and the dispatcher’s own framings with the options it carries out.1provisional, moved by plan item 50data/needs-and-answers.json
Steward recordsThe closed records a steward pass submits for the dispatcher’s next tick to check and apply: each kind, its fields, the causes a run’s record may name and the bounds of a submission.1provisional, moved by plan item 50data/steward-records.json

How the chapters are generated and checked: Protocol maintainer reference, and the decision behind it: ADR-0020.

Source: plugin/protocol/README.md