@kontextmind/kxm 0.7.94 → 0.7.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.kxm/README.md +39 -9
  3. package/CHANGELOG.md +1 -1
  4. package/README.md +147 -257
  5. package/SECURITY.md +21 -12
  6. package/docs/README.md +133 -54
  7. package/docs/adr/ADR-0002-browser-automation-steel-doks.md +24 -18
  8. package/docs/adr/ADR-0003-sqlite-only-store.md +100 -0
  9. package/docs/adr/ADR-0004-edge-identity-authentik.md +99 -0
  10. package/docs/adr/README.md +33 -0
  11. package/docs/concepts/architecture.md +262 -0
  12. package/docs/concepts/data-and-storage.md +194 -0
  13. package/docs/concepts/trust-model.md +152 -0
  14. package/docs/contracts/README.md +22 -14
  15. package/docs/contracts/effects-and-recovery.md +3 -0
  16. package/docs/contracts/migration.md +2 -2
  17. package/docs/contracts/routing.md +6 -5
  18. package/docs/contributing/assignment-runner.md +388 -0
  19. package/docs/contributing/ci-and-release.md +231 -0
  20. package/docs/contributing/development.md +362 -0
  21. package/docs/contributing/harness-routing-internals.md +192 -0
  22. package/docs/{packages.md → contributing/packages.md} +13 -15
  23. package/docs/{skills → contributing}/repo-work-delivery.md +20 -21
  24. package/docs/contributing/test-matrix.md +208 -0
  25. package/docs/{tui-components.md → contributing/tui-components.md} +30 -22
  26. package/docs/contributing/writing-docs.md +340 -0
  27. package/docs/glossary.md +471 -0
  28. package/docs/guides/agent-skills.md +137 -0
  29. package/docs/guides/browser-automation.md +160 -0
  30. package/docs/guides/context-and-memory.md +352 -0
  31. package/docs/guides/continuous-improvement.md +228 -0
  32. package/docs/guides/governed-skills.md +173 -0
  33. package/docs/guides/nous-providers.md +186 -0
  34. package/docs/guides/peer-messaging.md +304 -0
  35. package/docs/guides/pi-workers.md +219 -0
  36. package/docs/guides/provenance-gates.md +313 -0
  37. package/docs/guides/webhook-workflows.md +364 -0
  38. package/docs/kb/how-credentials-retrieved-safely.md +38 -12
  39. package/docs/kb/how-to-capture-and-annotate-section.md +15 -13
  40. package/docs/kb/how-to-connect-playwright-to-steel.md +16 -11
  41. package/docs/kb/how-to-recover-expired-session-or-orphan.md +26 -16
  42. package/docs/kb/how-to-resume-after-mfa.md +19 -11
  43. package/docs/kb/how-to-take-over-session.md +17 -13
  44. package/docs/kb/why-authentication-disappeared.md +22 -14
  45. package/docs/kb/why-automation-opened-different-browser.md +23 -14
  46. package/docs/kb/why-session-viewer-cannot-control.md +13 -12
  47. package/docs/operations/backup-and-restore.md +248 -0
  48. package/docs/operations/deploy.md +307 -0
  49. package/docs/operations/monitoring.md +209 -0
  50. package/docs/operations/runtime-sync.md +192 -0
  51. package/docs/operations/troubleshooting.md +265 -0
  52. package/docs/operations/upgrade.md +124 -0
  53. package/docs/prompts/browser-annotate-feedback.md +7 -7
  54. package/docs/prompts/browser-diagnose-recover.md +11 -10
  55. package/docs/prompts/browser-explore.md +7 -7
  56. package/docs/prompts/browser-repro-fix.md +7 -7
  57. package/docs/prompts/browser-start.md +12 -11
  58. package/docs/prompts/browser-takeover.md +8 -8
  59. package/docs/{cli-reference.md → reference/cli-reference.md} +83 -41
  60. package/docs/{config-reference.md → reference/config-reference.md} +159 -148
  61. package/docs/reference/configuration.md +299 -0
  62. package/docs/reference/harness-routing.md +508 -0
  63. package/docs/reference/http-api.md +203 -0
  64. package/docs/reference/tools.md +370 -0
  65. package/docs/{workflow-guide.md → reference/workflow-catalog.md} +92 -153
  66. package/docs/reference/workflow-definitions.md +286 -0
  67. package/docs/start/first-workflow.md +287 -0
  68. package/docs/start/install.md +146 -0
  69. package/docs/start/quickstart-claude-code.md +405 -0
  70. package/docs/start/quickstart-pi.md +213 -0
  71. package/docs/templates/README.md +78 -73
  72. package/docs/templates/adr.md +13 -13
  73. package/docs/templates/architecture.md +55 -71
  74. package/docs/templates/bug-fix.md +13 -16
  75. package/docs/templates/feature.md +14 -19
  76. package/docs/templates/handoff.md +44 -46
  77. package/docs/templates/postmortem.md +30 -43
  78. package/docs/templates/research.md +15 -20
  79. package/docs/templates/review.md +49 -50
  80. package/docs/templates/runbook.md +38 -30
  81. package/docs/templates/test-plan.md +16 -23
  82. package/docs/templates/test-report.md +14 -17
  83. package/examples/README.md +9 -5
  84. package/examples/provenance-workflow.json +1 -1
  85. package/examples/webhook-workflows/jira-development.json +59 -0
  86. package/examples/webhook-workflows/jira-issue-updated.json +12 -0
  87. package/package.json +2 -2
  88. package/packages/core/tui/README.md +1 -1
  89. package/plugins/kxm/.claude-plugin/plugin.json +1 -1
  90. package/plugins/kxm/README.md +31 -32
  91. package/plugins/kxm/dist/cli.js +5 -5
  92. package/plugins/kxm/dist/mcp-server.js +1 -1
  93. package/plugins/kxm/dist/runtime.js +1 -1
  94. package/plugins/kxm/package.json +1 -1
  95. package/plugins/kxm/skills/kxm/references/protocol.md +3 -1
  96. package/plugins/kxm/skills/kxm-browser-auth/SKILL.md +1 -1
  97. package/plugins/kxm/skills/kxm-browser-diagnostics/SKILL.md +5 -5
  98. package/plugins/kxm/skills/kxm-browser-explore/SKILL.md +2 -2
  99. package/plugins/kxm/skills/kxm-browser-session/SKILL.md +10 -13
  100. package/plugins/kxm/skills/kxm-browser-takeover/SKILL.md +1 -1
  101. package/plugins/kxm/skills/kxm-browser-verify/SKILL.md +1 -1
  102. package/plugins/kxm/skills/kxm-context-memory/SKILL.md +13 -4
  103. package/plugins/kxm/skills/kxm-hub-ops/SKILL.md +3 -1
  104. package/plugins/kxm/skills/kxm-mind-setup/SKILL.md +2 -1
  105. package/plugins/kxm/skills/kxm-project-setup/SKILL.md +31 -54
  106. package/plugins/kxm/skills/kxm-projects/SKILL.md +1 -1
  107. package/plugins/kxm/skills/kxm-protocol/SKILL.md +1 -1
  108. package/plugins/kxm/skills/kxm-routing-improve/SKILL.md +15 -7
  109. package/plugins/kxm/skills/kxm-runs/SKILL.md +11 -5
  110. package/plugins/kxm/skills/kxm-session/SKILL.md +1 -1
  111. package/plugins/kxm/skills/kxm-tasks/SKILL.md +9 -7
  112. package/plugins/kxm/skills/kxm-workflow/SKILL.md +10 -2
  113. package/plugins/kxm/src/cli/system.ts +1 -1
  114. package/plugins/kxm/src/cli.ts +3 -3
  115. package/plugins/kxm/src/init-guide-setup.ts +1 -1
  116. package/plugins/kxm/src/mcp-server.ts +1 -1
  117. package/plugins/kxm/src/modes.ts +1 -1
  118. package/schemas/README.md +1 -1
  119. package/docs/agent-communication-envelopes-and-gates.md +0 -553
  120. package/docs/agent-skills.md +0 -198
  121. package/docs/architecture.md +0 -245
  122. package/docs/assignment-runner.md +0 -264
  123. package/docs/browser-automation.md +0 -139
  124. package/docs/configuration.md +0 -437
  125. package/docs/continuous-improvement.md +0 -226
  126. package/docs/getting-started.md +0 -277
  127. package/docs/harness-routing.md +0 -616
  128. package/docs/kb/qa-authentik-authentication.md +0 -97
  129. package/docs/kb/qa-extension-install-and-hub-bootstrap.md +0 -85
  130. package/docs/kb/qa-hub-on-a-public-host.md +0 -48
  131. package/docs/kb/qa-sqlite-vs-duckdb.md +0 -35
  132. package/docs/kb/qa-what-the-hub-stores.md +0 -64
  133. package/docs/kxm-handbook.md +0 -1181
  134. package/docs/operations.md +0 -510
  135. package/docs/operator-pi-packages.md +0 -67
  136. package/docs/provenance-gates.md +0 -295
  137. package/docs/skills.md +0 -47
  138. package/docs/test-matrix.md +0 -132
  139. package/docs/troubleshooting.md +0 -293
  140. package/docs/webhook-workflows.md +0 -240
