@kontextmind/kxm 0.7.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 (51) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.kxm/roles/writer.yaml +2 -0
  3. package/docs/README.md +2 -0
  4. package/docs/agent-skills.md +5 -2
  5. package/docs/configuration.md +10 -1
  6. package/docs/getting-started.md +21 -0
  7. package/docs/operations.md +24 -0
  8. package/docs/skills/repo-work-delivery.md +5 -0
  9. package/docs/skills.md +2 -0
  10. package/docs/troubleshooting.md +22 -1
  11. package/package.json +1 -1
  12. package/plugins/kxm/.claude-plugin/plugin.json +1 -1
  13. package/plugins/kxm/dist/cli.js +2257 -439
  14. package/plugins/kxm/dist/core.js +57 -0
  15. package/plugins/kxm/dist/extension.js +40 -3
  16. package/plugins/kxm/dist/mcp-server.js +1 -1
  17. package/plugins/kxm/dist/runtime.js +140 -17
  18. package/plugins/kxm/dist/server.js +129 -4
  19. package/plugins/kxm/dist/vnext-runtime-supervisor.js +136 -13
  20. package/plugins/kxm/package.json +1 -1
  21. package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +9 -0
  22. package/plugins/kxm/skills/kxm-project-setup/SKILL.md +9 -2
  23. package/plugins/kxm/src/autocomplete.ts +1 -1
  24. package/plugins/kxm/src/cli.ts +507 -9
  25. package/plugins/kxm/src/completion-install.ts +223 -0
  26. package/plugins/kxm/src/database.ts +1 -1
  27. package/plugins/kxm/src/external-effects.ts +1 -1
  28. package/plugins/kxm/src/hub-env.ts +193 -0
  29. package/plugins/kxm/src/init-guide-setup.ts +547 -0
  30. package/plugins/kxm/src/local-snapshot.ts +1 -1
  31. package/plugins/kxm/src/mcp-server.ts +1 -1
  32. package/plugins/kxm/src/protocol.ts +111 -0
  33. package/plugins/kxm/src/role.ts +335 -0
  34. package/plugins/kxm/src/safety-integrity.ts +76 -0
  35. package/plugins/kxm/src/sqlite.ts +76 -0
  36. package/plugins/kxm/src/store.ts +1 -1
  37. package/plugins/kxm/src/vnext-bindings.ts +1 -1
  38. package/plugins/kxm/src/vnext-config.ts +38 -1
  39. package/plugins/kxm/src/vnext-engine-command.ts +2 -0
  40. package/plugins/kxm/src/vnext-engine.ts +16 -0
  41. package/plugins/kxm/src/vnext-harness.ts +4 -2
  42. package/plugins/kxm/src/vnext-oneshot-process.ts +21 -4
  43. package/plugins/kxm/src/vnext-oneshot-producer.ts +18 -0
  44. package/plugins/kxm/src/vnext-runtime-store.ts +1 -1
  45. package/plugins/kxm/src/workflow-tui.ts +1 -1
  46. package/plugins/kxm/src/workflow.ts +144 -0
  47. package/scripts/kxm-bump-version.mjs +146 -0
  48. package/scripts/kxm-hub.mjs +145 -3
  49. package/scripts/kxm-publish-npm.mjs +3 -1
  50. package/scripts/kxm-release-github.mjs +3 -1
  51. package/scripts/kxm.mjs +0 -0
@@ -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.7.0",
14
+ "version": "0.7.4",
15
15
  "category": "development",
16
16
  "tags": ["kxm", "multi-agent", "workflows", "mcp"]
17
17
  }
@@ -1,5 +1,7 @@
1
1
  schema: kxm.role.v1
2
2
  id: writer
3
3
  roster:
4
+ - model: xai/grok-4.6
5
+ enabled: true
4
6
  - model: openrouter/qwen/qwen3-coder-plus
5
7
  enabled: true
package/docs/README.md CHANGED
@@ -9,6 +9,7 @@ This documentation is organized by task. Start with the guide that matches what
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
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 |
12
13
  | [Operations](operations.md) | Hub operators | Run, monitor, secure, and recover the service |
