@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
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
# Assignment runner maintainer guide
|
|
2
|
-
|
|
3
|
-
> **Status.** The assignment runner (`scripts/assignment-run.mjs`, `just assign`)
|
|
4
|
-
> is the developer orchestration policy and verification runner for issue 127.
|
|
5
|
-
> It manages native developer assignments, deterministic witness verification,
|
|
6
|
-
> and multi-vendor dual-critic acceptance. It is not the runtime workflow
|
|
7
|
-
> engine (`kxm run`), an agent RPC worker (`kxm agent worker`), or a Phase 11
|
|
8
|
-
> dispatch adapter.
|
|
9
|
-
|
|
10
|
-
This guide explains how maintainers run, verify, attribute, and accept
|
|
11
|
-
assignments, as well as the safety invariants enforced by the developer roster
|
|
12
|
-
policy.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## 1. Overview and role rotation
|
|
17
|
-
|
|
18
|
-
Developer orchestration on this runner uses a role-based rotation backed by
|
|
19
|
-
trusted policy in [`.kxm/roster.yaml`](../.kxm/roster.yaml). Roles, harnesses,
|
|
20
|
-
and models are admitted with strict permission and vendor boundaries:
|
|
21
|
-
|
|
22
|
-
| Role | Admitted route | Vendor | Permission | Purpose |
|
|
23
|
-
|---|---|---|---|---|
|
|
24
|
-
| **`writer`** | `grok` / `grok-4.6`, `pi` / `openrouter/qwen/qwen3-coder-plus` | `xai`, `alibaba` | `edit` | Native code authoring. Grok is the default rotation; Qwen on Pi is admitted relief. |
|
|
25
|
-
| **`planner`** | `claude` / `fable` | `anthropic` | `read-only` | Architectural planning and permission boundaries. |
|
|
26
|
-
| **`reviewer-arch`** | `claude` / `fable` | `anthropic` | `read-only` | Architecture, permission, and safety review. |
|
|
27
|
-
| **`reviewer-cli`** | `codex` / `gpt-5.6-sol` | `openai` | `read-only` | CLI surface, documentation, and interface review. |
|
|
28
|
-
|
|
29
|
-
### Core principles
|
|
30
|
-
|
|
31
|
-
- **Independent critics:** Acceptance requires independent review from
|
|
32
|
-
different providers. The writer and each critic must have distinct canonical
|
|
33
|
-
vendors (`xai` / `alibaba`, `anthropic`, `openai`).
|
|
34
|
-
- **Fail-closed dispatch:** Route validation fails closed with `route_invalid` if
|
|
35
|
-
a requested harness/model is not in the admitted role lineup, or if permissions
|
|
36
|
-
exceed the admitted ceiling (e.g. attempting to give edit permissions to a
|
|
37
|
-
read-only reviewer).
|
|
38
|
-
- **Trusted roster policy:** Dispatch (`assign` / `run`) and accept load
|
|
39
|
-
`.kxm/roster.yaml` through the trusted control Git loader
|
|
40
|
-
(`loadTrustedRosterPolicy`). Loader errors, missing/empty policy, and
|
|
41
|
-
malformed policy fail closed with `route_invalid`. There is no raw working-tree
|
|
42
|
-
JSON fallback and no null-policy acceptance. Tests may inject an explicit
|
|
43
|
-
policy object; that seam is not a CLI or environment bypass. The witness
|
|
44
|
-
verifies the bound candidate against the fixed gate (`npm run verify`) and
|
|
45
|
-
does not itself call the policy loader today. Unified YAML
|
|
46
|
-
role/project/workflow authority is still open and is not this runner's live
|
|
47
|
-
source. Passive `schemas/policy-draft` / `validatePolicyDraft` scaffolding is
|
|
48
|
-
not operator settings and is not admission.
|
|
49
|
-
- **Deterministic witness beats extra models:** Implementers run `npm run verify`.
|
|
50
|
-
Root re-runs the fixed witness. Reviewers verify candidate trees; they do not
|
|
51
|
-
replace tests.
|
|
52
|
-
- **Closed schemas:** `accepted.json` (`kxm.task-accepted.v1`) and
|
|
53
|
-
`completion.json` (`kxm.assignment-completion.v1`) schemas are closed. Do not
|
|
54
|
-
add ad-hoc properties.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## 2. The developer loop
|
|
59
|
-
|
|
60
|
-
> **Environment.** These recipes do **not** auto-load a `.env` from the working
|
|
61
|
-
> directory, and neither the source text nor `just --dump` is allowed to enable it. An
|
|
62
|
-
> untracked, gitignored file must not be able to set `NODE_OPTIONS`
|
|
63
|
-
> and execute code before the runner validates anything — `just --dotenv-path /abs/.env assign …` is the explicit
|
|
64
|
-
> opt-in (`--dotenv-path` both selects and locates the file in `just` 1.58). Arguments are passed
|
|
65
|
-
> positionally and quoted, so a path is never re-read as shell source; the runner's
|
|
66
|
-
> absolute-path requirement is a separate validation rule, not what makes quoting
|
|
67
|
-
> safe. `accept` prints JSON by default but takes no `--json` flag, and its optional
|
|
68
|
-
> `--observed-pr` / `--observed-ci` need the direct script form shown in Step 5.
|
|
69
|
-
|
|
70
|
-
The standard progression follows a slim four-step lifecycle:
|
|
71
|
-
|
|
72
|
-
```text
|
|
73
|
-
plan-current ──> assign (writer) ──> witness ──> review (arch + cli) ──> accept
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Do not run the 13-stage `/fix` workflow for daily developer tasks or docs.
|
|
77
|
-
|
|
78
|
-
### Step 1: Current plan pointer
|
|
79
|
-
|
|
80
|
-
Every assignment binds to an explicit plan reference. When working against the
|
|
81
|
-
active plan, stamp or update the pointer:
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
just plan-current /abs/task-dir /abs/plan.md <sha256> <base-commit> <expected-generation>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
The pointer is recorded as `plan-current.json` (`kxm.plan-pointer.v1`) in the
|
|
88
|
-
task directory.
|
|
89
|
-
|
|
90
|
-
### Step 2: Dispatch assignment
|
|
91
|
-
|
|
92
|
-
Create an assignment manifest (`kxm.assignment.v1`) specifying the task id,
|
|
93
|
-
assignment id, kind (`implement`, `review-arch`, `review-cli`), admitted route,
|
|
94
|
-
clean or staged base commit, and deliverables contract.
|
|
95
|
-
|
|
96
|
-
Dispatch using:
|
|
97
|
-
|
|
98
|
-
```bash
|
|
99
|
-
just assign /absolute/path/to/manifest.json
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Under the hood:
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
node scripts/assignment-run.mjs run --manifest /absolute/path/to/manifest.json
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
- Manifest validation asserts worktree cleanliness and validates the route
|
|
109
|
-
against `.kxm/roster.yaml`.
|
|
110
|
-
- Headless execution dispatches to the native harness (or OpenRouter via Pi for
|
|
111
|
-
admitted relief).
|
|
112
|
-
- Successful runs write `completion.json`, candidate snapshot metadata, and
|
|
113
|
-
private sidecars under the assignment record directory.
|
|
114
|
-
|
|
115
|
-
### Step 3: Run the verification witness
|
|
116
|
-
|
|
117
|
-
After the writer completes code changes, execute the fixed verification
|
|
118
|
-
witness:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
just witness /absolute/path/to/record-dir
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Under the hood:
|
|
125
|
-
|
|
126
|
-
```bash
|
|
127
|
-
node scripts/assignment-run.mjs witness --record-dir /absolute/path/to/record-dir
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
The witness executes the fixed gate (`npm run verify`) in the workspace, hashes
|
|
131
|
-
the index and worktree states, and records `witness-receipt.json`
|
|
132
|
-
(`kxm.assignment-witness.v1`). Acceptance requires a witness receipt with
|
|
133
|
-
`result: "passed"`.
|
|
134
|
-
|
|
135
|
-
### Step 4: Dispatch critics
|
|
136
|
-
|
|
137
|
-
Dispatch both designated critics against the candidate index tree:
|
|
138
|
-
|
|
139
|
-
1. **Architecture review (`review-arch`):** Claude Fable (`fable`, read-only).
|
|
140
|
-
2. **CLI & docs review (`review-cli`):** Codex Sol (`gpt-5.6-sol`, read-only).
|
|
141
|
-
|
|
142
|
-
Each review produces its own record directory containing `completion.json` with
|
|
143
|
-
a structured critic verdict (`PASS` or `BLOCK`) bound to the reviewed tree.
|
|
144
|
-
|
|
145
|
-
### Step 5: Acceptance
|
|
146
|
-
|
|
147
|
-
Once the writer passes the witness, changes are committed to Git, and both
|
|
148
|
-
critics have rendered `PASS` verdicts:
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
just accept /abs/task-dir <commit-sha> /abs/writer-record /abs/arch-review /abs/cli-review
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Under the hood:
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
node scripts/assignment-run.mjs accept \
|
|
158
|
-
--task-dir /abs/task-dir \
|
|
159
|
-
--commit <commit-sha> \
|
|
160
|
-
--record-dir /abs/writer-record \
|
|
161
|
-
--critic /abs/arch-review \
|
|
162
|
-
--critic /abs/cli-review \
|
|
163
|
-
[--observed-pr <pr-id>] \
|
|
164
|
-
[--observed-ci <ci-id>]
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
`accept` validates all acceptance invariants:
|
|
168
|
-
|
|
169
|
-
1. Trusted roster policy is loaded and valid **before** acceptance artifacts are
|
|
170
|
-
written. Failure to obtain required policy refuses acceptance.
|
|
171
|
-
2. The commit exists and its tree matches the witness index tree.
|
|
172
|
-
3. The writer record matches the latest passed witness.
|
|
173
|
-
4. Both required critic roles (`review-arch` and `review-cli`) are present.
|
|
174
|
-
5. Both critics judged the exact accepted tree and issued `PASS`.
|
|
175
|
-
6. No unresolved `BLOCK` review exists for the tree in the task directory (unless
|
|
176
|
-
superseded by an unbroken `rework_of` lineage).
|
|
177
|
-
7. The writer and all critics satisfy pairwise vendor independence.
|
|
178
|
-
8. Writes `accepted.json` (`kxm.task-accepted.v1`) into the task directory.
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
## 3. Attribution and cost tracking
|
|
183
|
-
|
|
184
|
-
### Private attribution notes
|
|
185
|
-
|
|
186
|
-
When friction, environment issues, or model regressions occur, record private
|
|
187
|
-
handoff notes without altering closed completion schemas:
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
just attribute /abs/task-dir /abs/record-dir <class> /abs/note.txt
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
- Allowed classifications: `orchestration`, `model`, `environment`,
|
|
194
|
-
`unclassified`.
|
|
195
|
-
- Appends an immutable attribution entry in the task's attribution history.
|
|
196
|
-
|
|
197
|
-
### Historical cost observation
|
|
198
|
-
|
|
199
|
-
For manual bootstrap runs or unmetered subscription sessions where native
|
|
200
|
-
telemetry was not captured directly:
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
just observe-cost /abs/task-dir /abs/observation.json
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
Imports a `kxm.cost-observation.v1` record. Cost observations are strictly
|
|
207
|
-
cost-only; they cannot authorize acceptance or mint witness proof.
|
|
208
|
-
|
|
209
|
-
### Unified change report
|
|
210
|
-
|
|
211
|
-
Generate a consolidated change and cost summary for a task:
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
just change-report /abs/task-dir
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
The change report cleanly separates:
|
|
218
|
-
|
|
219
|
-
- Provider-reported metered spend vs list price estimates.
|
|
220
|
-
- Unmetered subscriptions (e.g. Claude Code or Codex subscription) vs unknown.
|
|
221
|
-
- Token counts, elapsed wall time, witness durations, and attempt counts.
|
|
222
|
-
- Failed or interrupted attempts (never silently omitted or zeroed).
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
## 4. Safety invariants and failure codes
|
|
227
|
-
|
|
228
|
-
The runner fails closed with bounded error codes defined in `RUNNER_CODES`:
|
|
229
|
-
|
|
230
|
-
| Code | Trigger condition | Remedy |
|
|
231
|
-
|---|---|---|
|
|
232
|
-
| `route_invalid` | Harness/model not admitted in lineup for the requested role, permission exceeds route ceiling, or trusted roster policy cannot be loaded/validated. | Use a trusted clean control checkout; do not dispatch from a dirty implementation branch. Check `.kxm/roster.yaml` lineup and permissions for the role. |
|
|
233
|
-
| `critic_invalid` | Missing required critic role, duplicate roles, wrong model, or vendor collision between writer and critics. | Ensure independent critics (Fable + Sol) from distinct providers. |
|
|
234
|
-
| `critic_block` | An unresolved `BLOCK` verdict exists for the target tree. | Rework the changes, address findings, and pass review with a `rework_of` link. |
|
|
235
|
-
| `commit_tree_mismatch` | Git commit tree does not equal the witnessed tree. | Commit the exact candidate tree verified by the witness before running accept. |
|
|
236
|
-
| `witness_failed` | Fixed gate (`npm run verify`) returned a non-zero exit code. | Fix code, typecheck, lint, or test failures and re-witness. |
|
|
237
|
-
| `witness_binding_invalid` | Writer transport incomplete, wrong deliverables boundary, or writer route unadmitted. | Re-run writer assignment through admitted rotation route. |
|
|
238
|
-
| `accepted_exists` | `accepted.json` is already present in the task directory. | Acceptance records are immutable; use a new task directory for new units. |
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## 5. File layout in task directories
|
|
243
|
-
|
|
244
|
-
A completed task directory contains:
|
|
245
|
-
|
|
246
|
-
```text
|
|
247
|
-
<task-dir>/
|
|
248
|
-
├── plan-current.json # Active plan pointer (kxm.plan-pointer.v1)
|
|
249
|
-
├── plan-current.md # Current plan markdown
|
|
250
|
-
├── accepted.json # Final acceptance proof (kxm.task-accepted.v1)
|
|
251
|
-
├── asg-writer-1/ # Writer assignment record directory
|
|
252
|
-
│ ├── manifest.json # Bound input manifest (kxm.assignment.v1)
|
|
253
|
-
│ ├── prompt.txt # Rendered assignment prompt
|
|
254
|
-
│ ├── completion.json # Completion record (kxm.assignment-completion.v1)
|
|
255
|
-
│ ├── witness-receipt.json # Deterministic gate witness receipt
|
|
256
|
-
│ └── telemetry.jsonl # Usage, latency, and cost telemetry
|
|
257
|
-
├── asg-review-arch/ # Architecture critic record directory
|
|
258
|
-
│ ├── manifest.json
|
|
259
|
-
│ └── completion.json # Contains critic PASS verdict
|
|
260
|
-
├── asg-review-cli/ # CLI critic record directory
|
|
261
|
-
│ ├── manifest.json
|
|
262
|
-
│ └── completion.json # Contains critic PASS verdict
|
|
263
|
-
└── runner-errors.jsonl # Diagnostic log of bounded failure codes
|
|
264
|
-
```
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
schema: "kxm.doc.v1"
|
|
3
|
-
id: "GUIDE-BROWSER-001"
|
|
4
|
-
type: "guide"
|
|
5
|
-
title: "KXM Browser Automation Guide"
|
|
6
|
-
project: "kxm"
|
|
7
|
-
status: "accepted"
|
|
8
|
-
owner: "@operator"
|
|
9
|
-
created: "2026-09-14"
|
|
10
|
-
updated: "2026-09-15"
|
|
11
|
-
authority: "instruction"
|
|
12
|
-
confidence: "verified"
|
|
13
|
-
summary: "Comprehensive guide to browser automation in KXM using self-hosted Steel on DOKS, agent-browser, Playwright, pass-cli, and human takeover."
|
|
14
|
-
tags: ["browser", "automation", "steel", "playwright", "agent-browser", "doks"]
|
|
15
|
-
related: ["docs/adr/ADR-0002-browser-automation-steel-doks.md", "docs/agent-skills.md"]
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# KXM Browser Automation Guide
|
|
19
|
-
|
|
20
|
-
This guide describes how to use KXM's browser automation capability powered by self-hosted Steel on DigitalOcean Kubernetes (DOKS), `agent-browser` for exploratory inspection, `Playwright` for automated regression testing, and `pass-cli` for credential security.
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 1. Architecture & Trust Boundaries
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
Herdr / Pi / Agent Harness
|
|
28
|
-
│
|
|
29
|
-
├──► KXM Browser Skills & Prompts (kxm-browser-*)
|
|
30
|
-
│
|
|
31
|
-
├──► pass-cli (Authoritative Vault: "AI Provider Keys")
|
|
32
|
-
│
|
|
33
|
-
├──► agent-browser (Exploratory CLI) ──┐
|
|
34
|
-
│ │ (CDP WebSocket)
|
|
35
|
-
├──► Playwright (E2E Test Suites) ────┼──► DOKS Steel Browser Cluster
|
|
36
|
-
│ │ (https://steel.kontextmind.com)
|
|
37
|
-
└──► Human Operator (Takeover UI) ─────┘ (https://steel.kontextmind.com/ui)
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Key Components
|
|
41
|
-
|
|
42
|
-
1. **Steel on DOKS (`https://steel.kontextmind.com`)**:
|
|
43
|
-
- Primary browser execution environment.
|
|
44
|
-
- Isolated Chromium containers with dedicated shared memory (`/dev/shm`).
|
|
45
|
-
- Exposed endpoints: REST API (port 443 / 3000), CDP WebSocket proxy (port 443 / 9223), Web UI (`/ui`), OpenAPI docs (`/documentation`).
|
|
46
|
-
2. **`pass-cli`**:
|
|
47
|
-
- The authoritative store for all long-lived passwords, session tokens, and the `STEEL_API_KEY`.
|
|
48
|
-
- Never write credentials to tracked git files.
|
|
49
|
-
3. **`agent-browser`**:
|
|
50
|
-
- Fast, token-efficient terminal CLI for accessibility snapshots, interactive navigation, and exploratory testing.
|
|
51
|
-
4. **`Playwright`**:
|
|
52
|
-
- High-fidelity assertion engine for bug reproduction, visual proofs, and permanent regression suites.
|
|
53
|
-
|
|
54
|
-
---
|
|
55
|
-
|
|
56
|
-
## 2. Getting Started: The First Browser Workflow
|
|
57
|
-
|
|
58
|
-
### Step 1: Verify Prerequisites
|
|
59
|
-
|
|
60
|
-
Check that `pass-cli` can access the Steel configuration:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
pass-cli item view --vault-name "AI Provider Keys" --item-title "Steel Browser (KontextMind DOKS)"
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Step 2: Launch a Steel Browser Session
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
STEEL_KEY=$(pass-cli item view --vault-name "AI Provider Keys" --item-title "Steel Browser (KontextMind DOKS)" --field STEEL_API_KEY)
|
|
70
|
-
|
|
71
|
-
# Create a 5-minute session
|
|
72
|
-
SESSION_RESP=$(curl -s -X POST https://steel.kontextmind.com/v1/sessions \
|
|
73
|
-
-H "Content-Type: application/json" \
|
|
74
|
-
-H "x-steel-api-key: $STEEL_KEY" \
|
|
75
|
-
-d '{"timeout": 300000}')
|
|
76
|
-
|
|
77
|
-
SESSION_ID=$(echo "$SESSION_RESP" | jq -r .id)
|
|
78
|
-
echo "Session created: $SESSION_ID"
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### Step 3: Run Exploratory Automation or Scrapes
|
|
82
|
-
|
|
83
|
-
To run a fast scrape without managing sessions:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
curl -s -X POST https://steel.kontextmind.com/v1/scrape \
|
|
87
|
-
-H "Content-Type: application/json" \
|
|
88
|
-
-H "x-steel-api-key: $STEEL_KEY" \
|
|
89
|
-
-d '{"url": "https://example.com"}'
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Step 4: Release the Session
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
curl -s -X POST https://steel.kontextmind.com/v1/sessions/$SESSION_ID/release \
|
|
96
|
-
-H "x-steel-api-key: $STEEL_KEY"
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## 3. Human Takeover Protocol
|
|
102
|
-
|
|
103
|
-
When authentication challenges (MFA, CAPTCHA, SSO) are encountered:
|
|
104
|
-
|
|
105
|
-
1. **Agent Pauses**: The agent stops automated actions and sets state to `HUMAN_CONTROL`.
|
|
106
|
-
2. **Emits Link**: Emits the protected URL: `https://steel.kontextmind.com/ui?sessionId=<SESSION_ID>`.
|
|
107
|
-
3. **Human Interacts**: The operator opens the session viewer, completes the login/MFA action, and confirms in the terminal (`auth complete`).
|
|
108
|
-
4. **Agent Verifies**: The agent inspects the resulting page, confirms dashboard/user state, refreshes DOM observations, and returns to `AGENT_CONTROL`.
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## 4. Resource Controls & Cost Safety
|
|
113
|
-
|
|
114
|
-
- **Session Timeouts**: Default 300s (5m), max 1800s (30m). Sessions terminate automatically on expiry.
|
|
115
|
-
- **Orphan Sweeping**: Periodically sweep untracked sessions via `GET /v1/sessions` and release idle processes.
|
|
116
|
-
- **Memory Protection**: Kubernetes mounts a 2Gi `emptyDir` memory volume at `/dev/shm` to prevent Chromium tab crashes without exhausting node memory.
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
## Knowledge base
|
|
121
|
-
|
|
122
|
-
- [How are credentials retrieved without exposing them to the model?](kb/how-credentials-retrieved-safely.md)
|
|
123
|
-
- [How do I capture a UI section and annotate changes for an agent?](kb/how-to-capture-and-annotate-section.md)
|
|
124
|
-
- [How do I connect Playwright to the existing Steel session?](kb/how-to-connect-playwright-to-steel.md)
|
|
125
|
-
- [How do I recover an expired session or remove an orphaned browser?](kb/how-to-recover-expired-session-or-orphan.md)
|
|
126
|
-
- [How does an agent resume after MFA?](kb/how-to-resume-after-mfa.md)
|
|
127
|
-
- [How do I take over a browser session to log in?](kb/how-to-take-over-session.md)
|
|
128
|
-
- [Why did authentication disappear?](kb/why-authentication-disappeared.md)
|
|
129
|
-
- [Why did automation open a different browser?](kb/why-automation-opened-different-browser.md)
|
|
130
|
-
- [Why can I view a session but not control it?](kb/why-session-viewer-cannot-control.md)
|
|
131
|
-
|
|
132
|
-
## Prompt templates
|
|
133
|
-
|
|
134
|
-
- [Starting browser work](prompts/browser-start.md)
|
|
135
|
-
- [Exploring an application](prompts/browser-explore.md)
|
|
136
|
-
- [Requesting human takeover](prompts/browser-takeover.md)
|
|
137
|
-
- [Diagnosing and recovering a failed session](prompts/browser-diagnose-recover.md)
|
|
138
|
-
- [Reproducing a UI bug and writing a Playwright test](prompts/browser-repro-fix.md)
|
|
139
|
-
- [Capturing UI section annotations](prompts/browser-annotate-feedback.md)
|