akm-cli 0.9.17-alpha.3 → 0.9.17-alpha.4

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 (343) hide show
  1. package/CHANGELOG.md +731 -0
  2. package/dist/akm +94 -196
  3. package/dist/cli/shared.js +6 -2
  4. package/dist/cli.js +22 -9
  5. package/dist/commands/agent/agent-dispatch.js +1 -1
  6. package/dist/commands/command/command-execution.js +24 -62
  7. package/dist/commands/feedback-cli.js +0 -1
  8. package/dist/commands/health/accept-rate.js +2 -2
  9. package/dist/commands/health/checks.js +30 -75
  10. package/dist/commands/health/config-skew.js +38 -0
  11. package/dist/commands/health/egress.js +54 -0
  12. package/dist/commands/health/html-report.js +0 -38
  13. package/dist/commands/health/improve-metrics.js +123 -562
  14. package/dist/commands/health/plugin-staleness.js +53 -3
  15. package/dist/commands/health/renderers.js +12 -4
  16. package/dist/commands/health/report-view-model.js +11 -106
  17. package/dist/commands/health/types-improve.js +4 -19
  18. package/dist/commands/health/windows.js +64 -73
  19. package/dist/commands/health.js +122 -143
  20. package/dist/commands/improve/consolidate/chunking.js +25 -100
  21. package/dist/commands/improve/consolidate/sanitize.js +54 -149
  22. package/dist/commands/improve/consolidate.js +538 -1075
  23. package/dist/commands/improve/content-hash.js +16 -24
  24. package/dist/commands/improve/distill/content-repair.js +18 -100
  25. package/dist/commands/improve/distill-guards.js +20 -81
  26. package/dist/commands/improve/distill-promotion-policy.js +23 -243
  27. package/dist/commands/improve/distill.js +608 -1075
  28. package/dist/commands/improve/eligibility.js +126 -400
  29. package/dist/commands/improve/execution.js +3 -5
  30. package/dist/commands/improve/extract.js +487 -1046
  31. package/dist/commands/improve/feedback-valence.js +0 -25
  32. package/dist/commands/improve/improve-cli.js +29 -166
  33. package/dist/commands/improve/improve-result-file.js +10 -66
  34. package/dist/commands/improve/improve-strategies.js +12 -7
  35. package/dist/commands/improve/improve-usage-report.js +18 -64
  36. package/dist/commands/improve/improve.js +443 -1063
  37. package/dist/commands/improve/ledger.js +114 -0
  38. package/dist/commands/improve/locks.js +2 -8
  39. package/dist/commands/improve/loop-stages.js +459 -1172
  40. package/dist/commands/improve/memory/derived-ref.js +12 -77
  41. package/dist/commands/improve/memory/memory-belief.js +14 -118
  42. package/dist/commands/improve/memory/memory-improve.js +4 -3
  43. package/dist/commands/improve/outcome-loop.js +28 -156
  44. package/dist/commands/improve/planner.js +5 -10
  45. package/dist/commands/improve/preparation.js +851 -2339
  46. package/dist/commands/improve/proactive-maintenance.js +34 -101
  47. package/dist/commands/improve/reflect-noise.js +104 -280
  48. package/dist/commands/improve/reflect.js +621 -1367
  49. package/dist/commands/improve/salience.js +46 -232
  50. package/dist/commands/improve/session-asset.js +19 -100
  51. package/dist/commands/improve/stage.js +323 -0
  52. package/dist/commands/proposal/drain.js +251 -644
  53. package/dist/commands/proposal/proposal-cli.js +3 -18
  54. package/dist/commands/proposal/proposal-types.js +20 -41
  55. package/dist/commands/proposal/proposal.js +1 -2
  56. package/dist/commands/proposal/propose.js +134 -160
  57. package/dist/commands/proposal/repository.js +502 -1487
  58. package/dist/commands/proposal/validators/proposal-quality-validators.js +71 -174
  59. package/dist/commands/proposal/validators/proposal-validators.js +1 -1
  60. package/dist/commands/proposal/validators/proposals.js +13 -89
  61. package/dist/commands/read/curate.js +63 -413
  62. package/dist/commands/read/search-cli.js +16 -33
  63. package/dist/commands/read/search.js +17 -23
  64. package/dist/commands/read/show.js +2 -13
  65. package/dist/commands/sources/bundle-cli.js +25 -2
  66. package/dist/commands/sources/bundle-config-ops.js +7 -0
  67. package/dist/commands/sources/dangerous-env-audit.js +1 -2
  68. package/dist/commands/sources/info.js +2 -11
  69. package/dist/commands/sources/installed-stashes.js +197 -746
  70. package/dist/commands/sources/schema-repair.js +98 -129
  71. package/dist/commands/sources/source-add.js +62 -12
  72. package/dist/commands/sources/stash-cli.js +1 -1
  73. package/dist/commands/tasks/explain.js +10 -13
  74. package/dist/commands/tasks/tasks-cli.js +9 -8
  75. package/dist/commands/tasks/tasks.js +326 -930
  76. package/dist/commands/tasks/validate.js +42 -21
  77. package/dist/commands/workflow/plan.js +22 -29
  78. package/dist/commands/workflow-cli.js +4 -4
  79. package/dist/core/adapter/adapters/akm-adapter.js +0 -1
  80. package/dist/core/adapter/adapters/akm-lint.js +2 -3
  81. package/dist/core/adapter/adapters/akm-metadata.js +11 -12
  82. package/dist/core/adapter/adapters/akm-workflow-adapter.js +1 -1
  83. package/dist/core/adapter/execution-source.js +17 -29
  84. package/dist/core/asset/resolve-ref.js +1 -1
  85. package/dist/core/bundle-id.js +42 -5
  86. package/dist/core/bundle-rename.js +291 -0
  87. package/dist/core/config/config-io.js +1 -2
  88. package/dist/core/config/config-schema.js +1 -33
  89. package/dist/core/config/config-walker.js +1 -1
  90. package/dist/core/config/config.js +163 -68
  91. package/dist/core/config/legacy-source-shape-shim.js +38 -9
  92. package/dist/core/config/schema/embedding.js +20 -5
  93. package/dist/core/config/schema/engines.js +5 -0
  94. package/dist/core/config/schema/execution.js +1 -1
  95. package/dist/core/config/schema/experimental.js +1 -1
  96. package/dist/core/config/schema/improve-processes.js +21 -95
  97. package/dist/core/config/schema/improve.js +4 -42
  98. package/dist/core/config/schema/scheduler.js +12 -12
  99. package/dist/core/config/schema/search.js +6 -22
  100. package/dist/core/env-secret-ref.js +0 -1
  101. package/dist/core/errors.js +8 -9
  102. package/dist/core/file-lock.js +76 -173
  103. package/dist/core/logs-db.js +2 -2
  104. package/dist/core/paths.js +0 -27
  105. package/dist/core/redaction.js +109 -2
  106. package/dist/core/run-lock.js +2 -5
  107. package/dist/core/spawn-env.js +1 -1
  108. package/dist/core/state/migrations.js +108 -61
  109. package/dist/core/state-db-scope.js +2 -4
  110. package/dist/core/state-db.js +126 -692
  111. package/dist/core/type-presentation.js +1 -9
  112. package/dist/core/write-source.js +293 -1012
  113. package/dist/execution/input-contract.js +1 -1
  114. package/dist/execution/resolved-request.js +135 -689
  115. package/dist/execution/source.js +63 -257
  116. package/dist/execution/target-ref.js +1 -1
  117. package/dist/indexer/bundle-identity-guard.js +2 -2
  118. package/dist/indexer/db/graph-db.js +106 -46
  119. package/dist/indexer/ensure-index.js +44 -85
  120. package/dist/indexer/graph/graph-extraction.js +340 -562
  121. package/dist/indexer/graph/graph-related.js +130 -0
  122. package/dist/indexer/index-rebuild-lock.js +3 -11
  123. package/dist/indexer/index-writer-lock.js +8 -17
  124. package/dist/indexer/index-written-assets.js +139 -151
  125. package/dist/indexer/indexer.js +524 -846
  126. package/dist/indexer/materialize-embeddings.js +60 -397
  127. package/dist/indexer/passes/memory-inference.js +81 -90
  128. package/dist/indexer/passes/metadata.js +132 -200
  129. package/dist/indexer/read-preflight.js +0 -7
  130. package/dist/indexer/scan/doc-to-entry.js +1 -3
  131. package/dist/indexer/scan/drain-dir.js +1 -1
  132. package/dist/indexer/search/db-search.js +181 -590
  133. package/dist/indexer/search/fts-query.js +30 -41
  134. package/dist/indexer/search/ranking.js +28 -154
  135. package/dist/indexer/search/search-attribution.js +12 -32
  136. package/dist/indexer/search/search-fields.js +11 -15
  137. package/dist/indexer/search/search-hit-enrichers.js +54 -85
  138. package/dist/indexer/search/search-source.js +1 -4
  139. package/dist/indexer/usage/usage-events.js +2 -7
  140. package/dist/integrations/agent/engine-fallback.js +23 -40
  141. package/dist/integrations/agent/engine-resolution.js +93 -183
  142. package/dist/integrations/agent/execution.js +507 -0
  143. package/dist/integrations/agent/model-map.js +28 -156
  144. package/dist/integrations/agent/request-lowering.js +66 -141
  145. package/dist/integrations/agent/runner-dispatch.js +143 -321
  146. package/dist/integrations/agent/runner.js +54 -14
  147. package/dist/integrations/lockfile.js +53 -101
  148. package/dist/llm/embedders/deterministic.js +2 -3
  149. package/dist/llm/embedders/profile.js +71 -0
  150. package/dist/llm/embedders/remote.js +10 -15
  151. package/dist/llm/graph-extract.js +3 -12
  152. package/dist/llm/index-passes.js +3 -5
  153. package/dist/llm/memory-infer.js +1 -2
  154. package/dist/llm/metadata-enhance.js +1 -2
  155. package/dist/llm/structured-call.js +5 -24
  156. package/dist/output/generic-render.js +23 -11
  157. package/dist/output/html-render.js +13 -10
  158. package/dist/output/render-registry.js +3 -32
  159. package/dist/output/shapes/helpers.js +2 -34
  160. package/dist/output/shapes/passthrough.js +1 -9
  161. package/dist/{indexer/search/ranking-types.js → output/text/bundle-rename.js} +4 -1
  162. package/dist/output/text/command-format.js +60 -23
  163. package/dist/output/text/helpers.js +1 -1
  164. package/dist/output/text/migrate.js +5 -14
  165. package/dist/output/text/proposal-format.js +1 -2
  166. package/dist/output/text/workflow-format.js +0 -32
  167. package/dist/output/text.js +2 -0
  168. package/dist/registry/factory.js +4 -19
  169. package/dist/registry/network.js +66 -220
  170. package/dist/registry/providers/index.js +0 -2
  171. package/dist/registry/providers/skills-sh.js +3 -14
  172. package/dist/registry/providers/static-index.js +24 -26
  173. package/dist/registry/resolve.js +55 -131
  174. package/dist/scripts/akm-migrate-node.js +43937 -93313
  175. package/dist/scripts/akm-migrate.js +43697 -93071
  176. package/dist/setup/registry-stash-loader.js +4 -13
  177. package/dist/setup/semantic-assets.js +3 -44
  178. package/dist/setup/setup.js +1 -1
  179. package/dist/setup/steps/tasks.js +25 -15
  180. package/dist/sources/provider-factory.js +17 -18
  181. package/dist/sources/providers/filesystem.js +2 -3
  182. package/dist/sources/providers/git-install.js +7 -1
  183. package/dist/sources/providers/git-provider.js +0 -3
  184. package/dist/sources/providers/git-stash.js +0 -17
  185. package/dist/sources/providers/npm.js +2 -4
  186. package/dist/sources/providers/provider-utils.js +5 -10
  187. package/dist/sources/providers/website.js +0 -2
  188. package/dist/sources/snapshot-fetchers/website-ingest.js +1 -1
  189. package/dist/sources/website-url.js +2 -2
  190. package/dist/storage/database.js +9 -35
  191. package/dist/storage/repositories/improve-ledger-repository.js +168 -0
  192. package/dist/storage/repositories/index-connection.js +34 -70
  193. package/dist/storage/repositories/index-entries-repository.js +69 -111
  194. package/dist/storage/repositories/index-entry-mapper.js +1 -2
  195. package/dist/storage/repositories/index-entry-schema.js +83 -269
  196. package/dist/storage/repositories/index-fts-repository.js +86 -256
  197. package/dist/storage/repositories/index-llm-cache-repository.js +17 -0
  198. package/dist/storage/repositories/index-meta-repository.js +6 -4
  199. package/dist/storage/repositories/index-schema.js +192 -220
  200. package/dist/storage/repositories/index-utility-repository.js +8 -29
  201. package/dist/storage/repositories/index-vec-repository.js +133 -414
  202. package/dist/storage/repositories/outcome-repository.js +2 -1
  203. package/dist/storage/repositories/proposals-repository.js +35 -0
  204. package/dist/storage/repositories/registry-index-cache-repository.js +100 -0
  205. package/dist/storage/repositories/task-history-repository.js +26 -4
  206. package/dist/storage/repositories/workflow-runs-repository.js +53 -244
  207. package/dist/storage/sqlite-migrations.js +136 -0
  208. package/dist/storage/sqlite-pragmas.js +11 -9
  209. package/dist/storage/sqlite-transaction.js +170 -0
  210. package/dist/storage/state-db-integrity.js +34 -27
  211. package/dist/tasks/activation-config.js +134 -62
  212. package/dist/tasks/backends/cron.js +129 -277
  213. package/dist/tasks/backends/exec-utils.js +2 -5
  214. package/dist/tasks/backends/launchd.js +125 -745
  215. package/dist/tasks/backends/schtasks.js +101 -620
  216. package/dist/tasks/prepare/prepare-support.js +5 -15
  217. package/dist/tasks/prepare/prepare.js +0 -2
  218. package/dist/tasks/resolve-akm-bin.js +20 -79
  219. package/dist/tasks/run/attempt-lifecycle.js +0 -1
  220. package/dist/tasks/scheduler-binding.js +18 -238
  221. package/dist/tasks/scheduler-invocation.js +52 -52
  222. package/dist/tasks/scheduler-lock.js +53 -0
  223. package/dist/tasks/scheduler-sync.js +361 -751
  224. package/dist/tasks/source/parse-task-source.js +160 -10
  225. package/dist/tasks/source/task-source-v3-frozen.js +3 -4
  226. package/dist/tasks/source/task-to-v4.js +2 -2
  227. package/dist/workflows/authoring/authoring.js +3 -12
  228. package/dist/workflows/compile.js +211 -0
  229. package/dist/workflows/concurrency-policy.js +13 -74
  230. package/dist/workflows/exec/child-invocation.js +3 -17
  231. package/dist/workflows/exec/child-workflow.js +32 -141
  232. package/dist/workflows/exec/dispatch-redaction.js +13 -53
  233. package/dist/workflows/exec/environment.js +98 -0
  234. package/dist/workflows/exec/exec-unit.js +33 -140
  235. package/dist/workflows/exec/frozen-judge.js +7 -59
  236. package/dist/workflows/exec/native-executor.js +82 -341
  237. package/dist/workflows/exec/param-secrets.js +29 -47
  238. package/dist/workflows/exec/run-workflow.js +154 -387
  239. package/dist/workflows/exec/scheduler.js +9 -36
  240. package/dist/workflows/exec/step-work.js +127 -430
  241. package/dist/workflows/exec/unit-dispatch.js +11 -63
  242. package/dist/workflows/exec/unit-writer.js +8 -52
  243. package/dist/workflows/exec/worktree.js +39 -273
  244. package/dist/workflows/freeze/child-output-references.js +4 -15
  245. package/dist/workflows/freeze/environment.js +99 -92
  246. package/dist/workflows/freeze/freeze.js +172 -0
  247. package/dist/workflows/freeze/step-values.js +19 -21
  248. package/dist/workflows/freeze/targets/child-workflow.js +23 -92
  249. package/dist/workflows/freeze/targets/command.js +10 -33
  250. package/dist/workflows/freeze/targets/script.js +5 -12
  251. package/dist/workflows/freeze/targets/shell.js +3 -6
  252. package/dist/workflows/freeze/targets/task.js +25 -80
  253. package/dist/workflows/freeze/task-bindings.js +20 -67
  254. package/dist/workflows/{source-ir/github-yaml.js → github-yaml.js} +88 -206
  255. package/dist/workflows/ir/params.js +6 -51
  256. package/dist/workflows/ir/plan-hash.js +2 -34
  257. package/dist/workflows/parser.js +140 -43
  258. package/dist/{commands/improve/consolidate/types.js → workflows/plan.js} +2 -1
  259. package/dist/workflows/renderer.js +36 -69
  260. package/dist/workflows/resource-limits.js +12 -120
  261. package/dist/workflows/runtime/agent-identity.js +8 -40
  262. package/dist/workflows/runtime/run-outputs.js +3 -6
  263. package/dist/workflows/runtime/run-plan.js +316 -0
  264. package/dist/workflows/runtime/runs.js +48 -200
  265. package/dist/workflows/runtime/workflow-asset-loader.js +24 -57
  266. package/dist/workflows/{source-ir/semantics.js → source-semantics.js} +16 -20
  267. package/dist/workflows/validate-summary.js +2 -7
  268. package/docs/integration/bundling-akm.md +49 -42
  269. package/docs/migration/README.md +1 -0
  270. package/docs/migration/release-notes/0.9.17.md +41 -0
  271. package/docs/migration/v0.9.1-to-v0.9.2.md +19 -7
  272. package/docs/reference/cli.md +182 -125
  273. package/docs/reference/configuration.md +49 -56
  274. package/docs/reference/data-and-telemetry.md +19 -20
  275. package/docs/reference/tasks.md +86 -38
  276. package/docs/reference/workflow-schema.md +14 -18
  277. package/docs/reference/workflows.md +6 -9
  278. package/package.json +1 -1
  279. package/schemas/akm-config.json +87 -406
  280. package/dist/commands/health/advisories.js +0 -150
  281. package/dist/commands/health/metrics.js +0 -329
  282. package/dist/commands/health/surfaces.js +0 -102
  283. package/dist/commands/improve/anti-collapse.js +0 -83
  284. package/dist/commands/improve/collapse-detector.js +0 -432
  285. package/dist/commands/improve/consolidate/eligibility.js +0 -48
  286. package/dist/commands/improve/consolidate/merge.js +0 -146
  287. package/dist/commands/improve/distill/promote-memory.js +0 -329
  288. package/dist/commands/improve/distill/quality-gate.js +0 -500
  289. package/dist/commands/improve/memory/memory-contradiction-detect.js +0 -291
  290. package/dist/commands/improve/proposal-envelope.js +0 -31
  291. package/dist/commands/improve/run-context.js +0 -123
  292. package/dist/commands/improve/shared.js +0 -21
  293. package/dist/commands/improve/source-identity.js +0 -28
  294. package/dist/commands/improve/triage.js +0 -96
  295. package/dist/commands/proposal/drain-policies.js +0 -151
  296. package/dist/commands/sources/update-transaction.js +0 -220
  297. package/dist/core/action-contributors.js +0 -28
  298. package/dist/core/config/config-version-shim.js +0 -101
  299. package/dist/core/config/retired-experimental-keys-shim.js +0 -62
  300. package/dist/core/fs-txn.js +0 -405
  301. package/dist/core/lexical-score.js +0 -25
  302. package/dist/core/maintenance-barrier.js +0 -167
  303. package/dist/execution/executable-identity.js +0 -105
  304. package/dist/execution/guarded-source.js +0 -441
  305. package/dist/indexer/graph/graph-boost.js +0 -427
  306. package/dist/indexer/graph/graph-dedup.js +0 -95
  307. package/dist/indexer/search/name-match.js +0 -35
  308. package/dist/indexer/search/ranking-contributors.js +0 -515
  309. package/dist/indexer/walk/project-context.js +0 -192
  310. package/dist/integrations/agent/execution-cascade.js +0 -566
  311. package/dist/integrations/agent/execution-definitions.js +0 -202
  312. package/dist/integrations/agent/execution-lowering.js +0 -841
  313. package/dist/integrations/agent/execution-preparation.js +0 -98
  314. package/dist/integrations/agent/inline-execution.js +0 -74
  315. package/dist/registry/create-provider-registry.js +0 -29
  316. package/dist/registry/pinned-request-helper.js +0 -247
  317. package/dist/registry/pinned-transport.js +0 -717
  318. package/dist/sources/providers/index.js +0 -14
  319. package/dist/storage/engines/sqlite-migrations.js +0 -271
  320. package/dist/storage/repositories/canaries-repository.js +0 -107
  321. package/dist/storage/repositories/embedding-salvage-repository.js +0 -184
  322. package/dist/storage/repositories/registry-cache.js +0 -113
  323. package/dist/tasks/scheduler-sync-preview.js +0 -52
  324. package/dist/workflows/freeze/resolve-steps.js +0 -86
  325. package/dist/workflows/freeze/source-freeze.js +0 -64
  326. package/dist/workflows/ir/compile.js +0 -321
  327. package/dist/workflows/ir/environment-v4.js +0 -330
  328. package/dist/workflows/ir/freeze-v4.js +0 -153
  329. package/dist/workflows/ir/schema-v4.js +0 -745
  330. package/dist/workflows/ir/schema.js +0 -354
  331. package/dist/workflows/program/schema.js +0 -78
  332. package/dist/workflows/runtime/checkin.js +0 -57
  333. package/dist/workflows/runtime/plan-classifier.js +0 -196
  334. package/dist/workflows/runtime/unit-checkin.js +0 -45
  335. package/dist/workflows/runtime/unit-phases.js +0 -20
  336. package/dist/workflows/schema.js +0 -4
  337. package/dist/workflows/source-ir/compile.js +0 -200
  338. package/dist/workflows/source-ir/program.js +0 -50
  339. package/dist/workflows/source-ir/result.js +0 -26
  340. package/dist/workflows/source-ir/schema.js +0 -786
  341. package/dist/workflows/source-ir/triggers.js +0 -79
  342. package/dist/workflows/source-ir/uses.js +0 -40
  343. package/dist/workflows/validator.js +0 -60