13
14
  | [Troubleshooting](troubleshooting.md) | Everyone | Diagnose common installation and delivery failures |
14
15
  | [Test matrix](test-matrix.md) | Users and maintainers | Map features and use cases to automated evidence |
@@ -16,6 +17,7 @@ This documentation is organized by task. Start with the guide that matches what
16
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 |
17
18
  | [Continuous improvement](continuous-improvement.md) | Product and engineering leads | Turn run evidence into reviewed workflow improvements |
18
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 |
19
21
  | [Agent Envelopes & Quality Gates](agent-communication-envelopes-and-gates.md) | Multi-agent workflow engineers | Production communication envelopes, quality gates, and work loops |
20
22
  | [Assignment runner](assignment-runner.md) | Maintainers and developers | Native developer assignments, deterministic witness verification, and multi-vendor dual-critic acceptance |
21
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 |
@@ -10,7 +10,7 @@ authority, admit new writers, or replace trusted `.kxm/roster.json` policy.
10
10
  | Feature Area | Skill | Commands Covered | Purpose |
11
11
  |---|---|---|---|
12
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 add shell completion |
13
+ | Project Setup | `kxm-project-setup` | `init`, `migrate`, `trust`, `config`, `completion` | Initialize, migrate, review permission changes, configure, and install shell completion |
14
14
  | Harness & Auth | `kxm-harness-auth` | `harness`, `auth`, `update`, `runtime`, `agent` | Inspect authenticated harness capability and operate supported runtimes/workers |
15
15
  | Hub Operations | `kxm-hub-ops` | `hub`, `backup`, `restore` | Run and protect the local hub and its durable SQLite state |
16
16
  | Session Management | `kxm-session` | `session`, `dash`, `studio` | Resume/inspect operator work and use UI capabilities each harness supports |
@@ -89,7 +89,10 @@ The skills in this suite (`kxm-*`) are bundled and operational by default. They
89
89
 
90
90
  Separately, `kxm skills` manages community or experimental candidates through
91
91
  create/evaluate/promote/reject/verify. Those governed skills are distinct from
92
- this bundled suite. Telemetry cannot auto-promote a skill.
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.
93
96
 
94
97
  ## Development and Maintenance
95
98
 
@@ -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:
@@ -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/env.example`](../ .kxm/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.
@@ -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
@@ -100,3 +100,8 @@ A prompt produced with this skill includes:
100
100
  12. PR, CI/review monitoring, bounded remediation, and merge gate
101
101
  13. Verified post-merge cleanup
102
102
  14. Completion report
103
+
104
+ ## Related
105
+
106
+ - [Agent Skills](../agent-skills.md) — bundled command-suite skills
107
+ - [Skill candidate lifecycle](../skills.md) — governed `kxm skills` candidates
package/docs/skills.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  KXM turns verified episodes and lessons into reusable Agent Skills through a governed lifecycle. Runtime experience never becomes promoted skill content automatically, and promoted skills never grant tool or permission authority.
4
4
 
5
+ This page is the governed `kxm skills` lifecycle. For the bundled command-suite skills, see [Agent Skills](agent-skills.md). For converting a repository request into a delivery prompt, see [Repository work delivery](skills/repo-work-delivery.md).
6
+
5
7
  ## Lifecycle
6
8
 
7
9
  ```text
@@ -28,7 +28,7 @@ Set `KXM_WORKER_TOOL_TIMEOUT_MS` above the longest legitimate tool call. Its 31-
28
28
 
29
29
  ### A hub or worker PID claim is stale
30
30
 
