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
@@ -57,12 +57,10 @@ and `secret run`), document payloads (`help`,
57
57
  documented shell-substitution primitive — wrapping it in an envelope would
58
58
  break `$(akm env path <ref>)` substitutions). Passing `--format` to one of
59
59
  those **warns on stderr** and is otherwise ignored; the exempt set is declared
60
- in `src/output/format-exempt.ts`. `migrate status`/`apply` also spawn a
61
- standalone tool (the migration tool) but are NOT exempt: the CLI parses that
62
- child's final JSON result line and renders it through the normal `--format`
63
- pipeline, so `text`/`md`/`html`/`yaml` genuinely reformat it; any progress
64
- lines the child printed along the way still print verbatim, ahead of the
65
- formatted result.
60
+ in `src/output/format-exempt.ts`. `migrate status`/`apply` invoke the packaged
61
+ task migrator but are NOT exempt: the CLI parses its task plan and renders it
62
+ through the normal `--format` pipeline, so `text`/`md`/`html`/`yaml` genuinely
63
+ reformat it.
66
64
 
67
65
  Scripted `setup` modes emit a normal format-aware result. Interactive `setup`
68
66
  is a terminal UI and emits no result document. `agent` leaves inherited child
@@ -284,11 +282,10 @@ Primary result fields:
284
282
  | Field | Description |
285
283
  | --- | --- |
286
284
  | `status` | Overall health verdict: `pass`, `warn`, or `fail` |
287
- | `hardChecks` | Deterministic checks such as `state-db-schema`, `state-db-round-trip`, `task-log-backing`, `active-runs`, and `default-engine` |
288
- | `advisories` | Non-fatal warnings including `semantic-search-runtime`, `session-extraction` (akmExtract pipeline health), and `session-log-failures` (informational keyword matches, never triggers warn) |
285
+ | `hardChecks` | Deterministic checks such as `state-db-schema`, `state-db-round-trip`, `task-log-backing`, `active-runs`, `default-engine`, and `model-map-files` |
286
+ | `advisories` | Non-fatal warnings including `semantic-search-runtime` and `session-extraction` (akmExtract pipeline health) |
289
287
  | `metrics` | Aggregate task/runtime metrics: `taskFailRate`, `agentFailureRate`, `stuckActiveRuns`, `logBackingRate`, `probeRoundTripMs` |
290
288
  | `improve` | Recent improve-loop counts derived from `improve_invoked`, `improve_skipped`, and `improve_completed` events |
291
- | `sessionLogAdvisories` | Raw keyword-matched session-log topics (pre-LLM, informational only) |
292
289
 
293
290
  The `improve` section includes counts for planned refs, reflect/distill actions,
294
291
  memory-prune actions, memory-inference writes, graph-extraction refreshes,
@@ -297,9 +294,7 @@ dead-URL detections, and skip reasons observed in the selected time window.
297
294
 
298
295
  The `session-extraction` advisory reflects the health of the `akmExtract` pipeline
299
296
  (Phase 0.4 of `akm improve`). It warns on harness errors or when no proposals are
300
- generated across five or more scanned sessions. The `session-log-failures` advisory
301
- is informational only and never triggers `warn` — it reports raw keyword matches,
302
- not LLM-validated extraction outcomes.
297
+ generated across five or more scanned sessions.
303
298
 
304
299
  The indexed entity graph (entities/relations extracted from bundle assets) has
305
300
  no dedicated inspection command; its summary counts surface as an info-level
@@ -356,6 +351,14 @@ The pre-0.9.0 `<type>:` / `<type>:<prefix>/` spelling was removed. A query in
356
351
  that shape is now an ordinary keyword search, and when it returns nothing the
357
352
  tip names the conceptId spelling that replaces it.
358
353
 
354
+ Local search responses include `searchMode`: `semantic` when vector ranking
355
+ ran, `keyword` when keyword-only search was intentional or semantic search was
356
+ not ready, and `fts-fallback` when a ready semantic backend failed during this
357
+ query. The last case also adds one sanitized, endpoint-naming entry to
358
+ `warnings`; it never repeats the provider/runtime error text. Both fields are
359
+ preserved by `--shape agent` so machine consumers can lower their confidence
360
+ instead of treating keyword fallback as healthy semantic ranking.
361
+
359
362
  | Flag | Values | Default | Description |
360
363
  | --- | --- | --- | --- |
361
364
  | `--type` | `skill`, `command`, `agent`, `knowledge`, `instruction`, `workflow`, `script`, `memory`, `env`, `secret`, `lesson`, `task`, `session`, `fact`, `any` | `any` | Filter by asset type. Free-form and unvalidated — an unknown type returns no hits. Also accepts any adapter-defined type (e.g. `website`) — see [Bundle Types](bundle-types.md) for the open types each adapter emits. |