@@ -10,32 +10,17 @@ automatic project-config discovery.
10
10
 
11
11
  ## Version 0.9
12
12
 
13
- A present configuration file must set `configVersion` to a version this
14
- binary knows: the current `"0.9.0"`, or a known older version it can
15
- auto-upgrade in memory (see "Version read shim" below). Missing, newer,
16
- numeric, and any other unrecognized version are rejected by ordinary
17
- commands without rewriting the file — an older binary never guesses at a
18
- newer, unknown shape. Pre-0.9 config and database layouts are not runtime
19
- inputs. Historical task sources and scheduler activation are handled by the
20
- standalone `akm-migrate` executable, also invoked by `akm migrate` / `akm
21
- upgrade`; ordinary runtime code reads only the current shape.
22
-
23
- ### Version read shim
24
-
25
- For config only, a known older `configVersion`
26
- is converted to the current shape in memory on load — with a one-line stderr
27
- deprecation warning — rather than hard-failing every command. Nothing is
28
- written back to disk by the shim itself; the very next config-mutating
29
- command (`akm config set`, etc.) persists the upgrade for free, since every
30
- config write already forces `configVersion` to the current value, which
31
- silences the warning. A `configVersion` this binary does not recognize at
32
- all — including anything newer than current — still fails closed with
33
- `UNSUPPORTED_CONFIG_VERSION`.
34
-
35
- As of this writing `"0.9.0"` is the only `configVersion` akm has ever
36
- shipped, so there is no real older shape for the shim to convert yet; the
37
- mechanism (`src/core/config/config-version-shim.ts`) is established ahead of
38
- the first bump that will need it, per #863.
13
+ `configVersion` is `"0.9.0"`, the only value akm has ever shipped. It is
14
+ read, never gated on: a file without the field loads silently, and a file
15
+ declaring any other value is named once on stderr (`config.json declares
16
+ configVersion "X"; this release reads it as 0.9.0.`) and read as the
17
+ current shape anyway — nothing is rewritten on disk. The next config write
18
+ (`akm config set`, etc.) and `akm migrate apply`'s config step both persist
19
+ `"0.9.0"`, which silences the note. When a newer akm wrote the shared
20
+ config, `akm health`'s `binary-config-skew` advisory is what says so. Pre-0.9
21
+ config and database layouts are not runtime inputs. Historical task sources
22
+ are handled by the standalone `akm-migrate` executable, also invoked by `akm
23
+ migrate` / `akm upgrade`; ordinary runtime code reads only the current shape.
39
24
 
