akm-cli 0.9.16 → 0.9.17-alpha.10

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 (403) hide show
  1. package/CHANGELOG.md +2101 -0
  2. package/STABILITY.md +11 -10
  3. package/dist/akm +124 -193
  4. package/dist/akm-migrate +38 -19
  5. package/dist/assets/hints/cli-hints-full.md +6 -7
  6. package/dist/assets/improve-strategies/catchup.json +0 -3
  7. package/dist/assets/improve-strategies/consolidate.json +0 -1
  8. package/dist/assets/improve-strategies/default.json +1 -2
  9. package/dist/assets/improve-strategies/proactive-maintenance.json +1 -2
  10. package/dist/assets/improve-strategies/quick.json +1 -2
  11. package/dist/assets/improve-strategies/reflect-distill.json +1 -2
  12. package/dist/assets/improve-strategies/thorough.json +0 -3
  13. package/dist/assets/prompts/consolidate-pair.md +20 -0
  14. package/dist/assets/prompts/consolidate-system.md +4 -11
  15. package/dist/assets/prompts/retrieval-relevance-judge.md +6 -0
  16. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +20 -20
  17. package/dist/assets/stash-skeleton/facts/conventions/domains.md +2 -2
  18. package/dist/assets/templates/html/health.html +3 -5
  19. package/dist/cli/retired-commands.js +1 -1
  20. package/dist/cli/shared.js +6 -2
  21. package/dist/cli/unknown-flags.js +24 -1
  22. package/dist/cli.js +68 -10
  23. package/dist/commands/agent/agent-dispatch.js +1 -1
  24. package/dist/commands/command/command-execution.js +24 -62
  25. package/dist/commands/feedback-cli.js +0 -1
  26. package/dist/commands/health/accept-rate.js +6 -0
  27. package/dist/commands/health/archive-usage.js +92 -0
  28. package/dist/commands/health/checks.js +83 -74
  29. package/dist/commands/health/config-skew.js +38 -0
  30. package/dist/commands/health/data-dir-usage.js +25 -13
  31. package/dist/commands/health/egress.js +54 -0
  32. package/dist/commands/health/html-report.js +1 -42
  33. package/dist/commands/health/improve-metrics.js +136 -591
  34. package/dist/commands/health/md-report.js +1 -6
  35. package/dist/commands/health/plugin-staleness.js +53 -3
  36. package/dist/commands/health/renderers.js +12 -4
  37. package/dist/commands/health/report-view-model.js +14 -120
  38. package/dist/commands/health/types-improve.js +4 -19
  39. package/dist/commands/health/windows.js +64 -74
  40. package/dist/commands/health.js +145 -143
  41. package/dist/commands/improve/consolidate/chunking.js +26 -117
  42. package/dist/commands/improve/consolidate/continuity-check.js +137 -0
  43. package/dist/commands/improve/consolidate/pair-pass.js +791 -0
  44. package/dist/commands/improve/consolidate/sanitize.js +54 -149
  45. package/dist/commands/improve/consolidate.js +589 -1127
  46. package/dist/commands/improve/content-hash.js +16 -24
  47. package/dist/commands/improve/distill/content-repair.js +18 -100
  48. package/dist/commands/improve/distill-guards.js +20 -81
  49. package/dist/commands/improve/distill-promotion-policy.js +23 -243
  50. package/dist/commands/improve/distill.js +608 -1041
  51. package/dist/commands/improve/eligibility.js +126 -390
  52. package/dist/commands/improve/execution.js +8 -10
  53. package/dist/commands/improve/extract-prompt.js +1 -2
  54. package/dist/commands/improve/extract.js +487 -1046
  55. package/dist/commands/improve/feedback-valence.js +0 -25
  56. package/dist/commands/improve/improve-cli.js +75 -169
  57. package/dist/commands/improve/improve-result-file.js +10 -66
  58. package/dist/commands/improve/improve-strategies.js +52 -4
  59. package/dist/commands/improve/improve-usage-report.js +18 -64
  60. package/dist/commands/improve/improve.js +480 -1074
  61. package/dist/commands/improve/ledger.js +119 -0
  62. package/dist/commands/improve/locks.js +2 -8
  63. package/dist/commands/improve/loop-stages.js +415 -1073
  64. package/dist/commands/improve/memory/derived-ref.js +12 -77
  65. package/dist/commands/improve/memory/memory-belief.js +16 -118
  66. package/dist/commands/improve/memory/memory-improve.js +266 -14
  67. package/dist/commands/improve/outcome-loop.js +28 -156
  68. package/dist/commands/improve/planner.js +5 -15
  69. package/dist/commands/improve/preparation.js +779 -2319
  70. package/dist/commands/improve/proactive-maintenance.js +34 -101
  71. package/dist/commands/improve/reflect-noise.js +104 -280
  72. package/dist/commands/improve/reflect.js +642 -1353
  73. package/dist/commands/improve/retrieval-gate.js +127 -0
  74. package/dist/commands/improve/retrieval-scope.js +92 -0
  75. package/dist/commands/improve/salience.js +41 -240
  76. package/dist/commands/improve/session-asset.js +19 -100
  77. package/dist/commands/improve/stage.js +322 -0
  78. package/dist/commands/lint/base-linter.js +37 -15
  79. package/dist/commands/proposal/drain.js +261 -578
  80. package/dist/commands/proposal/proposal-cli.js +19 -20
  81. package/dist/commands/proposal/proposal-types.js +31 -24
  82. package/dist/commands/proposal/proposal.js +38 -8
  83. package/dist/commands/proposal/propose.js +134 -160
  84. package/dist/commands/proposal/repository.js +1097 -1394
  85. package/dist/commands/proposal/validators/proposal-quality-validators.js +71 -174
  86. package/dist/commands/proposal/validators/proposal-validators.js +1 -1
  87. package/dist/commands/proposal/validators/proposals.js +22 -89
  88. package/dist/commands/read/curate.js +105 -462
  89. package/dist/commands/read/knowledge.js +3 -2
  90. package/dist/commands/read/search-cli.js +16 -33
  91. package/dist/commands/read/search.js +17 -23
  92. package/dist/commands/read/show.js +57 -108
  93. package/dist/commands/sources/bundle-cli.js +25 -2
  94. package/dist/commands/sources/bundle-config-ops.js +4 -0
  95. package/dist/commands/sources/dangerous-env-audit.js +1 -2
  96. package/dist/commands/sources/info.js +127 -29
  97. package/dist/commands/sources/installed-stashes.js +197 -746
  98. package/dist/commands/sources/schema-repair.js +98 -129
  99. package/dist/commands/sources/source-add.js +62 -12
  100. package/dist/commands/sources/source-manage.js +9 -2
  101. package/dist/commands/sources/stash-cli.js +24 -4
  102. package/dist/commands/tasks/explain.js +10 -13
  103. package/dist/commands/tasks/tasks-cli.js +12 -13
  104. package/dist/commands/tasks/tasks.js +350 -936
  105. package/dist/commands/tasks/validate.js +26 -24
  106. package/dist/commands/workflow/plan.js +22 -29
  107. package/dist/commands/workflow-cli.js +4 -4
  108. package/dist/core/adapter/adapters/akm-adapter.js +2 -1
  109. package/dist/core/adapter/adapters/akm-lint.js +2 -3
  110. package/dist/core/adapter/adapters/akm-metadata.js +42 -12
  111. package/dist/core/adapter/adapters/akm-task-adapter.js +29 -8
  112. package/dist/core/adapter/adapters/akm-workflow-adapter.js +1 -1
  113. package/dist/core/adapter/execution-source.js +17 -29
  114. package/dist/core/asset/asset-placement.js +4 -13
  115. package/dist/core/asset/frontmatter.js +106 -1
  116. package/dist/core/asset/resolve-ref.js +1 -1
  117. package/dist/core/bundle-id.js +42 -5
  118. package/dist/core/bundle-rename.js +285 -0
  119. package/dist/core/config/config-io.js +1 -2
  120. package/dist/core/config/config-schema.js +9 -34
  121. package/dist/core/config/config-walker.js +1 -1
  122. package/dist/core/config/config.js +184 -111
  123. package/dist/core/config/engine-semantics.js +0 -2
  124. package/dist/core/config/legacy-source-shape-shim.js +38 -9
  125. package/dist/core/config/schema/embedding.js +20 -5
  126. package/dist/core/config/schema/engines.js +5 -0
  127. package/dist/core/config/schema/execution.js +1 -1
  128. package/dist/core/config/schema/experimental.js +1 -1
  129. package/dist/core/config/schema/improve-processes.js +54 -125
  130. package/dist/core/config/schema/improve.js +4 -42
  131. package/dist/core/config/schema/index-config.js +9 -48
  132. package/dist/core/config/schema/scheduler.js +12 -12
  133. package/dist/core/config/schema/search.js +6 -22
  134. package/dist/core/env-secret-ref.js +0 -1
  135. package/dist/core/errors.js +8 -9
  136. package/dist/core/file-change.js +13 -5
  137. package/dist/core/file-lock.js +76 -173
  138. package/dist/core/improve-result.js +35 -7
  139. package/dist/core/improve-types.js +0 -1
  140. package/dist/core/logs-db.js +2 -2
  141. package/dist/core/loopback.js +7 -12
  142. package/dist/core/non-task-input.js +20 -0
  143. package/dist/core/parse.js +13 -16
  144. package/dist/core/paths.js +0 -24
  145. package/dist/core/redaction.js +109 -2
  146. package/dist/core/run-lock.js +2 -5
  147. package/dist/core/spawn-env.js +1 -1
  148. package/dist/core/state/migrations.js +123 -61
  149. package/dist/core/state-db-scope.js +2 -4
  150. package/dist/core/state-db.js +126 -692
  151. package/dist/core/time.js +0 -20
  152. package/dist/core/type-presentation.js +1 -9
  153. package/dist/core/write-source.js +294 -1005
  154. package/dist/execution/input-contract.js +1 -1
  155. package/dist/execution/resolved-request.js +135 -689
  156. package/dist/execution/source.js +63 -257
  157. package/dist/execution/target-ref.js +1 -1
  158. package/dist/indexer/bundle-identity-guard.js +2 -2
  159. package/dist/indexer/db/llm-cache.js +2 -2
  160. package/dist/indexer/ensure-index.js +77 -73
  161. package/dist/indexer/index-rebuild-lock.js +3 -11
  162. package/dist/indexer/index-writer-lock.js +8 -17
  163. package/dist/indexer/index-written-assets.js +141 -154
  164. package/dist/indexer/indexer.js +400 -1124
  165. package/dist/indexer/links/declared-links.js +90 -0
  166. package/dist/indexer/materialize-embeddings.js +60 -397
  167. package/dist/indexer/passes/memory-inference.js +96 -90
  168. package/dist/indexer/passes/metadata.js +132 -219
  169. package/dist/indexer/read-preflight.js +0 -7
  170. package/dist/indexer/scan/doc-to-entry.js +2 -3
  171. package/dist/indexer/scan/drain-dir.js +1 -1
  172. package/dist/indexer/search/db-search.js +190 -590
  173. package/dist/indexer/search/fts-query.js +30 -41
  174. package/dist/indexer/search/ranking.js +28 -154
  175. package/dist/indexer/search/search-attribution.js +12 -32
  176. package/dist/indexer/search/search-fields.js +11 -15
  177. package/dist/indexer/search/search-hit-enrichers.js +54 -85
  178. package/dist/indexer/search/search-source.js +1 -4
  179. package/dist/indexer/usage/usage-events.js +36 -7
  180. package/dist/indexer/walk/walker.js +3 -4
  181. package/dist/integrations/agent/engine-fallback.js +23 -40
  182. package/dist/integrations/agent/engine-resolution.js +93 -183
  183. package/dist/integrations/agent/execution.js +507 -0
  184. package/dist/integrations/agent/model-map.js +28 -156
  185. package/dist/integrations/agent/request-lowering.js +66 -141
  186. package/dist/integrations/agent/runner-dispatch.js +143 -321
  187. package/dist/integrations/agent/runner.js +54 -14
  188. package/dist/integrations/lockfile.js +53 -101
  189. package/dist/llm/client.js +18 -6
  190. package/dist/llm/embedders/deterministic.js +2 -3
  191. package/dist/llm/embedders/profile.js +71 -0
  192. package/dist/llm/embedders/remote.js +11 -17
  193. package/dist/llm/feature-gate.js +0 -8
  194. package/dist/llm/index-passes.js +3 -5
  195. package/dist/llm/memory-infer.js +1 -2
  196. package/dist/llm/structured-call.js +5 -24
  197. package/dist/output/generic-render.js +23 -11
  198. package/dist/output/html-render.js +13 -10
  199. package/dist/output/render-registry.js +3 -32
  200. package/dist/output/shapes/helpers.js +25 -38
  201. package/dist/output/shapes/passthrough.js +1 -9
  202. package/dist/{indexer/graph/graph-types.js → output/text/bundle-rename.js} +4 -1
  203. package/dist/output/text/command-format.js +69 -31
  204. package/dist/output/text/helpers.js +1 -1
  205. package/dist/output/text/migrate.js +5 -14
  206. package/dist/output/text/proposal-format.js +48 -3
  207. package/dist/output/text/show-format.js +13 -17
  208. package/dist/output/text/workflow-format.js +0 -32
  209. package/dist/output/text.js +2 -0
  210. package/dist/registry/factory.js +4 -19
  211. package/dist/registry/network.js +66 -220
  212. package/dist/registry/providers/index.js +0 -2
  213. package/dist/registry/providers/skills-sh.js +3 -14
  214. package/dist/registry/providers/static-index.js +24 -26
  215. package/dist/registry/resolve.js +55 -131
  216. package/dist/scripts/akm-migrate-node.js +42948 -92369
  217. package/dist/scripts/akm-migrate.js +42935 -92354
  218. package/dist/setup/registry-stash-loader.js +4 -13
  219. package/dist/setup/semantic-assets.js +3 -44
  220. package/dist/setup/setup.js +1 -1
  221. package/dist/setup/steps/connection.js +5 -6
  222. package/dist/setup/steps/platforms.js +2 -2
  223. package/dist/setup/steps/tasks.js +25 -15
  224. package/dist/sources/provider-factory.js +17 -18
  225. package/dist/sources/providers/filesystem.js +2 -3
  226. package/dist/sources/providers/git-install.js +7 -1
  227. package/dist/sources/providers/git-provider.js +0 -3
  228. package/dist/sources/providers/git-stash.js +83 -21
  229. package/dist/sources/providers/npm.js +2 -4
  230. package/dist/sources/providers/provider-utils.js +5 -10
  231. package/dist/sources/providers/website.js +0 -2
  232. package/dist/sources/snapshot-fetchers/website-ingest.js +1 -1
  233. package/dist/sources/website-url.js +2 -2
  234. package/dist/storage/database.js +9 -35
  235. package/dist/storage/repositories/improve-ledger-repository.js +209 -0
  236. package/dist/storage/repositories/index-connection.js +39 -72
  237. package/dist/storage/repositories/index-entries-repository.js +131 -129
  238. package/dist/storage/repositories/index-entry-mapper.js +1 -2
  239. package/dist/storage/repositories/index-entry-schema.js +101 -268
  240. package/dist/storage/repositories/index-fts-repository.js +86 -256
  241. package/dist/storage/repositories/index-links-repository.js +143 -0
  242. package/dist/storage/repositories/index-llm-cache-repository.js +7 -9
  243. package/dist/storage/repositories/index-meta-repository.js +6 -4
  244. package/dist/storage/repositories/index-schema.js +257 -325
  245. package/dist/storage/repositories/index-utility-repository.js +8 -29
  246. package/dist/storage/repositories/index-vec-repository.js +133 -414
  247. package/dist/storage/repositories/outcome-repository.js +2 -1
  248. package/dist/storage/repositories/proposals-repository.js +104 -1
  249. package/dist/storage/repositories/registry-index-cache-repository.js +100 -0
  250. package/dist/storage/repositories/salience-repository.js +1 -19
  251. package/dist/storage/repositories/task-history-repository.js +26 -4
  252. package/dist/storage/repositories/workflow-runs-repository.js +53 -244
  253. package/dist/storage/sqlite-migrations.js +136 -0
  254. package/dist/storage/sqlite-pragmas.js +11 -9
  255. package/dist/storage/sqlite-transaction.js +170 -0
  256. package/dist/storage/state-db-integrity.js +130 -0
  257. package/dist/tasks/activation-config.js +134 -62
  258. package/dist/tasks/backends/cron.js +191 -302
  259. package/dist/tasks/backends/exec-utils.js +2 -5
  260. package/dist/tasks/backends/launchd.js +141 -748
  261. package/dist/tasks/backends/schtasks.js +119 -623
  262. package/dist/tasks/prepare/prepare-support.js +5 -15
  263. package/dist/tasks/prepare/prepare.js +0 -2
  264. package/dist/tasks/resolve-akm-bin.js +20 -79
  265. package/dist/tasks/run/attempt-lifecycle.js +0 -1
  266. package/dist/tasks/run/load-task.js +1 -1
  267. package/dist/tasks/scheduler-binding.js +20 -238
  268. package/dist/tasks/scheduler-invocation.js +136 -244
  269. package/dist/tasks/scheduler-lock.js +53 -0
  270. package/dist/tasks/scheduler-sync.js +368 -679
  271. package/dist/tasks/source/parse-task-source.js +55 -9
  272. package/dist/tasks/source/task-source-v3-frozen.js +3 -4
  273. package/dist/tasks/source/task-to-v4.js +464 -88
  274. package/dist/workflows/authoring/authoring.js +3 -12
  275. package/dist/workflows/compile.js +211 -0
  276. package/dist/workflows/concurrency-policy.js +13 -74
  277. package/dist/workflows/exec/child-invocation.js +3 -17
  278. package/dist/workflows/exec/child-workflow.js +32 -141
  279. package/dist/workflows/exec/dispatch-redaction.js +13 -53
  280. package/dist/workflows/exec/environment.js +98 -0
  281. package/dist/workflows/exec/exec-unit.js +33 -140
  282. package/dist/workflows/exec/frozen-judge.js +7 -59
  283. package/dist/workflows/exec/native-executor.js +82 -341
  284. package/dist/workflows/exec/param-secrets.js +29 -47
  285. package/dist/workflows/exec/run-workflow.js +154 -387
  286. package/dist/workflows/exec/scheduler.js +9 -36
  287. package/dist/workflows/exec/step-work.js +127 -430
  288. package/dist/workflows/exec/unit-dispatch.js +11 -63
  289. package/dist/workflows/exec/unit-writer.js +8 -52
  290. package/dist/workflows/exec/worktree.js +39 -273
  291. package/dist/workflows/freeze/child-output-references.js +4 -15
  292. package/dist/workflows/freeze/environment.js +99 -92
  293. package/dist/workflows/freeze/freeze.js +172 -0
  294. package/dist/workflows/freeze/step-values.js +19 -21
  295. package/dist/workflows/freeze/targets/child-workflow.js +23 -92
  296. package/dist/workflows/freeze/targets/command.js +10 -33
  297. package/dist/workflows/freeze/targets/script.js +5 -12
  298. package/dist/workflows/freeze/targets/shell.js +3 -6
  299. package/dist/workflows/freeze/targets/task.js +25 -80
  300. package/dist/workflows/freeze/task-bindings.js +20 -67
  301. package/dist/workflows/{source-ir/github-yaml.js → github-yaml.js} +88 -206
  302. package/dist/workflows/ir/params.js +6 -51
  303. package/dist/workflows/ir/plan-hash.js +2 -34
  304. package/dist/workflows/parser.js +140 -43
  305. package/dist/{commands/improve/consolidate/types.js → workflows/plan.js} +2 -1
  306. package/dist/workflows/renderer.js +36 -69
  307. package/dist/workflows/resource-limits.js +12 -120
  308. package/dist/workflows/runtime/agent-identity.js +8 -40
  309. package/dist/workflows/runtime/run-outputs.js +3 -6
  310. package/dist/workflows/runtime/run-plan.js +316 -0
  311. package/dist/workflows/runtime/runs.js +48 -200
  312. package/dist/workflows/runtime/workflow-asset-loader.js +24 -57
  313. package/dist/workflows/{source-ir/semantics.js → source-semantics.js} +16 -20
  314. package/dist/workflows/validate-summary.js +2 -7
  315. package/docs/integration/bundling-akm.md +49 -42
  316. package/docs/migration/README.md +1 -0
  317. package/docs/migration/release-notes/0.9.17.md +43 -0
  318. package/docs/migration/v0.9.1-to-v0.9.2.md +23 -7
  319. package/docs/reference/cli.md +232 -135
  320. package/docs/reference/configuration.md +71 -57
  321. package/docs/reference/data-and-telemetry.md +20 -21
  322. package/docs/reference/tasks.md +105 -39
  323. package/docs/reference/workflow-schema.md +14 -18
  324. package/docs/reference/workflows.md +6 -9
  325. package/package.json +1 -1
  326. package/schemas/akm-config.json +115 -738
  327. package/schemas/akm-workflow.json +1 -0
  328. package/dist/assets/improve-strategies/graph-refresh.json +0 -15
  329. package/dist/assets/prompts/contradiction-judge.md +0 -33
  330. package/dist/assets/prompts/graph-extract-system.md +0 -1
  331. package/dist/assets/prompts/graph-extract-user-prompt.md +0 -35
  332. package/dist/assets/prompts/metadata-enhance-system.md +0 -1
  333. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +0 -4
  334. package/dist/commands/health/advisories.js +0 -150
  335. package/dist/commands/health/metrics.js +0 -329
  336. package/dist/commands/health/surfaces.js +0 -102
  337. package/dist/commands/improve/anti-collapse.js +0 -83
  338. package/dist/commands/improve/collapse-detector.js +0 -432
  339. package/dist/commands/improve/consolidate/eligibility.js +0 -48
  340. package/dist/commands/improve/consolidate/merge.js +0 -149
  341. package/dist/commands/improve/distill/promote-memory.js +0 -291
  342. package/dist/commands/improve/distill/quality-gate.js +0 -337
  343. package/dist/commands/improve/eval-cases.js +0 -52
  344. package/dist/commands/improve/memory/memory-contradiction-detect.js +0 -291
  345. package/dist/commands/improve/proposal-envelope.js +0 -31
  346. package/dist/commands/improve/run-context.js +0 -123
  347. package/dist/commands/improve/shared.js +0 -31
  348. package/dist/commands/improve/source-identity.js +0 -28
  349. package/dist/commands/improve/triage.js +0 -96
  350. package/dist/commands/proposal/drain-policies.js +0 -151
  351. package/dist/commands/sources/update-transaction.js +0 -220
  352. package/dist/core/action-contributors.js +0 -28
  353. package/dist/core/config/config-version-shim.js +0 -101
  354. package/dist/core/fs-txn.js +0 -405
  355. package/dist/core/lexical-score.js +0 -25
  356. package/dist/core/maintenance-barrier.js +0 -167
  357. package/dist/execution/executable-identity.js +0 -105
  358. package/dist/execution/guarded-source.js +0 -427
  359. package/dist/indexer/db/graph-db.js +0 -444
  360. package/dist/indexer/graph/graph-boost.js +0 -427
  361. package/dist/indexer/graph/graph-dedup.js +0 -95
  362. package/dist/indexer/graph/graph-extraction.js +0 -1108
  363. package/dist/indexer/search/name-match.js +0 -35
  364. package/dist/indexer/search/ranking-contributors.js +0 -515
  365. package/dist/indexer/search/ranking-types.js +0 -4
  366. package/dist/indexer/walk/project-context.js +0 -192
  367. package/dist/integrations/agent/execution-cascade.js +0 -566
  368. package/dist/integrations/agent/execution-definitions.js +0 -202
  369. package/dist/integrations/agent/execution-lowering.js +0 -841
  370. package/dist/integrations/agent/execution-preparation.js +0 -98
  371. package/dist/integrations/agent/inline-execution.js +0 -74
  372. package/dist/llm/graph-extract.js +0 -728
  373. package/dist/llm/metadata-enhance.js +0 -96
  374. package/dist/registry/create-provider-registry.js +0 -29
  375. package/dist/registry/pinned-request-helper.js +0 -247
  376. package/dist/registry/pinned-transport.js +0 -717
  377. package/dist/sources/providers/index.js +0 -14
  378. package/dist/storage/engines/sqlite-migrations.js +0 -271
  379. package/dist/storage/repositories/canaries-repository.js +0 -107
  380. package/dist/storage/repositories/embedding-salvage-repository.js +0 -184
  381. package/dist/storage/repositories/registry-cache.js +0 -113
  382. package/dist/tasks/scheduler-sync-preview.js +0 -52
  383. package/dist/tasks/source/task-to-v3.js +0 -507
  384. package/dist/workflows/freeze/resolve-steps.js +0 -86
  385. package/dist/workflows/freeze/source-freeze.js +0 -64
  386. package/dist/workflows/ir/compile.js +0 -321
  387. package/dist/workflows/ir/environment-v4.js +0 -330
  388. package/dist/workflows/ir/freeze-v4.js +0 -153
  389. package/dist/workflows/ir/schema-v4.js +0 -745
  390. package/dist/workflows/ir/schema.js +0 -354
  391. package/dist/workflows/program/schema.js +0 -77
  392. package/dist/workflows/runtime/checkin.js +0 -57
  393. package/dist/workflows/runtime/plan-classifier.js +0 -196
  394. package/dist/workflows/runtime/unit-checkin.js +0 -45
  395. package/dist/workflows/runtime/unit-phases.js +0 -20
  396. package/dist/workflows/schema.js +0 -4
  397. package/dist/workflows/source-ir/compile.js +0 -200
  398. package/dist/workflows/source-ir/program.js +0 -50
  399. package/dist/workflows/source-ir/result.js +0 -26
  400. package/dist/workflows/source-ir/schema.js +0 -786
  401. package/dist/workflows/source-ir/triggers.js +0 -79
  402. package/dist/workflows/source-ir/uses.js +0 -40
  403. 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