@@ -450,6 +453,8 @@ includes direct follow-up commands such as `akm show <ref>` or `akm bundle add <
450
453
  so you can immediately inspect or install what it found.
451
454
  `--detail` and `--shape agent` both work on curate output; `--shape summary`
452
455
  does not.
456
+ Curate preserves the underlying `searchMode` and deduplicates semantic fallback
457
+ warnings across its full-query and token-fallback searches.
453
458
  Agent-shaped local items include `ref`, `path`, and `editable`, plus `editHint`
454
459
  only for read-only items. Their `followUp` remains `akm show <ref>` rather than
455
460
  being replaced by clone guidance.
@@ -564,7 +569,7 @@ Subcommands:
564
569
 
565
570
  | Subcommand | Description |
566
571
  | --- | --- |
567
- | `create <name>` | Validate and write a unified markdown workflow under `workflows/`. `--path <dir>` places it in a subdirectory; `--from <file>` imports content; `--force` (requires `--from` or `--reset`) overwrites; `--print` prints the template that would be written instead of writing it |
572
+ | `create <name>` | Validate and write a Markdown workflow under `workflows/`. `--path <dir>` places it in a subdirectory; `--from <file>` imports content; `--force` (requires `--from` or `--reset`) overwrites; `--print` prints the template that would be written instead of writing it |
568
573
  | `run <run-id\|ref>` | Stable canonical start/resume/execute command. A ref starts a run or continues the active run in the current scope; a run id continues that exact active run. Executes until completion, failure, verification rejection, interruption, or an explicit limit |
569
574
  | `status <run-id\|ref>` | Show the full run state, including all step statuses. `--units` also lists per-unit rows from the run journal (diagnostics only) |
570
575
  | `list` | List workflow runs (optionally filtered by `--ref`; `--active` shows only `status=active` runs, excluding `blocked`/`failed`/`completed`) |
@@ -665,10 +670,10 @@ akm workflow create ship --path release # writes workflows/release/ship
665
670
  | Flag | Description |
666
671
  | --- | --- |
667
672
  | `--path <dir>` | Relative subdirectory under `workflows/` to place the workflow in. The filename comes from `<name>`. |
668
- | `--from <file>` | Import and validate a unified markdown workflow from an existing file |
673
+ | `--from <file>` | Import and validate a Markdown workflow from an existing file |
669
674
  | `--force` | Overwrite an existing workflow. Requires `--from` or `--reset`. |
670
675
  | `--reset` | Explicitly replace an existing workflow with a fresh template (use with `--force`) |
671
- | `--print` | Print the unified markdown template without creating anything |
676
+ | `--print` | Print the Markdown template without creating anything |
672
677
 
673
678
  `--force` requires either `--from <file>` (replace from a source file) or
674
679
  `--reset` (explicitly acknowledge you are overwriting in place). Without one of
@@ -864,24 +869,68 @@ akm bundle remove my-provider --yes # Skip the confirmation prompt
864
869
 
865
870
  ### bundle update
866
871
 
867
- Update one or all managed sources to the latest available version. Local and
868
- remote sources are not updatable akm explains why if you target one.
872
+ Update one bundle, or refresh every configured bundle with `--all`. Git, npm,
873
+ and website candidates are staged and audited before they replace the active
874
+ generation. Filesystem bundles require no hydration; update reconciles their
875
+ current files into the index immediately.
869
876
 
870
877
  ```sh
871
878
  akm bundle update npm:@scope/pkg
872
879
  akm bundle update --all
873
880
  akm bundle update --all --force # Force fresh download even if version is unchanged
874
881
  akm bundle update --all --yes # Skip confirmation when an update needs to delete a moved install dir
