akm-cli 0.9.1 → 0.9.2-alpha.2

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 (350) hide show
  1. package/CHANGELOG.md +103 -28
  2. package/README.md +3 -1
  3. package/SECURITY.md +1 -1
  4. package/STABILITY.md +1 -1
  5. package/dist/akm +2 -2
  6. package/dist/akm-migrate +2 -2
  7. package/dist/assets/hints/cli-hints-full.md +14 -9
  8. package/dist/assets/improve-strategies/proactive-maintenance.json +1 -1
  9. package/dist/assets/improve-strategies/reflect-distill.json +1 -1
  10. package/dist/assets/models.json +35 -0
  11. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +3 -4
  12. package/dist/assets/stash-skeleton/facts/conventions/organization.md +1 -3
  13. package/dist/assets/tasks/core/extract.yml +6 -5
  14. package/dist/assets/tasks/core/improve.yml +6 -5
  15. package/dist/assets/tasks/core/index-refresh.yml +6 -5
  16. package/dist/assets/tasks/core/sync.yml +6 -5
  17. package/dist/assets/tasks/core/version-check.yml +6 -5
  18. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +6 -5
  19. package/dist/assets/tasks/improve/akm-improve-catchup.yml +6 -5
  20. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +6 -5
  21. package/dist/assets/tasks/improve/akm-improve-frequent.yml +6 -5
  22. package/dist/assets/tasks/improve/akm-improve-nightly.yml +6 -5
  23. package/dist/cli/confirm.js +2 -2
  24. package/dist/cli/parse-args.js +3 -24
  25. package/dist/cli/retired-commands.js +1 -1
  26. package/dist/cli/shared.js +2 -2
  27. package/dist/cli.js +11 -9
  28. package/dist/commands/agent/agent-dispatch.js +55 -89
  29. package/dist/commands/agent/contribute-cli.js +12 -45
  30. package/dist/commands/command/builtin-action.js +32 -0
  31. package/dist/commands/command/command-cli.js +99 -0
  32. package/dist/commands/command/command-execution.js +308 -0
  33. package/dist/commands/command/execution-source-loader.js +176 -0
  34. package/dist/commands/command/portable-template.js +60 -0
  35. package/dist/commands/config-cli.js +10 -4
  36. package/dist/commands/env/env.js +4 -2
  37. package/dist/commands/feedback-cli.js +1 -1
  38. package/dist/commands/health/checks.js +241 -29
  39. package/dist/commands/health/html-report.js +0 -14
  40. package/dist/commands/health/report-view-model.js +0 -1
  41. package/dist/commands/health/surfaces.js +6 -7
  42. package/dist/commands/health/types.js +0 -2
  43. package/dist/commands/health.js +63 -18
  44. package/dist/commands/improve/collapse-detector.js +5 -6
  45. package/dist/commands/improve/consolidate.js +251 -214
  46. package/dist/commands/improve/distill/promote-memory.js +71 -34
  47. package/dist/commands/improve/distill/quality-gate.js +17 -5
  48. package/dist/commands/improve/distill.js +232 -155
  49. package/dist/commands/improve/eligibility.js +112 -79
  50. package/dist/commands/improve/execution.js +57 -0
  51. package/dist/commands/improve/extract-cli.js +5 -5
  52. package/dist/commands/improve/extract-prompt.js +64 -22
  53. package/dist/commands/improve/extract.js +608 -360
  54. package/dist/commands/improve/improve-strategies.js +43 -14
  55. package/dist/commands/improve/improve.js +249 -29
  56. package/dist/commands/improve/loop-stages.js +11 -17
  57. package/dist/commands/improve/memory/memory-contradiction-detect.js +90 -66
  58. package/dist/commands/improve/outcome-loop.js +22 -38
  59. package/dist/commands/improve/planner.js +134 -0
  60. package/dist/commands/improve/preparation.js +730 -409
  61. package/dist/commands/improve/reflect.js +386 -223
  62. package/dist/commands/improve/run-context.js +3 -4
  63. package/dist/commands/improve/salience.js +6 -58
  64. package/dist/commands/improve/session-asset.js +12 -12
  65. package/dist/commands/lint/index.js +101 -29
  66. package/dist/commands/migrate-cli.js +11 -69
  67. package/dist/commands/migration-tool.js +6 -9
  68. package/dist/commands/models-cli.js +27 -0
  69. package/dist/commands/proposal/drain.js +258 -186
  70. package/dist/commands/proposal/proposal-cli.js +32 -10
  71. package/dist/commands/proposal/proposal.js +2 -5
  72. package/dist/commands/proposal/propose.js +192 -172
  73. package/dist/commands/proposal/repository.js +54 -91
  74. package/dist/commands/proposal/validators/proposal-validators.js +9 -7
  75. package/dist/commands/read/curate.js +53 -22
  76. package/dist/commands/read/registry-search.js +25 -9
  77. package/dist/commands/read/remember-cli.js +14 -2
  78. package/dist/commands/read/search.js +10 -4
  79. package/dist/commands/read/show.js +139 -153
  80. package/dist/commands/registry-cli.js +16 -7
  81. package/dist/commands/remember.js +33 -18
  82. package/dist/commands/sources/add-cli.js +19 -178
  83. package/dist/commands/sources/bundle-cli.js +15 -3
  84. package/dist/commands/sources/dangerous-env-audit.js +135 -0
  85. package/dist/commands/sources/info.js +2 -1
  86. package/dist/commands/sources/installed-stashes.js +901 -177
  87. package/dist/commands/sources/schema-repair.js +174 -95
  88. package/dist/commands/sources/self-update.js +30 -74
  89. package/dist/commands/sources/source-add.js +3 -5
  90. package/dist/commands/sources/sources-cli.js +2 -15
  91. package/dist/commands/sources/update-transaction.js +220 -0
  92. package/dist/commands/tasks/tasks-cli.js +3 -3
  93. package/dist/commands/tasks/tasks.js +736 -317
  94. package/dist/commands/workflow-cli.js +2 -2
  95. package/dist/core/adapter/adapters/agent-skills-adapter.js +3 -0
  96. package/dist/core/adapter/adapters/akm-adapter.js +85 -35
  97. package/dist/core/adapter/adapters/akm-lint.js +54 -39
  98. package/dist/core/adapter/adapters/akm-metadata.js +45 -45
  99. package/dist/core/adapter/adapters/akm-task-adapter.js +32 -49
  100. package/dist/core/adapter/adapters/akm-workflow-adapter.js +38 -23
  101. package/dist/core/adapter/adapters/dotenv-adapter.js +30 -1
  102. package/dist/core/adapter/adapters/generic-files-adapter.js +11 -0
  103. package/dist/core/adapter/adapters/index.js +0 -9
  104. package/dist/core/adapter/adapters/llm-wiki-adapter.js +4 -0
  105. package/dist/core/adapter/adapters/okf-adapter.js +4 -0
  106. package/dist/core/adapter/adapters/opencode-adapter.js +5 -8
  107. package/dist/core/adapter/adapters/tool-dir-shared.js +63 -6
  108. package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -0
  109. package/dist/core/adapter/execution-source.js +308 -0
  110. package/dist/core/adapter/recognize-match.js +36 -13
  111. package/dist/core/adapter/registry.js +0 -9
  112. package/dist/core/asset/stash-meta.js +94 -4
  113. package/dist/core/common.js +6 -11
  114. package/dist/core/config/config-io.js +3 -3
  115. package/dist/core/config/config-schema.js +18 -40
  116. package/dist/core/config/config-sources.js +11 -21
  117. package/dist/core/config/config-walker.js +31 -13
  118. package/dist/core/config/config.js +23 -26
  119. package/dist/core/config/schema/engines.js +8 -7
  120. package/dist/core/config/schema/improve-processes.js +29 -5
  121. package/dist/core/config/schema/index-config.js +0 -27
  122. package/dist/core/config/schema/primitives.js +1 -23
  123. package/dist/core/config/schema/sources-bundles.js +13 -16
  124. package/dist/core/errors.js +2 -0
  125. package/dist/core/events.js +68 -32
  126. package/dist/core/extra-params.js +1 -0
  127. package/dist/core/improve-result.js +315 -0
  128. package/dist/core/lesson-lint.js +0 -6
  129. package/dist/core/maintenance-barrier.js +4 -4
  130. package/dist/core/network-policy.js +152 -0
  131. package/dist/core/paths.js +1 -1
  132. package/dist/core/recognition-util.js +4 -4
  133. package/dist/core/registry-url.js +456 -0
  134. package/dist/core/state/migrations.js +161 -47
  135. package/dist/core/state-db.js +453 -80
  136. package/dist/core/system-error.js +32 -0
  137. package/dist/core/time.js +2 -12
  138. package/dist/core/write-source.js +0 -18
  139. package/dist/execution/directory-identity.js +52 -0
  140. package/dist/execution/executable-identity.js +107 -0
  141. package/dist/execution/guarded-source.js +398 -0
  142. package/dist/execution/json.js +95 -0
  143. package/dist/{commands/health/types-session-log.js → execution/limits.js} +2 -1
  144. package/dist/execution/record.js +55 -0
  145. package/dist/execution/resolved-request.js +730 -0
  146. package/dist/execution/source.js +320 -0
  147. package/dist/indexer/bundle-identity-guard.js +5 -4
  148. package/dist/indexer/db/graph-db.js +33 -0
  149. package/dist/indexer/graph/graph-boost.js +3 -4
  150. package/dist/indexer/graph/graph-extraction.js +562 -373
  151. package/dist/indexer/index-written-assets.js +78 -39
  152. package/dist/indexer/indexer.js +471 -432
  153. package/dist/indexer/installations.js +6 -0
  154. package/dist/indexer/lookup/adapter-concept-owner.js +283 -0
  155. package/dist/indexer/materialize-embeddings.js +155 -0
  156. package/dist/indexer/passes/memory-inference.js +227 -174
  157. package/dist/indexer/passes/metadata.js +263 -118
  158. package/dist/indexer/scan/doc-to-entry.js +7 -10
  159. package/dist/indexer/scan/drain-dir.js +51 -23
  160. package/dist/indexer/search/db-search.js +156 -50
  161. package/dist/indexer/search/fts-query.js +40 -40
  162. package/dist/indexer/search/ranking.js +36 -1
  163. package/dist/indexer/search/search-attribution.js +3 -1
  164. package/dist/indexer/search/search-fields.js +23 -14
  165. package/dist/indexer/search/search-hit-enrichers.js +1 -1
  166. package/dist/indexer/search/search-source.js +7 -16
  167. package/dist/indexer/search/semantic-status.js +10 -1
  168. package/dist/indexer/usage/show-usage.js +105 -0
  169. package/dist/indexer/usage/usage-events.js +7 -2
  170. package/dist/indexer/walk/matchers.js +40 -10
  171. package/dist/indexer/walk/path-resolver.js +5 -2
  172. package/dist/indexer/walk/walker.js +20 -2
  173. package/dist/integrations/agent/builder-shared.js +3 -6
  174. package/dist/integrations/agent/conversation-fallback.js +16 -0
  175. package/dist/integrations/agent/engine-resolution.js +87 -87
  176. package/dist/integrations/agent/execution-cascade.js +566 -0
  177. package/dist/integrations/agent/execution-definitions.js +211 -0
  178. package/dist/integrations/agent/execution-lowering.js +811 -0
  179. package/dist/integrations/agent/execution-preparation.js +67 -0
  180. package/dist/integrations/agent/index.js +0 -2
  181. package/dist/integrations/agent/inline-execution.js +74 -0
  182. package/dist/integrations/agent/model-map.js +515 -0
  183. package/dist/integrations/agent/persona-fallback.js +30 -0
  184. package/dist/integrations/agent/request-lowering.js +186 -0
  185. package/dist/integrations/agent/runner-dispatch.js +230 -37
  186. package/dist/integrations/agent/runner.js +12 -83
  187. package/dist/integrations/harnesses/aider/agent-builder.js +8 -0
  188. package/dist/integrations/harnesses/aider/index.js +0 -1
  189. package/dist/integrations/harnesses/amazonq/agent-builder.js +8 -0
  190. package/dist/integrations/harnesses/amazonq/index.js +0 -1
  191. package/dist/integrations/harnesses/claude/agent-builder.js +14 -1
  192. package/dist/integrations/harnesses/claude/index.js +1 -5
  193. package/dist/integrations/harnesses/claude/session-log.js +3 -33
  194. package/dist/integrations/harnesses/codex/agent-builder.js +8 -0
  195. package/dist/integrations/harnesses/codex/index.js +0 -1
  196. package/dist/integrations/harnesses/copilot/agent-builder.js +8 -0
  197. package/dist/integrations/harnesses/copilot/index.js +0 -1
  198. package/dist/integrations/harnesses/gemini/agent-builder.js +8 -0
  199. package/dist/integrations/harnesses/gemini/index.js +0 -1
  200. package/dist/integrations/harnesses/index.js +4 -44
  201. package/dist/integrations/harnesses/opencode/agent-builder.js +16 -9
  202. package/dist/integrations/harnesses/opencode/index.js +0 -2
  203. package/dist/integrations/harnesses/opencode/session-log.js +14 -204
  204. package/dist/integrations/harnesses/opencode-sdk/harness.js +12 -1
  205. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +40 -42
  206. package/dist/integrations/harnesses/openhands/agent-builder.js +8 -0
  207. package/dist/integrations/harnesses/openhands/index.js +0 -1
  208. package/dist/integrations/harnesses/pi/agent-builder.js +8 -0
  209. package/dist/integrations/harnesses/pi/index.js +0 -1
  210. package/dist/integrations/harnesses/shared.js +0 -1
  211. package/dist/integrations/harnesses/types.js +1 -3
  212. package/dist/integrations/lockfile.js +82 -79
  213. package/dist/integrations/session-logs/index.js +6 -17
  214. package/dist/integrations/session-logs/provider-base.js +1 -29
  215. package/dist/llm/client.js +10 -5
  216. package/dist/llm/embedder.js +6 -7
  217. package/dist/llm/embedders/local.js +37 -88
  218. package/dist/llm/embedders/types.js +1 -1
  219. package/dist/llm/graph-extract.js +75 -50
  220. package/dist/llm/index-passes.js +43 -5
  221. package/dist/llm/memory-infer.js +8 -6
  222. package/dist/llm/metadata-enhance.js +5 -3
  223. package/dist/llm/structured-call.js +122 -25
  224. package/dist/output/format-exempt.js +1 -1
  225. package/dist/output/render-registry.js +0 -16
  226. package/dist/output/renderers.js +12 -7
  227. package/dist/output/shapes/curate.js +1 -0
  228. package/dist/output/shapes/helpers.js +10 -2
  229. package/dist/output/shapes/passthrough.js +2 -0
  230. package/dist/output/text/command-format.js +31 -33
  231. package/dist/output/text/health-format.js +1 -29
  232. package/dist/output/text/migrate.js +6 -56
  233. package/dist/output/text/proposal-format.js +16 -1
  234. package/dist/output/text/workflow-format.js +16 -0
  235. package/dist/registry/network.js +279 -0
  236. package/dist/registry/pinned-request-helper.js +247 -0
  237. package/dist/registry/pinned-transport.js +717 -0
  238. package/dist/registry/providers/skills-sh.js +18 -6
  239. package/dist/registry/providers/static-index.js +20 -7
  240. package/dist/registry/resolve.js +53 -28
  241. package/dist/scripts/akm-migrate-node.js +19334 -52269
  242. package/dist/scripts/akm-migrate.js +19270 -51612
  243. package/dist/setup/registry-stash-loader.js +64 -20
  244. package/dist/setup/semantic-assets.js +9 -34
  245. package/dist/setup/setup.js +12 -30
  246. package/dist/setup/source-identity.js +17 -0
  247. package/dist/setup/steps/sources.js +36 -15
  248. package/dist/setup/steps/tasks.js +39 -11
  249. package/dist/sources/providers/git-provider.js +3 -3
  250. package/dist/sources/providers/npm.js +2 -2
  251. package/dist/sources/providers/provider-utils.js +4 -3
  252. package/dist/sources/providers/website.js +11 -7
  253. package/dist/sources/snapshot-fetchers/host-guard.js +9 -136
  254. package/dist/sources/snapshot-fetchers/website-ingest.js +25 -109
  255. package/dist/sources/website-url.js +73 -0
  256. package/dist/storage/engines/sqlite-migrations.js +81 -26
  257. package/dist/storage/managed-db.js +27 -24
  258. package/dist/storage/repositories/events-repository.js +3 -0
  259. package/dist/storage/repositories/index-connection.js +42 -10
  260. package/dist/storage/repositories/index-entries-repository.js +203 -229
  261. package/dist/storage/repositories/index-entry-mapper.js +8 -12
  262. package/dist/storage/repositories/index-entry-schema.js +255 -0
  263. package/dist/storage/repositories/index-fts-repository.js +64 -71
  264. package/dist/storage/repositories/index-llm-cache-repository.js +8 -13
  265. package/dist/storage/repositories/index-meta-repository.js +0 -11
  266. package/dist/storage/repositories/index-schema.js +74 -350
  267. package/dist/storage/repositories/index-utility-repository.js +12 -17
  268. package/dist/storage/repositories/index-vec-repository.js +56 -7
  269. package/dist/storage/repositories/proposals-repository.js +4 -127
  270. package/dist/storage/repositories/registry-cache.js +2 -1
  271. package/dist/storage/repositories/task-history-repository.js +20 -40
  272. package/dist/storage/repositories/workflow-runs-repository.js +228 -129
  273. package/dist/storage/sqlite-read-snapshot.js +148 -0
  274. package/dist/tasks/backends/cron.js +170 -42
  275. package/dist/tasks/backends/index.js +1 -1
  276. package/dist/tasks/backends/launchd.js +787 -202
  277. package/dist/tasks/backends/schtasks.js +282 -83
  278. package/dist/tasks/embedded.js +7 -7
  279. package/dist/tasks/frozen-script.js +50 -0
  280. package/dist/tasks/resolve-akm-bin.js +5 -1
  281. package/dist/tasks/runner.js +239 -251
  282. package/dist/tasks/runtime-v3.js +281 -0
  283. package/dist/tasks/scheduler-binding.js +272 -0
  284. package/dist/tasks/scheduler-invocation.js +57 -43
  285. package/dist/tasks/scheduler-sync.js +654 -0
  286. package/dist/tasks/source-v3.js +752 -0
  287. package/dist/tasks/standalone-script-entry.js +5 -0
  288. package/dist/tasks/task-id.js +29 -0
  289. package/dist/workflows/authoring/authoring.js +15 -32
  290. package/dist/workflows/exec/dispatch-redaction.js +14 -8
  291. package/dist/workflows/exec/exec-unit.js +7 -28
  292. package/dist/workflows/exec/frozen-judge.js +57 -89
  293. package/dist/workflows/exec/lowering-notices.js +23 -0
  294. package/dist/workflows/exec/native-executor.js +301 -458
  295. package/dist/workflows/exec/param-secrets.js +4 -3
  296. package/dist/workflows/exec/run-workflow.js +26 -32
  297. package/dist/workflows/exec/step-work.js +105 -109
  298. package/dist/workflows/exec/unit-dispatch.js +103 -27
  299. package/dist/workflows/exec/unit-writer.js +3 -3
  300. package/dist/workflows/exec/worktree.js +2 -2
  301. package/dist/workflows/ir/compile.js +86 -72
  302. package/dist/workflows/ir/environment-v4.js +328 -0
  303. package/dist/workflows/ir/freeze-v4.js +122 -0
  304. package/dist/workflows/ir/plan-hash.js +13 -7
  305. package/dist/workflows/ir/schema-v4.js +525 -0
  306. package/dist/workflows/ir/schema.js +25 -284
  307. package/dist/workflows/ir/source-freeze-v4.js +506 -0
  308. package/dist/workflows/parser.js +27 -24
  309. package/dist/workflows/program/schema.js +1 -2
  310. package/dist/workflows/renderer.js +42 -29
  311. package/dist/workflows/resource-limits.js +4 -5
  312. package/dist/workflows/runtime/agent-identity.js +11 -13
  313. package/dist/workflows/runtime/plan-classifier.js +8 -8
  314. package/dist/workflows/runtime/runs.js +27 -43
  315. package/dist/workflows/runtime/workflow-asset-loader.js +45 -205
  316. package/dist/workflows/source-files.js +373 -0
  317. package/dist/workflows/source-ir/compile.js +196 -0
  318. package/dist/workflows/source-ir/github-yaml.js +577 -0
  319. package/dist/workflows/source-ir/ordering.js +38 -0
  320. package/dist/workflows/source-ir/program.js +50 -0
  321. package/dist/workflows/source-ir/result.js +26 -0
  322. package/dist/workflows/source-ir/schema.js +772 -0
  323. package/dist/workflows/source-ir/semantics.js +242 -0
  324. package/dist/workflows/source-ir/uses.js +14 -0
  325. package/docs/README.md +2 -0
  326. package/docs/migration/README.md +3 -1
  327. package/docs/migration/release-notes/0.9.2.md +55 -0
  328. package/docs/migration/release-notes/README.md +5 -0
  329. package/docs/migration/v0.8-to-v0.9.md +76 -1077
  330. package/docs/migration/v0.9.0-troubleshooting.md +104 -516
  331. package/docs/migration/v0.9.1-to-v0.9.2.md +150 -0
  332. package/docs/reference/README.md +1 -0
  333. package/docs/reference/cli.md +230 -98
  334. package/docs/reference/configuration.md +159 -36
  335. package/docs/reference/data-and-telemetry.md +19 -1
  336. package/docs/reference/supported-formats.md +23 -3
  337. package/docs/reference/tasks.md +182 -0
  338. package/docs/reference/workflow-schema.md +91 -40
  339. package/docs/reference/workflows.md +33 -6
  340. package/package.json +10 -6
  341. package/schemas/akm-config.json +372 -224
  342. package/schemas/akm-task.json +324 -80
  343. package/schemas/akm-workflow.json +6 -9
  344. package/dist/core/migration-operation.js +0 -75
  345. package/dist/integrations/agent/model-aliases.js +0 -74
  346. package/dist/tasks/parser.js +0 -380
  347. package/dist/tasks/schema.js +0 -123
  348. package/dist/tasks/validator.js +0 -80
  349. package/dist/workflows/ir/freeze.js +0 -320
  350. package/dist/workflows/runtime/document-cache.js +0 -13