@@ -328,7 +314,7 @@ can select `engine`, `model`, `timeoutMs`, and LLM request overrides:
328
314
  "engine": "fast",
329
315
  "processes": {
330
316
  "reflect": { "llm": { "temperature": 0.2 } },
331
- "graphExtraction": { "model": "qwen3-small" }
317
+ "memoryInference": { "model": "qwen3-small" }
332
318
  }
333
319
  }
334
320
  }
@@ -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).
@@ -847,3 +840,24 @@ profile identities.
847
840
  `embedding.chunkSize` was never read by anything under `src/` (#954), so a
848
841
  config that still sets it is simply ignored — it still loads, unvalidated
849
842
  and without warning.
843
+
844
+ `index.graph.*` and every strategy's `processes.graphExtraction.*` are retired
845
+ in 0.9.17-alpha.9: the LLM entity graph they configured is gone —
846
+ `akm show`'s links come from declared links instead (see `## Strategies`
847
+ above). A config that still sets them loads; each key is named once as
848
+ unknown, and `akm migrate apply` removes it. The built-in `graph-refresh`
849
+ strategy is retired too, but not the same way as an ordinary unknown name:
850
+ naming it via `--strategy` or a task always fails with a message pointing at
851
+ the retirement, even when `improve.strategies["graph-refresh"]` still has a
852
+ leftover override from customizing the built-in (the message names it;
853
+ `akm migrate apply` drops it — a leftover override is never resolved as a new
854
+ custom strategy, which would silently run a full, unplanned improve pass).
855
+ `defaults.improveStrategy: "graph-refresh"` still loads config successfully;
856
+ the refusal happens lazily, when the strategy is actually resolved.
857
+
858
+ `improve.strategies.<name>.processes.consolidate.incrementalSince` and
859
+ `.neighborsPerChanged` are retired in 0.9.17-alpha.9: the consolidate pair
860
+ pass is now the candidate generator, narrowing per initiator through the
861
+ improve ledger rather than a global time window. A config that still sets
862
+ either key loads; each is named once as unknown, and `akm migrate apply`
863
+ removes it.
@@ -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
- | `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
202
  | `events_purged` | Old events deleted by improve maintenance (90-day default retention) | `purgedCount`, `retentionDays` |
209
203
  | `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` |
204
+ | `state_db_vacuumed` | state.db was VACUUMed after the retention purge because more than half its pages were free | `pagesBefore`, `pagesAfter`, `freelistRatioBefore` |
211
205
  | `task_logs_purged` | Old scheduled-task log files purged by improve maintenance | |
212
206
 
213
207
  *Workflows*
@@ -240,7 +234,7 @@ queryable per-run or aggregated with `akm improve report`; see
240
234
 
241
235
  ### 2. Usage Events Table
242
236
 
243
- `usage_events` is the local analytical record behind utility ranking,
237
+ `usage_events` is the local analytical record behind utility scores,
244
238
  retrieval-demand counts, GRR, and real-query eval generation (0.9.0: its CLI
245
239
  read surface, `akm history`, was removed — the table itself and everything
246
240
  below still applies). It stores
@@ -251,7 +245,7 @@ configured endpoint.
251
245
 
252
246
  Successful `search`, `curate`, and `show` commands record usage by default.
253
247
  Pass `--no-track-usage` to any of those commands to leave local usage events
254
- and ranking signals unchanged.
248
+ unchanged.
255
249
 
256
250
  Every runtime writer stamps provenance as `user`, `improve`, `task`, `audit`, or
257
251
  `unknown`. Direct interactive CLI traffic defaults to `user`; internal improve,
@@ -263,20 +257,18 @@ real-query labels.
263
257
 
264
258
  Per-entry `search`, `curate`, and `show` rows carry a local-only
265
259
  `metadata.downstreamAttribution` object. Version 1 uses `control: true` for
266
- current traffic where neither memory inference nor graph extraction applies;
267
- rows without the version marker are historical/unattributed. Attributed rows
268
- use `control: false` and may contain:
260
+ current traffic where memory inference does not apply; rows without the
261
+ version marker are historical/unattributed. Attributed rows use
262
+ `control: false` and may contain:
269
263
 
270
264
  - `memoryInference`: `direct` when the emitted ref is an inferred child, or
271
265
  `surface` when derived description/tags were actually present in the emitted
272
266
  search or selected curate output. Brief output and internally replaced
273
267
  descriptions are controls, not surface attribution.
274
- - `graphExtraction`: the positive graph-ranking contribution that was actually
275
- applied after the shared contributor cap, plus `bodyHash` and
276
- `extractionRunId` when available. It is absent when `graph-ranking` is
277
- ablated. The number is a ranking-input contribution, not proof that graph
278
- changed final rank, selection, or outcome; score saturation and competing
279
- contributors can leave ordering unchanged.
268
+ - `graphExtraction`: written only by releases that boosted search with the
269
+ graph — the graph contribution applied to the hit, plus `bodyHash` and
270
+ `extractionRunId` when available. Current releases do not rank by the graph
271
+ and never write it.
280
272
 
281
273
  Attribution metadata contains fully-qualified refs and graph identifiers, never
282
274
  asset bodies or provenance content. It is not added to `search`, `curate`, or
@@ -298,6 +290,13 @@ Contents:
298
290
  - Full proposal content (Markdown text)
299
291
  - Created/updated timestamps
300
292
 
293
+ Beside it, the `improve_ledger` table records what each improve stage last did
294
+ with each asset — one row per bundle, asset ref and stage: the outcome
295
+ (`proposed`, `accepted`, `rejected`, `quality_rejected`, `review_needed`,
296
+ `expired`, `unchanged`, `failed`, `judged_no_action`), when it was attempted,
297
+ and the earliest time the stage may try that asset again. It holds refs,
298
+ timestamps, a proposal id and a short reason — never asset content.
299
+
301
300
  ### 4. Task History Table
302
301
 
303
302
  A record of scheduled task runs (from `akm task`):
@@ -5,31 +5,37 @@ 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 only task source grammar akm reads.**
9
+ A document with `version: 3` or `version: 2` fails to load with `UsageError`
10
+ code `TASK_SCHEMA_VERSION_UNSUPPORTED`, naming `akm migrate apply`, which
11
+ converts it. A declared `version: 4` document whose `schedule[]` still
12
+ carries a per-entry `enabled` key — 0.9.15's v4 grammar accepted it, this
13
+ release's does not — fails the same way with `TASK_SOURCE_INVALID`
14
+ (activation is host-local, below). Each such file fails on its own:
15
+ `akm task sync` reports it and keeps reconciling every other task. Task
16
+ source v4 adds typed `inputs:` and a single bounded `output:` schema
17
+ (command targets only), and makes scheduling OPTIONAL rather than
18
+ mandatory. `akm task add` authors task source v4 directly.
15
19
 
16
20
  If you have `version: 3` or `version: 2` files on disk (from an earlier
17
21
  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
22
+ below — `akm migrate apply` converts both generations in one pass and
23
+ rewrites the file on disk (`akm upgrade` runs it after an install). The
19
24
  retired v3 grammar itself is documented at the bottom of this page
20
25
  ([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.
26
+ purely so you can read an old file while migrating it; it is no longer
27
+ accepted as a standing grammar by any command in this release.
23
28
 
24
29
  ## Files and schema
25
30
 
26
31
  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
32
+ indexed, scheduled, or run. Every task should declare `version: 4`; a
28
33
  document with no `version:` key, or a `version:` that is not a number,
29
34
  fails with `TASK_SOURCE_INVALID` (`must be exactly 4.` / `is required and
