akm-cli 0.9.0-rc.8 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/CHANGELOG.md +1063 -44
  2. package/README.md +51 -25
  3. package/SECURITY.md +14 -1
  4. package/STABILITY.md +497 -0
  5. package/dist/akm +148 -35
  6. package/dist/{akm-migrate-storage → akm-migrate} +6 -9
  7. package/dist/assets/hints/cli-hints-full.md +223 -95
  8. package/dist/assets/hints/cli-hints-short.md +85 -22
  9. package/dist/assets/improve-strategies/default.json +1 -1
  10. package/dist/assets/improve-strategies/reflect-distill.json +1 -1
  11. package/dist/assets/prompts/memory-infer-user.md +2 -3
  12. package/dist/assets/stash-skeleton/README.md +6 -5
  13. package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +2 -0
  14. package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +2 -0
  15. package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +2 -0
  16. package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +2 -0
  17. package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +2 -0
  18. package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +2 -0
  19. package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +2 -0
  20. package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +2 -0
  21. package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +2 -0
  22. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +2 -0
  23. package/dist/assets/stash-skeleton/facts/conventions/domains.md +2 -0
  24. package/dist/assets/stash-skeleton/facts/conventions/organization.md +20 -9
  25. package/dist/assets/tasks/core/extract.yml +1 -1
  26. package/dist/assets/tasks/core/version-check.yml +1 -1
  27. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +5 -0
  28. package/dist/assets/tasks/improve/akm-improve-catchup.yml +8 -0
  29. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +5 -0
  30. package/dist/assets/tasks/improve/akm-improve-frequent.yml +5 -0
  31. package/dist/assets/tasks/improve/akm-improve-nightly.yml +5 -0
  32. package/dist/assets/templates/html/health.html +1 -3
  33. package/dist/assets/workflows/workflow-template.md +32 -15
  34. package/dist/cli/invocation.js +40 -15
  35. package/dist/cli/parse-args.js +0 -22
  36. package/dist/cli/retired-commands.js +121 -0
  37. package/dist/cli/shared.js +154 -22
  38. package/dist/cli/unknown-flags.js +236 -0
  39. package/dist/cli-node.mjs +2 -1
  40. package/dist/cli.js +696 -258
  41. package/dist/commands/agent/agent-dispatch.js +14 -3
  42. package/dist/commands/agent/contribute-cli.js +73 -88
  43. package/dist/commands/completions.js +79 -22
  44. package/dist/commands/config-cli.js +17 -150
  45. package/dist/commands/env/env-cli.js +59 -143
  46. package/dist/commands/env/env.js +12 -163
  47. package/dist/commands/env/marker-path.js +6 -0
  48. package/dist/commands/env/secret-cli.js +36 -66
  49. package/dist/commands/env/secret.js +24 -57
  50. package/dist/commands/feedback-cli.js +141 -87
  51. package/dist/commands/health/accept-rate.js +58 -0
  52. package/dist/commands/health/advisories.js +3 -4
  53. package/dist/commands/health/checks.js +85 -23
  54. package/dist/commands/health/html-report.js +7 -10
  55. package/dist/commands/health/improve-metrics.js +25 -83
  56. package/dist/commands/health/md-report.js +5 -9
  57. package/dist/commands/health/metrics.js +62 -20
  58. package/dist/commands/health/renderers.js +47 -0
  59. package/dist/commands/health/report-view-model.js +4 -5
  60. package/dist/commands/health/stash-exposure.js +1 -1
  61. package/dist/commands/health/surfaces.js +3 -48
  62. package/dist/commands/health/task-runs.js +3 -67
  63. package/dist/commands/health/types-improve.js +7 -0
  64. package/dist/commands/health.js +99 -28
  65. package/dist/commands/improve/anti-collapse.js +2 -2
  66. package/dist/commands/improve/autonomy-gate.js +68 -0
  67. package/dist/commands/improve/collapse-detector.js +41 -40
  68. package/dist/commands/improve/consolidate/eligibility.js +1 -23
  69. package/dist/commands/improve/consolidate/merge.js +4 -0
  70. package/dist/commands/improve/consolidate.js +140 -1000
  71. package/dist/commands/improve/distill/promote-memory.js +12 -12
  72. package/dist/commands/improve/distill/quality-gate.js +6 -6
  73. package/dist/commands/improve/distill.js +58 -69
  74. package/dist/commands/improve/eligibility.js +105 -57
  75. package/dist/commands/improve/extract-cli.js +14 -133
  76. package/dist/commands/improve/improve-cli.js +98 -114
  77. package/dist/commands/improve/improve-result-file.js +1 -28
  78. package/dist/commands/improve/improve-strategies.js +8 -5
  79. package/dist/commands/improve/improve.js +128 -91
  80. package/dist/commands/improve/loop-stages.js +182 -20
  81. package/dist/commands/improve/memory/derived-ref.js +45 -43
  82. package/dist/commands/improve/memory/memory-belief.js +1 -1
  83. package/dist/commands/improve/memory/memory-contradiction-detect.js +4 -12
  84. package/dist/commands/improve/memory/memory-improve.js +6 -5
  85. package/dist/commands/improve/outcome-loop.js +22 -65
  86. package/dist/commands/improve/preparation.js +114 -123
  87. package/dist/commands/improve/proactive-maintenance.js +2 -5
  88. package/dist/commands/improve/reflect.js +56 -160
  89. package/dist/commands/improve/salience.js +11 -122
  90. package/dist/commands/improve/source-identity.js +10 -38
  91. package/dist/commands/lint/base-linter.js +20 -124
  92. package/dist/commands/lint/env-key-rules.js +31 -47
  93. package/dist/commands/lint/index.js +249 -43
  94. package/dist/commands/{events.js → log.js} +33 -38
  95. package/dist/commands/migrate-cli.js +92 -12
  96. package/dist/commands/migration-tool.js +46 -0
  97. package/dist/commands/observability-cli.js +70 -209
  98. package/dist/commands/proposal/drain.js +101 -29
  99. package/dist/commands/proposal/proposal-cli.js +76 -48
  100. package/dist/commands/proposal/proposal.js +54 -18
  101. package/dist/commands/proposal/propose-cli.js +88 -0
  102. package/dist/commands/proposal/propose.js +23 -15
  103. package/dist/commands/proposal/repository.js +701 -278
  104. package/dist/commands/proposal/validators/proposal-quality-validators.js +2 -8
  105. package/dist/commands/proposal/validators/proposal-validators.js +55 -7
  106. package/dist/commands/proposal/validators/proposals.js +4 -7
  107. package/dist/commands/read/curate.js +34 -53
  108. package/dist/commands/read/knowledge.js +150 -95
  109. package/dist/commands/read/registry-search.js +2 -2
  110. package/dist/commands/read/remember-cli.js +42 -15
  111. package/dist/commands/read/search-cli.js +180 -78
  112. package/dist/commands/read/search.js +58 -43
  113. package/dist/commands/read/show.js +197 -141
  114. package/dist/commands/registry-cli.js +12 -51
  115. package/dist/commands/remember.js +14 -57
  116. package/dist/commands/sources/add-cli.js +100 -31
  117. package/dist/commands/sources/bundle-cli.js +166 -0
  118. package/dist/commands/sources/bundle-config-ops.js +7 -2
  119. package/dist/commands/sources/info.js +18 -5
  120. package/dist/commands/sources/init.js +12 -12
  121. package/dist/commands/sources/installed-stashes.js +382 -98
  122. package/dist/commands/sources/schema-repair.js +3 -2
  123. package/dist/commands/sources/self-update.js +131 -38
  124. package/dist/commands/sources/source-add.js +72 -17
  125. package/dist/commands/sources/source-clone.js +129 -45
  126. package/dist/commands/sources/source-manage.js +43 -23
  127. package/dist/commands/sources/sources-cli.js +57 -208
  128. package/dist/commands/sources/stash-cli.js +46 -53
  129. package/dist/commands/tasks/tasks-cli.js +91 -97
  130. package/dist/commands/tasks/tasks.js +276 -421
  131. package/dist/commands/workflow-cli.js +175 -450
  132. package/dist/core/adapter/adapters/akm-adapter.js +47 -28
  133. package/dist/core/adapter/adapters/akm-lint.js +42 -27
  134. package/dist/core/adapter/adapters/akm-metadata.js +15 -44
  135. package/dist/core/adapter/adapters/akm-task-adapter.js +15 -13
  136. package/dist/core/adapter/adapters/akm-workflow-adapter.js +55 -71
  137. package/dist/core/adapter/adapters/dotenv-adapter.js +1 -1
  138. package/dist/core/adapter/adapters/generic-files-adapter.js +2 -0
  139. package/dist/core/adapter/adapters/index.js +6 -6
  140. package/dist/core/adapter/adapters/llm-wiki-adapter.js +14 -8
  141. package/dist/core/adapter/adapters/okf-adapter.js +187 -19
  142. package/dist/core/adapter/adapters/shared.js +3 -19
  143. package/dist/core/adapter/adapters/tool-dir-shared.js +8 -3
  144. package/dist/core/adapter/adapters/website-snapshot-adapter.js +1 -0
  145. package/dist/core/adapter/detect-adapter.js +17 -0
  146. package/dist/core/adapter/recognize-match.js +6 -4
  147. package/dist/core/adapter/validate-context.js +214 -0
  148. package/dist/core/asset/akm-markdown.js +63 -0
  149. package/dist/core/asset/asset-placement.js +20 -6
  150. package/dist/core/asset/asset-ref.js +11 -9
  151. package/dist/core/asset/frontmatter-lint.js +30 -0
  152. package/dist/core/asset/frontmatter.js +37 -9
  153. package/dist/core/asset/markdown.js +40 -51
  154. package/dist/core/asset/resolve-ref.js +89 -18
  155. package/dist/core/asset/stash-meta.js +1 -1
  156. package/dist/core/bundle-id.js +51 -0
  157. package/dist/core/common.js +152 -38
  158. package/dist/core/config/config-io.js +12 -1
  159. package/dist/core/config/config-schema.js +35 -8
  160. package/dist/core/config/config-sources.js +55 -11
  161. package/dist/core/config/config-walker.js +25 -9
  162. package/dist/core/config/config.js +9 -48
  163. package/dist/core/config/experimental.js +21 -0
  164. package/dist/core/config/schema/embedding.js +5 -1
  165. package/dist/core/config/schema/experimental.js +30 -0
  166. package/dist/core/config/schema/improve-processes.js +0 -6
  167. package/dist/core/config/schema/improve.js +21 -3
  168. package/dist/core/config/schema/index-config.js +8 -15
  169. package/dist/core/config/schema/output.js +4 -1
  170. package/dist/core/config/schema/setup.js +9 -18
  171. package/dist/core/config/schema/sources-bundles.js +49 -33
  172. package/dist/core/config/schema/workflow.js +3 -3
  173. package/dist/core/env-secret-ref.js +76 -46
  174. package/dist/core/errors.js +18 -12
  175. package/dist/core/events.js +46 -128
  176. package/dist/core/file-change.js +6 -5
  177. package/dist/core/fs-txn.js +83 -7
  178. package/dist/core/git-message.js +2 -2
  179. package/dist/core/improve-result.js +1 -100
  180. package/dist/core/lesson-lint.js +1 -17
  181. package/dist/core/logs-db.js +2 -1
  182. package/dist/core/migration-operation.js +16 -0
  183. package/dist/core/mutation-target.js +78 -0
  184. package/dist/core/parse.js +4 -1
  185. package/dist/core/paths.js +17 -20
  186. package/dist/core/recognition-util.js +12 -14
  187. package/dist/core/redaction.js +34 -0
  188. package/dist/core/standards/resolve-standards-context.js +2 -14
  189. package/dist/core/standards/resolve-stash-standards.js +2 -2
  190. package/dist/core/standards/resolve-type-conventions.js +2 -2
  191. package/dist/core/state/migrations.js +41 -18
  192. package/dist/core/state-db.js +5 -14
  193. package/dist/core/structured.js +1 -1
  194. package/dist/core/subprocess.js +6 -4
  195. package/dist/core/text-truncation.js +9 -5
  196. package/dist/core/type-presentation.js +3 -3
  197. package/dist/core/warn.js +0 -3
  198. package/dist/core/write-source.js +771 -95
  199. package/dist/indexer/bundle-identity-guard.js +3 -2
  200. package/dist/indexer/db/graph-db.js +0 -24
  201. package/dist/indexer/ensure-index.js +1 -0
  202. package/dist/indexer/graph/graph-boost.js +9 -34
  203. package/dist/indexer/graph/graph-extraction.js +8 -5
  204. package/dist/indexer/index-writer-lock.js +53 -17
  205. package/dist/indexer/index-written-assets.js +16 -22
  206. package/dist/indexer/indexer.js +497 -239
  207. package/dist/indexer/installations.js +14 -96
  208. package/dist/indexer/passes/dir-staleness.js +16 -9
  209. package/dist/indexer/passes/memory-inference.js +11 -9
  210. package/dist/indexer/passes/metadata.js +113 -47
  211. package/dist/indexer/scan/doc-to-entry.js +38 -1
  212. package/dist/indexer/scan/drain-dir.js +13 -23
  213. package/dist/indexer/search/db-search.js +99 -54
  214. package/dist/indexer/search/fts-query.js +47 -24
  215. package/dist/indexer/search/ranking-contributors.js +42 -20
  216. package/dist/indexer/search/ranking.js +18 -99
  217. package/dist/indexer/search/search-fields.js +7 -2
  218. package/dist/indexer/search/search-source.js +82 -93
  219. package/dist/indexer/usage/usage-events.js +0 -89
  220. package/dist/indexer/walk/file-context.js +2 -1
  221. package/dist/indexer/walk/matchers.js +30 -43
  222. package/dist/indexer/walk/path-resolver.js +7 -2
  223. package/dist/indexer/walk/walker.js +38 -12
  224. package/dist/integrations/agent/builders.js +0 -6
  225. package/dist/integrations/agent/config.js +2 -2
  226. package/dist/integrations/agent/detect.js +49 -19
  227. package/dist/integrations/agent/engine-fallback.js +76 -0
  228. package/dist/integrations/agent/profiles.js +14 -0
  229. package/dist/integrations/agent/prompts.js +12 -8
  230. package/dist/integrations/agent/runner-dispatch.js +4 -2
  231. package/dist/integrations/agent/runner.js +0 -1
  232. package/dist/integrations/agent/spawn.js +5 -6
  233. package/dist/integrations/github.js +1 -1
  234. package/dist/integrations/harnesses/aider/agent-builder.js +6 -4
  235. package/dist/integrations/harnesses/amazonq/agent-builder.js +7 -4
  236. package/dist/integrations/harnesses/claude/session-log.js +0 -10
  237. package/dist/integrations/harnesses/codex/agent-builder.js +5 -2
  238. package/dist/integrations/harnesses/copilot/agent-builder.js +5 -3
  239. package/dist/integrations/harnesses/gemini/agent-builder.js +5 -3
  240. package/dist/integrations/harnesses/index.js +3 -7
  241. package/dist/integrations/harnesses/opencode/agent-builder.js +21 -2
  242. package/dist/integrations/harnesses/opencode/session-log.js +0 -15
  243. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +13 -4
  244. package/dist/integrations/harnesses/openhands/agent-builder.js +9 -6
  245. package/dist/integrations/harnesses/pi/agent-builder.js +6 -4
  246. package/dist/integrations/lockfile.js +101 -6
  247. package/dist/integrations/session-logs/index.js +3 -28
  248. package/dist/llm/client.js +136 -100
  249. package/dist/llm/embedders/remote.js +13 -5
  250. package/dist/llm/feature-gate.js +4 -12
  251. package/dist/llm/graph-extract.js +5 -11
  252. package/dist/llm/memory-infer.js +144 -1
  253. package/dist/llm/metadata-enhance.js +5 -7
  254. package/dist/llm/structured-call.js +1 -1
  255. package/dist/llm/usage-persist.js +26 -5
  256. package/dist/llm/usage-telemetry.js +25 -2
  257. package/dist/output/cli-hints.js +1 -2
  258. package/dist/output/context.js +22 -7
  259. package/dist/output/format-exempt.js +80 -0
  260. package/dist/output/generic-render.js +259 -0
  261. package/dist/output/render-registry.js +57 -0
  262. package/dist/output/renderers.js +14 -36
  263. package/dist/output/shapes/curate.js +10 -1
  264. package/dist/output/shapes/events.js +12 -7
  265. package/dist/output/shapes/helpers.js +56 -83
  266. package/dist/output/shapes/migrate.js +8 -0
  267. package/dist/output/shapes/passthrough.js +7 -41
  268. package/dist/output/shapes/proposal/producer.js +15 -7
  269. package/dist/output/shapes.js +2 -9
  270. package/dist/output/text/{init.js → bundle-create.js} +3 -1
  271. package/dist/output/text/bundle-show.js +7 -0
  272. package/dist/output/text/command-format.js +164 -96
  273. package/dist/output/text/env.js +1 -3
  274. package/dist/output/text/events.js +8 -7
  275. package/dist/output/text/health-format.js +103 -0
  276. package/dist/output/text/health.js +7 -0
  277. package/dist/output/text/helpers.js +10 -8
  278. package/dist/output/text/lint-format.js +43 -0
  279. package/dist/output/text/{save.js → lint.js} +2 -2
  280. package/dist/output/text/migrate.js +88 -0
  281. package/dist/output/text/proposal/producer.js +4 -2
  282. package/dist/output/text/proposal-format.js +44 -72
  283. package/dist/output/text/registry-commands.js +1 -2
  284. package/dist/output/text/show-directives.js +15 -7
  285. package/dist/output/text/status-list.js +32 -0
  286. package/dist/output/text/sync.js +5 -0
  287. package/dist/output/text/workflow-format.js +24 -203
  288. package/dist/output/text/workflow.js +1 -7
  289. package/dist/output/text.js +16 -17
  290. package/dist/registry/factory.js +4 -6
  291. package/dist/registry/origin-resolve.js +16 -27
  292. package/dist/registry/providers/skills-sh.js +3 -3
  293. package/dist/registry/providers/static-index.js +13 -23
  294. package/dist/registry/resolve.js +42 -7
  295. package/dist/registry/semver.js +34 -84
  296. package/dist/runtime.js +2 -23
  297. package/dist/scripts/akm-migrate-node.js +60290 -0
  298. package/dist/scripts/akm-migrate.js +59628 -0
  299. package/dist/setup/detect.js +42 -15
  300. package/dist/setup/registry-stash-loader.js +2 -2
  301. package/dist/setup/setup.js +236 -136
  302. package/dist/setup/steps/connection.js +7 -9
  303. package/dist/setup/steps/platforms.js +9 -9
  304. package/dist/setup/steps/semantic.js +15 -3
  305. package/dist/setup/steps/sources.js +12 -13
  306. package/dist/setup/steps/stashdir.js +2 -3
  307. package/dist/setup/steps/tasks.js +237 -120
  308. package/dist/sources/freshness.js +1 -1
  309. package/dist/sources/provider-factory.js +11 -17
  310. package/dist/sources/providers/filesystem.js +2 -3
  311. package/dist/sources/providers/git-install.js +278 -34
  312. package/dist/sources/providers/git-provider.js +25 -23
  313. package/dist/sources/providers/git-stash.js +395 -106
  314. package/dist/sources/providers/git.js +2 -2
  315. package/dist/sources/providers/npm.js +16 -19
  316. package/dist/sources/providers/provider-utils.js +7 -4
  317. package/dist/sources/providers/sync-from-ref.js +3 -9
  318. package/dist/sources/providers/website.js +6 -1
  319. package/dist/sources/resolve.js +6 -5
  320. package/dist/sources/snapshot-fetchers/bluesky.js +146 -0
  321. package/dist/sources/snapshot-fetchers/content-extract.js +566 -0
  322. package/dist/sources/snapshot-fetchers/fetcher-util.js +41 -0
  323. package/dist/sources/snapshot-fetchers/github.js +100 -0
  324. package/dist/sources/snapshot-fetchers/host-guard.js +291 -0
  325. package/dist/sources/snapshot-fetchers/registry.js +17 -1
  326. package/dist/sources/snapshot-fetchers/robots.js +348 -0
  327. package/dist/sources/snapshot-fetchers/rss.js +282 -0
  328. package/dist/sources/snapshot-fetchers/secret-seam.js +42 -0
  329. package/dist/sources/snapshot-fetchers/website-ingest.js +566 -268
  330. package/dist/sources/snapshot-fetchers/x.js +910 -0
  331. package/dist/storage/database.js +7 -0
  332. package/dist/storage/engines/sqlite-migrations.js +23 -111
  333. package/dist/storage/managed-db.js +2 -2
  334. package/dist/storage/repositories/canaries-repository.js +1 -1
  335. package/dist/storage/repositories/events-repository.js +27 -11
  336. package/dist/storage/repositories/improve-runs-repository.js +6 -12
  337. package/dist/storage/repositories/index-connection.js +17 -6
  338. package/dist/storage/repositories/index-entries-repository.js +151 -240
  339. package/dist/storage/repositories/index-entry-mapper.js +15 -11
  340. package/dist/storage/repositories/index-fts-repository.js +5 -2
  341. package/dist/storage/repositories/index-llm-cache-repository.js +0 -1
  342. package/dist/storage/repositories/index-meta-repository.js +2 -3
  343. package/dist/storage/repositories/index-schema.js +10 -25
  344. package/dist/storage/repositories/index-utility-repository.js +15 -28
  345. package/dist/storage/repositories/index-vec-repository.js +6 -1
  346. package/dist/storage/repositories/outcome-repository.js +119 -0
  347. package/dist/storage/repositories/proposals-repository.js +296 -59
  348. package/dist/storage/repositories/registry-cache.js +19 -0
  349. package/dist/storage/repositories/salience-repository.js +172 -0
  350. package/dist/storage/repositories/task-history-repository.js +15 -13
  351. package/dist/storage/repositories/workflow-runs-repository.js +52 -40
  352. package/dist/tasks/backends/cron.js +105 -15
  353. package/dist/tasks/backends/index.js +1 -1
  354. package/dist/tasks/backends/launchd.js +85 -38
  355. package/dist/tasks/backends/schtasks.js +135 -15
  356. package/dist/tasks/embedded.js +56 -40
  357. package/dist/tasks/parser.js +7 -157
  358. package/dist/tasks/resolve-akm-bin.js +137 -59
  359. package/dist/tasks/runner.js +79 -42
  360. package/dist/tasks/scheduler-invocation.js +220 -10
  361. package/dist/tasks/schema.js +24 -1
  362. package/dist/tasks/task-id.js +1 -3
  363. package/dist/tasks/validator.js +20 -6
  364. package/dist/workflows/authoring/authoring.js +94 -143
  365. package/dist/workflows/authoring/scope-key.js +1 -1
  366. package/dist/workflows/exec/frozen-judge.js +28 -2
  367. package/dist/workflows/exec/native-executor.js +77 -57
  368. package/dist/workflows/exec/param-secrets.js +9 -9
  369. package/dist/workflows/exec/run-workflow.js +133 -79
  370. package/dist/workflows/exec/step-work.js +219 -346
  371. package/dist/{migrate-storage-node.mjs → workflows/exec/unit-dispatch.js} +1 -5
  372. package/dist/workflows/ir/compile.js +141 -270
  373. package/dist/workflows/ir/freeze.js +40 -30
  374. package/dist/workflows/ir/params.js +135 -11
  375. package/dist/workflows/ir/plan-hash.js +1 -1
  376. package/dist/workflows/ir/schema.js +25 -26
  377. package/dist/workflows/parser.js +872 -307
  378. package/dist/workflows/program/expressions.js +20 -208
  379. package/dist/workflows/program/schema.js +7 -10
  380. package/dist/workflows/renderer.js +95 -68
  381. package/dist/workflows/resource-limits.js +2 -0
  382. package/dist/workflows/runtime/checkin.js +3 -3
  383. package/dist/workflows/runtime/plan-classifier.js +16 -75
  384. package/dist/workflows/runtime/runs.js +186 -127
  385. package/dist/workflows/runtime/unit-checkin.js +1 -1
  386. package/dist/workflows/runtime/unit-phases.js +2 -2
  387. package/dist/workflows/runtime/workflow-asset-loader.js +232 -83
  388. package/dist/workflows/schema.js +1 -11
  389. package/dist/workflows/validate-summary.js +30 -36
  390. package/dist/workflows/validator.js +21 -62
  391. package/docs/README.md +68 -0
  392. package/docs/migration/README.md +8 -0
  393. package/docs/migration/release-notes/0.7.0.md +11 -11
  394. package/docs/migration/release-notes/0.9.0.md +208 -27
  395. package/docs/migration/v0.7-to-v0.8.md +46 -47
  396. package/docs/migration/v0.8-to-v0.9.md +564 -208
  397. package/docs/migration/v0.9.0-troubleshooting.md +561 -0
  398. package/docs/reference/README.md +12 -0
  399. package/docs/reference/cli.md +2253 -0
  400. package/docs/reference/configuration.md +358 -0
  401. package/docs/reference/data-and-telemetry.md +105 -42
  402. package/docs/reference/workflows.md +647 -0
  403. package/package.json +22 -11
  404. package/schemas/akm-asset-envelope.json +93 -0
  405. package/schemas/akm-config.json +81 -128
  406. package/schemas/akm-workflow.json +74 -73
  407. package/dist/assets/tasks/core/backup.yml +0 -5
  408. package/dist/assets/tasks/graph-refresh-weekly.yml +0 -10
  409. package/dist/cli/config-migrate.js +0 -1806
  410. package/dist/cli/config-validate.js +0 -41
  411. package/dist/commands/backup-cli.js +0 -56
  412. package/dist/commands/bundle/bundle-cli.js +0 -68
  413. package/dist/commands/bundle/bundle.js +0 -219
  414. package/dist/commands/graph/graph-cli.js +0 -124
  415. package/dist/commands/graph/graph.js +0 -489
  416. package/dist/commands/improve/extract-watch.js +0 -140
  417. package/dist/commands/mv-cli.js +0 -1221
  418. package/dist/commands/sources/history.js +0 -201
  419. package/dist/commands/tasks/default-tasks.js +0 -186
  420. package/dist/core/migration-backup.js +0 -1234
  421. package/dist/indexer/usage/unmigrated-vaults-guard.js +0 -95
  422. package/dist/llm/memory-infer-impl.js +0 -138
  423. package/dist/migrate/legacy/config-source-migration.js +0 -223
  424. package/dist/migrate/legacy/content-migration.js +0 -305
  425. package/dist/migrate/legacy/legacy-layout.js +0 -779
  426. package/dist/migrate/legacy/legacy-paths.js +0 -25
  427. package/dist/migrate/legacy/legacy-stash-json.js +0 -72
  428. package/dist/migrate/legacy/proposal-fs-import.js +0 -168
  429. package/dist/migrate/legacy/task-target-ref-migration.js +0 -272
  430. package/dist/migrate/legacy/three-db-cutover.js +0 -841
  431. package/dist/migrate/legacy/workflow-migrations-bodies.js +0 -52
  432. package/dist/migrate/legacy/workflow-migrations-frozen.js +0 -21
  433. package/dist/migrate/legacy-ref-grammar.js +0 -214
  434. package/dist/output/shapes/distill.js +0 -14
  435. package/dist/output/shapes/history.js +0 -11
  436. package/dist/output/text/distill.js +0 -6
  437. package/dist/output/text/enable-disable.js +0 -8
  438. package/dist/output/text/history.js +0 -6
  439. package/dist/registry/build-index.js +0 -382
  440. package/dist/schemas/akm-config.json +0 -4704
  441. package/dist/schemas/akm-task.json +0 -87
  442. package/dist/schemas/akm-workflow.json +0 -372
  443. package/dist/scripts/migrate-storage.js +0 -3816
  444. package/dist/workflows/authoring/workflow-program-template.yaml +0 -31
  445. package/dist/workflows/cli.js +0 -53
  446. package/dist/workflows/exec/brief.js +0 -481
  447. package/dist/workflows/exec/report.js +0 -1460
  448. package/dist/workflows/exec/watch.js +0 -116
  449. package/dist/workflows/program/parser.js +0 -813
  450. package/dist/workflows/program/project.js +0 -104
