akm-cli 0.9.30 → 0.10.261001-beta

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 (384) hide show
  1. package/CHANGELOG.md +438 -0
  2. package/README.md +10 -10
  3. package/ROADMAP.md +112 -0
  4. package/STABILITY.md +99 -57
  5. package/dist/api-node.mjs +20 -0
  6. package/dist/api.d.ts +23 -0
  7. package/dist/api.js +45 -0
  8. package/dist/assets/hints/cli-hints-full.md +15 -29
  9. package/dist/assets/hints/cli-hints-short.md +2 -2
  10. package/dist/assets/improve-strategies/default.json +3 -3
  11. package/dist/assets/prompts/consolidate-pair.md +9 -7
  12. package/dist/assets/stash-skeleton/README.md +1 -1
  13. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +1 -1
  14. package/dist/cli/shared.js +31 -48
  15. package/dist/cli/unknown-flags.js +6 -43
  16. package/dist/cli.js +8 -34
  17. package/dist/commands/agent/contribute-cli.js +1 -1
  18. package/dist/commands/completions.js +1 -2
  19. package/dist/commands/config-cli.js +5 -28
  20. package/dist/commands/env/env-cli.js +5 -5
  21. package/dist/commands/env/secret-cli.js +2 -2
  22. package/dist/commands/feedback-cli.js +75 -49
  23. package/dist/commands/health/checks.js +41 -16
  24. package/dist/commands/health/plugin-staleness.js +52 -22
  25. package/dist/commands/improve/autonomy-gate.js +5 -3
  26. package/dist/commands/improve/consolidate/chunking.js +3 -10
  27. package/dist/commands/improve/consolidate/continuity-check.js +4 -4
  28. package/dist/commands/improve/consolidate/pair-pass.js +29 -10
  29. package/dist/commands/improve/consolidate.js +10 -65
  30. package/dist/commands/improve/distill/lesson-update.js +91 -0
  31. package/dist/commands/improve/distill-guards.js +1 -43
  32. package/dist/commands/improve/distill.js +148 -21
  33. package/dist/commands/improve/eligibility.js +14 -1
  34. package/dist/commands/improve/extract-cli.js +1 -1
  35. package/dist/commands/improve/extract-prompt.js +17 -7
  36. package/dist/commands/improve/extract.js +5 -7
  37. package/dist/commands/improve/improve-cli.js +125 -118
  38. package/dist/commands/improve/improve-strategies.js +8 -12
  39. package/dist/commands/improve/improve.js +134 -52
  40. package/dist/commands/improve/loop-stages.js +18 -5
  41. package/dist/commands/improve/planner.js +0 -1
  42. package/dist/commands/improve/preparation.js +40 -99
  43. package/dist/commands/improve/proactive-maintenance.js +2 -2
  44. package/dist/commands/improve/reflect-noise.js +3 -55
  45. package/dist/commands/improve/reflect.js +29 -34
  46. package/dist/commands/improve/retrieval-queries.js +37 -0
  47. package/dist/commands/improve/retrieval-scope.js +2 -2
  48. package/dist/commands/improve/salience.js +2 -9
  49. package/dist/commands/improve/session-asset.js +4 -1
  50. package/dist/commands/improve/stage.js +23 -12
  51. package/dist/commands/lint/index.js +5 -20
  52. package/dist/commands/observability-cli.js +3 -9
  53. package/dist/commands/proposal/drain.js +43 -6
  54. package/dist/commands/proposal/proposal-cli.js +11 -31
  55. package/dist/commands/proposal/repository.js +20 -14
  56. package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -3
  57. package/dist/commands/read/knowledge.js +3 -3
  58. package/dist/commands/read/remember-cli.js +0 -13
  59. package/dist/commands/read/search-cli.js +29 -97
  60. package/dist/commands/read/search.js +0 -11
  61. package/dist/commands/read/show.js +0 -19
  62. package/dist/commands/sources/plugin-upgrade.js +164 -101
  63. package/dist/commands/sources/sources-cli.js +1 -15
  64. package/dist/commands/sources/stash-cli.js +6 -14
  65. package/dist/commands/tasks/tasks-cli.js +4 -115
  66. package/dist/commands/workflow/plan.js +11 -33
  67. package/dist/commands/workflow-cli.js +2 -7
  68. package/dist/core/adapter/adapter-ids.js +1 -2
  69. package/dist/core/adapter/adapters/agent-skills-adapter.js +0 -4
  70. package/dist/core/adapter/adapters/akm-adapter.js +9 -48
  71. package/dist/core/adapter/adapters/akm-lint.js +10 -26
  72. package/dist/core/adapter/adapters/akm-metadata.js +2 -72
  73. package/dist/core/adapter/adapters/akm-task-adapter.js +0 -5
  74. package/dist/core/adapter/adapters/akm-workflow-adapter.js +9 -28
  75. package/dist/core/adapter/adapters/dotenv-adapter.js +1 -20
  76. package/dist/core/adapter/adapters/generic-files-adapter.js +0 -10
  77. package/dist/core/adapter/adapters/llm-wiki-adapter.js +0 -4
  78. package/dist/core/adapter/adapters/tool-dir-shared.js +0 -24
  79. package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -4
  80. package/dist/core/adapter/recognize-match.js +3 -4
  81. package/dist/core/common.js +18 -2
  82. package/dist/core/config/config-schema.js +12 -15
  83. package/dist/core/config/config-types.js +6 -15
  84. package/dist/core/config/config-walker.js +6 -23
  85. package/dist/core/config/config.js +17 -80
  86. package/dist/core/config/engine-semantics.js +7 -3
  87. package/dist/core/config/schema/engines.js +7 -7
  88. package/dist/core/config/schema/improve-processes.js +10 -63
  89. package/dist/core/config/schema/improve.js +2 -21
  90. package/dist/core/config/schema/index-config.js +6 -39
  91. package/dist/core/env-secret-ref.js +2 -45
  92. package/dist/core/errors.js +1 -2
  93. package/dist/core/extra-params.js +2 -86
  94. package/dist/core/file-lock.js +12 -7
  95. package/dist/core/improve-result.js +13 -1
  96. package/dist/core/mutation-target.js +2 -2
  97. package/dist/core/paths.js +4 -0
  98. package/dist/core/recognition-util.js +4 -5
  99. package/dist/core/run-lock.js +1 -1
  100. package/dist/core/subprocess.js +49 -0
  101. package/dist/core/warn.js +21 -4
  102. package/dist/core/write-source.js +3 -3
  103. package/dist/execution/target-ref.js +1 -2
  104. package/dist/indexer/indexer.js +15 -6
  105. package/dist/indexer/passes/memory-inference.js +15 -6
  106. package/dist/indexer/search/db-search.js +49 -36
  107. package/dist/indexer/search/fts-query.js +0 -19
  108. package/dist/indexer/search/ranking.js +29 -1
  109. package/dist/indexer/usage/usage-events.js +21 -16
  110. package/dist/integrations/agent/engine-resolution.js +5 -2
  111. package/dist/integrations/agent/index.js +1 -1
  112. package/dist/integrations/agent/profiles.js +41 -98
  113. package/dist/integrations/agent/request-lowering.js +3 -3
  114. package/dist/integrations/harnesses/aider/index.js +5 -0
  115. package/dist/integrations/harnesses/amazonq/index.js +1 -0
  116. package/dist/integrations/harnesses/claude/config-import.js +2 -3
  117. package/dist/integrations/harnesses/claude/index.js +5 -0
  118. package/dist/integrations/harnesses/codex/index.js +1 -0
  119. package/dist/integrations/harnesses/copilot/index.js +1 -0
  120. package/dist/integrations/harnesses/gemini/index.js +1 -0
  121. package/dist/integrations/harnesses/index.js +18 -39
  122. package/dist/integrations/harnesses/opencode/agent-builder.js +60 -35
  123. package/dist/integrations/harnesses/opencode/config-import.js +121 -52
  124. package/dist/integrations/harnesses/opencode/index.js +22 -0
  125. package/dist/integrations/harnesses/opencode/plugin-layout.js +68 -0
  126. package/dist/integrations/harnesses/opencode/session-log-types.js +12 -0
  127. package/dist/integrations/harnesses/opencode/session-log-v1.js +72 -0
  128. package/dist/integrations/harnesses/opencode/session-log-v2.js +140 -0
  129. package/dist/integrations/harnesses/opencode/session-log.js +104 -115
  130. package/dist/integrations/harnesses/opencode/version.js +98 -0
  131. package/dist/integrations/harnesses/opencode-sdk/{harness.js → index.js} +5 -17
  132. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +105 -206
  133. package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +199 -0
  134. package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +254 -0
  135. package/dist/integrations/harnesses/opencode-sdk/wire.js +66 -0
  136. package/dist/integrations/harnesses/openhands/index.js +1 -0
  137. package/dist/integrations/harnesses/pi/index.js +1 -0
  138. package/dist/integrations/harnesses/shared.js +2 -0
  139. package/dist/integrations/harnesses/types.js +2 -0
  140. package/dist/llm/client.js +74 -14
  141. package/dist/output/cli-hints.js +1 -1
  142. package/dist/output/context.js +10 -19
  143. package/dist/output/format-exempt.js +5 -8
  144. package/dist/output/shapes/helpers.js +1 -22
  145. package/dist/output/shapes/passthrough.js +0 -1
  146. package/dist/output/shapes.js +3 -31
  147. package/dist/output/stdout.js +5 -1
  148. package/dist/output/text/command-format.js +6 -1
  149. package/dist/output/text/workflow-format.js +4 -22
  150. package/dist/scripts/akm-migrate-node.js +15769 -16731
  151. package/dist/scripts/akm-migrate.js +16339 -17297
  152. package/dist/setup/detect.js +10 -4
  153. package/dist/setup/harness-config-import.js +5 -14
  154. package/dist/setup/setup.js +1 -1
  155. package/dist/setup/steps/tasks.js +12 -13
  156. package/dist/sources/providers/git-stash.js +94 -13
  157. package/dist/storage/repositories/index-utility-repository.js +2 -32
  158. package/dist/storage/repositories/index-vec-repository.js +4 -0
  159. package/dist/storage/repositories/task-history-repository.js +0 -5
  160. package/dist/storage/repositories/workflow-runs-repository.js +5 -15
  161. package/dist/tasks/embedded.js +2 -1
  162. package/dist/tasks/run/run-command-task.js +9 -1
  163. package/dist/tasks/run/run-workflow-task.js +4 -3
  164. package/dist/tasks/run/task-history.js +0 -2
  165. package/dist/tasks/run/task-log.js +38 -1
  166. package/dist/tasks/schedule-gates.js +39 -0
  167. package/dist/tasks/scheduler-binding.js +0 -16
  168. package/dist/tasks/scheduler-sync.js +3 -97
  169. package/dist/tasks/source/bounded-document.js +1 -1
  170. package/dist/tasks/source/task-source-v4.js +2 -12
  171. package/dist/tasks/task-run-reserved-flags.js +2 -31
  172. package/dist/workflows/authoring/authoring.js +6 -6
  173. package/dist/workflows/compile.js +8 -65
  174. package/dist/workflows/exec/child-workflow.js +22 -3
  175. package/dist/workflows/exec/native-executor.js +12 -147
  176. package/dist/workflows/exec/run-workflow.js +31 -103
  177. package/dist/workflows/exec/step-work.js +9 -178
  178. package/dist/workflows/exec/unit-dispatch.js +0 -10
  179. package/dist/workflows/freeze/environment.js +3 -44
  180. package/dist/workflows/freeze/freeze.js +8 -41
  181. package/dist/workflows/freeze/targets/child-workflow.js +27 -63
  182. package/dist/workflows/freeze/targets/command.js +2 -16
  183. package/dist/workflows/freeze/targets/shell.js +0 -2
  184. package/dist/workflows/freeze/task-bindings.js +2 -28
  185. package/dist/workflows/ir/params.js +12 -2
  186. package/dist/workflows/parser.js +82 -232
  187. package/dist/workflows/plan.js +1 -1
  188. package/dist/workflows/renderer.js +10 -19
  189. package/dist/workflows/runtime/run-plan.js +11 -53
  190. package/dist/workflows/runtime/runs.js +4 -27
  191. package/dist/workflows/source-files.js +12 -16
  192. package/dist/workflows/source-semantics.js +1 -93
  193. package/docs/README.md +43 -42
  194. package/docs/agents/README.md +15 -0
  195. package/docs/agents/agent-install.md +14 -0
  196. package/docs/architecture/0.10-process-rules.md +827 -0
  197. package/docs/architecture/README.md +67 -0
  198. package/docs/architecture/adapters.md +258 -0
  199. package/docs/architecture/akm-architecture-decision-history.md +2055 -0
  200. package/docs/architecture/akm-core-principles.md +126 -0
  201. package/docs/architecture/architecture.md +578 -0
  202. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
  203. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
  204. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
  205. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
  206. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
  207. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
  208. package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
  209. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
  210. package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
  211. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
  212. package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
  213. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
  214. package/docs/architecture/decisions/README.md +62 -0
  215. package/docs/architecture/improvement.md +479 -0
  216. package/docs/architecture/internals/classification.md +154 -0
  217. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
  218. package/docs/architecture/internals/functional-contract-patterns.md +340 -0
  219. package/docs/architecture/internals/health-advisories.md +110 -0
  220. package/docs/architecture/internals/improve-workflow.md +719 -0
  221. package/docs/architecture/internals/indexing.md +498 -0
  222. package/docs/architecture/internals/registry-network-boundary.md +57 -0
  223. package/docs/architecture/internals/search.md +248 -0
  224. package/docs/architecture/internals/storage-locations.md +943 -0
  225. package/docs/architecture/persisted-data-compat.md +68 -0
  226. package/docs/architecture/reviews/env-secret-access.md +319 -0
  227. package/docs/architecture/runtime-boundary-design.md +153 -0
  228. package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
  229. package/docs/architecture/specs/0.9.0-decisions.md +532 -0
  230. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
  231. package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
  232. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
  233. package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
  234. package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
  235. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
  236. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
  237. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
  238. package/docs/architecture/specs/di-seams-plan.md +539 -0
  239. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
  240. package/docs/architecture/specs/fact-asset-type.md +142 -0
  241. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
  242. package/docs/architecture/specs/okf-support.md +148 -0
  243. package/docs/architecture/specs/ref.md +329 -0
  244. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
  245. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
  246. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
  247. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
  248. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
  249. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
  250. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
  251. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
  252. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
  253. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
  254. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
  255. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
  256. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
  257. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
  258. package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
  259. package/docs/architecture/specs/stash-organization-conventions.md +377 -0
  260. package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
  261. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
  262. package/docs/architecture/specs/workflow-format-unification.md +432 -0
  263. package/docs/architecture/testing/manual-testing-checklist.md +3411 -0
  264. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
  265. package/docs/architecture/testing/task-workflow-manual-tests.md +1720 -0
  266. package/docs/architecture/testing/testing-workflow.md +446 -0
  267. package/docs/architecture/workflow-engine.md +223 -0
  268. package/docs/guides/README.md +33 -0
  269. package/docs/guides/author-bundles.md +310 -0
  270. package/docs/guides/author-workflows.md +490 -0
  271. package/docs/guides/bundles.md +323 -0
  272. package/docs/guides/capture-knowledge.md +136 -0
  273. package/docs/guides/claude-code-vs-akm-workflows.md +29 -0
  274. package/docs/guides/concepts.md +93 -0
  275. package/docs/guides/discover-and-load.md +158 -0
  276. package/docs/guides/getting-started.md +240 -0
  277. package/docs/guides/improve-the-library.md +247 -0
  278. package/docs/guides/knowledge-management.md +18 -0
  279. package/docs/guides/recipes/headless-install.md +97 -0
  280. package/docs/guides/recipes/website-source.md +28 -0
  281. package/docs/guides/run-workflows.md +279 -0
  282. package/docs/guides/scheduling.md +131 -0
  283. package/docs/guides/use-with-any-agent.md +174 -0
  284. package/docs/guides/wikis.md +81 -0
  285. package/docs/integration/bundling-akm.md +7 -6
  286. package/docs/maintainers/README.md +19 -0
  287. package/docs/maintainers/curate-workmap.md +335 -0
  288. package/docs/maintainers/eval.md +3 -0
  289. package/docs/maintainers/local-development.md +108 -0
  290. package/docs/maintainers/release-checklist.md +135 -0
  291. package/docs/migration/README.md +4 -2
  292. package/docs/migration/release-notes/0.0.13.md +1 -1
  293. package/docs/migration/release-notes/0.1.0.md +1 -1
  294. package/docs/migration/release-notes/0.10.0.md +201 -0
  295. package/docs/migration/release-notes/0.2.0.md +1 -1
  296. package/docs/migration/release-notes/0.3.0.md +1 -1
  297. package/docs/migration/release-notes/0.5.0.md +1 -1
  298. package/docs/migration/release-notes/0.6.0.md +1 -1
  299. package/docs/migration/release-notes/0.7.0.md +1 -1
  300. package/docs/migration/release-notes/0.7.3.md +2 -2
  301. package/docs/migration/release-notes/0.7.4.md +1 -1
  302. package/docs/migration/release-notes/0.7.5.md +1 -1
  303. package/docs/migration/release-notes/0.8.0.md +1 -1
  304. package/docs/migration/release-notes/0.9.0.md +1 -1
  305. package/docs/migration/release-notes/0.9.14.md +1 -1
  306. package/docs/migration/release-notes/0.9.15.md +1 -1
  307. package/docs/migration/release-notes/0.9.16.md +1 -1
  308. package/docs/migration/release-notes/0.9.17.md +1 -1
  309. package/docs/migration/release-notes/0.9.19.md +1 -1
  310. package/docs/migration/release-notes/0.9.2.md +1 -1
  311. package/docs/migration/release-notes/README.md +28 -31
  312. package/docs/migration/v0.5-to-v0.6.md +759 -0
  313. package/docs/migration/v0.8-to-v0.9.md +1 -1
  314. package/docs/migration/v0.9-to-v0.10.md +507 -0
  315. package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
  316. package/docs/posts/README.md +30 -0
  317. package/docs/posts/akm-command-tour.md +495 -0
  318. package/docs/posts/akm-logo-sized.webp +0 -0
  319. package/docs/posts/belief-aware-memory-12.md +139 -0
  320. package/docs/posts/config-v2-lessons-16.md +191 -0
  321. package/docs/posts/improve-loop-autonomous-10.md +225 -0
  322. package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
  323. package/docs/posts/intro-part-01.md +76 -0
  324. package/docs/posts/intro-part-02.md +221 -0
  325. package/docs/posts/intro-part-03.md +190 -0
  326. package/docs/posts/intro-part-04.md +221 -0
  327. package/docs/posts/llm-mode-reflect-13.md +166 -0
  328. package/docs/posts/openpalm-built-on-akm.md +86 -0
  329. package/docs/posts/progressive-disclosure-06.md +129 -0
  330. package/docs/posts/proposal-safety-net-15.md +112 -0
  331. package/docs/posts/release-0.5.0.md +247 -0
  332. package/docs/posts/release-0.6.0.md +117 -0
  333. package/docs/posts/release-0.7.0.md +159 -0
  334. package/docs/posts/release-0.8.0.md +332 -0
  335. package/docs/posts/scattered-skills-05.md +100 -0
  336. package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
  337. package/docs/posts/team-skills-07.md +198 -0
  338. package/docs/posts/wiki-agent-knowledge-08.md +223 -0
  339. package/docs/posts/workflows-vaults-09.md +321 -0
  340. package/docs/product-surface.md +54 -0
  341. package/docs/reference/README.md +2 -2
  342. package/docs/reference/api.md +65 -0
  343. package/docs/reference/asset-types.md +166 -0
  344. package/docs/reference/bundle-types.md +2 -4
  345. package/docs/reference/cli.md +163 -192
  346. package/docs/reference/configuration.md +101 -20
  347. package/docs/reference/data-and-telemetry.md +2 -2
  348. package/docs/reference/env-and-secrets.md +126 -0
  349. package/docs/reference/memory.md +124 -0
  350. package/docs/reference/refs.md +156 -0
  351. package/docs/reference/registry.md +489 -0
  352. package/docs/reference/supported-formats.md +3 -4
  353. package/docs/reference/tasks.md +12 -19
  354. package/docs/reference/website-sources.md +141 -0
  355. package/docs/reference/workflow-schema.md +89 -317
  356. package/docs/reference/workflows.md +20 -48
  357. package/package.json +23 -16
  358. package/schemas/akm-config.json +2 -243
  359. package/schemas/akm-task.json +2 -3
  360. package/schemas/akm-workflow.json +47 -84
  361. package/dist/assets/improve-strategies/catchup.json +0 -41
  362. package/dist/assets/improve-strategies/proactive-maintenance.json +0 -24
  363. package/dist/assets/improve-strategies/quick.json +0 -17
  364. package/dist/assets/improve-strategies/reflect-distill.json +0 -29
  365. package/dist/assets/improve-strategies/thorough.json +0 -49
  366. package/dist/assets/prompts/retrieval-relevance-judge.md +0 -6
  367. package/dist/assets/tasks/improve/akm-improve-catchup.yml +0 -6
  368. package/dist/assets/tasks/improve/akm-improve-frequent.yml +0 -4
  369. package/dist/assets/tasks/improve/akm-improve-nightly.yml +0 -4
  370. package/dist/cli/retired-commands.js +0 -118
  371. package/dist/commands/improve/retrieval-gate.js +0 -132
  372. package/dist/commands/tasks/validate.js +0 -176
  373. package/dist/core/config/legacy-source-shape-shim.js +0 -117
  374. package/dist/indexer/feedback/utility-policy.js +0 -75
  375. package/dist/integrations/harnesses/ids.js +0 -28
  376. package/dist/tasks/source/task-source-v3-frozen.js +0 -424
  377. package/dist/tasks/source/task-to-v4.js +0 -863
  378. package/dist/workflows/exec/worktree.js +0 -372
  379. package/dist/workflows/freeze/child-output-references.js +0 -83
  380. package/dist/workflows/freeze/identity.js +0 -22
  381. package/dist/workflows/freeze/targets/script.js +0 -50
  382. package/dist/workflows/freeze/targets/task.js +0 -124
  383. package/dist/workflows/github-yaml.js +0 -506
  384. package/dist/workflows/runtime/run-outputs.js +0 -80