40
25
  ```jsonc
41
26
  {
@@ -82,15 +67,16 @@ the first bump that will need it, per #863.
82
67
 
83
68
  ## Scheduler activation
84
69
 
85
- `scheduler.enabled` is this host's explicit scheduling allow-list. Each entry
86
- has a `kind` (`task` or `workflow`), a canonical fully qualified `ref`, and a
87
- `sourceId` binding the grant to the configured source installation that was
88
- approved. Absence means disabled. Replacing a bundle's path or locator under
89
- the same name invalidates the old grant; ordinary updates from the same origin
90
- do not. Authored task/workflow files may describe schedules but cannot grant
91
- themselves authority to create native scheduler entries. Do not edit
92
- `sourceId` manually: `akm task enable` writes it, and `akm migrate apply`
93
- upgrades grants written by older releases.
70
+ `scheduler.enabled` is this host's list of scheduled refs, such as
71
+ `stash//tasks/nightly`. A ref that is not listed is disabled. On disk each
72
+ entry is still written as the `{kind, ref, sourceId}` object 0.9.16 reads,
73
+ so that release keeps working against a config this one wrote; in memory it
74
+ is the ref.
75
+ A config without the list (written before 0.9.17) means "keep what is
76
+ installed": the first `akm task sync` fills it from the akm-written native
77
+ scheduler rows. The 0.9.17-alpha `{kind, ref, sourceId}` entries are read as
78
+ their `ref`. Authored task/workflow files may describe schedules but cannot
79
+ put themselves on the list.
94
80
 