@@ -1,561 +1,149 @@
1
- # AKM 0.9.0 Migration Troubleshooting
1
+ # Current 0.9 upgrade troubleshooting
2
2
 
3
- This guide covers recovery actions for a 0.9.0 installation that did not
4
- complete cleanly. It is written for operators repairing their own AKM
5
- installation; no source-code changes are required.
3
+ This page covers the supported upgrade boundaries in the current 0.9 line.
4
+ There is no general config/storage compatibility coordinator.
6
5
 
7
- ## Where AKM Stores Data
6
+ ## `akm upgrade` succeeded but AKM rejects config
8
7
 
9
- Recovery steps below reference these locations. Each default can be
10
- overridden with the matching `AKM_*_DIR` environment variable; check the
11
- environment before assuming the defaults.
8
+ `akm upgrade` updates executable code; it does not translate an old config.
9
+ Move the incompatible config aside and run `akm setup`, then configure current
10
+ `bundles`, `defaultBundle`, engines, and credentials deliberately.
12
11
 
13
- | Variable | Default | Contents |
14
- |---|---|---|
15
- | `$CONFIG` | `~/.config/akm` | `config.json` |
16
- | `$DATA` | `~/.local/share/akm` | `state.db`, `index.db`, `logs.db`, `txn/`, `backups/` |
17
- | `$CACHE` | `~/.cache/akm` | task logs under `tasks/logs/`, index logs under `logs/` |
18
- | `$BUNDLE` | `~/akm` | working bundle: assets, tasks, scripts, workflows, env files |
12
+ Do not restore an old config over the generated current file. Keep the archive
13
+ with the executable version that created it.
19
14
 
