@kontextmind/kxm 0.6.0 → 0.7.4

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 (136) 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 +4 -0
  14. package/docs/agent-skills.md +121 -0
  15. package/docs/architecture.md +1 -1
  16. package/docs/assignment-runner.md +21 -8
  17. package/docs/configuration.md +11 -2
  18. package/docs/getting-started.md +21 -0
  19. package/docs/kxm-handbook.md +3 -3
  20. package/docs/operations.md +24 -0
  21. package/docs/operator-pi-packages.md +63 -0
  22. package/docs/skills/repo-work-delivery.md +107 -0
  23. package/docs/skills.md +2 -0
  24. package/docs/test-matrix.md +4 -3
  25. package/docs/troubleshooting.md +41 -1
  26. package/docs/vnext/validation.md +9 -0
  27. package/docs/webhook-workflows.md +2 -2
  28. package/examples/README.md +1 -1
  29. package/package.json +16 -17
  30. package/plugins/kxm/.claude-plugin/plugin.json +1 -1
  31. package/plugins/kxm/README.md +1 -1
  32. package/plugins/kxm/dist/cli.js +8955 -3934
  33. package/plugins/kxm/dist/core.js +271 -34
  34. package/plugins/kxm/dist/extension.js +7759 -86
  35. package/plugins/kxm/dist/mcp-server.js +75 -21
  36. package/plugins/kxm/dist/runtime.js +5637 -1125
  37. package/plugins/kxm/dist/server.js +3125 -2260
  38. package/plugins/kxm/dist/vnext-runtime-supervisor.js +5808 -565
  39. package/plugins/kxm/package.json +1 -1
  40. package/plugins/kxm/skills/SUITE.md +5 -0
  41. package/plugins/kxm/skills/hints.json +73 -0
  42. package/plugins/kxm/skills/kxm/SKILL.md +30 -83
  43. package/plugins/kxm/skills/kxm-context-memory/SKILL.md +69 -0
  44. package/plugins/kxm/skills/kxm-definitions/SKILL.md +65 -0
  45. package/plugins/kxm/skills/kxm-harness-auth/SKILL.md +34 -0
  46. package/plugins/kxm/skills/kxm-harvest/SKILL.md +48 -0
  47. package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +43 -0
  48. package/plugins/kxm/skills/kxm-insights/SKILL.md +48 -0
  49. package/plugins/kxm/skills/kxm-mind/SKILL.md +59 -0
  50. package/plugins/kxm/skills/kxm-peer/SKILL.md +110 -0
  51. package/plugins/kxm/skills/kxm-project-setup/SKILL.md +42 -0
  52. package/plugins/kxm/skills/kxm-projects/SKILL.md +43 -0
  53. package/plugins/kxm/skills/kxm-protocol/SKILL.md +66 -0
  54. package/plugins/kxm/skills/kxm-query/SKILL.md +45 -0
  55. package/plugins/kxm/skills/kxm-routing-improve/SKILL.md +30 -0
  56. package/plugins/kxm/skills/kxm-runs/SKILL.md +29 -0
  57. package/plugins/kxm/skills/kxm-setup/SKILL.md +55 -0
  58. package/plugins/kxm/skills/kxm-skill-lifecycle/SKILL.md +31 -0
  59. package/plugins/kxm/skills/kxm-tasks/SKILL.md +33 -0
  60. package/plugins/kxm/skills/kxm-triage/SKILL.md +47 -0
  61. package/plugins/kxm/skills/kxm-work/SKILL.md +44 -0
  62. package/plugins/kxm/skills/kxm-workflow/SKILL.md +45 -0
  63. package/plugins/kxm/src/autocomplete.ts +9 -3
  64. package/plugins/kxm/src/cli.ts +1637 -73
  65. package/plugins/kxm/src/commands.ts +150 -8
  66. package/plugins/kxm/src/completion-install.ts +223 -0
  67. package/plugins/kxm/src/config.ts +7 -4
  68. package/plugins/kxm/src/context-packet.ts +172 -0
  69. package/plugins/kxm/src/database.ts +1 -1
  70. package/plugins/kxm/src/extension.ts +36 -1
  71. package/plugins/kxm/src/external-effects.ts +357 -8
  72. package/plugins/kxm/src/hub-env.ts +193 -0
  73. package/plugins/kxm/src/hub.ts +2 -4
  74. package/plugins/kxm/src/improve.ts +72 -0
  75. package/plugins/kxm/src/init-guide-setup.ts +547 -0
  76. package/plugins/kxm/src/local-snapshot.ts +1 -1
  77. package/plugins/kxm/src/mcp-server.ts +1 -1
  78. package/plugins/kxm/src/model-inventory.ts +127 -0
  79. package/plugins/kxm/src/policy-draft.d.mts +55 -0
  80. package/plugins/kxm/src/policy-draft.mjs +565 -0
  81. package/plugins/kxm/src/price-calc.ts +17 -18
  82. package/plugins/kxm/src/prices.ts +32 -16
  83. package/plugins/kxm/src/producers.ts +71 -0
  84. package/plugins/kxm/src/protocol.ts +111 -0
  85. package/plugins/kxm/src/restricted-yaml.d.mts +31 -0
  86. package/plugins/kxm/src/restricted-yaml.mjs +145 -0
  87. package/plugins/kxm/src/role.ts +710 -0
  88. package/plugins/kxm/src/routing.ts +99 -1
  89. package/plugins/kxm/src/safety-integrity.ts +76 -0
  90. package/plugins/kxm/src/session-work.ts +9 -2
  91. package/plugins/kxm/src/sqlite.ts +76 -0
  92. package/plugins/kxm/src/store.ts +1 -1
  93. package/plugins/kxm/src/studio-layout.ts +660 -17
  94. package/plugins/kxm/src/suggest.ts +7 -13
  95. package/plugins/kxm/src/telemetry.ts +82 -0
  96. package/plugins/kxm/src/tui.ts +140 -0
  97. package/plugins/kxm/src/vnext-bindings.ts +1 -1
  98. package/plugins/kxm/src/vnext-config.ts +53 -111
  99. package/plugins/kxm/src/vnext-engine-command.ts +2 -0
  100. package/plugins/kxm/src/vnext-engine.ts +214 -62
  101. package/plugins/kxm/src/vnext-harness.ts +267 -83
  102. package/plugins/kxm/src/vnext-oneshot-evidence.ts +85 -0
  103. package/plugins/kxm/src/vnext-oneshot-process.ts +166 -0
  104. package/plugins/kxm/src/vnext-oneshot-producer.ts +179 -224
  105. package/plugins/kxm/src/vnext-runtime-store.ts +36 -2
  106. package/plugins/kxm/src/vnext-runtime-supervisor.ts +120 -5
  107. package/plugins/kxm/src/vnext-runtime.ts +14 -0
  108. package/plugins/kxm/src/workflow-manager.ts +392 -0
  109. package/plugins/kxm/src/workflow-tui.ts +255 -0
  110. package/plugins/kxm/src/workflow.ts +144 -0
  111. package/schemas/policy-draft/README.md +17 -0
  112. package/schemas/policy-draft/model.v2.schema.json +140 -0
  113. package/schemas/policy-draft/role.v2.schema.json +91 -0
  114. package/schemas/vnext/role.schema.json +76 -0
  115. package/schemas/vnext/run-event.schema.json +1 -0
  116. package/scripts/assignment-run.d.mts +1 -1
  117. package/scripts/assignment-run.mjs +44 -35
  118. package/scripts/check-generated.mjs +33 -9
  119. package/scripts/emit-codex-artifacts.mjs +255 -11
  120. package/scripts/harness-run.d.mts +12 -4
  121. package/scripts/harness-run.mjs +65 -17
  122. package/scripts/kxm-bump-version.mjs +146 -0
  123. package/scripts/kxm-hub.mjs +150 -2
  124. package/scripts/kxm-publish-npm.mjs +3 -1
  125. package/scripts/kxm-release-github.mjs +3 -1
  126. package/scripts/kxm.mjs +0 -0
  127. package/scripts/native-critic.d.mts +5 -0
  128. package/scripts/native-critic.mjs +60 -0
  129. package/.kxm/config/README.md +0 -5
  130. package/.kxm/config/agents.json +0 -43
  131. package/.kxm/config/env.example +0 -56
  132. package/.kxm/config/update.example.yaml +0 -9
  133. package/.kxm/config/workflows/fix.json +0 -160
  134. package/.kxm/config/workflows/jira-development.json +0 -116
  135. package/.kxm/config/workflows/provenance-quorum.json +0 -150
  136. 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.4",
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,8 @@ 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
+ | [Skills](skills.md) | Operators and skill authors | Governed candidate lifecycle; also the [repository work delivery](skills/repo-work-delivery.md) skill |
11
13
  | [Operations](operations.md) | Hub operators | Run, monitor, secure, and recover the service |