30
35
  must be exactly 4.`) — a genuinely malformed v4 document, not a legacy one.
31
36
  `version: 3` and `version: 2` fail with `TASK_SCHEMA_VERSION_UNSUPPORTED`
32
- instead (see [Migrating to task source v4](#migrating-to-task-source-v4)).
37
+ naming `akm migrate apply` (see
38
+ [Migrating to task source v4](#migrating-to-task-source-v4)).
33
39
  The published [task schema](../../schemas/akm-task.json) describes the
34
40
  hand-authored contract; `src/tasks/source/task-source-v4.ts` is the
35
41
  authoritative bounded parser.
@@ -162,25 +168,22 @@ would. Multiple schedule entries create deterministic scheduler bindings
162
168
  for the one source task.
163
169
 
164
170
  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.
171
+ it cannot authorize its own host scheduling. Activation is this host's list of
172
+ fully-qualified refs in `config.json` under `scheduler.enabled`. A ref that
173
+ is not listed is disabled. A config with no list at all (written before
174
+ 0.9.17) means "keep what is installed": the first sync fills the list from
175
+ the akm-written native bindings. Use `akm task enable <bundle>//tasks/<id>`
176
+ and `akm task disable <bundle>//tasks/<id>` to change the list and
177
+ immediately sync the affected bundle. `akm task add` enables its new task by
178
+ default; `--disabled` writes the same task source but does not list it.
174
179
 