31
- Version 0.4.3 prevents a second wrapper from replacing a live hub or worker claim. `kxm hub stop` ignores an invalid, non-running, or ownership-mismatched record rather than guessing. If a crash or pre-0.4.3 process left one behind, inspect the exact `.pid` JSON and verify that its recorded PID is no longer running; for a hub, also verify the configured port has no listener. Then remove only that exact `.pid` and its recorded `.stop` control file before relaunching once. Worker filenames include a project/agent identity digest and their records include the exact names and generation, so do not substitute a similarly sanitized filename. Never delete the `.kxm/state` directory or SQLite database to clear a claim.
31
+ Version 0.4.3 prevents a second wrapper from replacing a live hub or worker claim. `kxm hub stop` ignores an invalid, non-running, or ownership-mismatched record rather than guessing. A hub claim whose wrapper PID is dead is reclaimed automatically on the next `kxm hub start`; the wrapper also terminates an orphaned hub server child recorded by a dead wrapper (for example after `SIGKILL`) before reclaiming, and `kxm hub stop` can stop such an orphan directly. If a pre-0.4.3 process left a malformed claim behind, inspect the exact `.pid` JSON and verify that its recorded PID is no longer running; for a hub, also verify the configured port has no listener. Then remove only that exact `.pid` and its recorded `.stop` control file before relaunching once. Worker filenames include a project/agent identity digest and their records include the exact names and generation, so do not substitute a similarly sanitized filename. Never delete the `.kxm/state` directory or SQLite database to clear a claim.
32
32
 
33
33
  ### GitHub checks passed but the workflow is still waiting
34
34
 
@@ -44,6 +44,14 @@ Set `KXM_PORT` to a valid integer. Remove the variable to use `7331`.
44
44
 
45
45
  Either restore `KXM_HOST=127.0.0.1` or configure a token before using a non-loopback interface.
46
46
 
47
+ **`KXM hub env file is malformed`**
48
+
49
+ The persisted credential file (`hub-env.json` under the user state root) failed
50
+ validation. It holds only `KXM_AUTH_TOKEN` / `KXM_PROJECT_TOKENS` values in
51
+ `kxm.hub-env.v1` schema; fix its JSON or delete it to have kxm generate a
52
+ fresh admin token on the next start. To rotate the generated token, delete
53
+ the file and run `kxm hub start` again.
54
+
47
55
  #### Database schema is newer than this runtime supports
48
56
 
49
57
  Do not delete or rewrite the database. Start the package version that created it, or upgrade this runtime. Restore the pre-upgrade backup when rolling back.
@@ -107,6 +115,19 @@ release asset through the authenticated `gh release download` flow in
107
115
  `node scripts/kxm.mjs` from a clone after `npm ci`. `npx kxm` and a
108
116
  global `git+https` npm install are not supported installation paths.
109
117
 
118
+ For bash and zsh, `kxm completion install` can add the kxm bin directory to
119
+ `PATH` in the shell rc file when it is missing; restart the shell afterwards.
120
+
121
+ ### Tab completion is not active
122
+
123
+ Run `kxm completion install` for the detected shell, or pass
124
+ `--shell bash|zsh|fish` explicitly. The install appends one guarded stanza to
125
+ the shell rc file and is idempotent: rerunning never duplicates it. Fish needs
126
+ no rc entry because fish auto-loads `~/.config/fish/completions`. After
127
+ installing, start a new terminal or `source` the rc file. To inspect without
128
+ writing, use `--dry-run`; to suppress the post-`kxm init` offer, set
129
+ `KXM_SKIP_COMPLETION_PROMPT=1`.
130
+
110
131
  ### An expected peer is missing
111
132
 
112
133
  The two agents usually have different `KXM_PROJECT` values or one stopped sending heartbeats. Compare settings and check for an `agent_stale` event. Names and projects are case-sensitive for display; live-name uniqueness is case-insensitive.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextmind/kxm",
3
- "version": "0.7.0",
3
+ "version": "0.7.4",
4
4
  "description": "KXM local-first multi-agent orchestration and operator dashboard",
5
5
  "type": "module",
6
6
  "author": "KontextMind",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "kxm",
4
4
  "displayName": "KXM",
5
- "version": "0.7.0",
5
+ "version": "0.7.4",
6
6
  "description": "Headless multi-agent orchestration, durable workflows, and a live operator dashboard for Pi and Claude Code",
7
7
  "author": {
8
8
  "name": "KontextMind",