20
- `akm config path --all` prints the resolved config, bundle, cache, and index
21
- paths for the installation you are repairing.
15
+ ## An old database does not open
22
16
 
23
- ## Before You Retry
24
-
25
- Stop scheduled AKM jobs and any running `akm improve`, `akm proposal extract`, or
26
- workflow processes. Do not delete databases, migration sentinels, WAL files, or
27
- backup directories while a migration is incomplete.
28
-
29
- Confirm that the command you are invoking is the intended 0.9 binary:
30
-
31
- ```sh
32
- command -v akm
33
- akm --version
34
- akm upgrade --check
35
- ```
36
-
37
- If the shell resolves an older installation, invoke the new package-manager
38
- launcher or staged binary explicitly for every migration command.
39
-
40
- ## Pin the Runtime the Scheduler Uses
41
-
42
- `akm task doctor` reports the runtime `kind` and whether it is `eligible`
43
- for scheduling. Scheduled jobs must be bound to an installed release, never
44
- to a development checkout:
45
-
46
- - If doctor reports `kind: checkout` with `eligible: false`, the scheduler
47
- is invoking a mutable source tree. Rebuilding that tree changes task
48
- behavior mid-schedule, which shows up as failures flipping to successes
49
- (or the reverse) within the same day's logs with no configuration change.
50
- - A launcher on `PATH` can be a thin wrapper back into a checkout. Verify
51
- with `command -v akm` and `realpath` before trusting the version string.
52
- - The version string itself can lie: an uncommitted local `package.json`
53
- edit produces a version that corresponds to no reproducible artifact.
54
-
55
- Also audit the task definitions and their helper scripts. Any command that
56
- invokes bare `akm` resolves through the scheduler's `PATH` at run time and
57
- can silently pick up a different binary than the one you validated. Pin
58
- nested invocations to the absolute launcher path — including in currently
59
- disabled tasks, so re-enabling one later cannot fall back to a stale
60
- binary — then resynchronize the bindings:
61
-
62
- ```sh
63
- akm task doctor
64
- akm task sync --rebind
65
- akm task doctor
66
- ```
67
-
68
- ## Migration Status
69
-
70
- Start with the read-only status command:
17
+ Managed current databases apply exact-prefix additive schema migrations
18
+ automatically. Released migration 002's `task_history` table rebuild is also
19
+ automatic and preserves every existing row. Released migration 018 is the
20
+ exception: it removes retired dead-lane state, so an ordinary command stops
21
+ before that migration and tells you to run:
71
22
 