@@ -1,10 +1,14 @@
1
1
  # Migrating from akm 0.8.x to 0.9.0
2
2
 
3
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:
4
+ asset-type registry with per-format adapters for *recognition, indexing,
5
+ presentation, and validation* placement alone still routes through AKM's
6
+ native type→directory table; wiring it through the adapter interface is
7
+ deferred to 0.10 (see [Removed surfaces](#3-removed-surfaces) and the 0.9.0
8
+ release notes for the exact boundary) — adopts one canonical ref grammar,
9
+ consolidates the durable databases and config, and completes several
10
+ 0.8-era deprecations (the CLI aliases and the `vault` asset type). This
11
+ guide is ordered the way you'll need it:
8
12
 
9
13
  > **Heads-up on the 0.9.x series:** 0.9.x is a refactoring and clean-up
10
14
  > series — patch releases may include further breaking changes (each with a
@@ -20,11 +24,14 @@ ordered the way you'll need it:
20
24
  5. [Troubleshooting](#5-troubleshooting)
21
25
 
22
26
  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
27
+ the crash-resumable `akm migrate apply` coordinator. It also rewrites
24
28
  legacy `workflow:` target refs in valid 0.8 task files after resolving them
25
29
  against their containing/configured bundle while preserving each YAML file's
26
30
  permission mode; it does not translate profile-based configuration or workflow
27
- definitions automatically. Create the recovery backup
31
+ definitions automatically — a 0.8 workflow document keeps its 0.8 structure
32
+ verbatim and needs a manual rewrite (see
33
+ [0.8 workflow assets after migration](#08-workflow-assets-after-migration) for
34
+ the concrete symptom and the fix). Create the recovery backup
28
35
  before changing a live installation, then migrate other affected assets deliberately.
29
36
 
30
37
  ## 1. Cross the boundary: `akm migrate status` / `akm migrate apply`
@@ -45,15 +52,22 @@ It:
45
52
  - Folds the former `workflow.db` into `state.db`, taking the database count
46
53
  from four to three: `state.db` (durable workspace state), `index.db` (the
47
54
  fully regenerable search cache), and a separate `logs.db`.
48
- - Folds `.stash.json` sidecars into the new layout and applies the D-R6
49
- reserved-filename renames (`index.md` / `log.md` at any bundle depth are now
50
- reserved structural files — see [§2](#2-ref-grammar-typename--bundleconceptid)).
55
+ - Folds `.stash.json` sidecars into the new layout and applies the AKM adapter's
56
+ D-R6 reserved-filename renames (`index.md` / `log.md` at any AKM stash depth
57
+ are now reserved structural files — see
58
+ [§2](#2-ref-grammar-typename--bundleconceptid)).
51
59
  - Imports any pre-0.9 filesystem proposals into `state.db` as part of the same
52
60
  apply — this is no longer a separate step.
53
61
  - Re-keys every durable ref (usage/feedback events, proposal targets,
54
62
  workflow/task targets, salience) to the new `[bundle//]conceptId` spelling.
55
63
  Refs embedded in your own asset bodies are rewritten by the content
56
- migration; unresolvable refs are quarantined, not dropped.
64
+ migration; unresolvable refs are quarantined, not dropped: the audit summary
65
+ lands in `legacy_state` (surface, ref, row count) and the complete original
66
+ rows are preserved as JSON in `legacy_state_rows` in the migrated
67
+ `state.db`, so nothing the migration cannot re-key is destroyed.
68
+ - Generates the target config for you when no `--config` is given and none
69
+ exists yet, instead of requiring one hand-authored from a blank page — see
70
+ [Auto-generating the 0.9 config](#auto-generating-the-09-config).
57
71
 
58
72
  ### The 0.8 binary cannot do this
59
73
 
@@ -63,8 +77,18 @@ The 0.8 binary does not contain `akm migrate` or the `upgrade
63
77
  package-manager/manual boundary procedure instead:
64
78
 
65
79
  1. Stop AKM writers, schedulers, and workflow drivers.
66
- 2. Prepare the complete 0.9 config in a separate file. Do not replace the live
67
- 0.8 config; AKM cannot infer names when old LLM and agent profiles collide.
80
+ 2. Decide how the 0.9 target config gets prepared. You usually don't need to
81
+ hand-write one: `akm migrate apply` (step 5) generates the mechanical part
82
+ — `bundles`/`defaultBundle` — from your existing `stashDir`/`sources[]`/
83
+ `installed[]` automatically when no `--config` is given and no target
84
+ config exists yet (see
85
+ [Auto-generating the 0.9 config](#auto-generating-the-09-config) below).
86
+ Write one by hand instead (see
87
+ [Preparing the 0.9 config](#preparing-the-09-config)) only if you want full
88
+ control, or already know your 0.8 config configured LLM/agent profiles —
89
+ AKM never guesses those. Either way, never replace the live 0.8 config
90
+ directly; a generated or hand-written target config always lives in a
91
+ separate file.
68
92
  3. Take an independent filesystem backup of the live 0.8 `config.json`,
69
93
  `state.db`, and `workflow.db` (including any SQLite `-wal`/`-shm` files).
70
94
  Store it outside AKM's data directory and verify it before continuing.
@@ -74,10 +98,188 @@ package-manager/manual boundary procedure instead:
74
98
  independent data backup in either case.
75
99
  5. Invoke the newly installed or staged 0.9 binary, whose migration startup
76
100
  bypass can read the old installation without loading its config normally.
77
- 6. After apply succeeds, run `akm tasks sync` with that same 0.9 binary and
78
- inspect `skipped` before restarting schedulers. Sync registers the migrated
79
- task view and quarantines the obsolete published backup task described in
80
- [§4](#4-behavioral-notes).
101
+ 6. After apply succeeds, run `akm task sync --rebind` with that same 0.9 binary
102
+ before restarting schedulers. The explicit rebind replaces 0.8 native
103
+ scheduler definitions with current context-bound invocations.
104
+
105
+ ### Auto-generating the 0.9 config
106
+
107
+ Run `akm migrate status` (or `akm migrate apply`) with **no** `--config`. If
108
+ the active 0.8 config still carries `stashDir`/`sources[]`/`installed[]` and no
109
+ target config exists yet, the plan's `generatedConfig` field previews what a
110
+ `migrate apply` will write: `path` (a predictable location next to the
111
+ migration's recovery backups — never the live `config.json`) and
112
+ `droppedKeys` — any `profiles.llm.<name>`/`profiles.agent.<name>`/
113
+ `profiles.improve.<name>`/`defaults.llm`/`defaults.agent`/`defaults.improve`
114
+ keys it will leave out, named exactly rather than guessed at (see
115
+ [Engine And Task Assets](#engine-and-task-assets) for why).
116
+
117
+ A `migrate apply` with no `--config` and no target config yet WRITES that
118
+ file and stops — it deliberately does not proceed to back up or mutate
119
+ anything on that run, so you get a real chance to review the generated
120
+ config (and hand-add `engines`/`defaults` for anything `droppedKeys` named)
121
+ before a second, explicit `akm migrate apply` — still no `--config` — picks
122
+ the file up and completes the cutover:
123
+
124
+ ```sh
125
+ akm migrate status # previews: generatedConfig.status "pending", droppedKeys []
126
+ akm migrate apply # writes the starter config, stops (status "ready")
127
+ # review/edit the file named in the JSON result's generatedConfig.path if
128
+ # droppedKeys named anything you need engines for, then:
129
+ akm migrate apply # picks up the generated file, applies it (status "current")
130
+ ```
131
+
132
+ The generated file's `bundles`/`defaultBundle` come from the exact same
133
+ transform (`migrateConfigSourcesToBundles`) [the key-mapping table
134
+ below](#08-key--09-key) describes for a hand-written target — generation just
135
+ runs it for you. When your 0.8 config had no `profiles`/`defaults.llm`/
136
+ `defaults.agent`/`defaults.improve` to translate, `droppedKeys` comes back
137
+ empty and the generated config is complete on its own: the second `apply` is
138
+ a plain confirming re-run, no editing required.
139
+
140
+ An explicit `--config` always wins over this and is never second-guessed — if
141
+ you pass one, generation never runs, exactly as if this section did not
142
+ exist. Use it for full control, or when you already know your 0.8 config
143
+ configured LLM/agent profiles and would rather write `engines`/`defaults`
144
+ yourself up front instead of re-running `apply` a second time.
145
+
146
+ ### Preparing the 0.9 config
147
+
148
+ A 0.9 config is a plain JSON file; nothing stops you from writing one
149
+ yourself instead of letting `migrate apply` generate it (see above) — you
150
+ still point `--config` at it exactly as before. This is the minimum that is
151
+ sufficient to drive a successful `akm migrate apply`: one writable bundle and
152
+ a `defaultBundle` naming it.
153
+
154
+ ```json
155
+ {
156
+ "configVersion": "0.9.0",
157
+ "bundles": {
158
+ "primary": { "path": "/abs/path/to/your/stash", "writable": true }
159
+ },
160
+ "defaultBundle": "primary"
161
+ }
162
+ ```
163
+
164
+ Point `path` at the same directory your 0.8 `stashDir` used — that is what
165
+ turns your existing assets into the migrated installation's working bundle. If
166
+ your 0.8 config also had `sources[]` or `installed[]` entries, add one
167
+ `bundles` entry per source (see the mapping table below); each one becomes
168
+ searchable the same way it was in 0.8.
169
+
170
+ If your 0.8 config configured LLM or agent profiles, add `engines` and
171
+ `defaults` too:
172
+
173
+ ```jsonc
174
+ {
175
+ "configVersion": "0.9.0",
176
+ "bundles": {
177
+ "primary": { "path": "/abs/path/to/your/stash", "writable": true }
178
+ },
179
+ "defaultBundle": "primary",
180
+ "engines": {
181
+ "fast": {
182
+ "kind": "llm",
183
+ "endpoint": "http://localhost:11434/v1/chat/completions",
184
+ "model": "qwen3"
185
+ },
186
+ "reviewer": { "kind": "agent", "platform": "opencode" }
187
+ },
188
+ "defaults": {
189
+ "engine": "reviewer",
190
+ "llmEngine": "fast"
191
+ }
192
+ }
193
+ ```
194
+
195
+ This is a minimal illustration, not the full schema — see
196
+ [Configuration](../reference/configuration.md) for every `engines`/`defaults`/
197
+ `improve.strategies` field, and point your editor's JSON schema support at
198
+ `$schema: "https://itlackey.github.io/akm/schemas/akm-config.json"` (or the
199
+ local `schemas/akm-config.json` in a source checkout) for autocomplete and
200
+ inline validation while you write it.
201
+
202
+ #### 0.8 key → 0.9 key
203
+
204
+ Verified against `scripts/akm-migrate/migrate/legacy/config-source-migration.ts`
205
+ (the transform `akm migrate apply` runs on your behalf once you give it a
206
+ target config that already speaks the 0.9 shape) and
207
+ `src/core/config/config-walker.ts`'s retired-key hints:
208
+
209
+ | 0.8 key | 0.9 key | Notes |
210
+ | --- | --- | --- |
211
+ | `stashDir` | `bundles.<id>.path` + `defaultBundle` | The `primary: true` source (or the top-level `stashDir` if none was marked primary) becomes the bundle named by `defaultBundle` |
212
+ | `sources[]` | `bundles` | One `bundles.<id>` entry per source; `id` is derived from the source's `name`/`registryId` or a slug of its path |
213
+ | `installed[]` | `bundles` + lockfile | The config entry keeps only the desired locator (`git`/`npm` + `registryId`); the materialized cache path and revision move to the lockfile, not the config |
214
+ | `wikiName` | (gone — no replacement) | The wiki subsystem was removed in 0.9; a Karpathy-style wiki is recognized automatically as an `llm-wiki` bundle, and ordinary content goes through `akm import` |
215
+ | `profiles.llm.<name>` / `defaults.llm` | `engines.<name>` (`kind: "llm"`) / `defaults.llmEngine` | Not migrated automatically — you choose the new engine names |
216
+ | `profiles.agent.<name>` / `defaults.agent` | `engines.<name>` (`kind: "agent"`) / `defaults.engine` | Not migrated automatically — see the name-collision note below |
217
+ | `profiles.improve.<name>` / `defaults.improve` | `improve.strategies.<name>` / `defaults.improveStrategy` | Not migrated automatically |
218
+
219
+ The engine/task-asset keys are **not** translated to `engines`/`defaults` by
220
+ `migrate apply` — see [Engine And Task Assets](#engine-and-task-assets) below
221
+ for why AKM cannot safely auto-generate `engines` names when a 0.8 LLM
222
+ profile and agent profile shared one. In a hand-written target config passed
223
+ via `--config`, leaving these keys in is a hard schema-validation error (same
224
+ as before 0.9.0's config generation existed) — [Preparing the 0.9
225
+ config](#preparing-the-09-config) above never touches them for you. The
226
+ auto-generation path ([above](#auto-generating-the-09-config)) instead
227
+ actively STRIPS them and reports exactly what it stripped via
228
+ `generatedConfig.droppedKeys`, so the config it writes is valid on its own;
229
+ either way, you still add `engines`/`defaults` by hand afterward if you want
230
+ LLM/agent execution to keep working. Everything else in the table above
231
+ (bundles, defaultBundle, `wikiName` removal) *is* handled — by `migrate apply`
232
+ once you hand it a target config, or by the generator on your behalf —
233
+ `migrate apply` moves the durable state and databases, not the config keys
234
+ themselves.
235
+
236
+ #### End-to-end happy path
237
+
238
+ The complete sequence, in the order you actually hit it, assuming a single
239
+ 0.8 `stashDir` and no LLM/agent profiles to carry over — letting `migrate
240
+ apply` generate the target config instead of hand-writing one:
241
+
242
+ ```sh
243
+ # 1. Stop schedulers and any running akm process first (see step 1 above).
244
+
245
+ # 2. Back up the live 0.8 data directory independently (outside AKM's own dirs).
246
+ cp -a ~/.local/share/akm ~/akm-0.8-backup-"$(date +%Y%m%d)"
247
+
248
+ # 3. Install 0.9.
249
+ npm install -g akm-cli@0.9.0
250
+
251
+ # 4. Check eligibility (previews the config apply would generate), then apply
252
+ # TWICE: the first apply only writes the generated config and stops; the
253
+ # second, unchanged, invocation picks it up and performs the cutover.
254
+ akm migrate status
255
+ akm migrate apply --dry-run
256
+ akm migrate apply
257
+ akm migrate apply
258
+
259
+ # 5. Rebind the scheduler to the new binary and rebuild the index.
260
+ akm task sync --rebind
261
+ akm index
262
+ akm migrate status # now reports current with no --config needed
263
+ ```
264
+
265
+ If your 0.8 config configured LLM/agent profiles, or you'd simply rather
266
+ write the target config yourself, replace step 4 with the hand-authored
267
+ `--config` form instead:
268
+
269
+ ```sh
270
+ # 4'. Write the target config (see the minimal example above), then check
271
+ # eligibility, dry-run, and apply against it explicitly.
272
+ cat > ./prepared-0.9.json << 'EOF'
273
+ {
274
+ "configVersion": "0.9.0",
275
+ "bundles": { "primary": { "path": "/home/you/akm", "writable": true } },
276
+ "defaultBundle": "primary"
277
+ }
278
+ EOF
279
+ akm migrate status --config ./prepared-0.9.json
280
+ akm migrate apply --config ./prepared-0.9.json --dry-run
281
+ akm migrate apply --config ./prepared-0.9.json
282
+ ```
81
283
 
82
284
  Package-manager installation examples for step 4:
83
285
 
@@ -96,51 +298,30 @@ Commands for steps 5 and 6:
96
298
  akm migrate status --config ./prepared-0.9.json
97
299
  akm migrate apply --config ./prepared-0.9.json --dry-run
98
300
  akm migrate apply --config ./prepared-0.9.json
99
- akm tasks sync
301
+ akm task sync --rebind
100
302
 
101
303
  # Or invoke a checksummed staged standalone binary explicitly.
102
304
  ./akm-0.9 migrate status --config ./prepared-0.9.json
103
305
  ./akm-0.9 migrate apply --config ./prepared-0.9.json
104
- ./akm-0.9 tasks sync
306
+ ./akm-0.9 task sync --rebind
105
307
  ```
106
308
 
107
309
  Status and dry-run perform the same read-only eligibility checks and report the
108
310
  source config plus target config explicitly. Apply validates the target in
109
- memory, creates a verified recovery run, applies pending `state.db` and
110
- `workflow.db` migrations one transaction at a time, and atomically installs the
111
- prepared config last. If any later artifact fails, apply restores config and
112
- both databases from the verified run before returning. Each artifact is
113
- classified independently, so a current config with pre-cutover databases can be
114
- recovered safely.
115
-
116
- Apply records durable `prepared`, `state-converting`, `state-collapsing`,
117
- `state-applied`, `workflow-applied`, `cutover-applied`, `config-applied`, `tasks-prepared`, `tasks-applied`,
118
- `pilot-prepared`, `pilot-applied`, `rollback-prepared`, and `committed` phases. Every phase stores
119
- streaming size/SHA fingerprints for config, both databases, and SQLite sidecars;
120
- a pre-cutover resume or rollback first requires the exact live generation.
121
- State schema migration and the `state-converting` marker commit together; the
122
- marker binds a canonical logical digest before the journal records the exact
123
- physical `state-collapsing` generation. A marker-write crash is recoverable only
124
- when that digest still matches. Once the journal is bound, any later WAL frame
125
- fails closed; a nonexact generation is accepted only after the raw database
126
- header proves the WAL-to-DELETE collapse completed and the logical digest still
127
- matches. After a process
128
- crash, ordinary config and canonical database access fail closed; `akm migrate
129
- status` reports the pending phase and `akm migrate apply` resumes idempotently
130
- from the retained target and verified backup. Apply also refuses before backup
131
- while managed database handles, maintenance activities, AKM mutation locks, or
132
- workflow claims are live.
133
-
134
- Format-v2 journals written by an earlier 0.9 RC at `state-applied` or
135
- `workflow-applied` are authenticated by raw artifact fingerprints before AKM
136
- opens live SQLite files. An exact journal is durably rewound through
137
- `state-converting`; a nonexact journal fails closed without probing WAL state.
138
- Earlier format-v2 journals at `cutover-applied` or any later forward-only phase
139
- are instead authenticated by the same operation's committed cutover ledger row.
140
- They continue from their recorded phase without requiring the newer
141
- `state-converting` marker; physical WAL differences are retained rather than
142
- rolled back. A post-cutover journal without that operation-bound marker fails
143
- closed.
311
+ memory and creates a verified recovery run. Before the first mutation it writes
312
+ one phase-free incomplete sentinel containing the retained target, path base,
313
+ and original backup identity. It then applies schema changes by ordered
314
+ migration ID, runs the data and asset transforms idempotently, and atomically
315
+ installs the prepared config last.
316
+
317
+ If a transform fails, apply does not guess at rollback and does not replace the
318
+ original backup. It leaves the incomplete sentinel in place, ordinary config
319
+ and canonical database access fail closed, and the next `akm migrate apply`
320
+ replays the same transforms to convergence. The transaction-local cutover
321
+ ledger prevents duplicate workflow or usage-event imports. The sentinel is
322
+ removed only after final config, schema, task, proposal-ref, and cutover outcome
323
+ checks pass. Apply also refuses before backup while managed database handles,
324
+ maintenance activities, AKM mutation locks, or workflow claims are live.
144
325
 
145
326
  Once already running a contract-capable 0.9 release, future self-upgrades may
146
327
  pass a prepared target through the coordinated upgrade path:
@@ -159,12 +340,61 @@ no migration-config flag is needed.
159
340
 
160
341
  Recovery runs are stored under
161
342
  `$DATA/backups/migrations/<installation-id>/<run-id>/`. They record present and
162
- absent `config.json`, `state.db`, and `workflow.db` artifacts, ordered migration
163
- ledgers, sizes, and streaming SHA-256 hashes. SQLite snapshots must also pass
343
+ absent `config.json`, `state.db`, `workflow.db`, and `index.db` artifacts,
344
+ ordered migration ledgers, and semantic state. SQLite snapshots must pass
164
345
  `PRAGMA quick_check` and ledger-prefix validation before the manifest is
165
- published. `akm backup create --for 0.9.0` creates an additional unique run when
166
- an operator wants a manual snapshot. Routine config writes, telemetry, and
167
- already-current database opens do not depend on any historical run.
346
+ published. `akm-migrate backup
347
+ --for 0.9.0` creates an additional unique run when an operator wants a manual
348
+ snapshot. Routine config writes, telemetry, and already-current database opens
349
+ do not depend on any historical run.
350
+
351
+ ### What migration control does not cover
352
+
353
+ Migration control tracks exactly four artifacts — `config.json`, `state.db`,
354
+ `workflow.db`, `index.db` — because that is the literal list the backup/restore
355
+ manifest enumerates. Two boundaries follow from that list that are worth
356
+ stating plainly rather than discovering by accident:
357
+
358
+ - **`logs.db` is entirely outside the migration system.** It is never backed
359
+ up, never restored, and never version-checked; `src/core/logs-db.ts`
360
+ bootstraps its own schema the first time it is opened, independent of the
361
+ migration coordinator. This is fine in practice — task and index logs are
362
+ purgeable operational data, not state you need a rollback path for — but it
363
+ means an `akm-migrate restore` rolls back `config.json`, `state.db`,
364
+ `workflow.db`, and `index.db` to a prior run while `logs.db` is left exactly
365
+ as the newer binary wrote it. Do not expect `logs.db` to move with a
366
+ restore.
367
+ - **`index.db` is only checked with `PRAGMA quick_check`**, never inspected
368
+ for a schema/migration version the way `state.db` and `workflow.db` are. A
369
+ `index.db` written by a release newer than the one currently running cannot
370
+ be detected as "newer" — the runtime instead quarantines and rebuilds it
371
+ from scratch on the next `akm index`. This is safe because the index is a
372
+ fully regenerable search cache; it is called out here only so "migration
373
+ status: current" is not read as "index.db is exactly what this binary
374
+ expects."
375
+
376
+ ### Two different `migrate` surfaces
377
+
378
+ `akm migrate` — the subcommand on the everyday `akm` binary — exposes only
379
+ `status` and `apply`: the two commands you need to cross the boundary and to
380
+ check or apply any future in-place migration. It does **not** expose `backup`,
381
+ `restore`, or `storage`.
382
+
383
+ The standalone `akm-migrate` program (`scripts/akm-migrate.ts` in a source
384
+ checkout; shipped as its own `dist/akm-migrate` release artifact — see the
385
+ `bin` entry in `package.json`) is a separate binary with a larger surface:
386
+ `status`, `apply`, `backup`, `restore`, and `storage`. `backup` and `restore`
387
+ exist **only** here — there is no `akm migrate restore`. If your install does
388
+ not ship `akm-migrate` (some minimal or hand-rolled installs omit it), you have
389
+ no restore path from that install; every `akm-migrate restore ...` /
390
+ `akm-migrate backup ...` command in this guide and in
391
+ [the troubleshooting guide](v0.9.0-troubleshooting.md) refers to that separate
392
+ binary, not the `akm migrate` subcommand.
393
+
394
+ There is also no `plan` subcommand on either surface. What some other tools
395
+ call "planning" is `akm migrate status` (read-only eligibility check) or
396
+ `akm migrate apply --dry-run` (the same transforms, run without writing) — do
397
+ not look for a separate plan step.
168
398
 
169
399
  ## 2. Ref grammar: `type:name` → `[bundle//]conceptId`
170
400
 
@@ -187,18 +417,19 @@ Before / after:
187
417
 
188
418
  **There is no compatibility parser.** The pre-0.9.0 `[origin//]type:name`
189
419
  grammar is removed from every normal code path; it survives only inside the
190
- migrator (`src/migrate/legacy-ref-grammar.ts`) for reading pre-cutover data.
420
+ migrator (`scripts/akm-migrate/migrate/legacy-ref-grammar.ts`) for reading
421
+ pre-cutover data.
191
422
  `akm migrate apply` re-keys every durable ref to the new spelling, and refs
192
423
  embedded in your own asset bodies are rewritten by the content migration — but
193
424
  any prompt, `AGENTS.md`, or doc that still spells refs in the old `type:name`
194
425
  form must be updated by hand. A code-review skill is now `skills/code-review`.
195
426
  See `STABILITY.md` for the full contract.
196
427
 
197
- `index.md` and `log.md` are also now reserved. Per the Open Knowledge Format,
198
- these are directory/structure files at every bundle depth never indexed as
199
- concepts and never valid write / `akm mv` targets. Existing stash files with
200
- those names are excluded from the index (and renamed by the content migration
201
- if they hold a real concept).
428
+ `index.md` and `log.md` are also now reserved by the AKM adapter at every stash
429
+ depth never indexed as items and never valid item-write targets. This matches
430
+ OKF's structural names but is an AKM format rule, not an assertion that the
431
+ stash is an OKF bundle. Existing stash files with those names are excluded from
432
+ the index and renamed by the content migration if they hold a real item.
202
433
 
203
434
  ## 3. Removed surfaces
204
435
 
@@ -206,17 +437,32 @@ if they hold a real concept).
206
437
 
207
438
  0.9.0 removes the entire `akm wiki` verb family (`create`, `register`, `list`,
208
439
  `show`, `remove`, `pages`, `search`, `stash`, `lint`, `ingest`) and the `wiki`
209
- asset type. The Karpathy-style LLM wiki structure stays first-class, but as a
210
- **bundle format** owned by the `llm-wiki` adapter instead of a bespoke command
211
- surface: `schema.md` (the per-wiki rulebook) + `pages/` (agent-authored pages)
212
- at a bundle's root is enough for the indexer to recognize and lint it like any
213
- other bundle. `raw/`, `index.md`, and `log.md` stay reserved infrastructure.
440
+ asset type. The Karpathy-style LLM wiki structure stays first-class for
441
+ *reading*, now as a **bundle format** recognized by the `llm-wiki` adapter
442
+ instead of a bespoke command surface: `schema.md` (the per-wiki rulebook) +
443
+ `pages/` (agent-authored pages) at a bundle's root is enough for the indexer
444
+ to recognize it, index its pages, and present them through `akm show`.
445
+ `raw/`, `index.md`, and `log.md` stay reserved infrastructure.
446
+
447
+ **llm-wiki is consumer/read-only for writes in 0.9.0, the same as OKF.** The
448
+ adapter defines its own `validate` and `placeNew` logic. Validation is
449
+ adapter-driven in 0.9.0: `akm lint` runs the `llm-wiki` adapter's own
450
+ wiki-shaped checks through `validate()` rather than falling back to the
451
+ generic AKM subdirectory scan. Placement is not — nothing in the write path
452
+ calls `placeNew()` yet for any adapter, llm-wiki included; that wiring is
453
+ deferred to 0.10 (see
454
+ [D12 in the 0.9.0 decision record](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/0.9.0-decisions.md#d12--bundleadapterplacenew-stays-unwired-until-010)).
455
+ Separately, `akm remember`/`akm import`/proposal-accept into an llm-wiki
456
+ bundle are rejected before they reach the adapter at all — the same
457
+ `assertAkmAssetWrite` allowlist that rejects OKF targets, unrelated to the
458
+ `placeNew` deferral. Author llm-wiki content through your agent writing
459
+ directly into `pages/` (as the Karpathy pattern always intended), not
460
+ through akm's native write commands.
214
461
 
215
462
  There is no `akm wiki ...` compatibility shim — an installed non-akm wiki
216
463
  directory reclassifies under the `llm-wiki` adapter on your next `akm index`
217
464
  (see [adapter dispatch reclassification](#4-behavioral-notes)); wiki pages are
218
- found through `akm search`/`akm show` like any other asset, and lint runs
219
- through `akm lint`.
465
+ found through `akm search`/`akm show` like any other asset.
220
466
 
221
467
  ### `akm vault` → `env` / `secret`
222
468
 
@@ -225,10 +471,10 @@ asset type, shipped in 0.8.0 alongside a deprecation shim and an automatic
225
471
  `vaults/` → `env/` migration. This section explains what changed, how to
226
472
  migrate, and what 0.9.0 removes.
227
473
 
228
- > **TL;DR:** In 0.8.0, run the migration (`akm-migrate-storage --yes`) to copy
474
+ > **TL;DR:** In 0.8.0, run the migration (`akm-migrate storage --yes`) to copy
229
475
  > `vaults/` → `env/`, then switch your scripts from `akm vault …` to
230
476
  > `akm env …` and from `source "$(akm vault path …)"` to
231
- > `akm env run env:<name> -- <command>` (or `-- $SHELL` for an interactive
477
+ > `akm env run <name> -- <command>` (or `-- $SHELL` for an interactive
232
478
  > session). Everything keeps working through 0.8.x; the `vault` verb and
233
479
  > `vault:` refs are removed in 0.9.0.
234
480
 
@@ -284,13 +530,13 @@ move**: the legacy `vaults/` tree is left intact as a frozen copy and a
284
530
 
285
531
  ```sh
286
532
  # Preview (no changes written)
287
- akm-migrate-storage --dry-run
533
+ akm-migrate storage --dry-run
288
534
 
289
535
  # Apply
290
- akm-migrate-storage --yes
536
+ akm-migrate storage --yes
291
537
 
292
538
  # From a source clone:
293
- bun scripts/migrate-storage.ts --yes
539
+ bun scripts/akm-migrate.ts storage --yes
294
540
  ```
295
541
 
296
542
  What the `vaults/ → env/` step does:
@@ -316,7 +562,7 @@ After migrating, run `akm index` to refresh search so entries surface under
316
562
 
317
563
  ```sh
318
564
  # List
319
- akm vault list → akm env list
565
+ 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)
320
566
 
321
567
  # Inspect keys (values never shown)
322
568
  akm show vault:prod → akm show env/prod
@@ -325,14 +571,14 @@ akm show vault:prod → akm show env/prod
325
571
  source "$(akm vault path vault:prod)" → akm env run prod -- $SHELL
326
572
 
327
573
  # Run a command with the env injected
328
- akm vault run vault:prod -- ./deploy.sh → akm env run prod -- ./deploy.sh
574
+ 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)
329
575
 
330
576
  # Create / ingest an existing .env
331
- akm vault create prod → akm env create prod
577
+ 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)
332
578
  # or: akm env create prod --from-file ./.env
333
579
 
334
580
  # Edit (akm no longer manages entries)
335
- akm vault set vault:prod DB_URL → $EDITOR "$(akm env path prod --quiet)"
581
+ 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)
336
582
  # or: akm secret set db-url
337
583
  ```
338
584
 
@@ -376,8 +622,8 @@ is a security-relevant behaviour change.
376
622
 
377
623
  - The entire `akm vault` verb and its subcommands.
378
624
  - The `vault:` ref alias. Parsing a `vault:` ref now fails immediately with:
379
- `The \`vault\` asset type was removed in 0.9.0 — use \`env:\` (whole .env
380
- config) or \`secret:\` (a single value).`
625
+ `The \`vault\` asset type was removed in 0.9.0 — use \`env/\` (whole .env
626
+ config) or \`secrets/\` (a single value).`
381
627
  - The `vault` asset-spec entry, renderer (`vault-env`), and the `vault_access`
382
628
  audit-event alias.
383
629
  - The frozen `vaults/` directory is deleted **only** after explicit per-path
@@ -390,25 +636,21 @@ idiom before upgrading to 0.9.0.
390
636
 
391
637
  Because 0.9.0 removed the `vault` asset type, the indexer **no longer scans
392
638
  `vaults/` at all**. If you jumped from 0.7/0.8 to 0.9.0 and never ran
393
- `akm-migrate-storage`, the `.env` data still sitting in `vaults/` was never
639
+ `akm-migrate storage`, the `.env` data still sitting in `vaults/` was never
394
640
  copied to `env/` and will **not** appear under `env/…` — it is silently
395
641
  un-indexed (the files themselves are untouched on disk).
396
642
 
397
- To make this non-silent, 0.9.0 adds a **one-time, read-only guard**: whenever
398
- `akm index` (or any auto-index path) runs against a stash whose `vaults/`
399
- directory holds `.env` files but has no `vaults/.migrated` marker, akm prints a
400
- single warning pointing here and at `akm-migrate-storage`. The guard never
401
- reads secret contents, and never writes, moves, or deletes anything — it only
402
- detects the un-migrated state. The fix is the same idempotent, non-destructive
403
- command as on 0.8:
643
+ The 0.9 runtime does not inspect the retired `vaults/` tree. Use the standalone
644
+ migration tool to detect and copy any remaining files; it owns the
645
+ `vaults/.migrated` marker and remains idempotent and non-destructive:
404
646
 
405
647
  ```sh
406
- akm-migrate-storage --yes # copies vaults/ -> env/, leaving vaults/ intact
407
- akm index # refresh search so entries surface under env:
648
+ akm-migrate storage --yes # copies vaults/ -> env/, leaving vaults/ intact
649
+ akm index # refresh search so entries surface under env/
408
650
  ```
409
651
 
410
652
  The `vaults/ → env/` migration step still ships in 0.9.0's
411
- `akm-migrate-storage` (it is part of the `0.8 → 0.9` migration) precisely so a
653
+ `akm-migrate storage` (it is part of the `0.8 → 0.9` migration) precisely so a
412
654
  late migration on a 0.9.0 install still works.
413
655
 
414
656
  #### Verifying the migration
@@ -418,7 +660,7 @@ late migration on a 0.9.0 install still works.
418
660
  akm env list
419
661
 
420
662
  # The frozen copy + marker are present
421
- ls -la "$(akm info --format=json | jq -r .stashDir)/vaults/.migrated"
663
+ ls -la "$(akm info --format=json | jq -r .bundleDir)/vaults/.migrated"
422
664
 
423
665
  # Values still never leak
424
666
  akm show env/prod # key names only
@@ -431,17 +673,15 @@ The migration is non-destructive — `vaults/` is untouched. To roll back, delet
431
673
  the generated `env/` directory and remove the `vaults/.migrated` marker, then
432
674
  downgrade akm. Because `env/` is a copy, no data is lost either way.
433
675
 
434
- ### `--auto-accept` on `akm improve` — deprecated and ignored
676
+ ### Removed `--auto-accept` on `akm improve`
435
677
 
436
678
  The 0.9.0 confidence gate `--auto-accept` used to configure was deleted:
437
679
  proposals now queue for review (`akm proposal` / the drain engine) instead of
438
- being auto-promoted by threshold. The flag is accepted but ignored for one
439
- minor release installed crontabs embed the old command line, and a hard
440
- parse error would make scheduled background runs fail invisibly after upgrade.
441
- Any present value (bare flag, `safe`, `false`, a number, garbage) prints one
442
- deprecation warning on stderr and never throws. It will be a hard error in
443
- 0.10. Drop `--auto-accept` from your task definitions and scripts now; see
444
- [proposal triage](#4-behavioral-notes) for its replacement.
680
+ being auto-promoted by threshold. Through 0.9.x, `--auto-accept` is accepted
681
+ only as a compatibility flag: akm warns that it is removed and ignored, and
682
+ discards a space-separated value. Remove it from task definitions and scripts;
683
+ it becomes a hard error in 0.10. See [proposal triage](#4-behavioral-notes) for
684
+ the explicit replacement.
445
685
 
446
686
  ### Retired `--wiki` flag
447
687
 
@@ -460,6 +700,44 @@ budget). There is no replacement flag — retrieval-count signal still feeds
460
700
  ranking, just not through a dedicated eligibility fallback. Drop the flag from
461
701
  any scripted `akm improve` invocations.
462
702
 
703
+ ### `akm mv` → move the file, then `akm index`
704
+
705
+ 0.9.0 removes `akm mv` outright — no alias, no stub; `akm mv …` fails with the
706
+ standard unknown-command error. A rename **is** delete plus create in akm's
707
+ identity model (see [`STABILITY.md`](../../STABILITY.md) § Renames), and the
708
+ command's inbound-ref rewrite matched bare conceptIds rather than anchored
709
+ `bundle//conceptId` refs, so it could edit ordinary prose while leaving real
710
+ refs dangling. The supported procedure is three steps you can see the results
711
+ of:
712
+
713
+ ```sh
714
+ mv ~/akm/memories/projectA/old-note.md ~/akm/memories/projectA/new-note.md
715
+ akm index # the new path is indexed; the old entry drops out
716
+ akm lint # reports every inbound ref the rename left dangling
717
+ ```
718
+
719
+ Fix the refs `akm lint` reports (its `missing-ref` check covers body prose and
720
+ the frontmatter xref channels) and re-run `akm lint` until it is clean.
721
+ Cross-bundle movement is copy/import plus delete — never identity-preserving.
722
+
723
+ **Optional: carry the ranking signal over.** The destination gets a fresh
724
+ identity, so its accumulated signal — feedback, usage events, salience and
725
+ outcome history — stays keyed to the old ref and is eventually collected as
726
+ orphan rows. If the asset has earned history worth keeping, run the re-key
727
+ script from a source clone **before** `akm index`:
728
+
729
+ ```sh
730
+ mv ~/akm/memories/projectA/old-note.md ~/akm/memories/projectA/new-note.md
731
+ bun scripts/rekey-asset-ref.ts memories/projectA/old-note memories/projectA/new-note
732
+ akm index && akm lint
733
+ ```
734
+
735
+ Add `--dry-run` to see the row counts it would move. It refuses if both files
736
+ exist (that is a copy, not a rename), and it is idempotent — a second run
737
+ reports zero changed rows. See
738
+ [the 0.9.0 troubleshooting guide](v0.9.0-troubleshooting.md) for the symptom
739
+ this fixes after the fact.
740
+
463
741
  ## 4. Behavioral notes
464
742
 
465
743
  ### Adapter dispatch reclassification (installed non-akm bundles)
@@ -473,18 +751,63 @@ regenerable cache and rebuilds itself — but searches or saved refs into those
473
751
  bundles may resolve to the new spellings afterwards. Reindex with `akm index`
474
752
  right after the cutover so this settles before you rely on saved refs.
475
753
 
754
+ ### 0.8 workflow assets after migration
755
+
756
+ A workflow document created by 0.8's own `akm workflow create` used
757
+ heading-based steps (`## Step name` sections). 0.9.0 requires the step graph
758
+ in frontmatter (`steps:`) instead — see
759
+ [Ref grammar](#2-ref-grammar-typename--bundleconceptid) for the related
760
+ `index.md`/`log.md` reservation, and the workflow authoring reference for the
761
+ current shape. `migrate apply` does not rewrite workflow *definitions* (only
762
+ `workflow:` target refs inside task files), so a 0.8-authored workflow
763
+ document keeps its 0.8 heading structure verbatim after migration.
764
+
765
+ The concrete end state, if you leave such a document unconverted:
766
+
767
+ - `akm lint` reports structural validation errors against it (missing
768
+ frontmatter `steps:`, plus one error per heading that no longer matches a
769
+ declared step id).
770
+ - It is **not indexed** as a workflow: `akm search --type workflow` and
771
+ `akm show <ref>` will not find it.
772
+ - Any run already started against it before the upgrade is unaffected by the
773
+ document rewrite and **stays `active`** — 0.9 does not silently fail or
774
+ auto-close it — and pollutes unrelated `akm show` output for other assets
775
+ with a `WORKFLOW ACTIVE` banner (workflow status is looked up by target,
776
+ not by whether the definition still validates).
777
+
778
+ Fix either by rewriting the asset with a frontmatter `steps:` list (see the
779
+ workflow reference for the schema, or run `akm workflow create --print` for a
780
+ fresh template to copy the shape from), or, if the run is no longer wanted, by
781
+ retiring it explicitly:
782
+
783
+ ```sh
784
+ akm workflow list --active # find the stale run-id
785
+ akm workflow abandon <run-id> # marks it failed; resume can still reopen it
786
+ ```
787
+
788
+ `akm workflow abandon` only changes the run's status — it does not touch the
789
+ workflow document. Rewrite the document separately if you want the asset
790
+ itself to lint clean and be searchable again.
791
+
476
792
  ### `env`/`secret` writes now honor `--target` / `defaultWriteTarget`
477
793
 
478
794
  Previously, `env create`/`set`/`unset`/`remove` and `secret set`/`remove`
479
795
  selected a write destination independently of `--target` and
480
796
  `defaultWriteTarget`, ignoring writability and git commit boundaries. 0.9.0
481
- routes these mutations through the same `resolveWriteTarget` selection every
482
- other write command uses: explicit `--target` wins, else `defaultWriteTarget`,
483
- else the working stash and a non-writable target is refused. A git-backed
484
- writable target now lands the change in the same batch-at-boundary commit as
485
- any other write (see [below](#single-batch-at-boundary-git-commit)). Reads
486
- (`env run`/`show`/`list`/`path`/`export`, `secret run`/`path`/`list`) are
487
- unaffected — they still search every configured source.
797
+ routes the surviving mutating subcommands (`env create`/`remove`, `secret
798
+ set`) through the same `resolveWriteTarget` selection every other write
799
+ command uses: explicit `--target` wins, else `defaultWriteTarget`, else the
800
+ working stash and a non-writable target is refused. A git-backed writable
801
+ target now lands the change in the same batch-at-boundary commit as any other
802
+ write (see [below](#single-batch-at-boundary-git-commit)). Reads (`env
803
+ run`/`list`/`path`/`export`, `secret run`/`list`) are unaffected — they still
804
+ search every configured source.
805
+
806
+ `env set`/`env unset` and `secret path`/`secret remove` are not merely
807
+ unaffected — they no longer exist in 0.9.0 (see the
808
+ [CLI rename table](#cli-surface-overhaul-rename-table-090-hard-break) and
809
+ [`akm secret`'s removal note](../reference/cli.md#secret) for why `secret
810
+ path`/`secret remove` specifically were dropped rather than fixed).
488
811
 
489
812
  ### LLM enrichment concurrency defaults
490
813
 
@@ -493,8 +816,9 @@ configured LLM endpoint instead of always assuming a remote API: a **local**
493
816
  endpoint (`localhost`/`127.0.0.1`/`::1`/`*.localhost`) defaults to
494
817
  **concurrency 1** (a single loaded model; parallel requests trigger reload
495
818
  thrash), and a **remote** endpoint defaults to **concurrency 2** (enough to
496
- overlap request latency without hammering rate-limited APIs). Set
497
- `llm.concurrency` in `config.json` to override either default explicitly.
819
+ overlap request latency without hammering rate-limited APIs).
820
+ `engines.<name>.concurrency` does not currently affect indexing enrichment;
821
+ it does cap frozen workflow fan-out.
498
822
 
499
823
  ### CLI rename table (old → new, removed 0.9.0)
500
824
 
@@ -504,7 +828,7 @@ spellings entirely — there is no delegation, and using one is a usage error.
504
828
 
505
829
  | Old spelling (0.8, deprecated) | Canonical (use this) | Notes |
506
830
  | --- | --- | --- |
507
- | `akm proposals` | `akm proposal list` | bare `akm proposal` also lists |
831
+ | `akm proposals` | `akm proposal list` | bare `akm proposal` is now a usage error (exit 2) |
508
832
  | `akm show proposal <id>` | `akm proposal show <id>` | |
509
833
  | `akm diff <id>` | `akm proposal diff <id>` | |
510
834
  | `akm accept <id>` | `akm proposal accept <id>` | |
@@ -513,17 +837,72 @@ spellings entirely — there is no delegation, and using one is a usage error.
513
837
  | `--detail summary` | `--shape summary` | `--detail` is now verbosity only (`brief\|normal\|full`) |
514
838
  | `--detail agent` | `--shape agent` | |
515
839
  | `--for-agent` | `--shape agent` | |
516
- | `--source` (on `accept`/`reject`/`history`) | `--generator` | unchanged on `search`/`curate`/`graph`/`remember` |
840
+ | `--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 |
517
841
  | `akm save` | `akm sync` | `sync` = commit + optional push; adds `--no-push` |
518
- | `akm enable <component>` | `akm config enable <component>` | |
519
- | `akm disable <component>` | `akm config disable <component>` | |
842
+ | `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 |
843
+ | `akm disable <component>` | `akm registry remove <component>` | |
520
844
  | `akm events` | `akm log` | `log` is primary in 0.9.0; `history` is a different (asset-scoped) surface |
521
845
  | `akm wiki remove --force` | (removed — see [§3](#3-removed-surfaces)) | the whole `akm wiki` family is gone in 0.9.0 |
522
846
  | `akm feedback --note <text>` | `akm feedback --reason <text>` | |
523
847
  | `akm workflow next --dry-run` | (removed) | the flag is gone; `next` never supported a dry run |
524
848
 
525
- Additive (non-breaking) singular aliases also shipped in 0.8 and remain:
526
- `akm task` (= `akm tasks`) and `akm lesson` (= `akm lessons`).
849
+ 0.9.0 retires the plural `akm tasks` spelling entirely (no alias): `akm task`
850
+ is the sole scheduling group. Its remaining subcommands are `add`, `run`,
851
+ `sync`, `doctor`, and `history`; `list`, `remove`, `init`, `enable`, and
852
+ `disable` are removed. `akm lessons` was removed outright (see
853
+ [§3](#3-removed-surfaces)).
854
+
855
+ ### CLI surface overhaul rename table (0.9.0, hard break)
856
+
857
+ A second, larger rename pass landed within 0.9.0 itself: a full CLI-surface
858
+ overhaul with no deprecation window and no aliases. Every old spelling below
859
+ fails immediately with the standard unknown-command/unknown-flag error —
860
+ there was no 0.8.x warn-and-delegate period for these.
861
+
862
+ | Old spelling | New spelling / replacement | Notes |
863
+ | --- | --- | --- |
864
+ | `akm init` | `akm bundle create` | |
865
+ | `akm add` | `akm bundle add` | |
866
+ | `akm list` | `akm bundle list` | |
867
+ | `akm remove` | `akm bundle remove` | |
868
+ | `akm update` | `akm bundle update` | |
869
+ | `akm extract` | `akm proposal extract` | |
870
+ | `akm propose` | `akm proposal new` | |
871
+ | `akm registry search` | `akm search --from registry` | `--assets` folds in too |
872
+ | `akm tasks ...` | `akm task add\|run\|sync\|doctor\|history` | singular group; no plural alias; `list`, `remove`, `init`, `enable`, and `disable` are removed |
873
+ | `akm lessons` / `akm lesson` (command group) | (removed) | the `lesson` asset **type** is unaffected — read/write it via `akm search`/`akm show`/the proposal queue |
874
+ | `akm history` | (removed) | `--accept-rate-by-source` folded into `akm health --report` |
875
+ | `akm log tail` | `akm log --since '@offset:<id>'` | poll from a cooperating process; no daemon |
876
+ | `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 |
877
+ | `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 |
878
+ | `akm workflow template` | `akm workflow create --print` | prints the template without writing |
879
+ | `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 |
880
+ | `akm workflow watch <run-id>` | `akm log --run <run-id> --since '@offset:<id>'` | |
881
+ | `akm workflow start <ref> --params '<json>'` | `akm workflow run <ref> --<param> <value> ...` | `run` is the canonical start/resume/execute command; parameter flags must exactly match declared names, and `--force` parallel starts are removed |
882
+ | `akm workflow next <target>` | `akm workflow run <target>` or `akm workflow status <target>` | use `run` to execute and `status` to inspect; there is no step-at-a-time native lifecycle |
883
+ | `akm workflow complete ...` | `akm workflow run ...` | native orchestration completes steps itself |
884
+ | `akm workflow brief` / `akm workflow report` | `akm workflow run <target>` | the experimental external-driver protocol was removed; `run` dispatches and records units itself |
885
+ | `akm workflow run <ref> --params '<json>'` | `akm workflow run <ref> --<param> <value> ...` | the JSON parameter bag is removed; repeat array flags or pass object/whole-array values as JSON |
886
+ | `akm extract --watch` / `--debounce-ms` | (removed) | use the shipped `core/extract.yml` cron template instead of a foreground daemon |
887
+ | `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 |
888
+ | `akm config show` | `akm config list` | `show` was a self-declared alias |
889
+ | `akm config validate` | (removed) | load-time schema checks already reject an invalid config |
890
+ | `akm index --background` | (removed) | the flag never actually backgrounded the process |
891
+ | `akm setup --detect-only` / `--reset-recommended` | (removed) | environment detection runs inside `akm setup`; `akm info` reports the *configured* capabilities, not a detection scan |
892
+ | `akm env set` / `akm env unset` | (removed) | edit the `.env` file directly, or ingest one with `env create --from-file` |
893
+ | `--source` on `search` / `curate` | `--from` | value rename too: `stash` → `local`, `both` → `all` |
894
+ | `--target` on `remember` / `clone` / `improve` / `task add`/`run`/`sync`/`history` | `--bundle` | `import`, `proposal accept`/`diff`/`revert`, `env create`/`remove`, and `secret set` **keep** `--target` |
895
+ | `AKM_STASH_DIR` | `AKM_BUNDLE_DIR` | no fallback to the old name |
896
+ | 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 |
897
+ | "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 |
898
+
899
+ **Scheduler ABI respelling.** Installed cron/launchd/schtasks entries invoke
900
+ `akm task run <id> ... --scheduled` (previously a `tasks` spelling on some
901
+ installs). `akm task sync` detects an entry whose argv no longer parses under
902
+ the current spelling — treating it as an orphan of its marker id — and
903
+ reinstalls it from the current file state. Run `akm task sync --rebind` once
904
+ after upgrading to 0.9.0 to explicitly capture the current binary/invocation
905
+ in every installed scheduler entry; see [§1](#1-cross-the-boundary-akm-migrate-status--akm-migrate-apply).
527
906
 
528
907
  ### Safety guards added in 0.8 (behavior change for non-interactive callers)
529
908
 
@@ -574,7 +953,7 @@ ref scalars; it does not convert an arbitrary prompt task into this command. The
574
953
  deterministic `akm proposal drain` verb, or the folded strategy pre-pass, is the
575
954
  supported 0.9 path.
576
955
 
577
- ### Single batch-at-boundary git commit (`options.pushOnCommit` deprecated)
956
+ ### Single batch-at-boundary git commit
578
957
 
579
958
  0.9.0 unifies the two commit models for git-backed sources onto a single
580
959
  **batch-at-boundary** model (issue #507). Previously, writing an asset to a
@@ -584,17 +963,14 @@ on `options.pushOnCommit`. That staged only the single asset file (leaving
584
963
 
585
964
  Now every write/delete to a source is a plain filesystem operation with **no**
586
965
  per-asset commit. Git-backed targets are committed **once** at the end of the
587
- operation (e.g. `akm remember --target <git-source>`, proposal accept/revert,
966
+ operation (e.g. `akm remember --bundle <git-source>`, proposal accept/revert,
588
967
  consolidate) as a single complete commit (`git add -A` staging `.akm/` + assets
589
968
  together), pushed under the same `writable + remote` gate as `akm save`/`akm sync`.
590
969
 
591
- **Migration:** `options.pushOnCommit` is **deprecated**. Existing configs still
592
- parse its push intent is honored via the batch push gate, and akm prints a
593
- one-time deprecation warning when it encounters the option. Remove
594
- `pushOnCommit` from your source config and rely on `writable: true` (plus a
595
- configured remote) to push. No behavior is lost: a writable git target with a
596
- remote is still pushed; a target without a remote (or with push disabled)
597
- commits only.
970
+ **Migration:** `options.pushOnCommit` is rejected at config load. Remove it
971
+ from your source config and rely on `writable: true` (plus a configured remote)
972
+ to push. A writable git target with a remote is still pushed; a target without
973
+ a remote (or with push disabled) commits only.
598
974
 
599
975
  ## Engine And Task Assets
600
976
 
@@ -608,12 +984,11 @@ Replace `profiles.llm.<name>` and `profiles.agent.<name>` with one
608
984
  Do not reuse a colliding LLM and agent profile name without deciding which new
609
985
  engine names make the distinction clear. AKM cannot safely infer that choice.
610
986
 
611
- New task files use strict YAML v2. During `migrate apply`, valid 0.8 task files
612
- with legacy workflow-target refs are surgically rewritten to canonical refs;
613
- other fields and current refs remain byte-identical. The 0.9 reader continues to
614
- normalize their missing/`1` version, prompt `profile:` field, permissive scalar
615
- forms, and `akm improve --profile` commands in memory. Update user-authored files
616
- to `version: 2` when editing them:
987
+ Task files use strict YAML v2. During `migrate apply`, valid 0.8 task files are
988
+ rewritten on disk to v2. The standalone migrator canonicalizes workflow refs,
989
+ moves prompt `profile:` to `engine:`, normalizes permissive scalar forms, maps
990
+ bare-current-AKM `improve --profile` to `--strategy`, and removes the retired
991
+ `--auto-accept` argument. The 0.9 runtime does not read v1 task files:
617
992
 
618
993
  ```yaml
619
994
  version: 2
@@ -627,9 +1002,14 @@ enabled: true
627
1002
 
628
1003
  Prompt tasks may use `engine`, `model`, `timeoutMs`, and `llm`; command tasks
629
1004
  may use `timeoutMs`; workflow tasks may use `params`. Unknown and wrong-target
630
- keys are errors in v2. Unsupported future versions are reported by `akm tasks
631
- list`, `sync`, and `doctor`. Reader normalization changes only the removed AKM
632
- spellings; arbitrary shell commands are never rewritten.
1005
+ keys are errors in v2. Unsupported versions are reported by current task
1006
+ commands. Migration changes only removed AKM spellings; arbitrary shell
1007
+ commands are never rewritten.
1008
+
1009
+ A workflow task now invokes the same native orchestration as `akm workflow
1010
+ run`: it executes to completion, failure, or verification rejection rather
1011
+ than merely creating a run row. Review scheduled workflow tasks for the
1012
+ resulting execution and cost impact before re-enabling the scheduler.
633
1013
 
634
1014
  For 0.8 command tasks, syntax migration and self-invocation routing are separate.
635
1015
  `--profile` is lowered only for a PATH-selected bare `akm`/`akm.exe`, including
@@ -641,20 +1021,17 @@ is operator-owned: it keeps selecting that exact binary and its command argv is
641
1021
  retained exactly. In particular, AKM does not change syntax sent to a retained
642
1022
  0.8 binary. Version-2 commands receive no compatibility rewriting.
643
1023
 
644
- The published 0.8 core `backup.yml` is a special unsafe legacy definition. It
645
- was enabled and ran `akm db backups`, but that command only listed snapshots; it
646
- did not create a recurring backup. In 0.9, `tasks add` refuses the enabled exact
647
- bare-self command before changing its source file or scheduler. `tasks sync`
648
- reports it in `skipped`, does not install a missing entry, and disables an
649
- existing scheduler entry while preserving the task file byte-for-byte. `tasks
650
- enable` also refuses to re-enable it. This quarantine applies only when bare
651
- `akm`/`akm.exe` is followed by exactly `db backups`; an explicit executable path
652
- is operator-owned and is not quarantined. Use `akm backup create --for 0.9.0`
653
- for an explicit migration recovery snapshot. Existing 0.8 data-directory backup
654
- folders are left untouched by migration.
1024
+ The published 0.8 core `backup.yml` is a special unsafe definition. It was
1025
+ enabled and ran `akm db backups`, but that command only listed snapshots; it did
1026
+ not create a recurring backup. The standalone migrator disables the exact bare
1027
+ `akm db backups` task while preserving its command for operator review. An
1028
+ explicit executable path is operator-owned and is not changed. Replace or remove
1029
+ the disabled task; use `akm-migrate backup --for 0.9.0` for an explicit migration
1030
+ recovery snapshot. Existing 0.8 data-directory backup folders are left
1031
+ untouched.
655
1032
 
656
1033
  Task `enabled` state controls scheduler-originated execution, not explicit
657
- operator invocation. `akm tasks run <id>` intentionally runs a disabled task so
1034
+ operator invocation. `akm task run <id>` intentionally runs a disabled task so
658
1035
  manual catch-up definitions remain useful. Backend-generated invocations carry
659
1036
  the internal `--scheduled` marker and record a `disabled` result without running
660
1037
  the target. Do not use the manual command as a scheduler replacement.
@@ -678,88 +1055,67 @@ than inventing a command classification. New runs use the correct target kind.
678
1055
 
679
1056
  ## 5. Troubleshooting
680
1057
 
681
- ### "Cannot convert state.db out of WAL mode for migration"
1058
+ ### Database is busy
682
1059
 
683
- `akm migrate apply` fails with:
684
-
685
- > Cannot convert state.db out of WAL mode for migration — another akm process
686
- > is holding it open. Close other akm processes and re-run `akm migrate apply`.
687
-
688
- This means a live `akm` process (or a zombie connection from a prior crashed
689
- one) still has `state.db` open in WAL mode, which blocks the checkpoint apply
690
- needs to fold `workflow.db` in. Close every other `akm` process (schedulers,
691
- `akm workflow run`, background `improve` runs) and re-run `akm migrate apply`
692
- — it resumes from the last completed phase rather than starting over.
1060
+ Close every other `akm` process, including schedulers, workflow runs, and
1061
+ background improve jobs, then re-run `akm migrate apply`. Apply holds the
1062
+ maintenance barrier and refuses to begin while known database handles, process
1063
+ locks, or workflow claims are active.
693
1064
 
694
1065
  ### Resuming after a crash
695
1066
 
696
1067
  If `akm migrate apply` is interrupted (killed, host crash, power loss), do not
697
1068
  manually edit or delete anything under `$DATA`. Run `akm migrate status` to
698
- read the pending phase, then re-run `akm migrate apply` with the same
699
- `--config` (or none, if the active config is already the target) — it
700
- authenticates the retained target and verified backup by fingerprint and
701
- resumes idempotently from the last durable phase (`prepared`, `state-converting`, `state-collapsing`, `state-applied`,
702
- `workflow-applied`, `cutover-applied`, `config-applied`, `tasks-prepared`,
703
- `tasks-applied`, `pilot-prepared`, `pilot-applied`, `rollback-prepared`, or `committed`). A
704
- malformed or fingerprint-mismatched journal fails closed for operator
705
- diagnosis instead of guessing.
1069
+ confirm that an incomplete apply is present, then re-run `akm migrate apply`.
1070
+ The sentinel already contains the original target and path base, so `--config`
1071
+ is not needed on a retry. Apply reuses the same verified backup and operation ID,
1072
+ reruns every idempotent transform, verifies final outcomes, and removes the
1073
+ sentinel. A malformed sentinel fails closed for operator diagnosis.
706
1074
 
707
- ### Restoring or downgrading the cutover
1075
+ ### Restoring migration control state
708
1076
 
709
1077
  Stop scheduled AKM jobs and all running `akm improve`, `akm extract`, and
710
1078
  workflow engine processes first. Restore refuses while a live process lock or
711
1079
  workflow lease exists. Then, while still running the 0.9 binary, restore the
712
- complete pre-cutover snapshot:
1080
+ pre-cutover config and database snapshot:
713
1081
 
714
1082
  ```sh
715
- akm backup restore --for 0.9.0 --run <run-id> --confirm
1083
+ akm-migrate restore --for 0.9.0 --run <run-id> --confirm
716
1084
  ```
717
1085
 
718
1086
  Restore verifies the selected run before changing live files and then creates a
719
- second verified rescue run of the current installation. It stages every
720
- replacement beside its destination, writes a durable restore journal,
721
- quarantines each database together with its WAL/SHM sidecars, and only then
722
- publishes clean staged files. The journal records a durable committed phase
723
- before cleanup: an earlier interruption rolls back, while an interruption after
724
- commit finishes cleanup without mixing generations. While either recovery phase
725
- is pending, ordinary config and canonical database access fail closed before
726
- accepting writes or recreating absent files. The selected and rescue runs remain
727
- under `$DATA`; if verification reports corruption, preserve them and recover
728
- from an independent backup.
729
-
730
- Recovery validates the complete restore journal before removing or renaming any
731
- path: journal format and migration version, phase, exact artifact and SQLite
732
- sidecar set, operation-bound stage/quarantine names, path uniqueness, source
733
- backup, and the expected prepared/committed filesystem state. A malformed or
734
- stale journal remains in place and recovery fails closed for operator diagnosis.
735
- Committed recovery additionally authenticates each published artifact against
736
- the selected backup's byte size and streaming SHA-256, then reruns config-state
737
- validation or SQLite `quick_check` and ledger validation before deleting any
738
- quarantine or journal.
739
-
740
- Prepared rollback is itself crash-idempotent. The journal fingerprints the
741
- original config/database/sidecar generation before quarantine. If recovery dies
742
- after restoring a quarantine or deleting a stage but before journal deletion,
743
- the next recovery authenticates the already-restored destination and continues
744
- cleanup. A same-ledger but byte-different substitution fails closed.
745
-
746
- Migration config files, manifests, and apply/restore journals are read through
1087
+ second verified rescue run of the current installation. It writes one
1088
+ phase-free restore sentinel, stages each selected artifact beside its
1089
+ destination, removes stale SQLite sidecars, and publishes the config last. If
1090
+ interrupted, ordinary config and canonical database access remain blocked and
1091
+ the next recovery repeats the same replacements from the selected backup until
1092
+ semantic verification passes. The selected and rescue runs remain under
1093
+ `$DATA`; if verification reports corruption, preserve them and recover from an
1094
+ independent backup.
1095
+
1096
+ Recovery runs do not copy writable bundle content. Reserved-file rename and ref
1097
+ plans are retained; sidecar/frontmatter rewrites are inherently idempotent, and
1098
+ task rewrites are re-planned on each apply. Restore replaces config and databases
1099
+ only. Already-migrated content stays in its forward-compatible form so a later
1100
+ 0.9 apply can converge without undoing filesystem changes.
1101
+
1102
+ Migration config files, manifests, and apply/restore sentinels are read through
747
1103
  bounded readers (1 MiB each). Oversized local control files fail closed rather
748
- than being loaded wholesale. Apply also measures the complete serialized journal
1104
+ than being loaded wholesale. Apply also measures the complete serialized sentinel
749
1105
  before its first write; a near-limit config whose expanded target would exceed
750
- the same cap is rejected before any apply journal or artifact mutation.
1106
+ the same cap is rejected before any apply sentinel or artifact mutation.
751
1107
 
752
- Only after restore succeeds should you install the older AKM binary. A 0.8
753
- binary must not run against a 0.9 config or against `state.db` migration 017 /
754
- `workflow.db` migration 010. If no valid pre-cutover bundle exists, do not
755
- downgrade in place: preserve the current config and databases, create a separate
756
- 0.8 data/config root, and manually reconstruct the profile-based configuration.
1108
+ Do not install a 0.8 binary into this restored installation: writable content may
1109
+ already use 0.9 task and ref formats. Restore is a control-state recovery step for
1110
+ a later 0.9 apply, not an in-place downgrade. To run 0.8 again, recover config,
1111
+ databases, and writable content from an independent pre-cutover backup, or create
1112
+ a separate 0.8 data/config/content root and reconstruct it manually.
757
1113
 
758
1114
  ### Where backups live
759
1115
 
760
1116
  Recovery runs are stored under
761
1117
  `$DATA/backups/migrations/<installation-id>/<run-id>/`. They record present and
762
- absent `config.json`, `state.db`, and `workflow.db` artifacts, ordered
763
- migration ledgers, sizes, and streaming SHA-256 hashes. `akm backup create
764
- --for 0.9.0` creates an additional unique run when an operator wants a manual
765
- snapshot outside of `apply`'s automatic one.
1118
+ absent `config.json`, `state.db`, `workflow.db`, and `index.db` artifacts,
1119
+ ordered migration ledgers, and semantic state. `akm-migrate backup --for 0.9.0`
1120
+ creates an additional unique run when an operator wants a manual snapshot
1121
+ outside of `apply`'s automatic one.