@kontextmind/kxm 0.7.92 → 0.7.93

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 (91) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.kxm/workflows/default.yaml +1 -1
  3. package/CHANGELOG.md +204 -0
  4. package/README.md +3 -0
  5. package/docs/README.md +3 -0
  6. package/docs/agent-skills.md +123 -60
  7. package/docs/architecture.md +5 -2
  8. package/docs/cli-reference.md +3527 -0
  9. package/docs/config-reference.md +1943 -0
  10. package/docs/configuration.md +29 -3
  11. package/docs/continuous-improvement.md +122 -10
  12. package/docs/contracts/routing.md +95 -11
  13. package/docs/harness-routing.md +616 -0
  14. package/docs/kxm-handbook.md +106 -19
  15. package/docs/templates/README.md +1 -1
  16. package/docs/test-matrix.md +12 -6
  17. package/docs/troubleshooting.md +2 -2
  18. package/examples/project/.kxm/workflows/fix.yaml +1 -1
  19. package/examples/project/.kxm/workflows/improve.yaml +1 -1
  20. package/package.json +1 -1
  21. package/plugins/kxm/.claude-plugin/plugin.json +9 -10
  22. package/plugins/kxm/README.md +238 -56
  23. package/plugins/kxm/dist/claude-hook.js +10083 -0
  24. package/plugins/kxm/dist/cli.js +3068 -2446
  25. package/plugins/kxm/dist/client.js +64 -0
  26. package/plugins/kxm/dist/core.js +102 -9
  27. package/plugins/kxm/dist/extension.js +210 -68
  28. package/plugins/kxm/dist/mcp-server.js +217 -40
  29. package/plugins/kxm/dist/runtime-supervisor.js +1628 -157
  30. package/plugins/kxm/dist/runtime.js +1874 -298
  31. package/plugins/kxm/dist/server.js +416 -82
  32. package/plugins/kxm/package.json +1 -1
  33. package/plugins/kxm/skills/hints.json +1 -1
  34. package/plugins/kxm/skills/kxm/SKILL.md +48 -24
  35. package/plugins/kxm/skills/kxm/references/protocol.md +3 -3
  36. package/plugins/kxm/skills/kxm-context-memory/SKILL.md +61 -21
  37. package/plugins/kxm/skills/kxm-definitions/SKILL.md +9 -0
  38. package/plugins/kxm/skills/kxm-harness-auth/SKILL.md +82 -16
  39. package/plugins/kxm/skills/kxm-harvest/SKILL.md +1 -1
  40. package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +55 -27
  41. package/plugins/kxm/skills/kxm-insights/SKILL.md +1 -1
  42. package/plugins/kxm/skills/kxm-mind/SKILL.md +2 -2
  43. package/plugins/kxm/skills/{kxm-setup → kxm-mind-setup}/SKILL.md +4 -4
  44. package/plugins/kxm/skills/kxm-peer/SKILL.md +68 -93
  45. package/plugins/kxm/skills/kxm-project-setup/SKILL.md +156 -23
  46. package/plugins/kxm/skills/kxm-projects/SKILL.md +1 -1
  47. package/plugins/kxm/skills/kxm-protocol/SKILL.md +1 -1
  48. package/plugins/kxm/skills/kxm-query/SKILL.md +1 -1
  49. package/plugins/kxm/skills/kxm-routing-improve/SKILL.md +74 -15
  50. package/plugins/kxm/skills/kxm-runs/SKILL.md +46 -17
  51. package/plugins/kxm/skills/kxm-session/SKILL.md +64 -36
  52. package/plugins/kxm/skills/kxm-skill-lifecycle/SKILL.md +44 -15
  53. package/plugins/kxm/skills/kxm-tasks/SKILL.md +16 -4
  54. package/plugins/kxm/skills/kxm-triage/SKILL.md +1 -1
  55. package/plugins/kxm/skills/kxm-work/SKILL.md +1 -1
  56. package/plugins/kxm/skills/kxm-workflow/SKILL.md +60 -19
  57. package/plugins/kxm/src/arbiter.ts +67 -22
  58. package/plugins/kxm/src/autocomplete.ts +1 -1
  59. package/plugins/kxm/src/claude-hook.ts +192 -0
  60. package/plugins/kxm/src/cli/project.ts +11 -5
  61. package/plugins/kxm/src/cli/system.ts +85 -13
  62. package/plugins/kxm/src/cli/types.ts +4 -1
  63. package/plugins/kxm/src/cli/workflows.ts +18 -16
  64. package/plugins/kxm/src/cli.ts +23 -13
  65. package/plugins/kxm/src/client.ts +15 -4
  66. package/plugins/kxm/src/commands.ts +19 -9
  67. package/plugins/kxm/src/config.ts +42 -7
  68. package/plugins/kxm/src/context-packet.ts +14 -2
  69. package/plugins/kxm/src/context.ts +16 -5
  70. package/plugins/kxm/src/dispatch-context.ts +286 -0
  71. package/plugins/kxm/src/engine-plan.ts +40 -0
  72. package/plugins/kxm/src/engine.ts +138 -6
  73. package/plugins/kxm/src/hub-env.ts +17 -1
  74. package/plugins/kxm/src/hub.ts +92 -29
  75. package/plugins/kxm/src/improve-sources.ts +228 -0
  76. package/plugins/kxm/src/improve.ts +325 -140
  77. package/plugins/kxm/src/local-snapshot.ts +101 -42
  78. package/plugins/kxm/src/mcp-server.ts +129 -30
  79. package/plugins/kxm/src/project-config.ts +25 -0
  80. package/plugins/kxm/src/protocol.ts +11 -0
  81. package/plugins/kxm/src/relevance.ts +138 -0
  82. package/plugins/kxm/src/retrospective.ts +16 -10
  83. package/plugins/kxm/src/runtime-service.ts +8 -1
  84. package/plugins/kxm/src/runtime-supervisor.ts +16 -2
  85. package/plugins/kxm/src/session-token-hint.ts +17 -0
  86. package/plugins/kxm/src/suggest.ts +7 -7
  87. package/plugins/kxm/src/workflow-manager.ts +80 -78
  88. package/plugins/kxm/src/workflow.ts +202 -12
  89. package/scripts/build-runtime.mjs +7 -1
  90. package/scripts/check-generated.mjs +1 -0
  91. package/scripts/emit-codex-artifacts.mjs +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-plugin",
