Stagecraft
stagecraft builds factories. A factory describes your process as a set of stages: in each one, work makes an artifact or records evidence, and gates decide when a work item may move on. Agents, people and plain code can each drive different parts of the flow; where a person must decide, the work stops and waits for them. stagecraft defines the stages and gates, keeps each work item's state and journal, and enforces the transitions.
A factory can be for anything you can describe that way: writing software, building swamp extensions, editorial review, incident follow-up, or swamp models from an OpenAPI spec.
Getting started
In a directory for your project (skip swamp init if it is already a
swamp repo):
swamp init
swamp extension pull @swamp/stagecraftThat installs the stagecraft models and the stagecraft skill. Then ask your agent to "set up a stagecraft factory" for your process: the skill interviews you, writes the factory from the closest example, validates it, shows it in the studio, and drives your first work item.
Models
@swamp/stagecraft/factory: holds a factory definition; validates and describes it@swamp/stagecraft/work-item: starts work items and drives them through the stages, gates and human stops@swamp/stagecraft/studio: a local page showing every factory and its work items, or, withserve --input server=<url>, a deployed swamp serve's, read-only with your own swamp login (not together withpublicOrigin)@swamp/stagecraft/tracker: the built-in tracker, kept in swamp data; a ticket can relate to one in another tracker, here or in another repository@swamp/stagecraft/linear: publishes work items as Linear issues@swamp/stagecraft/publisher: publishes work items to a tracker written as a separate extension
Workflows
Every tracker is driven through the same shipped workflows:
@swamp/stagecraft/publish, claim, create, fetch-issue and
mark-duplicate, each with --input tracker=<instance>, and
@swamp/stagecraft/conformance, which checks a tracker against the tracker
contract.
Your own tracker
A team that tracks work elsewhere (Jira, GitHub Issues, an in-house system)
can write its tracker as a separate extension: a model with describe and
operate, behind a publisher. TRACKERS.md, shipped with this extension, is
the guide.
Global Arguments
| Argument | Type | Description |
|---|---|---|
| definition? | preprocess | |
| tracker | string | The tracker instance work items publish to, e.g. board: a model of the |
| Argument | Type | Description |
|---|---|---|
| publicOrigin? | string | The origin a reverse proxy or tunnel publishes the studio at, such as https://studio.example.com. Requests with that Host or Origin are answered too; the studio has no authentication, so the proxy must provide it |
| basePath? | string | The path a reverse proxy publishes the studio under, such as /_stagecraft. The page's files, API calls and addresses carry it, and requests are answered with or without it, so the proxy may strip it or pass it through. Leave it out to serve at / |
| server? | string | A swamp serve to read instead of this repo, such as wss://swamp.example.com: its factories and work items, read-only, with your own swamp login, refreshed every few seconds. Not with publicOrigin |
| Argument | Type | Description |
|---|---|---|
| factory | string | The factory's name |
| title? | string | The work's title, its ticket's; status and the studio show it |
| Argument | Type | Description |
|---|---|---|
| model? | string |
| Argument | Type | Description |
|---|---|---|
| outcome | enum | |
| reason? | string |
| Argument | Type | Description |
|---|---|---|
| driverId? | string |
| Argument | Type | Description |
|---|---|---|
| gateId | string | |
| note? | string |
| Argument | Type | Description |
|---|---|---|
| gateId | string | |
| note? | string |
| Argument | Type | Description |
|---|---|---|
| kind | enum | |
| stage? | string | |
| note? | string |
| Argument | Type | Description |
|---|---|---|
| transition | string | |
| confirm? | stringbool |
| Argument | Type | Description |
|---|---|---|
| confirm | string | |
| repin? | stringbool |
| Argument | Type | Description |
|---|---|---|
| reason | string | Why the work moves ticket |
Global Arguments
| Argument | Type | Description |
|---|---|---|
| apiToken | string | A Linear personal API key. Wire it from a vault: |
| apiUrl? | string | Linear's GraphQL endpoint; defaults to https://api.linear.app/graphql. |
| statuses? | union | Status keys to Linear status names (per team, matched exactly), e.g. |
| teamId? | string | The id of the Linear team create files new issues in; create is |
| types? | union | Issue types to Linear label names (the team's or the workspace's, |
Global Arguments
| Argument | Type | Description |
|---|---|---|
| tracker | string | The tracker instance to publish to: a model with describe and |
| statuses? | union | Status keys to the tracker's status names, e.g. |
Start from a ticket: report its work item, or reserve a key for a new one and print the start command.
Check that a tracker meets the tracker contract: the checks stagecraft's own trackers pass, made through its operate one call at a time. It files and changes tickets, so point it at a tracker kept for testing.
File a new ticket on the tracker and record it; a retry after the tracker accepted it files another.
Read a ticket and record it, with the externalRefs to start a work item from it.
Mark a ticket a duplicate of a primary: relate it duplicate_of and close it where the tracker does not. It moves no work item.
Replay a work item's journal to its ticket: what publish does, for any tracker. Run it again after each step; it delivers only what is new.
Timeline and metrics of a stagecraft work item, rendered statically from its run record
Added 1, removed 5 behaviors. Added 6 workflows. Removed 1 skills
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Docs keep secrets in a vault0/1missing
- skills/stagecraft/references/driving.md--Line 408 sets the secret `--input totalTokens` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
- skills/stagecraft/references/examples/build-swamp-extension.md--Line 260 sets the secret `--input totalTokens` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
- skills/stagecraft/references/examples/build-swamp-extension.md--Line 369 sets the secret `--input totalTokens` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
- skills/stagecraft/references/examples/build-swamp-extension.md--Line 507 sets the secret `--input totalTokens` to a value written in the docs instead of a vault expression. Keep secrets in a vault: store them with `swamp vault put <vault> <key>`, which prompts for the value, and reference them as `${{ vault.get(<vault>, <key>) }}`.
Fix or accept each secret-unsafe-docs warning: the README, the manifest description and describe strings should store secrets with `swamp vault put <vault> <key>` (it prompts for the value) and pass them as `${{ vault.get(<vault>, <key>) }}`.
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License2/2earned
- Verified public repository2/2earned