72
23
  ```sh
73
- akm migrate status
24
+ akm upgrade --force
74
25
  ```
75
26
 
76
- If you prepared a separate target configuration, pass it again:
27
+ Only a successful executable upgrade admits migration 018. Immediately before
28
+ the migration, AKM takes a SQLite writer-exclusion lock, rechecks the exact
29
+ ledger, and writes a consistent SQLite snapshot beside the database as
30
+ `state.db.pre-018-drop-dead-lane-schema.<UTC-digits>.<UUID>.bak`. The randomized
31
+ path is reserved with exclusive creation, kept owner-only while it is written,
32
+ checked against its held file descriptor to reject symlink/inode replacement,
33
+ fsynced, and required to pass `PRAGMA quick_check`. Its final permissions are
34
+ never broader than the source database. Migration 018 and its ledger row commit
35
+ before that writer-exclusion window is released, so a concurrent WAL writer
36
+ cannot land between the recovery snapshot and the destructive DDL. AKM never
37
+ substitutes a raw copy of the main database file, which could omit committed
38
+ WAL content. Keep that safety copy until the upgraded installation has
39
+ completed its checks. This is a one-purpose historical ledger guard, not a
40
+ general storage migrator.
77
41
 
78
- ```sh
79
- akm migrate status --config ./prepared-0.9.json
80
- ```
42
+ An existing database with no applied migration IDs is never treated as a fresh
43
+ install, whether its `schema_migrations` table is absent or empty. Ordinary
44
+ commands reject it without writing. The explicit `akm upgrade --force` path
45
+ takes and verifies a descriptor-bound snapshot named
46
+ `state.db.pre-001-initial-schema.<UTC-digits>.<UUID>.bak` before it creates the
47
+ ledger or applies any migration from 001 through 022. A truly new database is
48
+ distinguished only by the inode this invocation created atomically. The
49
+ pre-001 snapshot, ledger initialization, migration 001, and migration 002 all
50
+ run within one writer-exclusion transaction. A concurrent process therefore
51
+ cannot commit an old-schema row after the snapshot but before migration 002
52
+ rebuilds `task_history`.
81
53
 
