akm-cli 0.9.0-rc.1 → 0.9.0-rc.13

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 (587) hide show
  1. package/CHANGELOG.md +1190 -52
  2. package/README.md +62 -37
  3. package/SECURITY.md +46 -31
  4. package/dist/akm +162 -38
  5. package/dist/akm-migrate +44 -0
  6. package/dist/assets/backends/schtasks-template.xml +2 -1
  7. package/dist/assets/hints/cli-hints-full.md +268 -118
  8. package/dist/assets/hints/cli-hints-short.md +87 -24
  9. package/dist/assets/{profiles → improve-strategies}/catchup.json +3 -1
  10. package/dist/assets/{profiles → improve-strategies}/consolidate.json +3 -1
  11. package/dist/assets/{profiles → improve-strategies}/default.json +6 -7
  12. package/dist/assets/improve-strategies/frequent.json +15 -0
  13. package/dist/assets/{profiles → improve-strategies}/graph-refresh.json +4 -2
  14. package/dist/assets/{profiles → improve-strategies}/memory-focus.json +4 -1
  15. package/dist/assets/{profiles → improve-strategies}/proactive-maintenance.json +5 -5
  16. package/dist/assets/{profiles → improve-strategies}/quick.json +4 -2
  17. package/dist/assets/improve-strategies/reflect-distill.json +30 -0
  18. package/dist/assets/{profiles → improve-strategies}/thorough.json +1 -1
  19. package/dist/assets/prompts/consolidate-system.md +5 -5
  20. package/dist/assets/prompts/extract-session.md +2 -6
  21. package/dist/assets/prompts/memory-infer-user.md +2 -3
  22. package/dist/assets/prompts/reflect-llm-framed-contract.md +11 -0
  23. package/dist/assets/prompts/reflect-llm-schema-contract.md +3 -0
  24. package/dist/assets/prompts/reflect-output-repair.md +3 -0
  25. package/dist/assets/stash-skeleton/README.md +38 -10
  26. package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +8 -0
  27. package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +8 -0
  28. package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +14 -1
  29. package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +13 -1
  30. package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +9 -1
  31. package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +11 -0
  32. package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +9 -0
  33. package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +9 -0
  34. package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +8 -0
  35. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +100 -0
  36. package/dist/assets/stash-skeleton/facts/conventions/domains.md +64 -0
  37. package/dist/assets/stash-skeleton/facts/conventions/organization.md +136 -0
  38. package/dist/assets/tasks/core/extract.yml +3 -2
  39. package/dist/assets/tasks/core/improve.yml +2 -1
  40. package/dist/assets/tasks/core/index-refresh.yml +1 -0
  41. package/dist/assets/tasks/core/sync.yml +1 -0
  42. package/dist/assets/tasks/core/version-check.yml +2 -1
  43. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +5 -0
  44. package/dist/assets/tasks/improve/akm-improve-catchup.yml +8 -0
  45. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +5 -0
  46. package/dist/assets/tasks/improve/akm-improve-frequent.yml +5 -0
  47. package/dist/assets/tasks/improve/akm-improve-nightly.yml +5 -0
  48. package/dist/assets/templates/html/health.html +5 -4
  49. package/dist/assets/workflows/workflow-template.md +31 -15
  50. package/dist/cli/invocation.js +279 -0
  51. package/dist/cli/parse-args.js +5 -90
  52. package/dist/cli/retired-commands.js +78 -0
  53. package/dist/cli/shared.js +158 -48
  54. package/dist/cli-node.mjs +2 -1
  55. package/dist/cli.js +747 -293
  56. package/dist/commands/agent/agent-dispatch.js +19 -18
  57. package/dist/commands/agent/agent-support.js +0 -24
  58. package/dist/commands/agent/contribute-cli.js +43 -97
  59. package/dist/commands/completions.js +80 -23
  60. package/dist/commands/config-cli.js +44 -281
  61. package/dist/commands/env/env-binding.js +13 -9
  62. package/dist/commands/env/env-cli.js +76 -159
  63. package/dist/commands/env/env.js +12 -163
  64. package/dist/commands/env/marker-path.js +6 -0
  65. package/dist/commands/env/secret-cli.js +45 -61
  66. package/dist/commands/env/secret.js +32 -62
  67. package/dist/commands/feedback-cli.js +179 -85
  68. package/dist/commands/health/accept-rate.js +58 -0
  69. package/dist/commands/health/advisories.js +7 -8
  70. package/dist/commands/health/checks.js +279 -94
  71. package/dist/commands/health/html-report.js +197 -578
  72. package/dist/commands/health/improve-metrics.js +277 -246
  73. package/dist/commands/health/llm-usage.js +19 -19
  74. package/dist/commands/health/md-report.js +16 -7
  75. package/dist/commands/health/metrics.js +67 -32
  76. package/dist/commands/health/renderers.js +47 -0
  77. package/dist/commands/health/report-view-model.js +508 -0
  78. package/dist/commands/health/stash-exposure.js +1 -1
  79. package/dist/commands/health/surfaces.js +16 -56
  80. package/dist/commands/health/task-runs.js +3 -67
  81. package/dist/{migrate-storage-node.mjs → commands/health/types-checks.js} +1 -5
  82. package/dist/commands/health/types-improve.js +29 -0
  83. package/dist/{output/text/save.js → commands/health/types-metrics.js} +1 -2
  84. package/dist/commands/health/types-result.js +7 -0
  85. package/dist/commands/health/types-runs.js +4 -0
  86. package/dist/commands/health/types-session-log.js +4 -0
  87. package/dist/commands/health/types-windows.js +4 -0
  88. package/dist/commands/health/types.js +26 -21
  89. package/dist/commands/health/windows.js +2 -3
  90. package/dist/commands/health.js +296 -167
  91. package/dist/commands/improve/anti-collapse.js +5 -5
  92. package/dist/commands/improve/autonomy-gate.js +68 -0
  93. package/dist/commands/improve/collapse-detector.js +65 -52
  94. package/dist/commands/improve/consolidate/chunking.js +9 -7
  95. package/dist/commands/improve/consolidate/eligibility.js +1 -23
  96. package/dist/commands/improve/consolidate/merge.js +4 -0
  97. package/dist/commands/improve/consolidate.js +454 -1354
  98. package/dist/commands/improve/content-hash.js +39 -0
  99. package/dist/commands/improve/distill/content-repair.js +4 -10
  100. package/dist/commands/improve/distill/promote-memory.js +89 -64
  101. package/dist/commands/improve/distill/quality-gate.js +118 -42
  102. package/dist/commands/improve/distill-guards.js +1 -1
  103. package/dist/commands/improve/distill-promotion-policy.js +33 -888
  104. package/dist/commands/improve/distill.js +607 -363
  105. package/dist/commands/improve/eligibility.js +165 -79
  106. package/dist/commands/improve/extract-cli.js +35 -126
  107. package/dist/commands/improve/extract-prompt.js +6 -35
  108. package/dist/commands/improve/extract.js +640 -391
  109. package/dist/commands/improve/feedback-valence.js +2 -12
  110. package/dist/commands/improve/improve-cli.js +134 -135
  111. package/dist/commands/improve/improve-result-file.js +30 -50
  112. package/dist/commands/improve/improve-run-types.js +4 -0
  113. package/dist/commands/improve/improve-strategies.js +135 -0
  114. package/dist/commands/improve/improve.js +904 -701
  115. package/dist/commands/improve/locks.js +64 -111
  116. package/dist/commands/improve/loop-stages.js +1110 -923
  117. package/dist/commands/improve/memory/derived-ref.js +124 -0
  118. package/dist/commands/improve/memory/memory-belief.js +79 -7
  119. package/dist/commands/improve/memory/memory-contradiction-detect.js +49 -52
  120. package/dist/commands/improve/memory/memory-improve.js +25 -37
  121. package/dist/commands/improve/outcome-loop.js +25 -88
  122. package/dist/commands/improve/preparation.js +1034 -813
  123. package/dist/commands/improve/proactive-maintenance.js +34 -9
  124. package/dist/commands/improve/proposal-envelope.js +31 -0
  125. package/dist/commands/improve/reflect.js +983 -794
  126. package/dist/commands/improve/run-context.js +119 -0
  127. package/dist/commands/improve/salience.js +24 -127
  128. package/dist/commands/improve/session-asset.js +7 -3
  129. package/dist/commands/improve/shared.js +14 -34
  130. package/dist/commands/improve/source-identity.js +28 -0
  131. package/dist/commands/improve/triage.js +20 -17
  132. package/dist/commands/lint/base-linter.js +340 -313
  133. package/dist/commands/lint/env-key-rules.js +31 -47
  134. package/dist/commands/lint/index.js +185 -30
  135. package/dist/commands/{events.js → log.js} +28 -38
  136. package/dist/commands/migrate-cli.js +54 -0
  137. package/dist/commands/migration-tool.js +55 -0
  138. package/dist/commands/observability-cli.js +70 -208
  139. package/dist/commands/proposal/diff-format.js +50 -0
  140. package/dist/commands/proposal/drain-policies.js +0 -6
  141. package/dist/commands/proposal/drain.js +91 -40
  142. package/dist/commands/proposal/proposal-cli.js +134 -132
  143. package/dist/commands/proposal/proposal-types.js +56 -0
  144. package/dist/commands/proposal/proposal.js +83 -65
  145. package/dist/commands/proposal/propose-cli.js +88 -0
  146. package/dist/commands/proposal/propose.js +105 -88
  147. package/dist/commands/proposal/repository.js +1303 -278
  148. package/dist/commands/proposal/validators/proposal-quality-validators.js +16 -6
  149. package/dist/commands/proposal/validators/proposal-validators.js +61 -12
  150. package/dist/commands/proposal/validators/proposals.js +6 -8
  151. package/dist/commands/read/curate.js +78 -73
  152. package/dist/commands/read/knowledge.js +510 -13
  153. package/dist/commands/read/registry-search.js +2 -2
  154. package/dist/commands/read/remember-cli.js +84 -15
  155. package/dist/commands/read/search-cli.js +203 -96
  156. package/dist/commands/read/search.js +126 -94
  157. package/dist/commands/read/show.js +226 -250
  158. package/dist/commands/registry-cli.js +34 -60
  159. package/dist/commands/remember.js +18 -57
  160. package/dist/commands/sources/add-cli.js +104 -49
  161. package/dist/commands/sources/bundle-cli.js +166 -0
  162. package/dist/commands/sources/bundle-config-ops.js +63 -0
  163. package/dist/commands/sources/info.js +27 -15
  164. package/dist/commands/sources/init.js +30 -40
  165. package/dist/commands/sources/installed-stashes.js +469 -172
  166. package/dist/commands/sources/schema-repair.js +10 -9
  167. package/dist/commands/sources/self-update.js +182 -121
  168. package/dist/commands/sources/source-add.js +169 -178
  169. package/dist/commands/sources/source-clone.js +144 -41
  170. package/dist/commands/sources/source-manage.js +94 -59
  171. package/dist/commands/sources/sources-cli.js +64 -205
  172. package/dist/commands/sources/stash-cli.js +91 -54
  173. package/dist/commands/sources/stash-skeleton.js +1 -1
  174. package/dist/commands/tasks/tasks-cli.js +106 -104
  175. package/dist/commands/tasks/tasks.js +445 -262
  176. package/dist/commands/workflow-cli.js +75 -228
  177. package/dist/core/action-contributors.js +1 -1
  178. package/dist/core/activation-policy.js +49 -0
  179. package/dist/core/adapter/adapters/agent-skills-adapter.js +181 -0
  180. package/dist/core/adapter/adapters/akm-adapter.js +528 -0
  181. package/dist/core/adapter/adapters/akm-lint.js +392 -0
  182. package/dist/core/adapter/adapters/akm-metadata.js +387 -0
  183. package/dist/core/adapter/adapters/akm-task-adapter.js +149 -0
  184. package/dist/core/adapter/adapters/akm-workflow-adapter.js +180 -0
  185. package/dist/core/adapter/adapters/claude-adapter.js +61 -0
  186. package/dist/core/adapter/adapters/dotenv-adapter.js +187 -0
  187. package/dist/core/adapter/adapters/generic-files-adapter.js +119 -0
  188. package/dist/core/adapter/adapters/index.js +80 -0
  189. package/dist/core/adapter/adapters/llm-wiki-adapter.js +419 -0
  190. package/dist/core/adapter/adapters/okf-adapter.js +391 -0
  191. package/dist/core/adapter/adapters/opencode-adapter.js +68 -0
  192. package/dist/core/adapter/adapters/shared.js +286 -0
  193. package/dist/core/adapter/adapters/tool-dir-shared.js +217 -0
  194. package/dist/core/adapter/adapters/website-snapshot-adapter.js +155 -0
  195. package/dist/core/adapter/bundle-adapter.js +4 -0
  196. package/dist/core/adapter/detect-adapter.js +17 -0
  197. package/dist/core/adapter/recognize-match.js +44 -0
  198. package/dist/core/adapter/registry.js +56 -0
  199. package/dist/core/adapter/types.js +4 -0
  200. package/dist/core/asset/akm-markdown.js +30 -0
  201. package/dist/core/asset/asset-placement.js +243 -0
  202. package/dist/core/asset/asset-ref.js +110 -79
  203. package/dist/core/asset/asset-serialize.js +20 -0
  204. package/dist/core/asset/frontmatter.js +28 -12
  205. package/dist/core/asset/markdown.js +40 -51
  206. package/dist/core/asset/resolve-ref.js +274 -0
  207. package/dist/core/asset/stash-meta.js +2 -2
  208. package/dist/core/bundle-id.js +51 -0
  209. package/dist/core/common.js +281 -86
  210. package/dist/core/config/config-io.js +42 -128
  211. package/dist/core/config/config-schema.js +233 -855
  212. package/dist/core/config/config-sources.js +162 -39
  213. package/dist/core/config/config-types.js +16 -11
  214. package/dist/core/config/config-version.js +29 -0
  215. package/dist/core/config/config-walker.js +126 -37
  216. package/dist/core/config/config.js +154 -331
  217. package/dist/core/config/deep-merge.js +41 -0
  218. package/dist/core/config/engine-semantics.js +28 -0
  219. package/dist/core/config/experimental.js +21 -0
  220. package/dist/core/config/schema/embedding.js +38 -0
  221. package/dist/core/config/schema/engines.js +116 -0
  222. package/dist/core/config/schema/experimental.js +47 -0
  223. package/dist/core/config/schema/feedback.js +31 -0
  224. package/dist/core/config/schema/improve-processes.js +389 -0
  225. package/dist/core/config/schema/improve.js +94 -0
  226. package/dist/core/config/schema/index-config.js +176 -0
  227. package/dist/core/config/schema/output.js +18 -0
  228. package/dist/core/config/schema/primitives.js +94 -0
  229. package/dist/core/config/schema/search.js +30 -0
  230. package/dist/core/config/schema/setup.js +18 -0
  231. package/dist/core/config/schema/sources-bundles.js +169 -0
  232. package/dist/core/config/schema/workflow.js +29 -0
  233. package/dist/core/env-secret-ref.js +155 -20
  234. package/dist/core/errors.js +17 -15
  235. package/dist/core/events-types.js +4 -0
  236. package/dist/core/events.js +46 -128
  237. package/dist/core/extra-params.js +62 -0
  238. package/dist/core/file-change.js +17 -0
  239. package/dist/core/file-lock.js +202 -57
  240. package/dist/core/fs-txn.js +392 -0
  241. package/dist/core/git-message.js +59 -0
  242. package/dist/core/improve-result.js +167 -0
  243. package/dist/core/lesson-lint.js +1 -17
  244. package/dist/core/logs-db.js +1 -1
  245. package/dist/core/maintenance-barrier.js +135 -0
  246. package/dist/core/migration-operation.js +44 -0
  247. package/dist/core/mutation-target.js +78 -0
  248. package/dist/core/paths.js +22 -25
  249. package/dist/core/platform.js +10 -0
  250. package/dist/core/recognition-util.js +128 -0
  251. package/dist/core/redaction.js +392 -0
  252. package/dist/core/standards/resolve-standards-context.js +36 -65
  253. package/dist/core/standards/resolve-stash-standards.js +2 -2
  254. package/dist/core/standards/resolve-type-conventions.js +5 -5
  255. package/dist/core/state/migrations.js +242 -11
  256. package/dist/core/state-db.js +98 -10
  257. package/dist/core/structured.js +1 -1
  258. package/dist/core/subprocess.js +303 -0
  259. package/dist/core/text-truncation.js +9 -5
  260. package/dist/core/time.js +20 -0
  261. package/dist/core/type-presentation.js +130 -0
  262. package/dist/core/warn.js +0 -3
  263. package/dist/core/write-source.js +834 -118
  264. package/dist/indexer/bundle-identity-guard.js +92 -0
  265. package/dist/indexer/db/graph-db.js +1 -25
  266. package/dist/indexer/db/llm-cache.js +1 -1
  267. package/dist/indexer/ensure-index.js +30 -9
  268. package/dist/indexer/graph/graph-boost.js +9 -30
  269. package/dist/indexer/graph/graph-extraction.js +41 -27
  270. package/dist/indexer/graph/graph-types.js +4 -0
  271. package/dist/indexer/index-writer-lock.js +93 -49
  272. package/dist/indexer/index-written-assets.js +100 -53
  273. package/dist/indexer/indexer.js +746 -329
  274. package/dist/indexer/init.js +18 -25
  275. package/dist/indexer/installations.js +142 -0
  276. package/dist/indexer/passes/dir-staleness.js +18 -10
  277. package/dist/indexer/passes/memory-inference.js +25 -15
  278. package/dist/indexer/passes/metadata.js +412 -243
  279. package/dist/indexer/scan/doc-to-entry.js +160 -0
  280. package/dist/indexer/scan/drain-dir.js +134 -0
  281. package/dist/indexer/search/db-search.js +292 -108
  282. package/dist/indexer/search/fts-query.js +64 -0
  283. package/dist/indexer/search/ranking-contributors.js +145 -25
  284. package/dist/indexer/search/ranking-types.js +4 -0
  285. package/dist/indexer/search/ranking.js +28 -71
  286. package/dist/indexer/search/search-attribution.js +67 -0
  287. package/dist/indexer/search/search-fields.js +18 -3
  288. package/dist/indexer/search/search-hit-enrichers.js +30 -40
  289. package/dist/indexer/search/search-source.js +157 -111
  290. package/dist/indexer/search/semantic-status.js +4 -1
  291. package/dist/indexer/usage/usage-events.js +10 -30
  292. package/dist/indexer/walk/file-context.js +3 -45
  293. package/dist/indexer/walk/matchers.js +42 -73
  294. package/dist/indexer/walk/path-resolver.js +11 -5
  295. package/dist/indexer/walk/walker.js +42 -14
  296. package/dist/integrations/agent/builder-shared.js +7 -0
  297. package/dist/integrations/agent/builders.js +5 -58
  298. package/dist/integrations/agent/config.js +3 -143
  299. package/dist/integrations/agent/detect.js +17 -2
  300. package/dist/integrations/agent/engine-resolution.js +231 -0
  301. package/dist/integrations/agent/index.js +1 -2
  302. package/dist/integrations/agent/model-aliases.js +8 -3
  303. package/dist/integrations/agent/profiles.js +6 -99
  304. package/dist/integrations/agent/prompts.js +46 -18
  305. package/dist/integrations/agent/runner-dispatch.js +78 -13
  306. package/dist/integrations/agent/runner.js +76 -208
  307. package/dist/integrations/agent/spawn.js +48 -279
  308. package/dist/integrations/harnesses/aider/agent-builder.js +9 -8
  309. package/dist/integrations/harnesses/aider/index.js +2 -12
  310. package/dist/integrations/harnesses/amazonq/agent-builder.js +10 -16
  311. package/dist/integrations/harnesses/amazonq/index.js +3 -17
  312. package/dist/integrations/harnesses/claude/agent-builder.js +2 -3
  313. package/dist/integrations/harnesses/claude/config-import.js +1 -3
  314. package/dist/integrations/harnesses/claude/index.js +1 -14
  315. package/dist/integrations/harnesses/claude/session-log.js +27 -75
  316. package/dist/integrations/harnesses/codex/agent-builder.js +8 -7
  317. package/dist/integrations/harnesses/codex/index.js +2 -13
  318. package/dist/integrations/harnesses/copilot/agent-builder.js +9 -9
  319. package/dist/integrations/harnesses/copilot/index.js +1 -13
  320. package/dist/integrations/harnesses/gemini/agent-builder.js +8 -9
  321. package/dist/integrations/harnesses/gemini/index.js +1 -13
  322. package/dist/integrations/harnesses/ids.js +24 -0
  323. package/dist/integrations/harnesses/index.js +31 -33
  324. package/dist/integrations/harnesses/opencode/agent-builder.js +23 -5
  325. package/dist/integrations/harnesses/opencode/config-import.js +1 -3
  326. package/dist/integrations/harnesses/opencode/index.js +1 -18
  327. package/dist/integrations/harnesses/opencode/session-log.js +67 -125
  328. package/dist/integrations/harnesses/opencode-sdk/harness.js +3 -17
  329. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +274 -191
  330. package/dist/integrations/harnesses/openhands/agent-builder.js +12 -10
  331. package/dist/integrations/harnesses/openhands/index.js +2 -12
  332. package/dist/integrations/harnesses/pi/agent-builder.js +11 -18
  333. package/dist/integrations/harnesses/pi/index.js +3 -16
  334. package/dist/integrations/harnesses/shared.js +17 -0
  335. package/dist/integrations/harnesses/types.js +38 -34
  336. package/dist/integrations/lockfile.js +211 -24
  337. package/dist/integrations/session-logs/index.js +24 -40
  338. package/dist/integrations/session-logs/provider-base.js +113 -0
  339. package/dist/llm/client.js +182 -110
  340. package/dist/llm/embedders/deterministic.js +2 -2
  341. package/dist/llm/embedders/remote.js +21 -9
  342. package/dist/llm/feature-gate.js +17 -57
  343. package/dist/llm/graph-extract.js +12 -13
  344. package/dist/llm/index-passes.js +8 -42
  345. package/dist/llm/memory-infer.js +144 -1
  346. package/dist/llm/metadata-enhance.js +45 -30
  347. package/dist/llm/structured-call.js +16 -8
  348. package/dist/llm/usage-persist.js +30 -5
  349. package/dist/llm/usage-telemetry.js +59 -6
  350. package/dist/output/cli-hints.js +1 -2
  351. package/dist/output/command-registry.js +27 -0
  352. package/dist/output/context.js +22 -7
  353. package/dist/output/format-exempt.js +80 -0
  354. package/dist/output/generic-render.js +251 -0
  355. package/dist/output/html-render.js +11 -16
  356. package/dist/output/render-registry.js +57 -0
  357. package/dist/output/renderers.js +15 -281
  358. package/dist/output/shapes/curate.js +10 -1
  359. package/dist/output/shapes/events.js +12 -7
  360. package/dist/output/shapes/helpers.js +58 -84
  361. package/dist/output/shapes/passthrough.js +8 -40
  362. package/dist/output/shapes/proposal/producer.js +15 -7
  363. package/dist/output/shapes/registry.js +12 -6
  364. package/dist/output/shapes.js +0 -9
  365. package/dist/output/text/{init.js → bundle-create.js} +3 -1
  366. package/dist/output/text/bundle-show.js +7 -0
  367. package/dist/output/text/command-format.js +562 -0
  368. package/dist/output/text/env.js +1 -3
  369. package/dist/output/text/events.js +8 -7
  370. package/dist/output/text/helpers.js +15 -1375
  371. package/dist/output/text/proposal/producer.js +4 -2
  372. package/dist/output/text/proposal-format.js +202 -0
  373. package/dist/output/text/registry-commands.js +1 -2
  374. package/dist/output/text/registry.js +12 -6
  375. package/dist/output/text/show-directives.js +117 -0
  376. package/dist/output/text/show-format.js +103 -0
  377. package/dist/output/text/sync.js +5 -0
  378. package/dist/output/text/workflow-format.js +332 -0
  379. package/dist/output/text/workflow.js +1 -2
  380. package/dist/output/text.js +10 -19
  381. package/dist/registry/factory.js +4 -6
  382. package/dist/registry/origin-resolve.js +16 -27
  383. package/dist/registry/providers/skills-sh.js +3 -3
  384. package/dist/registry/providers/static-index.js +15 -25
  385. package/dist/registry/resolve.js +43 -94
  386. package/dist/registry/semver.js +43 -0
  387. package/dist/runtime.js +81 -12
  388. package/dist/scripts/akm-migrate.js +35529 -0
  389. package/dist/setup/detect.js +5 -7
  390. package/dist/setup/detected-engines.js +136 -0
  391. package/dist/setup/engine-config.js +100 -0
  392. package/dist/setup/registry-stash-loader.js +3 -3
  393. package/dist/setup/semantic-assets.js +12 -9
  394. package/dist/setup/setup.js +444 -208
  395. package/dist/setup/steps/connection-shared.js +120 -0
  396. package/dist/setup/steps/connection.js +108 -305
  397. package/dist/setup/steps/platforms.js +13 -12
  398. package/dist/setup/steps/semantic.js +15 -3
  399. package/dist/setup/steps/sources.js +21 -15
  400. package/dist/setup/steps/stashdir.js +6 -4
  401. package/dist/setup/steps/tasks.js +236 -119
  402. package/dist/setup/steps.js +3 -2
  403. package/dist/sources/freshness.js +39 -0
  404. package/dist/sources/provider-factory.js +11 -17
  405. package/dist/sources/providers/filesystem.js +2 -3
  406. package/dist/sources/providers/git-install.js +278 -34
  407. package/dist/sources/providers/git-provider.js +54 -56
  408. package/dist/sources/providers/git-stash.js +420 -91
  409. package/dist/sources/providers/git.js +2 -2
  410. package/dist/sources/providers/npm.js +16 -19
  411. package/dist/sources/providers/provider-utils.js +47 -22
  412. package/dist/sources/providers/sync-from-ref.js +3 -9
  413. package/dist/sources/providers/website.js +2 -2
  414. package/dist/sources/resolve.js +11 -10
  415. package/dist/sources/snapshot-fetchers/types.js +4 -0
  416. package/dist/sources/{website-ingest.js → snapshot-fetchers/website-ingest.js} +110 -41
  417. package/dist/storage/database.js +60 -4
  418. package/dist/storage/engines/sqlite-migrations.js +156 -5
  419. package/dist/storage/locations.js +1 -2
  420. package/dist/storage/repositories/canaries-repository.js +1 -1
  421. package/dist/storage/repositories/events-repository.js +51 -11
  422. package/dist/storage/repositories/improve-runs-repository.js +6 -32
  423. package/dist/storage/repositories/index-connection.js +79 -0
  424. package/dist/storage/repositories/index-db.js +4 -3
  425. package/dist/storage/repositories/index-entries-repository.js +863 -0
  426. package/dist/{indexer/db/entry-mapper.js → storage/repositories/index-entry-mapper.js} +19 -2
  427. package/dist/storage/repositories/index-entry-types.js +4 -0
  428. package/dist/storage/repositories/index-fts-repository.js +167 -0
  429. package/dist/storage/repositories/index-llm-cache-repository.js +108 -0
  430. package/dist/storage/repositories/index-meta-repository.js +49 -0
  431. package/dist/{indexer/db/schema.js → storage/repositories/index-schema.js} +226 -100
  432. package/dist/storage/repositories/index-sql.js +12 -0
  433. package/dist/storage/repositories/index-utility-repository.js +356 -0
  434. package/dist/storage/repositories/index-vec-repository.js +250 -0
  435. package/dist/storage/repositories/outcome-repository.js +119 -0
  436. package/dist/storage/repositories/proposals-repository.js +317 -75
  437. package/dist/storage/repositories/registry-cache.js +1 -1
  438. package/dist/storage/repositories/salience-repository.js +172 -0
  439. package/dist/storage/repositories/task-history-repository.js +110 -3
  440. package/dist/storage/repositories/workflow-runs-repository.js +68 -35
  441. package/dist/tasks/backends/cron.js +169 -46
  442. package/dist/tasks/backends/exec-utils.js +76 -3
  443. package/dist/tasks/backends/index.js +6 -9
  444. package/dist/tasks/backends/launchd.js +292 -55
  445. package/dist/tasks/backends/schtasks.js +557 -70
  446. package/dist/tasks/backends/types.js +4 -0
  447. package/dist/tasks/command-executable.js +93 -0
  448. package/dist/tasks/embedded.js +56 -38
  449. package/dist/tasks/parser.js +156 -64
  450. package/dist/tasks/resolve-akm-bin.js +144 -51
  451. package/dist/tasks/runner.js +377 -209
  452. package/dist/tasks/schedule.js +108 -19
  453. package/dist/tasks/scheduler-invocation.js +296 -0
  454. package/dist/tasks/schema.js +1 -1
  455. package/dist/tasks/task-id.js +35 -0
  456. package/dist/tasks/validator.js +30 -16
  457. package/dist/workflows/authoring/authoring.js +96 -148
  458. package/dist/workflows/authoring/scope-key.js +1 -1
  459. package/dist/workflows/cli.js +0 -20
  460. package/dist/workflows/concurrency-policy.js +15 -0
  461. package/dist/workflows/exec/brief.js +25 -59
  462. package/dist/workflows/exec/frozen-judge.js +47 -0
  463. package/dist/workflows/exec/native-executor.js +157 -94
  464. package/dist/workflows/exec/report.js +365 -200
  465. package/dist/workflows/exec/run-workflow.js +46 -40
  466. package/dist/workflows/exec/scheduler.js +12 -41
  467. package/dist/workflows/exec/step-work.js +239 -205
  468. package/dist/workflows/exec/workflow-engine-gate.js +67 -0
  469. package/dist/workflows/ir/compile.js +141 -283
  470. package/dist/workflows/ir/freeze.js +233 -0
  471. package/dist/workflows/ir/plan-hash.js +40 -5
  472. package/dist/workflows/ir/schema.js +537 -1
  473. package/dist/workflows/parser.js +878 -306
  474. package/dist/workflows/program/expressions.js +20 -208
  475. package/dist/workflows/program/schema.js +7 -10
  476. package/dist/workflows/renderer.js +99 -121
  477. package/dist/workflows/resource-limits.js +22 -0
  478. package/dist/workflows/runtime/checkin.js +1 -1
  479. package/dist/workflows/runtime/plan-classifier.js +131 -0
  480. package/dist/workflows/runtime/runs.js +200 -113
  481. package/dist/workflows/runtime/unit-checkin.js +1 -1
  482. package/dist/workflows/runtime/unit-phases.js +20 -0
  483. package/dist/workflows/runtime/workflow-asset-loader.js +235 -97
  484. package/dist/workflows/schema.js +1 -11
  485. package/dist/workflows/validate-summary.js +4 -26
  486. package/dist/workflows/validator.js +52 -30
  487. package/docs/README.md +42 -78
  488. package/docs/migration/README.md +8 -0
  489. package/docs/migration/release-notes/0.6.0.md +1 -1
  490. package/docs/migration/release-notes/0.7.0.md +9 -8
  491. package/docs/migration/release-notes/0.9.0.md +158 -14
  492. package/docs/migration/v0.7-to-v0.8.md +46 -47
  493. package/docs/migration/v0.8-to-v0.9.md +844 -0
  494. package/docs/reference/README.md +12 -0
  495. package/docs/reference/data-and-telemetry.md +333 -0
  496. package/package.json +21 -17
  497. package/schemas/akm-asset-envelope.json +93 -0
  498. package/schemas/akm-config.json +4636 -0
  499. package/schemas/akm-task.json +87 -0
  500. package/{dist/schemas → schemas}/akm-workflow.json +127 -82
  501. package/dist/akm-migrate-storage +0 -38
  502. package/dist/assets/help/help-accept.md +0 -12
  503. package/dist/assets/help/help-improve.md +0 -84
  504. package/dist/assets/help/help-proposals.md +0 -17
  505. package/dist/assets/help/help-propose.md +0 -17
  506. package/dist/assets/help/help-reject.md +0 -11
  507. package/dist/assets/profiles/frequent.json +0 -13
  508. package/dist/assets/profiles/recombine-only.json +0 -21
  509. package/dist/assets/profiles/reflect-distill.json +0 -30
  510. package/dist/assets/profiles/synthesize.json +0 -15
  511. package/dist/assets/prompts/procedural-system.md +0 -44
  512. package/dist/assets/prompts/recombine-system.md +0 -40
  513. package/dist/assets/prompts/staleness-detect-system.md +0 -6
  514. package/dist/assets/tasks/core/backup.yml +0 -4
  515. package/dist/assets/tasks/graph-refresh-weekly.yml +0 -10
  516. package/dist/assets/templates/html/default.html +0 -78
  517. package/dist/assets/templates/html/vendor/echarts.min.js +0 -45
  518. package/dist/assets/wiki/index-template.md +0 -12
  519. package/dist/assets/wiki/ingest-workflow-template.md +0 -83
  520. package/dist/assets/wiki/log-template.md +0 -8
  521. package/dist/assets/wiki/schema-template.md +0 -61
  522. package/dist/cli/config-migrate.js +0 -150
  523. package/dist/cli/config-validate.js +0 -39
  524. package/dist/commands/graph/graph-cli.js +0 -124
  525. package/dist/commands/graph/graph.js +0 -487
  526. package/dist/commands/improve/calibration.js +0 -161
  527. package/dist/commands/improve/dedup.js +0 -482
  528. package/dist/commands/improve/extract-watch.js +0 -140
  529. package/dist/commands/improve/hot-probation.js +0 -45
  530. package/dist/commands/improve/improve-auto-accept.js +0 -276
  531. package/dist/commands/improve/improve-profiles.js +0 -168
  532. package/dist/commands/improve/procedural.js +0 -398
  533. package/dist/commands/improve/recombine.js +0 -818
  534. package/dist/commands/improve/schema-similarity-gate.js +0 -168
  535. package/dist/commands/lint/agent-linter.js +0 -44
  536. package/dist/commands/lint/command-linter.js +0 -44
  537. package/dist/commands/lint/default-linter.js +0 -16
  538. package/dist/commands/lint/fact-linter.js +0 -39
  539. package/dist/commands/lint/knowledge-linter.js +0 -16
  540. package/dist/commands/lint/memory-linter.js +0 -61
  541. package/dist/commands/lint/registry.js +0 -41
  542. package/dist/commands/lint/skill-linter.js +0 -45
  543. package/dist/commands/lint/task-linter.js +0 -50
  544. package/dist/commands/lint/workflow-linter.js +0 -81
  545. package/dist/commands/proposal/legacy-import.js +0 -115
  546. package/dist/commands/sources/history.js +0 -196
  547. package/dist/commands/tasks/default-tasks.js +0 -186
  548. package/dist/commands/wiki-cli.js +0 -292
  549. package/dist/core/asset/asset-registry.js +0 -76
  550. package/dist/core/asset/asset-spec.js +0 -316
  551. package/dist/core/config/config-migration.js +0 -602
  552. package/dist/core/deep-merge.js +0 -38
  553. package/dist/core/eval/rank-metrics.js +0 -113
  554. package/dist/core/ripgrep/install.js +0 -163
  555. package/dist/core/ripgrep/resolve.js +0 -81
  556. package/dist/indexer/db/db.js +0 -1414
  557. package/dist/indexer/manifest.js +0 -170
  558. package/dist/indexer/passes/metadata-contributors.js +0 -31
  559. package/dist/indexer/usage/unmigrated-vaults-guard.js +0 -94
  560. package/dist/integrations/harnesses/opencode-sdk/index.js +0 -25
  561. package/dist/llm/call-ai.js +0 -62
  562. package/dist/llm/memory-infer-impl.js +0 -138
  563. package/dist/output/shapes/distill.js +0 -14
  564. package/dist/output/shapes/history.js +0 -11
  565. package/dist/output/text/distill.js +0 -6
  566. package/dist/output/text/enable-disable.js +0 -8
  567. package/dist/output/text/history.js +0 -6
  568. package/dist/output/text/wiki.js +0 -16
  569. package/dist/registry/build-index.js +0 -386
  570. package/dist/schemas/akm-config.json +0 -14225
  571. package/dist/scripts/migrate-storage.js +0 -13169
  572. package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +0 -10169
  573. package/dist/scripts/migrations/v16-to-v17.js +0 -141
  574. package/dist/setup/legacy-config.js +0 -106
  575. package/dist/storage/repositories/consolidation-repository.js +0 -38
  576. package/dist/storage/repositories/recombine-repository.js +0 -213
  577. package/dist/wiki/wiki-templates.js +0 -15
  578. package/dist/wiki/wiki.js +0 -1012
  579. package/dist/workflows/authoring/workflow-program-template.yaml +0 -31
  580. package/dist/workflows/db.js +0 -350
  581. package/dist/workflows/exec/watch.js +0 -116
  582. package/dist/workflows/program/parser.js +0 -760
  583. package/dist/workflows/program/project.js +0 -105
  584. package/docs/data-and-telemetry.md +0 -227
  585. package/docs/migration/release-notes/0.9.0-beta.60.md +0 -19
  586. /package/dist/sources/{wiki-fetchers → snapshot-fetchers}/registry.js +0 -0
  587. /package/dist/sources/{wiki-fetchers → snapshot-fetchers}/youtube.js +0 -0
