@kontextmind/kxm 0.6.0

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 (227) hide show
  1. package/.claude-plugin/marketplace.json +19 -0
  2. package/.kxm/README.md +14 -0
  3. package/.kxm/assets/README.md +5 -0
  4. package/.kxm/assets/retrospectives/README.md +5 -0
  5. package/.kxm/config/README.md +5 -0
  6. package/.kxm/config/agents.json +43 -0
  7. package/.kxm/config/env.example +56 -0
  8. package/.kxm/config/update.example.yaml +9 -0
  9. package/.kxm/config/workflows/fix.json +160 -0
  10. package/.kxm/config/workflows/jira-development.json +116 -0
  11. package/.kxm/config/workflows/provenance-quorum.json +150 -0
  12. package/.kxm/config/workflows/v04-dogfood.json +72 -0
  13. package/CHANGELOG.md +465 -0
  14. package/LICENSE +21 -0
  15. package/README.md +306 -0
  16. package/SECURITY.md +72 -0
  17. package/docs/README.md +48 -0
  18. package/docs/agent-communication-envelopes-and-gates.md +553 -0
  19. package/docs/architecture.md +242 -0
  20. package/docs/assignment-runner.md +241 -0
  21. package/docs/configuration.md +361 -0
  22. package/docs/continuous-improvement.md +114 -0
  23. package/docs/getting-started.md +253 -0
  24. package/docs/kxm-handbook.md +1090 -0
  25. package/docs/operations.md +205 -0
  26. package/docs/provenance-gates.md +291 -0
  27. package/docs/skills.md +45 -0
  28. package/docs/templates/README.md +95 -0
  29. package/docs/templates/adr.md +88 -0
  30. package/docs/templates/architecture.md +120 -0
  31. package/docs/templates/bug-fix.md +109 -0
  32. package/docs/templates/feature.md +108 -0
  33. package/docs/templates/handoff.md +72 -0
  34. package/docs/templates/postmortem.md +77 -0
  35. package/docs/templates/research.md +100 -0
  36. package/docs/templates/review.md +85 -0
  37. package/docs/templates/runbook.md +73 -0
  38. package/docs/templates/test-plan.md +87 -0
  39. package/docs/templates/test-report.md +72 -0
  40. package/docs/test-matrix.md +121 -0
  41. package/docs/troubleshooting.md +249 -0
  42. package/docs/vnext/README.md +62 -0
  43. package/docs/vnext/architecture.md +185 -0
  44. package/docs/vnext/effects-and-recovery.md +172 -0
  45. package/docs/vnext/lifecycles.md +235 -0
  46. package/docs/vnext/migration.md +220 -0
  47. package/docs/vnext/routing.md +184 -0
  48. package/docs/vnext/synchronization.md +172 -0
  49. package/docs/vnext/terminology.md +240 -0
  50. package/docs/vnext/validation.md +335 -0
  51. package/docs/webhook-workflows.md +240 -0
  52. package/docs/workflow-guide.md +1150 -0
  53. package/examples/README.md +102 -0
  54. package/examples/provenance-workflow.json +40 -0
  55. package/examples/requester.ts +30 -0
  56. package/examples/reviewer-agent.ts +29 -0
  57. package/examples/roundtrip.ts +46 -0
  58. package/examples/vnext/.kxm/agents/coordinator.yaml +16 -0
  59. package/examples/vnext/.kxm/agents/critic-1.yaml +16 -0
  60. package/examples/vnext/.kxm/agents/critic-2.yaml +15 -0
  61. package/examples/vnext/.kxm/agents/critic-3.yaml +15 -0
  62. package/examples/vnext/.kxm/agents/implementer.yaml +15 -0
  63. package/examples/vnext/.kxm/agents/planner.yaml +13 -0
  64. package/examples/vnext/.kxm/agents/reproducer.yaml +15 -0
  65. package/examples/vnext/.kxm/agents/reviewer.yaml +15 -0
  66. package/examples/vnext/.kxm/gates.yaml +8 -0
  67. package/examples/vnext/.kxm/models/critic-claude.yaml +11 -0
  68. package/examples/vnext/.kxm/models/critic-gemini.yaml +11 -0
  69. package/examples/vnext/.kxm/models/critic-grok.yaml +12 -0
  70. package/examples/vnext/.kxm/models/implementation.yaml +14 -0
  71. package/examples/vnext/.kxm/models/primary.yaml +17 -0
  72. package/examples/vnext/.kxm/prices.yaml +111 -0
  73. package/examples/vnext/.kxm/project/env.yaml +7 -0
  74. package/examples/vnext/.kxm/project.yaml +32 -0
  75. package/examples/vnext/.kxm/repo/repo.yaml +8 -0
  76. package/examples/vnext/.kxm/workflows/default.yaml +92 -0
  77. package/examples/vnext/.kxm/workflows/fix.yaml +376 -0
  78. package/examples/vnext/.kxm/workflows/improve.yaml +57 -0
  79. package/examples/vnext/README.md +53 -0
  80. package/examples/vnext/records/assignment-result-recorded.json +63 -0
  81. package/examples/vnext/records/assignment-result.json +46 -0
  82. package/examples/vnext/records/context-candidate.json +42 -0
  83. package/examples/vnext/records/delivery-manifest.json +66 -0
  84. package/examples/vnext/records/effect-uncertainty-resolved-sync.json +67 -0
  85. package/examples/vnext/records/effect-uncertainty-resolved.json +62 -0
  86. package/examples/vnext/records/run-created.json +54 -0
  87. package/examples/vnext/records/sync-event.json +65 -0
  88. package/examples/vnext/repositories/api/.kxm/repo/env.yaml +7 -0
  89. package/examples/vnext/repositories/api/.kxm/repo/repo.yaml +8 -0
  90. package/examples/vnext/repositories/web/.kxm/repo/repo.yaml +8 -0
  91. package/examples/workflow-signal.ts +63 -0
  92. package/package.json +129 -0
  93. package/plugins/kxm/.claude-plugin/plugin.json +73 -0
  94. package/plugins/kxm/.mcp.json +19 -0
  95. package/plugins/kxm/README.md +93 -0
  96. package/plugins/kxm/dist/cli.js +42853 -0
  97. package/plugins/kxm/dist/client.js +416 -0
  98. package/plugins/kxm/dist/core.js +1823 -0
  99. package/plugins/kxm/dist/extension.js +3797 -0
  100. package/plugins/kxm/dist/mcp-server.js +17104 -0
  101. package/plugins/kxm/dist/runtime.js +23361 -0
  102. package/plugins/kxm/dist/server.js +13640 -0
  103. package/plugins/kxm/dist/vnext-runtime-supervisor.js +21109 -0
  104. package/plugins/kxm/package.json +12 -0
  105. package/plugins/kxm/skills/kxm/SKILL.md +97 -0
  106. package/plugins/kxm/skills/kxm/references/protocol.md +103 -0
  107. package/plugins/kxm/skills/kxm-session/SKILL.md +53 -0
  108. package/plugins/kxm/src/arbiter.ts +355 -0
  109. package/plugins/kxm/src/artifacts-exist.ts +62 -0
  110. package/plugins/kxm/src/autocomplete.ts +236 -0
  111. package/plugins/kxm/src/cli.ts +3707 -0
  112. package/plugins/kxm/src/client.ts +614 -0
  113. package/plugins/kxm/src/commands.ts +1063 -0
  114. package/plugins/kxm/src/config.ts +290 -0
  115. package/plugins/kxm/src/context/providers.ts +101 -0
  116. package/plugins/kxm/src/context-packet.ts +332 -0
  117. package/plugins/kxm/src/context.ts +499 -0
  118. package/plugins/kxm/src/core.ts +6 -0
  119. package/plugins/kxm/src/database.ts +563 -0
  120. package/plugins/kxm/src/diagnostics.ts +184 -0
  121. package/plugins/kxm/src/envelope.ts +118 -0
  122. package/plugins/kxm/src/extension.ts +895 -0
  123. package/plugins/kxm/src/external-effects.ts +299 -0
  124. package/plugins/kxm/src/github-watch.ts +255 -0
  125. package/plugins/kxm/src/hub-binding.ts +160 -0
  126. package/plugins/kxm/src/hub.ts +2502 -0
  127. package/plugins/kxm/src/improve.ts +383 -0
  128. package/plugins/kxm/src/inbox.ts +10 -0
  129. package/plugins/kxm/src/kxm-install-kind.ts +113 -0
  130. package/plugins/kxm/src/kxm-update-config.ts +39 -0
  131. package/plugins/kxm/src/kxm-update.ts +238 -0
  132. package/plugins/kxm/src/local-snapshot.ts +406 -0
  133. package/plugins/kxm/src/logger.ts +198 -0
  134. package/plugins/kxm/src/mcp-server.ts +143 -0
  135. package/plugins/kxm/src/memory.ts +385 -0
  136. package/plugins/kxm/src/nous-pi.ts +287 -0
  137. package/plugins/kxm/src/nous-provider.ts +729 -0
  138. package/plugins/kxm/src/price-calc.ts +87 -0
  139. package/plugins/kxm/src/prices.ts +121 -0
  140. package/plugins/kxm/src/protocol.ts +172 -0
  141. package/plugins/kxm/src/recovery.ts +211 -0
  142. package/plugins/kxm/src/redact.ts +26 -0
  143. package/plugins/kxm/src/retrospective.ts +400 -0
  144. package/plugins/kxm/src/routing.ts +830 -0
  145. package/plugins/kxm/src/runtime.ts +9 -0
  146. package/plugins/kxm/src/server.ts +117 -0
  147. package/plugins/kxm/src/session-work.ts +571 -0
  148. package/plugins/kxm/src/session.ts +184 -0
  149. package/plugins/kxm/src/skills.ts +535 -0
  150. package/plugins/kxm/src/state.ts +326 -0
  151. package/plugins/kxm/src/store.ts +637 -0
  152. package/plugins/kxm/src/studio-layout.ts +268 -0
  153. package/plugins/kxm/src/suggest.ts +162 -0
  154. package/plugins/kxm/src/task-manager.ts +244 -0
  155. package/plugins/kxm/src/telemetry.ts +116 -0
  156. package/plugins/kxm/src/tui.ts +1046 -0
  157. package/plugins/kxm/src/vnext-bindings.ts +403 -0
  158. package/plugins/kxm/src/vnext-config.ts +1646 -0
  159. package/plugins/kxm/src/vnext-engine-artifacts.ts +86 -0
  160. package/plugins/kxm/src/vnext-engine-command.ts +533 -0
  161. package/plugins/kxm/src/vnext-engine-compile.ts +722 -0
  162. package/plugins/kxm/src/vnext-engine-evidence.ts +273 -0
  163. package/plugins/kxm/src/vnext-engine-fold.ts +1400 -0
  164. package/plugins/kxm/src/vnext-engine-gate-records.ts +583 -0
  165. package/plugins/kxm/src/vnext-engine-plan.ts +717 -0
  166. package/plugins/kxm/src/vnext-engine.ts +2458 -0
  167. package/plugins/kxm/src/vnext-gate-hash.ts +10 -0
  168. package/plugins/kxm/src/vnext-harness.ts +1142 -0
  169. package/plugins/kxm/src/vnext-init.ts +430 -0
  170. package/plugins/kxm/src/vnext-migrate.ts +1848 -0
  171. package/plugins/kxm/src/vnext-oneshot-producer.ts +424 -0
  172. package/plugins/kxm/src/vnext-permission.ts +936 -0
  173. package/plugins/kxm/src/vnext-pi-producer.ts +628 -0
  174. package/plugins/kxm/src/vnext-repair.ts +1094 -0
  175. package/plugins/kxm/src/vnext-runtime-owner.ts +320 -0
  176. package/plugins/kxm/src/vnext-runtime-store.ts +1560 -0
  177. package/plugins/kxm/src/vnext-runtime-supervisor.ts +586 -0
  178. package/plugins/kxm/src/vnext-runtime.ts +663 -0
  179. package/plugins/kxm/src/vnext-template.ts +247 -0
  180. package/plugins/kxm/src/wiki.ts +313 -0
  181. package/plugins/kxm/src/workflow.ts +1548 -0
  182. package/schemas/vnext/README.md +46 -0
  183. package/schemas/vnext/agent.schema.json +40 -0
  184. package/schemas/vnext/assignment-result.schema.json +66 -0
  185. package/schemas/vnext/backup-manifest.schema.json +89 -0
  186. package/schemas/vnext/candidate.schema.json +109 -0
  187. package/schemas/vnext/common.schema.json +422 -0
  188. package/schemas/vnext/context-candidate.schema.json +76 -0
  189. package/schemas/vnext/context-packet.schema.json +192 -0
  190. package/schemas/vnext/delivery-manifest.schema.json +159 -0
  191. package/schemas/vnext/environment.schema.json +66 -0
  192. package/schemas/vnext/gate-registry.schema.json +109 -0
  193. package/schemas/vnext/handoff-manifest.schema.json +146 -0
  194. package/schemas/vnext/init-operation.schema.json +61 -0
  195. package/schemas/vnext/local-repository-bindings.schema.json +30 -0
  196. package/schemas/vnext/memory-record.schema.json +45 -0
  197. package/schemas/vnext/migration-decision.schema.json +26 -0
  198. package/schemas/vnext/migration-plan.schema.json +123 -0
  199. package/schemas/vnext/migration-receipt.schema.json +52 -0
  200. package/schemas/vnext/model.schema.json +42 -0
  201. package/schemas/vnext/permission-diff.schema.json +57 -0
  202. package/schemas/vnext/prices.schema.json +115 -0
  203. package/schemas/vnext/project.schema.json +85 -0
  204. package/schemas/vnext/repository.schema.json +24 -0
  205. package/schemas/vnext/run-event.schema.json +460 -0
  206. package/schemas/vnext/session-brief.schema.json +153 -0
  207. package/schemas/vnext/sync-event.schema.json +234 -0
  208. package/schemas/vnext/template-provenance.schema.json +38 -0
  209. package/schemas/vnext/workflow.schema.json +248 -0
  210. package/scripts/assignment-run.d.mts +354 -0
  211. package/scripts/assignment-run.mjs +4451 -0
  212. package/scripts/build-runtime.mjs +56 -0
  213. package/scripts/check-generated.mjs +77 -0
  214. package/scripts/check-versions.mjs +34 -0
  215. package/scripts/emit-codex-artifacts.d.mts +9 -0
  216. package/scripts/emit-codex-artifacts.mjs +91 -0
  217. package/scripts/harness-run.d.mts +83 -0
  218. package/scripts/harness-run.mjs +2095 -0
  219. package/scripts/kxm-hub.mjs +105 -0
  220. package/scripts/kxm-publish-npm.mjs +327 -0
  221. package/scripts/kxm-release-github.mjs +472 -0
  222. package/scripts/kxm-runtime-supervisor.mjs +7 -0
  223. package/scripts/kxm-worker.mjs +1127 -0
  224. package/scripts/kxm.mjs +27 -0
  225. package/scripts/roster-policy.d.mts +20 -0
  226. package/scripts/roster-policy.mjs +161 -0
  227. package/scripts/smoke-multi-pi.mjs +479 -0