82
- The status output identifies any incomplete operation, source configuration,
83
- target configuration, and whether recovery is required.
54
+ Both the source reader and safety-copy target stay bound to held file
55
+ descriptors while SQLite snapshots and verifies them; a pathname replacement
56
+ cannot substitute a different database. AKM never unlinks a reserved backup
57
+ pathname after reservation. If creation or verification fails, the
58
+ error names that retained path for inspection; do not treat it as verified
59
+ recovery media.
84
60
 
85
- ## Common Failures
61
+ Unknown or divergent ledgers still fail closed.
86
62
 
87
- ### WAL or database is busy
63
+ Do not delete `state.db` as a generic repair for a current installation. First
64
+ stop writers and preserve the database plus its `-wal` and `-shm` companions.
65
+ If it came from a 0.8 installation, keep it in the 0.8 archive and initialize
66
+ fresh current state. It is not a supported input to the current runtime.
88
67
 
89
- If migration reports that another process holds a database, lock, or workflow
90
- claim, stop all schedulers and close every AKM process. Check for remaining
91
- processes, then retry:
68
+ `index.db` is regenerable and can be rebuilt with `akm index` after its live
69
+ file is moved aside. `state.db` is durable history and is not regenerable.
92
70
 
93
- ```sh
94
- akm migrate apply --config ./prepared-0.9.json
95
- ```
71
+ If migration 018 fails after the safety copy was reported, stop every AKM
72
+ writer and preserve the failed database plus its sidecars. Verify the sibling
73
+ copy with `sqlite3 /path/to/safety-copy.bak 'PRAGMA quick_check;'` and use it
74
+ only with the matching older executable in an isolated data directory. Do not
75
+ overwrite the failed database while diagnosing it.
96
76
 
97
- Do not remove `state.db-wal` or `state.db-shm` manually. SQLite owns those files.
77
+ ## Task migration is blocked
98
78
 
99
- ### Migration was interrupted
100
-
101
- After a killed process, host crash, or power loss, run status and retry apply:
79
+ Preview the task-only plan:
102
80
 
103
81
  ```sh
104
82
  akm migrate status
105
- akm migrate apply
83
+ akm migrate apply --dry-run
106
84
  ```
107
85
 
108
- The coordinator reuses the original backup and phase-free incomplete sentinel,
109
- including its retained target config and path base, then reruns the idempotent
110
- schema, data, and asset transforms. Do not edit or delete files under the AKM
111
- data directory to force progress. Preserve the sentinel and backup if retry
112
- reports malformed control data.
86
+ A blocked file is intentionally unchanged. Common causes are argv arrays,
87
+ shell-sensitive command forms, invalid YAML, unsupported fields, or a source
88
+ that cannot be proven writable. Rewrite that file manually as task v3 and
89
+ preview again.
113
90
 
114
- ### `akm migrate status` stays "old" for one surface
91
+ The task migrator does not repair config or databases.
115
92
 
116
- If status reports every surface current except one, look for an obsolete
117
- database file left behind by an earlier version — for example an empty
118
- `workflow.db` in `$DATA` from a pre-0.9 install. Its mere presence can make
119
- that surface report as unmigrated. Stop all writers, move the file into a
120
- dated backup directory, and re-run `akm migrate status`. Do not delete the
121
- file; a later diagnosis may need it.
93
+ ## Task migration was interrupted
122
94
 
123
- ### Configuration still uses retired keys
95
+ The migrator validates and backs up each changed task immediately before its
96
+ atomic replacement. Re-run the preview. Already-current v3 files are skipped;
97
+ remaining v2 files are planned again from their current bytes. A changed input
98
+ generation fails closed instead of applying a stale plan.
124
99
 
125
- Errors naming `stashDir`, `sources`, `installed`, `wikiName`, or another
126
- pre-0.9 key mean the current configuration has not crossed the bundle cutover.
127
- Prepare a 0.9 configuration with `bundles` and `defaultBundle`, then run the
128
- migration with that file:
100
+ Use the per-file backup only to reverse that file deliberately. Do not copy a
101
+ backup over a file while a task sync or scheduler process is running.
129
102
 
130
- ```sh
131
- akm migrate status --config ./prepared-0.9.json
132
- akm migrate apply --config ./prepared-0.9.json --dry-run
133
- akm migrate apply --config ./prepared-0.9.json
134
- ```
103
+ ## A workflow will not resume
135
104
 