95
81
  This key is deliberately local: if a config uses `extends`, any `scheduler`
96
82
  section in the base is ignored with a warning. Only the top-level local config
@@ -424,7 +410,22 @@ unless a remote `embedding` config is provided.
424
410
  embedding model: `provider`, `endpoint`, `model`, `apiKey` (symbolic
425
411
  reference, same rules as engine `apiKey`), `dimension`, `localModel`,
426
412
  `maxInputTokens`, `maxTokens`, `batchSize`, `contextLength`, `timeoutMs`,
427
- `concurrency`, and `ollamaOptions.num_ctx`.
413
+ `queryTimeoutMs`, `queryTemplate`, `documentTemplate`, `concurrency`, and
414
+ `ollamaOptions.num_ctx`.
415
+
416
+ Retrieval models expect a prompt around queries and documents. akm picks it by
417
+ model name (`src/llm/embedders/profile.ts`): Qwen3-Embedding gets
418
+ `Instruct: Given a question or task, retrieve the knowledge asset that helps with it\nQuery:{text}`
419
+ on queries; nomic-embed `search_query: ` / `search_document: `; the BGE
420
+ English, mxbai and arctic models `Represent this sentence for searching
421
+ relevant passages: ` on queries; E5 `query: ` / `passage: `; any other model
422
+ none. `embedding.queryTemplate` and `embedding.documentTemplate` override the
423
+ preset (`{text}` marks where the text goes, a template without it is a prefix,
424
+ and `""` means none). The document template is part of the embedding
425
+ fingerprint, so changing it re-embeds the index; the query template applies
426
+ at search time only. `embedding.queryTimeoutMs` (default `3000`) bounds how
427
+ long a search waits for its query embedding before falling back to keyword
428
+ ranking with a warning.
428
429
 
429
430
  The knobs that bound request/document size and rate, all optional (defaults
430
431
  apply when unset), for a remote endpoint (`src/llm/embedders/remote.ts`):
@@ -528,26 +529,20 @@ taking about the same wall time as a single one against a healthy endpoint.
528
529
 
529
530
  ## Search tuning
530
531
 
531
- `search` tunes ranking, not behavior an ordinary user needs to touch:
532
+ `search` sets which types search leaves out by default, and the optional curate reranker:
532
533
 
533
534
  | Key | Purpose |
534
535
  | --- | --- |
535
- | `search.minScore` | Drop results below this score |
536
536
  | `search.defaultExcludeTypes` | Asset types excluded from results by default |
537
537
 
538
- ### Graph boost search tuning
539
-
540
- | Key | Purpose |
541
- | --- | --- |
542
- | `search.graphBoost.*` | Entity-graph relevance boost: `directBoostPerEntity`/`directBoostCap` (directly related entities), `hopBoostPerEntity`/`hopBoostCap` (multi-hop, capped at `maxHops` ≤ 3), `confidenceMode` (`blend`, the only supported value), `confidenceWeight` (0–1, default `0.2`) |
543
-
544
538
  ### Curate rerank (#951)
545
539
 
546
- An optional cross-encoder rerank pass over `akm curate`'s already-selected
547
- candidates, via a standalone `/rerank`-style HTTP endpoint (NOT one of the
548
- `engines.*` `"llm"`/`"agent"` kinds). Disabled by default; a misconfigured
549
- endpoint, network failure, timeout, or malformed response falls back to
550
- curate's own ranking unchanged.
540
+ An optional cross-encoder rerank pass over the top fused search candidates
541
+ `akm curate` fetches, via a standalone `/rerank`-style HTTP endpoint (NOT one
542
+ of the `engines.*` `"llm"`/`"agent"` kinds). Each candidate is sent as its
543
+ name, description and the start of its indexed content (2,000 characters in
544
+ all). Disabled by default; a misconfigured endpoint, network failure, timeout,
545
+ or malformed response keeps the fused order.
551
546
 
552
547
  | Key | Purpose |
553
548
  | --- | --- |
@@ -556,7 +551,7 @@ curate's own ranking unchanged.
556
551
  | `search.curateRerank.model` | Model name sent to the endpoint (optional) |
557
552
  | `search.curateRerank.apiKey` | `$VAR`/`secret://<name>` credential reference (optional) |
558
553
  | `search.curateRerank.timeoutMs` | Request timeout (default `10000`) |
559
- | `search.curateRerank.topN` | How many of curate's ranked candidates to send (default `8`, max `50`) |
554
+ | `search.curateRerank.topN` | How many of the top fused candidates to rerank (default `30`, max `50`) |
560
555
 
561
556
  ## Feedback
562
557
 
@@ -734,7 +729,7 @@ one file, and have each host's local config extend it.
734
729
  `extends` at it.
735
730
 
736
731
  Shared layers carry portable policy, not host authority. `bundles`, source and