@@ -0,0 +1,844 @@
1
+ # Migrating from akm 0.8.x to 0.9.0
2
+
3
+ 0.9.0 is the format-neutral **bundle / adapter** refactor. It replaces the flat
4
+ asset-type registry with per-format adapters, adopts one canonical ref grammar,
5
+ consolidates the durable databases and config, and completes several 0.8-era
6
+ deprecations (the CLI aliases and the `vault` asset type). This guide is
7
+ ordered the way you'll need it:
8
+
9
+ > **Heads-up on the 0.9.x series:** 0.9.x is a refactoring and clean-up
10
+ > series — patch releases may include further breaking changes (each with a
11
+ > CHANGELOG migration note) until the remaining technical debt is paid off.
12
+ > The 0.10.x series returns to bug fixes and tuning with the normal
13
+ > breaking-changes-only-in-major/minor discipline. See STABILITY.md.
14
+
15
+ 1. [Cross the boundary: `akm migrate status` / `akm migrate apply`](#1-cross-the-boundary-akm-migrate-status--akm-migrate-apply)
16
+ 2. [Ref grammar: `type:name` → `[bundle//]conceptId`](#2-ref-grammar-typename--bundleconceptid)
17
+ 3. [Removed surfaces](#3-removed-surfaces)
18
+ 4. [Behavioral notes](#4-behavioral-notes), including
19
+ [Engine And Task Assets](#engine-and-task-assets) config migration
20
+ 5. [Troubleshooting](#5-troubleshooting)
21
+
22
+ The durable-state re-key, database merge, and config migration are handled by
23
+ the journaled, crash-resumable `akm migrate apply` coordinator. It also rewrites
24
+ legacy `workflow:` target refs in valid 0.8 task files after resolving them
25
+ against their containing/configured bundle while preserving each YAML file's
26
+ permission mode; it does not translate profile-based configuration or workflow
27
+ definitions automatically. Create the recovery backup
28
+ before changing a live installation, then migrate other affected assets deliberately.
29
+
30
+ ## 1. Cross the boundary: `akm migrate status` / `akm migrate apply`
31
+
32
+ `akm migrate apply` is the one command that performs the 0.8 → 0.9 cutover.
33
+ It:
34
+
35
+ - Converts config from the flat `stashDir` / `sources` / `installed` /
36
+ `wikiName` keys to a `bundles` map keyed by each source's stable id, plus
37
+ `defaultBundle` naming the primary writable bundle. Bundle ids are derived
38
+ from the existing `registryId` / path slug, so no second identity migration
39
+ happens. After the cutover, the retired keys are **hard-rejected** by the
40
+ 0.9.0 config schema whenever present — a config still carrying them fails to
41
+ load with an error naming `akm migrate apply`
42
+ (`src/core/config/config-schema.ts`). Registry-installed bundles keep only
43
+ their desired locator (`git`/`npm` + `registryId`) in config; resolved cache
44
+ paths and revisions live exclusively in the lockfile.
45
+ - Folds the former `workflow.db` into `state.db`, taking the database count
46
+ from four to three: `state.db` (durable workspace state), `index.db` (the
47
+ fully regenerable search cache), and a separate `logs.db`.
48
+ - Folds `.stash.json` sidecars into the new layout and applies the AKM adapter's
49
+ D-R6 reserved-filename renames (`index.md` / `log.md` at any AKM stash depth
50
+ are now reserved structural files — see
51
+ [§2](#2-ref-grammar-typename--bundleconceptid)).
52
+ - Imports any pre-0.9 filesystem proposals into `state.db` as part of the same
53
+ apply — this is no longer a separate step.
54
+ - Re-keys every durable ref (usage/feedback events, proposal targets,
55
+ workflow/task targets, salience) to the new `[bundle//]conceptId` spelling.
56
+ Refs embedded in your own asset bodies are rewritten by the content
57
+ migration; unresolvable refs are quarantined, not dropped: the audit summary
58
+ lands in `legacy_state` (surface, ref, row count) and the complete original
59
+ rows are preserved as JSON in `legacy_state_rows` in the migrated
60
+ `state.db`, so nothing the migration cannot re-key is destroyed.
61
+
62
+ ### The 0.8 binary cannot do this
63
+
64
+ The 0.8 binary does not contain `akm migrate` or the `upgrade
65
+ --migration-config` contract. Do not attempt to invoke either command with
66
+ 0.8, and do not use 0.8 self-update to cross this boundary. Use this
67
+ package-manager/manual boundary procedure instead:
68
+
69
+ 1. Stop AKM writers, schedulers, and workflow drivers.
70
+ 2. Prepare the complete 0.9 config in a separate file. Do not replace the live
71
+ 0.8 config; AKM cannot infer names when old LLM and agent profiles collide.
72
+ 3. Take an independent filesystem backup of the live 0.8 `config.json`,
73
+ `state.db`, and `workflow.db` (including any SQLite `-wal`/`-shm` files).
74
+ Store it outside AKM's data directory and verify it before continuing.
75
+ 4. Install 0.9 with the package manager, or download, checksum, and stage the
76
+ 0.9 standalone binary. A package-manager install replaces the managed 0.8
77
+ package; a standalone operator should retain the old executable. Keep the
78
+ independent data backup in either case.
79
+ 5. Invoke the newly installed or staged 0.9 binary, whose migration startup
80
+ bypass can read the old installation without loading its config normally.
81
+ 6. After apply succeeds, run `akm task sync --rebind` with that same 0.9 binary
82
+ before restarting schedulers. The explicit rebind replaces 0.8 native
83
+ scheduler definitions with current context-bound invocations.
84
+
85
+ Package-manager installation examples for step 4:
86
+
87
+ Package-manager installs require Node.js >= 22. If Bun >= 1.0 is also on
88
+ `PATH`, the installed launcher prefers Bun after Node.js bootstraps it.
89
+
90
+ ```sh
91
+ npm install -g akm-cli@0.9.0
92
+ # or: pnpm add -g akm-cli@0.9.0
93
+ ```
94
+
95
+ Commands for steps 5 and 6:
96
+
97
+ ```sh
98
+ # Package-manager install: this `akm` is now the 0.9 binary.
99
+ akm migrate status --config ./prepared-0.9.json
100
+ akm migrate apply --config ./prepared-0.9.json --dry-run
101
+ akm migrate apply --config ./prepared-0.9.json
102
+ akm task sync --rebind
103
+
104
+ # Or invoke a checksummed staged standalone binary explicitly.
105
+ ./akm-0.9 migrate status --config ./prepared-0.9.json
106
+ ./akm-0.9 migrate apply --config ./prepared-0.9.json
107
+ ./akm-0.9 task sync --rebind
108
+ ```
109
+
110
+ Status and dry-run perform the same read-only eligibility checks and report the
111
+ source config plus target config explicitly. Apply validates the target in
112
+ memory, creates a verified recovery run, applies pending `state.db` and
113
+ `workflow.db` migrations one transaction at a time, and atomically installs the
114
+ prepared config last. If any later artifact fails, apply restores config and
115
+ both databases from the verified run before returning. Each artifact is
116
+ classified independently, so a current config with pre-cutover databases can be
117
+ recovered safely.
118
+
119
+ Apply records durable `prepared`, `state-converting`, `state-collapsing`,
120
+ `state-applied`, `workflow-applied`, `cutover-applied`, `config-applied`, `tasks-prepared`, `tasks-applied`,
121
+ `pilot-prepared`, `pilot-applied`, `rollback-prepared`, and `committed` phases. Every phase stores
122
+ streaming size/SHA fingerprints for config, both databases, and SQLite sidecars;
123
+ a pre-cutover resume or rollback first requires the exact live generation.
124
+ State schema migration and the `state-converting` marker commit together; the
125
+ marker binds a canonical logical digest before the journal records the exact
126
+ physical `state-collapsing` generation. A marker-write crash is recoverable only
127
+ when that digest still matches. Once the journal is bound, any later WAL frame
128
+ fails closed; a nonexact generation is accepted only after the raw database
129
+ header proves the WAL-to-DELETE collapse completed and the logical digest still
130
+ matches. After a process
131
+ crash, ordinary config and canonical database access fail closed; `akm migrate
132
+ status` reports the pending phase and `akm migrate apply` resumes idempotently
133
+ from the retained target and verified backup. Apply also refuses before backup
134
+ while managed database handles, maintenance activities, AKM mutation locks, or
135
+ workflow claims are live.
136
+
137
+ A journal at `state-applied` or `workflow-applied` is authenticated by raw
138
+ artifact fingerprints before AKM opens live SQLite files. An exact journal is
139
+ durably rewound through `state-converting`; a nonexact journal fails closed
140
+ without probing WAL state. A journal at `cutover-applied` or any later
141
+ forward-only phase is instead authenticated by the same operation's committed
142
+ cutover ledger row, continuing from its recorded phase without requiring the
143
+ `state-converting` marker; physical WAL differences are retained rather than
144
+ rolled back. A post-cutover journal without that operation-bound marker fails
145
+ closed.
146
+
147
+ Once already running a contract-capable 0.9 release, future self-upgrades may
148
+ pass a prepared target through the coordinated upgrade path:
149
+
150
+ ```sh
151
+ akm upgrade --migration-config ./prepared-0.9.json
152
+ ```
153
+
154
+ This command is not the 0.8-to-0.9 procedure. The already-installed 0.8 binary
155
+ cannot contain or enforce safeguards added in 0.9, so operators must follow the
156
+ manual boundary above rather than relying on 0.8 self-update. For 0.9+ upgrades,
157
+ the current binary preflights only its current artifact state; it does not parse
158
+ a prepared config for the future release. After installation, only the new
159
+ binary receives `--config` during apply. If the active config is already current,
160
+ no migration-config flag is needed.
161
+
162
+ Recovery runs are stored under
163
+ `$DATA/backups/migrations/<installation-id>/<run-id>/`. They record present and
164
+ absent `config.json`, `state.db`, and `workflow.db` artifacts, ordered migration
165
+ ledgers, sizes, and streaming SHA-256 hashes. SQLite snapshots must also pass
166
+ `PRAGMA quick_check` and ledger-prefix validation before the manifest is
167
+ published. `akm-migrate backup --for 0.9.0` creates an additional unique run when
168
+ an operator wants a manual snapshot. Routine config writes, telemetry, and
169
+ already-current database opens do not depend on any historical run.
170
+
171
+ ## 2. Ref grammar: `type:name` → `[bundle//]conceptId`
172
+
173
+ Refs are now subdir-qualified concept ids inside their bundle —
174
+ `skills/code-review`, `memories/vpn-note`, `knowledge/api-guide`, `env/prod`,
175
+ `secrets/deploy-token` — with an optional `bundle//` installation prefix and an
176
+ optional `#fragment`. Durable state stores the fully-qualified
177
+ `bundle//conceptId`; the short bundle-omitted form is accepted input only (CLI,
178
+ API, and inside bundle content), resolved against `defaultBundle` and then
179
+ installation-priority order.
180
+
181
+ Before / after:
182
+
183
+ | 0.8.x | 0.9.0 |
184
+ | --- | --- |
185
+ | `skill:code-review` | `skills/code-review` |
186
+ | `memory:vpn-note` | `memories/vpn-note` |
187
+ | `origin//knowledge:api-guide` | `origin//knowledge/api-guide` |
188
+ | `vault:prod` | `env/prod` (see [§3](#3-removed-surfaces)) |
189
+
190
+ **There is no compatibility parser.** The pre-0.9.0 `[origin//]type:name`
191
+ grammar is removed from every normal code path; it survives only inside the
192
+ migrator (`scripts/akm-migrate/migrate/legacy-ref-grammar.ts`) for reading
193
+ pre-cutover data.
194
+ `akm migrate apply` re-keys every durable ref to the new spelling, and refs
195
+ embedded in your own asset bodies are rewritten by the content migration — but
196
+ any prompt, `AGENTS.md`, or doc that still spells refs in the old `type:name`
197
+ form must be updated by hand. A code-review skill is now `skills/code-review`.
198
+ See `STABILITY.md` for the full contract.
199
+
200
+ `index.md` and `log.md` are also now reserved by the AKM adapter at every stash
201
+ depth — never indexed as items and never valid item-write targets. This matches
202
+ OKF's structural names but is an AKM format rule, not an assertion that the
203
+ stash is an OKF bundle. Existing stash files with those names are excluded from
204
+ the index and renamed by the content migration if they hold a real item.
205
+
206
+ ## 3. Removed surfaces
207
+
208
+ ### `akm wiki` → a bundle format, not a command family
209
+
210
+ 0.9.0 removes the entire `akm wiki` verb family (`create`, `register`, `list`,
211
+ `show`, `remove`, `pages`, `search`, `stash`, `lint`, `ingest`) and the `wiki`
212
+ asset type. The Karpathy-style LLM wiki structure stays first-class, but as a
213
+ **bundle format** owned by the `llm-wiki` adapter instead of a bespoke command
214
+ surface: `schema.md` (the per-wiki rulebook) + `pages/` (agent-authored pages)
215
+ at a bundle's root is enough for the indexer to recognize and lint it like any
216
+ other bundle. `raw/`, `index.md`, and `log.md` stay reserved infrastructure.
217
+
218
+ There is no `akm wiki ...` compatibility shim — an installed non-akm wiki
219
+ directory reclassifies under the `llm-wiki` adapter on your next `akm index`
220
+ (see [adapter dispatch reclassification](#4-behavioral-notes)); wiki pages are
221
+ found through `akm search`/`akm show` like any other asset, and lint runs
222
+ through `akm lint`.
223
+
224
+ ### `akm vault` → `env` / `secret`
225
+
226
+ 0.9.0 also removes the deprecated `vault` asset type. Its replacement, the `env`
227
+ asset type, shipped in 0.8.0 alongside a deprecation shim and an automatic
228
+ `vaults/` → `env/` migration. This section explains what changed, how to
229
+ migrate, and what 0.9.0 removes.
230
+
231
+ > **TL;DR:** In 0.8.0, run the migration (`akm-migrate storage --yes`) to copy
232
+ > `vaults/` → `env/`, then switch your scripts from `akm vault …` to
233
+ > `akm env …` and from `source "$(akm vault path …)"` to
234
+ > `akm env run <name> -- <command>` (or `-- $SHELL` for an interactive
235
+ > session). Everything keeps working through 0.8.x; the `vault` verb and
236
+ > `vault:` refs are removed in 0.9.0.
237
+
238
+ #### Why `vault` → `env`
239
+
240
+ The old `vault` type managed individual `KEY=value` entries: `vault set`,
241
+ `vault unset`, comment management, and bespoke value quoting. That hand-rolled
242
+ write surface was the riskiest part of the feature. 0.8.0 simplifies the model
243
+ and splits it by **purpose**:
244
+
245
+ - **`env`** — a group of related **configuration** for an app/service (URLs,
246
+ flags, and any credentials it needs) in one `.env` file, sourced or injected
247
+ **wholesale**. Values may or may not be sensitive — all are protected. akm no
248
+ longer edits entries; you edit the file with your own editor and akm loads it.
249
+ - **`secret`** — a single **sensitive value** used on its own for authentication
250
+ (one file = one value: a token, key, or cert), for the cases where
251
+ `vault set <ref> <KEY>` was used to store one credential.
252
+
253
+ Both protect values identically (never written to stdout, the index, or any
254
+ structured output); env additionally surfaces key names for discoverability
255
+ (comment text is never surfaced — comments can contain commented-out
256
+ credentials). Pick `env` for configuration, `secret` for a standalone
257
+ authentication credential.
258
+
259
+ #### What the `vault` split became
260
+
261
+ The mapping (right column is the current 0.9.0 world):
262
+
263
+ | Area | old `vault` world | now (0.9.0) |
264
+ | --- | --- | --- |
265
+ | Asset type | `vault` | `env` (whole group) / `secret` (single value) |
266
+ | Directory | `vaults/` | `env/` and `secrets/` (`vaults/` frozen after migration) |
267
+ | Ref | `vault:prod` | `env/prod` / `secrets/<name>` (the `vault:` prefix is removed) |
268
+ | Shell load | `source "$(akm vault path …)"` | `akm env run prod -- $SHELL` (or `export --out <file>` then source) |
269
+ | Run | `akm vault run vault:prod[/KEY] -- …` | `akm env run prod [--only K] -- …` |
270
+ | Set one value | `akm vault set vault:prod KEY` | `akm secret set <name>` (or edit the `.env`) |
271
+ | Ingest a `.env` | (hand-copy into `vaults/`) | `akm env create prod --from-file ./.env` |
272
+ | Delete | (hand-delete the file) | `akm env remove prod` |
273
+ | Renderer | `vault-env` | `env-file` |
274
+ | Audit event | `vault_access` | `env_access` |
275
+
276
+ The `akm vault` verb still works in 0.8.x: it prints a stderr deprecation
277
+ warning and delegates `list` / `path` / `export` / `run` / `create` to the
278
+ `env` handlers. `vault set` / `vault unset` and the single-key
279
+ `vault run <ref>/KEY` form are **hard-errors** with a signpost — silent changes
280
+ to secret-handling behaviour are unacceptable.
281
+
282
+ #### Running the migration
283
+
284
+ The migration copies `<stash>/vaults/` → `<stash>/env/`. It is **copy, never
285
+ move**: the legacy `vaults/` tree is left intact as a frozen copy and a
286
+ `vaults/.migrated` marker is written so re-runs are no-ops.
287
+
288
+ ```sh
289
+ # Preview (no changes written)
290
+ akm-migrate storage --dry-run
291
+
292
+ # Apply
293
+ akm-migrate storage --yes
294
+
295
+ # From a source clone:
296
+ bun scripts/akm-migrate.ts storage --yes
297
+ ```
298
+
299
+ What the `vaults/ → env/` step does:
300
+
301
+ 1. Skips entirely if there is no `vaults/` directory, if the `.migrated` marker
302
+ already exists, or if `vaults/` contains no `.env` files (e.g. a fresh
303
+ install).
304
+ 2. Copies every file under `vaults/` into `env/` as **opaque bytes** (`.env`,
305
+ `.sensitive`, and `.lock` sidecars alike) — contents are never read or
306
+ re-serialised.
307
+ 3. **Never overwrites** an `env/` file you already authored (those are skipped
308
+ and preserved).
309
+ 4. Tightens permissions on the copied tree: `0600` files, `0700` directories,
310
+ then verifies the mode. (The generic copy helper checks size only, so this
311
+ pass guarantees migrated secret material does not land at the umask default.)
312
+ 5. Verifies the post-copy `.env` count is at least the source count, then writes
313
+ the `vaults/.migrated` marker.
314
+
315
+ After migrating, run `akm index` to refresh search so entries surface under
316
+ `env/…` rather than `vault:`.
317
+
318
+ #### Command mapping
319
+
320
+ ```sh
321
+ # List
322
+ akm vault list → akm env list # doclint:ignore (left side is the removed 0.8.x `vault` verb — this is the "Before" of the mapping)
323
+
324
+ # Inspect keys (values never shown)
325
+ akm show vault:prod → akm show env/prod
326
+
327
+ # Load values into a shell (use a subshell — safe, nothing on disk)
328
+ source "$(akm vault path vault:prod)" → akm env run prod -- $SHELL
329
+
330
+ # Run a command with the env injected
331
+ akm vault run vault:prod -- ./deploy.sh → akm env run prod -- ./deploy.sh # doclint:ignore (left side is the removed 0.8.x `vault` verb — this is the "Before" of the mapping)
332
+
333
+ # Create / ingest an existing .env
334
+ akm vault create prod → akm env create prod # doclint:ignore (left side is the removed 0.8.x `vault` verb — this is the "Before" of the mapping)
335
+ # or: akm env create prod --from-file ./.env
336
+
337
+ # Edit (akm no longer manages entries)
338
+ akm vault set vault:prod DB_URL → $EDITOR "$(akm env path prod --quiet)" # doclint:ignore (left side is the removed 0.8.x `vault` verb — this is the "Before" of the mapping)
339
+ # or: akm secret set db-url
340
+ ```
341
+
342
+ Existing `vault:` refs embedded in your own assets are **not** rewritten (akm
343
+ never mutates your content). They keep resolving through 0.8.x: the resolver
344
+ prefers `env/` and falls back to the frozen `vaults/` copy.
345
+
346
+ #### The safe load paths
347
+
348
+ `env path` prints the **raw** file path. Do **not** `source` it: a hand-edited
349
+ or migrated `.env` containing `X=$(rm -rf ~)` would execute on `source`.
350
+
351
+ - **Processes / agents / interactive** — `akm env run prod -- <cmd>` (or
352
+ `-- $SHELL`). Values go straight into the child process, never through a shell
353
+ and never onto stdout. **This is the only path safe for AI agents** —
354
+ `env export`/`env path` put value-bearing data where a captured context would
355
+ ingest it.
356
+ - **A sourceable file** (a tool that must `source` a script) — `akm env export
357
+ prod --out <file>` writes single-quote-escaped `export KEY='value'` lines
358
+ to a file (mode 0600); the values are re-serialised so sourcing it can never
359
+ execute a substitution. `export` never prints values to stdout, so it requires
360
+ `--out`.
361
+ - **Docker `_FILE` / `--env-file`** — `akm env path prod --quiet` prints the
362
+ raw file path for tools that read it themselves.
363
+
364
+ #### Single values are now secrets
365
+
366
+ If you used `vault set <ref> <KEY>` to store a single credential, store it as a
367
+ [secret](../reference/cli.md#secret) instead:
368
+
369
+ ```sh
370
+ printf '%s' "$TOKEN" | akm secret set deploy-token
371
+ akm secret run deploy-token GITHUB_TOKEN -- gh release create v1.0.0
372
+ ```
373
+
374
+ `akm env run` injects the **whole** file; the single-key `vault run <ref>/KEY`
375
+ form was removed because silently changing which variables a child process sees
376
+ is a security-relevant behaviour change.
377
+
378
+ #### What 0.9.0 removes
379
+
380
+ - The entire `akm vault` verb and its subcommands.
381
+ - The `vault:` ref alias. Parsing a `vault:` ref now fails immediately with:
382
+ `The \`vault\` asset type was removed in 0.9.0 — use \`env/\` (whole .env
383
+ config) or \`secrets/\` (a single value).`
384
+ - The `vault` asset-spec entry, renderer (`vault-env`), and the `vault_access`
385
+ audit-event alias.
386
+ - The frozen `vaults/` directory is deleted **only** after explicit per-path
387
+ confirmation — the migration never auto-removes it.
388
+
389
+ Switch to `akm env` / `akm secret` and the `akm env run <name> -- <cmd>`
390
+ idiom before upgrading to 0.9.0.
391
+
392
+ ##### If you upgraded straight to 0.9.0 without migrating
393
+
394
+ Because 0.9.0 removed the `vault` asset type, the indexer **no longer scans
395
+ `vaults/` at all**. If you jumped from 0.7/0.8 to 0.9.0 and never ran
396
+ `akm-migrate storage`, the `.env` data still sitting in `vaults/` was never
397
+ copied to `env/` and will **not** appear under `env/…` — it is silently
398
+ un-indexed (the files themselves are untouched on disk).
399
+
400
+ The 0.9 runtime does not inspect the retired `vaults/` tree. Use the standalone
401
+ migration tool to detect and copy any remaining files; it owns the
402
+ `vaults/.migrated` marker and remains idempotent and non-destructive:
403
+
404
+ ```sh
405
+ akm-migrate storage --yes # copies vaults/ -> env/, leaving vaults/ intact
406
+ akm index # refresh search so entries surface under env/
407
+ ```
408
+
409
+ The `vaults/ → env/` migration step still ships in 0.9.0's
410
+ `akm-migrate storage` (it is part of the `0.8 → 0.9` migration) precisely so a
411
+ late migration on a 0.9.0 install still works.
412
+
413
+ #### Verifying the migration
414
+
415
+ ```sh
416
+ # env/ now contains your former vault files
417
+ akm env list
418
+
419
+ # The frozen copy + marker are present
420
+ ls -la "$(akm info --format=json | jq -r .bundleDir)/vaults/.migrated"
421
+
422
+ # Values still never leak
423
+ akm show env/prod # key names only
424
+ akm search <a-secret-value> # no hits
425
+ ```
426
+
427
+ #### Rolling back the vault copy
428
+
429
+ The migration is non-destructive — `vaults/` is untouched. To roll back, delete
430
+ the generated `env/` directory and remove the `vaults/.migrated` marker, then
431
+ downgrade akm. Because `env/` is a copy, no data is lost either way.
432
+
433
+ ### Removed `--auto-accept` on `akm improve`
434
+
435
+ The 0.9.0 confidence gate `--auto-accept` used to configure was deleted:
436
+ proposals now queue for review (`akm proposal` / the drain engine) instead of
437
+ being auto-promoted by threshold. Through 0.9.x, `--auto-accept` is accepted
438
+ only as a compatibility flag: akm warns that it is removed and ignored, and
439
+ discards a space-separated value. Remove it from task definitions and scripts;
440
+ it becomes a hard error in 0.10. See [proposal triage](#4-behavioral-notes) for
441
+ the explicit replacement.
442
+
443
+ ### Retired `--wiki` flag
444
+
445
+ `akm import`'s 0.8.x `--wiki <name>` flag (route content into
446
+ `wikis/<name>/raw/` instead of `knowledge/`) is removed along with the rest of
447
+ the `akm wiki` surface. `akm import` always writes into `knowledge/` (use
448
+ `--path` for a subdirectory); use the `llm-wiki` bundle format directly
449
+ (`pages/`, `raw/`) if you still want wiki-shaped content.
450
+
451
+ ### Removed `--min-retrieval-count`
452
+
453
+ `akm improve`'s `--min-retrieval-count` flag and the `minRetrievalCount` option
454
+ configured the P0-A high-retrieval fallback lane, which was deleted along with
455
+ several other improve-loop lanes (self-consistency, multi-cycle, exploration
456
+ budget). There is no replacement flag — retrieval-count signal still feeds
457
+ ranking, just not through a dedicated eligibility fallback. Drop the flag from
458
+ any scripted `akm improve` invocations.
459
+
460
+ ### `akm mv` → move the file, then `akm index`
461
+
462
+ 0.9.0 removes `akm mv` outright — no alias, no stub; `akm mv …` fails with the
463
+ standard unknown-command error. A rename **is** delete plus create in akm's
464
+ identity model (see [`STABILITY.md`](../../STABILITY.md) § Renames), and the
465
+ command's inbound-ref rewrite matched bare conceptIds rather than anchored
466
+ `bundle//conceptId` refs, so it could edit ordinary prose while leaving real
467
+ refs dangling. The supported procedure is three steps you can see the results
468
+ of:
469
+
470
+ ```sh
471
+ mv ~/akm/memories/projectA/old-note.md ~/akm/memories/projectA/new-note.md
472
+ akm index # the new path is indexed; the old entry drops out
473
+ akm lint # reports every inbound ref the rename left dangling
474
+ ```
475
+
476
+ Fix the refs `akm lint` reports (its `missing-ref` check covers body prose and
477
+ the frontmatter xref channels) and re-run `akm lint` until it is clean.
478
+ Cross-bundle movement is copy/import plus delete — never identity-preserving.
479
+
480
+ **Optional: carry the ranking signal over.** The destination gets a fresh
481
+ identity, so its accumulated signal — feedback, usage events, salience and
482
+ outcome history — stays keyed to the old ref and is eventually collected as
483
+ orphan rows. If the asset has earned history worth keeping, run the re-key
484
+ script from a source clone **before** `akm index`:
485
+
486
+ ```sh
487
+ mv ~/akm/memories/projectA/old-note.md ~/akm/memories/projectA/new-note.md
488
+ bun scripts/rekey-asset-ref.ts memories/projectA/old-note memories/projectA/new-note
489
+ akm index && akm lint
490
+ ```
491
+
492
+ Add `--dry-run` to see the row counts it would move. It refuses if both files
493
+ exist (that is a copy, not a rename), and it is idempotent — a second run
494
+ reports zero changed rows. See
495
+ [the 0.9.0 troubleshooting guide](v0.9.0-troubleshooting.md) for the symptom
496
+ this fixes after the fact.
497
+
498
+ ## 4. Behavioral notes
499
+
500
+ ### Adapter dispatch reclassification (installed non-akm bundles)
501
+
502
+ The indexer now dispatches each installed bundle's *detected* adapter (Claude
503
+ tool dirs, LLM wikis, website snapshots, agent-skills packs, …) instead of
504
+ recognizing everything with the akm-stash adapter. Entries in such bundles
505
+ change type and ref spelling to the owning adapter's own scheme the first time
506
+ you reindex after upgrading. **No action needed** — the index is a
507
+ regenerable cache and rebuilds itself — but searches or saved refs into those
508
+ bundles may resolve to the new spellings afterwards. Reindex with `akm index`
509
+ right after the cutover so this settles before you rely on saved refs.
510
+
511
+ ### `env`/`secret` writes now honor `--target` / `defaultWriteTarget`
512
+
513
+ Previously, `env create`/`set`/`unset`/`remove` and `secret set`/`remove`
514
+ selected a write destination independently of `--target` and
515
+ `defaultWriteTarget`, ignoring writability and git commit boundaries. 0.9.0
516
+ routes these mutations through the same `resolveWriteTarget` selection every
517
+ other write command uses: explicit `--target` wins, else `defaultWriteTarget`,
518
+ else the working stash — and a non-writable target is refused. A git-backed
519
+ writable target now lands the change in the same batch-at-boundary commit as
520
+ any other write (see [below](#single-batch-at-boundary-git-commit)). Reads
521
+ (`env run`/`show`/`list`/`path`/`export`, `secret run`/`path`/`list`) are
522
+ unaffected — they still search every configured source.
523
+
524
+ ### LLM enrichment concurrency defaults
525
+
526
+ Indexing's LLM enrichment pool now defaults its concurrency from the
527
+ configured LLM endpoint instead of always assuming a remote API: a **local**
528
+ endpoint (`localhost`/`127.0.0.1`/`::1`/`*.localhost`) defaults to
529
+ **concurrency 1** (a single loaded model; parallel requests trigger reload
530
+ thrash), and a **remote** endpoint defaults to **concurrency 2** (enough to
531
+ overlap request latency without hammering rate-limited APIs).
532
+ `engines.<name>.concurrency` does not currently affect indexing enrichment;
533
+ it does cap frozen workflow fan-out.
534
+
535
+ ### CLI rename table (old → new, removed 0.9.0)
536
+
537
+ Every old spelling printed a stderr deprecation warning in 0.8.x (suppressed
538
+ under `--quiet`) and delegated to the canonical form. 0.9.0 removes the old
539
+ spellings entirely — there is no delegation, and using one is a usage error.
540
+
541
+ | Old spelling (0.8, deprecated) | Canonical (use this) | Notes |
542
+ | --- | --- | --- |
543
+ | `akm proposals` | `akm proposal list` | bare `akm proposal` is now a usage error (exit 2) |
544
+ | `akm show proposal <id>` | `akm proposal show <id>` | |
545
+ | `akm diff <id>` | `akm proposal diff <id>` | |
546
+ | `akm accept <id>` | `akm proposal accept <id>` | |
547
+ | `akm reject <id>` | `akm proposal reject <id>` | |
548
+ | `akm revert <id>` | `akm proposal revert <id>` | |
549
+ | `--detail summary` | `--shape summary` | `--detail` is now verbosity only (`brief\|normal\|full`) |
550
+ | `--detail agent` | `--shape agent` | |
551
+ | `--for-agent` | `--shape agent` | |
552
+ | `--source` (on `accept`/`reject`/`history`) | `--generator` | `search`/`curate`'s `--source` was separately replaced by `--from` in the 0.9.0 surface overhaul (see below); `remember`'s `--source` is a distinct memory-tagging field, not renamed; `graph` was removed in 0.9.0 |
553
+ | `akm save` | `akm sync` | `sync` = commit + optional push; adds `--no-push` |
554
+ | `akm enable <component>` | `akm registry add <url> --name <component>` | `akm config enable/disable` was also removed in 0.9.0 (it only ever toggled the skills.sh registry); use `akm registry add\|remove`, the general mechanism |
555
+ | `akm disable <component>` | `akm registry remove <component>` | |
556
+ | `akm events` | `akm log` | `log` is primary in 0.9.0; `history` is a different (asset-scoped) surface |
557
+ | `akm wiki remove --force` | (removed — see [§3](#3-removed-surfaces)) | the whole `akm wiki` family is gone in 0.9.0 |
558
+ | `akm feedback --note <text>` | `akm feedback --reason <text>` | |
559
+ | `akm workflow next --dry-run` | (removed) | the flag is gone; `next` never supported a dry run |
560
+
561
+ 0.9.0 retires the plural `akm tasks` spelling entirely (no alias): `akm task`
562
+ is the sole scheduling group. Its remaining subcommands are `add`, `run`,
563
+ `sync`, `doctor`, and `history`; `list`, `remove`, `init`, `enable`, and
564
+ `disable` are removed. `akm lessons` was removed outright (see
565
+ [§3](#3-removed-surfaces)).
566
+
567
+ ### CLI surface overhaul rename table (0.9.0, hard break)
568
+
569
+ A second, larger rename pass landed within 0.9.0 itself: a full CLI-surface
570
+ overhaul with no deprecation window and no aliases. Every old spelling below
571
+ fails immediately with the standard unknown-command/unknown-flag error —
572
+ there was no 0.8.x warn-and-delegate period for these.
573
+
574
+ | Old spelling | New spelling / replacement | Notes |
575
+ | --- | --- | --- |
576
+ | `akm init` | `akm bundle create` | |
577
+ | `akm add` | `akm bundle add` | |
578
+ | `akm list` | `akm bundle list` | |
579
+ | `akm remove` | `akm bundle remove` | |
580
+ | `akm update` | `akm bundle update` | |
581
+ | `akm extract` | `akm proposal extract` | |
582
+ | `akm propose` | `akm proposal new` | |
583
+ | `akm registry search` | `akm search --from registry` | `--assets` folds in too |
584
+ | `akm tasks ...` | `akm task add\|run\|sync\|doctor\|history` | singular group; no plural alias; `list`, `remove`, `init`, `enable`, and `disable` are removed |
585
+ | `akm lessons` / `akm lesson` (command group) | (removed) | the `lesson` asset **type** is unaffected — read/write it via `akm search`/`akm show`/the proposal queue |
586
+ | `akm history` | (removed) | `--accept-rate-by-source` folded into `akm health --report` |
587
+ | `akm log tail` | `akm log --since '@offset:<id>'` | poll from a cooperating process; no daemon |
588
+ | `akm graph ...` (command group) | (removed) | summary counts (entities/relations/extraction coverage) folded into `akm health`; the extraction engine and `akm show`'s related-paths are unaffected |
589
+ | `akm mv` | (removed — see [§3](#akm-mv--move-the-file-then-akm-index)) | plain filesystem move → `akm index` → `akm lint`; optionally `bun scripts/rekey-asset-ref.ts <old> <new>` first to carry feedback/usage signal across the rename |
590
+ | `akm workflow template` | `akm workflow create --print` | prints the template without writing |
591
+ | `akm workflow validate` | `akm lint --type workflows --fail-on-flagged` | plain `lint` exits 0 regardless of findings — keep `--fail-on-flagged` in CI gates to preserve the old non-zero-on-invalid semantics |
592
+ | `akm workflow watch <run-id>` | `akm log --run <run-id> --since '@offset:<id>'` | |
593
+ | `akm extract --watch` / `--debounce-ms` | (removed) | use the shipped `core/extract.yml` cron template instead of a foreground daemon |
594
+ | `akm improve canary` / `--refresh` | `bun scripts/refresh-canary-set.ts [--refresh]` | maintainer tooling, run from a source checkout — helper scripts are not shipped in the npm package or binaries |
595
+ | `akm config show` | `akm config list` | `show` was a self-declared alias |
596
+ | `akm config validate` | (removed) | load-time schema checks already reject an invalid config |
597
+ | `akm index --background` | (removed) | the flag never actually backgrounded the process |
598
+ | `akm setup --detect-only` / `--reset-recommended` | (removed) | environment detection runs inside `akm setup`; `akm info` reports the *configured* capabilities, not a detection scan |
599
+ | `akm env set` / `akm env unset` | (removed) | edit the `.env` file directly, or ingest one with `env create --from-file` |
600
+ | `--source` on `search` / `curate` | `--from` | value rename too: `stash` → `local`, `both` → `all` |
601
+ | `--target` on `remember` / `clone` / `improve` / `task add`/`run`/`sync`/`history` | `--bundle` | `import` and `proposal accept`/`diff`/`revert` **keep** `--target` |
602
+ | `AKM_STASH_DIR` | `AKM_BUNDLE_DIR` | no fallback to the old name |
603
+ | JSON field `stashDir` | `bundleDir` | in command results (`akm info`, `akm bundle create`, `akm config path --all`'s `stash` key → `bundle`); internal DB columns and type names are unaffected |
604
+ | "stash" wording in help text, hints, and docs | "bundle" | user-visible surface only — internal identifiers, DB schema, and historical CHANGELOG/release-notes text are unaffected |
605
+
606
+ **Scheduler ABI respelling.** Installed cron/launchd/schtasks entries invoke
607
+ `akm task run <id> ... --scheduled` (previously a `tasks` spelling on some
608
+ installs). `akm task sync` detects an entry whose argv no longer parses under
609
+ the current spelling — treating it as an orphan of its marker id — and
610
+ reinstalls it from the current file state. Run `akm task sync --rebind` once
611
+ after upgrading to 0.9.0 to explicitly capture the current binary/invocation
612
+ in every installed scheduler entry; see [§1](#1-cross-the-boundary-akm-migrate-status--akm-migrate-apply).
613
+
614
+ ### Safety guards added in 0.8 (behavior change for non-interactive callers)
615
+
616
+ Two previously-unguarded destructive paths confirm before acting. **Scripts
617
+ that invoke these non-interactively must add `-y` / `--yes`:**
618
+
619
+ - `akm registry remove <name>` — prompts before removing the registry; pass `-y`
620
+ to skip. Non-interactive use without `-y` aborts.
621
+ - `akm proposal accept --generator <g>` (the **bulk** form) — prompts before
622
+ promoting every matching proposal. Single-id accept is unchanged (revertable).
623
+
624
+ ### Proposal triage replaces the `process-proposals` prompt task
625
+
626
+ Move a 0.8 triage process into the selected 0.9 improve strategy. The folded
627
+ pre-pass remains the recommended shape:
628
+
629
+ ```jsonc
630
+ {
631
+ "improve": {
632
+ "strategies": {
633
+ "default": {
634
+ "processes": {
635
+ "triage": {
636
+ "enabled": true,
637
+ "applyMode": "queue",
638
+ "policy": "personal-stash"
639
+ }
640
+ }
641
+ }
642
+ }
643
+ }
644
+ }
645
+ ```
646
+
647
+ If a separate schedule is required, replace the old agent prompt task with a
648
+ strict task YAML v2 command:
649
+
650
+ ```yaml
651
+ version: 2
652
+ schedule: "20 * * * *"
653
+ command: akm proposal drain --policy personal-stash --yes
654
+ enabled: true
655
+ name: Drain AKM proposal queue
656
+ ```
657
+
658
+ Task files live in your stash. Migration rewrites only legacy workflow-target
659
+ ref scalars; it does not convert an arbitrary prompt task into this command. The
660
+ deterministic `akm proposal drain` verb, or the folded strategy pre-pass, is the
661
+ supported 0.9 path.
662
+
663
+ ### Single batch-at-boundary git commit
664
+
665
+ 0.9.0 unifies the two commit models for git-backed sources onto a single
666
+ **batch-at-boundary** model (issue #507). Previously, writing an asset to a
667
+ writable git `--target` committed (and optionally pushed) **per asset**, gated
668
+ on `options.pushOnCommit`. That staged only the single asset file (leaving
669
+ `.akm/` state dirty) and produced one noisy commit per asset.
670
+
671
+ Now every write/delete to a source is a plain filesystem operation with **no**
672
+ per-asset commit. Git-backed targets are committed **once** at the end of the
673
+ operation (e.g. `akm remember --bundle <git-source>`, proposal accept/revert,
674
+ consolidate) as a single complete commit (`git add -A` staging `.akm/` + assets
675
+ together), pushed under the same `writable + remote` gate as `akm save`/`akm sync`.
676
+
677
+ **Migration:** `options.pushOnCommit` is rejected at config load. Remove it
678
+ from your source config and rely on `writable: true` (plus a configured remote)
679
+ to push. A writable git target with a remote is still pushed; a target without
680
+ a remote (or with push disabled) commits only.
681
+
682
+ ## Engine And Task Assets
683
+
684
+ Replace `profiles.llm.<name>` and `profiles.agent.<name>` with one
685
+ `engines.<name>` map. Replace `defaults.llm`, `defaults.agent`, and
686
+ `defaults.improve` with `defaults.llmEngine`, `defaults.engine`, and
687
+ `defaults.improveStrategy`. Replace `profiles.improve.<name>` with
688
+ `improve.strategies.<name>`, process `mode`/`profile` with `engine`, and CLI
689
+ `--profile` with `--strategy` for improve or `--engine` for execution.
690
+
691
+ Do not reuse a colliding LLM and agent profile name without deciding which new
692
+ engine names make the distinction clear. AKM cannot safely infer that choice.
693
+
694
+ Task files use strict YAML v2. During `migrate apply`, valid 0.8 task files are
695
+ rewritten on disk to v2. The standalone migrator canonicalizes workflow refs,
696
+ moves prompt `profile:` to `engine:`, normalizes permissive scalar forms, maps
697
+ bare-current-AKM `improve --profile` to `--strategy`, and removes the retired
698
+ `--auto-accept` argument. The 0.9 runtime does not read v1 task files:
699
+
700
+ ```yaml
701
+ version: 2
702
+ schedule: "@daily"
703
+ prompt: Review the previous day's changes.
704
+ engine: reviewer
705
+ model: claude-sonnet-4-6
706
+ timeoutMs: 600000
707
+ enabled: true
708
+ ```
709
+
710
+ Prompt tasks may use `engine`, `model`, `timeoutMs`, and `llm`; command tasks
711
+ may use `timeoutMs`; workflow tasks may use `params`. Unknown and wrong-target
712
+ keys are errors in v2. Unsupported versions are reported by current task
713
+ commands. Migration changes only removed AKM spellings; arbitrary shell
714
+ commands are never rewritten.
715
+
716
+ For 0.8 command tasks, syntax migration and self-invocation routing are separate.
717
+ `--profile` is lowered only for a PATH-selected bare `akm`/`akm.exe`, including
718
+ when it follows supported `env` options and assignments. The scanner recognizes
719
+ citty-valid global forms before `improve`, including `--no-quiet`,
720
+ `--no-verbose`, `--quiet=false`, `--verbose=false`, and value options such as
721
+ `--format json`. An explicit `./akm`, `/opt/vendor/akm`, or other executable path
722
+ is operator-owned: it keeps selecting that exact binary and its command argv is
723
+ retained exactly. In particular, AKM does not change syntax sent to a retained
724
+ 0.8 binary. Version-2 commands receive no compatibility rewriting.
725
+
726
+ The published 0.8 core `backup.yml` is a special unsafe definition. It was
727
+ enabled and ran `akm db backups`, but that command only listed snapshots; it did
728
+ not create a recurring backup. The standalone migrator disables the exact bare
729
+ `akm db backups` task while preserving its command for operator review. An
730
+ explicit executable path is operator-owned and is not changed. Replace or remove
731
+ the disabled task; use `akm-migrate backup --for 0.9.0` for an explicit migration
732
+ recovery snapshot. Existing 0.8 data-directory backup folders are left
733
+ untouched.
734
+
735
+ Task `enabled` state controls scheduler-originated execution, not explicit
736
+ operator invocation. `akm task run <id>` intentionally runs a disabled task so
737
+ manual catch-up definitions remain useful. Backend-generated invocations carry
738
+ the internal `--scheduled` marker and record a `disabled` result without running
739
+ the target. Do not use the manual command as a scheduler replacement.
740
+
741
+ Canonical task IDs contain only letters, digits, dots, underscores, and dashes,
742
+ start with a letter or digit, are at most 228 characters, omit `.yml`/`.yaml`,
743
+ and cannot use Windows device aliases such as `CON`, `NUL`, `COM1`, or `LPT1`
744
+ (including aliases followed by a dot). The 228-character limit is the final
745
+ portable bound after scheduler and filename overhead. These portability checks
746
+ apply on every platform. For command-line compatibility only, a trailing
747
+ lowercase `.yml` or legacy `.md` is stripped from an ID; a filename discovered
748
+ under `tasks/` must already be canonical and is never renamed. Sync skips a
749
+ non-portable file and disables any matching installed entry rather than guessing
750
+ a replacement ID.
751
+
752
+ Canonical migration preserves 0.8 `state.db` task-history rows and their log
753
+ paths. One historical detail cannot be recovered: published 0.8.14 stored
754
+ command-task history with `target_kind=prompt`. Because the durable row contains
755
+ no command marker, 0.9 preserves and exposes it as legacy prompt history rather
756
+ than inventing a command classification. New runs use the correct target kind.
757
+
758
+ ## 5. Troubleshooting
759
+
760
+ ### "Cannot convert state.db out of WAL mode for migration"
761
+
762
+ `akm migrate apply` fails with:
763
+
764
+ > Cannot convert state.db out of WAL mode for migration — another akm process
765
+ > is holding it open. Close other akm processes and re-run `akm migrate apply`.
766
+
767
+ This means a live `akm` process (or a zombie connection from a prior crashed
768
+ one) still has `state.db` open in WAL mode, which blocks the checkpoint apply
769
+ needs to fold `workflow.db` in. Close every other `akm` process (schedulers,
770
+ `akm workflow run`, background `improve` runs) and re-run `akm migrate apply`
771
+ — it resumes from the last completed phase rather than starting over.
772
+
773
+ ### Resuming after a crash
774
+
775
+ If `akm migrate apply` is interrupted (killed, host crash, power loss), do not
776
+ manually edit or delete anything under `$DATA`. Run `akm migrate status` to
777
+ read the pending phase, then re-run `akm migrate apply` with the same
778
+ `--config` (or none, if the active config is already the target) — it
779
+ authenticates the retained target and verified backup by fingerprint and
780
+ resumes idempotently from the last durable phase (`prepared`, `state-converting`, `state-collapsing`, `state-applied`,
781
+ `workflow-applied`, `cutover-applied`, `config-applied`, `tasks-prepared`,
782
+ `tasks-applied`, `pilot-prepared`, `pilot-applied`, `rollback-prepared`, or `committed`). A
783
+ malformed or fingerprint-mismatched journal fails closed for operator
784
+ diagnosis instead of guessing.
785
+
786
+ ### Restoring or downgrading the cutover
787
+
788
+ Stop scheduled AKM jobs and all running `akm improve`, `akm extract`, and
789
+ workflow engine processes first. Restore refuses while a live process lock or
790
+ workflow lease exists. Then, while still running the 0.9 binary, restore the
791
+ complete pre-cutover snapshot:
792
+
793
+ ```sh
794
+ akm-migrate restore --for 0.9.0 --run <run-id> --confirm
795
+ ```
796
+
797
+ Restore verifies the selected run before changing live files and then creates a
798
+ second verified rescue run of the current installation. It stages every
799
+ replacement beside its destination, writes a durable restore journal,
800
+ quarantines each database together with its WAL/SHM sidecars, and only then
801
+ publishes clean staged files. The journal records a durable committed phase
802
+ before cleanup: an earlier interruption rolls back, while an interruption after
803
+ commit finishes cleanup without mixing generations. While either recovery phase
804
+ is pending, ordinary config and canonical database access fail closed before
805
+ accepting writes or recreating absent files. The selected and rescue runs remain
806
+ under `$DATA`; if verification reports corruption, preserve them and recover
807
+ from an independent backup.
808
+
809
+ Recovery validates the complete restore journal before removing or renaming any
810
+ path: journal format and migration version, phase, exact artifact and SQLite
811
+ sidecar set, operation-bound stage/quarantine names, path uniqueness, source
812
+ backup, and the expected prepared/committed filesystem state. A malformed or
813
+ stale journal remains in place and recovery fails closed for operator diagnosis.
814
+ Committed recovery additionally authenticates each published artifact against
815
+ the selected backup's byte size and streaming SHA-256, then reruns config-state
816
+ validation or SQLite `quick_check` and ledger validation before deleting any
817
+ quarantine or journal.
818
+
819
+ Prepared rollback is itself crash-idempotent. The journal fingerprints the
820
+ original config/database/sidecar generation before quarantine. If recovery dies
821
+ after restoring a quarantine or deleting a stage but before journal deletion,
822
+ the next recovery authenticates the already-restored destination and continues
823
+ cleanup. A same-ledger but byte-different substitution fails closed.
824
+
825
+ Migration config files, manifests, and apply/restore journals are read through
826
+ bounded readers (1 MiB each). Oversized local control files fail closed rather
827
+ than being loaded wholesale. Apply also measures the complete serialized journal
828
+ before its first write; a near-limit config whose expanded target would exceed
829
+ the same cap is rejected before any apply journal or artifact mutation.
830
+
831
+ Only after restore succeeds should you install the older AKM binary. A 0.8
832
+ binary must not run against a 0.9 config or against `state.db` migration 017 /
833
+ `workflow.db` migration 010. If no valid pre-cutover bundle exists, do not
834
+ downgrade in place: preserve the current config and databases, create a separate
835
+ 0.8 data/config root, and manually reconstruct the profile-based configuration.
836
+
837
+ ### Where backups live
838
+
839
+ Recovery runs are stored under
840
+ `$DATA/backups/migrations/<installation-id>/<run-id>/`. They record present and
841
+ absent `config.json`, `state.db`, and `workflow.db` artifacts, ordered
842
+ migration ledgers, sizes, and streaming SHA-256 hashes. `akm-migrate backup
843
+ --for 0.9.0` creates an additional unique run when an operator wants a manual
844
+ snapshot outside of `apply`'s automatic one.