@kontextmind/kxm 0.6.0 → 0.7.10

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.
Files changed (175) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.kxm/agents/coordinator.yaml +9 -0
  3. package/.kxm/agents/critic-arch.yaml +13 -0
  4. package/.kxm/agents/critic-cli.yaml +13 -0
  5. package/.kxm/agents/implementer.yaml +13 -0
  6. package/.kxm/gates.yaml +8 -0
  7. package/.kxm/producers.yaml +22 -0
  8. package/.kxm/project.yaml +15 -0
  9. package/.kxm/roles/writer.yaml +7 -0
  10. package/.kxm/workflows/default.yaml +47 -0
  11. package/CHANGELOG.md +39 -7
  12. package/README.md +1 -0
  13. package/docs/README.md +5 -0
  14. package/docs/adr/ADR-0002-browser-automation-steel-doks.md +103 -0
  15. package/docs/agent-skills.md +135 -0
  16. package/docs/architecture.md +1 -1
  17. package/docs/assignment-runner.md +21 -8
  18. package/docs/browser-automation.md +116 -0
  19. package/docs/configuration.md +11 -2
  20. package/docs/getting-started.md +21 -0
  21. package/docs/kb/how-credentials-retrieved-safely.md +31 -0
  22. package/docs/kb/how-to-capture-and-annotate-section.md +60 -0
  23. package/docs/kb/how-to-connect-playwright-to-steel.md +54 -0
  24. package/docs/kb/how-to-recover-expired-session-or-orphan.md +54 -0
  25. package/docs/kb/how-to-resume-after-mfa.md +28 -0
  26. package/docs/kb/how-to-take-over-session.md +32 -0
  27. package/docs/kb/why-authentication-disappeared.md +32 -0
  28. package/docs/kb/why-automation-opened-different-browser.md +32 -0
  29. package/docs/kb/why-session-viewer-cannot-control.md +31 -0
  30. package/docs/kxm-handbook.md +3 -3
  31. package/docs/operations.md +24 -0
  32. package/docs/operator-pi-packages.md +63 -0
  33. package/docs/prompts/browser-annotate-feedback.md +41 -0
  34. package/docs/prompts/browser-diagnose-recover.md +38 -0
  35. package/docs/prompts/browser-explore.md +42 -0
  36. package/docs/prompts/browser-repro-fix.md +48 -0
  37. package/docs/prompts/browser-start.md +41 -0
  38. package/docs/prompts/browser-takeover.md +50 -0
  39. package/docs/skills/repo-work-delivery.md +107 -0
  40. package/docs/skills.md +2 -0
  41. package/docs/test-matrix.md +4 -3
  42. package/docs/troubleshooting.md +41 -1
  43. package/docs/vnext/validation.md +9 -0
  44. package/docs/webhook-workflows.md +2 -2
  45. package/examples/README.md +1 -1
  46. package/package.json +16 -17
  47. package/plugins/kxm/.claude-plugin/plugin.json +1 -1
  48. package/plugins/kxm/README.md +1 -1
  49. package/plugins/kxm/dist/cli.js +41620 -35578
  50. package/plugins/kxm/dist/core.js +271 -34
  51. package/plugins/kxm/dist/extension.js +7759 -86
  52. package/plugins/kxm/dist/mcp-server.js +75 -21
  53. package/plugins/kxm/dist/runtime.js +8218 -2328
  54. package/plugins/kxm/dist/server.js +3125 -2260
  55. package/plugins/kxm/dist/vnext-runtime-supervisor.js +5961 -661
  56. package/plugins/kxm/package.json +1 -1
  57. package/plugins/kxm/skills/SUITE.md +5 -0
  58. package/plugins/kxm/skills/hints.json +103 -0
  59. package/plugins/kxm/skills/kxm/SKILL.md +30 -83
  60. package/plugins/kxm/skills/kxm-browser-annotate/SKILL.md +90 -0
  61. package/plugins/kxm/skills/kxm-browser-auth/SKILL.md +47 -0
  62. package/plugins/kxm/skills/kxm-browser-diagnostics/SKILL.md +48 -0
  63. package/plugins/kxm/skills/kxm-browser-explore/SKILL.md +48 -0
  64. package/plugins/kxm/skills/kxm-browser-session/SKILL.md +94 -0
  65. package/plugins/kxm/skills/kxm-browser-takeover/SKILL.md +87 -0
  66. package/plugins/kxm/skills/kxm-browser-verify/SKILL.md +71 -0
  67. package/plugins/kxm/skills/kxm-context-memory/SKILL.md +69 -0
  68. package/plugins/kxm/skills/kxm-definitions/SKILL.md +65 -0
  69. package/plugins/kxm/skills/kxm-harness-auth/SKILL.md +34 -0
  70. package/plugins/kxm/skills/kxm-harvest/SKILL.md +48 -0
  71. package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +43 -0
  72. package/plugins/kxm/skills/kxm-insights/SKILL.md +48 -0
  73. package/plugins/kxm/skills/kxm-mind/SKILL.md +59 -0
  74. package/plugins/kxm/skills/kxm-peer/SKILL.md +110 -0
  75. package/plugins/kxm/skills/kxm-project-setup/SKILL.md +42 -0
  76. package/plugins/kxm/skills/kxm-projects/SKILL.md +43 -0
  77. package/plugins/kxm/skills/kxm-protocol/SKILL.md +66 -0
  78. package/plugins/kxm/skills/kxm-query/SKILL.md +45 -0
  79. package/plugins/kxm/skills/kxm-routing-improve/SKILL.md +30 -0
  80. package/plugins/kxm/skills/kxm-runs/SKILL.md +29 -0
  81. package/plugins/kxm/skills/kxm-setup/SKILL.md +55 -0
  82. package/plugins/kxm/skills/kxm-skill-lifecycle/SKILL.md +31 -0
  83. package/plugins/kxm/skills/kxm-tasks/SKILL.md +33 -0
  84. package/plugins/kxm/skills/kxm-triage/SKILL.md +47 -0
  85. package/plugins/kxm/skills/kxm-work/SKILL.md +44 -0
  86. package/plugins/kxm/skills/kxm-workflow/SKILL.md +45 -0
  87. package/plugins/kxm/src/autocomplete.ts +9 -3
  88. package/plugins/kxm/src/browser.ts +603 -0
  89. package/plugins/kxm/src/cli/context-skills.ts +373 -0
  90. package/plugins/kxm/src/cli/hub.ts +614 -0
  91. package/plugins/kxm/src/cli/roles.ts +615 -0
  92. package/plugins/kxm/src/cli/system.ts +906 -0
  93. package/plugins/kxm/src/cli/tasks.ts +364 -0
  94. package/plugins/kxm/src/cli/types.ts +270 -0
  95. package/plugins/kxm/src/cli/vnext.ts +698 -0
  96. package/plugins/kxm/src/cli/workflows.ts +699 -0
  97. package/plugins/kxm/src/cli.ts +362 -2849
  98. package/plugins/kxm/src/commands.ts +150 -8
  99. package/plugins/kxm/src/completion-install.ts +223 -0
  100. package/plugins/kxm/src/config.ts +7 -4
  101. package/plugins/kxm/src/context-packet.ts +172 -0
  102. package/plugins/kxm/src/database.ts +1 -1
  103. package/plugins/kxm/src/extension.ts +36 -1
  104. package/plugins/kxm/src/external-effects.ts +357 -8
  105. package/plugins/kxm/src/hub-env.ts +193 -0
  106. package/plugins/kxm/src/hub.ts +2 -4
  107. package/plugins/kxm/src/improve.ts +72 -0
  108. package/plugins/kxm/src/init-guide-setup.ts +547 -0
  109. package/plugins/kxm/src/local-snapshot.ts +1 -1
  110. package/plugins/kxm/src/mcp-server.ts +1 -1
  111. package/plugins/kxm/src/model-inventory.ts +127 -0
  112. package/plugins/kxm/src/modes.ts +348 -0
  113. package/plugins/kxm/src/policy-draft.d.mts +55 -0
  114. package/plugins/kxm/src/policy-draft.mjs +565 -0
  115. package/plugins/kxm/src/price-calc.ts +17 -18
  116. package/plugins/kxm/src/prices.ts +32 -16
  117. package/plugins/kxm/src/producers.ts +71 -0
  118. package/plugins/kxm/src/protocol.ts +111 -0
  119. package/plugins/kxm/src/restricted-yaml.d.mts +31 -0
  120. package/plugins/kxm/src/restricted-yaml.mjs +145 -0
  121. package/plugins/kxm/src/role.ts +710 -0
  122. package/plugins/kxm/src/routing.ts +99 -1
  123. package/plugins/kxm/src/runtime.ts +4 -0
  124. package/plugins/kxm/src/safety-integrity.ts +76 -0
  125. package/plugins/kxm/src/session-work.ts +9 -2
  126. package/plugins/kxm/src/sqlite.ts +76 -0
  127. package/plugins/kxm/src/ssh-remote.ts +560 -0
  128. package/plugins/kxm/src/store.ts +1 -1
  129. package/plugins/kxm/src/studio-layout.ts +660 -17
  130. package/plugins/kxm/src/subagent-control.ts +312 -0
  131. package/plugins/kxm/src/suggest.ts +7 -13
  132. package/plugins/kxm/src/telemetry.ts +82 -0
  133. package/plugins/kxm/src/tui.ts +140 -0
  134. package/plugins/kxm/src/vnext-bindings.ts +1 -1
  135. package/plugins/kxm/src/vnext-config.ts +53 -111
  136. package/plugins/kxm/src/vnext-engine-command.ts +2 -0
  137. package/plugins/kxm/src/vnext-engine.ts +214 -62
  138. package/plugins/kxm/src/vnext-harness.ts +336 -84
  139. package/plugins/kxm/src/vnext-oneshot-evidence.ts +117 -0
  140. package/plugins/kxm/src/vnext-oneshot-process.ts +187 -0
  141. package/plugins/kxm/src/vnext-oneshot-producer.ts +182 -224
  142. package/plugins/kxm/src/vnext-pi-producer.ts +11 -7
  143. package/plugins/kxm/src/vnext-runtime-store.ts +36 -2
  144. package/plugins/kxm/src/vnext-runtime-supervisor.ts +122 -5
  145. package/plugins/kxm/src/vnext-runtime.ts +14 -0
  146. package/plugins/kxm/src/workflow-manager.ts +392 -0
  147. package/plugins/kxm/src/workflow-tui.ts +255 -0
  148. package/plugins/kxm/src/workflow.ts +144 -0
  149. package/schemas/policy-draft/README.md +17 -0
  150. package/schemas/policy-draft/model.v2.schema.json +140 -0
  151. package/schemas/policy-draft/role.v2.schema.json +91 -0
  152. package/schemas/vnext/modes.schema.json +56 -0
  153. package/schemas/vnext/role.schema.json +76 -0
  154. package/schemas/vnext/run-event.schema.json +1 -0
  155. package/scripts/assignment-run.d.mts +1 -1
  156. package/scripts/assignment-run.mjs +44 -35
  157. package/scripts/check-generated.mjs +33 -9
  158. package/scripts/emit-codex-artifacts.mjs +255 -11
  159. package/scripts/harness-run.d.mts +12 -4
  160. package/scripts/harness-run.mjs +65 -17
  161. package/scripts/kxm-bump-version.mjs +146 -0
  162. package/scripts/kxm-hub.mjs +150 -2
  163. package/scripts/kxm-publish-npm.mjs +3 -1
  164. package/scripts/kxm-release-github.mjs +3 -1
  165. package/scripts/kxm.mjs +0 -0
  166. package/scripts/native-critic.d.mts +5 -0
  167. package/scripts/native-critic.mjs +60 -0
  168. package/.kxm/config/README.md +0 -5
  169. package/.kxm/config/agents.json +0 -43
  170. package/.kxm/config/env.example +0 -56
  171. package/.kxm/config/update.example.yaml +0 -9
  172. package/.kxm/config/workflows/fix.json +0 -160
  173. package/.kxm/config/workflows/jira-development.json +0 -116
  174. package/.kxm/config/workflows/provenance-quorum.json +0 -150
  175. package/.kxm/config/workflows/v04-dogfood.json +0 -72