737
- write defaults, registries, embedding connections, scheduler grants,
732
+ write defaults, registries, embedding connections, scheduler activation,
738
733
  `execution`, `experimental`, and setup state are ignored when inherited.
739
734
  Engine definitions may be shared, but credentials and executable authority
740
735
  (`apiKey`, `apiKeyFile`, `bin`, `args`, and `workspace`) must be supplied by
@@ -823,11 +818,9 @@ one of the three per engine.
823
818
 
824
819
  `embedding.apiKey` accepts the same three forms and resolves `secret://` the
825
820
  same way, on every path that sends an embedding request: `akm index`
826
- (including its `bundle update` post-commit embedding pass and the targeted
827
- re-embed a write command like `akm remember` triggers), `akm improve`'s
828
- consolidate pass (memory dedup and similarity clustering), and the
829
- fingerprint-rename canary `akm index` runs when the embedding config
830
- changes. All of them build the
821
+ (including the reindex `akm bundle update` runs and the targeted re-embed a
822
+ write command like `akm remember` triggers), `akm improve`'s
823
+ consolidate pass (memory dedup and similarity clustering). All of them build the
831
824
  provider request through the same `RemoteEmbedder`/`resolveSecret` boundary,
832
825
  so a `secret://` reference resolves identically regardless of which command