@@ -0,0 +1,85 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "REV-0001"
4
+ type: "review"
5
+ title: "Dual-Critic Review Report"
6
+ project: "kxm"
7
+ status: "approved" # draft | in_review | approved | rejected
8
+ owner: "@critics"
9
+ created: "2026-09-08"
10
+ updated: "2026-09-08"
11
+ authority: "evidence"
12
+ confidence: "verified"
13
+ summary: "Independent dual-critic evaluation for candidate commit <git-sha>."
14
+ tags: ["review", "critics", "quorum"]
15
+ related: []
16
+ details:
17
+ quorum_verdict: "passed" # passed | rework_required | blocked
18
+ target_commit: "<git-sha>"
19
+ critics:
20
+ - role: "reviewer-arch"
21
+ harness: "claude"
22
+ model: "claude-fable-5-1"
23
+ verdict: "pass_with_stipulations"
24
+ - role: "reviewer-cli"
25
+ harness: "codex"
26
+ model: "gpt-5.6-sol"
27
+ verdict: "pass"
28
+ ---
29
+
30
+ # Dual-Critic Review Report
31
+
32
+ ## Review Scope & Provenance
33
+
34
+ - **Candidate Commit:** `<git-sha>`
35
+
36
+ - **Candidate Tree Hash:** `<tree-sha>`
37
+
38
+ - **Deterministic Branch:** `kxm/run-<id>-<description>`
39
+
40
+ - **Independent Provider Rule:** Reviewers MUST originate from different providers than the implementer (Grok/xAI implementer $\rightarrow$ Claude/Anthropic + Codex/OpenAI critics).
41
+
42
+ ## Critic 1: Claude Fable 5.1 (Planning & Architecture Critic)
43
+
44
+ - **Role:** `reviewer-arch`
45
+
46
+ - **Focus Areas:** Fail-closed security boundaries, memory isolation, permission ceilings, state consistency.
47
+
48
+ - **Verdict:** **PASS WITH STIPULATIONS**
49
+
50
+ ### Findings
51
+
52
+ | ID | Severity | Category | Path | Line | Description |
53
+
54
+ |---|---|---|---|---|---|
55
+ | F-01 | warning | concurrency | `plugins/kxm/src/external-effects.ts` | 68 | Uncommitted CAS lease must enforce a 5-minute timeout on worker crash. |
56
+
57
+ | F-02 | info | architecture | `plugins/kxm/src/arbiter.ts` | 240 | Project knowledge correctly prioritized ahead of `_shared` defaults. |
58
+
59
+ ## Critic 2: GPT Astra / Codex (CLI, Ergonomics & Failure Modes)
60
+
61
+ - **Role:** `reviewer-cli`
62
+
63
+ - **Focus Areas:** CLI flags, error messages, terminal output, performance, failure resilience.
64
+
65
+ - **Verdict:** **PASS**
66
+
67
+ ### Findings
68
+
69
+ | ID | Severity | Category | Path | Line | Description |
70
+
71
+ |---|---|---|---|---|---|
72
+ | A-01 | info | ergonomics | `plugins/kxm/src/external-effects.ts` | 80 | Descriptive branch slugging provides clean readability in `git branch`. |
73
+
74
+ ## Quorum & Dissent Reconciliation
75
+
76
+ | Finding ID | Raised By | Severity | Author Response / Resolution | Status |
77
+
78
+ |---|---|---|---|---|
79
+ | F-01 | Claude Fable | warning | Implemented 300s expiration check in `claimEffect()`. | Resolved |
80
+
81
+ ## Final Quorum Signoff
82
+
83
+ - **Quorum Status:** **RECONCILED PASS**
84
+
85
+ - **Action:** Ready for acceptance binding via `just accept` or workflow stage transition.
@@ -0,0 +1,73 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "RB-0001"
4
+ type: "runbook"
5
+ title: "Operational Runbook Title"
6
+ project: "kxm"
7
+ status: "approved"
8
+ owner: "@ops"
9
+ created: "2026-09-08"
10
+ updated: "2026-09-08"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Procedures for diagnosing and mitigating <operational incident>."
14
+ tags: ["operations", "runbook", "triage"]
15
+ related: []
16
+ details:
17
+ service: "hub"
18
+ target_environment: "local-or-server"
19
+ ---
20
+
21
+ # Operational Runbook: <Incident / Procedure Name>
22
+
23
+ ## Symptoms & Alerts
24
+
25
+ - **Alert / Observable Signal:** <Describe alert, log error code, or metric spike>
26
+
27
+ - **Impact:** <Worker starvation, stuck approval, or failed signal dispatch>
28
+
29
+ ## Triage & Diagnostic Steps
30
+
31
+ ```mermaid
32
+ flowchart TD
33
+ Detect[Alert Detected] --> CheckHub{Is kxm hub running?}
34
+ CheckHub -->|No| Restart[Run kxm hub start]
35
+ CheckHub -->|Yes| CheckDB{Is SQLite DB locked?}
36
+ CheckDB -->|Yes| ClearLocks[Check .git/*.lock & WAL mode]
37
+ CheckDB -->|No| CheckLogs[Inspect .kxm/logs/telemetry.jsonl]
38
+
39
+ ```
40
+
41
+ *Triage decision tree: Verify hub daemon health, inspect database locks, and triage worker logs.*
42
+
43
+ 1. **Verify Hub Daemon Status:**
44
+
45
+ ```bash
46
+ kxm hub view
47
+ ```
48
+
49
+ 2. **Inspect Active Worker Processes:**
50
+
51
+ ```bash
52
+ kxm procs --json
53
+ ```
54
+
55
+ 3. **Check SQLite Integrity:**
56
+
57
+ ```bash
58
+ sqlite3 .kxm/state/kxm.db "PRAGMA integrity_check;"
59
+ ```
60
+
61
+ ## Safe Mitigation Commands
62
+
63
+ | Issue | Remediation Command | Expected Outcome |
64
+ |---|---|---|
65
+ | Orphaned Worktree Lock | `rm -f .git/kxm-worktree.lock` | Restores concurrent worktree creation |
66
+ | Stale Dispatched Effect | `kxm routing unquarantine <routeId>` | Restores model route to roster |
67
+ | Stuck Active Run | `kxm workflow signal <runId> cancel` | Safely aborts and cleans up attempt token |
68
+
69
+ ## Rollback & Escalation
70
+
71
+ - **Rollback Procedure:** <Exact command to restore previous database backup: `kxm restore <backup>`>
72
+
73
+ - **Escalation Path:** <Primary on-call or human operator contact>
@@ -0,0 +1,87 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "TEST-0001"
4
+ type: "test_plan"
5
+ title: "Test Plan for Feature / Refactor"
6
+ project: "kxm"
7
+ status: "draft" # draft | in_review | approved | superseded | archived
8
+ owner: "@owner"
9
+ created: "2026-09-08"
10
+ updated: "2026-09-08"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Behavior, failure modes, and risk boundaries covered by this test plan."
14
+ tags: ["testing", "qa"]
15
+ related: []
16
+ details:
17
+ execution_status: "not_started"
18
+ target_suite: "core" # core | simulations | complete
19
+ ---
20
+
21
+ # Test Plan: <Feature / Refactor Name>
22
+
23
+ ## Objective & Scope
24
+
25
+ - **Feature / Change Under Test:** <Link to FEAT-xx, BUG-xx, or ARCH-xx>
26
+
27
+ - **Included Behavior:** <Explicitly list capabilities tested>
28
+
29
+ - **Excluded Behavior:** <Explicitly list deferred or out-of-scope scenarios>
30
+
31
+ ## Risks & Coverage Strategy
32
+
33
+ | Risk / Failure Mode | Test Tier | Rationale for Selected Coverage | Target File |
34
+
35
+ |---|---|---|---|
36
+ | Race condition on git index | Unit (Concurrency) | Immediate lock failure detection | `test/core/external-effects.test.ts` |
37
+
38
+ | Context packet token overflow | Unit (Arbiter) | Verifies token pruning order | `test/core/context-packet.test.ts` |
39
+ | Multi-agent peer deadlock | Simulation | Replays multi-turn timeout | `test/simulations/deadlock.test.ts` |
40
+
41
+ ## Test Environment & Preconditions
42
+
43
+ - **Runtime:** Node 22.19.0 / Node 24.15.0
44
+
45
+ - **Database Fixture:** In-memory `:memory:` SQLite or isolated `.kxm/tmp/test.db`
46
+
47
+ - **Harness Preflight:** `kxm harness list` verifying mock or native CLI status
48
+
49
+ ## Detailed Test Cases
50
+
51
+ | Case ID | Requirement | Precondition | Test Action | Expected Result |
52
+
53
+ |---|---|---|---|---|
54
+ | TC-01 | REQ-01 | Clean database | Call `claimEffect()` twice concurrently | One succeeds, one returns `ok: false, conflict: true` |
55
+
56
+ | TC-02 | REQ-02 | Valid lease | Call `commitEffect()` with effect key | Status transitions to `confirmed` |
57
+
58
+ ## Test Execution Workflow
59
+
60
+ ```mermaid
61
+ flowchart LR
62
+ Build[npm run build] --> Core[Unit / Core Suite]
63
+ Core --> Check[npm run check]
64
+ Check --> Generated[npm run check:generated]
65
+ Generated --> Witness[npm run verify]
66
+
67
+ ```
68
+
69
+ *Verification flow: Build runtime artifacts, run core tests, enforce types and linting, and verify generated dist files match staged index.*
70
+
71
+ ## Execution Commands
72
+
73
+ | Suite | Command | Expected Output |
74
+
75
+ |---|---|---|
76
+ | Core Tests | `npm run test:core` | `tests >= 1008, fail 0` |
77
+
78
+ | Typecheck | `npm run typecheck` | Clean exit code 0 |
79
+ | Docs Lint | `npm run lint:docs` | `0 issues in 0 files` |
80
+
81
+ | Generated Dist | `npm run check:generated` | `generated artifacts are tracked and current` |
82
+
83
+ ## Entry & Exit Criteria
84
+
85
+ - **Entry Criteria:** Clean git working tree; `npm run build` succeeds without warnings.
86
+
87
+ - **Exit Criteria:** All test cases pass with zero failures; coverage thresholds met (lines >= 92%, branches >= 80%).
@@ -0,0 +1,72 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "REP-0001"
4
+ type: "test_report"
5
+ title: "Test Execution Witness Report"
6
+ project: "kxm"
7
+ status: "approved" # draft | approved | archived
8
+ owner: "@verifier"
9
+ created: "2026-09-08"
10
+ updated: "2026-09-08"
11
+ authority: "evidence"
12
+ confidence: "verified"
13
+ summary: "Witness verification report for commit <git-sha>."
14
+ tags: ["verification", "witness"]
15
+ related: ["TEST-0001"]
16
+ details:
17
+ result: "passed" # passed | failed | warning
18
+ exit_code: 0
19
+ commit_hash: "<git-sha>"
20
+ branch: "kxm/run-<id>-<description>"
21
+ ---
22
+
23
+ # Test Execution Witness Report
24
+
25
+ ## Metadata & Execution Environment
26
+
27
+ - **Tested Commit:** `<git-sha>`
28
+
29
+ - **Active Branch:** `kxm/run-<id>-<description>`
30
+
31
+ - **Test Plan:** [`TEST-0001`](../testing/plans/TEST-0001.md)
32
+
33
+ - **Executed At:** `2026-09-08T15:45:00Z`
34
+
35
+ - **Verifier:** `npm run verify` witness gate runner
36
+
37
+ - **OS & Runtime:** macOS / Node v24.15.0
38
+
39
+ ## Summary of Results
40
+
41
+ | Suite | Total Tests | Passed | Failed | Skipped | Duration | Status |
42
+
43
+ |---|---|---|---|---|---|---|
44
+ | `test:core` | 1008 | 1003 | 0 | 5 (Windows) | 271s | PASS |
45
+
46
+ | `typecheck` | N/A | N/A | 0 | 0 | 3s | PASS |
47
+ | `lint:docs` | 57 files | 57 | 0 | 0 | 2s | PASS |
48
+
49
+ | `check:generated` | 14 files | 14 | 0 | 0 | 4s | PASS |
50
+
51
+ ## Test Case Execution Details
52
+
53
+ | Case ID | Suite File | Result | Duration | Artifact Reference |
54
+
55
+ |---|---|---|---|---|
56
+ | TC-01 | `test/core/external-effects.test.ts` | PASS | 1.8ms | `artifact:.kxm/assets/witness.log@sha256:...` |
57
+
58
+ | TC-02 | `test/core/context-packet.test.ts` | PASS | 0.9ms | `artifact:.kxm/assets/witness.log@sha256:...` |
59
+
60
+ ## Test Coverage Metrics
61
+
62
+ - **Line Coverage:** 92.4% (Threshold: >= 92%)
63
+
64
+ - **Branch Coverage:** 81.2% (Threshold: >= 80%)
65
+
66
+ - **Function Coverage:** 93.5% (Threshold: >= 93%)
67
+
68
+ ## Verdict & Recommendation
69
+
70
+ - **Witness Verdict:** **VERIFIED PASS**
71
+
72
+ - **Recommendation:** Ready for dual-critic evaluation (`review-arch` and `review-cli`).
@@ -0,0 +1,121 @@
1
+ # Test matrix
2
+
3
+ The release gate executes every test, measures the core source directly, type-checks strict TypeScript, lints documentation, verifies package versions, validates Claude manifests, rebuilds the generated runtimes, and installs and executes the npm artifact outside the repository.
4
+
5
+ Run the commit gate with `npm run verify`. CI PR legs run `validate:ci` plus
6
+ `check:generated`. Plugin validation is a hosted CI job.
7
+
8
+ ```powershell
9
+ npm run verify
10
+ ```
11
+
12
+ ## Product features
13
+
14
+ | Feature | Automated evidence |
15
+ |---|---|
16
+ | Health, readiness, metrics, request IDs, security headers | `test/core/hub-api.test.ts` |
17
+ | Shared and per-project authentication, project isolation | `test/core/hub-api.test.ts` |
18
+ | Registration, discovery, presence, stale detection, identity resumption | `test/core/hub-api.test.ts`, `test/core/hub.test.ts` |
19
+ | SQLite persistence, restart recovery, schema compatibility | `test/core/hub-api.test.ts`, `test/core/store.test.ts` |
20
+ | All delivery modes, message fields, hop limits, and validation | `test/core/hub-api.test.ts`, `test/core/protocol.test.ts` |
21
+ | Queue, acknowledgement, visibility, reply, and authorization | `test/core/hub-api.test.ts`, `test/core/hub.test.ts` |
22
+ | Queued/delivered replay after recipient restart reuses one message record | `test/core/hub.test.ts`, `test/core/extension.test.ts`, `test/core/mcp.test.ts` |
23
+ | One-to-three-peer fanout, recoverable local timeouts/aborts, exact retries, and partial-error collection | `test/core/client.test.ts`, `test/core/hub-api.test.ts`, `test/core/extension.test.ts`, `test/core/mcp.test.ts` |
24
+ | TTL expiry, sender cancellation, and terminal retention | `test/core/hub-api.test.ts` |
25
+ | Terminal inbound cleanup and next-request activation | `test/core/extension.test.ts`, `test/core/mcp.test.ts` |
26
+ | Exact-retry idempotency and conflicting-key rejection | `test/core/hub-api.test.ts` |
27
+ | Rate limiting and retry guidance | `test/core/hub-api.test.ts` |
28
+ | Redacted structured logs | `test/core/hub-api.test.ts` |
29
+ | Client lifecycle, aborts, timeouts, invalid responses, reconnection | `test/core/client.test.ts` |
30
+ | Pi tools, inbound turns, automatic replies, status command | `test/core/extension.test.ts` |
31
+ | Claude MCP catalog, outbound and inbound tools, channel delivery | `test/core/mcp.test.ts` |
32
+ | Responsive metadata-only TUI, authenticated ops mode, presence-only fallback, observer filtering, key controls, and local body-free projection | `test/core/tui.test.ts`, `test/core/hub-api.test.ts` |
33
+ | Session manifest creation, fail-closed rosters, shared worker/result envelopes, and hub-owned envelope fields | `test/core/session.test.ts`, `test/core/cli.test.ts`, `test/core/envelope.test.ts`, `test/core/envelope-contract.test.ts` |
34
+ | Generic CLI/project telemetry classification, JSONL recovery, and proposed `kxm improve` output | `test/core/telemetry.test.ts`, `test/core/cli.test.ts` |
35
+ | Signed Jira webhook verification, filtering, dispatch, and retry deduplication | `test/core/hub-api.test.ts` |
36
+ | Ordered workflow checkpoints, normalized keyed evidence gates, unrelated-volume rejection, and warning/failure retry | `test/core/hub-api.test.ts`, `test/core/workflow.test.ts` |
37
+ | Run-start eligible-producer resolution, immutable workflow context, per-requirement message-reference verification, unique-producer quorum, and replay/cross-context rejection | `test/core/workflow-provenance.test.ts`, `test/core/workflow.test.ts`, `test/core/hub-api.test.ts`, `test/core/client.test.ts`, `test/core/store.test.ts` |
38
+ | Explicit current-attempt admin degradation, configured lower minimum, audit journal, idempotency, and forbidden or stale approvals | `test/core/workflow-provenance.test.ts`, `test/core/cli.test.ts` |
39
+ | Durable external waits, local/callback evidence accumulation, safe settlement, checkpoint/expiry race rejection, minimal signed responses, retry/conflict deduplication, separate secrets, and timeout notification | `test/core/hub-api.test.ts`, `test/core/workflow.test.ts`, `test/core/workflow-provenance.test.ts` |
40
+ | Plans, decisions, contradictions, errors, lessons, and improvement reports | `test/core/hub-api.test.ts`, `test/core/workflow.test.ts` |
41
+ | Safe diagnostic classification and redaction | `test/core/diagnostics.test.ts`, `test/core/extension.test.ts`, `test/core/hub-api.test.ts` |
42
+ | Operator CLI init/validate/export/watch | `test/core/cli.test.ts`, `test/core/github-watch.test.ts` |
43
+ | Local and isolated-global packed npm CLI plus hub runtimes | `test/core/package-install.test.ts` |
44
+ | Required generated runtimes are present, tracked, and match the staged copy after build | `scripts/check-generated.mjs`, `test/core/generated-artifacts.test.ts` |
45
+ | Tag release packs `kxm-<v>.tgz`, fail-closed draft GitHub upload, 404-then-list draft discovery, digest proof, no clobber | `scripts/kxm-release-github.mjs`, `test/core/kxm-release-github.test.ts`, `test/core/ci-contract.test.ts` |
46
+ | Retrospective export snapshots, metadata-only provenance audit, body allowlisting, degradation records, and v1 compatibility | `test/core/retrospective.test.ts` |
47
+ | Interrupted-worker continue fallback, exact run-bound recovery, unbound telemetry isolation, and one-turn durable replay | `test/core/worker.test.ts`, `test/core/recovery.test.ts`, `test/core/extension.test.ts` |
48
+ | Hub-owned workflow affinity; integrated hub→extension→supervisor→replacement replay; pre-ack default/run/cross-run routing; one-child session-dir swapping; stable ordinary context; LRU retention; and corrupt-state/link containment | `test/core/hub-api.test.ts`, `test/core/extension.test.ts`, `test/core/worker.test.ts`, `test/core/cli.test.ts` |
49
+ | Final provider-error retention, built-in retry ordering, metadata-only journaling, bounded fallback exhaustion, oversized-frame classification, and session-preserving restart | `test/core/extension.test.ts`, `test/core/worker.test.ts`, `test/core/diagnostics.test.ts`, `test/core/cli.test.ts` |
50
+ | Tool capability allowlist, watchdog grace, bounded hung-tool recovery, oversized completed-tool cancellation, and race-safe hub/worker ownership claims | `test/core/worker.test.ts`, `test/core/cli.test.ts`, `test/core/server.test.ts` |
51
+ | Exact worker extension/skill sets, discovery isolation, path preflight, multi-path ordering, and Windows argument safety | `test/core/worker.test.ts` |
52
+ | Opt-in real-Pi smoke contract and safe skip paths | `test/core/smoke-real-pi.test.ts`, `test/core/smoke.test.ts` |
53
+ | Durable workflow and journal recovery | `test/core/store.test.ts` |
54
+ | Atomic workflow transition commit and rollback | `test/core/store.test.ts` |
55
+ | Pi and Claude workflow/journal tools, workflow-context sends, and peer-reference checkpoints/waits | `test/core/extension.test.ts`, `test/core/mcp.test.ts` |
56
+ | Package and marketplace version consistency | `scripts/check-versions.mjs` |
57
+ | Planned vNext schemas, restricted YAML fixtures, cross-resource semantics, and sync-safe rejection | `test/core/contracts-vnext.test.ts` |
58
+ | Production vNext restricted loader, deterministic bundle hashing, Git discovery, fail-closed semantics, init classification, provenance-tracked atomic creation, exact three-way repair, authority-change blocking, pinned crash resumption, shadow validation, explicit join, Runtime-local bindings, CLI isolation, and idempotence | `test/core/vnext-config.test.ts`, `test/core/cli.test.ts`, `test/core/package-install.test.ts` |
59
+ | Bounded legacy JSON migration: exact duplicate-key rejection, deterministic plans, decision binding (project/source/values), schema+semantic target validation, durable install, self-hashed receipts, tamper/drift detection, link refusal, CLI and packed-consumer round trips | `test/core/vnext-migrate.test.ts`, `test/core/cli.test.ts`, `test/core/contracts-vnext.test.ts`, `test/core/package-install.test.ts` |
60
+ | Permission-diff trust workflow: structured authority projections, conservative lattice classification (access, network, budgets, quorums, snapshots, secrets, transitions, shapes), prose neutrality, Git base shadowing, CLI diff/check gating, and packed-consumer round trips | `test/core/vnext-permission.test.ts`, `test/core/cli.test.ts`, `test/core/contracts-vnext.test.ts`, `test/core/package-install.test.ts` |
61
+ | Event-sourced local Runtime: supervisor singleton with stable logical identity, immutable home bindings, append-only per-project event stores, idempotent acceptance/cancel, projection rebuild equivalence, token-authenticated local API, auto-start, SIGKILL crash recovery, offline CLI, packed consumer | `test/core/vnext-runtime.test.ts`, `test/core/cli.test.ts`, `test/core/package-install.test.ts` |
62
+
63
+ The CI minimums are 93% lines, 80% branches, and 93% functions across
64
+ `plugins/kxm/src/**/*.ts` (excludes `server.ts` and `mcp-server.ts`). Those
65
+ floors may only ratchet up. The generated MCP runtime is exercised as a child
66
+ process, while the packed CLI and hub are installed in a clean consumer and
67
+ exercised from `node_modules`.
68
+
69
+ ## Executable examples and use cases
70
+
71
+ | Scenario | Location | Verification |
72
+ |---|---|---|
73
+ | Self-contained planner/reviewer round trip | `examples/roundtrip.ts` | Executed by `test/core/examples.test.ts` |
74
+ | Long-running deterministic reviewer | `examples/reviewer-agent.ts` | Type-checked and documented |
75
+ | Command-line requester | `examples/requester.ts` | Type-checked and documented |
76
+ | Plan then review | `examples/README.md` | Uses discovery, send, and wait |
77
+ | Separate file ownership | `examples/README.md` | Documents non-overlapping writers |
78
+ | Non-blocking delegation | `examples/README.md` | Uses send, independent work, and get |
79
+ | Obsolete-work cancellation | `examples/README.md` | Uses cancel and states rollback boundary |
80
+ | Safe network retry | `examples/README.md` | Uses stable idempotency keys |
81
+ | Jira issue-to-merge workflow | `.kxm/config/workflows/jira-development.json` | Parsed, type-checked through workflow tests, and exercised end to end with representative configuration |
82
+ | `.kxm` workspace defaults and persisted hub/worker logs | `.kxm/`, `test/core/server.test.ts`, `test/core/worker.test.ts` | Executed with isolated temporary workspaces |
83
+ | Signed external result callback | `examples/workflow-signal.ts` | Type-checked; equivalent signed callback path is exercised end to end in `test/core/hub-api.test.ts` |
84
+ | Peer provenance and optional explicit degradation | `examples/provenance-workflow.json`, `.kxm/config/workflows/provenance-quorum.json`, `docs/provenance-gates.md` | Both definitions are parser-checked in `test/core/examples.test.ts`; adversarial evidence and degradation behavior is automated in `test/core/workflow-provenance.test.ts` |
85
+ | Quorum parser boundaries and definition identity | `plugins/kxm/src/workflow.ts`, `test/core/workflow-quorum.test.ts`, `test/core/workflow-definition-hash.test.ts` | Rejects impossible peer pools, verifies degradation bounds, and proves secret-free semantic hash stamping plus credential-rotation invariance |
86
+ | Artifact existence and containment gate | `plugins/kxm/src/artifacts-exist.ts`, `test/core/artifacts-exist.test.ts` | Non-empty regular files pass; missing, empty, non-file, lexical escape, and real-path escape cases fail closed (host-permitted symlink coverage) |
87
+ | Headless harness helper | `scripts/harness-run.mjs`, `justfile`, `test/core/harness-run.test.ts` | Offline auth success/logout/garbage, role/mode/pair/provider refusals before spawn, missing brief/schema fail closed with zero spawn, invocation-cwd relative `prompt_file`/`output_schema` vs `request.cwd` (absolute argv tokens; Claude/Codex stdin matches the brief), Pi JSONL multi-`message_end` sums, Claude auxiliary usage, native error-on-exit-0, timeout/empty payload, sidecar-only stderr/answer/error, shell:false argv metacharacters, and win32 `.cmd` rejection. Result v2 transport vs closed model claims, dispatch-before-spawn, grok/codex isolation flags, `max_turns` validation, obsolete v1 diagnosis without rewrite or unknown-schema echo, partial usage on fail/interrupt, signaled null `exitCode` plus exact `signal`, exit-before-stdio-close drain vs bounded linger, type-closed usage/cost (no object leak or zero-coercion), malformed optional text as run-stage failure with retained spend, stdin/pid-record write failures not completed, bounded timeout settle without descendant-death claims, spawn/write-failure stage and spend, and capability-fixture parser evidence (Codex `--ignore-user-config` is not invented in top-level help; captured help bytes are not rescrubbed). Recipe quoting is covered from the justfile body without a just binary (POSIX `sh` + positional argv; Windows uses the recipe's `node -e` / argv shape). Real just integration is optional and skipped when the binary is absent. No live paid smoke. |
88
+ | Long-lived headless coordinator | `scripts/kxm-worker.mjs` | Restart limits, spawn failure, collision-resistant ownership, exact resource and tool loading, raw-output isolation, bounded RPC framing, bounded drain, hung-tool recovery, provider/model fallback, and `--continue` fallback are automated; the opt-in real-Pi gate verifies two workers, discovery, request/reply, fanout, durable restart/resume, journal, and checkpoint |
89
+ | GitHub check signal adapter | `plugins/kxm/src/github-watch.ts` | Deterministic pagination, conclusion, retry, and per-wait delivery-generation states in `test/core/github-watch.test.ts` |
90
+ | Operator CLI | `scripts/kxm.mjs` | Isolated workspace commands in `test/core/cli.test.ts`; the packed artifact is installed locally and with the documented global `--omit=peer` path by `test/core/package-install.test.ts` |
91
+ | Hub-local session brief | `plugins/kxm/src/session-work.ts`, `test/core/session-work.test.ts`, `test/core/cli.test.ts` | Status line and task/plan lists from hub SQLite without message bodies; `init --hub` is an unknown option; `hub bind` reports on/off/unknown |
92
+ | Native-free package install and Windows `pi.cmd` worker launch | `package.json`, `test/core/store.test.ts`, `test/core/worker.test.ts` | CI runs on Linux at Node 22.19 and Node 24; the Windows `pi.cmd` fixture stays in `test/core/worker.test.ts` and runs locally on Windows or when the paused Windows legs resume. |
93
+
94
+ ## Manual release checks
95
+
96
+ Automation cannot prove that a third-party harness UI renders perfectly. Before a release, connect two current Pi sessions, run `/kxm hub`, complete one inbound round trip, install the marketplace plugin in a clean Claude Code profile, and verify `kxm_list`. Exercise preview channel delivery only when the target Claude Code version supports community channels.
97
+
98
+ Create the versioned tarball with `npm pack`, attach it to the matching GitHub
99
+ release, and verify the authenticated `gh release download` plus
100
+ `npm install --global --omit=peer <local-tarball>` path before publishing the
101
+ operator installation instructions. For version `<release-version>`, the required asset is
102
+ `kxm-<release-version>.tgz`.
103
+
104
+ When adding a feature, add executable coverage and update this matrix in the same change. If a behavior can only be verified manually, state why and add it to the release checklist instead of implying automated coverage.
105
+
106
+ ## v0.5 context suites
107
+
108
+ | Suite | Covers |
109
+ |---|---|
110
+ | `test/core/context.test.ts` | Context schema round-trips, hostile input, cross-project fail-closed, storage upgrade |
111
+ | `test/core/state.test.ts` | Temporal state lifecycle, asOf queries, supersession, contradictions, restart durability |
112
+ | `test/core/context-authority.test.ts` | Authority grant floor, reserialization escalation, lineage bounds, control-plane smuggling |
113
+ | `test/core/arbiter.test.ts` | Role-aware packet assembly, budgets, contradiction routing, journal conversion, hub surfaces |
114
+ | `test/core/context-surfaces.test.ts` | CLI and Pi tool parity for the context API |
115
+ | `test/core/journal-evolution.test.ts` | New journal categories, evidence requirements, governed promotion |
116
+ | `test/core/wiki.test.ts` | Wiki compilation determinism, lifecycle preservation, contradiction visibility, lint |
117
+ | `test/core/workflow-transitions.test.ts` | Typed back-edges, budgets, bypass protection, restart recovery |
118
+ | `test/core/fix-workflow.test.ts` | /fix end-to-end, independent repro-review oracle, wrong-seam invalidation, failed self-retry, plan-hash gating, exhaustion |
119
+ | `test/core/skills.test.ts` | Skill candidate lifecycle, quarantine, immutability, CLI |
120
+ | `test/core/routing.test.ts` | Behavioral hash, record parsing, comparisons, routing report |
121
+ | `test/core/migration.test.ts` | v0.4 → v0.5 database upgrade fixture |