136
- Do not run a 0.8 binary with `akm migrate`; that command exists only in the
137
- 0.9 runtime.
105
+ Only durable plan IR v4 executes. Pre-v4 stored plans are rejected rather than
106
+ decoded by a compatibility runtime. Start a new run from the current Markdown
107
+ or YAML workflow source.
138
108
 
139
- Retired keys also linger inside task commands and helper scripts. A common
140
- 0.8 pattern was `akm config get stashDir`; it now fails with an unknown-key
141
- error on every scheduled run. Replace it with the bundle path from
142
- `akm config path --all` or `akm info`. Use `akm task history` to spot
143
- tasks failing on every interval: an unbroken run of failures starting at
144
- the migration date almost always means a retired key or reference inside
145
- the task definition, not a scheduler fault.
109
+ For a v4 run, a missing or changed authored source is not a resume blocker: the
110
+ run uses its frozen plan. A plan-hash or schema failure is durable-state
111
+ corruption and must fail closed.
146
112
 
147
- ### Old references no longer resolve
113
+ ## A stale transaction journal is reported
148
114
 
149
- The normal 0.9 grammar is `[bundle//]conceptId`, such as:
115
+ Current atomic source mutations may leave a transaction journal after a crash.
116
+ Stop AKM writers and inspect the named journal and its target files. Reconcile
117
+ or restore those current-source files from their recorded backups, then remove
118
+ the journal only after verifying the result.
150
119
 
151
- ```text
152
- skills/code-review
153
- memories/vpn-note
154
- knowledge/api-guide
155
- env/production
156
- ```
120
+ This is source-transaction recovery, not the removed 0.8 config/storage
121
+ cutover protocol.
157
122
 
158
- Replace old `type:name` references in your own prompts, task files, scripts,
159
- and documentation. The migration rewrites durable state and eligible asset
160
- content, but it cannot safely infer every reference embedded in operator-owned
161
- text.
123
+ ## Scheduler entries point at an old installation
162
124
 
163
- Check scheduled task YAML and workflow documents first: `env:name`,
164
- `workflow:name`, `knowledge:name`, and `skill:name` references inside a
165
- task definition fail on every run until rewritten as `env/name`,
166
- `workflows/name`, and so on.
167
-
168
- Workflow runs that were already in flight before the upgrade keep their
169
- frozen pre-0.9 plan. If a driver task resumes such a run, it executes the
170
- old plan — including retired commands — even after you rewrite the workflow
171
- document. Let the stale run reach a terminal state or abandon it, then
172
- start a fresh run so the rewritten plan is what executes.
173
-
174
- ### Renamed or moved assets lose their ranking signal
175
-
176
- `akm mv` was removed in 0.9. A rename is now a plain filesystem move followed
177
- by `akm index` and `akm lint`, and the destination gets a **fresh identity**.
178
- Everything the old ref had earned — feedback events, usage events, salience and
179
- outcome history — stays keyed to the ref that no longer exists. The symptom is a
180
- long-serving asset that suddenly ranks like a brand-new one after you renamed
181
- or reorganized it, and orphaned rows accumulating in `state.db`.
182
-
183
- Re-key the rows onto the new ref from a source clone:
184
-
185
- ```sh
186
- # Preview the counts it would move
187
- bun scripts/rekey-asset-ref.ts memories/old-note memories/new-note --dry-run
188
-
189
- # Apply
190
- bun scripts/rekey-asset-ref.ts memories/old-note memories/new-note
191
- ```
192
-
193
- It re-keys the index `entries` row **in place** (preserving the row id, and
194
- with it the utility/embedding history keyed to that id), the `asset_salience`
195
- and `asset_outcome` rows, and `usage_events.entry_ref` — then appends one
196
- `rekey` event. It is idempotent: a second run reports zero changed rows.
197
-
198
- Two constraints follow from the identity model, and the script refuses rather
199
- than guess: refs must name the same bundle and the same asset type
200
- (cross-bundle and cross-type movement is copy/import plus delete), and the old
201
- file must be gone — if both files exist that is a copy, not a rename.
202
-
203
- Run it **before** `akm index` when you can. Afterwards still works and carries
204
- the `state.db` signal, but `akm index` will already have dropped the old
205
- `entries` row and minted a fresh one, so the utility/embedding history attached
206
- to that row id is gone. The improve maintenance pass marks and clears orphaned
207
- salience/outcome state. With `improve.stateGc.collect: true`, it collects rows
208
- that remain orphaned after the seven-day grace period and emits an
209
- `asset_state_gc` event. Re-key before indexing when you need to preserve that
210
- history rather than collect it.
211
-
212
- ### `akm wiki` commands fail
213
-
214
- The `akm wiki` command family was removed in 0.9. Use ordinary bundle and
215
- knowledge commands instead:
216
-
217
- ```sh
218
- akm index
219
- akm search "your query"
220
- akm show knowledge/your-document
221
- akm lint --type knowledge
222
- ```
223
-
224
- For URL snapshots, use `akm import URL --path articles`, then index and lint
225
- the destination.
226
-
227
- Scheduled pipelines built on `akm wiki` must be rewritten, not renamed:
228
-
229
- 1. Acquire URLs with `akm import <url> --path <subdir>` into an ordinary
230
- knowledge subtree (for example `knowledge/articles`).
231
- 2. Deduplicate by source URL before importing, and normalize alias hosts
232
- (for example `twitter.com` vs `x.com`) so one article is not imported
233
- twice under two URLs.
234
- 3. Verify with `akm index`, `akm search`, and `akm show`, and lint the
235
- destination subtree rather than the whole bundle.
236
- 4. Advance any incremental cursor (channel position, feed offset) only
237
- after the whole task run succeeds, so a failed run is retried instead
238
- of silently skipped.
239
-
240
- ### Tasks do not run after migration
241
-
242
- Task files are strict YAML v2 in 0.9. Inspect and resynchronize the installed
243
- scheduler bindings:
125
+ Run:
244
126
 
245
127
  ```sh
246
128
  akm task doctor
247
- akm task sync --rebind
248
- akm task doctor
129
+ akm task sync
249
130
  ```
250
131
 