175
180
  `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
181
+ `akm task sync` scans every enabled configured bundle, reads only locally
182
+ activated task/workflow refs, and reconciles the native scheduler one row at a
183
+ time (see [Operations](#operations)). `--bundle <name>` narrows that pass to
179
184
  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.
185
+ attributable native entries without reading task content. Workflow targets
186
+ create a fresh durable workflow freeze at fire time.
184
187
 
185
188
  ## Typed inputs and output
186
189
 
@@ -410,28 +413,91 @@ for full before/after examples and recovery guidance.
410
413
  check and its per-schedule-entry input-contract check — without touching
411
414
  the scheduler and without requiring a configured engine, even for a
412
415
  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.
416
+ file's declared schema version. A version 2/3 file, and a `version: 4`
417
+ file still carrying a retired `schedule[].enabled`, report `blocked`
418
+ (exit 1) naming `akm migrate apply`, which converts them.
419
+ - `akm task add` validates a task source v4 document, writes it, adds its ref
420
+ to local scheduler activation, and syncs its bundle. `--params` renders
421
+ typed `inputs:` declarations instead of a `with:` bag; `--schedule` is
422
+ required on every invocation. `--disabled` writes the same source but
423
+ leaves the ref out of activation. `--force` overwrites an existing task of
424
+ the same id; without it add refuses. Add also refuses, before writing
425
+ anything, when the id is already scheduled from another bundle or
426
+ installation. If the row itself cannot be installed, add fails and says so;
427
+ the task stays written and enabled, and the next `akm task sync` retries it.
419
428
  - `akm task history` reads durable run history from `state.db`.
420
429
  - `akm task enable <ref>` / `akm task disable <ref>` change only local
421
430
  scheduler config, then reconcile that bundle.
422
431
  - Delete the `.yml` source and sync to remove its derived binding(s).
432
+ - `akm task sync` reads the installed rows once, compares each against what
433
+ its source renders, and installs, rewrites, or removes rows one at a time.
434
+ A row that fails to install or remove is reported in `failures` and every
435
+ other row still applies. A source that fails to parse is reported the same
436
+ way, and its installed row is left exactly as it is. Rows akm cannot attribute to a bundle this sync covers —
437
+ another bundle's, another installation's (the row's `AKM_BUNDLE_DIR`
438
+ names a different working stash), or anything outside akm's `# akm:task` markers,
439
+ `com.akm.task.` labels, or `\akm\` task folder — are never touched. A
440
+ Task Scheduler row is compared by the fingerprint akm writes into its
441
+ `<Source>` plus its enabled state, so an edit made in Task Scheduler that
442
+ keeps that fingerprint is left alone.
443
+ - `akm task sync`, `add`, `enable`, `disable`, and `prune --yes` hold one lock
444
+ file, `$STATE/locks/scheduler.lock`, while they read and write the native
445
+ scheduler. A second one started meanwhile exits 75 (retry shortly); a lock
446
+ left by a process that is no longer running is reclaimed.
423
447
  - `akm task sync --dry-run` previews the reconcile (adds/updates/removes,
424
448
  removals annotated with their owning bundle) without writing to the
425
449
  scheduler; exits non-zero when removals are pending.
426
450
  - `akm task prune` removes installed scheduler entries `sync` cannot reach
427
- because their own descriptor no longer resolves to a live bundle
428
- (corrupt/missing `--scheduler-context`, or the owning bundle directory is
429
- gone). It never touches an entry that still resolves to a live bundle.
451
+ because they no longer resolve to a live bundle: a row whose
452
+ `AKM_BUNDLE_DIR` names a directory that is gone, or a row written before
453
+ 0.9.17-alpha.7 whose `--scheduler-context` descriptor cannot be read. It
454
+ never touches an entry that still resolves to a live bundle.
430
455
  Defaults to a dry-run preview (zero writes); `--yes` executes it; `--id