833
826
  triggered the request (#953).
@@ -60,7 +60,7 @@ Override: set `AKM_CONFIG_DIR` or `XDG_CONFIG_HOME`.
60
60
  | `state.db` | Events, local usage telemetry, proposals, task history, improve run results, and workflow run state/history (the former `workflow.db` was folded in during the 0.9.0 cutover) | **No** — deletes event/usage logs, proposal queue, improve history, and workflow run history |
61
61
  | `logs.db` | Structured, high-volume task/run log lines (`{ts, task_id, run_id, stream, level, line}`), joined to `state.db`'s `task_history` rows by `task_id@started_at`. Kept separate from `state.db` because log lines are append-only and freely purgeable, unlike durable state | Yes — log lines are regenerable per run; deleting loses historical run output only |
62
62
  | `akm.lock` | Inter-process write lock | Yes — recreated automatically |
63
- | `backups/task-v3/`, `backups/task-v4/` | Copies of task files taken by `akm migrate apply` before it rewrites them, one timestamped directory per run; the five most recent per generation are kept (#897) | Yes — once the migrated tasks are verified |
63
+ | `backups/tasks/` | Copies of task files taken by `akm migrate apply` before it rewrites them, one timestamped directory per run that rewrote a file | Yes — once the migrated tasks are verified |
64
64
  | `akm.lock.lck` | Lock write sentinel | Yes — recreated automatically |
65
65
 
66
66
  Override: set `AKM_DATA_DIR` or `XDG_DATA_HOME`.
@@ -161,6 +161,7 @@ the set of types the code actually emits at HEAD (verified against every
161
161
  | `select` | `akm show` after a search returning the same ref | `ref`, `entryId` |
162
162
  | `feedback` | `akm feedback <ref>` | `signal` (positive/negative) |
163
163
  | `sync` | `akm sync` | `ref` |
164
+ | `index_db_vacuumed` | `akm index` VACUUMed index.db, after an index layout migration or because more than half its pages were free | `pagesBefore`, `pagesAfter`, `freelistRatioBefore` |
164
165
  | `stash_synced` | `akm improve`'s internal auto-sync pass (the `sync.push` feature), **distinct from** the `akm sync` command above | `committed`, `pushed`, `skipped`, `reason`, `attributed` (paths the run wrote and staged), `unattributed` (in-scope paths that went dirty during the run without the run writing them — left for their author) |
165
166
  | `env_access` | `akm env run <name> -- <command>` (audit trail: key **names** only, values never recorded) | `ref`, `keys` |
166
167
  | `secret_access` | `akm secret run <ref> <VAR> -- <command>` (audit trail: var **name** only, value never recorded) | `ref`, `var` |
@@ -176,7 +177,7 @@ the set of types the code actually emits at HEAD (verified against every
176
177
  | `proposal_expiration_pass` | Summary emitted once per `akm improve` maintenance run after per-proposal `proposal_expired` events | expiry counts |
177
178
  | `proposal_orphan_purge` | Stale proposals whose target asset no longer exists on disk, pruned by improve maintenance | `checked`, `rejected` |
178
179
  | `proposal_creation_rejected` | `createProposal()` validation failed before write | `ref`, `reason`, `source` |
179
- | `triage_drained` | `akm proposal drain` run summary | `promoted`, `rejected`, `deferredByReason`, `skippedByCap`, `policy`, `applyMode` |
180
+ | `triage_drained` | `akm proposal drain` run summary | `promoted`, `rejected`, `deferredByReason`, `skippedByCap`, `applyMode` |
180
181
  | `triage_deferred` | `akm proposal drain` left items unresolved after the (optional) judgment tier | `deferred`, `deferredByReason`, `reason` |
181
182
 
182
183
  *`akm improve` pipeline*
@@ -194,20 +195,13 @@ the set of types the code actually emits at HEAD (verified against every
194
195
  | `improve_reflect_outcome` | Per-asset reflect result | `ref`, `ok`, `durationMs`, `reason` |
195
196
  | `propose_invoked` | `akm proposal new` | `ref` |
196
197
  | `distill_invoked` | Distill phase inside the `akm improve`/`akm proposal new` pipeline. **`akm distill` is not a CLI command** — there is no standalone verb by that name | `ref`, outcome |
197
- | `consolidate_completed` | `akm improve`'s consolidate pass processed at least one memory | `ref` (`memories/_consolidation`) |
198
198
  | `extract_invoked` | `akm proposal extract --type <harness>` / `--auto`, or improve-stage session extraction | `outcome`, `sessionId`, `harness` |
199
199
  | `extract_triaged` | The pre-LLM extract triage gate evaluated at least one session | `evaluated`, `passed`, `triagedOut`, `sourceRun` (aggregated) |
200
200
  | `schema_repair_invoked` | The schema-repair pass inside `akm improve` (`runSchemaRepairPass`) attempts to patch missing frontmatter on an asset that failed schema validation. **There is no `akm lint --repair` flag** — `lint` has `--fix`/`--auto-fix`, unrelated to this event | `ref`, outcome |
201
201
  | `proactive_selected` | The proactive-maintenance selector runs (once per `akm improve` run) | `count`, `dueTotal`, `neverReflected` (aggregated) |
202
- | `improve_replay_selected` | Bounded replay-budget selection ran | `count`, `budget`, `convergedSkipped`, `candidatePool` (aggregated) |
203
- | `improve_salience_first_run` | First improve run with no pre-existing salience baseline to compare against | `candidateCount`, `note` |
204
202
  | `improve_salience_rank_change` | Bundle-wide rank-change report, from the second improve run onward | `stashSize`, `totalChanged`, `forgettingCandidates`, `topDrops` |
205
- | `outcome_proxy_inverted` | Proxy-adequacy tripwire: `outcome_score` correlates *negatively* with accepted-change rate (corr < −0.3) | `correlation`, `n` |
206
- | `outcome_proxy_dead` | Proxy-adequacy tripwire: `outcome_score` is statistically unrelated to accepted-change rate (\|corr\| < 0.1, n ≥ 500) | `correlation`, `n` |
207
- | `collapse_detector_alert` | The collapse/churn detector trips an alert rule during an improve cycle | `kind` (collapse-recall\|collapse-entropy\|collapse-shrink\|churn\|merge-floor), `detail`, `metrics`, `canarySetId`, `runId` |
208
203
  | `events_purged` | Old events deleted by improve maintenance (90-day default retention) | `purgedCount`, `retentionDays` |
209
204
  | `improve_runs_purged` | Old `improve_runs` rows deleted by improve maintenance (same retention window as events) | `purgedCount`, `retentionDays` |
210
- | `improve_cycle_metrics_purged` | Old `improve_cycle_metrics` rows (365-day retention) deleted by improve maintenance | `purgedCount`, `retentionDays` |
211
205
  | `state_db_vacuumed` | state.db was VACUUMed after the retention purge because more than half its pages were free | `pagesBefore`, `pagesAfter`, `freelistRatioBefore` |
212
206
  | `task_logs_purged` | Old scheduled-task log files purged by improve maintenance | |
213
207
 
@@ -241,7 +235,7 @@ queryable per-run or aggregated with `akm improve report`; see
241
235
 
242
236
  ### 2. Usage Events Table
243
237
 
244
- `usage_events` is the local analytical record behind utility ranking,
238
+ `usage_events` is the local analytical record behind utility scores,
245
239
  retrieval-demand counts, GRR, and real-query eval generation (0.9.0: its CLI
246
240
  read surface, `akm history`, was removed — the table itself and everything
247
241
  below still applies). It stores
@@ -252,7 +246,7 @@ configured endpoint.
252
246
 
253
247
  Successful `search`, `curate`, and `show` commands record usage by default.
254
248
  Pass `--no-track-usage` to any of those commands to leave local usage events
255
- and ranking signals unchanged.
249
+ unchanged.
256
250
 
257
251
  Every runtime writer stamps provenance as `user`, `improve`, `task`, `audit`, or
258
252
  `unknown`. Direct interactive CLI traffic defaults to `user`; internal improve,
@@ -264,20 +258,18 @@ real-query labels.
264
258
 
265
259
  Per-entry `search`, `curate`, and `show` rows carry a local-only
266
260
  `metadata.downstreamAttribution` object. Version 1 uses `control: true` for
267
- current traffic where neither memory inference nor graph extraction applies;
268
- rows without the version marker are historical/unattributed. Attributed rows
269
- use `control: false` and may contain:
261
+ current traffic where memory inference does not apply; rows without the
262
+ version marker are historical/unattributed. Attributed rows use
263
+ `control: false` and may contain:
270
264
 
271
265
  - `memoryInference`: `direct` when the emitted ref is an inferred child, or
272
266
  `surface` when derived description/tags were actually present in the emitted
273
267
  search or selected curate output. Brief output and internally replaced
274
268
  descriptions are controls, not surface attribution.
275
- - `graphExtraction`: the positive graph-ranking contribution that was actually
276
- applied after the shared contributor cap, plus `bodyHash` and
277
- `extractionRunId` when available. It is absent when `graph-ranking` is
278
- ablated. The number is a ranking-input contribution, not proof that graph
279
- changed final rank, selection, or outcome; score saturation and competing
280
- contributors can leave ordering unchanged.
269
+ - `graphExtraction`: written only by releases that boosted search with the
270
+ graph — the graph contribution applied to the hit, plus `bodyHash` and
271
+ `extractionRunId` when available. Current releases do not rank by the graph
272
+ and never write it.
281
273
 
282
274
  Attribution metadata contains fully-qualified refs and graph identifiers, never
283
275
  asset bodies or provenance content. It is not added to `search`, `curate`, or
@@ -299,6 +291,13 @@ Contents:
299
291
  - Full proposal content (Markdown text)
300
292
  - Created/updated timestamps
301
293
 
294
+ Beside it, the `improve_ledger` table records what each improve stage last did
295
+ with each asset — one row per bundle, asset ref and stage: the outcome
296
+ (`proposed`, `accepted`, `rejected`, `quality_rejected`, `review_needed`,
297
+ `expired`, `unchanged`, `failed`, `judged_no_action`), when it was attempted,
298
+ and the earliest time the stage may try that asset again. It holds refs,
299
+ timestamps, a proposal id and a short reason — never asset content.
300
+
302
301
  ### 4. Task History Table
303
302
 
304
303
  A record of scheduled task runs (from `akm task`):
@@ -5,31 +5,43 @@ Task assets are strict, local automation sources. They live at
5
5
  launchd, or Windows Task Scheduler with `akm task sync`. The task file is
6
6
  authored source; scheduler entries are derived OS state.
7
7
 
8
- **Task source v4 (`version: 4`) is the only task source grammar this
9
- release accepts.** A document with `version: 3` or `version: 2` (or any
10
- other value) fails to load with `UsageError` code
11
- `TASK_SCHEMA_VERSION_UNSUPPORTED`, naming the migrator. Task source v4 adds
12
- typed `inputs:` and a single bounded `output:` schema (command targets
13
- only), and makes scheduling OPTIONAL rather than mandatory. `akm task add`
14
- authors task source v4 directly.
8
+ **Task source v4 (`version: 4`) is the current task source grammar.** A
9
+ document with `version: 3` or `version: 2` still reads and runs: an
10
+ in-memory shim converts it to v4 on the same bytes `akm migrate apply`
11
+ would produce, prints a one-line stderr deprecation warning (once per file
12
+ per process), and never writes anything to disk. Only a v2/v3 document the
13
+ deterministic conversion itself cannot resolve (an ambiguous shell command,
14
+ say) fails to load, with `UsageError` code `TASK_SCHEMA_VERSION_UNSUPPORTED`
15
+ naming the specific blocked reason and the human decision it needs. A
16
+ declared `version: 4` document whose `schedule[]` still carries a
17
+ per-entry `enabled` key — 0.9.15's v4 grammar accepted it, this release's
18
+ does not — reads through the same kind of in-memory shim: the key is
19
+ stripped without ever being read (activation is host-local, below) and the
20
+ same one-line deprecation warning is printed. Task source v4 adds typed
21
+ `inputs:` and a single bounded `output:` schema (command targets only), and
22
+ makes scheduling OPTIONAL rather than mandatory. `akm task add` authors
23
+ task source v4 directly.
15
24
 
16
25
  If you have `version: 3` or `version: 2` files on disk (from an earlier
17
26
  akm release), see [Migrating to task source v4](#migrating-to-task-source-v4)
18
- below — `akm migrate apply` converts both generations in one pass. The
27
+ below — `akm migrate apply` converts both generations in one pass and
28
+ rewrites the file on disk, silencing the read-time deprecation warning. The
19
29
  retired v3 grammar itself is documented at the bottom of this page
20
30
  ([Task v3 (retired): grammar reference for migration](#task-v3-retired-grammar-reference-for-migration))
21
- purely so you can read an old file while migrating it; it is not accepted
22
- by any command in this release.
31
+ purely so you can read an old file while migrating it; it is no longer
32
+ accepted as a standing grammar by any command in this release.
23
33
 
24
34
  ## Files and schema
25
35
 
26
36
  The only recognized task extension is `.yml`. A `.yaml` near miss is never
27
- indexed, scheduled, or run. Every task must declare `version: 4`; a
37
+ indexed, scheduled, or run. Every task should declare `version: 4`; a
28
38
  document with no `version:` key, or a `version:` that is not a number,
29
39
  fails with `TASK_SOURCE_INVALID` (`must be exactly 4.` / `is required and
30
40
  must be exactly 4.`) — a genuinely malformed v4 document, not a legacy one.
31
- `version: 3` and `version: 2` fail with `TASK_SCHEMA_VERSION_UNSUPPORTED`
32
- instead (see [Migrating to task source v4](#migrating-to-task-source-v4)).
41
+ `version: 3` and `version: 2` read via the in-memory deprecation shim
42
+ described above and, only when the deterministic conversion itself cannot
43
+ resolve the document, fail with `TASK_SCHEMA_VERSION_UNSUPPORTED` instead
44
+ (see [Migrating to task source v4](#migrating-to-task-source-v4)).
33
45
  The published [task schema](../../schemas/akm-task.json) describes the
34
46
  hand-authored contract; `src/tasks/source/task-source-v4.ts` is the
35
47
  authoritative bounded parser.
@@ -162,25 +174,22 @@ would. Multiple schedule entries create deterministic scheduler bindings
162
174
  for the one source task.
163
175
 
164
176
  Task source v4 has **no enablement flag**. A source describes what may run;
165
- it cannot authorize its own host scheduling. Activation is an exact,
166
- host-local allow-list in `config.json` under `scheduler.enabled`, keyed by
167
- asset kind, fully qualified ref, and the approved source installation identity.
168
- Absence means disabled. A removed, disabled, or replaced bundle cannot reuse a
169
- grant written for an earlier source under the same name. Use `akm task
170
- enable <bundle>//tasks/<id>` and `akm task disable <bundle>//tasks/<id>` to
171
- change that list and immediately sync the affected bundle. `akm task add`
172
- enables its new task by default; `--disabled` writes the same task source but
173
- does not add the local activation.
177
+ it cannot authorize its own host scheduling. Activation is this host's list of
178
+ fully-qualified refs in `config.json` under `scheduler.enabled`. A ref that
179
+ is not listed is disabled. A config with no list at all (written before
180
+ 0.9.17) means "keep what is installed": the first sync fills the list from
181
+ the akm-written native bindings. Use `akm task enable <bundle>//tasks/<id>`
182
+ and `akm task disable <bundle>//tasks/<id>` to change the list and
183
+ immediately sync the affected bundle. `akm task add` enables its new task by
184
+ default; `--disabled` writes the same task source but does not list it.
174
185
 
175
186
  `akm task run <id>` executes a task immediately, including a disabled task.
176
- `akm task sync` scans every enabled configured bundle, selects only locally
177
- activated task/workflow refs, validates the complete desired set, and then
178
- atomically reconciles scheduler state. `--bundle <name>` narrows that pass to
187
+ `akm task sync` scans every enabled configured bundle, reads only locally
188
+ activated task/workflow refs, and reconciles the native scheduler one row at a
189
+ time (see [Operations](#operations)). `--bundle <name>` narrows that pass to
179
190
  one active bundle. If every configured bundle is disabled, sync removes the
180
- attributable native entries without reading task content. Scheduled task
181
- invocations check both the local activation and current source identity again at
182
- fire time before re-reading the guarded current task bytes; workflow targets
183
- then create a fresh durable workflow freeze.
191
+ attributable native entries without reading task content. Workflow targets
192
+ create a fresh durable workflow freeze at fire time.
184
193
 
185
194
  ## Typed inputs and output
186
195
 
@@ -405,21 +414,45 @@ for full before/after examples and recovery guidance.
405
414
  anything — see [`akm task explain`](#akm-task-explain) above.
406
415
  - `akm task validate <path>` parses one task file by filesystem path (the
407
416
  file need not live in a configured bundle) and reports the same
408
- `valid`/`blocked`/`invalid`/`not-a-task` diagnostic
417
+ `valid`/`converts`/`blocked`/`invalid`/`not-a-task` diagnostic
409
418
  `akm task sync` would produce for it — including sync's own cron-dialect
410
419
  check and its per-schedule-entry input-contract check — without touching
411
420
  the scheduler and without requiring a configured engine, even for a
412
421
  command-kind task. The envelope's own `sourceVersion` field names the
413
- file's declared schema version. Version 2/3 files are `blocked` with an
414
- `akm migrate apply` instruction; validation never migrates them in memory.
415
- - `akm task add` writes a task source v4 document and installs it after
416
- validation. `--params` renders typed `inputs:` declarations instead of a
417
- `with:` bag; `--schedule` is required on every invocation. `--disabled`
418
- leaves the new ref absent from local scheduler activation.
422
+ file's declared schema version. A version 2/3 file the in-memory shim
423
+ converts reports `converts` (exit 0); one the shim's deterministic
424
+ planner cannot resolve reports `blocked` (exit 1) naming the human
425
+ decision it needs. A `version: 4` file whose only defect is a retired
426
+ `schedule[].enabled` also reports `converts` (`sourceVersion` still `4`)
427
+ — it read through the shim too, not the direct v4 path.
428
+ - `akm task add` validates a task source v4 document, writes it, adds its ref
429
+ to local scheduler activation, and syncs its bundle. `--params` renders
430
+ typed `inputs:` declarations instead of a `with:` bag; `--schedule` is
431
+ required on every invocation. `--disabled` writes the same source but
432
+ leaves the ref out of activation. `--force` overwrites an existing task of
433
+ the same id; without it add refuses. Add also refuses, before writing
434
+ anything, when the id is already scheduled from another bundle or
435
+ installation. If the row itself cannot be installed, add fails and says so;
436
+ the task stays written and enabled, and the next `akm task sync` retries it.
419
437
  - `akm task history` reads durable run history from `state.db`.
420
438
  - `akm task enable <ref>` / `akm task disable <ref>` change only local
421
439
  scheduler config, then reconcile that bundle.
422
440
  - Delete the `.yml` source and sync to remove its derived binding(s).
441
+ - `akm task sync` reads the installed rows once, compares each against what
442
+ its source renders, and installs, rewrites, or removes rows one at a time.
443
+ A row that fails to install or remove is reported in `failures` and every
444
+ other row still applies. A source that fails to parse is reported the same
445
+ way, and its installed row is left exactly as it is. Rows akm cannot attribute to a bundle this sync covers —
446
+ another bundle's, another installation's (the row's own descriptor names a
447
+ different bundle path), or anything outside akm's `# akm:task` markers,
448
+ `com.akm.task.` labels, or `\akm\` task folder — are never touched. A
449
+ Task Scheduler row is compared by the fingerprint akm writes into its
450
+ `<Source>` plus its enabled state, so an edit made in Task Scheduler that
451
+ keeps that fingerprint is left alone.
452
+ - `akm task sync`, `add`, `enable`, `disable`, and `prune --yes` hold one lock
453
+ file, `$STATE/locks/scheduler.lock`, while they read and write the native
454
+ scheduler. A second one started meanwhile exits 75 (retry shortly); a lock
455
+ left by a process that is no longer running is reclaimed.
423
456
  - `akm task sync --dry-run` previews the reconcile (adds/updates/removes,
424
457
  removals annotated with their owning bundle) without writing to the
425
458
  scheduler; exits non-zero when removals are pending.
@@ -430,8 +463,23 @@ for full before/after examples and recovery guidance.
430
463
  Defaults to a dry-run preview (zero writes); `--yes` executes it; `--id
431
464
  <id1,id2,...>` scopes to specific ids and refuses any id that isn't a
432
465
  current orphan candidate.
433
- - Use `akm task sync --rebind` only when deliberately changing the captured
434
- AKM runtime, then verify with `akm task doctor`.
466
+ - A plain sync keeps each installed row's launcher. Use
467
+ `akm task sync --rebind` only when deliberately changing the captured AKM
468
+ runtime, then verify with `akm task doctor`. When the launcher sync writes
469
+ runs akm from a source checkout (`src/cli.ts`, a local build, or a package
470
+ inside a git work tree), sync says so once: scheduled runs then run
471
+ whatever the checkout holds.
472
+ - `akm task sync` writes one `PATH=` line inside a `# akm:env BEGIN`/`END`
473
+ section directly above the first akm task block in the crontab (on macOS,
474
+ an `EnvironmentVariables` entry in each plist). It is the PATH of the shell
475
+ that ran the sync, rewritten on every crontab write and removed with the
476
+ last akm block; cron applies it to every row below it. The
477
+ `--scheduler-context` descriptor a row references holds directories only:
478
+ the bundle path, plus any `AKM_CONFIG_DIR`, `AKM_DATA_DIR`, `AKM_CACHE_DIR`
479
+ or `AKM_STATE_DIR` that shell had set explicitly. Defaults resolve at fire
480
+ time, so a scheduled run uses the same state, data and cache directories an
481
+ interactive command does. Run the sync from a shell whose environment you
482
+ would want scheduled.
435
483
 
436
484
  Scheduler execution is at least once. Backends provide a stable invocation
437
485
  identity and AKM fences stale attempts, but an ambiguous process crash can be
@@ -188,8 +188,8 @@ child is re-read at dispatch time. Concretely:
188
188
  workflow depends on.
189
189
 
190
190
  See [Architecture: The Workflow Engine](https://github.com/itlackey/akm/blob/main/docs/architecture/workflow-engine.md#child-workflows)
191
- for the embedded-plan integrity chain (`irVersion`, `planHash`,
192
- `contentHash`) and why a tampered embedded child plan fails to decode.
191
+ for how an embedded child plan is decoded (`irVersion`, `planHash`, and
192
+ `contentHash` are recorded provenance, not re-verified).
193
193
 
194
194
  ### Composition limits
195
195
 
@@ -217,9 +217,9 @@ run and drives it to completion, or as far as it gets, before the parent
217
217
  step is finalized. The drive happens **inline, in the parent's own
218
218
  process**: it is the same engine `akm workflow run` uses on the child's
219
219
  frozen plan, not a separately scheduled job. Consequently, whatever aborts
220
- the parent's own dispatch — `Ctrl-C`, a `--timeout`, a budget ceiling, or
221
- the parent losing its run lease — also aborts the child drive; both runs
222
- are left resumable, never partially torn down.
220
+ the parent's own dispatch — `Ctrl-C`, a `--timeout`, or a budget ceiling —
221
+ also aborts the child drive; both runs are left resumable, never partially
222
+ torn down.
223
223
 
224
224
  The child's final status maps onto the composing step and the parent run:
225
225
 
@@ -228,9 +228,9 @@ The child's final status maps onto the composing step and the parent run:
228
228
  | `completed` | completes; its output is the child's exported result — its declared `outputs:` (see [What a step's output is](#what-a-steps-output-is)), or `{runId, status}` when the child declares none | continues |
229
229
  | `failed` | `failed` | `failed` |
230
230
  | `blocked` | `blocked` | `blocked` |
231
- | aborted mid-drive (parent cancelled/timed out/lost its lease) | left unfinished, not finalized | active and resumable |
232
- | the child could not be published or its plan failed an integrity re-check | `failed` | `failed` |
233
- | another process already holds the child's run lease | `failed` | `failed` |
231
+ | aborted mid-drive (parent cancelled/timed out) | left unfinished, not finalized | active and resumable |
232
+ | the child could not be published (its params do not satisfy the child's declared `params:`) | `failed` | `failed` |
233
+ | another process already holds the child's run lock | `failed` | `failed` |
234
234
 
235
235
  **Blocked-child recovery.** A blocked child blocks its composing step —
236
236
  `akm` does not resume a child for you, because a gate is a gate for a
@@ -531,12 +531,8 @@ unknown step, unknown param, bad path — at lint time.
531
531
  ### Params are not secret
532
532
 
533
533
  Run params are copied verbatim into every unit's dispatched instructions and
534
- are part of the unit's content-derived input hash — the same hash that makes
535
- resume-without-replay possible (see
536
- [Resume is journaled replay](https://github.com/itlackey/akm/blob/main/docs/architecture/workflow-engine.md#resume-is-journaled-replay)).
537
- Redacting a param would change what gets hashed and make a resumed run
538
- diverge from the original, so params are **declared non-secret and
539
- un-redactable** by design: secrets belong in `env:` refs instead, which carry
534
+ are stored on the run row and shown by `akm workflow status`, so params are
535
+ **declared non-secret**: secrets belong in `env:` refs instead, which carry
540
536
  by name only through the plan and are resolved from akm's env/secret store
541
537
  at dispatch (see [Reference: Env & Secrets](https://github.com/itlackey/akm/blob/main/docs/reference/env-and-secrets.md)).
542
538
 
@@ -545,7 +541,9 @@ values that *look* like credentials — secret-suggesting key names (`token`,
545
541
  `password`, `apikey`, `credential`, …) or long, high-entropy strings matching
546
542
  known token prefixes — and surfaces a warning naming the param path and
547
543
  recommending an `env:` ref instead. This is advisory only: it never blocks a
548
- run and never mutates params, and false positives/negatives are expected.
544
+ run and never mutates params, and false positives/negatives are expected. The
545
+ same heuristic feeds the dispatch redaction set, so a unit result or
546
+ diagnostic that echoes such a value is scrubbed before it is journaled.
549
547
 
550
548
  ## What a step's output is
551
549
 
@@ -1053,9 +1051,7 @@ request for whole-process inheritance; use exact named environment bindings
1053
1051
  and `pass_env:` instead. Both mechanisms are dispatch-significant, keep the
1054
1052
  visible environment surface bounded, and form part of the unit's input hash.
1055
1053
 
1056
- The historical `inherit_env` spelling is unsupported. Pre-`irVersion`-5 stored
1057
- plans are rejected; they are never upgraded or replayed through a second
1058
- runtime.
1054
+ The historical `inherit_env` spelling is unsupported.
1059
1055
 
1060
1056
  ### What `akm show` reports for an exec step
1061
1057
 
@@ -46,14 +46,11 @@ artifacts, and exec vocabulary. The YAML adapter accepts the documented local
46
46
  `name`/`on`/`jobs` subset. `.yaml` is not a workflow source.
47
47
 
48
48
  Both adapters produce strict source IR version 1. New starts resolve source
49
- owners and executable targets, then freeze durable plan `irVersion` 5. Only
50
- the current `irVersion` executes: a run frozen at an older version keeps
51
- `status`, `list`, and `abandon` working, but `resume`/`next`/`complete`/`run`
52
- fail closed — abandon it and start a new run from current source. See
53
- [Architecture: The Workflow Engine](https://github.com/itlackey/akm/blob/main/docs/architecture/workflow-engine.md#resume-is-journaled-replay)
54
- for the exact policy and
55
- [Migrating from akm 0.9.1 to 0.9.2](https://github.com/itlackey/akm/blob/main/docs/migration/v0.9.1-to-v0.9.2.md#workflow-cutover)
56
- if you are upgrading with runs in flight.
49
+ owners and executable targets, then freeze durable plan `irVersion` 5. A
50
+ stored plan is read back as it is: one frozen at another `irVersion` that
51
+ still decodes runs, and one this akm cannot decode is abandoned by
52
+ `akm workflow run` with a message naming how to start a new run. See
53
+ [Architecture: The Workflow Engine](https://github.com/itlackey/akm/blob/main/docs/architecture/workflow-engine.md#resume-skips-completed-units).
57
54
 
58
55
  A step can compose another workflow as a child — directly
59
56
  (`uses: workflows/<ref>`) or through a task whose own target is a workflow
@@ -121,7 +118,7 @@ service events, and runners; none of those capabilities is implied by 0.9.2.
121
118
  - [Capture Knowledge](https://github.com/itlackey/akm/blob/main/docs/guides/capture-knowledge.md) — turn a workflow run's
122
119
  outputs into searchable memories
123
120
  - [Improve the Library](https://github.com/itlackey/akm/blob/main/docs/guides/improve-the-library.md) — feed run outcomes
124
- back into a workflow asset's ranking and proposed edits
121
+ back into a workflow asset's utility score and proposed edits
125
122
  - [Concepts](https://github.com/itlackey/akm/blob/main/docs/guides/concepts.md) — the workflow asset type and run-state
126
123
  storage in the broader AKM model
127
124
  - [CLI Reference](cli.md) — full flag documentation for all `workflow`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-cli",
3
- "version": "0.9.17-alpha.3",
3
+ "version": "0.9.17-alpha.4",
4
4
  "type": "module",
5
5
  "description": "akm (Agent Knowledge Manager) — a portable, local-first capability library for AI agents. Discover, load, share, and improve reusable skills, scripts, workflows, and knowledge across any shell-capable coding agent, including Claude Code, OpenCode, and Cursor.",
6
6
  "keywords": [