882
+ akm bundle update npm:@scope/pkg --allow-insecure # Explicitly approve reviewed dangerous env keys
875
883
  ```
876
884
 
877
885
  | Flag | Description |
878
886
  | --- | --- |
879
887
  | `--all` | Update all managed sources |
880
888
  | `--force` | Delete cached extraction before re-downloading |
889
+ | `--allow-insecure` | Permit a staged update containing dangerous environment keys after warning. Without it, an interactive terminal prompts with a default of No; non-interactive use fails closed. This is independent of `--yes`. |
881
890
  | `-y`, `--yes` | Skip the confirmation prompt for the rare branch where the resolved content location moved and the previous install directory must be deleted. No effect on a normal refresh, which deletes nothing. |
882
891
 
883
- Reports per-entry change flags: `changed.version`, `changed.revision`,
884
- `changed.any`.
892
+ The audit examines key names in `.env`-suffixed files under the staged
893
+ component root. Publisher lint suppressions do not bypass it. Rejection or an
894
+ audit/publication/index failure preserves the prior active bytes, lock/config
895
+ generation, and searchable index for that bundle.
896
+
897
+ Writable Git updates resolve configured roots to their physical checkout,
898
+ reject component symlinks that escape it, and re-audit the exact materialized
899
+ worktree before activation. AKM holds its source/index writer lease through
900
+ that check and commit, and rechecks after the index pass at the final database
901
+ commit boundary. All AKM writers cooperate with this lease. A non-cooperating
902
+ local process can still edit ordinary files because POSIX/Windows filesystems
903
+ provide no mandatory recursive directory lock: writes observed by either
904
+ generation check make the update fail and restore the pre-update checkout, but
905
+ a write racing after the final filesystem read cannot be guaranteed detectable
906
+ and a write during compensation can be overwritten. Do not edit a writable
907
+ checkout from another process while its update is running.
908
+
909
+ The index and its update-owned state maintenance share one deferred SQLite
910
+ transaction. WAL readers continue to see the last committed generation while a
911
+ full update index pass runs, and competing writers wait for that pass to commit
912
+ or roll back. The semantic-status JSON file is a recomputable advisory: failure
913
+ to refresh it after the database commit warns but does not undo a committed
914
+ bundle update.
915
+
916
+ This boundary guarantees rollback for handled process faults (throws and
917
+ SQLite commit failures); it is not an abrupt-termination or cross-database
918
+ power-loss guarantee. Both `index.db` and `state.db` remain in WAL mode, where
919
+ SQLite does not guarantee an atomic commit across attached database files after
920
+ `SIGKILL`, abrupt power loss, or storage failure. The durable outcome may
921
+ therefore combine approved old/new source bytes and lock state with adjacent
922
+ index/state generations. `akm health` reports `index-state-generation` when a
923
+ durable usage link disagrees with the searchable index, but that advisory
924
+ cannot identify every theoretical split. Stop concurrent writers, rerun the
925
+ targeted bundle update if the checkout/lock is not the intended approved
926
+ revision, then run `akm index --full` to rebuild the search index and relink
927
+ durable usage state.
928
+
929
+ Reports per-entry change flags: `changed.version`, `changed.revision`, and
930
+ `changed.any`. With `--all`, each bundle is isolated: successful entries appear
931
+ in `processed`/`plainSynced`; rejected entries report `status: "blocked"` and a
932
+ security code; provider or transaction errors report `status: "failed"`. The
933
+ command continues with later bundles without half-publishing a blocked one.
885
934
 
886
935
  ### upgrade
887
936
 
@@ -889,25 +938,9 @@ Upgrade `akm` itself to the latest release. Standalone binaries are downloaded,
889
938
  checksummed, and staged before replacement; npm, Bun, and pnpm global installs
890
939
  use their package manager.
891
940
 
892
- For contract-capable releases, upgrade treats migration and indexing as
893
- separate steps. It runs migration preflight before installation, migration apply
894
- after installation, and rebuilds the derived index only after migration
895
- succeeds. Standalone upgrades retain the previous binary until migration apply
896
- completes. If apply fails, the new binary stays installed and the previous binary
897
- remains beside it for operator recovery; the executable is never rolled back
898
- independently of durable state.
899
-
900
- A binary that predates the `migrate` command and `--migration-config` cannot
901
- enforce guards implemented in a release that is not installed yet, so
902
- self-update cannot safely cross that boundary; install or stage the new
903
- binary manually instead and run its `akm migrate apply` command. See
904
- [docs/migration/](../migration/) for version-specific upgrade guides.
905
-
906
- For contract-capable upgrades, the old/current binary's preflight inspects only its
907
- current artifact state and never parses the future prepared config. The prepared
908
- config is then checked by the staged standalone binary's `migrate status` before
909
- replacement and passed to the newly installed binary's apply command. A failed
910
- staged preflight removes the stage and leaves the old executable untouched.
941
+ Upgrade replaces the installed program and then rebuilds the derived index.
942
+ It does not run legacy config, database, or workflow migration paths. Standalone
943
+ downloads use a temporary rollback copy only during atomic executable replacement.
911
944
 
912
945
  Standalone downloads are streamed directly to the staged file while SHA-256 is
913
946
  computed, with a 256 MiB binary limit. Release/checksum metadata is capped at
@@ -917,15 +950,13 @@ computed, with a 256 MiB binary limit. Release/checksum metadata is capped at
917
950
  akm upgrade # Download and replace the running binary
918
951
  akm upgrade --check # Check for updates without installing
919
952
  akm upgrade --force # Force upgrade even if already on latest
920
- akm upgrade --migration-config ./prepared-config.json # Contract-capable releases only
921
953
  ```
922
954
 
923
955
  | Flag | Description |
924
956
  | --- | --- |
925
957
  | `--check` | Check for updates without installing |
926
958
  | `--force` | Force upgrade even if on latest version |
927
- | `--skip-post-upgrade` | Skip only the post-migration index rebuild; migration preflight and apply still run |
928
- | `--migration-config` | On contract-capable upgrades, operator-prepared config passed only to the new binary's migration apply; not a path for crossing from a pre-`migrate` binary |
959
+ | `--skip-post-upgrade` | Skip the post-upgrade index rebuild |
929
960
 
930
961
  Checksum verification is not optional and has no flag. If a release's
931
962
  `checksums.txt` is genuinely unreachable, the recovery hatch is the
