logicsrc/docs/openworkflow.md
Anthony Ettinger d2cd5ffee3
Some checks failed
CI / build (push) Has been cancelled
Deploy to dev2 / deploy (push) Has been cancelled
test / test (push) Has been cancelled
OpenTask 0.1 + OpenWorkflow 0.1 (#250)
* OpenTask 0.1 + OpenWorkflow 0.1: specs, schemas, fixtures, validators

docs/opentask.md mints OpenTask: one task a person does on a computer,
written down as meaning (goal, apps, parameters with a sensitivity class
and never a value, semantic steps with no coordinates, capture gaps, stop
conditions, approvals, a success check, provenance, runners with digests)
so an agent can do it again. docs/openworkflow.md mints OpenWorkflow: a
collection of OpenTasks inline or by URL + sha256, in sequence or any
order respecting after, with a publisher index at
/.well-known/openworkflow.json.

- @logicsrc/schemas 0.6.0: opentask, openworkflow, openworkflow-index
- @logicsrc/validators 0.6.0: step numbering, placeholders, apps,
  no example on personal/secret parameters, after references

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* logicsrc-web: register OpenTask and OpenWorkflow

Registry entries (process family, status 0.1) after OpenErrand, with the
family blurb updated; /opentask and /openworkflow landing pages naming
w3bs.org/tasks and w3bs.org/workflows as the reference publisher and
moshscript (moshcode run) as one runner; the worked examples served under
/examples and a logicsrc.com workflow index at
/.well-known/openworkflow.json; contract tests holding the pages' lists and
the served files against the docs and fixtures, and both specs added to
spec discovery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 12:18:16 -07:00

121 lines
5.8 KiB
Markdown

# OpenWorkflow
OpenWorkflow is one JSON file that collects [OpenTasks](/docs/opentask) into a workflow: a named set of tasks a person does together, such as "release a package" or "close the month", in the order they do them or in any order. Each task is carried inline or referenced by URL with its digest, so a workflow can gather tasks from more than one publisher without copying them. A publisher lists its workflows at `/.well-known/openworkflow.json`. It is maintained by Profullstack, Inc. as part of the LogicSRC open-standards surface.
Status: **0.1**. The format w3bs.org/workflows serves, published so other task libraries can serve the same thing.
Slug: `openworkflow`
## The problem
One task is rarely the job. Publishing a release is a version bump in a terminal, a changelog in an editor and an announcement in a browser; each can be demonstrated and written down as an OpenTask, but the job is all three, in order, with the second waiting on the first. Without a collection, a person hands an agent three files and explains the order in chat, and the next person to run it has to be told again.
A workflow file is that explanation written down: which tasks, in what order, which ones wait on which, and where a runner stops the whole thing.
## Terms
- A **workflow** is a named collection of tasks. Its **workflow file** is the JSON document this specification describes.
- An **entry** is one task in a workflow: the task inline, or a reference to a task file by URL.
- A **runner** is the program that carries a workflow out, one task at a time, under the [OpenTask runner rules](/docs/opentask#runner-rules).
## The workflow file
```json
{
"type": "logicsrc.openworkflow",
"version": "0.1",
"id": "release-a-package",
"title": "Release a package",
"description": "Bump the version, write the changelog, announce it.",
"publisher": { "name": "@anthony", "url": "https://w3bs.org/workflows" },
"updated": "2026-10-19T12:00:00Z",
"order": "sequence",
"tasks": [
{
"url": "https://w3bs.org/tasks/tk_4Hq8sP1x.json",
"sha256": "3f1b5c0e9a0e4d7b8c2a6f5d4e3c2b1a09f8e7d6c5b4a39281706f5e4d3c2b1a",
"id": "bump-the-version",
"title": "Bump the version"
},
{
"url": "https://w3bs.org/tasks/tk_Lm2Rt7vQ.json",
"sha256": "a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f90",
"id": "write-the-changelog",
"title": "Write the changelog",
"after": ["bump-the-version"]
}
]
}
```
| Key | Required | Meaning |
| --- | --- | --- |
| `type` | yes | `logicsrc.openworkflow` |
| `version` | yes | `0.1` |
| `id` | yes | A slug, unique within its publisher. |
| `title` | yes | A short name a person reads in a list. |
| `description` | no | What the workflow is for, at most 4000 characters. Untrusted text, as in OpenTask. |
| `publisher` | no | `{ "name", "url" }`: who serves it. |
| `updated` | no | When it last changed. |
| `order` | yes | `sequence` (run the entries in the order listed) or `any` (in any order that respects `after`). |
| `tasks` | yes | At least one entry. See [Entries](#entries). |
| `license` | no | An SPDX identifier for the file. |
## Entries
An entry is one of two shapes.
**Inline**: the whole OpenTask under `task`.
```json
{ "task": { "type": "logicsrc.opentask", "version": "0.1", "id": "empty-the-trash", "...": "..." } }
```
**Reference**: where to fetch it and what it must hash to.
| Key | Required | Meaning |
| --- | --- | --- |
| `url` | yes | An `https` URL serving the task file. |
| `sha256` | yes | The SHA-256 of the bytes served, lowercase hex. A runner refuses a task whose bytes do not match. |
| `id` | yes | The task's `id`, repeated so a person can read the list without fetching. |
| `title` | yes | The task's `title`, likewise. |
Either shape may add `after`, a list of task ids in the same workflow that must finish first, and `optional: true`, which lets a runner skip the entry when a person says so. Task ids are unique within a workflow, `after` names only ids listed earlier, and an entry cannot wait on itself.
## Runner rules
A conforming runner follows every [OpenTask runner rule](/docs/opentask#runner-rules) for each task, and:
1. **Shows the workflow first.** Every entry, its status (an inline task's `status`, or "not yet fetched"), and the order.
2. **Checks references.** It fetches each referenced task over HTTPS, checks its digest and validates it before showing it. A mismatch stops the workflow.
3. **Asks for parameters per task.** Parameters belong to their task; a value given for one task is not reused by another unless a person says so.
4. **Stops the workflow when a task stops.** A task that stops, fails or is skipped without permission ends the run. The runner reports which tasks finished.
5. **Never starts an entry early.** An entry starts only when every id in its `after` has finished.
## The index
A publisher lists its workflows at `/.well-known/openworkflow.json`:
```json
{
"type": "logicsrc.openworkflow-index",
"version": "0.1",
"publisher": "https://w3bs.org",
"updated": "2026-10-19T12:00:00Z",
"workflows": [
{ "url": "https://w3bs.org/workflows/release-a-package.json", "id": "release-a-package", "title": "Release a package", "tasks": 2 }
]
}
```
## Publishing
A publisher serves workflow files as `application/json` over HTTPS. When a referenced task changes, its digest changes, so the workflow is republished with the new digest or it stops working. That is deliberate: a workflow someone reviewed cannot change underneath them.
## Validation
The JSON Schemas are `@logicsrc/schemas/openworkflow` and `@logicsrc/schemas/openworkflow-index`; an inline task is checked against `@logicsrc/schemas/opentask`. `@logicsrc/validators` also checks that task ids are unique, that `after` names only earlier ids, and every OpenTask rule on inline tasks.
```sh
npx @logicsrc/validators openworkflow workflow.json
```