package/STABILITY.md CHANGED
@@ -12,6 +12,47 @@ out in the CHANGELOG with a migration note. The 0.10.x series returns to bug
12
12
  fixes and tuning, and aims to restore the normal discipline of breaking
13
13
  changes only in major and minor releases.
14
14
 
15
+ **Version floor (0.10, #1091).** 0.10 reads what 0.9.15 and later wrote: config,
16
+ `state.db`, task sources, frozen workflow plans and scheduler rows. It does not
17
+ convert anything older. An install on an earlier release runs `akm migrate
18
+ apply` under akm 0.9.x first, then upgrades; a 0.10 reader that meets an older
19
+ shape refuses with one message saying so. See
20
+ [`docs/architecture/persisted-data-compat.md`](docs/architecture/persisted-data-compat.md).
21
+
22
+ **CLI spellings merged in 0.10 (#1091).** Each of these is an unknown flag or
23
+ command (exit 2) from 0.10, with no alias and no deprecation period; the new
24
+ spelling is in the CHANGELOG entry and the CLI reference.
25
+
26
+ | Gone | Use |
27
+ | --- | --- |
28
+ | `akm help agents` | `akm hints` (`--detail brief` for the short guide) |
29
+ | `--shape agent` | `--detail agent` |
30
+ | `--shape summary` | `--detail brief` (it only had a projection on `akm show`) |
31
+ | `--target` on `import`, `env create`, `env remove`, `secret set`, `proposal accept`, `proposal diff`, `proposal revert` | `--bundle` |
32
+ | `akm task validate <path>` | `akm lint --type tasks` |
33
+ | `akm config path --all` | `akm info` |
34
+ | `--run` / `--since` on `akm improve` | `akm improve report --run` / `--since` |
35
+
36
+ **Version numbers (0.10 onward, #1089).** A 0.10 release is numbered
37
+ `0.10.YYMMNN`: `YY` the UTC year, `MM` the month (`01` to `12`) and `NN` the
38
+ release within that month (`01` to `99`), each two digits. Every release takes
39
+ the next `NN`, whatever its stage: the first release of 2026-10 is `0.10.261001`
40
+ (or `0.10.261001-alpha`), the next `0.10.261002`. A prerelease carries its stage
41
+ only: `-alpha`, `-beta` or `-rc`, with no `.N`. A build is not promoted through
42
+ stages under one number: each stage is its own release. Prereleases publish to
43
+ the npm `next` tag and stable releases to `latest`; `akm upgrade --next` follows
44
+ `next`. Versions sort by month and then `NN`, so semver ranges and `akm upgrade`
45
+ order them correctly across months and years. The patch number no longer says
46
+ how big a change is: read the CHANGELOG, which still marks breaking changes. The
47
+ 0.9 line keeps `0.9.N`, and `0.11` restarts on the same scheme.
48
+
49
+ The 0.10 daily alphas (`0.10.26101001-alpha` through `0.10.26101202-alpha`) used
50
+ an 8-digit patch, `YYMMDDNN`. Semver compares the patch numerically, so every
51
+ `0.10.YYMMNN` sorts below them and `akm upgrade` does not offer it from a daily
52
+ alpha: install the first monthly release explicitly once (for example
53
+ `npm install -g akm-cli@0.10.261001-beta`). This is a known, accepted break and
54
+ `tests/semver-order.test.ts` pins it.
55
+
15
56
  This document classifies **every** user-facing surface by stability so you can
16
57
  decide which parts of `akm` are safe to script against today and which to
17
58
  treat as still-evolving. If a surface is not listed here, that is a bug —
@@ -87,6 +128,8 @@ enumeration of the whole `proposal` noun group.
87
128
  | `akm models` | Evolving | `list` and `copy-defaults` for model intent aliases. |
88
129
  | `akm lint` | Evolving | |
89
130
  | `akm improve` | Evolving | Review-first by default; mutating lanes require `experimental.improveAutonomy` — see below. |
131
+ | `akm improve report` | Evolving | Subcommand since 0.10 (was a magic `scope` value); owns `--run` and `--since`. |
132
+ | `akm improve judge` | Evolving | Subcommand since 0.10 (was a magic `scope` value); reads one revision as JSON on stdin and writes nothing. |
90
133
  | `akm proposal list` | Stable | See reconciliation note above. |
91
134
  | `akm proposal show` | Evolving | |
92
135
  | `akm proposal diff` | Evolving | |
@@ -95,10 +138,9 @@ enumeration of the whole `proposal` noun group.
95
138
  | `akm proposal reopen` | Evolving | New in 0.9.19; undoes a rejection. |
96
139
  | `akm proposal revert` | Evolving | |
97
140
  | `akm proposal drain` | Evolving | |
98
- | `akm proposal extract` | Experimental | Former top-level `akm extract`. Session extraction quality is still being measured (0.10, #1094). |
141
+ | `akm proposal extract` | Evolving | Former top-level `akm extract`. Promoted from Experimental in 0.10 (#1133): the extract eval measures it. Evolving, not Stable, because 0.10 is still settling the improve defaults. |
99
142
  | `akm proposal new` | Evolving | Former top-level `akm propose`. |
100
143
  | `akm help` | Stable | |
101
- | `akm help agents` | Stable | |
102
144
  | `akm help migrate` | Stable | Only renders release notes. |
103
145
  | `akm hints` | Stable | Format-exempt agent guide; `--detail brief` selects the compact version. |
104
146
  | `akm completions` | Stable | Format-exempt (emits shell script source). |
@@ -117,8 +159,6 @@ enumeration of the whole `proposal` noun group.
117
159
  | `akm task sync` | Evolving | |
118
160
  | `akm task doctor` | Evolving | |
119
161
  | `akm task explain` | Evolving | New in 0.9.2; secret-shaped values in provenance output are redacted on a best-effort heuristic basis (not a guarantee). |
120
- | `akm task validate` | Evolving | New in 0.9.11; read-only, and the only `task` subcommand that takes a bare filesystem path instead of a ref — the file need not belong to any configured bundle. |
121
- | `akm task list` | Evolving | New in 0.9.15 (#951); a pure delegating alias for `akm search --type task` — same envelope, no separate implementation. |
122
162
 
123
163
  ## Stable
124
164
 
@@ -157,7 +197,7 @@ enumeration of the whole `proposal` noun group.
157
197
  - **Read commands** — `akm search`, `akm show`, `akm bundle list`, `akm curate`,
158
198
  `akm info`, `akm config get`, `akm config list`, `akm config path`,
159
199
  `akm env list`, `akm secret list`, `akm proposal list` (list filters),
160
- `akm help`, `akm help agents`, `akm hints`, `akm completions`.
200
+ `akm help`, `akm hints`, `akm completions`.
161
201
  - **Write commands core surface** — `akm bundle add`, `akm bundle update`,
162
202
  `akm bundle remove`, `akm clone`, `akm import`, `akm sync`, `akm index`,
163
203
  `akm bundle create`, `akm setup`, `akm remember`, `akm feedback`,
@@ -195,12 +235,11 @@ enumeration of the whole `proposal` noun group.
195
235
  fetch**: a registered renderer fires on the shape of the result (`akm health
196
236
  --report` carries the report dataset in the envelope, so the same data is
197
237
  available as JSON), never on the format alone.
198
- `--detail` is verbosity only (`brief|normal|full`);
199
- `--shape` (`human|agent|summary`) is the output-projection axis (see
200
- Experimental). A small set of commands is **format-exempt** because their
238
+ `--detail` is `brief|normal|full` (verbosity) or `agent` (the projection of
239
+ `search`, `curate` and `show`; see Experimental). A small set of commands is **format-exempt** because their
201
240
  output is not a result envelope at all: `completions` (shell script source),
202
241
  child-process passthrough in `env run` / `secret run`, a bare-path payload
203
- from `env path`, and document payloads from `help` (bare, `help agents`, and
242
+ from `env path`, and document payloads from `help` (bare and
204
243
  `help migrate`). The set is declared in
205
244
  `src/output/format-exempt.ts`, and
206
245
  passing `--format` to one of them warns rather than silently doing something
@@ -250,6 +289,7 @@ remain available across minor releases, but flag names, prompts, and
250
289
  proposal-queue shape may shift. Breaking changes will be flagged in the
251
290
  CHANGELOG with a migration note.
252
291
 
292
+ - **Programmatic API** — `akm-cli/api` (`curate()`, for in-process recall by the akm plugins; see [`docs/reference/api.md`](docs/reference/api.md)). The export list only grows and `curate()`'s parameters and result keep their documented contract; the text it returns is `akm curate`'s agent-shaped output and changes with it. Everything else in the package remains CLI-only.
253
293
  - **Improvement loop** — `akm improve` and the proposal noun group
254
294
  `akm proposal {extract,new,list,show,diff,accept,reject,reopen,revert,drain}`
255
295
  (`extract` and `new` are the former top-level `akm extract`/`akm propose`,
@@ -259,14 +299,15 @@ CHANGELOG with a migration note.
259
299
  default and is **review-first**: the lanes that mutate assets without review
260
300
  require `experimental.improveAutonomy` — see
261
301
  [`akm improve` autonomy](#akm-improve-autonomy--opt-in-in-090).
262
- `--auto-accept` was removed in 0.9.0. It is now accepted-and-warned rather
263
- than silently absorbed: passing it prints a deprecation warning naming the
264
- replacement, and the space-separated form (`--auto-accept 90`) no longer
265
- poisons the asset-type positional — its value is discarded with a second
266
- warning instead of silently reducing the run to a zero-match no-op. It
267
- becomes a hard error in 0.10. The replacement is
302
+ `--auto-accept` was removed in 0.9.0 and is an unknown flag (a usage error,
303
+ exit 2) since 0.10. The replacement is
268
304
  `akm improve && akm proposal drain --promote --yes`, or a `triage` block
269
305
  with `applyMode: "promote"` in your strategy.
306
+ **Session extraction** (`akm proposal extract` and the improve `extract`
307
+ process) is Evolving as of 0.10 (#1133): the extract eval (insights saved,
308
+ routine sessions left empty, planted instructions refused) is its gate. It
309
+ is Evolving, not Stable, because 0.10 is still settling the improve
310
+ defaults; what it extracts and its output may still be tuned.
270
311
  - **Tasks** — `akm task` subcommand surface (`add | run | sync | doctor |
271
312
  history | explain | validate`; no alias, no
272
313
  `list`/`remove`/`init`/`enable`/`disable`); task source v4 YAML (typed
@@ -282,14 +323,7 @@ CHANGELOG with a migration note.
282
323
  construction** (the excluded data never reaches the command). `akm task
283
324
  explain` instead **redacts** secret-shaped input values on a best-effort
284
325
  heuristic basis — a value that doesn't match the heuristic can still
285
- print unredacted. `akm task validate <path>` (new in 0.9.11) is the same
286
- kind of zero-write introspection as `explain`, but takes a bare filesystem
287
- path rather than a bundle-qualified ref — it reports whether that ONE file
288
- would parse cleanly (`valid`), need `akm migrate apply` first (`blocked`:
289
- task v2/v3, or a retired `schedule[].enabled`),
290
- fail schema validation (`invalid`), or isn't a task source at all
291
- (`not-a-task`) — exactly the diagnostic `akm task sync` would produce for
292
- it, before the file is ever wired into a bundle or the scheduler.
326
+ print unredacted.
293
327
  - **Workflow plan** — `akm workflow plan <ref>`, new in 0.9.2: zero-write
294
328
  compile+freeze introspection (the canonical step graph, task/child
295
329
  expansion, input bindings, and lowering notices for a workflow, without
@@ -300,7 +334,7 @@ CHANGELOG with a migration note.
300
334
  both removed; `log` is now a leaf command — the former `list` surface).
301
335
  - **Bundles & the workspace model** — installed sources are *bundles*; each is
302
336
  recognized by a built-in *adapter* (native Agent Skills, Claude and OpenCode
303
- commands/agents, knowledge, YAML workflows, tasks, env/secret files, scripts,
337
+ commands/agents, knowledge, workflows, tasks, env/secret files, scripts,
304
338
  OKF and LLM-wiki knowledge bases). Config is keyed by `bundles` and
305
339
  `defaultBundle`. The adapter set, bundle-recognition rules, and the
306
340
  `bundles` config shape may still shift; the `okf`, `llm-wiki` and
@@ -324,9 +358,14 @@ CHANGELOG with a migration note.
324
358
  `claude`, `opencode-sdk` (the primary OpenCode interface), `codex`, and the
325
359
  `opencode` CLI path, `copilot`, `pi`, `gemini`, `aider`, `amazonq`,
326
360
  `openhands`. Every harness is Evolving: the harness implementation is being
327
- reworked so harnesses are easy to add, remove and update (0.10), and the
328
- `opencode` CLI dispatch path is a deprecation candidate once `opencode-sdk`
329
- covers it. The set will grow.
361
+ reworked so harnesses are easy to add, remove and update (0.10). The set will
362
+ grow.
363
+ **Deprecated:** the `opencode` CLI dispatch path (an agent engine with
364
+ `platform: "opencode"`, which runs `opencode run` per call). It still works on
365
+ OpenCode 1 and 2 throughout 0.10; use an `opencode-sdk` engine instead, which
366
+ covers it, including a default agent (#1098). It may be removed in 0.11 or
367
+ later. The rest of the OpenCode integration (session-log import, config
368
+ import) is not deprecated.
330
369
  - **Model aliases** — `akm models list|copy-defaults` and the intent-alias
331
370
  defaults they expose.
332
371
  - **Proposal queue** — quality classifications (`accepted`, `pending`,
@@ -357,16 +396,19 @@ for scripted use.
357
396
  workflow engine are Experimental from 0.9.28 and throughout 0.10. The 0.10
358
397
  series stabilizes the feature and trims what is not useful, then either
359
398
  promotes it out of Experimental or removes it if stabilization does not
360
- produce a quality feature.
399
+ produce a quality feature. **Child workflows** (`unit: { workflow: … }`, a
400
+ step that runs another workflow and returns its last step's output) are the
401
+ least settled part and are kept only in that simple form; `akm workflow list
402
+ --children` goes with them.
361
403
  - **`akm metrics`** — new in 0.9.28. What it reports, its JSON shape and the
362
404
  `--format html` dashboard may change in any release; do not script against
363
405
  them.
364
406
  - **`lesson` asset type** — schema (`when_to_use`, `description`) is
365
407
  stable, but lesson-distillation triggers and ranking are tuning targets.
366
- - **`--shape agent` and `--shape summary`** — the output-projection axis
367
- (`--shape human|agent|summary`). `summary` is implemented only on
368
- `akm show`; `agent` is implemented on `search`, `show`, and `curate`.
369
- Coverage will expand. `--detail` is verbosity only (`brief|normal|full`).
408
+ - **`--detail agent`** — the agent projection, implemented on `search`, `show`,
409
+ and `curate` (other commands ignore it). Coverage will expand. It replaces
410
+ `--shape agent`; `--shape` (and `--shape summary`, which only `show` had) is
411
+ gone in 0.10 and is an unknown flag.
370
412
  - **Protected env & secret values** — `env` (a whole `.env` group; key names
371
413
  are surfaced for discoverability, values never are) and `secret` (a single
372
414
  sensitive value). Values are never written to stdout, the index, or
@@ -378,14 +420,11 @@ for scripted use.
378
420
  contradiction edges, and the consolidate journal are observable but
379
421
  the algorithm that writes them is tuning across patch releases.
380
422
  - **Improve built-in strategies and lanes** — the built-in strategies other
381
- than `default` and `consolidate` (`quick`, `reflect-distill`, `thorough`,
382
- `catchup`) and the proactive-maintenance and high-salience lanes. 0.10
383
- measures each and keeps, folds or removes it (#1094).
384
- - **Session extraction** — `akm proposal extract` and the `extract` process:
385
- what it extracts, its quality gates and its output may change while 0.10
386
- measures it (#1094).
423
+ than `default` and `consolidate` and the proactive-maintenance lane. 0.10 measures each and keeps, folds or removes it
424
+ (#1094). `quick`, `reflect-distill`, `thorough` and `catchup` were removed
425
+ in 0.10 (#1130), as were `proactive-maintenance` and the high-salience lane (#1129); a user-defined strategy of the same name keeps working.
387
426
  - **Improve tuning config** — `improve.strategies.*.processes.*` (per-process
388
- engines, limits, gates, and the anti-collapse / CLS / fidelity knobs) and
427
+ engines, limits, gates, and the CLS knobs) and
389
428
  the `index.*` per-pass config. The 0.9.x series is explicitly still settling
390
429
  the design of the improve processes, so **keys in these two families may be
391
430
  added, renamed, or dropped in any 0.9.x or 0.10.x release**. The `akm
@@ -401,7 +440,8 @@ mutate assets *without* review require an explicit opt-in:
401
440
  akm config set experimental.improveAutonomy true
402
441
  ```
403
442
 
404
- Without it, these three lanes are downgraded, and each downgrade is **reported,
443
+ Without it, these three lanes are downgraded (the triage lane only when its
444
+ judgment tier is on), and each downgrade is **reported,
405
445
  not silent**: it warns on stderr naming the lane and the key, appends an
406
446
  `improve_skipped` event with `reason: "autonomy_gated"`, is counted in
407
447
  `akm health`'s improve skip-reason summary, and is listed by `akm task doctor`
@@ -414,7 +454,13 @@ review-first config correctly shows `queue`.
414
454
  | --- | --- | --- |
415
455
  | `memoryInference` | Writes `.derived.md` children and rewrites parent frontmatter | disabled |
416
456
  | memory cleanup | Belief-state frontmatter rewrites, archive moves | analyzed but not applied |
417
- | `triage` `applyMode: "promote"` | Auto-accepts queued proposals into the bundle | downgraded to `queue` — triage still runs, it just does not auto-accept |
457
+ | `triage` `applyMode: "promote"` **with judgment on** | The judgment tier auto-accepts consolidate promotions into the bundle | downgraded to `queue` — triage still runs, it just does not auto-accept |
458
+
459
+ A deterministic-only `promote` (triage with judgment off) is **not** a gated
460
+ lane (#1143): the `default` strategy runs it without the opt-in, bounded by
461
+ `maxAcceptsPerRun` (200), through the same deterministic gates as
462
+ `akm proposal drain --promote`. Only a promote that turns the judgment tier on
463
+ needs `experimental.improveAutonomy`.
418
464
 
419
465
  Consolidation remains enabled with autonomy off: both its passes (promotion,
420
466
  and the pair pass's duplicate/subsumed/supersedes judging) only ever emit a
@@ -510,7 +556,7 @@ Shipped from that record: **D1** (`#fragment` section selection),
510
556
  gone — `#fragment` is the only section selector), **D4** (conceptId /
511
557
  `bundle//` prefix browse), **D5** (`akm bundle` removed), **D6** (open `type`
512
558
  set at runtime), **D7** (all six `--format` values everywhere), **D8** (the
513
- `experimental.improveAutonomy` gate), **D9** (`--auto-accept` warn-and-ignore),
559
+ `experimental.improveAutonomy` gate), **D9** (`--auto-accept` removed, a hard error since 0.10),
514
560
  and partially **D10** (an `akm-migrate` binary now exists, though the code still
515
561
  lives in this repo). **D3** shipped too, in the end: `akm mv` was removed in
516
562
  0.9.0 (see the Renames bullet above), with `scripts/rekey-asset-ref.ts` as the
@@ -518,21 +564,17 @@ Internal replacement for the one capability nothing else covered.
518
564
 
519
565
  - **0.10 — `config set`/`config unset` may drop the config dump** in favor of
520
566
  a compact `{ok, shape, key}` result; `akm config list` remains the full read.
521
- - **0.10 — migration extraction.** The migration machinery leaves the CLI for
522
- a separately published `akm-migrate` package (see Internal above).
523
- - **0.10 — `--auto-accept` hard error.** It is currently accepted-and-warned;
524
- see the Improvement loop entry.
525
- - **0.10 — `BundleAdapter.placeNew()` wiring.** The interface declares
526
- `placeNew()` as an optional capability method, and 9 of the 11 built-in
527
- adapters already implement it (all but `okf` and `website-snapshot`;
528
- `claude` and `opencode` inherit theirs from the shared tool-dir factory),
529
- but nothing in the write path calls it —
530
- writes still resolve through AKM's native flat type→directory table.
531
- Placement for every existing bundle is already correct today; this is a
532
- deliberately sequenced routing change, not unfinished behavior. See
533
- [D12](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/0.9.0-decisions.md#d12--bundleadapterplacenew-stays-unwired-until-010)
534
- for why it is scoped out of 0.9.0. Nothing user-visible changes in 0.10 for
535
- this alone.
567
+ - **0.10 — migration extraction.** The migration machinery lives in its own
568
+ `akm-migrate` executable, which ships inside the `akm-cli` package next to
569
+ `akm` (no separate npm package). The task-source migrator (`task-to-v4.ts`,
570
+ `task-source-v3-frozen.ts`) lives with it under `scripts/akm-migrate/migrate/`,
571
+ out of `src/`.
572
+ - **0.11 or later — the `opencode` CLI dispatch path may be removed.**
573
+ Deprecated in 0.10 (see Agent dispatch under Evolving); `opencode-sdk`
574
+ engines replace it.
575
+ - **0.10 — `BundleAdapter.placeNew()` is removed.** Nothing called it; writes use AKM's fixed type→directory table.
576
+ Writable bundles in a non-akm layout would need per-adapter placement back
577
+ ([#1163](https://github.com/itlackey/akm/issues/1163)).
536
578
  - **1.0 contract freeze** — the `[bundle//]conceptId[#fragment]` ref grammar,
537
579
  the supported source model, search behavior, and write-target rules are
538
580
  frozen at 1.0. The SDK and in-process plugin story ship on top of that
@@ -0,0 +1,20 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+
5
+ // Node entry for `akm-cli/api` (the package `exports` map points the default
6
+ // condition here; the `bun` condition points straight at `api.js`).
7
+ //
8
+ // `api.js` reaches modules that embed `.md`/`.xml` assets through
9
+ // `with { type: "text" }` imports, which Node cannot load without the
10
+ // text-import hook. Those imports are static and hoisted, so the hook must be
11
+ // registered before `api.js` is evaluated: register it, then import `api.js`
12
+ // dynamically. Same reason as `cli-node.mjs`.
13
+
14
+ import { register } from "node:module";
15
+
16
+ register("./text-import-hook.mjs", import.meta.url);
17
+
18
+ const { curate } = await import("./api.js");
19
+
20
+ export { curate };
package/dist/api.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+
5
+ // Hand-written declarations for `akm-cli/api` (the build emits no .d.ts).
6
+ // tests/contracts/api-surface.test.ts keeps this file and src/api.ts in step.
7
+
8
+ export interface CurateOptions {
9
+ /** Maximum number of curated results (positive integer; the CLI default is 4). */
10
+ limit?: number;
11
+ /** Asset type filter, same as `--type`. */
12
+ type?: string;
13
+ /** Output format, same as `--format`. Default `"json"`, as in the CLI. */
14
+ format?: "text" | "json";
15
+ }
16
+
17
+ /**
18
+ * Returns exactly the stdout text of
19
+ * `akm --detail agent -q curate <query> [--limit N] [--type T] --format <format>`,
20
+ * including its trailing newline. Rejects with the error the CLI would fail
21
+ * with: its message, and its error code on the `code` property.
22
+ */
23
+ export function curate(query: string, options?: CurateOptions): Promise<string>;
package/dist/api.js ADDED
@@ -0,0 +1,45 @@
1
+ // This Source Code Form is subject to the terms of the Mozilla Public
2
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ // file, You can obtain one at https://mozilla.org/MPL/2.0/.
4
+ /**
5
+ * `akm-cli/api` — the one supported programmatic entry point. Everything else
6
+ * in this package is CLI-only. See docs/reference/api.md for the contract.
7
+ *
8
+ * Each export runs the same code path as its CLI command and computes the
9
+ * document the CLI would print, in-process: no child process, no write to
10
+ * stdout/stderr, no `process.chdir`, no change to the host's `process.env`,
11
+ * and no process-level output-mode, quiet or verbose state left changed.
12
+ */
13
+ import { renderOutput } from "./cli/shared.js";
14
+ import { runCurate } from "./commands/read/search-cli.js";
15
+ import { loadConfig } from "./core/config/config.js";
16
+ import { UsageError } from "./core/errors.js";
17
+ import { withQuiet } from "./core/warn.js";
18
+ import { installLlmUsagePersistenceIfAbsent } from "./llm/usage-persist.js";
19
+ import { resolveOutputMode } from "./output/context.js";
20
+ import { stdoutText } from "./output/stdout.js";
21
+ /**
22
+ * Returns exactly the stdout text of
23
+ * `akm --detail agent -q curate <query> [--limit N] [--type T] --format <format>`
24
+ * including its trailing newline. Rejects with the error the CLI
25
+ * would fail with: its message, and its error code on the `code` property.
26
+ */
27
+ export async function curate(query, options = {}) {
28
+ const format = options.format ?? "json";
29
+ if (format !== "text" && format !== "json") {
30
+ throw new UsageError(`Invalid value for --format: ${format}. Expected one of: json|text`, "INVALID_FORMAT_VALUE");
31
+ }
32
+ return withQuiet(async () => {
33
+ // Same startup order as the CLI: config first (an invalid config fails
34
+ // the call before anything runs), then the output mode from argv + config.
35
+ const mode = resolveOutputMode(["--detail", "agent", "--format", format], loadConfig().output ?? {});
36
+ const disposeLlmUsageSink = installLlmUsagePersistenceIfAbsent();
37
+ try {
38
+ const curated = await runCurate({ query, type: options.type, limit: options.limit === undefined ? undefined : String(options.limit) }, mode);
39
+ return stdoutText(renderOutput("curate", curated, { ...mode, format }));
40
+ }
41
+ finally {
42
+ disposeLlmUsageSink();
43
+ }
44
+ });
45
+ }
@@ -23,8 +23,7 @@ akm search "team-catalog//" # List every item in one bundle
23
23
  | `--from` | `local`, `registry`, `all`, or a configured bundle name | `local` |
24
24
  | `--limit` | number | `20` |
25
25
  | `--format` | `json`, `jsonl`, `text`, `yaml`, `md`, `html` | `json` |
26
- | `--detail` | `brief`, `normal`, `full` | `brief` |
27
- | `--shape` | `human`, `agent`, `summary` (`summary` only on `show`) | `human` |
26
+ | `--detail` | `brief`, `normal`, `full`, `agent` (`agent`: search, curate and show only) | `brief` |
28
27
 
29
28
  Ref-prefix queries (a conceptId prefix ending in `/`, optionally bundle-qualified)
30
29
  return a deterministic listing, not a relevance ranking. Drop the trailing slash
@@ -90,13 +89,13 @@ akm import ./doc.md --xref knowledge/auth-flow # Merge provenance xrefs into the
90
89
  akm import ./new.md --supersedes knowledge/old # Import a correction AND demote the doc it replaces
91
90
  akm import - --name scratch-notes < notes.md # Import stdin as a knowledge doc
92
91
  akm import https://example.com/docs/auth # Fetch one URL and import it as knowledge
93
- akm import ./doc.md --target my-other-bundle # Route import to a named writable bundle source
92
+ akm import ./doc.md --bundle my-other-bundle # Route import to a named writable bundle source
94
93
  akm workflow create ship-release # Create a workflow asset in the bundle
95
- akm lint --type workflows # Parse and compile every .md/.yml workflow source; list every error
94
+ akm lint --type workflows # Parse and compile every workflow source; list every error
96
95
  akm workflow run workflows/ship-release # Start or resume and execute the workflow
97
96
  akm feedback skills/code-review --positive # Record that an asset helped (ranks it higher; no rewrite)
98
97
  akm feedback agents/reviewer --negative --reason "says to run jest; the suite runs on vitest" # Content wrong or stale: lowers its ranking; improve may repair its frontmatter
99
- akm feedback knowledge/opencode-server --negative --reason "the default port is 4096, not 8000" --replace "port 8000" --with "port 4096" --source "https://opencode.ai/docs/server/" # Queue an exact fix
98
+ akm feedback knowledge/opencode-server --negative --reason "the default port is 4096, not 8000" --replace "port 8000" --with "port 4096" --source "https://opencode.ai/docs/server/" # Apply an exact fix
100
99
  akm feedback memories/deployment-notes --positive # Works for memories too
101
100
  akm feedback env/prod --positive # Records env feedback without surfacing values
102
101
  ```
@@ -111,7 +110,7 @@ its description, title or `when_to_use` from your reason. A note that simply did
111
110
  not fit your task is not negative feedback: record nothing for it. Improve does
112
111
  not rewrite an asset's text: once you have verified the correct fact, attach the
113
112
  exact fix with `--replace "<exact current text>" --with "<corrected text>"
114
- --source "<URL, command or file>"`, which akm checks and queues as a proposal.
113
+ --source "<URL, command or file>"`, which akm checks and applies at once.
115
114
  A note that is outdated can be marked with `--outdated`, or
116
115
  `--superseded-by <ref>` when another note replaces it.
117
116
  `--positive` records that an asset helped (it raises its ranking) and does not
@@ -176,9 +175,8 @@ akm secret run secrets/deploy-token GITHUB_TOKEN -- gh release create v1.0.0 #
176
175
 
177
176
  ## Workflows
178
177
 
179
- Workflows live under `<bundle>/workflows/` as peer `.md` and `.yml` sources.
180
- Both compile to the same source IR; see `docs/reference/workflow-schema.md` for
181
- the bounded GitHub-shaped YAML subset.
178
+ Workflows live under `<bundle>/workflows/` as `.md` sources; see
179
+ `docs/reference/workflow-schema.md` for the frontmatter and body syntax.
182
180
 
183
181
  Ref-based workflow commands are scoped to the current project/worktree/directory,
184
182
  so one active run does not block unrelated directories from starting the same
@@ -235,7 +233,6 @@ rename instead of starting fresh, run `bun scripts/rekey-asset-ref.ts <old-ref>
235
233
  ## Sync
236
234
 
237
235
  Commit local changes in a git-backed bundle. Behaviour adapts automatically.
238
- (`akm save` was the pre-0.8 spelling; it was removed in 0.9.0 — use `akm sync`.)
239
236
 
240
237
  - **No `.git` directory** — no-op (silent skip)
241
238
  - **Git repo, no remote** — stage and commit only (the default bundle always falls here)
@@ -255,15 +252,13 @@ akm sync my-skills -m "Update patterns" # Sync named bundle with message
255
252
  The `--sync` / `--no-sync` and `--push` / `--no-push` flags control this:
256
253
 
257
254
  ```sh
258
- akm improve # auto-sync per strategy default (most strategies: on; proactive-maintenance/reflect-distill: off)
255
+ akm improve # auto-sync per strategy default (both strategies: on)
259
256
  akm improve --no-sync # skip the end-of-run commit
260
257
  akm improve --no-push # commit but skip push for this run
261
258
  akm improve --sync # force sync even on strategies that disable it
262
259
  ```
263
260
 
264
- Strategy sync defaults: `catchup`, `consolidate`, `default`, `quick`, and
265
- `thorough` auto-commit + push; `proactive-maintenance` and `reflect-distill`
266
- skip sync entirely. Override with `--sync` / `--no-sync` flags.
261
+ Strategy sync defaults: `consolidate` and `default` auto-commit + push. Override with `--sync` / `--no-sync` flags.
267
262
 
268
263
  The `--writable` flag on `akm bundle add` opts a remote git bundle into push-on-sync:
269
264
 
@@ -313,7 +308,6 @@ akm config list # Show current config
313
308
  akm config get <key> # Read a value
314
309
  akm config set <key> <value> # Set a value
315
310
  akm config unset <key> # Remove a key
316
- akm config path --all # Show all config paths
317
311
  ```
318
312
 
319
313
  ## Other Commands
@@ -331,11 +325,10 @@ akm lint --fix # Auto-fix Tier 1 issues
331
325
  akm lint --fail-on-flagged # Exit non-zero when summary.flagged > 0 (CI-friendly)
332
326
  akm upgrade # Upgrade akm using its install method, then update installed harness plugins
333
327
  akm upgrade --check # Report pending CLI and plugin updates, changing nothing
334
- akm upgrade --next # Follow prereleases (@next); OpenCode needs "akm-opencode@next" in its plugin list
328
+ akm upgrade --next # Follow prereleases (@next); OpenCode needs "akm-opencode@next" (or "akm-opencode-v2@next" on OpenCode 2) in its plugin list
335
329
  akm help migrate 0.6.0 # Print migration notes for a release (or: latest)
336
330
  akm help bundle # Print options and subcommands for one command
337
- akm help agents --full # Print this reference
338
- akm hints # Print this complete agent guide
331
+ akm hints # Print this complete agent guide (--detail brief for the short one)
339
332
  akm completions # Print bash completion script
340
333
  akm completions --install # Install completions
341
334
  ```
@@ -354,7 +347,7 @@ akm proposal show <id> # Render the proposal bo
354
347
  akm proposal diff <ref-or-id> # Diff by ref, UUID, or 8-char prefix
355
348
  akm proposal diff skills/akm-dream # Diff by asset ref
356
349
  akm proposal accept 7c115132 # Accept by UUID prefix
357
- akm proposal accept <id> --target team-bundle # Accept to a named writable bundle source
350
+ akm proposal accept <id> --bundle team-bundle # Accept to a named writable bundle source
358
351
  akm proposal reject skills/my-skill --reason "not ready" # Reject by asset ref
359
352
  akm proposal reject <id> --reason "..." # Archive with a reason
360
353
  akm proposal reopen <id> --reason "..." # Undo a rejection: back to pending (refused if the target changed)
@@ -364,11 +357,6 @@ akm proposal extract --auto # Mine native session fi
364
357
  akm proposal extract --type claude # Restrict extraction to one harness
365
358
  ```
366
359
 
367
- The flat verbs `akm proposals` / `akm show proposal` / `akm accept` /
368
- `akm reject` / `akm diff` / `akm revert` were removed in 0.9.0 — use the
369
- `akm proposal <verb>` forms above. `akm extract` and `akm propose` moved
370
- here as `proposal extract` / `proposal new`.
371
-
372
360
  ## Scheduled Tasks
373
361
 
374
362
  Tasks are pure-YAML assets at `<bundle>/tasks/<id>.yml`, bound to the OS
@@ -387,7 +375,7 @@ akm task doctor # Scheduler binding + runtime eli
387
375
  akm task history # Recent run rows (status, timing)
388
376
  akm task run <id> # Run one task immediately (works when disabled)
389
377
  akm task explain <ref> # Read-only: declared inputs, target, schedule — spawns nothing
390
- akm search --type task # Enumerate task assets (there is no `task list`)
378
+ akm search --type task # Enumerate task assets
391
379
  ```
392
380
 
393
381
  Task files use task source v4 (`version: 4`). There is no `akm:` options bag
@@ -428,7 +416,7 @@ akm log --run <run-id> # Events for one workflow-engine
428
416
 
429
417
  ## Output Control
430
418
 
431
- Result-envelope commands accept `--format`, `--detail`, and `--shape` flags:
419
+ Result-envelope commands accept `--format` and `--detail` flags:
432
420
 
433
421
  - `--format json` (default) — structured JSON
434
422
  - `--format jsonl` — one JSON object per line (streaming-friendly)
@@ -439,9 +427,7 @@ Result-envelope commands accept `--format`, `--detail`, and `--shape` flags:
439
427
  - `--detail brief` (default) — compact output
440
428
  - `--detail normal` — adds tags, refs, origins
441
429
  - `--detail full` — includes scores, paths, timing, debug info
442
- - `--shape human` (default) — standard projection
443
- - `--shape agent` — agent-optimized output: strips non-actionable fields
444
- - `--shape summary` — metadata only (no content/template/prompt), under 200 tokens; only `akm show` has a dedicated summary projection — elsewhere it falls back to `agent` with a warning
430
+ - `--detail agent` — agent-optimized output on `search`, `curate` and `show`: strips non-actionable fields (other commands ignore it)
445
431
 
446
432
  Run `akm help <command>` or `akm <command> -h` for per-command help. Run
447
433
  `akm --help` for the sectioned command overview.
@@ -35,13 +35,13 @@ akm remember "note" --bundle my-bundle # Route write to a named writable
35
35
  akm remember "note" --xref knowledge/auth-flow # Cite provenance in frontmatter xrefs (repeatable)
36
36
  akm remember "fix" --supersedes memories/old-note # Write a correction AND demote the superseded asset
37
37
  akm import ./notes/release-checklist.md # Import a knowledge doc into your bundle
38
- akm import ./doc.md --target my-bundle # Route import to a named writable bundle source
38
+ akm import ./doc.md --bundle my-bundle # Route import to a named writable bundle source
39
39
  akm proposal diff skills/akm-dream # Diff proposal by ref, UUID, or 8-char prefix
40
40
  akm proposal accept 7c115132 # Accept by UUID prefix
41
41
  akm proposal reject skills/my-skill --reason "..." # Reject by ref
42
42
  akm feedback <ref> --positive # Record that an asset helped (ranks it higher; no rewrite)
43
43
  akm feedback <ref> --negative --reason "..." # Content wrong or stale: lowers its ranking; improve may repair its frontmatter
44
- akm feedback <ref> --negative --reason "..." --replace "<exact text>" --with "<fix>" --source "<url|cmd|file>" # Queue an exact fix of its text
44
+ akm feedback <ref> --negative --reason "..." --replace "<exact text>" --with "<fix>" --source "<url|cmd|file>" # Apply an exact fix to its text
45
45
  akm bundle add <ref> # Add a source (npm, GitHub, git, local dir)
46
46
  akm clone <ref> # Copy an asset to the working bundle (optional --dest arg to clone to specific location)
47
47
  akm sync # Commit (and push if writable remote) changes in the primary bundle (--no-push to commit only)
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "Standard improve pass — reflect (rewrites only from negative feedback), distill, consolidation (promotion plus the reviewed pair-pass retire/supersede proposals), and validation. Memory inference is listed below but only runs when experimental.improveAutonomy is set; improve-stage extract and proactive maintenance off.",
2
+ "description": "Standard improve pass — reflect (rewrites only from negative feedback), distill, consolidation (promotion plus the reviewed pair-pass retire/supersede proposals), and validation. Memory inference is listed below but only runs when experimental.improveAutonomy is set; improve-stage extract off. Proactive maintenance plans up to 15 assets not reflected or distilled for 30 days.",
3
3
  "processes": {
4
4
  "reflect": {
5
5
  "enabled": true,
@@ -11,8 +11,8 @@
11
11
  "memoryInference": { "enabled": true },
12
12
  "extract": { "enabled": false, "triage": { "enabled": true, "minScore": 2 } },
13
13
  "validation": { "enabled": true },
14
- "proactiveMaintenance": { "enabled": false, "dueDays": 30, "maxPerRun": 15 },
15
- "triage": { "enabled": false, "applyMode": "queue", "policy": "personal-stash" }
14
+ "proactiveMaintenance": { "enabled": true, "dueDays": 30, "maxPerRun": 15 },
15
+ "triage": { "enabled": true, "applyMode": "promote", "maxAcceptsPerRun": 200 }
16
16
  },
17
17
  "sync": { "enabled": true, "push": true }
18
18
  }
@@ -1,19 +1,21 @@
1
- You compare two assets from one person's agent-memory library (memories and knowledge notes an AI coding agent reads). Asset A is the OLDER one and asset B the NEWER one, by the dates shown. akm deletes one of them only when the other keeps every claim a reader would need, so your two lists decide what is safe to delete.
1
+ You compare two assets from one person's agent-memory library (memories and knowledge notes an AI coding agent reads). Asset A is the OLDER one and asset B the NEWER one, by the dates shown, unless both carry the same date and are labelled "same age". akm deletes one of them only when the other keeps every claim a reader would need, so your two lists decide what is safe to delete.
2
2
 
3
3
  First list what each asset has that the other lacks:
4
- - "onlyInA": every durable claim of A that B neither states nor updates.
5
- - "onlyInB": every durable claim of B that A neither states nor updates.
4
+ - "onlyInA": every durable claim of A that B does not state or replace.
5
+ - "onlyInB": every durable claim of B that A does not state or replace.
6
6
 
7
7
  A durable claim is a fact, decision, value, command, flag, path, file name, URL, number, version, name, error message, condition or rule someone would act on. Ignore wording, headings, dates of writing, tags and boilerplate. A claim is stated when the other asset says it in any wording or format. It is not stated when the other asset is vaguer (a config file instead of the specific path) or drops a number, command, step or condition. Write each item as a short phrase that quotes its identifier. Use [] when there is nothing.
8
8
 
9
+ B replaces a claim of A only when both are about the same named thing (the same service, integration, partner, component, region or file) and B gives a new value for it that is current: B says so (now, instead of, since, renamed, corrected, no longer) or B is created later than A. Notes about different named things never replace each other, whatever their dates: list each one's own name, value and path as its claims. A different value for the same thing with neither sign is a conflict, not a replacement: list A's value in "onlyInA" and B's value in "onlyInB".
10
+
9
11
  Then classify the relation as exactly one of:
10
12
  - "duplicate": both lists are empty.
11
13
  - "subsumed": exactly one list is empty. The asset with the empty list is redundant.
12
- - "supersedes": B updates, corrects, reverses or replaces a claim in A (a newer version, a changed decision, a fixed bug, a new value), and onlyInA is empty.
13
- - "contradicts": they make logically exclusive claims about the same thing and nothing shows which one is current.
14
+ - "supersedes": B replaces a claim in A as defined above (a newer version, a changed decision, a fixed bug, a new value), and onlyInA is empty.
15
+ - "contradicts": they make logically exclusive claims about the same thing and nothing shows which one is current: B does not say it replaces the claim and was not created later.
14
16
  - "overlap": same subject, and both lists have items.
15
- - "unrelated": different subjects or different facts that happen to share words.
17
+ - "unrelated": different subjects, or different named things written to one layout (two services, partners or regions), or different facts that happen to share words.
16
18
 
17
19
  Set "redundant" to the asset that could be deleted with no loss: "A" for "duplicate", the asset with the empty list for "subsumed", "A" for "supersedes"; else null. Set "stale" to "A" when the relation is "supersedes", else null.
18
20
 
19
- Answer ONLY with JSON: {"onlyInA": ["..."], "onlyInB": ["..."], "relation": "...", "redundant": "A"|"B"|null, "stale": "A"|null, "confidence": 0.0-1.0, "reason": "<at most 25 words: name the asset that can be deleted and what the other asset still holds>"}
21
+ Answer ONLY with JSON: {"onlyInA": ["..."], "onlyInB": ["..."], "relation": "...", "redundant": "A"|"B"|null, "stale": "A"|null, "confidence": 0.0-1.0, "reason": "<at most 25 words: name the asset that can be deleted and what the other asset still holds; for supersedes, quote the words of B that replace the claim or say B is created later>"}
@@ -85,7 +85,7 @@ akm feedback <ref> --positive
85
85
  # A note that simply did not fit your task gets no negative feedback.
86
86
  akm feedback <ref> --negative --reason "<what is wrong and what should change>"
87
87
 
88
- # Once you have verified the correct fact, attach the exact fix: it is checked and queued for review
88
+ # Once you have verified the correct fact, attach the exact fix: it is checked and applied at once
89
89
  akm feedback <ref> --negative --reason "<what is wrong>" --replace "<exact current text>" --with "<corrected text>" --source "<URL, command or file>"
90
90
 
91
91
  # Capture a durable lesson or memory from the current session
@@ -1,4 +1,4 @@
1
1
  version: 4
2
- run: akm improve --strategy consolidate --skip-if-locked --require-engines
2
+ run: akm improve --strategy consolidate --timeout-ms 3600000 --skip-if-locked --require-engines
3
3
  description: Consolidation-only pass (every 4h at :20)
4
4
  schedule: "20 */4 * * *"