@@ -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.94",
14
+ "version": "0.7.96",
15
15
  "category": "development",
16
16
  "tags": ["kxm", "multi-agent", "workflows", "mcp"]
17
17
  }
package/.kxm/README.md CHANGED
@@ -1,14 +1,44 @@
1
- # KontextMind workspace
1
+ # The `.kxm` directory
2
2
 
3
- `.kxm` is the canonical home for repository-local Pi Mesh configuration, logs, assets, and runtime state.
3
+ `.kxm/` holds a KXM project's reviewable definition and its local workspace. You
4
+ commit the configuration; logs, restart state and generated files stay on the
5
+ machine. This directory is the KXM repository's own project. In your project,
6
+ `kxm init` creates the core files: `project.yaml`, `repo/repo.yaml`, two agents,
7
+ a `default` workflow, `gates.yaml` and `template-provenance.yaml`.
4
8
 
5
- | Directory | Contents | Git policy |
9
+ ## Layout
10
+
11
+ | Path | Contents | Git |
6
12
  |---|---|---|
7
- | `config/` | Reviewable workflow and harness configuration without secrets | Tracked |
8
- | `logs/` | Hub, worker, and agent process logs | Ignored except documentation |
9
- | `assets/` | Durable workflow inputs and outputs that belong to this workspace | Track intentionally; generated content is ignored |
10
- | `state/` | SQLite and other restart-recovery state | Ignored except documentation |
13
+ | `project.yaml` | Project identity, repositories and defaults (`kxm.project.v1`) | Tracked |
14
+ | `repo/repo.yaml` | This repository's definition (`kxm.repository.v1`) | Tracked |
15
+ | `agents/`, `models/`, `workflows/` | Agents, model profiles and workflows, one YAML file each | Tracked |
16
+ | `gates.yaml` | The executable gate registry | Tracked |
17
+ | `roles/`, `routes.yaml`, `prices.yaml` | Role rosters, admitted model routes, dated list prices | Tracked |
18
+ | `roster.yaml` | The developer assignment roster for this repository | Tracked, and must be committed |
19
+ | `template-provenance.yaml` | Hashes of the template `kxm init` used | Tracked |
20
+ | `models/inventory.yaml` | The discovered model catalog | Generated; track it for a reviewed snapshot |
21
+ | `config.yaml` | Shared personalization settings | Tracked if the project shares them |
22
+ | `memory/` | Project memory facts that `kxm memory` projects into `AGENTS.md`, `CLAUDE.md` and `GEMINI.md` | Tracked |
23
+ | `assets/` | Intentional workflow inputs and outputs; `assets/generated/` is for machine output | Tracked intentionally; `generated/` ignored |
24
+ | `tasks/` | Task records from `kxm task` | Your choice |
25
+ | `logs/` | Hub, worker and agent logs | Ignored |
26
+ | `state/` | The hub database `kxm.db`, Pi sessions and restart state | Ignored |
27
+ | `run/` | SSH control sockets from `kxm ssh` | Ignored |
28
+
29
+ The [configuration reference](../docs/reference/config-reference.md#workspace-layout-tracked-ignored-and-state)
30
+ describes every file, the ignore rules to add, and the state KXM keeps outside
31
+ the project.
11
32
 
12
- Secrets remain in environment variables or an approved secret manager. Do not put tokens, webhook secrets, credentials, or private prompt dumps anywhere under `.kxm/config`.
33
+ ## Rules
13
34
 
14
- All directory defaults derive from `.kxm`. Set `KXM_WORKSPACE_DIR` to relocate the complete workspace or use a specific path override when an operator-managed volume requires it.
35
+ - **No secrets here.** Keep tokens, webhook secrets and credentials in
36
+ environment variables or a secret manager. Never commit logs, SQLite files, or
37
+ raw prompts.
38
+ - **YAML only.** JSON definitions in a `config/` subdirectory are a retired
39
+ format: their presence makes the project refuse to load with
40
+ `legacy_state_unsupported`. The hub may create an empty `config/` directory;
41
+ that alone is harmless.
42
+ - **Moving the workspace.** `KXM_WORKSPACE_DIR`, `KXM_LOGS_DIR`,
43
+ `KXM_ASSETS_DIR` and `KXM_STATE_DIR` relocate `logs/`, `assets/` and
44
+ `state/`. The configuration files always stay in `<project root>/.kxm/`.
package/CHANGELOG.md CHANGED
@@ -271,7 +271,7 @@ All notable user-facing changes are documented here. The project follows [Semant
271
271
  a message naming the process that recreates the store (`kxm hub start` for hub state, the Runtime for registry/event stores; `kxm init` is project-only) — and the refusal never
272
272
  advances `user_version`, so the store stays identifiably old (WAL sidecars may still be
273
273
  checkpointed by opening the file, so the whole state set remains the backup unit — see
274
- [`docs/operations.md`](docs/operations.md)). Relabelling a store it refused to open would
274
+ [`docs/operations.md`](docs/operations/deploy.md)). Relabelling a store it refused to open would
275
275
  only hide the problem until a query hit a missing column. The coordinator fingerprint no
276
276
  longer recomputes over stored authority to forgive rows written before set canonicalisation:
277
277
  a stale coordinator is re-bound. Intake tests go from 23 to 22; the two forced-race tests
package/README.md CHANGED
@@ -1,310 +1,200 @@
1
1
  # KXM
2
2
 
3
3
  [![CI](https://github.com/kontextmind/kxm/actions/workflows/ci.yml/badge.svg)](https://github.com/kontextmind/kxm/actions/workflows/ci.yml)
4
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+ [![npm](https://img.shields.io/npm/v/@kontextmind/kxm.svg)](https://www.npmjs.com/package/@kontextmind/kxm)
5
5
  [![Node.js 22.19+ or 24+](https://img.shields.io/badge/node-22.19%2B%20%7C%2024%2B-339933.svg)](https://nodejs.org/)
6
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
7
 
7
- Give running coding agents a small, dependable communication plane.
8
+ **KXM gives coding agents (Claude Code, Pi and other harnesses) a durable, authenticated message and workflow plane, so they can delegate bounded work to each other and prove who answered, without sharing one giant context.**
9
+
10
+ KXM runs on your machine: one `kxm` CLI, a local [hub](docs/glossary.md#hub) for messages and webhook workflows, and a local [Runtime](docs/glossary.md#runtime) for workflow runs. Your project is reviewable YAML in Git, every agent keeps its own context and its own safety controls, and the docs say plainly what KXM does not guarantee ([Status and limits](#status-and-limits)).
11
+
12
+ ## What makes KXM different
13
+
14
+ - **Durable messages, not chat.** Every request is a SQLite record that moves from `queued` to `delivered` to `replied`, survives hub and agent restarts, and deduplicates retries by idempotency key. Agents authenticate with a project token and see only their own project's peers. [Message peer agents](docs/guides/peer-messaging.md)
15
+ - **Provenance you can check.** A quorum gate counts only replies the hub itself routed, from distinct eligible peers, for the exact run, stage and attempt. Text a coordinator writes never counts. It proves who answered, not that the answer is right. [Peer provenance and quorum gates](docs/guides/provenance-gates.md)
16
+ - **Workflows that release the turn.** Signed Jira, GitHub or generic webhooks start durable runs. A coordinator can park a stage, give up its turn, and resume only when a signed CI, review or merge callback arrives. [Run webhook workflows](docs/guides/webhook-workflows.md)
17
+ - **Local-first and reviewable.** The project lives in `.kxm/*.yaml`. `kxm trust diff` lists every permission expansion, and `kxm trust check` fails on any expansion beyond the base revision. `kxm run` executes workflows in an event-sourced Runtime that works with the hub down and ends each drive with a receipt it verifies. [Architecture](docs/concepts/architecture.md)
18
+ - **Native harnesses, fail-closed auth, honest cost.** Before a live run dispatches, KXM checks that the harness hosts the model and runs only admitted routes. KXM will not run a model on Pi when its vendor has its own harness, at dispatch or when a worker starts; route admission is a second layer, and a few reseller and policy cases [remain operator decisions](docs/reference/harness-routing.md#where-the-code-is-looser-than-the-rules). A logged-out harness stops the run instead of billing another provider, and cost is recorded as metered, unmetered or unknown. [Harness routing](docs/reference/harness-routing.md)
19
+ - **Context that ranks, learning that only proposes.** Context packets are ranked deterministically for the role and task and filled to a token budget, and they carry the selected evidence itself. Hub workflow journals feed `kxm_improvement_report`, and `kxm improve` reads the Runtime's settled attempts and routing telemetry. Both only propose: readiness never authorizes, and nothing changes until a person merges a reviewed Git change. [Context and memory](docs/guides/context-and-memory.md) · [Continuous improvement](docs/guides/continuous-improvement.md)
20
+ - **One plane for every harness.** A Claude Code plugin (MCP tools, pushed channel, a read-only SessionStart brief), a Pi extension with the same tools, portable Agent Skills, and the `kxm` CLI all work against the same hub. [Claude Code plugin](plugins/kxm/README.md) · [Agent skills](docs/guides/agent-skills.md)
21
+
22
+ ## How it fits together
23
+
24
+ Claude Code, Pi and the operator CLI talk to one hub on your machine, while the Runtime executes workflow runs locally and syncs their summaries to the hub.
25
+
26
+ ```mermaid
27
+ flowchart LR
28
+ subgraph Clients["Agents and operator"]
29
+ CC["Claude Code<br/>plugin: MCP stdio, channel, SessionStart hook"]
30
+ PI["Pi<br/>extension and skills"]
31
+ CLI["kxm CLI<br/>operator"]
32
+ end
33
+ subgraph Machine["Your machine: loopback by default"]
34
+ HUB[("KXM hub<br/>HTTP and SSE, SQLite kxm.db")]
35
+ RT["Runtime supervisor<br/>runs, event store, outbox"]
36
+ end
37
+ GIT[["Git repository<br/>.kxm/*.yaml"]]
38
+ EXT["Webhooks and CI<br/>signed starts and callbacks"]
39
+ CC -->|"MCP tools, SSE"| HUB
40
+ PI -->|"HTTP, SSE"| HUB
41
+ CLI -->|"admin and project APIs"| HUB
42
+ EXT -->|"HMAC-signed"| HUB
43
+ CLI -->|"kxm run, kxm runs"| RT
44
+ RT -->|"sync events, outbound only"| HUB
45
+ GIT -.->|"reviewed config"| CLI
46
+ GIT -.->|"pinned per run"| RT
47
+ ```
48
+
49
+ - The **hub** authenticates agents, stores messages and webhook workflow runs, and pushes events. It routes work but never runs a model or merges agent contexts, and it refuses to listen beyond loopback without a token.
50
+ - The **Runtime supervisor** owns the runs `kxm run` creates, as an append-only event log per project. It listens only on `127.0.0.1` and pushes sync-safe events to the hub whenever it can reach one. [Architecture](docs/concepts/architecture.md) explains each component and lifecycle.
51
+
52
+ ## Feature tour
53
+
54
+ | Capability | Learn more |
55
+ |---|---|
56
+ | **Peer messaging**: discover peers, send, await, fan out to one to three peers, cancel and reply | [Message peer agents](docs/guides/peer-messaging.md) |
57
+ | **Claude Code plugin**: 19 MCP tools, pushed channel or pull mode, and a SessionStart brief | [Claude Code plugin](plugins/kxm/README.md) |
58
+ | **Supervised Pi workers**: restarts, model fallbacks, tool allowlists and one Pi session per workflow run | [Run supervised Pi workers](docs/guides/pi-workers.md) |
59
+ | **Webhook workflows**: signed starts, ordered stages, checkpoints, durable waits and signed callbacks | [Run webhook workflows](docs/guides/webhook-workflows.md) |
60
+ | **Provenance and quorum gates**: hub-verified peer evidence, with an admin-only degradation path | [Peer provenance and quorum gates](docs/guides/provenance-gates.md) |
61
+ | **Local Runtime runs**: `kxm.workflow.v1` steps and gates, `kxm run`, simulated or live drives, verified receipts, cancel and recovery | [Run your first workflow](docs/start/first-workflow.md) · [Workflow definition reference](docs/reference/workflow-definitions.md) |
62
+ | **Trust review**: permission diffs for changes to the project definition in `.kxm/` | [Reviewed Git configuration](docs/concepts/architecture.md#configuration-is-reviewed-git-yaml) · [`kxm trust`](docs/reference/cli-reference.md#kxm-trust) |
63
+ | **Harness routing and admission**: `kxm harness`, `kxm models` and `kxm routes` | [Harness routing](docs/reference/harness-routing.md) |
64
+ | **Context and memory**: role-aware packets, recall, temporal state, episodes, a compiled wiki, and Git memory projected into `AGENTS.md`, `CLAUDE.md` and `GEMINI.md` | [Context and memory](docs/guides/context-and-memory.md) |
65
+ | **Continuous improvement**: journals, retrospectives, improvement reports and coded-repeat candidates | [Continuous improvement](docs/guides/continuous-improvement.md) |
66
+ | **Governed skills**: candidates, recorded evaluations, promotion or rejection, hash pinning | [Governed skills](docs/guides/governed-skills.md) |
67
+ | **Agent Skills**: a portable `SKILL.md` suite that covers every `kxm` command | [Agent skills](docs/guides/agent-skills.md) |
68
+ | **Live dashboard**: `kxm dash` screens for agents, tasks, workflows, plans, inbox and processes | [Monitor KXM](docs/operations/monitoring.md) |
69
+ | **Backup and restore**: the six state roots, `kxm backup` and `kxm restore`, and what each one covers | [Back up and restore KXM](docs/operations/backup-and-restore.md) |
70
+ | **Runtime sync and leases**: the outbox, refused-event recovery and fenced leases | [Runtime sync](docs/operations/runtime-sync.md) |
71
+ | **Hosted deployment**: supervision, and a pattern for one hub and Runtime per tenant behind an authenticating proxy | [Deploy KXM](docs/operations/deploy.md) |
72
+ | **Browser automation**: Steel sessions, Playwright and human takeover skills | [Browser automation](docs/guides/browser-automation.md) |
73
+ | **Everything else**: tasks, goals, suggestions, SSH workers, Studio layouts and shell completion | [KXM CLI reference](docs/reference/cli-reference.md) |
8
74
 
9
- **KXM** lets Pi and Claude Code agents discover one another, send focused requests, continue working independently, and collect replies without sharing an oversized conversation. It provides communication primitives—not an autonomous swarm manager—so each agent keeps its own context and safety controls.
75
+ ## Quick start: Claude Code
10
76
 
11
- > **Project status:** Production candidate (`0.4.x`) for a single hub serving local or trusted-team agents. Durable delivery, signed webhook workflows, operator CLI, security controls, observability, and recovery are tested. It is not a horizontally scaled or multi-tenant orchestration service. See [Production boundaries](#production-boundaries).
77
+ <a id="set-up-a-new-project-with-claude-code"></a>
12
78
 
13
- ## Why use it?
79
+ You need Node.js 22.19 or newer on the 22.x line, or Node.js 24 or newer, plus Git and Claude Code. These steps connect a Claude Code session in one of your repositories to a hub on the same machine.
14
80
 
15
- - **Delegate deliberately.** Route a bounded task to a peer selected by name and purpose.
16
- - **Stay productive.** Poll for a result or wait only when the reply blocks progress.
17
- - **Mix harnesses.** Connect native Pi sessions and Claude Code through the same hub.
18
- - **Keep control.** Authentication, project isolation, message limits, and normal agent approval rules remain in place.
19
- - **Install using native formats.** One repository packages a Pi extension, an Agent Skill, and a Claude Code marketplace plugin.
20
- - **Start from real events.** Signed Jira, GitHub, or generic webhooks can prompt durable, long-lived coordinators.
21
- - **Release idle turns.** Coordinators can wait durably for signed CI, review, merge, or Jira callbacks and resume only when work remains.
22
- - **Verify peer provenance.** Per-requirement quorum gates count unique eligible producers from immutable, attempt-bound replied messages rather than coordinator-authored claims.
23
- - **Learn from every run.** Capture plans, decisions, contradictions, errors, and lessons without turning unreviewed opinions into policy.
81
+ 1. Install the CLI and initialize KXM in your repository. `kxm init` writes no ignore rules, so add them, then review and commit `.kxm/`:
24
82
 
25
- ## First run
83
+ ```bash
84
+ npm install --global --omit=peer @kontextmind/kxm
85
+ cd <your-repo>
86
+ kxm init
87
+ printf '%s\n' '.kxm/state/' '.kxm/logs/' '.kxm/backups/' >> .gitignore
88
+ ```
26
89
 
27
- You need Node.js 22.19 or newer on the 22.x line, or Node.js 24 or newer, plus Git, GitHub CLI, Pi, and two terminal windows. Six steps take you from install to `kxm session brief` and `/kxm hub`.
90
+ 2. In a second terminal, in the same repository, start the hub with a token for this project. Pick any `<hub-project>` key, for example the repository name:
28
91
 
29
- ### 1. Install
92
+ ```bash
93
+ PROJECT_TOKEN="$(openssl rand -hex 32)" # keep a copy in your password manager
94
+ export KXM_PROJECT_TOKENS="{\"<hub-project>\":\"$PROJECT_TOKEN\"}"
95
+ kxm hub start # runs in the foreground; keep this terminal open
96
+ ```
30
97
 
31
- Download the packed release through an authenticated GitHub CLI session. Run `gh auth login` first if necessary. Pi's Git package install supplies the extension and Agent Skill; it does not place `kxm` on `PATH`.
98
+ > [!IMPORTANT]
99
+ > `KXM_PROJECT_TOKENS` replaces the hub's saved token map. If this hub already serves other projects, list every one of them. The [Claude Code quick start](docs/start/quickstart-claude-code.md) has a command that merges the map for you.
32
100
 
33
- PowerShell:
101
+ 3. Back in the first terminal, bind this machine to the hub and check it:
34
102
 
35
- ```powershell
36
- $version = "<release-version>"
37
- $asset = "kxm-$version.tgz"
38
- $releaseDir = Join-Path $PWD ".kxm-release"
39
- New-Item -ItemType Directory -Force -Path $releaseDir | Out-Null
40
- gh release download "v$version" --repo kontextmind/kxm --pattern $asset --dir $releaseDir --clobber
41
- npm install --global --omit=peer (Join-Path $releaseDir $asset)
42
- pi install git:github.com/kontextmind/kxm@main
43
- ```
103
+ ```bash
104
+ kxm hub bind http://127.0.0.1:7331
105
+ kxm hub view
106
+ ```
44
107
 
45
- Bash:
108
+ Expected output:
46
109
 
47
- ```bash
48
- version='<release-version>'
49
- asset="kxm-${version}.tgz"
50
- mkdir -p .kxm-release
51
- gh release download "v${version}" --repo kontextmind/kxm \
52
- --pattern "$asset" --dir .kxm-release --clobber
53
- npm install --global --omit=peer ".kxm-release/$asset"
54
- pi install git:github.com/kontextmind/kxm@main
55
- ```
110
+ ```text
111
+ bound hub http://127.0.0.1:7331 · loopback · health=on
112
+ hub health=true ready=true · loopback hub
113
+ ```
56
114
 
57
- From a clone, run `npm ci` and use `node scripts/kxm.mjs` in place of `kxm`. Do not use `npm install --global git+https://github.com/kontextmind/kxm.git`.
115
+ 4. Install the plugin. In Claude Code:
58
116
 
59
- ### 2. Initialize the project
117
+ ```text
118
+ /plugin marketplace add kontextmind/kxm
119
+ /plugin install kxm@kxm
120
+ /reload-plugins
121
+ ```
60
122
 
61
- ```text
62
- kxm init
63
- ```
64
-
65
- ### 3. Start the hub in another terminal
123
+ When Claude Code asks for the plugin options, set `project` to `<hub-project>` and leave `auth_token` blank. On the machine that runs the hub, a blank token uses the project token the hub saved for `<hub-project>`, and only that one. On another machine, enter the project token at `/plugin configure kxm@kxm`. Never enter the hub admin token.
66
124
 
67
- `kxm hub start` is foreground. Keep that terminal running.
125
+ 5. Ask Claude to call `kxm_list`. It lists this session as an agent in `<hub-project>`.
68
126
 
69
- PowerShell:
127
+ Next, [run your first workflow](docs/start/first-workflow.md). The full [Claude Code quick start](docs/start/quickstart-claude-code.md) also shows how to <a id="add-claude-code-to-an-existing-kxm-project"></a>[add Claude Code to an existing KXM project](docs/start/quickstart-claude-code.md#add-claude-code-to-an-existing-project) and how to <a id="update-an-existing-install"></a>[update the CLI and the plugin](docs/start/quickstart-claude-code.md#update-kxm-and-the-plugin).
70
128
 
71
- ```powershell
72
- $env:KXM_AUTH_TOKEN = "replace-with-an-admin-token"
73
- $env:KXM_PROJECT_TOKENS = '{"demo":"replace-with-a-demo-project-token"}'
74
- kxm hub start
75
- ```
129
+ ## Quick start: Pi
76
130
 
77
- Bash:
131
+ These steps add a Pi agent to the same hub and project. Install the CLI and the Pi package, which provides the KXM extension and skills:
78
132
 
79
133
  ```bash
80
- export KXM_AUTH_TOKEN="replace-with-an-admin-token"
81
- export KXM_PROJECT_TOKENS='{"demo":"replace-with-a-demo-project-token"}'
82
- kxm hub start
83
- ```
84
-
85
- The hub listens on `http://127.0.0.1:7331`.
86
-
87
- ### 4. Bind this machine to the hub
88
-
89
- ```text
90
- kxm hub bind http://127.0.0.1:7331
91
- ```
92
-
93
- ### 5. Confirm the session
94
-
95
- ```text
96
- kxm session brief
97
- ```
98
-
99
- ### 6. Open Pi and check the hub
100
-
101
- Give agents the project token, not the administrative token.
102
-
103
- PowerShell:
104
-
105
- ```powershell
106
- $env:KXM_SERVER_URL = "http://127.0.0.1:7331"
107
- $env:KXM_AUTH_TOKEN = "replace-with-a-demo-project-token"
108
- $env:KXM_PROJECT = "demo"
109
- $env:KXM_AGENT_NAME = "planner"
110
- $env:KXM_AGENT_PURPOSE = "Plans work and coordinates handoffs"
111
- pi
134
+ npm install --global --omit=peer @kontextmind/kxm
135
+ pi install git:github.com/kontextmind/kxm@main
136
+ cd <your-repo>
137
+ kxm init # skip if .kxm/project.yaml already exists
112
138
  ```
113
139
 
114
- Bash:
140
+ Start and bind the hub as in steps 2 and 3 above, then start Pi as an agent of `<hub-project>`. Give it the project token (`PROJECT_TOKEN` from step 2), never the admin token:
115
141
 
116
142
  ```bash
117
- export KXM_SERVER_URL=http://127.0.0.1:7331
118
- export KXM_AUTH_TOKEN="replace-with-a-demo-project-token"
119
- export KXM_PROJECT=demo
143
+ export KXM_PROJECT=<hub-project>
144
+ export KXM_AUTH_TOKEN="replace-with-the-project-token"
120
145
  export KXM_AGENT_NAME=planner
121
146
  export KXM_AGENT_PURPOSE="Plans work and coordinates handoffs"
122
147
  pi
123
148
  ```
124
149
 
125
- In Pi, run `/kxm hub`. For a second agent or Claude Code, follow [Getting started](docs/getting-started.md).
150
+ In Pi:
126
151
 
127
- ## Command-first operation
152
+ ```text
153
+ /kxm hub
154
+ ```
128
155
 
129
- The `kxm` entry point manages one project. Tools are `init`, `hub`, `dash`, `session`, `agent`, `workflow`, and `gate`. Runtime configuration, logs, durable state, and generated retrospectives stay under `.kxm`.
156
+ Pi reports the hub's health, its own agent name and how many agents are online, for example `kxm hub view: health=ok; planner; 2 online agent(s)`. Start a second agent the same way under another `KXM_AGENT_NAME`, and ask one to send the other a request. [Quick start: Pi](docs/start/quickstart-pi.md) walks through it, including mixed Pi and Claude Code pools.
130
157
 
131
- After the first-run path above, load a reviewed Jira definition with distinct administrative, project, workflow-start, and callback credentials:
158
+ <details><summary>PowerShell</summary>
132
159
 
133
160
  ```powershell
134
- # Create or copy a reviewed definition to .kxm/config/workflows/jira-development.json.
135
- $env:KXM_AUTH_TOKEN = "replace-with-the-admin-token"
136
- $env:KXM_PROJECT_TOKENS = '{"product":"replace-with-the-project-token"}'
137
- $env:JIRA_WEBHOOK_SECRET = "replace-with-the-workflow-start-secret"
138
- $env:WORKFLOW_SIGNAL_SECRET = "replace-with-the-callback-secret"
139
- $env:KXM_WEBHOOK_WORKFLOWS_FILE = ".kxm/config/workflows/jira-development.json"
140
- kxm gate validate --file .kxm/config/workflows/jira-development.json
161
+ # Step 1: ignore runtime state
162
+ Add-Content .gitignore ".kxm/state/", ".kxm/logs/", ".kxm/backups/"
163
+ # Step 2: start the hub with a token for this project
164
+ $ProjectToken = [Convert]::ToHexString([Security.Cryptography.RandomNumberGenerator]::GetBytes(32)).ToLower()
165
+ $env:KXM_PROJECT_TOKENS = @{ "<hub-project>" = $ProjectToken } | ConvertTo-Json -Compress
141
166
  kxm hub start
142
- ```
143
-
144
- In a separately supervised coordinator terminal, give the single writer only
145
- the project credential and the tools required by the full Jira lifecycle. This
146
- PowerShell example uses the Windows shell tool; replace `powershell` with `bash`
147
- on macOS or Linux.
148
-
149
- ```powershell
167
+ # Pi: start an agent with the project token
168
+ $env:KXM_PROJECT = "<hub-project>"
150
169
  $env:KXM_AUTH_TOKEN = "replace-with-the-project-token"
151
- $coordinatorTools = @(
152
- "read", "powershell", "edit", "write", "grep", "find", "ls",
153
- "kxm_list", "kxm_send", "kxm_fanout", "kxm_get", "kxm_await",
154
- "kxm_workflow_get", "kxm_workflow_checkpoint", "kxm_workflow_wait",
155
- "kxm_workflow_record", "kxm_improvement_report"
156
- ) -join ","
157
- kxm agent worker --name coordinator --project product --model openrouter/qwen/qwen3-coder-plus `
158
- --fallback-models antigravity/gemini-3.1-pro --tools $coordinatorTools `
159
- --session-isolation workflow --fresh-start
160
- ```
161
-
162
- Give review-only peers `read,grep,find,ls`; do not copy the coordinator's shell
163
- or write capabilities to them. In an operator terminal, start and inspect work,
164
- then run external watchers with the separate callback secret:
165
-
166
- ```powershell
167
- $env:KXM_WORKFLOW_SECRET = "replace-with-the-workflow-start-secret"
168
- $env:KXM_WORKFLOW_ID = "jira-development"
169
- $env:KXM_WORKFLOW_SIGNAL_SECRET = "replace-with-the-callback-secret"
170
- $env:GITHUB_TOKEN = "replace-with-a-checks-read-token"
171
- kxm workflow start jira-development --payload '@ticket.json'
172
- kxm workflow list
173
- kxm workflow get run_123
174
- kxm gate github watch --run-id run_123 --stage-id push-watch `
175
- --signal-key pr-42-checks --repo org/repo --pr 42 --required ci
176
- kxm workflow export run_123
177
- kxm hub stop
178
- ```
179
-
180
- Use `--dry-run --json` to inspect mutation plans without exposing configured
181
- token or secret values. Terminal workflows export proposed Markdown and JSON
182
- retrospectives automatically; review them before adopting any improvement as
183
- policy. Provenance quorum degradation is a separate admin-only operation; use
184
- the [provenance runbook](docs/provenance-gates.md#degrade-only-through-an-explicit-admin-decision)
185
- only for a workflow whose evidence policy declares a lower minimum.
186
-
187
- ## What is included?
188
-
189
- | Component | What it does | Packaging |
190
- |---|---|---|
191
- | KXM hub | Persists presence and routes authenticated HTTP/SSE messages | Node.js executable + SQLite |
192
- | Pi extension | Adds communication, workflow, journal, and improvement tools | `pi.extensions` |
193
- | Agent Skill | Teaches agents a safe, efficient coordination workflow | `pi.skills` and `SKILL.md` |
194
- | Claude bridge | Exposes the same workflow plane through MCP and optional channel events | Claude Code plugin |
195
- | Marketplace | Makes the Claude plugin installable from this repository | Claude marketplace catalog |
196
-
197
- ## How it works
198
-
199
- ```text
200
- Pi planner ──HTTP──┐
201
- ├── KXM hub ──SSE──> addressed inbound requests
202
- Pi reviewer ─HTTP──┤ │
203
- │ └── presence, heartbeats, message state
204
- Claude Code ─MCP───┘
170
+ $env:KXM_AGENT_NAME = "planner"
171
+ pi
205
172
  ```
206
173
 
207
- The hub routes messages; it does not merge contexts, choose tasks, or bypass tool permissions. A typical request moves through `queued` → `delivered` → `replied`. It may instead end as `cancelled`, `expired`, or `error`. The sender can check it with `kxm_get`, wait with `kxm_await`, or stop pending work with `kxm_cancel`. A local `kxm_fanout` wait ending is nonterminal: it returns a durable pending handle that can be checked with `kxm_get` or retried with the same correlation and idempotency prefix.
174
+ </details>
208
175
 
209
176
  ## Documentation
210
177
 
211
- | If you want to… | Read |
212
- |---|---|
213
- | Install, configure, and use every KXM surface | [KXM Handbook](docs/kxm-handbook.md) |
214
- | Complete a Pi-to-Pi or Pi-to-Claude setup | [Getting started](docs/getting-started.md) |
215
- | Configure the hub or an agent | [Configuration reference](docs/configuration.md) |
216
- | Look up any `kxm` command, option, or output | [CLI reference](docs/cli-reference.md) |
217
- | Write project, workflow, agent, role, route, or price files | [Configuration file reference](docs/config-reference.md) |
218
- | Choose a native harness or OpenRouter for the same model | [Native harness or OpenRouter](docs/harness-routing.md) |
219
- | Understand components and message flow | [Architecture](docs/architecture.md) |
220
- | Learn about agent skills | [Agent Skills](docs/agent-skills.md) |
221
- | Run the hub responsibly | [Operations guide](docs/operations.md) |
222
- | Fix connection or delivery problems | [Troubleshooting](docs/troubleshooting.md) |
223
- | See which behaviors and examples are verified | [Test matrix](docs/test-matrix.md) |
224
- | Start work from Jira or another webhook | [Webhook workflows](docs/webhook-workflows.md) |
225
- | Require verified replies from eligible peers | [Peer provenance and quorum gates](docs/provenance-gates.md) |
226
- | Improve the harness and delivery process from evidence | [Continuous improvement](docs/continuous-improvement.md) |
227
- | Navigate Area → Workflow → Stage → Role taxonomy | [Workflow guide](docs/workflow-guide.md) |
228
- | Develop or submit a change | [Contributing](CONTRIBUTING.md) |
229
- | Report a vulnerability | [Security policy](SECURITY.md) |
230
- | Review user-facing changes | [Changelog](CHANGELOG.md) |
231
-
232
- The [documentation index](docs/README.md) describes the intended audience and scope of each guide.
233
-
234
- ## Claude Code installation
235
-
236
- Inside Claude Code:
178
+ The [documentation index](docs/README.md) groups every page by what you want to do:
237
179
 
238
- ```text
239
- /plugin marketplace add kontextmind/kxm
240
- /plugin install kxm
241
- /reload-plugins
242
- ```
180
+ - [Start here](docs/README.md#start-here): install, the quick starts, your first workflow and the glossary.
181
+ - [Guides](docs/README.md#guides): peer messaging, Pi workers, webhook workflows, provenance gates, context and memory, skills and improvement.
182
+ - [Reference](docs/README.md#reference): the CLI, configuration files, harness routing, tools, HTTP API and workflow definitions.
183
+ - [Concepts](docs/README.md#concepts): architecture, the trust model, data and storage, decisions and contracts.
184
+ - [Operations](docs/README.md#operations): deploy, monitor, back up and restore, upgrade, Runtime sync and troubleshooting.
185
+ - [Contributing](docs/README.md#contributing): development, CI and release, writing docs and the test matrix.
243
186
 
244
- The plugin provides peer messaging plus workflow listing, checkpoints, structured journal capture, and project improvement reports. See the [plugin tool table](plugins/kxm/README.md#tools).
187
+ ## Status and limits
245
188
 
246
- Pushed Claude channel delivery is a research-preview feature. Community channels currently require an explicit development-channel launch:
189
+ KXM is under active development and is published to npm as [`@kontextmind/kxm`](https://www.npmjs.com/package/@kontextmind/kxm). Merged pull requests ship as patch releases, and the [changelog](CHANGELOG.md) is not split per release: everything released since its newest dated section is still listed under **Unreleased**. It is built for one workstation or one trusted team host, with these deliberate limits, which [Architecture](docs/concepts/architecture.md#limits-and-trade-offs) and the [trust model](docs/concepts/trust-model.md) cover in detail:
247
190
 
248
- ```text
249
- claude --dangerously-load-development-channels plugin:kxm
250
- ```
251
-
252
- Without channel mode, ordinary MCP tools still work; use `kxm_inbox` and `kxm_reply` for inbound requests. See [Getting started](docs/getting-started.md#connect-claude-code) for the complete flow.
253
-
254
- ## Production boundaries
255
-
256
- The codebase is structured, typed, persisted, tested, packaged, and CI-gated. The current hub is suitable for production use on one workstation or a controlled trusted-team host, with these deliberate limits:
257
-
258
- - One process owns one SQLite database; there is no clustering, leader election, or shared-state failover.
259
- - Project tokens isolate hub access by project, but there are no per-user roles or external identity provider.
260
- - Peer quorum proves durable message provenance only within the shared project-credential boundary; it does not prove truth, model independence, non-collusion, or human approval.
261
- - Delivery is durable and retry-safe when callers supply an idempotency key, but it is not exactly-once execution.
262
- - Rate-limit counters reset after restart, and capacity depends on the host and SQLite workload.
263
- - The hub does not coordinate filesystem ownership; use separate worktrees or a single-writer rule.
264
- - A non-loopback deployment requires authentication, TLS termination, process supervision, and network access controls.
265
-
266
- The [operations guide](docs/operations.md) explains backup, recovery, monitoring, upgrade, and the safe deployment envelope.
267
-
268
- ## Package standards
269
-
270
- This repository follows the native package structures for:
271
-
272
- - [Pi package discovery](https://pi.dev/docs/latest/packages) through the `pi-package` keyword and `pi.extensions` / `pi.skills` manifests;
273
- - portable [Pi Agent Skills](https://pi.dev/docs/latest/skills) using `<skill-name>/SKILL.md`;
274
- - [Claude Code plugins](https://code.claude.com/docs/en/plugins-reference) through `.claude-plugin/plugin.json`;
275
- - [Claude marketplaces](https://code.claude.com/docs/en/plugin-marketplaces) through `.claude-plugin/marketplace.json`;
276
- - standard MCP stdio tools and the optional [Claude channel](https://code.claude.com/docs/en/channels-reference) capability.
277
-
278
- ## Development
279
-
280
- ```powershell
281
- npm ci
282
- npm run verify
283
- ```
284
-
285
- `npm run verify` includes `check:generated`. CI also runs `validate:ci` and
286
- plugin validation (`claude plugin validate`) as a hosted job. See
287
- [Contributing](CONTRIBUTING.md) before changing the protocol or generated
288
- runtimes.
289
-
290
- ## Repository layout
291
-
292
- ```text
293
- .kxm/ Workspace configuration, logs, assets, and state
294
- .claude-plugin/ Claude marketplace catalog
295
- .github/ CI and contribution templates
296
- docs/ User, operator, and architecture guides
297
- plugins/kxm/
298
- ├── .claude-plugin/ Claude plugin manifest
299
- ├── dist/ Generated self-contained CLI, hub, and MCP runtimes
300
- ├── skills/ Portable Agent Skill
301
- └── src/ Pi extension, hub, client, and MCP source
302
- scripts/ Build and consistency helpers
303
- test/ Integration tests
304
- examples/ Executable transport scenarios and callback sender
305
- scripts/kxm-worker.mjs Restarting headless Pi RPC worker
306
- ```
191
+ - **Single node.** One hub process owns one SQLite database. There is no clustering, replication or failover.
192
+ - **At-least-once.** Messages survive restarts and retries deduplicate by idempotency key, but work can run more than once. Make external side effects idempotent.
193
+ - **Not a sandbox.** KXM does not contain what an agent's tools can do. Use separate worktrees or a single writer, and separate OS accounts for agents you do not trust.
194
+ - **Provenance, not truth.** A quorum shows which agents answered through the hub under one project credential. It does not prove correctness, model independence or human approval.
307
195
 
308
- ## License
196
+ ## Contributing, security and license
309
197
 
310
- [MIT](LICENSE) © KontextMind contributors.
198
+ - **Contributing:** read [CONTRIBUTING.md](CONTRIBUTING.md), [Develop KXM](docs/contributing/development.md) and the [code of conduct](CODE_OF_CONDUCT.md), and run `npm ci` and `npm run verify` before you open a pull request.
199
+ - **Security:** report a suspected vulnerability privately, as [SECURITY.md](SECURITY.md) describes.
200
+ - **License:** [MIT](LICENSE) © KontextMind contributors.
package/SECURITY.md CHANGED
@@ -18,25 +18,32 @@ Do not include real credentials, private prompts, personal data, or unrelated re
18
18
 
19
19
  ## Security model
20
20
 
21
- The current hub provides:
21
+ This section summarizes KXM's security model. The [trust model](docs/concepts/trust-model.md) explains every credential, what it can reach, and where each boundary stops. [Data and storage](docs/concepts/data-and-storage.md) lists what each store keeps and how long.
22
+
23
+ The current hub and Runtime provide:
22
24
 
23
25
  - an administrative bearer token and optional per-project bearer tokens;
24
- - ephemeral per-agent keys for agent-specific operations;
25
- - project-scoped discovery and message visibility;
26
- - loopback binding by default;
27
- - refusal to bind beyond localhost without a token;
26
+ - per-agent keys, rotated at every registration, for agent-specific operations;
27
+ - hub credentials persisted with mode `0600` in the user state root, never in the project;
28
+ - project-scoped discovery, message visibility, and context requests;
29
+ - loopback binding by default, and refusal to bind beyond localhost without a token;
30
+ - a Runtime supervisor that listens only on `127.0.0.1` behind its own token;
31
+ - a Claude Code plugin whose MCP server and SessionStart hook never use the admin token;
28
32
  - bounded request bodies, message content, and hop counts;
29
33
  - per-agent request rate limiting and stable request IDs;
30
34
  - security response headers and generic public responses for internal errors;
31
35
  - SHA-256 HMAC verification and stable-delivery deduplication for webhook workflows;
32
36
  - attempt-bound peer-message provenance, unique-producer quorum, and explicit admin-only degradation for configured workflow requirements;
33
- - structured hub logs that omit prompt and reply bodies.
37
+ - a context authority ceiling per origin, so peer, tool, and external content can never grant instructions or policy;
38
+ - structured hub logs that omit prompt and reply bodies, and an allowlisted, redacted Runtime-to-hub sync.
34
39
 
35
40
  It does not currently provide:
36
41
 
37
- - per-user roles or external identity-provider integration;
38
- - durable encrypted storage;
42
+ - per-user roles or identity-provider integration inside the hub (hosted deployments authenticate browsers at a proxy; see [ADR-0004](docs/adr/ADR-0004-edge-identity-authentik.md));
43
+ - encryption of stored message bodies, prompts, evidence, or credentials;
39
44
  - end-to-end message encryption;
45
+ - signed session tokens: local tool policy is a guardrail, not an authorization boundary;
46
+ - isolation between processes that run as the same OS user;
40
47
  - public-internet hardening;
41
48
  - distributed denial-of-service protection;
42
49
  - guarantees that peer-provided content is safe or correct.
@@ -49,17 +56,19 @@ a new agent or reclaim an offline agent name and its durable ID in that project,
49
56
  so every holder of one shared project credential belongs to the same fully
50
57
  trusted provenance domain.
51
58
 
52
- Authentication does not make a mesh message trustworthy. Agents must retain their normal permission, tool, filesystem, and secret-handling controls.
59
+ Authentication does not make a peer message trustworthy. Agents must retain their normal permission, tool, filesystem, and secret-handling controls.
53
60
 
54
61
  ## Operator responsibilities
55
62
 
56
63
  - Keep the hub on loopback whenever possible.
57
64
  - Use a long random token and load it from a secret manager or protected environment.
58
- - Use distinct project tokens when different teams share one hub.
65
+ - Use distinct project tokens when different teams share one hub, and list every project in `KXM_PROJECT_TOKENS` so the admin token stops working on agent routes.
59
66
  - Reserve a distinct administrative token for admin routes; give agents only their explicit project token. Never give a workflow callback or peer the admin token.
60
- - Protect and back up `.kxm/state/kxm.db` because it contains messages and agent credentials.
67
+ - Set `KXM_AUTH_TOKEN` to the project token for Pi sessions and Pi workers. Without it, the Pi extension falls back to the admin token saved on the hub's machine.
68
+ - Protect and back up `.kxm/state/kxm.db` because it contains message bodies and agent keys.
69
+ - Protect the user state root: `hub-env.json` holds the raw admin and project tokens, and the Runtime stores hold run prompts and event payloads.
61
70
  - Protect `.kxm/logs`; raw long-lived Pi process logs can contain model output, tool output, paths, and other sensitive operational data.
62
- - Keep secrets out of tracked `.kxm/config` and `.kxm/assets`; runtime logs, generated assets, and state must remain uncommitted.
71
+ - Keep secrets out of tracked `.kxm/*.yaml` configuration and `.kxm/assets`; runtime logs, generated assets, and state must remain uncommitted.
63
72
  - Store webhook secrets in dedicated environment variables through `secretEnv`; do not commit them in workflow JSON.
64
73
  - Use a separate `signalSecretEnv` for callbacks and never put credentials, private prompts, or sensitive incident details in a degradation reason.
65
74
  - Review every quorum degradation as a security-relevant decision. It must be declared by policy, limited to the current attempt, and followed by enough verified replies to meet the approved minimum.