@@ -1262,7 +1293,7 @@ akm log --run <run-id> # Only events for one workflow run
1262
1293
  | Flag | Description |
1263
1294
  | --- | --- |
1264
1295
  | `--since` | Lower bound. Accepts ISO 8601, epoch ms, or `@offset:<id>` for a durable row-id cursor that survives across processes. |
1265
- | `--type` | Filter by event type. Common values include `add`, `remove`, `update`, `remember`, `import`, `sync`, `feedback`, `promoted`, `rejected`, `propose_invoked`, `reflect_invoked`, `distill_invoked`, `select`, and `improve_skipped`. `sync` and the legacy `save` are synonyms on read, so `--type save` still returns rows written before the 0.9.0 rename as well as new ones. |
1296
+ | `--type` | Filter by event type. Common values include `add`, `remove`, `update`, `remember`, `import`, `sync`, `feedback`, `promoted`, `rejected`, `propose_invoked`, `reflect_invoked`, `distill_invoked`, `select`, and `improve_skipped`. |
1266
1297
  | `--ref` | Filter by asset ref (`[bundle//]conceptId`). |
1267
1298
  | `--run` | Filter to one workflow run's events (`metadata.runId`) — the replacement for the dropped `akm workflow watch <run-id>`. Poll with `--since '@offset:<id>'` for a live tail; there is no daemon. |
1268
1299
  | `--limit` | Return only the most recent N events matching every other filter. Default: unlimited. |
@@ -1335,24 +1366,20 @@ akm registry remove my-team --yes # Skip the confirmation prompt
1335
1366
 
1336
1367
  ### migrate
1337
1368
 
1338
- Inspect or apply config and durable database (`state.db`) migration as one
1339
- installation lifecycle. Status and dry-run are read-only and exit nonzero when
1340
- newer, inconsistent, corrupt, or unresolved config state blocks apply.
1369
+ Inspect or apply the explicit one-way task-v2 to task-v3 conversion. Normal task
1370
+ execution accepts only task v3. Database schema upgrades are additive and run
1371
+ automatically when `state.db` opens; config and workflow formats have no runtime
1372
+ compatibility migrator.
1341
1373
 
1342
1374
  ```sh
1343
1375
  akm migrate status
1344
- akm migrate status --config ./prepared-config.json
1345
- akm migrate apply --config ./prepared-config.json --dry-run
1346
- akm migrate apply --config ./prepared-config.json
1376
+ akm migrate apply --dry-run
1377
+ akm migrate apply
1347
1378
  ```
1348
1379
 
1349
- `--config` is required when the active config is legacy or absent. When the
1350
- active config is current, apply safely uses it as the target. Apply is
1351
- idempotent and creates a semantically verified recovery run before changing any
1352
- artifact. One phase-free incomplete sentinel makes a killed apply replayable;
1353
- while apply or restore is incomplete, ordinary canonical config/database access
1354
- fails closed. Apply refuses before backup when managed handles, maintenance
1355
- activities, mutation locks, or workflow claims are live.
1380
+ `status` and `apply --dry-run` are read-only. Apply refuses blocked task sources,
1381
+ backs up each changed file, atomically publishes strict v3 YAML, and is
1382
+ idempotent: an already-v3 file is skipped.
1356
1383
 
1357
1384
  ### config
1358
1385
 
@@ -1390,6 +1417,28 @@ and CI scripts.
1390
1417
 
1391
1418
  See [configuration.md](configuration.md) for details.
1392
1419
 