251
- Use `akm task history` to distinguish a disabled task, a failed command, and a
252
- task that was never installed. A disabled task can still be run explicitly for
253
- testing:
254
-
255
- ```sh
256
- akm task run <task-id>
257
- ```
258
-
259
- If a periodic task fails only when it coincides with a running improve
260
- cycle, add `--skip-if-locked` to its improve invocation so the overlap is
261
- skipped instead of recorded as a failure.
262
-
263
- `akm task history` can also show rows stuck in an active state from runs
264
- interrupted by a crash or power loss. Confirm no AKM process is actually
265
- running before treating them as abandoned. Such rows are historical
266
- records only, but they distort health fail-rate statistics until resolved.
267
-
268
- ### Improve aborts on legacy pending proposals
269
-
270
- Proposals created before 0.9 can lack metadata the 0.9 lifecycle requires —
271
- most often the proposed target and per-change paths. Symptoms:
272
-
273
- - `akm improve` exits with code 70 on every cycle while processing a
274
- specific proposal.
275
- - `akm proposal reject` fails on the same row because archival cannot
276
- serialize the missing metadata.
277
-
278
- Inspect the queue read-only before changing anything:
279
-
280
- ```sh
281
- akm proposal list --status pending --format json
282
- sqlite3 -readonly "$DATA/state.db" \
283
- "SELECT COUNT(*) FROM proposals WHERE status='pending' \
284
- AND json_extract(metadata_json,'$.proposedTarget') IS NULL;"
285
- ```
286
-
287
- Reject duplicates and stale drafts through the normal proposal commands
288
- wherever they still work; that preserves the audit trail. If rejection
289
- itself fails on a malformed row, stop all writers, take a fresh
290
- `sqlite3 ".backup"` copy of `state.db`, add only the missing metadata
291
- fields to the affected rows, verify `PRAGMA quick_check` returns `ok`, and
292
- then retry the CLI rejection. Never delete proposal rows directly.
293
-
294
- The 0.9 pre-publish lint gate keeps structurally valid but lint-invalid
295
- legacy drafts pending instead of publishing them. They are harmless, but
296
- each is re-evaluated every cycle; reject drafts that can never promote so
297
- they stop consuming the promotion budget.
298
-
299
- ### Stale transaction journals under `$DATA/txn`
300
-
301
- An interrupted run can leave a journal directory under
302
- `$DATA/txn/<installation>/<transaction-id>/`. Read its `journal.json`
303
- before acting:
304
-
305
- - A journal in an applying phase with zero completed operations recorded
306
- no file changes. After stopping all writers, move the whole transaction
307
- directory into a dated backup location. Do not delete it.
308
- - A journal whose operations already published files needs per-proposal
309
- reconciliation. If a published file matches the proposal content,
310
- finalize the acceptance through the proposal commands. If the file has
311
- since diverged (for example because you fixed lint defects in it), keep
312
- the newer file, quarantine the journal, and reject the superseded
313
- proposal.
314
-
315
- A leftover journal can also block `akm proposal reject` for the proposal
316
- it references. Resolve the journal first, then retry the rejection.
317
-
318
- A journal whose `kind` no longer exists in 0.9 — notably `"mv"`, left by an
319
- rc-era `akm mv` run — needs no action. It records no recoverable work, and any
320
- recovery scan that meets it removes it once it is older than five minutes
321
- rather than failing.
132
+ Inspect ownership and the planned command. Use `akm task sync --rebind` only
133
+ for a scheduler entry you deliberately want the current installation to adopt.
134
+ Unknown or foreign entries must remain fail-closed.
322
135
 
323
- ### Index or search results look incomplete
136
+ ## Roll back executable code
324
137
 