431
456
  <id1,id2,...>` scopes to specific ids and refuses any id that isn't a
432
457
  current orphan candidate.
433
- - Use `akm task sync --rebind` only when deliberately changing the captured
434
- AKM runtime, then verify with `akm task doctor`.
458
+ - A plain sync keeps each installed row's launcher. Use
459
+ `akm task sync --rebind` only when deliberately changing the captured AKM
460
+ runtime, then verify with `akm task doctor`. When the launcher sync writes
461
+ runs akm from a source checkout (`src/cli.ts`, a local build, or a package
462
+ inside a git work tree), sync says so once: scheduled runs then run
463
+ whatever the checkout holds.
464
+ - `akm task sync` writes one `PATH=` line inside a `# akm:env BEGIN`/`END`
465
+ section directly above the first akm task block in the crontab (on macOS,
466
+ an `EnvironmentVariables` entry in each plist). It is the PATH of the shell
467
+ that ran the sync, rewritten on every crontab write and removed with the
468
+ last akm block; cron applies it to every row below it.
469
+ - A task's row is its command plus its schedule:
470
+ `<launcher> task run <id> --bundle <bundle> --scheduled`, and it sets its
471
+ own environment. Every row sets `AKM_BUNDLE_DIR` to the working stash of
472
+ the shell that ran the sync (its `AKM_BUNDLE_DIR`, or the default bundle),
473
+ so the scheduled run uses the same working stash, `--bundle` finds a stash
474
+ no config names, and sync tells rows of other installations sharing the
475
+ scheduler apart (#846). Rows synced from a shell that set
476
+ `AKM_CONFIG_DIR`, `AKM_DATA_DIR`, `AKM_CACHE_DIR` or `AKM_STATE_DIR`
477
+ explicitly set those too. Each backend does it its own way: a
478
+ `VAR=value` prefix in the crontab, an `EnvironmentVariables` entry in the
479
+ plist, a `$env:VAR='value';` assignment ahead of the command in Task
480
+ Scheduler. Other defaults resolve at fire time, so a scheduled run uses
481
+ the same state, data and cache directories an interactive command does.
482
+ Run the sync from a shell whose environment you would want scheduled.
483
+
484
+ ```text
485
+ 15 2 * * * AKM_BUNDLE_DIR=/home/u/akm /home/u/.bun/bin/bun /home/u/.bun/lib/node_modules/akm-cli/dist/akm task run nightly --bundle work --scheduled > /home/u/.cache/akm/tasks/logs/nightly.log 2>&1
486
+ ```
487
+
488
+ A row whose command is over 1,000 bytes runs a wrapper script under the
489
+ log directory instead (`sh <log dir>/.akm-cron-wrapper-<id>-<hash>.sh`);
490
+ sync reads the script to tell which task the row runs.
491
+
492
+ Releases 0.9.0 through 0.9.17-alpha.6 wrote a `--scheduler-context
493
+ <file>` argument into each row instead, naming a descriptor file under
494
+ `$DATA/tasks/context/` that held the same values. akm still applies that
495
+ file when such a row fires, and the first `akm task sync` after upgrading
496
+ rewrites each row in place: it shows as an update, keeps the row's
497
+ launcher and schedule, and sets the values inline. A row the sync leaves as it is (its task file failed to load, or
498
+ a `--bundle` sync did not cover it) still names its file; once
499
+ `akm task doctor` lists no binding with a `contextPath`, the old descriptor
500
+ files are not read and can be deleted.
435
501
 
436
502
  Scheduler execution is at least once. Backends provide a stable invocation
437
503
  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.16",
3
+ "version": "0.9.17-alpha.10",
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": [