@kontextmind/kxm 0.7.95 → 0.7.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.kxm/README.md +39 -9
- package/CHANGELOG.md +1 -1
- package/README.md +147 -257
- package/SECURITY.md +21 -12
- package/docs/README.md +133 -54
- package/docs/adr/ADR-0002-browser-automation-steel-doks.md +24 -18
- package/docs/adr/ADR-0003-sqlite-only-store.md +100 -0
- package/docs/adr/ADR-0004-edge-identity-authentik.md +99 -0
- package/docs/adr/README.md +33 -0
- package/docs/concepts/architecture.md +262 -0
- package/docs/concepts/data-and-storage.md +194 -0
- package/docs/concepts/trust-model.md +152 -0
- package/docs/contracts/README.md +22 -14
- package/docs/contracts/effects-and-recovery.md +3 -0
- package/docs/contracts/migration.md +2 -2
- package/docs/contracts/routing.md +6 -5
- package/docs/contributing/assignment-runner.md +388 -0
- package/docs/contributing/ci-and-release.md +231 -0
- package/docs/contributing/development.md +362 -0
- package/docs/contributing/harness-routing-internals.md +192 -0
- package/docs/{packages.md → contributing/packages.md} +13 -15
- package/docs/{skills → contributing}/repo-work-delivery.md +20 -21
- package/docs/contributing/test-matrix.md +208 -0
- package/docs/{tui-components.md → contributing/tui-components.md} +30 -22
- package/docs/contributing/writing-docs.md +340 -0
- package/docs/glossary.md +471 -0
- package/docs/guides/agent-skills.md +137 -0
- package/docs/guides/browser-automation.md +160 -0
- package/docs/guides/context-and-memory.md +352 -0
- package/docs/guides/continuous-improvement.md +228 -0
- package/docs/guides/governed-skills.md +173 -0
- package/docs/guides/nous-providers.md +186 -0
- package/docs/guides/peer-messaging.md +304 -0
- package/docs/guides/pi-workers.md +219 -0
- package/docs/guides/provenance-gates.md +313 -0
- package/docs/guides/webhook-workflows.md +364 -0
- package/docs/kb/how-credentials-retrieved-safely.md +38 -12
- package/docs/kb/how-to-capture-and-annotate-section.md +15 -13
- package/docs/kb/how-to-connect-playwright-to-steel.md +16 -11
- package/docs/kb/how-to-recover-expired-session-or-orphan.md +26 -16
- package/docs/kb/how-to-resume-after-mfa.md +19 -11
- package/docs/kb/how-to-take-over-session.md +17 -13
- package/docs/kb/why-authentication-disappeared.md +22 -14
- package/docs/kb/why-automation-opened-different-browser.md +23 -14
- package/docs/kb/why-session-viewer-cannot-control.md +13 -12
- package/docs/operations/backup-and-restore.md +248 -0
- package/docs/operations/deploy.md +307 -0
- package/docs/operations/monitoring.md +209 -0
- package/docs/operations/runtime-sync.md +192 -0
- package/docs/operations/troubleshooting.md +265 -0
- package/docs/operations/upgrade.md +124 -0
- package/docs/prompts/browser-annotate-feedback.md +7 -7
- package/docs/prompts/browser-diagnose-recover.md +11 -10
- package/docs/prompts/browser-explore.md +7 -7
- package/docs/prompts/browser-repro-fix.md +7 -7
- package/docs/prompts/browser-start.md +12 -11
- package/docs/prompts/browser-takeover.md +8 -8
- package/docs/{cli-reference.md → reference/cli-reference.md} +83 -41
- package/docs/{config-reference.md → reference/config-reference.md} +159 -148
- package/docs/reference/configuration.md +299 -0
- package/docs/reference/harness-routing.md +508 -0
- package/docs/reference/http-api.md +203 -0
- package/docs/reference/tools.md +370 -0
- package/docs/{workflow-guide.md → reference/workflow-catalog.md} +92 -153
- package/docs/reference/workflow-definitions.md +286 -0
- package/docs/start/first-workflow.md +287 -0
- package/docs/start/install.md +146 -0
- package/docs/start/quickstart-claude-code.md +405 -0
- package/docs/start/quickstart-pi.md +213 -0
- package/docs/templates/README.md +78 -73
- package/docs/templates/adr.md +13 -13
- package/docs/templates/architecture.md +55 -71
- package/docs/templates/bug-fix.md +13 -16
- package/docs/templates/feature.md +14 -19
- package/docs/templates/handoff.md +44 -46
- package/docs/templates/postmortem.md +30 -43
- package/docs/templates/research.md +15 -20
- package/docs/templates/review.md +49 -50
- package/docs/templates/runbook.md +38 -30
- package/docs/templates/test-plan.md +16 -23
- package/docs/templates/test-report.md +14 -17
- package/examples/README.md +9 -5
- package/examples/provenance-workflow.json +1 -1
- package/examples/webhook-workflows/jira-development.json +59 -0
- package/examples/webhook-workflows/jira-issue-updated.json +12 -0
- package/package.json +1 -1
- package/packages/core/tui/README.md +1 -1
- package/plugins/kxm/.claude-plugin/plugin.json +1 -1
- package/plugins/kxm/README.md +31 -32
- package/plugins/kxm/dist/cli.js +5 -5
- package/plugins/kxm/dist/mcp-server.js +1 -1
- package/plugins/kxm/dist/runtime.js +1 -1
- package/plugins/kxm/package.json +1 -1
- package/plugins/kxm/skills/kxm/references/protocol.md +3 -1
- package/plugins/kxm/skills/kxm-browser-auth/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-browser-diagnostics/SKILL.md +5 -5
- package/plugins/kxm/skills/kxm-browser-explore/SKILL.md +2 -2
- package/plugins/kxm/skills/kxm-browser-session/SKILL.md +10 -13
- package/plugins/kxm/skills/kxm-browser-takeover/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-browser-verify/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-context-memory/SKILL.md +13 -4
- package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +3 -1
- package/plugins/kxm/skills/kxm-mind-setup/SKILL.md +2 -1
- package/plugins/kxm/skills/kxm-project-setup/SKILL.md +31 -54
- package/plugins/kxm/skills/kxm-projects/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-protocol/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-routing-improve/SKILL.md +15 -7
- package/plugins/kxm/skills/kxm-runs/SKILL.md +11 -5
- package/plugins/kxm/skills/kxm-session/SKILL.md +1 -1
- package/plugins/kxm/skills/kxm-tasks/SKILL.md +9 -7
- package/plugins/kxm/skills/kxm-workflow/SKILL.md +10 -2
- package/plugins/kxm/src/cli/system.ts +1 -1
- package/plugins/kxm/src/cli.ts +3 -3
- package/plugins/kxm/src/init-guide-setup.ts +1 -1
- package/plugins/kxm/src/mcp-server.ts +1 -1
- package/plugins/kxm/src/modes.ts +1 -1
- package/schemas/README.md +1 -1
- package/docs/agent-communication-envelopes-and-gates.md +0 -553
- package/docs/agent-skills.md +0 -198
- package/docs/architecture.md +0 -245
- package/docs/assignment-runner.md +0 -264
- package/docs/browser-automation.md +0 -139
- package/docs/configuration.md +0 -437
- package/docs/continuous-improvement.md +0 -226
- package/docs/getting-started.md +0 -277
- package/docs/harness-routing.md +0 -616
- package/docs/kb/qa-authentik-authentication.md +0 -97
- package/docs/kb/qa-extension-install-and-hub-bootstrap.md +0 -85
- package/docs/kb/qa-hub-on-a-public-host.md +0 -48
- package/docs/kb/qa-sqlite-vs-duckdb.md +0 -35
- package/docs/kb/qa-what-the-hub-stores.md +0 -64
- package/docs/kxm-handbook.md +0 -1181
- package/docs/operations.md +0 -510
- package/docs/operator-pi-packages.md +0 -67
- package/docs/provenance-gates.md +0 -295
- package/docs/skills.md +0 -47
- package/docs/test-matrix.md +0 -132
- package/docs/troubleshooting.md +0 -322
- package/docs/webhook-workflows.md +0 -240
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Workflow definition reference
|
|
2
|
+
|
|
3
|
+
KXM has two kinds of workflow definition. A **webhook workflow definition** is JSON that the [hub](../glossary.md#hub) loads; a signed webhook starts a run, and one coordinator agent works through its ordered **stages**. A **Runtime workflow** is a `kxm.workflow.v1` YAML file in your project; `kxm run` starts it, and the local Runtime executes its **steps**. This page compares the two, documents every field of the JSON format, and summarizes the YAML format with links to its full reference.
|
|
4
|
+
|
|
5
|
+
## Two workflow systems
|
|
6
|
+
|
|
7
|
+
| | Webhook workflow definition | Runtime workflow |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| Format | JSON array of definitions | YAML file with `schema: kxm.workflow.v1` |
|
|
10
|
+
| Location | Any JSON file named by `KXM_WEBHOOK_WORKFLOWS_FILE`, or inline in `KXM_WEBHOOK_WORKFLOWS` | `.kxm/workflows/<id>.yaml`, tracked in Git |
|
|
11
|
+
| Loaded by | The hub, once at start | Every project load (`kxm init`, `kxm run`) |
|
|
12
|
+
| Units | Stages, in order | Steps, connected by typed transitions |
|
|
13
|
+
| Started by | A signed `POST /v1/webhooks/<id>`, or `kxm workflow start` | `kxm run <workflow> [prompt]` |
|
|
14
|
+
| Who does the work | One coordinator agent, prompted with every stage, using the [workflow tools](tools.md#workflow-tools) | The Runtime: agent steps through a model producer, gate steps by running `.kxm/gates.yaml` commands |
|
|
15
|
+
| Evidence | Keyed strings plus verified peer replies | Gate evidence the Runtime records itself |
|
|
16
|
+
| External results | `kxm_workflow_wait`, then a signed signal | Recovery signals only; `wait` steps compile but are not matched yet |
|
|
17
|
+
| Inspect with | `kxm_workflow_get`, `kxm workflow get`, `kxm dash` | `kxm runs status`, `kxm runs list` |
|
|
18
|
+
| Validate with | `kxm gate validate` | `kxm init --dry-run`, `kxm run --dry-run` |
|
|
19
|
+
|
|
20
|
+
Both kinds of run have IDs of the form `run_<32 hex>`. The journal, checkpoints and waits belong to webhook runs only.
|
|
21
|
+
|
|
22
|
+
## Webhook workflow definitions
|
|
23
|
+
|
|
24
|
+
### Load definitions
|
|
25
|
+
|
|
26
|
+
The hub reads its definitions once, at start, from exactly one source:
|
|
27
|
+
|
|
28
|
+
- `KXM_WEBHOOK_WORKFLOWS_FILE`: a path to a JSON file holding an array of definitions;
|
|
29
|
+
- `KXM_WEBHOOK_WORKFLOWS`: the same array, inline.
|
|
30
|
+
|
|
31
|
+
Setting both, or an invalid definition, stops the hub from starting. Restart the hub to load a change. Check a file first; the command parses the same source the hub loads and never prints secrets:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
export JIRA_WEBHOOK_SECRET="replace-with-a-start-secret"
|
|
35
|
+
export WORKFLOW_SIGNAL_SECRET="replace-with-a-signal-secret"
|
|
36
|
+
kxm gate validate --file .kxm/assets/webhooks/workflows.json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Expected output for the [example](#example) below:
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
validated 1 workflow(s) from file with 1 warning(s)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Keep the file out of `.kxm/config/workflows/`: any JSON there counts as legacy configuration and makes the whole project unloadable (`legacy_state_unsupported`). Do not point the hub at `.kxm/workflows/*.yaml` either; those are Runtime workflows and do not parse as JSON. Unknown fields are ignored, except inside `evidencePolicies`, where they are refused. Errors are plain messages rather than codes.
|
|
46
|
+
|
|
47
|
+
### Definition fields
|
|
48
|
+
|
|
49
|
+
| Field | Type and limits | Default | Effect |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| `id` | String, 64 characters, unique | Required | The URL segment in `/v1/webhooks/<id>` and the name `kxm workflow start` takes |
|
|
52
|
+
| `source` | `jira`, `github` or `generic` | `generic` | Recorded on each run; does not change how requests are read |
|
|
53
|
+
| `project` | String, 128 characters | Required | Hub project the run and its coordinator belong to |
|
|
54
|
+
| `target` | Agent name or ID, 80 characters | Required | The coordinator. It must have registered at least once before a run starts; it may be offline |
|
|
55
|
+
| `secretEnv` | Environment variable name | Use this or `secret` | Variable holding the start secret, read when the definitions are parsed |
|
|
56
|
+
| `secret` | String, 16 to 512 characters | Use this or `secretEnv` | The start secret inline. Prefer `secretEnv` |
|
|
57
|
+
| `signalSecretEnv`, `signalSecret` | As above | The start secret | Separate secret for result callbacks |
|
|
58
|
+
| `event` | String, 128 characters | Any event | Only deliveries with this event start a run; others get 204 |
|
|
59
|
+
| `filter.path`, `filter.equals` | Dotted payload path (256), exact string (512) | No filter | Only payloads whose value at the path equals the string start a run; others get 204 |
|
|
60
|
+
| `delivery` | `followUp` or `steer` | `followUp` | Delivery mode of the coordinator's prompt |
|
|
61
|
+
| `ttlMs` | Integer, 1,000 to 604,800,000 | The hub's `KXM_MESSAGE_TTL_MS` | Lifetime of the coordinator prompt and each resume message |
|
|
62
|
+
| `promptTemplate` | String, 20,000 characters | Required | Task text with `{{dotted.path}}` placeholders filled from the payload |
|
|
63
|
+
| `maxTransitions` | Integer, 1 to 200 | No global budget | Run-wide budget on declared transitions. Required when any stage has a back-edge |
|
|
64
|
+
| `planHash` | `{ "stageId", "evidenceKey" }` | None | See [Plan hash and reproduction oracle](#plan-hash-and-reproduction-oracle) |
|
|
65
|
+
| `reproOracle` | `{ "stageId", "evidenceKey" }` | None | As above |
|
|
66
|
+
| `requirePlanHash` | Array of stage IDs | None | Stages that cannot checkpoint until the plan hash is captured |
|
|
67
|
+
| `stages` | 1 to 32 stages | Required | In execution order |
|
|
68
|
+
|
|
69
|
+
A placeholder whose value is an object is filled with its JSON; a missing value becomes empty. The hub adds the run ID, every stage with its required evidence and peer policies, and the coordinator's rules to the rendered template. The whole prompt must fit in 32,000 characters, or the start is refused.
|
|
70
|
+
|
|
71
|
+
### Stage fields
|
|
72
|
+
|
|
73
|
+
| Field | Type and limits | Default | Effect |
|
|
74
|
+
|---|---|---|---|
|
|
75
|
+
| `id` | String, 64 characters, unique in the definition | Required | The `stageId` in tool calls |
|
|
76
|
+
| `label` | String, 128 characters | The `id` | Display name |
|
|
77
|
+
| `instructions` | String, 4,000 characters | Required | What the coordinator does in this stage |
|
|
78
|
+
| `requiredEvidence` | Up to 32 unique strings of 128 characters | `[]` | Evidence keys a passing checkpoint must cover |
|
|
79
|
+
| `maxAttempts` | Integer, 1 to 20 | `3` | Warning or failed checkpoints allowed before the run fails |
|
|
80
|
+
| `autoResumeLimit` | Integer, 1 to 20 | None | Attempts after which the stage escalates to an operator |
|
|
81
|
+
| `area` | `harness`, `gates`, `implementation`, `workflow`, `documentation`, `security` or `other` | None | Default area for this stage's journal entries |
|
|
82
|
+
| `evidencePolicies` | Map of required key to a policy | None | Keys that only verified peer replies can satisfy |
|
|
83
|
+
| `on` | Map of outcome key to a transition | None | Declared transitions; see [Transitions and outcome keys](#transitions-and-outcome-keys) |
|
|
84
|
+
| `maxTransitions` | Integer, 1 to 100 | None | Budget on transitions taken out of this stage |
|
|
85
|
+
|
|
86
|
+
Evidence keys are compared after trimming, collapsing inner whitespace and lowercasing, so `Peer Reviews` and `peer reviews` are the same key; duplicates after normalizing are refused.
|
|
87
|
+
|
|
88
|
+
### Evidence policy fields
|
|
89
|
+
|
|
90
|
+
A policy turns one required key into a peer-reply requirement: only replies from eligible peers, requested with the run's exact `workflowContext` and cited in `evidenceRefs`, can satisfy it.
|
|
91
|
+
|
|
92
|
+
| Field | Type and limits | Default | Effect |
|
|
93
|
+
|---|---|---|---|
|
|
94
|
+
| `kind` | `peer-reply` | Required | The only kind |
|
|
95
|
+
| `minProducers` | Integer, 1 to 8 | Required | Unique eligible agents whose replies are needed; at most the number of eligible agents |
|
|
96
|
+
| `eligibleAgents` | 1 to 16 unique agent names or IDs | Required | Who may produce the evidence. Must not include `target` |
|
|
97
|
+
| `acceptedStatuses` | Exactly `["replied"]` | `["replied"]` | Only replied messages count |
|
|
98
|
+
| `degradation.minProducers` | Integer, at least 1 and lower than `minProducers` | None | The lowest minimum an operator may approve; below 2 validates with a warning |
|
|
99
|
+
|
|
100
|
+
The policy key must also appear in `requiredEvidence`. When a run starts, the hub resolves the eligible agents to stable agent IDs and snapshots them on the run. The start fails with 409 if an eligible agent never registered (`workflow_target_unavailable`), resolves to the coordinator (`workflow_evidence_policy_invalid`), or leaves fewer unique producers than `minProducers` (`workflow_evidence_policy_unresolvable`).
|
|
101
|
+
|
|
102
|
+
An operator approves a degraded minimum for the current attempt with `kxm gate degrade`, which needs the admin token. The approval is journaled and does not pass the stage; the coordinator still cites the approved number of replies. [Peer provenance and quorum gates](../guides/provenance-gates.md) explains what quorum does and does not prove.
|
|
103
|
+
|
|
104
|
+
### How a stage passes
|
|
105
|
+
|
|
106
|
+
- An ordinary required key is satisfied by any non-empty string under that key, from the checkpoint itself, from earlier `kxm_workflow_wait` calls in this stage, or from the callback.
|
|
107
|
+
- A peer-policy key is satisfied only by verified `evidenceRefs` from distinct eligible producers for this run, stage, requirement and attempt. Evidence strings never satisfy it, and replies requested for an earlier attempt do not count.
|
|
108
|
+
- Evidence sent with a `warning` or `failed` checkpoint or callback is recorded in the journal but not kept for the next attempt.
|
|
109
|
+
- A `passed` checkpoint missing any key is refused with `workflow_evidence_incomplete`, which lists the missing keys; it does not consume an attempt.
|
|
110
|
+
|
|
111
|
+
The following diagram shows one stage's states.
|
|
112
|
+
|
|
113
|
+
```mermaid
|
|
114
|
+
stateDiagram-v2
|
|
115
|
+
state "failed or warning" as exhausted
|
|
116
|
+
[*] --> in_progress: first stage, when the run starts
|
|
117
|
+
[*] --> pending: every other stage
|
|
118
|
+
pending --> in_progress: previous stage passed, or a transition enters it
|
|
119
|
+
in_progress --> in_progress: warning or failed, attempts remain
|
|
120
|
+
in_progress --> pending: declared failure transition to another stage
|
|
121
|
+
in_progress --> waiting: kxm_workflow_wait, or autoResumeLimit reached
|
|
122
|
+
waiting --> in_progress: signed signal, then checkpointed
|
|
123
|
+
in_progress --> passed: passed with complete evidence
|
|
124
|
+
in_progress --> exhausted: last attempt not passed, run fails
|
|
125
|
+
waiting --> exhausted: wait expires, run fails
|
|
126
|
+
passed --> [*]
|
|
127
|
+
exhausted --> [*]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Transitions and outcome keys
|
|
131
|
+
|
|
132
|
+
Without an `on` map, a stage follows default edges: `passed` moves to the next pending stage (or completes the run after the last stage), and `warning` or `failed` retries the same stage until `maxAttempts`.
|
|
133
|
+
|
|
134
|
+
Each `on` key is an outcome key, and each value is a stage ID, `$terminal`, or `{ "target": "<stage or $terminal>", "maxTransitions": <1 to 100> }`.
|
|
135
|
+
|
|
136
|
+
- **Outcome keys.** The key is the checkpoint's or signal's status: `passed`, `warning` or `failed`. The checkpoint route also accepts an `outcome` field naming a custom key, but no KXM tool or command sends one.
|
|
137
|
+
- **Forward targets.** A transition may target only the next stage, so a gate stage cannot be skipped. Targeting a later stage is refused when the definitions load.
|
|
138
|
+
- **Back-edges.** A target at or before the current stage is a back-edge. Any back-edge requires the definition's `maxTransitions`.
|
|
139
|
+
- **Budgets.** The per-edge `maxTransitions`, the stage's `maxTransitions` and the definition's `maxTransitions` all count transitions already taken. Exhausting any of them fails the run and journals a `transition_budget_exhausted` error.
|
|
140
|
+
- **Entering a stage.** A transition resets the target stage's attempts and evidence. A stage left on a failure transition returns to `pending`.
|
|
141
|
+
- **After a back-edge.** The default `passed` edge enters the first `pending` stage in definition order. Stages between the back-edge target and the stage that took it are still `passed` from before, so they are skipped, not re-run. To re-run them, declare `on.passed` on each stage explicitly, naming the next stage.
|
|
142
|
+
- **Last attempt.** A failure transition is taken only while attempts remain; a stage's last failing attempt fails the run.
|
|
143
|
+
- **`$terminal`.** Completes the run, whichever outcome led there. It takes no terminal status.
|
|
144
|
+
|
|
145
|
+
Every transition taken is journaled as a `state-change` entry.
|
|
146
|
+
|
|
147
|
+
### Waits, signals and escalation
|
|
148
|
+
|
|
149
|
+
`kxm_workflow_wait` parks the active stage in `waiting` under a `signalKey` until a signed callback arrives or the wait expires (1 second to 30 days, default 24 hours; expiry fails the run). The coordinator can then reply to release its turn.
|
|
150
|
+
|
|
151
|
+
The callback is `POST /v1/webhooks/<id>/runs/<runId>/signals/<signalKey>`, signed with HMAC-SHA256 of the raw body using the signal secret (or the start secret), with a delivery ID header. Its body carries `status`, `summary` and `evidence`. Evidence keys `workflow.run`, `workflow.stage` and `workflow.signal`, when present, must match the route (`workflow_signal_context_mismatch`). The signal checkpoints the stage with its status; if work remains, the hub sends the coordinator a resume message. See the [HTTP API](http-api.md#webhooks-and-signals) for headers and deduplication.
|
|
152
|
+
|
|
153
|
+
When `autoResumeLimit` is set and a stage's attempts reach it without passing, the stage escalates instead of retrying: it waits for signal key `audit_escalation` for 24 hours and records a `kxm.terminal-receipt.v1` receipt. A signed `audit_escalation` signal, or `kxm role resume`, resumes it. Anyone holding the signal secret can clear an escalation.
|
|
154
|
+
|
|
155
|
+
> [!IMPORTANT]
|
|
156
|
+
> Inside a KXM project (a Git repository with `.kxm/project.yaml`), `kxm gate signal`, `kxm workflow signal`, `kxm workflow wait` and `kxm role resume` send every `run_…` ID to the local Runtime, and hub run IDs use the same form. To signal a hub run from the CLI, run `kxm gate signal` outside any KXM project. `kxm gate github watch` and the agent tools always reach the hub.
|
|
157
|
+
|
|
158
|
+
### Plan hash and reproduction oracle
|
|
159
|
+
|
|
160
|
+
Both take `{ "stageId", "evidenceKey" }`. When `stageId` passes, the hub records the SHA-256 of that stage's values for `evidenceKey`.
|
|
161
|
+
|
|
162
|
+
- **`planHash`** records the approved plan. Stages listed in `requirePlanHash` refuse checkpoints with `plan_hash_required` until it exists.
|
|
163
|
+
- **`reproOracle`** records a confirmed reproduction. A later checkpoint that cites the same key with different values is refused with `weakened_reproduction`, so a reproduction cannot be weakened to make a fix pass.
|
|
164
|
+
|
|
165
|
+
### What else ends or records a run
|
|
166
|
+
|
|
167
|
+
- **Early reply.** A coordinator reply while the run is `running` fails it, with an `error` journal entry. Reply only after the last checkpoint, or after `kxm_workflow_wait`.
|
|
168
|
+
- **Prompt expiry.** If the coordinator's prompt expires while the run is `running`, the run fails.
|
|
169
|
+
- **Retrospective.** When a run completes or fails, the hub writes a proposed retrospective (JSON and Markdown) under `.kxm/assets/retrospectives/`.
|
|
170
|
+
- **Retention.** Finished runs and their journal are purged from the hub after 7 days. The retrospective files remain.
|
|
171
|
+
|
|
172
|
+
### Limits
|
|
173
|
+
|
|
174
|
+
| Item | Limit |
|
|
175
|
+
|---|---|
|
|
176
|
+
| Definitions | Unique `id`s; each ID 64 characters |
|
|
177
|
+
| Stages per definition | 1 to 32 |
|
|
178
|
+
| Required evidence per stage | 32 keys of 128 characters |
|
|
179
|
+
| Peer policy | `minProducers` 1 to 8; `eligibleAgents` 1 to 16 |
|
|
180
|
+
| Attempts | `maxAttempts` and `autoResumeLimit` 1 to 20 |
|
|
181
|
+
| Transition budgets | Edge and stage 1 to 100; definition 1 to 200 |
|
|
182
|
+
| Secrets | 16 to 512 characters |
|
|
183
|
+
| Prompt | Template 20,000 characters; rendered prompt 32,000 |
|
|
184
|
+
| Message lifetime (`ttlMs`) | 1 second to 7 days |
|
|
185
|
+
| Signal wait | 1 second to 30 days |
|
|
186
|
+
|
|
187
|
+
Checkpoint and journal limits are in [Protocol limits](configuration.md#workflows-and-context).
|
|
188
|
+
|
|
189
|
+
### Example
|
|
190
|
+
|
|
191
|
+
This definition plans with two independent peer reviews, implements, then waits for CI and loops back to implementation at most twice on a failed CI signal. It validates with one warning, for the degraded minimum of 1.
|
|
192
|
+
|
|
193
|
+
`.kxm/assets/webhooks/workflows.json`:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
[
|
|
197
|
+
{
|
|
198
|
+
"id": "jira-development",
|
|
199
|
+
"source": "jira",
|
|
200
|
+
"project": "payments",
|
|
201
|
+
"target": "coordinator",
|
|
202
|
+
"secretEnv": "JIRA_WEBHOOK_SECRET",
|
|
203
|
+
"signalSecretEnv": "WORKFLOW_SIGNAL_SECRET",
|
|
204
|
+
"event": "jira:issue_updated",
|
|
205
|
+
"filter": { "path": "issue.fields.status.name", "equals": "In Progress" },
|
|
206
|
+
"delivery": "followUp",
|
|
207
|
+
"ttlMs": 86400000,
|
|
208
|
+
"maxTransitions": 6,
|
|
209
|
+
"planHash": { "stageId": "plan", "evidenceKey": "approved plan" },
|
|
210
|
+
"requirePlanHash": ["implement"],
|
|
211
|
+
"promptTemplate": "Deliver {{issue.key}}: {{issue.fields.summary}}",
|
|
212
|
+
"stages": [
|
|
213
|
+
{
|
|
214
|
+
"id": "plan",
|
|
215
|
+
"label": "Plan and review",
|
|
216
|
+
"instructions": "Produce a plan and collect two independent peer reviews.",
|
|
217
|
+
"requiredEvidence": ["approved plan", "peer reviews"],
|
|
218
|
+
"evidencePolicies": {
|
|
219
|
+
"peer reviews": {
|
|
220
|
+
"kind": "peer-reply",
|
|
221
|
+
"minProducers": 2,
|
|
222
|
+
"eligibleAgents": ["reviewer-claude", "reviewer-grok"],
|
|
223
|
+
"acceptedStatuses": ["replied"],
|
|
224
|
+
"degradation": { "minProducers": 1 }
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"maxAttempts": 3,
|
|
228
|
+
"area": "workflow",
|
|
229
|
+
"on": { "passed": "implement" }
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"id": "implement",
|
|
233
|
+
"label": "Implement",
|
|
234
|
+
"instructions": "Implement the approved plan.",
|
|
235
|
+
"requiredEvidence": ["diff"],
|
|
236
|
+
"maxAttempts": 3,
|
|
237
|
+
"autoResumeLimit": 2,
|
|
238
|
+
"area": "implementation",
|
|
239
|
+
"on": { "passed": "ci" }
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"id": "ci",
|
|
243
|
+
"label": "Wait for CI",
|
|
244
|
+
"instructions": "Call kxm_workflow_wait and let kxm gate github watch report the checks.",
|
|
245
|
+
"requiredEvidence": ["github.check:ci"],
|
|
246
|
+
"maxAttempts": 3,
|
|
247
|
+
"area": "gates",
|
|
248
|
+
"on": {
|
|
249
|
+
"passed": "$terminal",
|
|
250
|
+
"failed": { "target": "implement", "maxTransitions": 2 }
|
|
251
|
+
},
|
|
252
|
+
"maxTransitions": 2
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
[Webhook workflows](../guides/webhook-workflows.md) walks through running a definition like this end to end.
|
|
260
|
+
|
|
261
|
+
## Runtime workflows (`kxm.workflow.v1`)
|
|
262
|
+
|
|
263
|
+
A Runtime workflow is a YAML file whose name is its ID. The [configuration file reference](config-reference.md#kxmworkflowsidyaml-kxmworkflowv1) documents every field and error code; this table summarizes the parts that differ most from webhook definitions.
|
|
264
|
+
|
|
265
|
+
| Topic | Summary | Full reference |
|
|
266
|
+
|---|---|---|
|
|
267
|
+
| Top level | `schema`, `description`, `coordinator`, `limits` (`maxTransitions`, `maxRunDurationMs`, `maxAgentTimeMs`, `maxModelCost`, `currency`), `planHash`, `reproOracle`, `requirePlanHash`, and 1 to 128 `steps` | [Top-level fields](config-reference.md#top-level-fields) |
|
|
268
|
+
| Step kinds | `agent`, `moa`, `gate`, `approval`, `wait`; `workflow` is reserved | [Step fields](config-reference.md#step-fields) |
|
|
269
|
+
| Parallel work | `assignments` (allowed agents, counts, `distinctBy`) and `join` (`all`, `all-settled`, `quorum`, `first-success`) | [Assignments and join](config-reference.md#assignments-and-join) |
|
|
270
|
+
| Evidence | `requiredEvidence` entries with a `kind` and an optional `producerPolicy` | [Evidence requirements](config-reference.md#evidence-requirements) |
|
|
271
|
+
| Transitions | `on` is required on every step. `$terminal` needs `terminalStatus` (`completed`, `failed` or `cancelled`). Each back-edge needs its own `maxTransitions`, plus `limits.maxTransitions` | [Transitions and outcomes](config-reference.md#transitions-and-outcomes) |
|
|
272
|
+
| Gate outcome keys | An `expect: pass` gate produces `passed` or `implementation-failure`; an `expect: fail` gate produces `passed` or `repro-missing`. Declare both produced outcomes | [Transitions and outcomes](config-reference.md#transitions-and-outcomes) |
|
|
273
|
+
| `gate_outcome_impossible` | Refused at load when a gate step declares an outcome it never produces, such as `failed`, and omits one it produces. `gate_outcome_renamed` catches underscore spellings | [Transitions and outcomes](config-reference.md#transitions-and-outcomes) |
|
|
274
|
+
| Agent steps | The model returns a JSON `outcome` from the step's declared keys; anything else becomes `failed`, so declare `failed` | [Transitions and outcomes](config-reference.md#transitions-and-outcomes) |
|
|
275
|
+
| Not executed yet | Some valid fields make the Runtime hand the run off (`step_unsupported`, `gate_unsupported`, `limit_unsupported`) instead of executing | [Steps the Runtime does not execute yet](config-reference.md#steps-the-runtime-does-not-execute-yet) |
|
|
276
|
+
|
|
277
|
+
`kxm workflow add --template <name>` writes a valid starting file from a built-in template (`implement-and-verify`, `dual-critic-review` or `spec-and-plan`). `kxm run <workflow>` creates a run and prints the commands that drive it with the model-free simulation (`kxm runs drive <runId> --simulated --wait`) or cancel it. See [`kxm run`](cli-reference.md#kxm-run) and [`kxm runs`](cli-reference.md#kxm-runs).
|
|
278
|
+
|
|
279
|
+
## Related
|
|
280
|
+
|
|
281
|
+
- [Webhook workflows](../guides/webhook-workflows.md): start, wait for and resume a webhook run
|
|
282
|
+
- [Peer provenance and quorum gates](../guides/provenance-gates.md): evidence policies in practice
|
|
283
|
+
- [Agent tools](tools.md#workflow-tools): the coordinator's workflow tools
|
|
284
|
+
- [Hub HTTP API](http-api.md#webhooks-and-signals): signed start and signal requests
|
|
285
|
+
- [Configuration file reference](config-reference.md#kxmworkflowsidyaml-kxmworkflowv1): every `kxm.workflow.v1` field
|
|
286
|
+
- [Workflow catalog](workflow-catalog.md): the area, workflow and role taxonomy
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Run your first workflow
|
|
2
|
+
|
|
3
|
+
A [workflow](../glossary.md#workflow) is a reviewed YAML file in `.kxm/workflows/` that the local [Runtime](../glossary.md#runtime) runs step by step. In this tutorial you add a workflow from a built-in template, review and commit it, and drive a run to a verified completion without calling any model. [Understand the workflow](#understand-the-workflow) then explains what you ran.
|
|
4
|
+
|
|
5
|
+
## Before you begin
|
|
6
|
+
|
|
7
|
+
- The `kxm` CLI. See [Install KXM](install.md#install-the-cli).
|
|
8
|
+
- A KXM project whose `.kxm/` is committed to Git. Steps [1](quickstart-claude-code.md#1-initialize-the-project) and [2](quickstart-claude-code.md#2-ignore-runtime-state-and-commit-kxm) of the Claude Code quick start create one.
|
|
9
|
+
- Nothing else. The drive in this tutorial is simulated, so it needs no model credentials, and runs work without a hub: the Runtime sends run summaries to the bound hub whenever one is running.
|
|
10
|
+
|
|
11
|
+
## How a first run works
|
|
12
|
+
|
|
13
|
+
A new workflow reaches a finished run through one human decision: your reviewed commit.
|
|
14
|
+
|
|
15
|
+
```mermaid
|
|
16
|
+
flowchart LR
|
|
17
|
+
A["Add .kxm/workflows/first.yaml"] -->|"kxm init"| B[Validated]
|
|
18
|
+
B -->|"kxm trust diff"| C[Expansion listed]
|
|
19
|
+
C -->|"you review and commit"| D[Trusted]
|
|
20
|
+
D -->|"kxm run"| E[Run created]
|
|
21
|
+
E -->|"kxm runs drive --simulated"| F[Run completed]
|
|
22
|
+
F -->|"kxm runs status"| G[Receipt verified]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 1. Add a workflow from a template
|
|
26
|
+
|
|
27
|
+
From the repository root:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
kxm workflow add first --template spec-and-plan
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Expected output:
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
Added workflow 'first' to local (<repo-root>/.kxm/workflows/first.yaml)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The file name is the workflow ID, so this workflow is `first`. The `spec-and-plan` template writes this file, `.kxm/workflows/first.yaml`:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
schema: kxm.workflow.v1
|
|
43
|
+
description: Plan a change, then review the plan. Both steps run as the
|
|
44
|
+
coordinator agent and only read the repository.
|
|
45
|
+
coordinator: coordinator
|
|
46
|
+
limits:
|
|
47
|
+
maxTransitions: 8
|
|
48
|
+
steps:
|
|
49
|
+
- id: plan
|
|
50
|
+
kind: agent
|
|
51
|
+
agent: coordinator
|
|
52
|
+
maxAttempts: 3
|
|
53
|
+
repositories:
|
|
54
|
+
control: read
|
|
55
|
+
on:
|
|
56
|
+
passed: review-arch
|
|
57
|
+
failed:
|
|
58
|
+
target: $terminal
|
|
59
|
+
terminalStatus: failed
|
|
60
|
+
- id: review-arch
|
|
61
|
+
kind: agent
|
|
62
|
+
agent: coordinator
|
|
63
|
+
maxAttempts: 3
|
|
64
|
+
repositories:
|
|
65
|
+
control: read
|
|
66
|
+
on:
|
|
67
|
+
passed:
|
|
68
|
+
target: $terminal
|
|
69
|
+
terminalStatus: completed
|
|
70
|
+
failed:
|
|
71
|
+
target: plan
|
|
72
|
+
maxTransitions: 2
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Each step's `on` map routes an outcome to the next step. A failed review sends the work back to `plan` at most twice:
|
|
76
|
+
|
|
77
|
+
```mermaid
|
|
78
|
+
flowchart LR
|
|
79
|
+
plan -->|passed| review[review-arch]
|
|
80
|
+
plan -->|failed| failed([failed])
|
|
81
|
+
review -->|passed| completed([completed])
|
|
82
|
+
review -->|failed, at most 2 times| plan
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## 2. Validate the workflow
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
kxm init
|
|
89
|
+
kxm workflow definitions
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Expected output:
|
|
93
|
+
|
|
94
|
+
```text
|
|
95
|
+
validated KXM project at <repo-root>
|
|
96
|
+
WORKFLOW DEFINITIONS:
|
|
97
|
+
default [local] 3 steps (roles: coordinator, implementer) Plan, implement, and verify a local change.
|
|
98
|
+
first [local] 2 steps (roles: coordinator) Plan a change, then review the plan. Both steps run as the coordinator agent and only read the repository.
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
If a file is invalid, `kxm init` exits 1 and prints one `<file>: <code>: <message>` line per problem.
|
|
102
|
+
|
|
103
|
+
## 3. Review the change and commit it
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
kxm trust diff
|
|
107
|
+
kxm trust check
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Expected output of `kxm trust diff`:
|
|
111
|
+
|
|
112
|
+
```text
|
|
113
|
+
permission diff: sha256:<old-revision>… -> sha256:<new-revision>…
|
|
114
|
+
EXPANSION .kxm/workflows/first.yaml added (expansion)
|
|
115
|
+
1 expansion(s) require explicit reviewed trust action
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`kxm trust check` prints the same lines, adds `trust check failed: review every expansion above before merging`, and exits 1. A new workflow is an [expansion](../glossary.md#expansion) of what agents may do, so read it: which agents run each step, and what access each step has to each repository. When you agree with it, commit it yourself:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
git add .kxm/workflows/first.yaml
|
|
122
|
+
git commit -m "Add the first workflow"
|
|
123
|
+
kxm trust check
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Expected output:
|
|
127
|
+
|
|
128
|
+
```text
|
|
129
|
+
permission diff: sha256:<revision>… -> sha256:<revision>…
|
|
130
|
+
no authority-bearing or prose changes
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
> [!IMPORTANT]
|
|
134
|
+
> Your reviewed commit is the approval. `kxm trust` has only `diff` and `check`, and no command approves an expansion for you.
|
|
135
|
+
|
|
136
|
+
## 4. Plan the run
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
kxm run first "Plan a hello script" --dry-run
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Expected output:
|
|
143
|
+
|
|
144
|
+
```text
|
|
145
|
+
run plan: workflow first at sha256:<revision>… (no run created)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The hash is the project's configuration revision, the same one `kxm trust diff` prints; a run pins it. Keep secrets out of run prompts.
|
|
149
|
+
|
|
150
|
+
## 5. Create the run
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
kxm run first "Plan a hello script"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Expected output:
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
run created: run_<id> (home rtm_<id>…, config sha256:<revision>…)
|
|
160
|
+
drive it model-free: kxm runs drive run_<id> --simulated --wait (or cancel: kxm runs cancel run_<id>)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`kxm run` starts the Runtime supervisor if it is not running. Check the new run, using the run ID from the output:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
kxm runs status run_<id>
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Expected output:
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
run run_<id>: created (workflow first, updated <timestamp>)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## 6. Drive the run
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
kxm runs drive run_<id> --simulated --wait
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Expected output, one line:
|
|
182
|
+
|
|
183
|
+
```text
|
|
184
|
+
{"budget":null,"closedAt":"<timestamp>","driveId":"drv_<id>","homeRuntimeId":"rtm_<id>","lastSequence":41,"logHash":"sha256:[redacted]","mode":"simulated","openedAt":"<timestamp>","openedSequence":4,"producer":{"closed":false,"id":"driver-simulated"},"projectId":"prj_<id>","runId":"run_<id>","schema":"kxm.drive-receipt.v1","settlement":{"kind":"terminal","reason":"","status":"completed"}}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The simulated producer answers every agent step with `passed` and calls no model or harness, so the run moves from `plan` to `review-arch` to `completed`. `--wait` blocks until the [drive receipt](../glossary.md#drive-receipt) is recorded, for 60 seconds by default (`--timeout-ms`, up to 600000), and exits 0 only for a verified completed run.
|
|
188
|
+
|
|
189
|
+
## 7. Check the result
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
kxm runs status run_<id>
|
|
193
|
+
kxm runs receipt run_<id>
|
|
194
|
+
kxm runs list
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Expected output:
|
|
198
|
+
|
|
199
|
+
```text
|
|
200
|
+
run run_<id>: completed (workflow first, updated <timestamp>)
|
|
201
|
+
drive drv_<id>: completed (receipt verified)
|
|
202
|
+
{"kind":"terminal","reason":"","status":"completed"}
|
|
203
|
+
run_<id> completed first <timestamp>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
`receipt verified` means the Runtime checked the drive receipt against the run's event log.
|
|
207
|
+
|
|
208
|
+
## 8. Stop the Runtime supervisor
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
kxm runtime stop
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Expected output:
|
|
215
|
+
|
|
216
|
+
```text
|
|
217
|
+
runtime supervisor rtm_<id> stopping
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
You have added, reviewed, run and verified a workflow.
|
|
221
|
+
|
|
222
|
+
## Understand the workflow
|
|
223
|
+
|
|
224
|
+
### What the file says
|
|
225
|
+
|
|
226
|
+
The file is a `kxm.workflow.v1` definition. `coordinator` names the agent that owns the run, and `limits.maxTransitions` caps the step-to-step moves one run may make. Each step has an `id`, a `kind` (`agent` here), the `agent` that performs it, a `maxAttempts` limit, access per repository (`none`, `read` or `write`, at most the agent's own), and an `on` map that routes each outcome to the next step or to `$terminal` with a `terminalStatus`. A transition back to an earlier step needs its own `maxTransitions`.
|
|
227
|
+
|
|
228
|
+
[Workflow files](../reference/config-reference.md#kxmworkflowsidyaml-kxmworkflowv1) lists every field, its limits and its error codes, and the [worked example](../reference/config-reference.md#worked-example-a-minimal-two-step-project) shows a workflow written by hand. The [Workflow definition reference](../reference/workflow-definitions.md) compares the two kinds of workflow KXM runs.
|
|
229
|
+
|
|
230
|
+
### Other templates
|
|
231
|
+
|
|
232
|
+
`kxm workflow add` has three built-in templates. Add `--dry-run` to see the path without writing the file.
|
|
233
|
+
|
|
234
|
+
| Template | Steps | Use it for |
|
|
235
|
+
|---|---|---|
|
|
236
|
+
| `spec-and-plan` | `plan`, then `review-arch`, both run by the `coordinator` agent with read-only access | A first workflow: it writes nothing and runs no test command |
|
|
237
|
+
| `implement-and-verify` | `implement`, then the `test` gate; a failing gate sends the work back to `implement` | Changes checked by your test command |
|
|
238
|
+
| `dual-critic-review` | `implement`, two reviews, then the `test` gate | Changes that need two reviews before the tests |
|
|
239
|
+
|
|
240
|
+
### Simulated and live drives
|
|
241
|
+
|
|
242
|
+
`--simulated` replaces model calls, not your commands. Gate steps run their command from `.kxm/gates.yaml` in both modes, so a failing test fails the gate even in a simulated drive.
|
|
243
|
+
|
|
244
|
+
| | Simulated (`--simulated`) | Live (no flag) |
|
|
245
|
+
|---|---|---|
|
|
246
|
+
| Agent steps | Report `passed` without calling a model | Call the agent's harness in a one-shot, read-only mode |
|
|
247
|
+
| Gate steps | Run the gate's command | Run the gate's command |
|
|
248
|
+
| Needs | Nothing | An admitted route for each agent's model (`kxm routes admit`) |
|
|
249
|
+
| Non-gate steps with `write` access | Run, but change no files | Refused: the run is handed off. Gate steps are exempt |
|
|
250
|
+
| Cost | None | Model usage on your accounts |
|
|
251
|
+
|
|
252
|
+
> [!WARNING]
|
|
253
|
+
> Without `--simulated`, `kxm runs drive` calls live harnesses. An agent whose model is not an admitted route fails with `producer_route_not_admitted`. Read [Harness routing](../reference/harness-routing.md) before your first live drive. A live drive hands off any agent, panel, approval or wait step with `write` access; gate steps are exempt, and the read-only `spec-and-plan` template avoids the refusal.
|
|
254
|
+
|
|
255
|
+
### Why not the `default` workflow
|
|
256
|
+
|
|
257
|
+
`kxm init` also writes a `default` workflow that plans, implements and runs the test gate. It declares `limits.maxAgentTimeMs`, an agent-time budget the Runtime cannot enforce yet. A drive of it is refused with HTTP 409 `run_handoff_required` (reason `limit_unsupported`), and the run stays `preparing` until you cancel it with `kxm runs cancel <run-id>`. [Steps the Runtime does not execute yet](../reference/config-reference.md#steps-the-runtime-does-not-execute-yet) lists every setting that causes a handoff.
|
|
258
|
+
|
|
259
|
+
### Two kinds of runs
|
|
260
|
+
|
|
261
|
+
`kxm run` and `kxm runs` manage Runtime runs like this one. A hub workflow run is different: a signed webhook or `kxm workflow start` creates it, and `kxm workflow list` and the `kxm_workflow_*` tools show it. `kxm workflow list` never shows a Runtime run. See [Run webhook workflows](../guides/webhook-workflows.md).
|
|
262
|
+
|
|
263
|
+
## Troubleshooting
|
|
264
|
+
|
|
265
|
+
| Message or symptom | Cause | Fix |
|
|
266
|
+
|---|---|---|
|
|
267
|
+
| `run_handoff_required` naming `limits.maxAgentTimeMs` | You drove the `default` workflow | Cancel the run and use `first` |
|
|
268
|
+
| `trust check failed: review every expansion above before merging` | The workflow is not committed | Review it, then commit it |
|
|
269
|
+
| `workflow <id> does not exist in this project` | The ID is not a local workflow | Use an ID from `kxm workflow definitions` marked `[local]` |
|
|
270
|
+
| `gate_outcome_impossible` from `kxm init` | A gate step routes failure on `failed` | Declare `implementation-failure` on the gate step |
|
|
271
|
+
| `--wait` exits 1 with settlement `failed` | A step failed, for example a gate that kept failing (`budget_edge`) | Read the reason with `kxm runs receipt run_<id>`, then fix the step or the command |
|
|
272
|
+
| A run stays `preparing` or `running` | The run was handed off | Run `kxm runs cancel run_<id>` |
|
|
273
|
+
|
|
274
|
+
## Next steps
|
|
275
|
+
|
|
276
|
+
- Let Claude do it in your next project. With the [Claude Code plugin](quickstart-claude-code.md) installed, the `kxm-project-setup` skill runs `kxm init`, then `kxm workflow add first --template spec-and-plan`, the trust checks and a simulated drive. It stops twice for you to review and commit `.kxm/`: after `kxm init`, and after it adds the workflow. Claude never commits `.kxm/` itself, and tokens, starting the hub and the plugin's configuration stay with you.
|
|
277
|
+
|
|
278
|
+
In Claude Code:
|
|
279
|
+
|
|
280
|
+
```text
|
|
281
|
+
Set up KXM in this repository and run a first workflow.
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
- Learn from runs: `kxm improve report` proposes improvement candidates from live runs. It leaves simulated attempts out, so for now it reports `0 record(s)`. See [Continuous improvement](../guides/continuous-improvement.md).
|
|
285
|
+
- Give agents project context: Claude calls `kxm_context` with its role and task before planning. See [Context and memory](../guides/context-and-memory.md).
|
|
286
|
+
- Watch agents and workflows live with `kxm dash`: [Monitor KXM](../operations/monitoring.md#watch-live-work-with-kxm-dash).
|
|
287
|
+
- Write richer workflows: [Workflow catalog](../reference/workflow-catalog.md) and [Workflow definition reference](../reference/workflow-definitions.md).
|