12
14
  | [Troubleshooting](troubleshooting.md) | Everyone | Diagnose common installation and delivery failures |
13
15
  | [Test matrix](test-matrix.md) | Users and maintainers | Map features and use cases to automated evidence |
@@ -15,8 +17,10 @@ This documentation is organized by task. Start with the guide that matches what
15
17
  | [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
18
  | [Continuous improvement](continuous-improvement.md) | Product and engineering leads | Turn run evidence into reviewed workflow improvements |
17
19
  | [Workflow guide](workflow-guide.md) | Workflow designers and operators | Area -> Workflow -> Stage -> Role taxonomy with documentation slugs, dated research candidates, and selection policy |
20
+ | [Templates](templates/README.md) | Workflow authors | Markdown templates for features, ADRs, reviews, runbooks, and related artifacts |
18
21
  | [Agent Envelopes & Quality Gates](agent-communication-envelopes-and-gates.md) | Multi-agent workflow engineers | Production communication envelopes, quality gates, and work loops |
19
22
  | [Assignment runner](assignment-runner.md) | Maintainers and developers | Native developer assignments, deterministic witness verification, and multi-vendor dual-critic acceptance |
23
+ | [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
24
  | [vNext contract package](vnext/README.md) | Maintainers and reviewers | Review the accepted local-first target architecture and implementation contracts |
21
25
 
22
26
  Project-level policies live at the repository root:
@@ -0,0 +1,121 @@
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
+ ## Installation and Discovery
27
+
28
+ ### For Pi Users
29
+
30
+ Pi automatically discovers skills in the `pi.skills` section of `package.json`. The KXM skills are included in the standard distribution:
31
+
32
+ ```json
33
+ {
34
+ "pi.skills": [
35
+ "./plugins/kxm/skills"
36
+ ]
37
+ }
38
+ ```
39
+
40
+ ### For Claude Users
41
+
42
+ Claude plugins package the authored skills from `plugins/kxm/skills/` during the build process.
43
+
44
+ ### For Other Harnesses
45
+
46
+ Skills in `.agents/skills/` follow the standard agent skill format. Discovery
47
+ outside Pi and Claude remains harness-specific; do not assume every consumer
48
+ loads this mirror.
49
+
50
+ ## Progressive Disclosure Usage
51
+
52
+ 1. Start with the core `kxm` skill to choose a specialized skill.
53
+ 2. Use the named skill for that command group.
54
+ 3. Teach only verbs and options that exist in `kxm <group> --help`.
55
+
56
+ ### Example Usage Patterns
57
+
58
+ ```bash
59
+ kxm peer list --json
60
+ kxm peer send --target alice --content "Please review" --json
61
+ kxm workflow list --json
62
+ kxm workflow checkpoint run_123 stage_a passed "Completed stage A" --json
63
+ ```
64
+
65
+ ## Verified vs Unverified Harness Limits
66
+
67
+ ### Verified Harnesses
68
+
69
+ - **Pi**: Discovers `plugins/kxm/skills`
70
+ - **Claude**: Plugin packaging of the authored skills
71
+ - **Codex**: Consumes the generated `.agents/skills` mirror and AGENTS command block
72
+
73
+ ### Unverified Harnesses
74
+
75
+ The following harnesses have discovery claims that remain explicitly unverified:
76
+
77
+ - **Kimi**: `.agents/skills` consumer capability unverified
78
+ - **Copilot**: Integration capability unverified
79
+ - **OpenCode**: Compatibility unverified
80
+ - **Other `.agents/skills` consumers**: Capabilities unverified
81
+
82
+ ## Distinguishing Operational vs Governed Skills
83
+
84
+ ### Bundled Operational Skills
85
+
86
+ 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.
87
+
88
+ ### Governed Candidates
89
+
90
+ Separately, `kxm skills` manages community or experimental candidates through
91
+ create/evaluate/promote/reject/verify. Those governed skills are distinct from
92
+ this bundled suite. Telemetry cannot auto-promote a skill. See
93
+ [Skill candidate lifecycle](skills.md) for the full lifecycle, and
94
+ [Repository work delivery](skills/repo-work-delivery.md) for converting a
95
+ repository request into a delivery prompt.
96
+
97
+ ## Development and Maintenance
98
+
99
+ ### Authoring Location
100
+
101
+ Skills are authored in `plugins/kxm/skills/` as the primary source of truth.
102
+
103
+ ### Generated Mirror
104
+
105
+ `scripts/emit-codex-artifacts.mjs` copies owned skills byte-for-byte to
106
+ `.agents/skills/` and leaves unrelated skills in that tree untouched. The
107
+ suite manifest `plugins/kxm/skill-suite.json` is required; missing, symlink,
108
+ or malformed manifests fail closed.
109
+
110
+ ### Build Process
111
+
112
+ 1. Validate `plugins/kxm/skill-suite.json`
113
+ 2. Replace owned generated skill directories
114
+ 3. Preserve foreign skills in `.agents/skills/`
115
+ 4. `scripts/check-generated.mjs` requires every owned mirror path
116
+
117
+ ### Testing
118
+
119
+ - `test/core/skill-suite.test.ts` validates command coverage and mirrors
120
+ - `test/core/commands-policy.test.ts` checks taught verbs against `cli.ts`
121
+ - `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. |
@@ -74,6 +74,15 @@ rewrites it.
74
74
 
75
75
  The hub refuses a non-loopback bind without `KXM_AUTH_TOKEN`. Use a long random administrative token even when project tokens are configured, because administrative endpoints such as `/metrics` require it outside loopback.
76
76
 
77
+ When `KXM_AUTH_TOKEN` is unset, `kxm hub start` resolves credentials from the
78
+ persisted `kxm.hub-env.v1` file under the user state root
79
+ (`~/.local/state/kxm/hub-env.json`; honors `KXM_STATE_HOME` and platform
80
+ equivalents). A missing admin token is generated once, persisted with `0600`
81
+ permissions, and reused across hub restarts so workers and dashboards on the
82
+ same machine share one stable credential. Explicit `KXM_AUTH_TOKEN` or
83
+ `KXM_PROJECT_TOKENS` environment values take precedence and are persisted for
84
+ later restarts. Delete the file and restart to rotate the generated token.
85
+
77
86
  Project tokens are an authorization boundary. A project-specific token can register only in its mapped project and see only that project's agents and messages. The administrative token remains a fallback for projects without an explicit entry. For provenance-gated workflows, configure an explicit project token and give workers only that token; reserve a distinct administrative token for operations such as quorum degradation approval.
78
87
 
79
88
  PowerShell example:
@@ -269,7 +278,7 @@ Global flags: `--json`, `--dry-run`, `--workspace`. Project-root `kxm init` disc
269
278
 
270
279
  Configure either `KXM_WEBHOOK_WORKFLOWS` or `KXM_WEBHOOK_WORKFLOWS_FILE`, never both. A definition selects a provider source, project, coordinator, event and payload filters, prompt template, and ordered stages. Use `secretEnv` to resolve the workflow-start HMAC secret from another environment variable. Use the optional `signalSecretEnv` for a separate callback secret; otherwise external signals use the workflow-start secret. Do not store either secret in JSON.
271
280
 
272
- See [Webhook workflows](webhook-workflows.md) for the base schema and the complete Jira configuration under `.kxm/config/workflows`. See [Peer provenance and quorum gates](provenance-gates.md) for `evidencePolicies`, `workflowContext`, `evidenceRefs`, and explicit degradation.
281
+ See [Webhook workflows](webhook-workflows.md) for the base schema and the complete Jira configuration under `.kxm/workflows`. See [Peer provenance and quorum gates](provenance-gates.md) for `evidencePolicies`, `workflowContext`, `evidenceRefs`, and explicit degradation.
273
282
 
274
283
  ## Delivery modes
275
284
 
@@ -279,7 +288,7 @@ See [Webhook workflows](webhook-workflows.md) for the base schema and the comple
279
288
  | `steer` | An active blocker requires a course change | Deliver at the next decision boundary |
280
289
  | `nextTurn` | Information should wait for a later turn | Queue context without immediate work |
281
290
 
282
- `followUp` is the safe default. Use [`.kxm/config/env.example`](../.kxm/config/env.example) as a reference, but load values through your shell, supervisor, container platform, or secret manager. Never commit real tokens.
291
+ `followUp` is the safe default. Load values through your shell, supervisor, container platform, or secret manager using the variables documented on this page and in the [KXM Handbook](kxm-handbook.md). Never commit real tokens.
283
292
 
284
293
  ## Nous providers (opt-in)
285
294
 
@@ -61,6 +61,27 @@ kxm init
61
61
 
62
62
  `kxm init` never copies the package repository's dogfood roster or workflows into a consumer workspace.
63
63
 
64
+ When `kxm init` succeeds in an interactive terminal, it offers to install shell
65
+ completion for the detected shell. Accepting writes the completion script
66
+ under the user config directory, appends one idempotent stanza to the shell
67
+ rc file, and, when the kxm bin directory is not already on `PATH`, adds a
68
+ `PATH` export. Declining is safe: run `kxm completion install` later, or set
69
+ `KXM_SKIP_COMPLETION_PROMPT=1` to suppress the offer. Non-interactive,
70
+ `--json`, and `--dry-run` runs never prompt or write shell files.
71
+
72
+ After the completion offer, an interactive `kxm init` also offers to set up
73
+ workflow-guide agents and workflows for the harnesses you have installed and
74
+ authenticated. Accepting lists the software-engineering workflows from
75
+ [`workflow-guide.md`](workflow-guide.md); pick by number or slug (`all` works
76
+ too). kxm resolves each role's first guide candidate whose harness is
77
+ authenticated and writes only current vNext project resources —
78
+ `.kxm/agents/<role>.yaml` (`kxm.agent.v1`) and `.kxm/workflows/<slug>.yaml`
79
+ (`kxm.workflow.v1`). It never writes retired legacy authority (`.kxm/config`,
80
+ `.kxm/roster.json`). Roles whose candidates have no authenticated harness are
81
+ reported as skipped, not silently downgraded. Guide candidates are dated
82
+ research — verify them before dispatch. Declining is safe: set
83
+ `KXM_SKIP_GUIDE_SETUP_PROMPT=1` to suppress the offer.
84
+
64
85
  ## 3. Start the hub in another terminal
65
86
 
66
87
  `kxm hub start` is foreground. Keep that terminal running.
@@ -695,7 +695,7 @@ Claude MCP also exposes:
695
695
  Set exactly one of:
696
696
 
697
697
  ```text
698
- KXM_WEBHOOK_WORKFLOWS_FILE=.kxm/config/workflows/product.json
698
+ KXM_WEBHOOK_WORKFLOWS_FILE=.kxm/workflows/default.yaml
699
699
  ```
700
700
 
701
701
  or:
@@ -712,7 +712,7 @@ required evidence, attempt limits, and optional peer policies.
712
712
  Validate before restart:
713
713
 
714
714
  ```powershell
715
- kxm gate validate --file .kxm/config/workflows/product.json
715
+ kxm gate validate --file .kxm/workflows/default.yaml
716
716
  ```
717
717
 
718
718
  Secrets belong in environment variables named by `secretEnv` and
@@ -921,7 +921,7 @@ with content hashes. See `docs/skills.md` for the full lifecycle.
921
921
 
922
922
  ### Reference /fix workflow
923
923
 
924
- `.kxm/config/workflows/fix.json` implements the reference bug-fix flow:
924
+ `.kxm/workflows/default.yaml` implements the reference bug-fix flow:
925
925
  read-only exploration, a tests-only reproduction draft, independent two-critic
926
926
  `repro-review` that captures the immutable oracle (a sibling API is invalid),
927
927
  plan review by independent critics, a human approval gate, bounded rework
@@ -21,10 +21,34 @@ These operator commands assume the packed release CLI installation from
21
21
  [Getting started](getting-started.md#install-the-operator-command). From a
22
22
  source clone, use `npm run hub` instead.
23
23
 
24
+ When `KXM_AUTH_TOKEN` is not set, `kxm hub start` loads the persisted hub
25
+ credential file (schema `kxm.hub-env.v1`) under the user state root
26
+ (`~/.local/state/kxm/hub-env.json` on Linux, honoring `KXM_STATE_HOME` and
27
+ platform equivalents). If no persisted token exists, a long random
28
+ administrative token is generated, saved there with `0600` permissions, and
29
+ used. The hub therefore never silently starts with `auth=none` because a
30
+ token was forgotten; a missing token is created once and reused by every
31
+ later restart, worker, and dashboard on the same machine. Explicit
32
+ `KXM_AUTH_TOKEN` / `KXM_PROJECT_TOKENS` environment values always win and are
33
+ persisted so restarts keep them. The generated value is never printed in
34
+ full; kxm only reports which file it came from.
35
+
24
36
  Stop with `Ctrl+C` or `SIGTERM`. The hub stops accepting connections, closes SSE streams, waits for active HTTP connections, and closes SQLite.
25
37
 
26
38
  For unattended service, use a supervisor that sets a stable working directory, injects secrets, captures stdout, restarts after failure, and allows at least five seconds for graceful shutdown.
27
39
 
40
+ ### PID claims and restart recovery
41
+
42
+ The hub wrapper records its own PID and the server child PID in
43
+ `.kxm/state/hub.pid`. A claim whose wrapper is dead is reclaimed automatically
44
+ on the next `kxm hub start`; when the dead wrapper left an orphaned server
45
+ child behind (for example after `SIGKILL` or a machine crash), the new
46
+ wrapper terminates that orphan before reclaiming. `kxm hub stop` also
47
+ recovers orphans directly: it signals a still-running recorded server child
48
+ of a dead wrapper, waits for exit, and removes the stale claim. Malformed or
49
+ foreign PID claims stay fail-closed; remove those only after verifying no
50
+ hub process is running.
51
+
28
52
  Run each long-lived coordinator with `kxm agent worker --name <stable-name> --project <project> [--model <provider/model>] [--fallback-models <provider/model,...>] [--tools <name,...>]` under a separate service-manager unit. Use distinct worktrees for concurrent writers, explicit CPU and memory limits, and restart throttling outside the built-in bounded backoff. Enforce role ownership with the Pi tool allowlist: omit `bash`, `edit`, and `write` from read-only reviewers, even if their prompt also says not to edit. The worker launches Pi RPC mode and retains the most recent session unless configured otherwise. Use `--fresh-start` for a clean first session that may still resume after a later provider failure; reserve `--no-continue` for a worker that must never resume. For release verification, configure the [exact extension and skill sets](configuration.md#long-lived-worker-settings), including every required provider extension; configured categories disable discovery and fail closed on invalid paths. `kxm hub stop` writes a generation-matched control request; the worker asks Pi RPC to abort, waits for confirmation and state flush, and only force-stops the process tree after the bounded drain deadline. A final provider error leaves the inbound hub message delivered, gracefully restarts Pi, rotates to an unused fallback model, and preserves the session; Pi's own automatic retries always finish first. A tool that exceeds `KXM_WORKER_TOOL_TIMEOUT_MS` follows the same durable restart path without changing models. If `--continue` reports an invalid tool-result session, the worker retries once fresh, journals a redacted recovery envelope, and injects a bounded resume instruction for the durable run and stage. Do not copy `pi-agent-*.log` into journals or retrospectives.
29
53
 
30
54
  ### Workflow-specific Pi sessions
@@ -0,0 +1,63 @@
1
+ # This host's Pi packages
2
+
3
+ Snapshot of the operator Pi user packages and file extensions on this KXM
4
+ development host (2026-09-10). It is **not** a KXM install requirement and is
5
+ **not** copied by `kxm init`. `pi list` is authoritative; this page is a
6
+ checked-in copy for agents working in this repository.
7
+
8
+ ## User packages (`pi list`)
9
+
10
+ | Source | Version | What it loads |
11
+ |---|---|---|
12
+ | `npm:pi-antigravity` | 0.7.2 | Antigravity / Cloud Code Assist provider (`./src/index.ts`) |
13
+ | `git:git@github.com:kontextmind/kxm.git@main` | 0.6.0 (`10a1b77` at snapshot) | KXM Pi extension and Agent Skills |
14
+ | `npm:@xynogen/pix-core` | 0.5.38 | pix UI/tool aggregator (`src/extension.ts`); activates bundled pix members, not separate `pi list` sources |
15
+ | `npm:@tian.zuo/pi-antigravity` | 0.10.3 | Antigravity via `agy` stream-json (`./index.ts`) |
16
+ | `npm:@latentminds/pi-quotas` | 0.5.0 | Quota and usage status commands |
17
+ | `npm:pi-provider-kimi-code` | 0.6.12 | Kimi Code provider (`./index.ts`) |
18
+
19
+ Install roots on this host:
20
+
21
+ - npm: `%USERPROFILE%\.pi\agent\npm\node_modules\`
22
+ - git KXM: `%USERPROFILE%\.pi\agent\git\github.com\kontextmind\kxm`
23
+
24
+ Project-local Pi extension (gitignored `.pi/`): `.pi/extensions/rtk.ts` from
25
+ `rtk init --agent pi`. User-level `~/.pi/agent/extensions/rtk.ts` is also
26
+ installed.
27
+
28
+ ## File extensions
29
+
30
+ Loaded from `%USERPROFILE%\.pi\agent\extensions\` (not shown by `pi list`):
31
+
32
+ | File | Role |
33
+ |---|---|
34
+ | `rtk.ts` | RTK bash rewrite via `rtk rewrite`; needs `rtk` 0.23 or newer on `PATH` |
35
+ | `quotas.json` | Config for `@latentminds/pi-quotas`, not an extension factory |
36
+
37
+ `rtk` 0.48.0 is installed as winget `rtk-ai.rtk`. New shells pick up the User
38
+ `PATH` entry. `pix-core` also activates `pix-optimizer`, which can rewrite
39
+ commands for RTK independently of `rtk.ts`.
40
+
41
+ ## Notes
42
+
43
+ - `pi-antigravity` and `@tian.zuo/pi-antigravity` are different Pi providers.
44
+ They do not replace the native `agy` harness used by the assignment runner.
45
+ - For KXM development loads, prefer the working tree:
46
+ `pi --no-extensions -e ./plugins/kxm/src/extension.ts`. Add every required
47
+ provider extension with another `-e`; otherwise Pi discovery is disabled.
48
+ See [Troubleshooting](troubleshooting.md#pi-shows-huboff).
49
+ - Refresh this page when `pi list` or
50
+ `%USERPROFILE%\.pi\agent\extensions\` changes.
51
+
52
+ ## Project-scoped RTK (this checkout)
53
+
54
+ `rtk init` in this repository (2026-09-10). Not copied by `kxm init`.
55
+
56
+ | Path | Role |
57
+ |---|---|
58
+ | `RTK.md` | Slim RTK instructions for Codex and `@RTK.md` includes |
59
+ | `AGENTS.md` | `@RTK.md` reference (Codex / Kimi) |
60
+ | `CLAUDE.md` | `@RTK.md` reference (Claude Code) |
61
+ | `.rtk/filters.toml` | Project filter template |
62
+ | `.agents/rules/antigravity-rtk-rules.md` | Antigravity rules |
63
+ | `.pi/extensions/rtk.ts` | Project Pi rewrite extension (gitignored) |