3
- "version": "0.7.92",
3
+ "version": "0.7.93",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "engines": {
@@ -58,7 +58,7 @@
58
58
  "complete": ["km_projects", "km_project_add", "km_reindex", "km_invite"]
59
59
  },
60
60
  {
61
- "name": "kxm-setup",
61
+ "name": "kxm-mind-setup",
62
62
  "argumentHint": "[serve|login|init|doctor]",
63
63
  "triggers": ["install", "serve", "login", "kontext init", "kontext doctor"],
64
64
  "complete": ["npx kontextmind serve", "kontext login", "kontext init", "kontext doctor"]
@@ -1,31 +1,46 @@
1
1
  ---
2
2
  name: kxm
3
- description: Select the right suite skill; state universal safety rules and portable CLI convention. Use this skill to route to the appropriate specialized skill for each KXM command category.
3
+ description: Entry point for KXM, the kxm CLI and the Claude Code plugin kxm_* MCP tools. Use when the user mentions KXM or kxm, asks which command or kxm_* tool to use, or a task spans setup, hub, peers, workflows, runs, context and memory, or improvement.
4
4
  ---
5
5
 
6
- # KXM Lightweight Router
6
+ # KXM router
7
7
 
8
- This skill routes to the appropriate specialized skill for each KXM command category. Use this skill to determine which specific skill handles the command you need.
8
+ Pick the skill that owns the request, then follow it. These bundled skills
9
+ document the current CLI. They do not switch runtime YAML authority, admit
10
+ writers, or replace `.kxm/roster.yaml` trusted policy.
9
11
 
10
- These bundled skills document the current CLI. They do not switch runtime YAML
11
- authority, admit writers, or replace `.kxm/roster.yaml` trusted policy.
12
+ ## Route by request
12
13
 
13
- ## Command Routing Guide
14
+ | Request | Skill | Commands owned |
15
+ |---|---|---|
16
+ | Set up or upgrade a project, onboard, run a first workflow | `kxm-project-setup` | `init`, `trust`, `config`, `completion` |
17
+ | Harness installs and auth, updates, the Runtime supervisor, model inventory, route admission, SSH workers, Pi workers | `kxm-harness-auth` | `harness`, `auth`, `update`, `runtime`, `agent`, `models`, `routes`, `ssh` |
18
+ | Hub health, binding, tenant status, backup and restore | `kxm-hub-ops` | `hub`, `backup`, `restore`, `tenant` |
19
+ | Session status, dashboard screens, studio layout | `kxm-session` | `session`, `dash`, `studio` |
20
+ | Delegate to or answer another agent | `kxm-peer` | `peer` (`peer await` is capped at 60 seconds) |
21
+ | Work inside a durable workflow run, gates, signed callbacks | `kxm-workflow` | `workflow`, `gate` |
22
+ | Role definitions, role hosts, model rosters | `kxm-definitions` | `role` |
23
+ | Create, drive, inspect, or cancel a run | `kxm-runs` | `run`, `runs` |
24
+ | What we know or decided, recall, context footprint, Git memory | `kxm-context-memory` | `context`, `memory`, `explain` |
25
+ | Turn a repeated practice into a governed skill | `kxm-skill-lifecycle` | `skills` |
26
+ | What KXM learned, repeated asks, recorded route spend | `kxm-routing-improve` | `routing`, `improve` |
27
+ | Which workflow fits, goals and tasks | `kxm-tasks` | `suggest`, `goal`, `task` |
28
+ | Remote browser sessions, human takeover, exploration, UI verification | `kxm-browser-session`, `kxm-browser-takeover`, `kxm-browser-auth`, `kxm-browser-explore`, `kxm-browser-verify`, `kxm-browser-diagnostics`, `kxm-browser-annotate` | none |
29
+ | KontextMind, the separate knowledge plane with its own kontext CLI | `kxm-mind` | none |
14
30
 
15
- The KXM Agent Skills suite is organized by functional areas:
31
+ ## MCP tools
16
32
 
17
- - **Project Setup**: Use `kxm-project-setup` for `init`, `trust`, `config`, `completion`
18
- - **Harness & Auth**: Use `kxm-harness-auth` for `harness`, `auth`, `update`, `runtime`, `agent`
19
- - **Hub Operations**: Use `kxm-hub-ops` for `hub`, `backup`, `restore`
20
- - **Session Management**: Use `kxm-session` for `session`, `dash`, `studio`
21
- - **Peer Communication**: Use `kxm-peer` for `peer` commands (`peer await` is capped at 60 seconds)
22
- - **Workflow Management**: Use `kxm-workflow` for `workflow`, `gate`
23
- - **Definitions**: Use `kxm-definitions` for `role`
24
- - **Run Management**: Use `kxm-runs` for `run`, `runs`
25
- - **Context & Memory**: Use `kxm-context-memory` for `context`, `memory`
26
- - **Skills Lifecycle**: Use `kxm-skill-lifecycle` for `skills`
27
- - **Routing & Improvement**: Use `kxm-routing-improve` for `routing`, `improve`
28
- - **Tasks**: Use `kxm-tasks` for `suggest`, `goal`, `task`
33
+ | Tools | Skill |
34
+ |---|---|
35
+ | `kxm_list`, `kxm_send`, `kxm_get`, `kxm_await`, `kxm_cancel`, `kxm_fanout`, `kxm_inbox`, `kxm_reply` | `kxm-peer` |
36
+ | `kxm_workflow_list`, `kxm_workflow_get`, `kxm_workflow_record`, `kxm_workflow_checkpoint`, `kxm_workflow_wait` | `kxm-workflow` |
37
+ | `kxm_context`, `kxm_recall`, `kxm_state`, `kxm_episode`, `kxm_promote` | `kxm-context-memory` |
38
+ | `kxm_improvement_report` | `kxm-routing-improve` |
39
+
40
+ ## Status
41
+
42
+ Check hub and session status with `kxm hub view` and `kxm session status`.
43
+ Both read only. `kxm hub view` exits 1 when the hub is down.
29
44
 
30
45
  ## Universal Safety Rules
31
46
 
@@ -33,12 +48,21 @@ The KXM Agent Skills suite is organized by functional areas:
33
48
  2. **Credential Protection**: Never include credentials or raw secrets in peer messages or public contexts
34
49
  3. **Verification Required**: Always verify outcomes from peer responses before acting on them
35
50
  4. **Single Writer**: Never write concurrently to the same checkout; use separate worktrees or rotations
51
+ 5. **User-owned actions**: Credentials, hub start and bind, plugin configuration, and reviewing and committing .kxm permission changes are the user's actions. Ask the user to do them and never commit .kxm changes yourself.
36
52
 
37
53
  ## Portable CLI Convention
38
54
 
39
- All KXM commands support `--json` for machine-readable output and follow consistent parameter patterns:
55
+ - Use `--json` for structured output.
56
+ - Flags differ per command; read `kxm <group> <verb> --help`. For example,
57
+ `kxm context get` scopes with `--run` and `--stage`, while
58
+ `kxm workflow checkpoint` uses `--run-id` and `--stage-id`.
59
+ - `--help` after an unknown subcommand prints the group's help and exits 0.
60
+ Confirm a verb exists by checking that the `Usage:` line names it.
61
+ - Teach only verbs and options that the help prints; do not invent
62
+ subcommands.
63
+
64
+ ## References
40
65
 
41
- - Use `--json` for structured output
42
- - Parameter names are consistent across commands (e.g., `--run-id`, `--stage-id`)
43
- - Help is available with `kxm <group> --help`
44
- - Teach only verbs and options that exist in `kxm <group> --help`; do not invent subcommands
66
+ - [Hub protocol reference](references/protocol.md): HTTP routes, message
67
+ states, delivery modes, and the trust boundary behind the peer and workflow
68
+ tools.
@@ -1,4 +1,4 @@
1
- # Pi Mesh protocol reference
1
+ # KXM hub protocol reference
2
2
 
3
3
  The hub exposes a project-scoped HTTP API and an SSE event stream.
4
4
 
@@ -23,8 +23,8 @@ Operational routes are `GET /health`, `GET /ready`, and authenticated `GET /metr
23
23
  - `POST /v1/workflows/:runId/waits` pauses the active stage for a named external signal and bounded deadline, optionally accumulating verified local keyed evidence.
24
24
  - `POST /v1/workflows/:runId/degradations` uses administrative authentication to approve a configured lower peer quorum for the exact current stage, requirement, and attempt.
25
25
  - `POST /v1/webhooks/:definitionId/runs/:runId/signals/:signalKey` accepts a signed, retry-deduplicated external checkpoint result.
26
- - `POST /v1/workflows/:runId/journal` records a plan, decision, contradiction, error, or lesson.
27
- - `GET /v1/improvements` groups project journal evidence by improvement area.
26
+ - `POST /v1/workflows/:runId/journal` records an entry in one of ten journal categories. An optional `stageId` binds it to that stage: the hub derives the attempt, and `area` defaults to the stage's declared area.
27
+ - `GET /v1/improvements` groups project journal evidence by improvement area and returns ranked, redacted `signals` merged across runs.
28
28
 
29
29
  Webhook and signal bodies require SHA-256 HMAC validation and a stable provider delivery ID. Workflow routes require both project authentication and the assigned coordinator identity. Signal routes use `signalSecretEnv` when configured and otherwise use the workflow-start secret.
30
30
 
@@ -1,38 +1,64 @@
1
1
  ---
2
2
  name: kxm-context-memory
3
- description: Retrieve scoped KXM context, inspect evidence lineage, and record Git memory candidates across supported harnesses. Use for recalling decisions or proposing durable learning; distinguish candidates from approved authoritative state.
3
+ description: Retrieve role-aware KXM context and record Git memory candidates with kxm context get, recall, state, episode and explain (MCP kxm_context, kxm_recall, kxm_state, kxm_episode), propose a state change with kxm_promote, check a mode's context footprint with kxm explain, and note or sync project memory. Promoting an approved proposal with kxm context promote is an operator action. Use when asked what we know or decided, to recall prior runs or lessons, to explain why an item is in a packet, or to record a durable learning.
4
4
  ---
5
5
 
6
- # KXM Context and Memory
6
+ # KXM context and memory
7
7
 
8
- Use KXM's common CLI across supported harnesses. Do not query underlying
9
- memory providers directly or copy credentials into context. Begin with a
10
- small role-aware packet rather than an unbounded history dump.
8
+ Use KXM's common CLI or MCP tools across supported harnesses. Do not query
9
+ underlying memory providers directly or copy credentials into context. Begin
10
+ with a small role-aware packet rather than an unbounded history dump.
11
11
 
12
- ## Context Commands
12
+ ## Context commands
13
13
 
14
14
  | Command | Purpose | Options |
15
15
  |---|---|---|
16
16
  | `kxm context get <project>` | Assemble a role-aware packet | Required `--role`, `--task`; optional `--run`, `--stage`, `--budget`, `--kinds` |
17
- | `kxm context recall <project>` | Search durable metadata | `--query`, `--kinds`, `--limit` |
18
- | `kxm context state <project> <key>` | Inspect current or historical state | `--as-of` |
19
- | `kxm context episode <project>` | Inspect learning from workflow journals | `--run` |
20
- | `kxm context explain <project> <itemId>` | Inspect evidence and lineage | `--json` |
21
- | `kxm context promote <project> <proposalId>` | Control-plane promotion of an approved proposal | Required `--evidence <refs>` |
22
-
23
- All commands accept `--json`. Use comma-separated kind filters and evidence
24
- references where requested. Verify command-specific `--help` before mutations.
25
- The CLI promotion command is not the same interface as an agent tool that
26
- merely proposes state: never substitute a state key for a proposal ID or
27
- assume that a proposal grants approval.
17
+ | `kxm context recall <project>` | Search durable context records (metadata only) | `--query`, `--kinds`, `--limit` (1-100) |
18
+ | `kxm context state <project> <key>` | Current or historical value of one state key | `--as-of <iso>` |
19
+ | `kxm context episode <project>` | Episodic learning from workflow journals | `--run` |
20
+ | `kxm context explain <project> <itemId>` | Evidence and lineage behind one context item | `--json` |
21
+
22
+ All commands accept `--json`. Use comma-separated kind filters. The `context`
23
+ commands need a reachable hub: check `kxm hub view` first, because they exit 1
24
+ with a stack trace and no JSON when the hub is down.
25
+
26
+ ## CLI and MCP
27
+
28
+ | CLI | MCP tool | MCP arguments |
29
+ |---|---|---|
30
+ | `kxm context get` | `kxm_context` | `role`, `task`, `workflowRunId`, `stageId`, `budgetTokens`, `includeKinds` (`evidence`, `state`, `episode`, `knowledge`, `skill`) |
31
+ | `kxm context recall` | `kxm_recall` | `query`, `kinds`, `limit` (1-100) |
32
+ | `kxm context state` | `kxm_state` | `key`, `asOf` |
33
+ | `kxm context episode` | `kxm_episode` | `workflowRunId` |
34
+ | none | `kxm_promote` | Proposes a state change only (`key`, `summary`, `authority`, `confidence`, `evidenceRefs`) |
35
+
36
+ Packets and recall are ranked deterministically, without a model. `context get`
37
+ orders eligible items by contradiction, project before shared defaults, task
38
+ match, role kind, lexical relevance to `--task`, confidence, authority and
39
+ recency, fills the budget first-fit, and reports numeric `audit.relevance`.
40
+ `context recall` returns whole-query matches first, then items sharing a query
41
+ word by relevance, then id, each with a numeric `relevance` and never a
42
+ summary. Write a specific `--task` or `--query`: the words drive the ranking.
28
43
 
29
44
  ```bash
30
45
  kxm context get my-project --role implementer --task "inspect configuration authority" --budget 4000 --json
31
46
  kxm context recall my-project --query "configuration decisions" --limit 5 --json
32
47
  kxm context state my-project "configuration.authority" --json
48
+ kxm context explain my-project ctx_123 --json
33
49
  ```
34
50
 
35
- ## Git Memory Commands
51
+ ## Context footprint
52
+
53
+ `kxm explain [--mode coder|planner|auditor|browser] [--domains <list>] [--model <id>]`
54
+ estimates the prompt footprint and per-turn cost of a workflow mode before a
55
+ run. It reads only; costs stay unknown when the price catalog is missing.
56
+
57
+ ```bash
58
+ kxm explain --mode planner --model claude/fable --json
59
+ ```
60
+
61
+ ## Git memory commands
36
62
 
37
63
  | Command | Purpose | Options |
38
64
  |---|---|---|
@@ -67,15 +93,29 @@ Do not invent search, save, delete, list, or clear subcommands under memory.
67
93
  Use context retrieval for discovery and reviewed authored changes for
68
94
  corrections, respecting provenance and historical records.
69
95
 
70
- ## Authority and Safety
96
+ ## Authority and safety
71
97
 
98
+ - `kxm_promote` only proposes a state change. The proposal is not approval,
99
+ and a state key is never a proposal ID.
72
100
  - A candidate, recommendation, or learned skill cannot grant tools, admit a
73
101
  writer, change a workflow gate, or waive independent review.
74
- - Promotion requires durable evidence and authorized control-plane approval.
75
- Do not self-approve a proposal merely because you generated it.
102
+ - Do not self-approve a proposal merely because you generated it.
76
103
  - Preserve project/run scope and distinguish hypotheses from verified facts.
77
104
  - Keep secrets and unrelated private observations out of shared packets.
78
105
  - Pi, native harnesses, and generated instruction projections consume the
79
106
  same KXM policy; none creates a separate authoritative memory store here.
107
+ - `kxm run` agents receive only committed, pinned memory (project or operator
108
+ scope) and hash-verified promoted skills. Uncommitted or changed memory is
109
+ withheld with a `dispatch_context_*` gap until it is committed and a new run
110
+ pins it; a successful `memory note` does not reach a dispatched agent.
80
111
  - Wiki compile/ingest is deferred by this project's release policy. Do not
81
112
  activate it merely because a CLI entry exists.
113
+
114
+ ## Operator steps
115
+
116
+ Promotion is a control-plane decision that belongs to the user or another
117
+ authorized approver, not to the agent that proposed it.
118
+
119
+ | Command | Purpose | Options |
120
+ |---|---|---|
121
+ | `kxm context promote <project> <proposalId>` | Promote an approved state proposal | Required `--evidence <refs>` |
@@ -15,6 +15,7 @@ or permission to execute an assignment.
15
15
  ```bash
16
16
  kxm role list --scope all --json
17
17
  kxm role get writer --scope local --json
18
+ kxm role hosts --json
18
19
  kxm role --help
19
20
  ```
20
21
 
@@ -31,11 +32,19 @@ changes every project or the trusted developer runner.
31
32
  | `kxm role add [roleId]` | Add a YAML definition or construct a role | `--file`, `--description`, `--skills`, `--harness`, `--model`, `--scope`, `--overwrite`, `--pick` |
32
33
  | `kxm role modify [roleId]` | Change description, skill references, or model roster | `--description`, `--add-skill`, `--remove-skill`, `--add-model <harness:model>`, `--remove-model`, `--scope`, `--pick` |
33
34
  | `kxm role remove [roleId]` | Remove a definition | `--scope`, `--pick` |
35
+ | `kxm role hosts` | List role seats and the host, model, and effort each resolves to, with the source of that decision | `--scope all\|global\|local` |
36
+ | `kxm role set-host <seatId> <host>` | Bind a role seat to a host in `.kxm/role-hosts.yaml` | `--model`, `--effort low\|medium\|high\|xhigh`, `--scope global\|local` |
37
+ | `kxm role resume <runId> [ruling]` | Resume an audit-escalated run with an operator directive | `[ruling]` free text |
34
38
 
35
39
  Use `--json` for structured output. Inspect command-specific `--help` before
36
40
  constructing a mutation; do not invent `create`, `update`, `delete`, `validate`,
37
41
  or `apply` subcommands under `kxm role`.
38
42
 
43
+ `kxm role hosts` reads only. `kxm role set-host` writes `.kxm/role-hosts.yaml`
44
+ (or the global file); show the user the resulting diff. `kxm role resume`
45
+ records the operator's ruling on an audit escalation: run it only with the
46
+ ruling the user gave you, and preview a KXM run with `--dry-run` first.
47
+
39
48
  ## Make an Authorized Change
40
49
 
41
50
  1. Inspect the existing role and its owning scope.
@@ -1,34 +1,100 @@
1
1
  ---
2
2
  name: kxm-harness-auth
3
- description: Inspect authenticated harness capability and operate supported runtimes/workers without inventing fallback.
3
+ description: Check which coding-agent harnesses are installed and authenticated, update kxm, harness CLIs and the Claude plugin, manage the Runtime supervisor, refresh the model inventory, admit or disable model routes, run remote SSH workers, and start Pi workers. Use when a dispatch fails on auth, a route is not admitted, the runtime is down, or the operator asks to update.
4
4
  ---
5
5
 
6
- # KXM Harness and Auth
6
+ # KXM harness and auth
7
7
 
8
- `kxm harness list` is observational (`yes|no|unknown`). `unknown` and `no` are
9
- never eligible. Do not invent install/login/status verbs. Native harnesses
10
- keep their own login; do not silently bill through Pi.
8
+ `kxm harness list` is observational (`yes|no|unknown`); `unknown` and `no` are
9
+ never eligible. Native harnesses keep their own login; do not silently bill
10
+ through Pi. Do not invent install, login, or status verbs.
11
11
 
12
- ## Commands
12
+ ## Harnesses and tokens
13
13
 
14
14
  | Command | Purpose | Options / arguments |
15
15
  |---|---|---|
16
16
  | `kxm harness list` | Installed harnesses, auth, and native updaters | `--json` |
17
- | `kxm auth token` | Inspect, issue, or clear local session tokens | `--status`, `--clear`, `--issue` |
18
- | `kxm update [harness]` | Update kxm, harness CLIs, extensions, catalogs | `--check`, `--kxm`, `--self`, `--extensions`, `--models` |
19
- | `kxm runtime start` | Start the Runtime supervisor | `--json` |
20
- | `kxm runtime status` | Supervisor liveness | `--json` |
21
- | `kxm runtime stop` | Stop the supervisor | `--json` |
17
+ | `kxm auth token --status` | Report the local session token | `--json` |
18
+ | `kxm auth token --clear` | Delete the local session token file | `--json` |
19
+
20
+ Issuing a token is an operator action. When kxm_* tools fail with
21
+ `tool_policy_denied` for an expired or malformed session token file,
22
+ `kxm auth token --clear` removes it; `--status` reports
23
+ `No active session token found in env or disk` for such a file even though it
24
+ still blocks the tools.
25
+
26
+ ## Updates
27
+
28
+ | Command | Purpose |
29
+ |---|---|
30
+ | `kxm update --check` | Check for a kxm package update without applying it |
31
+ | `kxm update --kxm` | Apply the kxm package update |
32
+ | `kxm update [harness] --self` | Update only the harness CLI |
33
+ | `kxm update [harness] --extensions` | Update only extensions and plugins (Pi packages, the Claude kxm plugin) |
34
+ | `kxm update [harness] --models` | Refresh model catalogs where the harness supports it |
35
+
36
+ - `kxm update --kxm` downloads the GitHub release tarball by default, so it
37
+ needs an authenticated `gh`.
38
+ - `kxm update claude --extensions` updates only a user-scope plugin install;
39
+ its dry run prints `claude extensions: would claude plugin update kxm -y`.
40
+ A project-scope install is the operator's `claude plugin update kxm@kxm --scope project`.
41
+ - Preview any update with `--dry-run`.
42
+
43
+ ## Runtime supervisor
44
+
45
+ | Command | Purpose |
46
+ |---|---|
47
+ | `kxm runtime start` | Start the Runtime supervisor if it is not running |
48
+ | `kxm runtime status` | Supervisor liveness and per-project sync state; exits 1 when it is down |
49
+ | `kxm runtime sync-retry` | Re-queue outbox rows the hub durably refused, after the hub-side state is corrected |
50
+ | `kxm runtime stop` | Gracefully stop the supervisor |
51
+
52
+ `kxm run` starts the supervisor on demand. Stop it with `kxm runtime stop` when
53
+ work is finished.
54
+
55
+ ## Models and routes
56
+
57
+ | Command | Purpose | Options |
58
+ |---|---|---|
59
+ | `kxm models inventory-refresh` | Refresh `.kxm/models/inventory.yaml` from the OpenRouter and Nous catalogs (alias `refresh`) | `--dry-run`, `--json` |
60
+ | `kxm routes list` | List admitted and disabled routes | `--json` |
61
+ | `kxm routes count` | Count admitted and disabled routes | `--json` |
62
+ | `kxm routes admit` | Admit a model route from the inventory | `--model <id>`, `--dry-run` |
63
+ | `kxm routes disable` | Disable a model route | `--model <id>`, `--dry-run` |
64
+
65
+ `kxm routes admit` and `kxm routes disable` write `.kxm/routes.yaml`, and the
66
+ model must exist in the inventory. Without `--model` in a non-interactive
67
+ shell they exit 2 with `model_selection_required`. Run them only when the user
68
+ asks, then show `kxm trust diff` and let the user review and commit the
69
+ change. A listed or admitted route is not proof of authentication.
70
+
71
+ ## SSH workers
72
+
73
+ | Command | Purpose | Options / arguments |
74
+ |---|---|---|
75
+ | `kxm ssh info [host]` | Discover SSH host aliases and parameters without opening sockets | `--json` |
76
+ | `kxm ssh run <host> <command...>` | Run a command on a host over a multiplexed ControlMaster socket | `--sudo` |
77
+ | `kxm ssh file <host> <path>` | Read or write a remote file | `--read`, `--content <text>`, `--append`, `--sudo` |
78
+ | `kxm ssh close <host>` | Close the host's ControlMaster socket | `--json` |
79
+
80
+ `kxm ssh run` and `kxm ssh file` act on the remote host. Confirm the host and
81
+ command with the user first and never use `--sudo` unasked.
82
+
83
+ ## Pi workers
84
+
85
+ | Command | Purpose | Options |
86
+ |---|---|---|
22
87
  | `kxm agent worker` | Start a long-lived Pi worker | `--name`, `--project`, `--model`, `--fallback-models`, `--tools`, `--session-isolation`, `--no-continue`, `--fresh-start` |
23
88
 
89
+ Only Pi is a supervised RPC worker (`kxm agent worker`, `pi --mode rpc`).
90
+ Grok and agy are one-shot headless CLIs, not workers. Listing a harness does
91
+ not grant edit permission or writer admission.
92
+
24
93
  ```bash
25
94
  kxm harness list --json
26
95
  kxm auth token --status --json
27
96
  kxm update --check --json
28
- kxm update --models
29
97
  kxm runtime status --json
98
+ kxm routes list --json
99
+ kxm ssh info --json
30
100
  ```
31
-
32
- Only Pi is a supervised RPC worker (`kxm agent worker` / `pi --mode rpc`).
33
- Grok and agy are one-shot headless CLIs, not workers. Listing a harness does
34
- not grant edit permission or writer admission.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kxm-harvest
3
- description: Extract durable KontextMind learnings at session end. Use when asked to harvest, close session, file a learning, km_append, save a checkpoint, or write a handoff. Redacts secrets first, dedupes against the mind, then drafts to local/project/org.
3
+ description: KontextMind knowledge plane only, the separate kontext CLI and km_ tools, not KXM or this plugin's kxm_* tools. Drafts redacted session learnings into a KontextMind mind with km_append. Use only when the user names KontextMind, the kontext CLI, or a km_ tool.
4
4
  license: Apache-2.0
5
5
  compatibility: Any agent that can run a shell or MCP client. No vendor-only tools.
6
6
  metadata:
@@ -1,43 +1,71 @@
1
1
  ---
2
2
  name: kxm-hub-ops
3
- description: Run and protect the local hub and its durable SQLite state.
3
+ description: Start, inspect, stop, bind, and unbind the KXM hub (default http://127.0.0.1:7331), read tenant status, and back up or restore its SQLite state. Use when kxm_list or peer commands cannot reach the hub, when binding to a local or authenticated remote hub, or before upgrades.
4
4
  ---
5
5
 
6
- # KXM Hub Operations
6
+ # KXM hub operations
7
7
 
8
- Hub process CLI is `start`, `view`, `stop`, plus bind/unbind. Backup writes a
9
- verified SQLite archive; restore takes that manifest. Do not invent restart
10
- or backup subcommands.
8
+ The hub serves peers and webhook workflows on `http://127.0.0.1:7331` by
9
+ default. Its CLI is `start`, `view`, `stop`, `bind`, and `unbind`. Do not
10
+ invent restart or status subcommands.
11
11
 
12
- ## Commands
12
+ ## Agent steps
13
13
 
14
14
  | Command | Purpose | Options / arguments |
15
15
  |---|---|---|
16
- | `kxm hub start` | Start the hub | `--json` |
17
- | `kxm hub view` | Check `/health` and `/ready` | `--json` |
18
- | `kxm hub stop` | Request managed shutdown | `--wait-ms <ms>` |
19
- | `kxm hub bind <url>` | Bind this machine to a running hub | http or https URL |
20
- | `kxm hub unbind` | Remove this machine's hub binding | `--json` |
21
- | `kxm backup` | Verified SQLite backup of all stores | `--out <dir>` |
22
- | `kxm restore <manifest>` | Restore from a verified backup manifest | `--json` |
16
+ | `kxm hub view` | Check `/health` and `/ready`; exits 1 when the hub is down | `--json` |
17
+ | `kxm tenant status` | Hub metadata and Runtime run state as one labeled view; reads only and never starts the supervisor | `--json` |
18
+ | `kxm backup` | Verified SQLite backup of the hub stores with a hashed manifest | `--out <dir>`, `--json` |
19
+
20
+ ```bash
21
+ kxm hub view --json
22
+ kxm tenant status --json
23
+ kxm backup --out .kxm/backups/pre-upgrade --json
24
+ ```
25
+
26
+ `kxm tenant status` reports an unreadable source as `unavailable` with a
27
+ reason such as `hub_unreachable` or `runtime_supervisor_not_running`, and sets
28
+ `degraded`. It exits 0 when at least one source was read. Hub runs and Runtime
29
+ runs have separate ID spaces, so a comparison with no shared ID is
30
+ `unverified`, never agreement.
23
31
 
24
- Durable hub SQLite default is `.kxm/state/kxm.db` (`KXM_DATA_PATH`).
32
+ The durable hub store defaults to `.kxm/state/kxm.db` (`KXM_DATA_PATH`). Do not
33
+ hand-edit it. `kxm backup` does not include the Runtime supervisor's stores
34
+ under the user state root.
25
35
 
26
- `kxm hub start` requires no token setup on a fresh machine: when
27
- `KXM_AUTH_TOKEN` is unset, a long random admin token is generated once and
28
- persisted in `hub-env.json` (schema `kxm.hub-env.v1`, `0600`) under the user
29
- state root, then reused by every restart, worker, and dashboard. Explicit
30
- `KXM_AUTH_TOKEN` / `KXM_PROJECT_TOKENS` values win and are persisted too.
31
- Hub PID claims record the wrapper and server child PID; a dead wrapper's
32
- claim is reclaimed automatically, an orphaned server is terminated first,
33
- and `kxm hub stop` recovers such orphans directly.
36
+ ## Operator steps
37
+
38
+ Ask the user to run these in their own terminal. Never read, print, or store
39
+ the hub admin token or a project token.
40
+
41
+ | Command | Purpose | Options / arguments |
42
+ |---|---|---|
43
+ | `kxm hub start` | Start the hub in the foreground | `--json` |
44
+ | `kxm hub stop` | Request managed hub and worker shutdown | `--wait-ms <ms>` |
45
+ | `kxm hub bind <url>` | Bind this machine to a running hub | http or https URL |
46
+ | `kxm hub unbind` | Remove this machine's hub binding | `--json` |
47
+ | `kxm restore <manifest>` | Replace the live stores from a verified backup manifest | `--json` |
34
48
 
35
49
  ```bash
36
50
  kxm hub start
37
- kxm hub view --json
38
- kxm hub bind http://127.0.0.1:8787
39
- kxm backup --out /tmp/kxm-backup
40
- kxm restore /tmp/kxm-backup/manifest.json
51
+ kxm hub bind http://127.0.0.1:7331
52
+ kxm restore .kxm/backups/pre-upgrade/manifest.json
41
53
  ```
42
54
 
43
- Do not hand-edit the hub database or skip restore verification.
55
+ - `kxm hub start` needs no token setup on a fresh machine. When
56
+ `KXM_AUTH_TOKEN` is unset it generates a long random admin token once and
57
+ persists it in `hub-env.json` (schema `kxm.hub-env.v1`, mode `0600`) under
58
+ the user state root, then reuses it on every restart.
59
+ - `KXM_PROJECT_TOKENS` must list every project's token. It replaces the saved
60
+ token map rather than merging with it, and the replacement is saved. When a
61
+ hub already serves other projects, build the full map with the merge
62
+ command in the KXM README before restarting the hub.
63
+ - `kxm hub bind` to a remote (non-loopback) URL fails closed with
64
+ `hub_bind_unauthenticated` unless a credential for the current project
65
+ resolves from `KXM_AUTH_TOKEN` or the persisted `hub-env.json`.
66
+ - Hub PID claims record the wrapper and server child PID. A dead wrapper's
67
+ claim is reclaimed automatically, an orphaned server is terminated first,
68
+ and `kxm hub stop` recovers such orphans directly.
69
+ - `kxm restore` replaces the live stores. Preview it with
70
+ `kxm restore <manifest> --dry-run`, stop the hub first, and never skip
71
+ restore verification.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kxm-insights
3
- description: KontextMind workflow intelligence — loop patterns, knowledge gaps, and evidence-backed recommendations. Use when asked for insights, what the mind observed, loops, gaps, or km_insights list/dismiss.
3
+ description: KontextMind knowledge plane only, the separate kontext CLI and km_ tools, not KXM or this plugin's kxm_* tools. Lists and dismisses KontextMind insights with km_insights. Use only when the user names KontextMind, the kontext CLI, or a km_ tool.
4
4
  license: Apache-2.0
5
5
  compatibility: Any agent that can run a shell or MCP client. No vendor-only tools.
6
6
  metadata:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: kxm-mind
3
- description: Router for the KontextMind knowledge plane on any agent harness. Use when the user mentions KontextMind, the mind, km_ tools, kontext CLI, harvest, triage, handoffs, insights, reindex, or KM-Session trailers. Does not replace the KXM peer/workflow skill named kxm.
3
+ description: KontextMind knowledge plane only, the separate kontext CLI and km_ tools, not KXM or this plugin's kxm_* tools. Routes a KontextMind request to the matching knowledge-plane skill. Use only when the user names KontextMind, the kontext CLI, or a km_ tool.
4
4
  license: Apache-2.0
5
5
  compatibility: Any agent that can run a shell or MCP client (Claude Code, Cursor, Codex, Pi, Gemini, Grok, and others). No vendor-only tools.
6
6
  metadata:
@@ -31,7 +31,7 @@ Slash / skill menu hint — `[intent]`
31
31
  | work, handoff, in-flight | `kxm-work` |
32
32
  | insights, loop, gap | `kxm-insights` |
33
33
  | project, reindex, invite | `kxm-projects` |
34
- | serve, login, init, doctor | `kxm-setup` |
34
+ | serve, login, init, doctor | `kxm-mind-setup` |
35
35
  | trailer, trust, gate, authz | `kxm-protocol` |
36
36
  | peer, fanout, checkpoint | `kxm` |
37
37
  | brief, hub bind, status line | `kxm-session` |
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: kxm-setup
3
- description: Connect a machine or repo to KontextMind — serve, login, init, doctor. Use when asked to install kxm, start the local server, OAuth login, stamp MCP/hooks/AGENTS.md, run kontext doctor, or wire an agent to the mind.
2
+ name: kxm-mind-setup
3
+ description: KontextMind knowledge plane only, the separate kontext CLI and km_ tools, not KXM or this plugin's kxm_* tools. Connects a machine to a KontextMind server with the kontext CLI. Use only when the user names KontextMind, the kontext CLI, or a km_ tool.
4
4
  license: Apache-2.0
5
5
  compatibility: Any agent that can run a shell or MCP client. No vendor-only tools.
6
6
  metadata:
@@ -11,9 +11,9 @@ metadata:
11
11
  suite: kxm
12
12
  ---
13
13
 
14
- # kxm-setup
14
+ # kxm-mind-setup
15
15
 
16
- Beacon after the server is up — `km_status` with `skill: "kxm-setup"`.
16
+ Beacon after the server is up — `km_status` with `skill: "kxm-mind-setup"`.
17
17
 
18
18
  ## Zero-install server
19
19