@@ -11,7 +11,7 @@
11
11
  "name": "kxm",
12
12
  "source": "./plugins/kxm",
13
13
  "description": "Durable workflows, peer agents, and kxm tui",
14
- "version": "0.6.0",
14
+ "version": "0.7.10",
15
15
  "category": "development",
16
16
  "tags": ["kxm", "multi-agent", "workflows", "mcp"]
17
17
  }
@@ -0,0 +1,9 @@
1
+ schema: kxm.agent.v1
2
+ purpose: Coordinate the pinned workflow and emit schema-validated commands.
3
+ tools:
4
+ preset: coordinator
5
+ defaultRepositoryAccess: read
6
+ repositories:
7
+ control: read
8
+ network: provider-only
9
+ resultSchema: kxm.assignment-result.v1
@@ -0,0 +1,13 @@
1
+ schema: kxm.agent.v1
2
+ purpose: Architecture critic for the approved workflow change.
3
+ harness: claude
4
+ model:
5
+ provider: anthropic
6
+ model: fable
7
+ tools:
8
+ preset: read-only
9
+ defaultRepositoryAccess: read
10
+ repositories:
11
+ control: read
12
+ network: provider-only
13
+ resultSchema: kxm.assignment-result.v1
@@ -0,0 +1,13 @@
1
+ schema: kxm.agent.v1
2
+ purpose: CLI and verification critic for the approved workflow change.
3
+ harness: codex
4
+ model:
5
+ provider: openai
6
+ model: gpt-5.6-sol
7
+ tools:
8
+ preset: read-only
9
+ defaultRepositoryAccess: read
10
+ repositories:
11
+ control: read
12
+ network: provider-only
13
+ resultSchema: kxm.assignment-result.v1
@@ -0,0 +1,13 @@
1
+ schema: kxm.agent.v1
2
+ purpose: Implement the approved change within the declared repository scope.
3
+ harness: grok
4
+ model:
5
+ provider: xai
6
+ model: grok-4.6
7
+ tools:
8
+ preset: workspace-writer
9
+ defaultRepositoryAccess: none
10
+ repositories:
11
+ control: write
12
+ network: provider-only
13
+ resultSchema: kxm.assignment-result.v1
@@ -0,0 +1,8 @@
1
+ schema: kxm.gate-registry.v1
2
+ gates:
3
+ test:
4
+ kind: command
5
+ argv:
6
+ - npm
7
+ - test
8
+ timeoutMs: 3600000
@@ -0,0 +1,22 @@
1
+ schema: kxm.producers.v1
2
+ updatedAt: 2026-09-10T17:30:00.000Z
3
+ promoted:
4
+ - anthropic/fable
5
+ - openai/gpt-5.6-sol
6
+ - xai/grok-4.6
7
+ - openrouter/qwen/qwen3-coder-plus
8
+ demoted: []
9
+ enabled:
10
+ - anthropic/fable
11
+ - openai/gpt-5.6-sol
12
+ - xai/grok-4.6
13
+ - openrouter/qwen/qwen3-coder-plus
14
+ disabled: []
15
+ roles:
16
+ implementer:
17
+ - xai/grok-4.6
18
+ - openrouter/qwen/qwen3-coder-plus
19
+ critic-arch:
20
+ - anthropic/fable
21
+ critic-cli:
22
+ - openai/gpt-5.6-sol
@@ -0,0 +1,15 @@
1
+ schema: kxm.project.v1
2
+ id: prj_kxm_project
3
+ name: KXM
4
+ defaultWorkflow: default
5
+ defaultExecutor: local
6
+ defaultHarness: pi
7
+ repositories:
8
+ - id: control
9
+ role: control
10
+ required: true
11
+ pathHint: .
12
+ workspace:
13
+ dirtySnapshot:
14
+ untracked: ask
15
+ dirtySubmodules: fail
@@ -0,0 +1,7 @@
1
+ schema: kxm.role.v1
2
+ id: writer
3
+ roster:
4
+ - model: xai/grok-4.6
5
+ enabled: true
6
+ - model: openrouter/qwen/qwen3-coder-plus
7
+ enabled: true
@@ -0,0 +1,47 @@
1
+ schema: kxm.workflow.v1
2
+ description: Canonical 4-stage KXM delivery workflow
3
+ coordinator: coordinator
4
+ limits:
5
+ maxTransitions: 8
6
+ steps:
7
+ - id: implement
8
+ kind: agent
9
+ agent: implementer
10
+ maxAttempts: 3
11
+ on:
12
+ passed: review-arch
13
+ failed:
14
+ target: $terminal
15
+ terminalStatus: failed
16
+ - id: review-arch
17
+ kind: agent
18
+ agent: critic-arch
19
+ maxAttempts: 2
20
+ on:
21
+ passed: review-cli
22
+ failed:
23
+ target: implement
24
+ maxTransitions: 2
25
+ - id: review-cli
26
+ kind: agent
27
+ agent: critic-cli
28
+ maxAttempts: 2
29
+ on:
30
+ passed: verify
31
+ failed:
32
+ target: implement
33
+ maxTransitions: 2
34
+ - id: verify
35
+ kind: gate
36
+ gate: test
37
+ expect: pass
38
+ repositories:
39
+ control: write
40
+ maxAttempts: 2
41
+ on:
42
+ passed:
43
+ target: $terminal
44
+ terminalStatus: completed
45
+ failed:
46
+ target: implement
47
+ maxTransitions: 2
package/CHANGELOG.md CHANGED
@@ -4,15 +4,36 @@ All notable user-facing changes are documented here. The project follows [Semant
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.7.0 - 2026-09-11
8
+
7
9
  ### Added
8
10
 
9
- - **Public npm release automation unlatched (E7):** Unlatched `publish-npm` job
10
- in `.github/workflows/release.yml` with `environment: npm-publish`. Added
11
- `scripts/kxm-publish-npm.mjs` to enforce fail-closed verification: requires the
12
- GitHub release for the tag to be published (`draft: false`), validates the
13
- release asset presence and SHA-256 digest against the release manifest, and
14
- executes `npm publish --access public`. Added `publishConfig.access: "public"`
15
- in root `package.json` and unit test suite `test/core/kxm-publish-npm.test.ts`.
11
+ - **vNext Architecture Engine and Multi-Phase Isolation (Phases 0–4):**
12
+ - **Dead Route Brake (Phase 0):** Fails closed and asserts 404 on obsolete `/dispatch`
13
+ endpoint in supervisor API to eliminate legacy unmonitored dispatch routes.
14
+ - **Objective Propagation (Phase 1):** Propagates accepted run objectives into the producer
15
+ context packet with cryptographic SHA-256 hash validation against execution drift.
16
+ - **Dynamic Permission Ceilings (Phase 2):** Dynamically derives sandbox permissions from step
17
+ repository access declarations (`birthMember`), failing closed immediately on unauthorized
18
+ live write access outside declared repository scopes.
19
+ - **Pinned Route Admission & Roster Verification (Phase 3):** Strictly validates producer model
20
+ resolution (`step.model -> agent.model -> refuse`), enforcing model admission policies and role
21
+ roster alignment before birth.
22
+ - **Asynchronous Scheduler & Graceful Lifecycle (Phase 4):** Asynchronous `/drive` execution via
23
+ `VnextRunScheduler` returning `202 Accepted` with `/v1/runs/:id` poll endpoints, duplicate run
24
+ rejection (`409 Conflict`), and supervisor graceful shutdown that awaits active drives.
25
+ - **Oneshot Harness Isolation, Pricing Safety & Async Probes:**
26
+ - Standardized one-shot harness execution across Anthropic Claude, OpenAI Codex, Kimi, and Google AGY
27
+ with unmetered subscription vs metered cost separation, process stdin piping, and timeout protection.
28
+ - **Universal KontextMind Knowledge-Plane Skill Suite:**
29
+ - Portable, harness-agnostic skill suite under `.agents/skills/` including repository delivery skills,
30
+ context memory recall, and lifecycle governance.
31
+ - **Pi Workflow Progress TUI & Studio Dashboard:**
32
+ - Interactive Pi extension workflow progress terminal user interface with live status bars and web studio layout.
33
+ - **Public npm Release Automation Unlatched (E7):**
34
+ - Unlatched `publish-npm` job in `.github/workflows/release.yml` with `environment: npm-publish`.
35
+ - Added `scripts/kxm-publish-npm.mjs` verifying published GitHub release assets, digests, and
36
+ publishing to npm registry.
16
37
 
17
38
  ## 0.6.0 - 2026-09-08
18
39
 
@@ -109,6 +130,17 @@ All notable user-facing changes are documented here. The project follows [Semant
109
130
 
110
131
  ### Fixed
111
132
 
133
+ - **Windows Claude Code / npm shim detection (issue #168):** `kxm harness list`
134
+ treated Claude Code as `not_detected` when the CLI was only an npm
135
+ `claude.cmd` shim (no `claude.exe` on `PATH`). The probe now tries `.exe`,
136
+ then the allowlisted inner package `claude.exe` next to `claude.cmd`, then
137
+ `.cmd` on win32. Allowlisted `name.cmd` probes still use `shell: true` and
138
+ record `windows_shim` when that is what answered. Auth still requires
139
+ parseable `claude auth status`. Headless assignment (`just assign` /
140
+ `harness-run`) scans every PATH directory for `name.exe` before any `.cmd`
141
+ (so a user-bin `codex.cmd` cannot hide `codex.exe`), then unwraps the inner
142
+ npm `claude.exe` and Pi's `node.exe` plus `cli.js`, without running
143
+ unverified `.cmd` launchers through a shell.
112
144
  - Concurrent Runtime registry and event-store initialization now checks and
113
145
  creates the schema under one write transaction, preventing duplicate-table
114
146
  failures when a supervisor and status reader first open the same database.
package/README.md CHANGED
@@ -214,6 +214,7 @@ The hub routes messages; it does not merge contexts, choose tasks, or bypass too
214
214
  | Complete a Pi-to-Pi or Pi-to-Claude setup | [Getting started](docs/getting-started.md) |
215
215
  | Configure the hub or an agent | [Configuration reference](docs/configuration.md) |
216
216
  | Understand components and message flow | [Architecture](docs/architecture.md) |
217
+ | Learn about agent skills | [Agent Skills](docs/agent-skills.md) |
217
218
  | Run the hub responsibly | [Operations guide](docs/operations.md) |
218
219
  | Fix connection or delivery problems | [Troubleshooting](docs/troubleshooting.md) |
219
220
  | See which behaviors and examples are verified | [Test matrix](docs/test-matrix.md) |
package/docs/README.md CHANGED
@@ -8,6 +8,9 @@ This documentation is organized by task. Start with the guide that matches what
8
8
  | [Getting started](getting-started.md) | Pi and Claude Code users | Complete the first successful multi-agent exchange |
9
9
  | [Configuration](configuration.md) | Users and operators | Understand every supported setting and default |
10
10
  | [Architecture](architecture.md) | Maintainers and integrators | Learn the component boundaries and message lifecycle |
11
+ | [Agent Skills](agent-skills.md) | Users and integrators | Comprehensive skill suite covering all KXM commands with progressive disclosure |
12
+ | [Browser automation](browser-automation.md) | Developers and operators | Self-hosted Steel on DOKS, agent-browser, Playwright, pass-cli, and human takeover |
13
+ | [Skills](skills.md) | Operators and skill authors | Governed candidate lifecycle; also the [repository work delivery](skills/repo-work-delivery.md) skill |
11
14
  | [Operations](operations.md) | Hub operators | Run, monitor, secure, and recover the service |
12
15
  | [Troubleshooting](troubleshooting.md) | Everyone | Diagnose common installation and delivery failures |
13
16
  | [Test matrix](test-matrix.md) | Users and maintainers | Map features and use cases to automated evidence |
@@ -15,8 +18,10 @@ This documentation is organized by task. Start with the guide that matches what
15
18
  | [Peer provenance and quorum gates](provenance-gates.md) | Workflow authors and security reviewers | Require durable replies from eligible peer identities without overstating the trust guarantee |
16
19
  | [Continuous improvement](continuous-improvement.md) | Product and engineering leads | Turn run evidence into reviewed workflow improvements |
17
20
  | [Workflow guide](workflow-guide.md) | Workflow designers and operators | Area -> Workflow -> Stage -> Role taxonomy with documentation slugs, dated research candidates, and selection policy |
21
+ | [Templates](templates/README.md) | Workflow authors | Markdown templates for features, ADRs, reviews, runbooks, and related artifacts |
18
22
  | [Agent Envelopes & Quality Gates](agent-communication-envelopes-and-gates.md) | Multi-agent workflow engineers | Production communication envelopes, quality gates, and work loops |
19
23
  | [Assignment runner](assignment-runner.md) | Maintainers and developers | Native developer assignments, deterministic witness verification, and multi-vendor dual-critic acceptance |
24
+ | [This host's Pi packages](operator-pi-packages.md) | Maintainers on this development host | Snapshot of operator `pi list` packages and file extensions; not a KXM install requirement |
20
25
  | [vNext contract package](vnext/README.md) | Maintainers and reviewers | Review the accepted local-first target architecture and implementation contracts |
21
26
 
22
27
  Project-level policies live at the repository root:
@@ -0,0 +1,103 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "ADR-0002"
4
+ type: "adr"
5
+ title: "Self-Hosted Steel on DOKS for Reusable Browser Automation and Human Takeover"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-14"
11
+ authority: "decision"
12
+ confidence: "verified"
13
+ summary: "Adopt self-hosted Steel on DigitalOcean Kubernetes (DOKS) with agent-browser and Playwright as KXM's primary browser automation infrastructure."
14
+ tags: ["architecture", "decision", "browser", "steel", "doks", "playwright"]
15
+ related: ["docs/browser-automation.md", "docs/agent-skills.md"]
16
+ details:
17
+ decision_drivers:
18
+ - "Eliminate per-minute SaaS browser provider costs"
19
+ - "Support unified same-session human takeover for MFA and sensitive authentication"
20
+ - "Provide dual exploratory (agent-browser) and regression (Playwright) interfaces"
21
+ - "Enforce strict credential isolation via pass-cli"
22
+ supersedes: null
23
+ superseded_by: null
24
+ ---
25
+
26
+ # ADR-0002: Self-Hosted Steel on DOKS for Reusable Browser Automation
27
+
28
+ ## Context & Problem Statement
29
+
30
+ AI coding agents and orchestration workflows in KXM require browser interaction for UI exploration, DOM mapping, bug reproduction, and end-to-end regression testing. Existing approaches suffered from three core issues:
31
+
32
+ 1. **High SaaS Costs**: Commercial cloud providers (e.g. Browserbase) charge steep per-session and per-minute pricing that conflicts with KXM's low-cost operating priority.
33
+ 2. **Disconnected Human Takeover**: When login challenges, MFA prompts, or CAPTCHAs occur, local or headless cloud browsers cannot easily hand the live session over to a human operator and seamlessly resume without destroying session state.
34
+ 3. **Tool Fragmentation**: Exploratory navigation needs a fast, token-efficient terminal CLI (`agent-browser`), while testing needs durable, assertion-rich frameworks (`Playwright`).
35
+
36
+ ## Decision Drivers
37
+
38
+ 1. **Operating Cost Control**: Keep infrastructure expenses predictable by utilizing our existing DigitalOcean Kubernetes Service (DOKS) cluster (`k8s-agentic-hub`).
39
+ 2. **Unified Same-Session Takeover**: Enable a human to interact with the exact same browser tab and session state during authentication gates before handing control back to the agent.
40
+ 3. **Dual Automation Interfaces**: Support `agent-browser` for discovery and `Playwright` for permanent regression tests over standard Chrome DevTools Protocol (CDP).
41
+ 4. **Authoritative Credential Management**: Ensure `pass-cli` remains the exclusive source of truth for secrets and API keys.
42
+
43
+ ## Considered Options
44
+
45
+ - **Option A**: Self-hosted Steel (`steel-dev/steel-browser`) deployed on DOKS with Ingress-NGINX and TLS.
46
+ - **Option B**: Paid SaaS browser providers (e.g., Browserbase, Steel Cloud).
47
+ - **Option C**: Local headless Chrome instances spawned on developer workstations.
48
+
49
+ ## Evaluation & Tradeoff Matrix
50
+
51
+ ### Option A: Self-hosted Steel on DOKS (Chosen)
52
+
53
+ - **Good, because**: Zero marginal per-session fees; fully self-hosted on our Kubernetes cluster.
54
+ - **Good, because**: Built-in REST API, CDP WebSocket proxy, and live session viewer UI (`/ui`).
55
+ - **Good, because**: Both `Playwright` and `agent-browser` connect seamlessly over standard CDP (`wss://steel.kontextmind.com/v1/devtools`).
56
+ - **Good, because**: Dedicated shared memory (`/dev/shm`) and resource limits prevent workstation degradation.
57
+ - **Bad, because**: Requires managing Kubernetes deployment and periodic orphaned session sweeping.
58
+
59
+ ### Option B: Paid SaaS Browser Provider
60
+
61
+ - **Good, because**: Managed scaling and proxy pools.
62
+ - **Bad, because**: Violates the core cost-efficiency constraint; introduces recurring credit card charges and third-party data transmission risks.
63
+
64
+ ### Option C: Local Chrome Instances
65
+
66
+ - **Good, because**: No cluster deployment needed.
67
+ - **Bad, because**: High workstation memory and CPU pressure; fragile cross-platform headless setups; cannot easily share live debug sessions across multi-agent environments.
68
+
69
+ ## Decision Outcome
70
+
71
+ **Chosen Option**: **Option A (Self-hosted Steel on DOKS)**.
72
+
73
+ ### Architecture
74
+
75
+ ```text
76
+ ┌─────────────────────────────────────────────────────────────┐
77
+ │ KXM Agent / Herdr │
78
+ │ (kxm-browser-session, kxm-browser-takeover, pass-cli) │
79
+ └───────────────┬─────────────────────────────┬───────────────┘
80
+ │ REST API (create/release) │ CDP WebSocket
81
+ ▼ ▼
82
+ ┌─────────────────────────────────────────────────────────────┐
83
+ │ DigitalOcean Kubernetes (DOKS) │
84
+ │ https://steel.kontextmind.com │
85
+ │ │
86
+ │ ┌─────────────────────┐ ┌────────────────────────┐ │
87
+ │ │ Steel API & CDP │◄─────►│ Chromium Sandbox │ │
88
+ │ │ (Fastify) │ │ (/dev/shm 2Gi) │ │
89
+ │ └──────────┬──────────┘ └────────────────────────┘ │
90
+ │ │ │
91
+ │ ▼ │
92
+ │ ┌─────────────────────┐ │
93
+ │ │ Session Viewer │ ◄─── Human Takeover (MFA/Auth) │
94
+ │ │ (/ui) │ │
95
+ │ └─────────────────────┘ │
96
+ └─────────────────────────────────────────────────────────────┘
97
+ ```
98
+
99
+ ## Confirmation & Verification Strategy
100
+
101
+ - **Verification**: Health endpoint `https://steel.kontextmind.com/v1/health` verified with HTTP 200 and Let's Encrypt TLS.
102
+ - **Integration Test**: `test/core/browser.test.ts` validates session lifecycle, CDP endpoint formatting, takeover transitions, and secret redaction.
103
+ - **Security Check**: `pass-cli` verified as the authoritative store for `STEEL_API_KEY` under vault `AI Provider Keys`.
@@ -0,0 +1,135 @@
1
+ # KXM Agent Skills
2
+
3
+ This document describes the bundled KXM Agent Skills suite: focused skills
4
+ that cover current KXM top-level command groups. The suite documents the
5
+ existing CLI. It does **not** land unified YAML role/project/workflow
6
+ authority, admit new writers, or replace trusted `.kxm/roster.json` policy.
7
+
8
+ ## Feature-to-Skill Matrix
9
+
10
+ | Feature Area | Skill | Commands Covered | Purpose |
11
+ |---|---|---|---|
12
+ | Core Routing | `kxm` | — | Select the right suite skill; state universal safety rules and portable CLI convention |
13
+ | Project Setup | `kxm-project-setup` | `init`, `migrate`, `trust`, `config`, `completion` | Initialize, migrate, review permission changes, configure, and install shell completion |
14
+ | Harness & Auth | `kxm-harness-auth` | `harness`, `auth`, `update`, `runtime`, `agent` | Inspect authenticated harness capability and operate supported runtimes/workers |
15
+ | Hub Operations | `kxm-hub-ops` | `hub`, `backup`, `restore` | Run and protect the local hub and its durable SQLite state |
16
+ | Session Management | `kxm-session` | `session`, `dash`, `studio` | Resume/inspect operator work and use UI capabilities each harness supports |
17
+ | Peer Communication | `kxm-peer` | `peer` | Discover, send, poll/await, cancel, fan out, inbox, and reply safely |
18
+ | Workflow Management | `kxm-workflow` | `workflow`, `gate` | Operate webhook workflows, waits/signals, evidence checkpoints, provenance |
19
+ | Definitions | `kxm-definitions` | `role` | Manage role YAML through configuration commands; role edits do not grant trusted writer admission |
20
+ | Run Management | `kxm-runs` | `run`, `runs` | Create and inspect local vNext runs while preserving execution boundaries |
21
+ | Context & Memory | `kxm-context-memory` | `context`, `memory` | Query role-aware context and manage Git-authored memory proposals |
22
+ | Skill Lifecycle | `kxm-skill-lifecycle` | `skills` | Govern candidate/evaluate/promote/reject/verify lifecycle |
23
+ | Routing & Improve | `kxm-routing-improve` | `routing`, `improve` | Inspect real route quality/cost and propose reviewed improvements |
24
+ | Tasks & Goals | `kxm-tasks` | `suggest`, `goal`, `task` | Recommend workflows and manage goals/tasks with SCM/tracker boundaries |
25
+
26
+ ## Browser Automation Skills
27
+
28
+ KXM includes dedicated skills for remote browser automation on self-hosted Steel (DOKS), exploratory navigation via `agent-browser`, testing with `Playwright`, and visual feedback. See [Browser Automation Guide](browser-automation.md) and [ADR-0002](adr/ADR-0002-browser-automation-steel-doks.md).
29
+
30
+ | Feature Area | Skill | Purpose |
31
+ |---|---|---|
32
+ | Browser Sessions | `kxm-browser-session` | Start, attach, inspect, and release Steel sessions on DOKS |
33
+ | Human Takeover | `kxm-browser-takeover` | Handoff protocol for MFA, login, CAPTCHA, and sensitive consent |
34
+ | Credentials & Profiles | `kxm-browser-auth` | Retrieve credentials from `pass-cli` and manage authenticated profiles safely |
35
+ | Exploration | `kxm-browser-explore` | Exploratory navigation, DOM inspection, and workflow mapping via `agent-browser` |
36
+ | Reproduction & Verify | `kxm-browser-verify` | Reproduce UI bugs, gather evidence, and author durable Playwright tests |
37
+ | Diagnostics & Recovery | `kxm-browser-diagnostics` | Investigate Steel connectivity, CDP errors, timeouts, and orphan cleanup |
38
+ | Section Annotation | `kxm-browser-annotate` | Capture DOM sections, attach structured annotations, and feed changes to agents |
39
+
40
+ ## Installation and Discovery
41
+
42
+ ### For Pi Users
43
+
44
+ Pi automatically discovers skills in the `pi.skills` section of `package.json`. The KXM skills are included in the standard distribution:
45
+
46
+ ```json
47
+ {
48
+ "pi.skills": [
49
+ "./plugins/kxm/skills"
50
+ ]
51
+ }
52
+ ```
53
+
54
+ ### For Claude Users
55
+
56
+ Claude plugins package the authored skills from `plugins/kxm/skills/` during the build process.
57
+
58
+ ### For Other Harnesses
59
+
60
+ Skills in `.agents/skills/` follow the standard agent skill format. Discovery
61
+ outside Pi and Claude remains harness-specific; do not assume every consumer
62
+ loads this mirror.
63
+
64
+ ## Progressive Disclosure Usage
65
+
66
+ 1. Start with the core `kxm` skill to choose a specialized skill.
67
+ 2. Use the named skill for that command group.
68
+ 3. Teach only verbs and options that exist in `kxm <group> --help`.
69
+
70
+ ### Example Usage Patterns
71
+
72
+ ```bash
73
+ kxm peer list --json
74
+ kxm peer send --target alice --content "Please review" --json
75
+ kxm workflow list --json
76
+ kxm workflow checkpoint run_123 stage_a passed "Completed stage A" --json
77
+ ```
78
+
79
+ ## Verified vs Unverified Harness Limits
80
+
81
+ ### Verified Harnesses
82
+
83
+ - **Pi**: Discovers `plugins/kxm/skills`
84
+ - **Claude**: Plugin packaging of the authored skills
85
+ - **Codex**: Consumes the generated `.agents/skills` mirror and AGENTS command block
86
+
87
+ ### Unverified Harnesses
88
+
89
+ The following harnesses have discovery claims that remain explicitly unverified:
90
+
91
+ - **Kimi**: `.agents/skills` consumer capability unverified
92
+ - **Copilot**: Integration capability unverified
93
+ - **OpenCode**: Compatibility unverified
94
+ - **Other `.agents/skills` consumers**: Capabilities unverified
95
+
96
+ ## Distinguishing Operational vs Governed Skills
97
+
98
+ ### Bundled Operational Skills
99
+
100
+ The skills in this suite (`kxm-*`) are bundled and operational by default. They map 1:1 with KXM's top-level command groups and are maintained as part of the core KXM distribution.
101
+
102
+ ### Governed Candidates
103
+
104
+ Separately, `kxm skills` manages community or experimental candidates through
105
+ create/evaluate/promote/reject/verify. Those governed skills are distinct from
106
+ this bundled suite. Telemetry cannot auto-promote a skill. See
107
+ [Skill candidate lifecycle](skills.md) for the full lifecycle, and
108
+ [Repository work delivery](skills/repo-work-delivery.md) for converting a
109
+ repository request into a delivery prompt.
110
+
111
+ ## Development and Maintenance
112
+
113
+ ### Authoring Location
114
+
115
+ Skills are authored in `plugins/kxm/skills/` as the primary source of truth.
116
+
117
+ ### Generated Mirror
118
+
119
+ `scripts/emit-codex-artifacts.mjs` copies owned skills byte-for-byte to
120
+ `.agents/skills/` and leaves unrelated skills in that tree untouched. The
121
+ suite manifest `plugins/kxm/skill-suite.json` is required; missing, symlink,
122
+ or malformed manifests fail closed.
123
+
124
+ ### Build Process
125
+
126
+ 1. Validate `plugins/kxm/skill-suite.json`
127
+ 2. Replace owned generated skill directories
128
+ 3. Preserve foreign skills in `.agents/skills/`
129
+ 4. `scripts/check-generated.mjs` requires every owned mirror path
130
+
131
+ ### Testing
132
+
133
+ - `test/core/skill-suite.test.ts` validates command coverage and mirrors
134
+ - `test/core/commands-policy.test.ts` checks taught verbs against `cli.ts`
135
+ - `test/core/generated-artifacts.test.ts` checks manifest-backed generated paths
@@ -163,7 +163,7 @@ Workflow session isolation is a context-routing and accidental-cross-run safety
163
163
 
164
164
  | Path | Responsibility |
165
165
  |---|---|
166
- | `.kxm/config/` | Tracked workspace workflow and harness configuration |
166
+ | `.kxm/` | Tracked workspace workflow and harness configuration |
167
167
  | `.kxm/logs/` | Ignored hub, worker, and Pi process logs |
168
168
  | `.kxm/assets/` | Intentional workflow inputs and outputs |
169
169
  | `.kxm/state/` | Ignored SQLite and restart-recovery state |
@@ -35,6 +35,17 @@ and models are admitted with strict permission and vendor boundaries:
35
35
  a requested harness/model is not in the admitted role lineup, or if permissions
36
36
  exceed the admitted ceiling (e.g. attempting to give edit permissions to a
37
37
  read-only reviewer).
38
+ - **Trusted roster policy:** Dispatch (`assign` / `run`) and accept load
39
+ `.kxm/roster.json` 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.
38
49
  - **Deterministic witness beats extra models:** Implementers run `npm run verify`.
39
50
  Root re-runs the fixed witness. Reviewers verify candidate trees; they do not
40
51
  replace tests.
@@ -145,14 +156,16 @@ node scripts/assignment-run.mjs accept \
145
156
 
146
157
  `accept` validates all acceptance invariants:
147
158
 
148
- 1. The commit exists and its tree matches the witness index tree.
149
- 2. The writer record matches the latest passed witness.
150
- 3. Both required critic roles (`review-arch` and `review-cli`) are present.
151
- 4. Both critics judged the exact accepted tree and issued `PASS`.
152
- 5. No unresolved `BLOCK` review exists for the tree in the task directory (unless
159
+ 1. Trusted roster policy is loaded and valid **before** acceptance artifacts are
160
+ written. Failure to obtain required policy refuses acceptance.
161
+ 2. The commit exists and its tree matches the witness index tree.
162
+ 3. The writer record matches the latest passed witness.
163
+ 4. Both required critic roles (`review-arch` and `review-cli`) are present.
164
+ 5. Both critics judged the exact accepted tree and issued `PASS`.
165
+ 6. No unresolved `BLOCK` review exists for the tree in the task directory (unless
153
166
  superseded by an unbroken `rework_of` lineage).
154
- 6. The writer and all critics satisfy pairwise vendor independence.
155
- 7. Writes `accepted.json` (`kxm.task-accepted.v1`) into the task directory.
167
+ 7. The writer and all critics satisfy pairwise vendor independence.
168
+ 8. Writes `accepted.json` (`kxm.task-accepted.v1`) into the task directory.
156
169
 
157
170
  ---
158
171
 
@@ -206,7 +219,7 @@ The runner fails closed with bounded error codes defined in `RUNNER_CODES`:
206
219
 
207
220
  | Code | Trigger condition | Remedy |
208
221
  |---|---|---|
209
- | `route_invalid` | Harness/model not admitted in lineup for the requested role, or permission exceeds route ceiling. | Check `.kxm/roster.json` lineup and permissions for the role. |
222
+ | `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.json` lineup and permissions for the role. |
210
223
  | `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. |
211
224
  | `critic_block` | An unresolved `BLOCK` verdict exists for the target tree. | Rework the changes, address findings, and pass review with a `rework_of` link. |
212
225
  | `commit_tree_mismatch` | Git commit tree does not equal the witnessed tree. | Commit the exact candidate tree verified by the witness before running accept. |