325
- The index is regenerable. First verify the bundle and configuration, then
326
- rebuild and inspect lint findings:
327
-
328
- ```sh
329
- akm index
330
- akm health
331
- akm lint --type knowledge
332
- akm search "a known document title"
333
- ```
334
-
335
- Do not restore an old index database over a current one unless you have a
336
- separate, verified recovery procedure. Rebuilding the index preserves the
337
- source assets and avoids mixing database generations.
338
-
339
- ### `source "<name>" was not scanned completely`
340
-
341
- Indexing prints this warning and preserves the source's last-known-good
342
- rows when a file listed by the source cannot be read back during the walk.
343
- On a Git-backed bundle the usual cause is benign: a tracked file was deleted
344
- in the working tree and the deletion is not yet committed. The final 0.9.0
345
- runtime handles that state; if you still see the warning, commit or restore
346
- the deletion in the bundle repository and re-index:
347
-
348
- ```sh
349
- git -C <bundle-dir> status --short
350
- akm index
351
- ```
352
-
353
- Because last-known-good rows are preserved, search keeps working while the
354
- warning is active — but deleted assets do not disappear from the index
355
- until a complete scan succeeds.
356
-
357
- ### Local LLM features fail after upgrade
358
-
359
- Check the configured engine and endpoint without exposing credentials:
360
-
361
- ```sh
362
- akm config get engines
363
- akm health
364
- ```
365
-
366
- Confirm that the local model server is running, reachable from the host, and
367
- serves the configured model. Keep the endpoint and model under the named
368
- `engines` configuration; the retired top-level `llm` configuration is not a
369
- 0.9 setting.
370
-
371
- Verify the endpoint directly before changing AKM configuration:
372
-
373
- ```sh
374
- curl -sS -o /dev/null -w '%{http_code}\n' http://HOST:PORT/v1/models
375
- ```
376
-
377
- A 200 without an `Authorization` header means no token is needed — do not
378
- wire one in. Old 401 entries in task logs can be stale evidence of a
379
- transient server state, not a configuration rule; trust the live probe.
380
- If a chat or classification feature fails while embeddings work, confirm
381
- the exact configured model is loaded on the host you are pointing at: a
382
- reachable server without the model loaded fails in ways that resemble
383
- authentication or endpoint errors, and the fix may simply be pointing the
384
- configuration at the host that actually serves the model.
385
-
386
- ### Derived memories contain placeholder text
387
-
388
- A small local model can echo a prompt's example structure instead of
389
- producing real content. Affected derived memories contain literal template
390
- text — a description like "one sentence summary", tags like `tag1`, a
391
- generic template body — and often omit the `updated` field. The final
392
- 0.9.0 runtime rejects this output pattern and uses a new inference cache
393
- namespace, so upgrade first; regeneration under an old binary can
394
- reproduce the same placeholders from cache.
395
-
396
- Then clean up in this order:
397
-
398
- 1. Search the bundle for the literal template phrases and remove only the
399
- placeholder derived assets. Do not edit dates onto them; that conceals
400
- the bad automation without fixing it.
401
- 2. Re-run indexing and the improvement task with the upgraded runtime.
402
- 3. Confirm the regenerated memories contain real content and an `updated`
403
- date before re-enabling any schedule that consumes them.
404
-
405
- ### Improve does less than it did on 0.8
406
-
407
- 0.9 gates autonomous maintenance lanes (memory inference, memory cleanup,
408
- automatic triage promotion) behind an explicit opt-in. While
409
- `experimental.improveAutonomy` is false, those lanes are skipped or queue
410
- their work for review instead of applying it. That is configuration, not
411
- damage. Check the current value and enable the opt-in only after reviewing
412
- what the lanes may write:
413
-
414
- ```sh
415
- akm config get experimental
416
- ```
417
-
418
- Read health fail-rate advisories with the same care: the aggregate combines
419
- improve results with every scheduled task, so one misconfigured legacy task
420
- failing on a tight schedule can dominate the percentage while improve
421
- itself is healthy. Distinguish deterministic check failures (integrity,
422
- index, scheduler) from historical-rate advisories before treating health
423
- as degraded.
424
-
425
- ### State databases are very large after migration
426
-
427
- Improve telemetry accumulates in `state.db` and can dominate its size;
428
- multi-gigabyte stored improve-run results are the usual cause. Set a
429
- retention window, let the next quick improve run purge expired rows, then
430
- compact offline:
431
-
432
- ```sh
433
- akm config set improve.eventRetentionDays 30
434
- akm task run <quick-improve-task-id>
435
- ```
436
-
437
- Check the run log for the purge counts, stop all writers, then compact and
438
- verify each database:
439
-
440
- ```sh
441
- sqlite3 "$DATA/state.db" "VACUUM; PRAGMA quick_check;"
442
- sqlite3 "$DATA/logs.db" "VACUUM; PRAGMA quick_check;"
443
- ```
444
-
445
- Also review `$DATA/backups`: migration backups are large by design. Keep at
446
- least the most recent verified pre-cutover backup, and do not prune backup
447
- directories while any migration or recovery question is open.
448
-
449
- ### Proposal promotion is rejected by lint
450
-
451
- 0.9 rejects proposal promotion when a proposal has critical `unquoted-colon`,
452
- `missing-ref`, or `stale-path` findings. Inspect the proposal, fix the content
453
- or add an intentional lint suppression, then retry:
454
-
455
- ```sh
456
- akm proposal show <proposal-id>
457
- akm proposal diff <proposal-id>
458
- akm proposal accept <proposal-id>
459
- ```
460
-
461
- Rejected promotion leaves the proposal pending and does not publish the bad
462
- asset. Do not force-copy the proposal into the bundle; fix the proposal through
463
- the proposal command so its audit trail remains intact.
464
-
465
- ### Read-only bundles still contain v1 tasks
466
-
467
- The migration deliberately never rewrites a read-only bundle. Affected
468
- bundles are reported per bundle (a `readOnlyLegacyTasks` warning naming the
469
- bundle and files), and those tasks remain non-executable warnings until the
470
- upstream source ships 0.9-format tasks. Do not mark a lock-materialized
471
- cache `writable: true` to silence the warning — the next source update
472
- overwrites the cache and your edit with it. Update the upstream source, or
473
- replace it with a writable local source if you must run those tasks now.
474
-
475
- ## Migrations Performed With a Pre-Release Build
476
-
477
- If the migration originally ran under a 0.9.0 release candidate, re-verify
478
- it with the final binary before trusting the environment:
479
-
480
- 1. Run `akm migrate status` with the final 0.9.0 binary.
481
- 2. Read
482
- `$DATA/backups/migrations/<installation-id>/content-migration-report.json`
483
- and confirm every installed bundle you expected was imported. Early
484
- builds could skip an installed tree whose lock still used a prefixed
485
- locator (for example `github:owner/repo`), leaving its legacy metadata
486
- and filesystem proposals unimported.
487
- 3. Check whether quarantined legacy rows were preserved in full. The final
488
- migration stores them in a `legacy_state_rows` table inside `state.db`;
489
- some early builds recorded only per-surface summary counts (a
490
- `legacy_state` table with counts but no `legacy_state_rows`). In that
491
- case the full data exists only in the pre-cutover backup — preserve that
492
- backup indefinitely, or restore and re-migrate with the final binary if
493
- the quarantined history matters to you.
494
-
495
- ```sh
496
- sqlite3 -readonly "$DATA/state.db" \
497
- "SELECT name FROM sqlite_master \
498
- WHERE name IN ('legacy_state','legacy_state_rows');"
499
- ```
500
-
501
- ## Credential Hygiene After Failures
502
-
503
- Runs under pre-final builds could write full webhook URLs into task logs
504
- when an unhandled network error printed the failing request. Before
505
- archiving or sharing logs, scan for embedded credentials and rotate
506
- anything you find — deleting the log copy does not un-expose a credential:
507
-
508
- ```sh
509
- grep -rl 'discord.com/api/webhooks/' "$CACHE/tasks/logs" || true
510
- ```
511
-
512
- Keep scheduler environment files (`env/*.env` in the bundle) at mode `600`
513
- and out of version control. Scheduled task environments frequently hold
514
- plaintext credentials; never paste their contents into logs, reports, or
515
- issue trackers while diagnosing a failure.
516
-
517
- ## Recovery and Downgrade
518
-
519
- Migration recovery runs are stored below:
520
-
521
- ```text
522
- $DATA/backups/migrations/<installation-id>/<run-id>/
523
- ```
524
-
525
- If you must restore, stop all writers first and use a verified recovery run:
526
-
527
- ```sh
528
- akm-migrate restore --for 0.9.0 --run <run-id> --confirm
529
- ```
530
-
531
- Only install an older AKM binary after restore completes. A 0.8 binary must
532
- not run against a 0.9 configuration or migrated databases. If no verified
533
- pre-cutover backup exists, preserve the current installation and reconstruct a
534
- separate older-version data root instead of downgrading in place.
535
-
536
- ## Final Verification
537
-
538
- After recovery, run these checks with the same binary used for migration:
539
-
540
- ```sh
541
- akm --version
542
- akm migrate status
543
- akm task doctor
544
- akm index
545
- akm health
546
- akm lint --type knowledge
547
- akm proposal list --status pending
548
- ```
138
+ Executable rollback and data rollback are separate:
549
139
 
550
- Before restarting schedules, also confirm the environment is quiescent:
140
+ 1. stop tasks and running AKM processes;
141
+ 2. preserve the current config/data/state/cache and authored bundles;
142
+ 3. restore the previous executable;
143
+ 4. restore the matching archived data set, if one is required.
551
144
 
552
- - `$DATA/txn` contains no leftover transaction journals.
553
- - No pending proposal is missing its target metadata (see the legacy
554
- pending proposals section above).
555
- - `akm task history` shows no rows stuck in an active state.
556
- - Task logs contain no embedded credentials.
145
+ Never combine a restored old executable with current state, or a current
146
+ executable with an archived old state layout.
557
147
 
558
- Restart scheduled jobs only after status is committed, the scheduler is bound
559
- to the current launcher, and the index and lint checks are clean. Then watch
560
- the first full scheduled cycle: one completed run of each task family under
561
- cron is the real proof of recovery, not a successful manual invocation.
148
+ See [Moving from 0.8 to current 0.9](v0.8-to-v0.9.md) and
149
+ [Migrating from 0.9.1 to 0.9.2](v0.9.1-to-v0.9.2.md).