1420
+ ### models
1421
+
1422
+ Manage the installed and operator-owned model intent map. Bare `akm models`
1423
+ is a usage error; use the explicit copy operation when you want an editable
1424
+ full map.
1425
+
1426
+ ```sh
1427
+ akm models copy-defaults
1428
+ akm models copy-defaults --overwrite
1429
+ ```
1430
+
1431
+ `copy-defaults` validates the packaged version-1 `models.json`, then stages and
1432
+ syncs it beside the normal AKM configuration target. Creation uses an atomic
1433
+ no-replace publish and fails safely on filesystems that cannot provide it.
1434
+ `--overwrite` performs an atomic pathname replacement after a best-effort
1435
+ regular-file identity recheck; it never dereferences a symlink, but portable
1436
+ filesystems do not offer a conditional rename that locks the previously
1437
+ observed inode. Symlinks and other non-regular targets observed during checks
1438
+ are refused. See
1439
+ [Model-map files](configuration.md#model-map-files) for schema, overlay, and
1440
+ resolution semantics.
1441
+
1393
1442
  ### help
1394
1443
 
1395
1444
  Print the sectioned command overview, detailed help for any command, agent
@@ -1765,36 +1814,100 @@ source <(akm completions)
1765
1814
 
1766
1815
  These commands define the self-improvement and agent-dispatch surface.
1767
1816
 
1817
+ ### command run
1818
+
1819
+ Resolve a stored command through its owning bundle adapter and execute one
1820
+ fresh session through the common engine/model cascade:
1821
+
1822
+ ```sh
1823
+ akm command run <command-ref> [--arguments <exact-text>] [--agent <selector>] [--engine <name>] [--model <id-or-alias>] [--timeout-ms <ms>] [--cwd <path>] [--dry-run]
1824
+ ```
1825
+
1826
+ `--dry-run` does not dispatch and does not materialize credentials.
1827
+
1828
+ | Argument / Flag | Description |
1829
+ | --- | --- |
1830
+ | `<command-ref>` | Local indexed command ref, optionally bundle-qualified (for example `commands/review` or `team//commands/review`) |
1831
+ | `--arguments <exact-text>` | Exact string substituted for every literal `$ARGUMENTS`; it is not trimmed, tokenized, quoted, or recursively expanded |
1832
+ | `--agent <selector>` | Portable `agents/...` ref or a native harness selector |
1833
+ | `--engine <name>` | Current-invocation engine override |
1834
+ | `--model <id-or-alias>` | Current-invocation exact model or operator model-map alias |
1835
+ | `--timeout-ms <ms>` | Current-invocation timeout override |
1836
+ | `--cwd <path>` | Current-invocation workspace override |
1837
+ | `--dry-run` | Resolve, authorize, and lower the command without dispatching or materializing credentials |
1838
+
1839
+ Commands and portable personas are rendered by their bundle adapter. Native
1840
+ frontmatter is never sent as prompt text and native files are never rewritten.
1841
+ The only portable template token is literal `$ARGUMENTS`. Positional, named,
1842
+ expression, legacy `{{...}}`, and other native-only constructs fail before
1843
+ authorization or dispatch; invoke those templates through their native tool.
1844
+ Omitting `--arguments` and passing an explicit empty string both substitute
1845
+ empty text, but remain distinct in the resolved request.
1846
+
1847
+ `akm command run ... --dry-run` performs the real adapter read, cascade/model
1848
+ resolution, operator authorization or policy check, and engine lowering. It
1849
+ returns a successful JSON result with `schemaVersion: 1`,
1850
+ `shape: "command-dry-run"`, `ok: true`, `dryRun: true`, the selected engine
1851
+ name, safe `provenance`, and safe lowering `notices`. It has no fake exit code,
1852
+ stdout, stderr, or duration.
1853
+
1854
+ Each provenance entry contains only `field`, `layer`, `kind`, and `via`. Each
1855
+ lowering notice contains `code`, `severity`, `adapter`, optional `field`, and
1856
+ fixed `message`. Dry-run does not dispatch and does not materialize
1857
+ credentials. It uses a read-only source lookup and records no usage, events, or
1858
+ accounting.
1859
+
1860
+ Diagnostics exclude resolved values. They never include prompt content.
1861
+ They never include command content. They never include environment values.
1862
+ They never include credential values. User-authored
1863
+ inference keys are collapsed to the safe wildcard field instead of being
1864
+ echoed.
1865
+
1866
+ For live execution, global `--verbose` emits the same safe provenance and
1867
+ notices to stderr before dispatch. The normal command result on stdout is
1868
+ preserved unchanged, so enabling verbose diagnostics does not corrupt scripts
1869
+ that consume stdout.
1870
+
1768
1871
  ### agent
1769
1872
 
1770
- Dispatch a configured agent engine, optionally embodying a bundle agent asset.
1873
+ Dispatch a configured agent engine, optionally selecting a bundle agent persona
1874
+ and model defaults. A nonempty tool request from that asset is not
1875
+ authorization: the current CLI rejects it at the execution boundary.
1876
+ Stored command assets execute only through `akm command run`; `akm agent` has
1877
+ no command compatibility alias.
1771
1878
 
1772
1879
  ```sh
1773
- akm agent [<agent-ref>] [--engine <name>] [--prompt <text>] [--model <model>] [--command <ref>] [--workflow <ref>] [--timeout-ms <ms>] [--cwd <path>]
1880
+ akm agent [<agent-ref>] [--engine <name>] [--prompt <text>] [--model <model>] [--timeout-ms <ms>] [--cwd <path>]
1774
1881
  ```
1775
1882
 
1776
1883
  | Argument / Flag | Description |
1777
1884
  | --- | --- |
1778
- | `<agent-ref>` | Optional agent asset ref (e.g. `agents/code-reviewer`). Loads system prompt, model, and tool policy from the bundle asset. |
1885
+ | `<agent-ref>` | Optional agent asset ref (e.g. `agents/code-reviewer`). Resolves persona and model defaults; a nonempty tool request still requires separate operator authorization. |
1779
1886
  | `--engine <name>` | Agent engine to use; defaults to `defaults.engine` |
1780
1887
  | `--prompt <text>` | Task prompt to pass to the agent |
1781
1888
  | `--model <model>` | Model override. Accepts aliases (`opus`, `sonnet`, `haiku`) or exact platform model IDs. Overrides the model in the agent asset. Resolved per platform: `opencode/claude-opus-4-7` for opencode, `claude-opus-4-7` for claude. |
1782
- | `--command <ref>` | Load prompt from a `commands/<name>` asset |
1783
- | `--workflow <ref>` | Load prompt from a `workflows/<name>` asset |
1784
1889
  | `--timeout-ms <ms>` | Override the agent CLI timeout in milliseconds |
1785
1890
  | `--cwd <path>` | Working directory for the spawned agent (defaults to the current directory) |
1786
1891
 
1787
- When `<agent-ref>` is provided, akm loads the bundle agent asset and extracts
1788
- its system prompt, `modelHint`, and `toolPolicy`. The `--model` flag wins
1789
- over any model specified in the asset.
1892
+ When `<agent-ref>` is provided, akm resolves the bundle agent's persona,
1893
+ `modelHint`, and requested `toolPolicy`. The `--model` flag wins over any model
1894
+ specified in the asset. The requested tool policy never grants access by
1895
+ itself: authorization runs before lowering, credentials, or provider dispatch.
1896
+ The current CLI has no built-in allow-all authorizer, so a nonempty request is
1897
+ rejected rather than silently weakened.
1898
+ Selecting a persona or model without `--prompt` or `--prompt-stdin` is also
1899
+ rejected; akm never fabricates an empty command. The
1900
+ prompt-free interactive exemption applies only when no persona/model/tool/schema
1901
+ or inference payload was selected.
1790
1902
 
1791
1903
  **Platform-specific dispatch:** akm uses a platform builder to construct the
1792
1904
  CLI argv for each engine's harness platform. `platform: "opencode"` engines emit:
1793
1905
  `opencode run [--system-prompt "..."] [--model opencode/claude-opus-4-7] "<prompt>"`.
1794
1906
  `platform: "claude"` engines emit:
1795
- `claude [--system-prompt "..."] [--model claude-opus-4-7] [--allowedTools ...] --print "<prompt>"`.
1796
- Agent engines may set `bin`, `args`, `workspace`, `model`, `timeoutMs`, and
1797
- `modelAliases` in config.
1907
+ `claude [--system-prompt "..."] [--model claude-opus-4-7] --print -- "<prompt>"`.
1908
+ Agent engines may set `bin`, `args`, `workspace`, `model`, and `timeoutMs` in
1909
+ config. Semantic model aliases live only in the installed/user `models.json`
1910
+ files and resolve before dispatch.
1798
1911
 
1799
1912
  Without any `--prompt`, `<agent-ref>`, or `--model`, the agent is launched
1800
1913
  interactively (no injected prompt, no platform-specific flags beyond the
@@ -1838,7 +1951,7 @@ stale paths, and broken refs — in body text and in
1838
1951
  `dangerous-env-key` findings for env files (the same key set `akm bundle add`
1839
1952
  enforces — see [Dangerous env key audit](#dangerous-env-key-audit) — but
1840
1953
  non-blocking here; `lint` only warns). `--type workflows` structurally parses
1841
- and compiles unified markdown workflows; errors surface as
1954
+ and compiles peer Markdown and GitHub-shaped YAML workflows; errors surface as
1842
1955
  `invalid-workflow-structure` findings (0.9.0: this is the only
1843
1956
  structural-validation surface now that `akm workflow validate` is gone).
1844
1957
 
@@ -1890,7 +2003,7 @@ akm improve --sync --no-push # commit only, skip the push after it
1890
2003
  | `--task` | Optional extra guidance for this improvement pass |
1891
2004
  | `--dry-run` | Show the schema-v2 result on stdout without creating config, data, state, cache, bundle, log, or result artifacts. Dry-run results are never persisted, including on errors or signals. |
1892
2005
  | `--bundle` | Select the proposal/write target; when the ref scope is bundle-qualified, it must name the same bundle |
1893
- | `--limit <n>` | Maximum number of assets to process (highest utility first) |
2006
+ | `--limit <n>` | Base cap for ordinary assets (highest utility first); configured replay slots are additive |
1894
2007
  | `--timeout-ms <ms>` | Wall-clock budget for the run (default: `7200000` = 2 hours) |
1895
2008
  | `--require-feedback-signal` | Only process assets with recent feedback signals |
1896
2009
  | `--strategy <name>` | Override the active improve strategy (a built-in or entry under `improve.strategies`) |
@@ -1933,6 +2046,22 @@ Selection behavior defaults to recent feedback signals first, with a
1933
2046
  zero-feedback retrieval fallback for high-traffic refs. Use
1934
2047
  `--require-feedback-signal` to disable retrieval fallback for the run.
1935
2048
 
2049
+ For dry runs, `plannedRefs` is the effective post-limit work set, not every
2050
+ ref in the requested scope. The `plan` object preserves both views: raw scope
2051
+ size and per-gate removals, configured and effective caps, final ranked refs
2052
+ and their selection lanes, proactive and consolidation statistics, stage
2053
+ decisions, triage mode/caps, and `snapshot.status`/`snapshot.reason` for the
2054
+ read-side index boundary. `limits.effective` is the ordinary-ref base cap;
2055
+ `limits.additiveReplayAllowance` is the separate replay budget, and
2056
+ `limits.totalCeiling` is their finite sum (omitted when the base run is
2057
+ unbounded). A missing or incompatible index is an explicit empty snapshot and
2058
+ is not created or migrated. `plan.mode` is `estimate` and `plan.dispatch` is
2059
+ `false`; live JSON results use the same projection with `mode: "execution"`.
2060
+ The dry result is a best-effort observation assembled during that invocation,
2061
+ not an atomic cross-store snapshot or a reservation. Live execution re-inspects
2062
+ mutable inputs, so a later run can differ after index, state, filesystem,
2063
+ clock, or session-log changes.
2064
+
1936
2065
  When reinforced facts need promotion, `knowledge` is the higher-authority
1937
2066
  destination than `memory`. The deterministic search ranking also prefers
1938
2067
  `knowledge` over `memory` hits, including inferred `.derived` memories, when
@@ -1970,16 +2099,16 @@ session extraction — it replaces the legacy session-checkpoint hook and runs
1970
2099
  independently of the improve-stage extract toggle (see `improve` above).
1971
2100
 
1972
2101
  ```sh
1973
- akm proposal extract --type claude-code --session-id <id>
1974
- akm proposal extract --type claude-code --since 24h
2102
+ akm proposal extract --type claude --session-id <id>
2103
+ akm proposal extract --type claude --since 24h
1975
2104
  akm proposal extract --type opencode --since 7d --dry-run
1976
2105
  akm proposal extract --auto # iterate every available harness
1977
- akm proposal extract --type claude-code --location /custom/path --session-id <id>
2106
+ akm proposal extract --type claude --location /custom/path --session-id <id>
1978
2107
  ```
1979
2108
 
1980
2109
  | Flag | Description |
1981
2110
  | --- | --- |
1982
- | `--type <harness>` | Harness name (`claude-code`, `opencode`). Required unless `--auto`. |
2111
+ | `--type <harness>` | Harness name (`claude`, `opencode`). Required unless `--auto`. |
1983
2112
  | `--session-id <id>` | Process only this session ID. When absent, discover sessions via `--since`. |
1984
2113
  | `--location <path>` | Override the harness's default session-discovery location. |
1985
2114
  | `--since <cutoff>` | Discovery cutoff. ISO timestamp or duration (`24h`, `7d`, `30m`). Default `24h`. |
@@ -2192,7 +2321,7 @@ akm proposal drain --strategy default --promote -y # Read the triage block from
2192
2321
  | `--max-accepts` | Hard per-run accept ceiling; accepts beyond this are reported as `skippedByCap` |
2193
2322
  | `--max-diff-lines` | Defer (never promote) accepts whose proposed content exceeds this many lines |
2194
2323
  | `--older-than` | Only consider proposals created more than this many days ago |
2195
- | `--judgment` | Opt into the judgment tier (`llm` by default; `agent`/`sdk` per config) for deferred items. No-op with a logged `triage_deferred` summary when no runner is configured. |
2324
+ | `--judgment` | Explicitly enable the judgment tier for this standalone drain, including when the selected strategy says `judgment.enabled: false`; execution overrides still come from that strategy. Without this flag, strategy judgment config does not enable standalone drain judgment. A missing runner remains a no-op with a logged `triage_deferred` summary. |
2196
2325
  | `-y`, `--yes` | Skip the confirmation prompt (required in non-interactive mode for promotion) |
2197
2326
 
2198
2327
  ### feedback (`--reason`)
@@ -2206,7 +2335,8 @@ prompts. Negative feedback requires a reason by default.
2206
2335
  `akm task` is the scheduling surface for workflows, agent prompts, and
2207
2336
  shell commands. It manages on-disk task definitions under
2208
2337
  `<bundle>/tasks/<id>.yml` and reconciles them with the OS-native scheduler
2209
- (cron / launchd / schtasks). Only version-2 task YAML is discovered. The
2338
+ (cron / launchd / schtasks). Strict task v3 YAML is the executable source
2339
+ contract; see the canonical [Tasks reference](tasks.md). The
2210
2340
  group is `add | run | sync | doctor | history` — there is no `list` or
2211
2341
  `remove`; use `akm search --type task` / `akm show tasks/<id>` to inspect,
2212
2342
  and edit the file + `akm task sync` to change or remove a schedule.
@@ -2272,16 +2402,16 @@ disturbs another bundle's scheduled tasks. Scheduler ids are the bare task id an
2272
2402
  are never namespaced: registering a task whose id is already scheduled from a
2273
2403
  different bundle is a hard error.
2274
2404
 
2275
- Each task targets exactly one of `--workflow <ref>`, `--prompt <text-or-ref>`,
2276
- or `--command <shell>`. Task YAML is strict and begins with `version: 2`.
2277
- Prompt targets dispatch through `--engine` or `defaults.engine` and may set
2278
- `model`, `timeoutMs`, and LLM request overrides; command tasks may set only
2279
- `timeoutMs`; workflow tasks may set `params`, `timeoutMs`, `maxSteps`, and
2280
- `maxRetries`. `task add` accepts `--engine`, `--model`, `--timeout-ms`,
2281
- `--params`, `--name`, `--when-to-use`, `--description`, and `--tags`
2282
- (`maxSteps` / `maxRetries` are YAML-only set them in the file and run `akm
2283
- task sync`). A v1 task is diagnosed by sync and doctor but is never rewritten
2284
- or executed.
2405
+ `task add` accepts exactly one CLI target selector (`--workflow <ref>`,
2406
+ `--prompt <text-or-ref>`, or `--command <shell>`) and writes a strict task v3
2407
+ source. In the file, exactly one of `uses` or `run` is allowed. `uses` accepts
2408
+ command, workflow, and script refs plus `akm/command`; agents and task refs are
2409
+ not executable. `run` accepts a shell string with the closed shell and
2410
+ contained working-directory contract. The `akm` object owns scheduling,
2411
+ resolver overrides, `timeout`, `maxSteps`, `maxRetries`, and redaction names.
2412
+ Normal execution rejects v2 and points to `akm migrate apply --dry-run` followed
2413
+ by `akm migrate apply`. See [Tasks](tasks.md#migrating-task-v2-to-v3) for the
2414
+ complete grammar and fail-closed migration behavior.
2285
2415
 
2286
2416
  **Task-log redaction and `redact:`.** A task's persisted output — the run `.log`
2287
2417
  file and its `logs.db` rows — is scrubbed before it is written. Two passes run:
@@ -2298,10 +2428,11 @@ Any task kind may add `redact:` for a secret exported under a name none of those
2298
2428
  rules recognise:
2299
2429
 
2300
2430
  ```yaml
2301
- version: 2
2302
- schedule: "0 3 * * *"
2303
- command: ./deploy.sh
2304
- redact: [ACME_DEPLOY_TOKEN] # NAMES, never values — max 32
2431
+ version: 3
2432
+ run: ./deploy.sh
2433
+ akm:
2434
+ schedule: "0 3 * * *"
2435
+ redact: [ACME_DEPLOY_TOKEN] # NAMES, never values
2305
2436
  ```
2306
2437
 
2307
2438
  akm looks each name up in the environment the run is given; a name that is unset
@@ -2317,13 +2448,13 @@ run`; it does not stop after creating a run. Completion maps to task
2317
2448
  `failed`. The task schema's `params` mapping remains the non-CLI way a scheduled
2318
2449
  definition supplies its new-run parameter snapshot.
2319
2450
 
2320
- **Workflow-task run bounds.** `timeoutMs`, `maxSteps`, and `maxRetries` are the
2321
- task-file spellings of `akm workflow run --timeout`, `--max-steps`, and
2451
+ **Workflow-task run bounds.** `akm.timeout`, `akm.maxSteps`, and
2452
+ `akm.maxRetries` correspond to `akm workflow run --timeout`, `--max-steps`, and
2322
2453
  `--max-retries`. Unlike the interactive command, a scheduled workflow task gets
2323
2454
  a **default whole-run timeout of 6 hours**
2324
2455
  (`DEFAULT_WORKFLOW_TASK_TIMEOUT_MS`): nobody is at the terminal to Ctrl-C an
2325
2456
  unattended run, so without one a single wedged unit hangs the task forever. An
2326
- explicit `timeoutMs` always wins, and `timeoutMs: null` opts out entirely. On
2457
+ explicit `akm.timeout` always wins, and `timeout: null` opts out entirely. On
2327
2458
  expiry the runner aborts the run's signal, which the engine treats as a
2328
2459
  graceful break at the next step boundary — the journal is kept and the run
2329
2460
  stays resumable with `akm workflow resume <run-id>` (the run id is in the task
@@ -2331,12 +2462,13 @@ run's `detail.error` and log). The attempt itself is recorded as `failed`, so
2331
2462
  the OS scheduler sees a non-zero exit.
2332
2463
 
2333
2464
  ```yaml
2334
- version: 2
2335
- schedule: "@daily"
2336
- workflow: workflows/nightly-report
2337
- params:
2465
+ version: 3
2466
+ uses: workflows/nightly-report
2467
+ with:
2338
2468
  region: us-east-1
2339
- timeoutMs: 3600000 # 1h whole-run bound (omit for the 6h default, null for none)
2340
- maxSteps: 20 # optional
2341
- maxRetries: 1 # optional
2469
+ akm:
2470
+ schedule: "@daily"
2471
+ timeout: 3600000 # 1h whole-run bound (omit for the 6h default, null for none)
2472
+ maxSteps: 20 # optional
2473
+ maxRetries: 1 # optional
2342
2474
  ```