@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,62 @@
1
+ import { lstatSync, realpathSync, statSync } from "node:fs";
2
+ import { isAbsolute, relative, resolve } from "node:path";
3
+
4
+ export type ArtifactExistenceFailure =
5
+ | "artifact_outside_workspace_assets"
6
+ | "artifact_missing"
7
+ | "artifact_not_file"
8
+ | "artifact_empty"
9
+ | "artifact_unreadable";
10
+
11
+ export type ArtifactExistenceResult =
12
+ | { ok: true; path: string; bytes: number }
13
+ | { ok: false; error: ArtifactExistenceFailure; path: string };
14
+
15
+ function staysUnder(root: string, candidate: string): boolean {
16
+ const child = relative(root, candidate);
17
+ return child === "" || (!isAbsolute(child) && child !== ".." && !child.startsWith(`..${process.platform === "win32" ? "\\" : "/"}`));
18
+ }
19
+
20
+ /**
21
+ * Verify one non-empty regular file beneath the configured workspace assets
22
+ * directory. Both lexical and real paths are checked so a missing outside path
23
+ * and a symlink/junction escape fail closed.
24
+ */
25
+ export function verifyArtifactExists(rootInput: string, pathInput: string): ArtifactExistenceResult {
26
+ const lexicalRoot = resolve(rootInput);
27
+ const lexicalPath = resolve(pathInput);
28
+ if (!staysUnder(lexicalRoot, lexicalPath)) {
29
+ return { ok: false, error: "artifact_outside_workspace_assets", path: lexicalPath };
30
+ }
31
+
32
+ let realRoot: string;
33
+ let realPath: string;
34
+ try {
35
+ realRoot = realpathSync(lexicalRoot);
36
+ } catch {
37
+ return { ok: false, error: "artifact_unreadable", path: lexicalPath };
38
+ }
39
+ try {
40
+ realPath = realpathSync(lexicalPath);
41
+ } catch {
42
+ return { ok: false, error: "artifact_missing", path: lexicalPath };
43
+ }
44
+ if (!staysUnder(realRoot, realPath)) {
45
+ return { ok: false, error: "artifact_outside_workspace_assets", path: lexicalPath };
46
+ }
47
+
48
+ try {
49
+ // lstat keeps an explicit link check at the final component. Parent
50
+ // junction/symlink escapes are covered by the real-path containment above.
51
+ const link = lstatSync(lexicalPath);
52
+ if (link.isSymbolicLink()) {
53
+ return { ok: false, error: "artifact_outside_workspace_assets", path: lexicalPath };
54
+ }
55
+ const artifact = statSync(realPath);
56
+ if (!artifact.isFile()) return { ok: false, error: "artifact_not_file", path: lexicalPath };
57
+ if (artifact.size < 1) return { ok: false, error: "artifact_empty", path: lexicalPath };
58
+ return { ok: true, path: realPath, bytes: artifact.size };
59
+ } catch {
60
+ return { ok: false, error: "artifact_unreadable", path: lexicalPath };
61
+ }
62
+ }
@@ -0,0 +1,236 @@
1
+ export type SupportedShell = "bash" | "zsh" | "fish";
2
+
3
+ const TOP_LEVEL_COMMANDS = [
4
+ "init",
5
+ "migrate",
6
+ "backup",
7
+ "restore",
8
+ "run",
9
+ "runs",
10
+ "harness",
11
+ "update",
12
+ "runtime",
13
+ "trust",
14
+ "agent",
15
+ "session",
16
+ "peer",
17
+ "workflow",
18
+ "gate",
19
+ "improve",
20
+ "context",
21
+ "skills",
22
+ "memory",
23
+ "routing",
24
+ "hub",
25
+ "dash",
26
+ "config",
27
+ "completion",
28
+ "suggest",
29
+ "goal",
30
+ "task",
31
+ "plan",
32
+ ];
33
+
34
+ const SUBCOMMANDS: Record<string, string[]> = {
35
+ runs: ["status", "cancel", "list"],
36
+ migrate: ["plan", "apply", "verify"],
37
+ harness: ["list"],
38
+ runtime: ["start", "status", "stop"],
39
+ trust: ["diff", "check"],
40
+ agent: ["worker"],
41
+ session: ["status", "brief", "start", "stop"],
42
+ peer: ["list", "send", "get", "await", "cancel", "fanout", "inbox", "reply"],
43
+ workflow: ["list", "get", "checkpoint", "record", "wait", "signal", "start", "export"],
44
+ gate: ["validate", "artifacts-exist", "degrade", "signal", "github"],
45
+ context: ["get", "recall", "state", "episode", "promote", "explain", "wiki-compile", "wiki-lint"],
46
+ skills: ["create", "evaluate", "promote", "reject", "list", "verify"],
47
+ memory: ["brief", "note", "sync"],
48
+ routing: ["report"],
49
+ hub: ["view", "start", "stop", "bind", "unbind"],
50
+ config: ["get", "set", "list"],
51
+ goal: ["create", "list", "get"],
52
+ task: ["create", "list", "get", "run", "sync"],
53
+ };
54
+
55
+ export function generateShellCompletion(shell: SupportedShell): string {
56
+ switch (shell) {
57
+ case "bash":
58
+ return generateBashCompletion();
59
+ case "zsh":
60
+ return generateZshCompletion();
61
+ case "fish":
62
+ return generateFishCompletion();
63
+ default:
64
+ throw new Error(`Unsupported shell: ${String(shell)}`);
65
+ }
66
+ }
67
+
68
+ function generateBashCompletion(): string {
69
+ const topList = TOP_LEVEL_COMMANDS.join(" ");
70
+ let subcases = "";
71
+ for (const [cmd, subs] of Object.entries(SUBCOMMANDS)) {
72
+ subcases += `
73
+ ${cmd})
74
+ COMPREPLY=( $(compgen -W "${subs.join(" ")}" -- "$cur") )
75
+ return 0
76
+ ;;`;
77
+ }
78
+
79
+ return `#!/usr/bin/env bash
80
+ # Bash completion for kxm
81
+
82
+ _kxm_completions() {
83
+ local cur prev words cword
84
+ _init_completion || return
85
+
86
+ local top_commands="${topList}"
87
+
88
+ if [[ $cword -eq 1 ]]; then
89
+ COMPREPLY=( $(compgen -W "$top_commands" -- "$cur") )
90
+ return 0
91
+ fi
92
+
93
+ case "\${words[1]}" in${subcases}
94
+ completion)
95
+ COMPREPLY=( $(compgen -W "bash zsh fish" -- "$cur") )
96
+ return 0
97
+ ;;
98
+ dash)
99
+ if [[ "$prev" == "--screen" ]]; then
100
+ COMPREPLY=( $(compgen -W "agents tasks workflows plans inbox procs spend" -- "$cur") )
101
+ return 0
102
+ fi
103
+ ;;
104
+ context)
105
+ if [[ "$prev" == "--role" ]]; then
106
+ COMPREPLY=( $(compgen -W "repro planner critic implementer verifier" -- "$cur") )
107
+ return 0
108
+ fi
109
+ ;;
110
+ *)
111
+ ;;
112
+ esac
113
+ }
114
+
115
+ complete -F _kxm_completions kxm
116
+ `;
117
+ }
118
+
119
+ function generateZshCompletion(): string {
120
+ return `#compdef kxm
121
+
122
+ _kxm() {
123
+ local curcontext="$curcontext" state line
124
+ typeset -A opt_args
125
+
126
+ local -a commands
127
+ commands=(
128
+ 'init:Create or validate a vNext project'
129
+ 'migrate:Plan, apply, and verify legacy configuration migration'
130
+ 'backup:Create a verified SQLite backup manifest'
131
+ 'restore:Restore SQLite stores from a backup manifest'
132
+ 'run:Create a vNext workflow run'
133
+ 'runs:Inspect vNext runs'
134
+ 'harness:Detect coding-agent harnesses and auth'
135
+ 'update:Update kxm, harness CLIs, and model catalogs'
136
+ 'runtime:Manage the vNext Runtime supervisor'
137
+ 'trust:Permission-diff trust review'
138
+ 'agent:Run and supervise agents'
139
+ 'session:Create manifests and brief recent hub work'
140
+ 'peer:Peer agent messaging and coordination'
141
+ 'workflow:Start and inspect workflow runs'
142
+ 'gate:Validate definitions and operate evidence gates'
143
+ 'improve:Propose CLI or project improvements'
144
+ 'context:KXM context operating-system queries'
145
+ 'skills:Governed skill candidate lifecycle'
146
+ 'memory:Harness-agnostic Git memory operations'
147
+ 'routing:Routing telemetry and behavioral comparisons'
148
+ 'hub:Start, inspect, and stop the local KXM hub'
149
+ 'dash:Live terminal dashboard screens'
150
+ 'config:Inspect and configure personalization settings'
151
+ 'completion:Generate shell autocompletions (bash, zsh, fish)'
152
+ 'suggest:Recommend workflow, roles, and skills from a prompt'
153
+ 'goal:Internal project goal management'
154
+ 'task:Task management driving workflow runs'
155
+ )
156
+
157
+ _arguments -C \\
158
+ '1: :->cmd' \\
159
+ '*:: :->args'
160
+
161
+ case "$state" in
162
+ cmd)
163
+ _describe 'kxm commands' commands
164
+ ;;
165
+ args)
166
+ case "\${line[1]}" in
167
+ dash)
168
+ _arguments '--screen[Screen to view]:screen:(agents tasks workflows plans inbox procs spend)'
169
+ ;;
170
+ completion)
171
+ _arguments '1:shell:(bash zsh fish)'
172
+ ;;
173
+ config)
174
+ _arguments '1:action:(get set list)'
175
+ ;;
176
+ runs)
177
+ _arguments '1:subcommand:(status cancel list)'
178
+ ;;
179
+ workflow)
180
+ _arguments '1:subcommand:(list get checkpoint record wait signal start export)'
181
+ ;;
182
+ memory)
183
+ _arguments '1:subcommand:(brief note sync)'
184
+ ;;
185
+ task)
186
+ _arguments '1:subcommand:(create list get run sync)'
187
+ ;;
188
+ goal)
189
+ _arguments '1:subcommand:(create list get)'
190
+ ;;
191
+ *)
192
+ _files
193
+ ;;
194
+ esac
195
+ ;;
196
+ esac
197
+ }
198
+
199
+ _kxm "$@"
200
+ `;
201
+ }
202
+
203
+ function generateFishCompletion(): string {
204
+ const topList = TOP_LEVEL_COMMANDS.join(" ");
205
+ return `# Fish completion for kxm
206
+
207
+ complete -c kxm -f
208
+
209
+ # Top level commands
210
+ complete -c kxm -n "__fish_use_subcommand" -a "${topList}"
211
+
212
+ # Completion subcommand
213
+ complete -c kxm -n "__fish_seen_subcommand_from completion" -a "bash zsh fish"
214
+
215
+ # Dash subcommand
216
+ complete -c kxm -n "__fish_seen_subcommand_from dash" -l screen -a "agents tasks workflows plans inbox procs spend"
217
+
218
+ # Config subcommand
219
+ complete -c kxm -n "__fish_seen_subcommand_from config" -a "get set list"
220
+
221
+ # Runs subcommand
222
+ complete -c kxm -n "__fish_seen_subcommand_from runs" -a "status cancel list"
223
+
224
+ # Workflow subcommand
225
+ complete -c kxm -n "__fish_seen_subcommand_from workflow" -a "list get checkpoint record wait signal start export"
226
+
227
+ # Memory subcommand
228
+ complete -c kxm -n "__fish_seen_subcommand_from memory" -a "brief note sync"
229
+
230
+ # Task subcommand
231
+ complete -c kxm -n "__fish_seen_subcommand_from task" -a "create list get run sync"
232
+
233
+ # Goal subcommand
234
+ complete -c kxm -n "__fish_seen_subcommand_from goal" -a "create list get"
235
+ `;
236
+ }