akm-cli 0.10.261012-beta → 0.10.261014-beta

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 (518) hide show
  1. package/CHANGELOG.md +710 -3
  2. package/README.md +15 -0
  3. package/SECURITY.md +11 -10
  4. package/STABILITY.md +47 -51
  5. package/dist/assets/hints/cli-hints-full.md +21 -19
  6. package/dist/assets/hints/cli-hints-short.md +3 -4
  7. package/dist/assets/opencode/akm-plugin.js +177 -0
  8. package/dist/assets/stash-skeleton/README.md +1 -1
  9. package/dist/assets/tasks/core/improve.yml +1 -1
  10. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +1 -1
  11. package/dist/assets/ui/config.js +27 -10
  12. package/dist/assets/workflows/workflow-template.md +2 -2
  13. package/dist/cli/clack.js +3 -1
  14. package/dist/cli/selection.js +33 -0
  15. package/dist/cli/shared.js +14 -1
  16. package/dist/cli/unknown-flags.js +6 -37
  17. package/dist/cli.js +69 -48
  18. package/dist/commands/agent/agent-dispatch.js +17 -25
  19. package/dist/commands/agent/contribute-cli.js +9 -8
  20. package/dist/commands/command/command-cli.js +4 -8
  21. package/dist/commands/command/command-execution.js +25 -39
  22. package/dist/commands/command/execution-source-loader.js +10 -14
  23. package/dist/commands/completions.js +1 -1
  24. package/dist/commands/config-cli.js +14 -5
  25. package/dist/commands/env/child-env.js +12 -14
  26. package/dist/commands/env/env-binding.js +47 -58
  27. package/dist/commands/env/env-cli.js +22 -24
  28. package/dist/commands/env/env.js +10 -58
  29. package/dist/commands/env/secret-cli.js +11 -29
  30. package/dist/commands/env/secret.js +3 -10
  31. package/dist/commands/health/checks.js +10 -849
  32. package/dist/commands/health/connections-and-harnesses-check.js +109 -0
  33. package/dist/commands/health/egress.js +3 -3
  34. package/dist/commands/health/html-report.js +9 -10
  35. package/dist/commands/health/plugin-staleness.js +18 -11
  36. package/dist/commands/health/report-view-model.js +16 -12
  37. package/dist/commands/health/scheduler-binary.js +1 -1
  38. package/dist/commands/health/semantic-search-check.js +85 -0
  39. package/dist/commands/health/type-directory-check.js +0 -3
  40. package/dist/commands/health.js +30 -42
  41. package/dist/commands/improve/consolidate/pair-pass.js +10 -25
  42. package/dist/commands/improve/consolidate.js +10 -15
  43. package/dist/commands/improve/distill.js +5 -17
  44. package/dist/commands/improve/eligibility.js +1 -3
  45. package/dist/commands/improve/execution.js +37 -40
  46. package/dist/commands/improve/extract-cli.js +6 -11
  47. package/dist/commands/improve/extract-prompt.js +2 -2
  48. package/dist/commands/improve/extract.js +67 -97
  49. package/dist/commands/improve/improve-cli.js +22 -128
  50. package/dist/commands/improve/improve-report.js +1 -1
  51. package/dist/commands/improve/improve-strategies.js +25 -108
  52. package/dist/commands/improve/improve.js +10 -14
  53. package/dist/commands/improve/loop-stages.js +3 -0
  54. package/dist/commands/improve/memory/memory-improve.js +1 -1
  55. package/dist/commands/improve/preparation.js +8 -13
  56. package/dist/commands/improve/reflect.js +203 -332
  57. package/dist/commands/improve/retrieval-scope.js +1 -1
  58. package/dist/commands/improve/session-asset.js +3 -2
  59. package/dist/commands/improve/stage.js +87 -115
  60. package/dist/commands/lint/base-linter.js +3 -3
  61. package/dist/commands/lint/env-key-rules.js +7 -6
  62. package/dist/commands/lint/index.js +3 -3
  63. package/dist/commands/models-cli.js +103 -63
  64. package/dist/commands/proposal/drain.js +26 -39
  65. package/dist/commands/proposal/proposal-cli.js +14 -18
  66. package/dist/commands/proposal/propose-cli.js +4 -2
  67. package/dist/commands/proposal/propose.js +37 -64
  68. package/dist/commands/proposal/repository.js +17 -17
  69. package/dist/commands/proposal/validators/proposal-validators.js +3 -6
  70. package/dist/commands/read/curate.js +10 -6
  71. package/dist/commands/read/registry-search.js +2 -48
  72. package/dist/commands/read/search-cli.js +1 -8
  73. package/dist/commands/read/search.js +5 -6
  74. package/dist/commands/read/show.js +6 -29
  75. package/dist/commands/remember.js +25 -40
  76. package/dist/commands/sources/add-cli.js +8 -63
  77. package/dist/commands/sources/bundle-cli.js +8 -9
  78. package/dist/commands/sources/bundle-config-ops.js +2 -2
  79. package/dist/commands/sources/info.js +12 -1
  80. package/dist/commands/sources/init.js +1 -1
  81. package/dist/commands/sources/installed-stashes.js +119 -63
  82. package/dist/commands/sources/migration-help.js +1 -1
  83. package/dist/commands/sources/plugin-upgrade.js +8 -15
  84. package/dist/commands/sources/schema-repair.js +4 -10
  85. package/dist/commands/sources/source-add.js +2 -2
  86. package/dist/commands/sources/source-clone.js +31 -7
  87. package/dist/commands/sources/source-manage.js +4 -4
  88. package/dist/commands/targets.js +175 -0
  89. package/dist/commands/tasks/explain.js +104 -69
  90. package/dist/commands/tasks/tasks-cli.js +9 -11
  91. package/dist/commands/tasks/tasks.js +75 -97
  92. package/dist/commands/ui/api.js +11 -3
  93. package/dist/commands/ui/redact.js +5 -31
  94. package/dist/commands/ui/workspace-actions.js +1 -1
  95. package/dist/commands/workflow/plan.js +48 -9
  96. package/dist/commands/workflow-cli.js +40 -45
  97. package/dist/core/adapter/adapters/agent-skills-adapter.js +10 -11
  98. package/dist/core/adapter/adapters/akm-adapter.js +36 -41
  99. package/dist/core/adapter/adapters/akm-lint.js +10 -12
  100. package/dist/core/adapter/adapters/akm-metadata.js +2 -2
  101. package/dist/core/adapter/adapters/akm-task-adapter.js +8 -9
  102. package/dist/core/adapter/adapters/akm-workflow-adapter.js +5 -5
  103. package/dist/core/adapter/adapters/claude-adapter.js +1 -1
  104. package/dist/core/adapter/adapters/dotenv-adapter.js +7 -6
  105. package/dist/core/adapter/adapters/generic-files-adapter.js +5 -5
  106. package/dist/core/adapter/adapters/index.js +3 -4
  107. package/dist/core/adapter/adapters/llm-wiki-adapter.js +12 -14
  108. package/dist/core/adapter/adapters/okf-adapter.js +8 -10
  109. package/dist/core/adapter/adapters/opencode-adapter.js +1 -1
  110. package/dist/core/adapter/adapters/shared.js +3 -3
  111. package/dist/core/adapter/adapters/tool-dir-shared.js +7 -25
  112. package/dist/core/adapter/adapters/website-snapshot-adapter.js +3 -3
  113. package/dist/core/adapter/detect-adapter.js +1 -1
  114. package/dist/core/adapter/execution-source.js +13 -35
  115. package/dist/core/adapter/registry.js +1 -1
  116. package/dist/core/adapter/validate-context.js +2 -4
  117. package/dist/core/asset/asset-placement.js +1 -1
  118. package/dist/core/asset/asset-ref.js +3 -3
  119. package/dist/core/asset/resolve-ref.js +5 -0
  120. package/dist/core/bundle-rename.js +12 -4
  121. package/dist/core/closest-match.js +37 -0
  122. package/dist/core/common.js +37 -57
  123. package/dist/core/config/config-io.js +26 -18
  124. package/dist/core/config/config-schema.js +19 -106
  125. package/dist/core/config/config-sources.js +3 -3
  126. package/dist/core/config/config-types.js +4 -4
  127. package/dist/core/config/config-walker.js +50 -77
  128. package/dist/core/config/config.js +438 -109
  129. package/dist/core/config/convert-engine-references.js +114 -0
  130. package/dist/core/config/convert-engines-shared.js +40 -0
  131. package/dist/core/config/convert-engines.js +300 -0
  132. package/dist/core/config/convert-models-overlay.js +137 -0
  133. package/dist/core/config/credentials.js +304 -0
  134. package/dist/core/config/engine-semantics.js +3 -3
  135. package/dist/core/config/migrate-keys.js +222 -0
  136. package/dist/core/config/model-aliases.js +37 -0
  137. package/dist/core/config/models-file.js +34 -0
  138. package/dist/core/config/retired-engines.js +53 -0
  139. package/dist/core/config/schema/connections.js +41 -0
  140. package/dist/core/config/schema/embedding.js +2 -2
  141. package/dist/core/config/schema/harnesses.js +41 -0
  142. package/dist/core/config/schema/improve-processes.js +9 -28
  143. package/dist/core/config/schema/improve.js +36 -1
  144. package/dist/core/config/schema/index-config.js +18 -20
  145. package/dist/core/config/schema/primitives.js +42 -17
  146. package/dist/core/config/schema/search.js +6 -11
  147. package/dist/core/config/schema/sources-bundles.js +9 -9
  148. package/dist/core/config/schema/workflow.js +2 -6
  149. package/dist/core/config/unusable-entries.js +66 -0
  150. package/dist/core/content-safety.js +3 -6
  151. package/dist/core/endpoint-url.js +47 -0
  152. package/dist/core/env-secret-ref.js +84 -73
  153. package/dist/core/errors.js +10 -16
  154. package/dist/core/extra-params.js +3 -3
  155. package/dist/core/improve-result.js +8 -9
  156. package/dist/core/json-schema.js +1 -1
  157. package/dist/core/lesson-lint.js +1 -1
  158. package/dist/core/llm-inference.js +80 -0
  159. package/dist/core/parse.js +2 -2
  160. package/dist/core/paths.js +33 -10
  161. package/dist/core/recognition-util.js +8 -10
  162. package/dist/core/redaction.js +94 -55
  163. package/dist/core/ref-token.js +82 -0
  164. package/dist/core/secret-value.js +14 -0
  165. package/dist/core/state/migrations.js +17 -22
  166. package/dist/core/structured.js +2 -68
  167. package/dist/core/subprocess.js +63 -22
  168. package/dist/core/type-presentation.js +10 -14
  169. package/dist/core/write-source.js +20 -4
  170. package/dist/execution/input-contract.js +3 -6
  171. package/dist/execution/notices.js +49 -0
  172. package/dist/execution/resolved-request.js +24 -40
  173. package/dist/execution/source.js +21 -45
  174. package/dist/execution/target-ref.js +2 -2
  175. package/dist/indexer/bundle-identity-guard.js +6 -5
  176. package/dist/indexer/ensure-index.js +1 -1
  177. package/dist/indexer/index-writer-lock.js +1 -1
  178. package/dist/indexer/indexer.js +46 -42
  179. package/dist/indexer/installations.js +12 -22
  180. package/dist/indexer/lookup/adapter-concept-owner.js +40 -14
  181. package/dist/indexer/materialize-embeddings.js +20 -16
  182. package/dist/indexer/passes/memory-inference.js +21 -50
  183. package/dist/indexer/passes/metadata.js +5 -5
  184. package/dist/indexer/scan/doc-to-entry.js +1 -1
  185. package/dist/indexer/scan/drain-dir.js +9 -11
  186. package/dist/indexer/search/db-search.js +9 -7
  187. package/dist/indexer/search/search-source.js +42 -22
  188. package/dist/indexer/usage/usage-events.js +2 -3
  189. package/dist/indexer/walk/index-context.js +2 -1
  190. package/dist/indexer/walk/matchers.js +3 -11
  191. package/dist/indexer/walk/path-resolver.js +13 -68
  192. package/dist/indexer/walk/walker.js +32 -26
  193. package/dist/integrations/agent/akm-read-tools.js +81 -0
  194. package/dist/integrations/agent/config.js +1 -1
  195. package/dist/integrations/agent/detect.js +32 -36
  196. package/dist/integrations/agent/execution.js +130 -428
  197. package/dist/integrations/agent/index.js +1 -1
  198. package/dist/integrations/agent/profiles.js +24 -28
  199. package/dist/integrations/agent/prompts.js +17 -30
  200. package/dist/integrations/agent/request-lowering.js +67 -101
  201. package/dist/integrations/agent/resolution.js +332 -0
  202. package/dist/integrations/agent/runner-dispatch.js +156 -181
  203. package/dist/integrations/agent/runner.js +20 -70
  204. package/dist/integrations/agent/runtime-port.js +4 -0
  205. package/dist/integrations/agent/runtime.js +10 -0
  206. package/dist/integrations/agent/spawn.js +65 -190
  207. package/dist/integrations/harnesses/aider/index.js +19 -39
  208. package/dist/integrations/harnesses/amazonq/index.js +17 -32
  209. package/dist/integrations/harnesses/claude/index.js +59 -28
  210. package/dist/integrations/harnesses/claude/session-log.js +7 -5
  211. package/dist/integrations/harnesses/codex/index.js +19 -31
  212. package/dist/integrations/harnesses/copilot/index.js +17 -35
  213. package/dist/integrations/harnesses/gemini/index.js +18 -34
  214. package/dist/integrations/harnesses/harness.js +36 -0
  215. package/dist/integrations/harnesses/index.js +20 -51
  216. package/dist/integrations/harnesses/opencode/agent-builder.js +132 -100
  217. package/dist/integrations/harnesses/opencode/index.js +11 -33
  218. package/dist/integrations/harnesses/opencode/roots.js +50 -0
  219. package/dist/integrations/harnesses/opencode/runtime/binary.js +206 -0
  220. package/dist/integrations/harnesses/opencode/runtime/command.js +152 -0
  221. package/dist/integrations/harnesses/opencode/runtime/index.js +177 -0
  222. package/dist/integrations/harnesses/opencode/runtime/tar.js +107 -0
  223. package/dist/integrations/harnesses/opencode/session-log-v1.js +15 -7
  224. package/dist/integrations/harnesses/opencode/session-log-v2.js +72 -48
  225. package/dist/integrations/harnesses/opencode/session-log.js +58 -137
  226. package/dist/integrations/harnesses/opencode/version.js +34 -53
  227. package/dist/integrations/harnesses/openhands/index.js +13 -37
  228. package/dist/integrations/harnesses/pi/index.js +21 -32
  229. package/dist/integrations/lockfile.js +1 -1
  230. package/dist/integrations/session-logs/index.js +11 -31
  231. package/dist/llm/client.js +93 -111
  232. package/dist/llm/embedder.js +19 -34
  233. package/dist/llm/embedders/connection.js +31 -0
  234. package/dist/llm/embedders/local-model-files.js +56 -0
  235. package/dist/llm/embedders/local.js +146 -115
  236. package/dist/llm/embedders/remote.js +26 -23
  237. package/dist/llm/embedders/types.js +1 -1
  238. package/dist/llm/index-passes.js +33 -39
  239. package/dist/llm/memory-infer.js +67 -77
  240. package/dist/llm/model-list.js +35 -0
  241. package/dist/llm/rerank-client.js +8 -14
  242. package/dist/llm/structured-call.js +45 -99
  243. package/dist/llm/structured.js +60 -0
  244. package/dist/output/renderers.js +2 -8
  245. package/dist/output/shapes/helpers.js +18 -44
  246. package/dist/output/shapes/passthrough.js +1 -0
  247. package/dist/output/shapes.js +1 -7
  248. package/dist/output/text/command-format.js +41 -39
  249. package/dist/output/text/health-format.js +8 -2
  250. package/dist/output/text/helpers.js +1 -1
  251. package/dist/output/text/migrate.js +12 -0
  252. package/dist/output/text/models.js +3 -2
  253. package/dist/output/text/registry-commands.js +1 -2
  254. package/dist/output/text/show-directives.js +16 -28
  255. package/dist/output/text/show-format.js +0 -2
  256. package/dist/output/text/targets-table.js +70 -0
  257. package/dist/output/text/workflow-format.js +44 -15
  258. package/dist/output/text.js +1 -1
  259. package/dist/registry/providers/skills-sh.js +1 -28
  260. package/dist/registry/providers/static-index.js +1 -71
  261. package/dist/runtime.js +6 -2
  262. package/dist/scripts/akm-migrate-node.js +47095 -44905
  263. package/dist/scripts/akm-migrate.js +46946 -44755
  264. package/dist/setup/detect.js +28 -273
  265. package/dist/setup/endpoint.js +36 -0
  266. package/dist/setup/semantic-assets.js +13 -19
  267. package/dist/setup/setup-flags.js +77 -0
  268. package/dist/setup/setup-plan.js +144 -0
  269. package/dist/setup/setup.js +134 -358
  270. package/dist/setup/steps/connection-shared.js +49 -101
  271. package/dist/setup/steps/connection.js +121 -524
  272. package/dist/setup/steps/embeddings.js +151 -0
  273. package/dist/setup/steps/harnesses.js +118 -0
  274. package/dist/setup/steps/platforms.js +2 -81
  275. package/dist/setup/steps/tasks.js +1 -2
  276. package/dist/setup/steps.js +10 -0
  277. package/dist/setup/summary.js +67 -0
  278. package/dist/sources/freshness.js +16 -21
  279. package/dist/sources/providers/git-provider.js +2 -9
  280. package/dist/sources/providers/provider-utils.js +13 -5
  281. package/dist/sources/resolve.js +12 -16
  282. package/dist/sources/snapshot-fetchers/robots.js +11 -12
  283. package/dist/sources/snapshot-fetchers/secret-seam.js +2 -4
  284. package/dist/sources/snapshot-fetchers/website-ingest.js +8 -15
  285. package/dist/sources/snapshot-fetchers/x.js +1 -1
  286. package/dist/standalone/onnxruntime-library.js +52 -0
  287. package/dist/storage/repositories/improve-ledger-repository.js +1 -1
  288. package/dist/storage/repositories/improve-runs-repository.js +0 -13
  289. package/dist/storage/repositories/index-entries-repository.js +2 -2
  290. package/dist/storage/repositories/proposals-repository.js +2 -2
  291. package/dist/storage/repositories/task-history-repository.js +2 -2
  292. package/dist/storage/repositories/workflow-runs-repository.js +44 -129
  293. package/dist/storage/sqlite-read-snapshot.js +33 -29
  294. package/dist/tasks/embedded.js +1 -1
  295. package/dist/tasks/log-redaction.js +7 -119
  296. package/dist/tasks/prepare/prepare-support.js +8 -7
  297. package/dist/tasks/prepare/prepare.js +8 -9
  298. package/dist/tasks/prepare/script-capture.js +9 -25
  299. package/dist/tasks/run/attempt-lifecycle.js +17 -35
  300. package/dist/tasks/run/load-task.js +54 -27
  301. package/dist/tasks/run/run-command-task.js +15 -10
  302. package/dist/tasks/run/run-native-task.js +8 -21
  303. package/dist/tasks/run/run-task.js +5 -8
  304. package/dist/tasks/run/run-workflow-task.js +14 -21
  305. package/dist/tasks/run/task-history.js +9 -17
  306. package/dist/tasks/run/task-log.js +1 -5
  307. package/dist/tasks/scheduler-invocation.js +13 -18
  308. package/dist/tasks/scheduler-sync.js +0 -1
  309. package/dist/tasks/source/bounded-document.js +31 -117
  310. package/dist/tasks/source/parse-task-source.js +0 -1
  311. package/dist/tasks/source/project-v4.js +5 -3
  312. package/dist/tasks/source/task-input-diagnostics.js +3 -4
  313. package/dist/tasks/source/task-source-v4.js +48 -72
  314. package/dist/tasks/source-v3.js +2 -5
  315. package/dist/tasks/task-run-reserved-flags.js +1 -2
  316. package/dist/workflows/authoring/authoring.js +2 -7
  317. package/dist/workflows/compile.js +1 -15
  318. package/dist/workflows/concurrency-policy.js +4 -4
  319. package/dist/workflows/exec/child-workflow.js +1 -4
  320. package/dist/workflows/exec/dispatch-redaction.js +35 -86
  321. package/dist/workflows/exec/environment.js +13 -77
  322. package/dist/workflows/exec/exec-unit.js +14 -55
  323. package/dist/workflows/exec/frozen-judge.js +26 -28
  324. package/dist/workflows/exec/native-executor.js +126 -71
  325. package/dist/workflows/exec/run-workflow.js +38 -42
  326. package/dist/workflows/exec/step-work.js +13 -17
  327. package/dist/workflows/exec/unit-dispatch.js +7 -21
  328. package/dist/workflows/freeze/environment.js +14 -119
  329. package/dist/workflows/freeze/freeze.js +14 -33
  330. package/dist/workflows/freeze/step-values.js +6 -13
  331. package/dist/workflows/freeze/targets/child-workflow.js +3 -5
  332. package/dist/workflows/freeze/targets/command.js +9 -15
  333. package/dist/workflows/freeze/targets/shell.js +0 -3
  334. package/dist/workflows/freeze/task-bindings.js +0 -1
  335. package/dist/workflows/parser.js +50 -59
  336. package/dist/workflows/plan.js +8 -2
  337. package/dist/workflows/renderer.js +83 -9
  338. package/dist/workflows/resource-limits.js +2 -2
  339. package/dist/workflows/runtime/run-plan.js +38 -23
  340. package/dist/workflows/runtime/runs.js +55 -93
  341. package/dist/workflows/runtime/workflow-asset-loader.js +55 -86
  342. package/dist/workflows/source-files.js +7 -19
  343. package/docs/README.md +10 -16
  344. package/docs/architecture/README.md +2 -37
  345. package/docs/architecture/adapters.md +2 -2
  346. package/docs/architecture/akm-core-principles.md +256 -118
  347. package/docs/architecture/architecture.md +283 -99
  348. package/docs/architecture/improvement.md +8 -2
  349. package/docs/architecture/internals/classification.md +1 -3
  350. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +7 -6
  351. package/docs/architecture/internals/health-advisories.md +35 -74
  352. package/docs/architecture/internals/improve-workflow.md +27 -26
  353. package/docs/architecture/internals/indexing.md +3 -3
  354. package/docs/architecture/internals/storage-locations.md +48 -15
  355. package/docs/architecture/persisted-data-compat.md +10 -6
  356. package/docs/architecture/specs/okf-support.md +9 -11
  357. package/docs/architecture/specs/ref.md +7 -9
  358. package/docs/architecture/testing/testing-workflow.md +172 -52
  359. package/docs/architecture/workflow-engine.md +51 -34
  360. package/docs/guides/README.md +0 -1
  361. package/docs/guides/author-bundles.md +15 -20
  362. package/docs/guides/author-workflows.md +93 -71
  363. package/docs/guides/bundles.md +20 -16
  364. package/docs/guides/discover-and-load.md +1 -1
  365. package/docs/guides/getting-started.md +49 -3
  366. package/docs/guides/improve-the-library.md +10 -4
  367. package/docs/guides/recipes/headless-install.md +11 -16
  368. package/docs/guides/run-workflows.md +29 -20
  369. package/docs/guides/scheduling.md +2 -2
  370. package/docs/guides/use-with-any-agent.md +20 -22
  371. package/docs/integration/bundling-akm.md +19 -9
  372. package/docs/maintainers/README.md +2 -6
  373. package/docs/maintainers/release-checklist.md +73 -126
  374. package/docs/migration/README.md +10 -3
  375. package/docs/migration/release-notes/0.10.0.md +81 -16
  376. package/docs/migration/release-notes/0.6.0.md +1 -1
  377. package/docs/migration/release-notes/0.7.0.md +1 -1
  378. package/docs/migration/release-notes/0.9.0.md +1 -1
  379. package/docs/migration/release-notes/README.md +1 -1
  380. package/docs/migration/v0.9-to-v0.10.md +300 -60
  381. package/docs/migration/v0.9.1-to-v0.9.2.md +6 -5
  382. package/docs/posts/config-v2-lessons-16.md +1 -1
  383. package/docs/posts/llm-mode-reflect-13.md +1 -1
  384. package/docs/posts/release-0.6.0.md +11 -11
  385. package/docs/posts/release-0.8.0.md +4 -4
  386. package/docs/posts/workflows-vaults-09.md +1 -1
  387. package/docs/reference/README.md +1 -1
  388. package/docs/reference/asset-types.md +2 -2
  389. package/docs/reference/cli.md +477 -388
  390. package/docs/reference/configuration.md +569 -550
  391. package/docs/reference/data-and-telemetry.md +9 -6
  392. package/docs/reference/env-and-secrets.md +72 -15
  393. package/docs/reference/refs.md +3 -20
  394. package/docs/reference/registry.md +12 -38
  395. package/docs/reference/supported-formats.md +1 -1
  396. package/docs/reference/tasks.md +22 -11
  397. package/docs/reference/ui-api.md +14 -9
  398. package/docs/reference/workflow-schema.md +199 -154
  399. package/docs/reference/workflows.md +4 -6
  400. package/package.json +9 -11
  401. package/schemas/akm-config.json +1696 -2922
  402. package/schemas/akm-task.json +4 -4
  403. package/schemas/akm-workflow.json +36 -9
  404. package/ROADMAP.md +0 -112
  405. package/dist/assets/models.json +0 -35
  406. package/dist/commands/health/engine-usage.js +0 -45
  407. package/dist/commands/sources/dangerous-env-audit.js +0 -134
  408. package/dist/core/activation-policy.js +0 -67
  409. package/dist/core/config/schema/engines.js +0 -160
  410. package/dist/core/config/schema/execution.js +0 -23
  411. package/dist/core/spawn-env.js +0 -268
  412. package/dist/execution/directory-identity.js +0 -78
  413. package/dist/integrations/agent/builder-shared.js +0 -33
  414. package/dist/integrations/agent/builders.js +0 -43
  415. package/dist/integrations/agent/engine-fallback.js +0 -59
  416. package/dist/integrations/agent/engine-resolution.js +0 -333
  417. package/dist/integrations/agent/model-map.js +0 -475
  418. package/dist/integrations/harnesses/aider/agent-builder.js +0 -107
  419. package/dist/integrations/harnesses/aider/result-extractor.js +0 -53
  420. package/dist/integrations/harnesses/amazonq/agent-builder.js +0 -138
  421. package/dist/integrations/harnesses/amazonq/result-extractor.js +0 -48
  422. package/dist/integrations/harnesses/claude/agent-builder.js +0 -106
  423. package/dist/integrations/harnesses/claude/config-import.js +0 -67
  424. package/dist/integrations/harnesses/claude/result-extractor.js +0 -67
  425. package/dist/integrations/harnesses/codex/agent-builder.js +0 -150
  426. package/dist/integrations/harnesses/codex/result-extractor.js +0 -110
  427. package/dist/integrations/harnesses/copilot/agent-builder.js +0 -117
  428. package/dist/integrations/harnesses/copilot/result-extractor.js +0 -178
  429. package/dist/integrations/harnesses/gemini/agent-builder.js +0 -114
  430. package/dist/integrations/harnesses/gemini/result-extractor.js +0 -149
  431. package/dist/integrations/harnesses/opencode/config-import.js +0 -149
  432. package/dist/integrations/harnesses/opencode/model-config.js +0 -33
  433. package/dist/integrations/harnesses/opencode/model-work-agent.js +0 -115
  434. package/dist/integrations/harnesses/opencode/session-log-types.js +0 -12
  435. package/dist/integrations/harnesses/opencode-sdk/index.js +0 -44
  436. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +0 -1052
  437. package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +0 -199
  438. package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +0 -254
  439. package/dist/integrations/harnesses/opencode-sdk/wire.js +0 -66
  440. package/dist/integrations/harnesses/openhands/agent-builder.js +0 -120
  441. package/dist/integrations/harnesses/openhands/result-extractor.js +0 -135
  442. package/dist/integrations/harnesses/pi/agent-builder.js +0 -89
  443. package/dist/integrations/harnesses/pi/result-extractor.js +0 -168
  444. package/dist/integrations/harnesses/shared.js +0 -18
  445. package/dist/integrations/harnesses/types.js +0 -55
  446. package/dist/llm/feature-gate.js +0 -115
  447. package/dist/output/shapes/models-list.js +0 -16
  448. package/dist/output/shapes/registry-search.js +0 -10
  449. package/dist/setup/detected-engines.js +0 -136
  450. package/dist/setup/engine-config.js +0 -97
  451. package/dist/setup/harness-config-import.js +0 -47
  452. package/dist/setup/providers.js +0 -14
  453. package/dist/setup/steps/semantic.js +0 -39
  454. package/dist/workflows/authoring/scope-key.js +0 -79
  455. package/dist/workflows/exec/lowering-notices.js +0 -23
  456. package/dist/workflows/source-semantics.js +0 -110
  457. package/docs/architecture/0.10-process-rules.md +0 -832
  458. package/docs/architecture/akm-architecture-decision-history.md +0 -2055
  459. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +0 -550
  460. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +0 -72
  461. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +0 -142
  462. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +0 -189
  463. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +0 -97
  464. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +0 -108
  465. package/docs/architecture/decisions/0006-task-source-version-routing.md +0 -124
  466. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +0 -83
  467. package/docs/architecture/decisions/0008-task-binding-normalization.md +0 -88
  468. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +0 -80
  469. package/docs/architecture/decisions/0010-driver-protocol-cut.md +0 -36
  470. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +0 -125
  471. package/docs/architecture/decisions/README.md +0 -62
  472. package/docs/architecture/internals/functional-contract-patterns.md +0 -340
  473. package/docs/architecture/internals/registry-network-boundary.md +0 -57
  474. package/docs/architecture/internals/search.md +0 -248
  475. package/docs/architecture/reviews/env-secret-access.md +0 -319
  476. package/docs/architecture/runtime-boundary-design.md +0 -153
  477. package/docs/architecture/specs/0.9.0-close-out-plan.md +0 -361
  478. package/docs/architecture/specs/0.9.0-decisions.md +0 -532
  479. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +0 -745
  480. package/docs/architecture/specs/0.9.0-open-items-register.md +0 -135
  481. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +0 -740
  482. package/docs/architecture/specs/0.9.0-release-surface-review.md +0 -636
  483. package/docs/architecture/specs/agent-command-engine-model-design.md +0 -513
  484. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +0 -501
  485. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +0 -291
  486. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +0 -2059
  487. package/docs/architecture/specs/di-seams-plan.md +0 -539
  488. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +0 -275
  489. package/docs/architecture/specs/fact-asset-type.md +0 -142
  490. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +0 -634
  491. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +0 -72
  492. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +0 -152
  493. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +0 -352
  494. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +0 -300
  495. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +0 -402
  496. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +0 -758
  497. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +0 -645
  498. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +0 -602
  499. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +0 -27
  500. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +0 -27
  501. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +0 -74
  502. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +0 -15
  503. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +0 -132
  504. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +0 -147
  505. package/docs/architecture/specs/stash-conventions-code-spec.md +0 -275
  506. package/docs/architecture/specs/stash-organization-conventions.md +0 -377
  507. package/docs/architecture/specs/task-workflow-format-unification.md +0 -721
  508. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +0 -231
  509. package/docs/architecture/specs/workflow-format-unification.md +0 -432
  510. package/docs/architecture/testing/manual-testing-checklist.md +0 -3411
  511. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +0 -924
  512. package/docs/architecture/testing/task-workflow-manual-tests.md +0 -1720
  513. package/docs/guides/claude-code-vs-akm-workflows.md +0 -29
  514. package/docs/guides/knowledge-management.md +0 -18
  515. package/docs/maintainers/curate-workmap.md +0 -335
  516. package/docs/migration/v0.5-to-v0.6.md +0 -759
  517. package/docs/migration/v0.7-to-v0.8.md +0 -1378
  518. package/docs/plans/0.9.2-agent-command-workflow-plan.md +0 -423
@@ -51,9 +51,9 @@ steps:
51
51
  The step needs a `## investigate` body section like any other step (it is
52
52
  documentation for a human; the child's own steps carry the instructions).
53
53
 
54
- - `workflow` names the child. A workflow unit reaches no engine and the child
55
- carries its own environment, so `exec`, `engine`, `model`, `llm` and `env`
56
- beside `workflow` are lint errors. `workflow` is not allowed inside
54
+ - `workflow` names the child. A workflow unit runs no model of its own and the
55
+ child carries its own environment, so `exec`, `connection`, `harness`, `model`,
56
+ `llm` and `env` beside `workflow` are lint errors. `workflow` is not allowed inside
57
57
  `map.unit`.
58
58
  - `with:` binds the child's declared `params:` (a workflow has no `inputs:`).
59
59
  Each value is a literal (validated against the param's declared type at
@@ -159,12 +159,14 @@ families) plus the orchestration keys:
159
159
  - `params` — name → `{ type, description, default }` (JSON-Schema-typed, unlike a bare
160
160
  description string). A param the run does not supply takes its `default:`; an explicit
161
161
  value wins. Params are never required.
162
- - `defaults` — run-level dispatch defaults (`engine`, `model`, `llm`,
163
- `timeout`, `on_error`), overridable per unit. `llm:` tuning reaches an engine
164
- of any kind, and a document-level `llm:` reaches EVERY step. An LLM engine
165
- sends it; an agent engine reports it as an `untranslated-field` notice on that
166
- step (see
167
- [Inference on an agent engine](configuration.md#inference-on-an-agent-engine)).
162
+ - `defaults` — run-level dispatch defaults (`connection`, `harness`, `model`,
163
+ `llm`, `timeout`, `on_error`), overridable per unit. A step with neither runs
164
+ on the default harness, else akm's own runtime over the default connection.
165
+ `llm:` tuning (`temperature`, `max_tokens`, `enable_thinking`,
166
+ `reasoning_effort`) reaches every step, and a document-level `llm:` reaches
167
+ EVERY step. A connection and akm's own runtime send it; a harness reports it as
168
+ an `untranslated-field` notice on that step (see
169
+ [Settings a call asks for](configuration.md#settings-a-call-asks-for)).
168
170
  There is no per-step opt-out (`llm: {}` is a no-op and `llm: null` is a parse
169
171
  error), so in a mixed document put `llm:` on the `unit:` of each step it is
170
172
  meant for instead of in `defaults:`.
@@ -174,8 +176,8 @@ families) plus the orchestration keys:
174
176
  (`[A-Za-z_][A-Za-z0-9_-]*` — no dots) and **at most one** of `unit` or `map`.
175
177
  A step with neither is **still a unit step** — bare
176
178
  `- id: validate` is the complete minimal declaration. `unit:` is the
177
- optional dispatch-override bag (`exec`, `engine`, `model`, `llm`, `timeout`,
178
- `retry`, `on_error`, `output`, `env`; see
179
+ optional dispatch-override bag (`exec`, `connection`, `harness`, `model`,
180
+ `llm`, `timeout`, `retry`, `on_error`, `output`, `env`; see
179
181
  [Exec (shell) units](#exec-shell-units) and
180
182
  [Failure policy](#failure-policy)). Dispatch settings live under `unit:`
181
183
  (`map.unit:` on a map step), not on the step itself; `unit.output` types
@@ -267,7 +269,7 @@ type: workflow
267
269
  description: Review changed files and give an overall verdict
268
270
  params:
269
271
  changed_files: { type: array, description: Files to review }
270
- defaults: { engine: reviewer, model: balanced, timeout: 10m, on_error: fail }
272
+ defaults: { harness: claude, model: balanced, timeout: 10m, on_error: fail }
271
273
  budget: { max_units: 40, max_tokens: 200000 }
272
274
  steps:
273
275
  - id: discover
@@ -278,8 +280,8 @@ steps:
278
280
  over: steps.discover.output.files
279
281
  concurrency: 8
280
282
  unit:
281
- engine: reviewer
282
- model: deep
283
+ harness: claude
284
+ model: reasoning
283
285
  timeout: 5m
284
286
  retry: { max: 1, on: [timeout, llm_rate_limit] }
285
287
  on_error: continue
@@ -491,20 +493,20 @@ fail later at `akm workflow run`:
491
493
  | `map.concurrency` | 1 – 64 |
492
494
  | `retry.max` | 0 – 100 |
493
495
  | `timeout` | ≤ 2147483647 ms (~24.8 days), or `none` |
494
- | `engine` names | `^[a-z][a-z0-9]*(-[a-z0-9]+)*$`, ≤ 63 chars |
496
+ | `connection` and `harness` names | `^[a-z][a-z0-9]*(-[a-z0-9]+)*$`, ≤ 63 chars |
495
497
 
496
498
  `timeout` is resolved **once, at freeze time**, and the frozen value is what
497
- dispatch applies — there is no separate engine-side ceiling on top of it. The
499
+ dispatch applies — there is no separate ceiling on top of it. The
498
500
  first of these that is set wins: the unit's `timeout`, then the document's
499
- `defaults.timeout`, then `engines.<name>.timeoutMs`, then the engine-kind
500
- default — **10m for `kind: llm` engines, and none for agent engines**, which
501
- manage their own process lifetime. Writing `timeout: none` is an explicit opt
501
+ `defaults.timeout`, then the selected connection's or harness's `timeoutMs`,
502
+ then the default — **none for agent work, whether it runs on a harness or on
503
+ akm's runtime over a connection, and 10m for model work**. Writing `timeout: none` is an explicit opt
502
504
  out and leaves the unit genuinely unbounded; nothing later re-imposes a cap.
503
505
 
504
506
  ## Exec (shell) units
505
507
 
506
508
  A step whose `unit:` block declares `exec:` runs a **shell command** instead of
507
- dispatching to an engine. Deterministic work — running the test suite, building,
509
+ dispatching a model. Deterministic work — running the test suite, building,
508
510
  linting, copying a file, invoking a script — is a command, not a prompt, and
509
511
  paying for an LLM or agent dispatch to get it done buys nondeterminism, latency,
510
512
  and tokens in exchange for nothing.
@@ -515,15 +517,15 @@ steps:
515
517
  unit:
516
518
  exec:
517
519
  command: ["bun", "run", "test:unit"]
518
- cwd: packages/core # optional, relative
520
+ cwd: packages/core # optional: relative to the workflow's bundle root, or absolute
519
521
  timeout: "10m"
520
522
  retry: { max: 1, on: [timeout] }
521
523
  ```
522
524
 
523
- An exec unit names **no engine**. It carries no `engine`, `model`, or `llm` (the
524
- parser rejects those alongside `exec:`), it consumes no tokens, and a workflow
525
- made only of exec steps freezes and runs on an install with no engine configured
526
- at all. Everything else about a unit still applies unchanged: `timeout`, `retry`,
525
+ An exec unit names **no connection or harness**. It carries no `connection`,
526
+ `harness`, `model`, or `llm` (the parser rejects those alongside `exec:`), it
527
+ consumes no tokens, and a workflow made only of exec steps freezes and runs on an
528
+ install with no connection or harness configured at all. Everything else about a unit still applies unchanged: `timeout`, `retry`,
527
529
  `on_error`, `output`, `env`, `map` fan-out and its concurrency, the
528
530
  unit journal, budget accounting, and replay/reuse.
529
531
 
@@ -554,11 +556,66 @@ Bounds: 1–64 argv entries, each a non-empty string of at most 4096 bytes.
554
556
 
555
557
  ### `cwd`
556
558
 
557
- Optional and **relative**. It resolves inside the unit's working directory —
558
- the engine invocation's working directory. Absolute paths, Windows drive
559
- letters, `~`, and `..` segments are rejected by the parser *and* by the
560
- frozen-plan decoder, and containment is re-checked against the *resolved* base
561
- (symlinks included) immediately before the command is spawned.
559
+ Optional: a non-empty string, **relative or absolute**, and free to carry
560
+ `${ref}` tokens (see [`${ref}` in argv and `cwd`](#ref-in-argv-and-cwd)). It is
561
+ the only static check; there is no containment.
562
+
563
+ An exec unit's working directory is the **root of the bundle that owns the
564
+ workflow**. akm finds that bundle again for each step, by the run's workflow
565
+ ref, so a `bundle update` that moves the bundle to a new revision directory
566
+ between two steps of a running workflow is harmless: the next step runs from
567
+ the new directory. `cwd` is joined onto that root **once**: `cwd: sub` runs in
568
+ `<bundle>/sub`, and an absolute `cwd` replaces the root. Agent and SDK units
569
+ get the same directory as their workspace, and so does a step's gate judge. If the workflow's bundle no longer
570
+ resolves, the step fails with a message naming the ref; a step with a gate is
571
+ blocked by its judge first, for `akm workflow resume`, because the judge is built
572
+ before anything is dispatched. akm never falls back to its own working
573
+ directory.
574
+
575
+ ### The exec contract
576
+
577
+ What a command can rely on, in one place. The sections below give each point in
578
+ full.
579
+
580
+ | | |
581
+ | --- | --- |
582
+ | **Working directory** | The owner root of the run's workflow, found at each step's dispatch. `cwd` joins it once and may be absolute. |
583
+ | **Argv** | Spawned directly, never shell-interpreted. A `${ref}` token in an entry is replaced at dispatch. |
584
+ | **Environment** | [akm's own](#the-childs-environment), with the directories this akm resolved set over it, then the unit's `env:` bindings, then the engine's `AKM_*` [context](#context-reaching-the-command). |
585
+ | **`${ref}` tokens** | In argv, `cwd` and env-asset values. `${secrets/name}` becomes the secret's value, any other asset ref the asset's absolute path. A ref no bundle owns fails the unit before it spawns. Prompts are not substituted. |
586
+ | **Redaction** | Only values akm knows are secret are scrubbed from stdout, stderr, diagnostics and the journal: values substituted from `secrets/` refs, secret-shaped run params, connection keys, and the values of credential-named variables the command inherited from akm's environment (names such as `*_API_KEY`, `*_TOKEN`, `*_SECRET` and `*_PASSWORD`, eight characters or more). Configuration, such as a URL bound through an env asset or an ordinary inherited variable, is not. |
587
+
588
+ #### What is frozen, and what is found at dispatch
589
+
590
+ The frozen plan records the identities the engine itself dereferences: the
591
+ workflow ref, each unit's `env:` refs qualified with their bundle
592
+ (`team//env/prod`), and child workflow refs, plus the argv, `cwd` and
593
+ `pass_env` names as authored. It records no directory or file location. The
594
+ bundle root, the env files, the secrets and the paths behind `${ref}` tokens are
595
+ all looked up when the unit dispatches, through the same ref lookup `akm show`
596
+ uses. Plans frozen by earlier releases (`irVersion` 5 and 6) also carry a frozen
597
+ `cwdIdentity` and the env asset's owner paths; they decode, those fields are
598
+ ignored, and such a run dispatches by ref like any other.
599
+
600
+ #### `${ref}` in argv and `cwd`
601
+
602
+ An argv entry or `cwd` can name an asset in any bundle with the same
603
+ `${[bundle//]conceptId}` token env assets use:
604
+
605
+ ```yaml
606
+ - id: status
607
+ unit:
608
+ env: [team//env/discord]
609
+ exec:
610
+ command: ["bun", "${homelab//scripts/lab-status/fetch-status.ts}"]
611
+ ```
612
+
613
+ A `secrets/` ref gives the secret's value, trimmed of surrounding whitespace,
614
+ and joins the redaction set; any other asset ref gives the asset's absolute
615
+ path. Putting a secret in argv is the author's choice (it shows up in the
616
+ process list); prefer an `env:` binding. A `${...}` body that is not an akm ref
617
+ (`${HOME}`) is left as text. A ref no bundle owns fails the unit, naming it,
618
+ before anything is spawned.
562
619
 
563
620
  ### The output rule
564
621
 
@@ -623,13 +680,12 @@ failure reason.
623
680
  | non-zero exit | `non_zero_exit` | yes |
624
681
  | exceeded `timeout` | `timeout` | yes |
625
682
  | run cancelled (`Ctrl-C`, `--timeout`, budget) | `aborted` | yes |
626
- | binary missing / working directory unusable | `spawn_failed` | yes |
683
+ | binary missing / working directory missing | `spawn_failed` | yes |
627
684
  | **stdout** capture never completed | `exec_capture_incomplete` | **no** (the command already ran) |
628
685
  | **stderr** capture never completed | — (unit succeeds; a warning says the stderr tail may be missing) | — |
629
686
  | stdout past the retention limit, **and** the unit declares `output:` | `exec_output_limit` | **no** (deterministic) |
630
687
  | stdout past the retention limit, no `output:` schema | — (unit succeeds; artifact marked truncated) | — |
631
688
  | `AKM_*` context too large for **this platform** to spawn | `exec_context_too_large` | **no** (an authoring/data problem) |
632
- | `cwd` resolved outside its base | `exec_cwd_escape` | **no** (tampering, never transient) |
633
689
 
634
690
  `non_zero_exit` in `retry.on` re-runs a command that already ran, and a
635
691
  command's exit is usually deterministic, so the retry mostly repeats the
@@ -642,8 +698,10 @@ is exactly what makes a `test` step a **gate**. With `on_error: continue` the
642
698
  failure is recorded in the step's evidence and the completion gate decides.
643
699
 
644
700
  On timeout or cancellation the child's whole **process group** gets a
645
- SIGTERM→SIGKILL ladder, so a command that spawned its own children does not
646
- leave them orphaned.
701
+ SIGINT→SIGTERM→SIGKILL ladder (each signal after a grace period of 5 seconds, for
702
+ a command still running), so a command that spawned its own children does not
703
+ leave them orphaned. Windows has no process group; there the first signal ends
704
+ the command itself.
647
705
 
648
706
  ### Output limits
649
707
 
@@ -689,9 +747,10 @@ want the whole thing, have it write to a file and print the **path**:
689
747
 
690
748
  ### Context reaching the command
691
749
 
692
- A frozen argv is never interpolated (this format has no substitution language),
693
- so data reaches an exec unit as **environment**, the argv analogue of the
694
- context blocks a model unit gets in its prompt:
750
+ A frozen argv never carries run data (this format has no substitution language
751
+ for params or step output; the only substitution is a [`${ref}` token](#ref-in-argv-and-cwd)
752
+ naming an asset), so data reaches an exec unit as **environment**, the argv
753
+ analogue of the context blocks a model unit gets in its prompt:
695
754
 
696
755
  | Variable | Value |
697
756
  | --- | --- |
@@ -724,7 +783,7 @@ Where those numbers come from:
724
783
  - **macOS** has no per-string cap; its binding constraint is `ARG_MAX`
725
784
  (262 144 bytes) over `argv` + `environ` *combined*. The 128 KiB total keeps
726
785
  akm's own contribution to half of that, leaving the rest for the argv, the
727
- environment allowlist and your `env:` bindings.
786
+ rest of the environment and your `env:` bindings.
728
787
  - **Windows** caps a single user-defined environment variable at 32 767
729
788
  characters (`SetEnvironmentVariable`), and the environment block has limits of
730
789
  the same order.
@@ -768,42 +827,32 @@ command would have to handle both shapes, and the spill file would have to be
768
827
  placed and cleaned up. A stable contract plus
769
828
  an explicit error is the smaller, more predictable surface.
770
829
 
771
- ### The child's environment is an allowlist
830
+ ### The child's environment
772
831
 
773
- An exec unit's command does **not** inherit akm's environment. The child starts
774
- from an **empty** environment and is built in three layers, in this order:
832
+ An exec unit's command inherits the environment akm runs in, as a command typed in
833
+ your shell would, and nothing is filtered out of it: `PATH`, `HOME`, locale and
834
+ toolchain variables, and any credential or proxy setting of the process that ran
835
+ `akm workflow run` reach the command. It is built in three layers, in this order:
775
836
 
776
- 1. the **default allowlist** below, copied through from akm's own environment
777
- (plus any names the unit adds with `pass_env:`);
837
+ 1. akm's own environment, with the directories this akm resolved set over it;
778
838
  2. the unit's resolved **`env:` bindings**;
779
839
  3. the engine-authored **`AKM_*` context** — last, so a binding can never
780
840
  shadow it.
781
841
 
782
- The default allowlist is exactly these names (a name absent from akm's own
783
- environment is simply absent from the child):
842
+ The directories are `AKM_CONFIG_DIR`, `AKM_DATA_DIR`, `AKM_CACHE_DIR` and
843
+ `AKM_STATE_DIR`, set to the ones the akm that started the command resolved (from
844
+ `AKM_*_DIR`, `XDG_*_HOME` or the platform default), and `AKM_BUNDLE_DIR` when that
845
+ akm had one. A step that runs `akm` therefore uses the same bundle, config, data,
846
+ cache and state. Binding one of them in `env:` overrides it. When a scheduled
847
+ task runs the workflow, `AKM_EVENT_SOURCE` is set (when the environment has
848
+ none), so a command that calls `akm` records machine traffic, not user demand; a
849
+ direct `akm workflow run` leaves it as it found it.
784
850
 
785
- | Group | Names | Why |
786
- | --- | --- | --- |
787
- | Command resolution | `PATH` | without it only an absolute `command[0]` can be spawned |
788
- | Home | `HOME` | the config/cache root git, npm, bun, cargo and ssh all read |
789
- | Identity | `USER`, `LOGNAME`, `SHELL` | read by git/ssh and by tools that re-exec a login shell |
790
- | Locale | `LANG`, `LC_ALL`, `LC_CTYPE` | without a locale, non-ASCII stdout — *which is this unit's artifact* — gets mangled |
791
- | Terminal / clock | `TERM`, `TZ` | some CLIs abort with no `TERM`; `TZ` keeps printed timestamps stable |
792
- | Scratch space | `TMPDIR`, `TEMP`, `TMP` | POSIX and Windows temp roots |
793
- | Windows essentials | `SystemRoot`, `SystemDrive`, `WINDIR`, `COMSPEC`, `PATHEXT` | Windows **process creation itself** fails with an empty environment; `PATHEXT` is what makes `bun.exe`/`bun.cmd` resolvable at all |
794
- | Windows home/config | `USERPROFILE`, `HOMEDRIVE`, `HOMEPATH`, `APPDATA`, `LOCALAPPDATA`, `ProgramData`, `ProgramFiles` | the Windows analogues of `HOME` and the machine-wide install roots toolchain shims resolve against |
795
- | akm provenance | `AKM_EVENT_SOURCE` | a command that calls `akm` records machine traffic, not user demand |
796
-
797
- `PATH` is additionally supplemented with well-known user binary directories
798
- when akm is running in a scheduler context (cron/launchd/Task Scheduler) that
799
- stripped it — the same treatment an agent-harness child gets.
800
-
801
- Deliberately **not** on the list: credentials of any kind, cloud/CI variables,
802
- and the proxy family (`HTTP_PROXY` and friends — proxy URLs routinely embed
803
- credentials). Reach a required value with an exact named `env:` binding, or
804
- name a non-secret per-machine variable with `pass_env:`.
805
-
806
- #### `pass_env:` — widen the allowlist by name
851
+ Reach a fixed value or a secret with an exact named `env:` binding; what is
852
+ redacted from what the command prints is in the Redaction row of [the exec
853
+ contract](#the-exec-contract).
854
+
855
+ #### `pass_env:` — frozen, and it selects nothing
807
856
 
808
857
  ```yaml
809
858
  unit:
@@ -812,22 +861,20 @@ name a non-secret per-machine variable with `pass_env:`.
812
861
  pass_env: [CARGO_HOME, SCCACHE_DIR]
813
862
  ```
814
863
 
815
- Names only, 1–32 of them, matching `^[A-Za-z_][A-Za-z0-9_]*$`. Use it for a
816
- **per-machine** variable an `env:` binding cannot express — an env asset stores
817
- a committed *value*, so it cannot carry "whatever this build agent's
818
- `CARGO_HOME` happens to be".
819
-
820
- Values passed through this way are **not** redacted from the command's output
821
- the way `env:` binding values are, so never list a credential here.
864
+ `pass_env:` was the list of variable names an earlier release copied into a child
865
+ that started empty. A workflow that has it keeps loading, and the names are kept
866
+ in the frozen plan and in the unit's input hash, but they select nothing now: the
867
+ command already has the environment. Names only, matching
868
+ `^[A-Za-z_][A-Za-z0-9_]*$`.
822
869
 
823
870
  #### Binding a secret to a unit
824
871
 
825
872
  A unit's `env:` lists env assets by ref. A value inside an env asset can be a
826
- `${secret:<name>}` token, which akm replaces with a secret when the unit is
873
+ `${ref}` token, which akm replaces with the secret's value when the unit is
827
874
  dispatched. Say the bundle `team` holds `env/discord.env`:
828
875
 
829
876
  ```sh
830
- DISCORD_BOT_TOKEN=${secret:discord_bot_token}
877
+ DISCORD_BOT_TOKEN=${team//secrets/discord_bot_token}
831
878
  ```
832
879
 
833
880
  and the secret beside it, set with
@@ -843,33 +890,42 @@ env asset:
843
890
  command: ["node", "announce.mjs"]
844
891
  ```
845
892
 
846
- - `<name>` is read from the **env asset's own bundle's** `secrets/` directory.
847
- It is a path there, not a ref: `bundle//name` inside the token is **not** a
848
- bundle qualifier. `${secret:team//token}` reads `secrets/team/token` in the
849
- env asset's bundle.
893
+ - The token body is an akm ref, `[bundle//]conceptId`, resolved with the one
894
+ ref walk: `${team//secrets/discord_bot_token}` reads that secret from the
895
+ `team` bundle whichever bundle holds the env asset, and an unqualified
896
+ `${secrets/discord_bot_token}` resolves by the default bundle then
897
+ installation priority. A `secrets/...` ref gives the secret's value, trimmed
898
+ of surrounding whitespace; any other asset ref (`${scripts/x.sh}`) gives the
899
+ asset's absolute path. A `${...}` body that is not an akm ref (`${HOME}`) is
900
+ left as text.
850
901
  - It is the same token `akm env run` resolves. `akm env export` does not
851
902
  resolve it; it writes the token verbatim.
852
- - Freezing records the env ref, its key names and the secret names, never a
853
- value. Values and secrets are read at dispatch. A missing secret fails the
854
- step at dispatch ("frozen environment preflight failed") and nothing is
855
- injected.
903
+ - Freezing records the env ref, never a value. At each dispatch the unit's env
904
+ assets are read live with `resolveEnvBinding`, the same function `akm env run`
905
+ uses, so an edit to the env file, or to a secret, after the run started is
906
+ picked up by the next dispatch; there is no key-set check against the frozen
907
+ plan. A ref no bundle owns fails the step at dispatch ("frozen environment
908
+ preflight failed") and nothing is injected.
856
909
  - Each dispatch that reads the env asset records an `env_access` event with the
857
- ref, key names and secret names, never values.
858
- - Every value from an env asset is treated as sensitive, secret or not, and is
859
- redacted out of stdout, stderr and diagnostics before they are journaled. A
860
- non-secret value such as a channel id would be redacted from the output too,
861
- so pass it as a param or in `command:` instead.
862
- - `env:` needs a child process: it works on exec units and on agent and SDK
863
- engines. A unit on an `llm` engine that declares `env:` fails
864
- `env_unsupported`.
865
-
866
- #### Durable v4 (`irVersion: 5`) forbids `inherit_env`
910
+ ref and key names, never values.
911
+ - Redaction covers secrets, not configuration. A value substituted from a
912
+ `secrets/` ref is treated as sensitive and redacted out of stdout, stderr and
913
+ diagnostics before they are journaled. The rest of an env asset, such as a URL
914
+ or a channel id, reaches the journal and the next step unredacted. A
915
+ credential typed straight into an env file is not redacted, so keep
916
+ credentials in `secrets/` and bind them with a `${secrets/name}` token.
917
+ - `env:` needs a child process: it works on exec units and on every unit that
918
+ runs an agent, whether on a harness or on akm's own runtime. A model call that
919
+ runs no agent cannot take a per-unit environment and fails `env_unsupported`.
920
+
921
+ #### Durable v4 (`irVersion: 8`) forbids `inherit_env`
867
922
 
868
923
  Every new workflow start freezes the durable plan v4 family's current
869
- executable format, `irVersion: 5`. It rejects `inherit_env: true` and any other
870
- request for whole-process inheritance; use exact named environment bindings
871
- and `pass_env:` instead. Both mechanisms are dispatch-significant, keep the
872
- visible environment surface bounded, and form part of the unit's input hash.
924
+ executable format (`irVersion: 8`; a plan frozen earlier decodes when it holds no
925
+ model step). It rejects
926
+ `inherit_env: true`, which is not needed: the command inherits akm's
927
+ environment. Exact named `env:` bindings are dispatch-significant and form part
928
+ of the unit's input hash.
873
929
 
874
930
  The historical `inherit_env` spelling is unsupported.
875
931
 
@@ -877,8 +933,8 @@ The historical `inherit_env` spelling is unsupported.
877
933
 
878
934
  `akm show <workflow> --format json` summarizes each step under
879
935
  `steps[].orchestration`. For an exec step that summary carries an `exec` object
880
- and **no `engine`/`model`** — an exec unit names no engine, so reporting the
881
- workflow's `defaults.engine` there would describe a dispatch that never
936
+ and **no `engine`/`model`** — an exec unit runs on no connection or harness, so
937
+ reporting the workflow's `defaults` there would describe a dispatch that never
882
938
  happens. Field presence is the discriminator, the same way `fanOut` marks a
883
939
  `map` step:
884
940
 
@@ -906,8 +962,8 @@ happens. Field presence is the discriminator, the same way `fanOut` marks a
906
962
  step's output. Every byte is already visible in the workflow file (and stored
907
963
  verbatim in `plan_json`) — which is also why you never inline a secret there.
908
964
  - `cwd` and `passEnv` appear only when the unit declares them. `passEnv` is a
909
- list of variable **names**; no value is ever projected. New v4 plans never
910
- carry `inheritEnv`.
965
+ list of variable **names** that select nothing; no value is ever projected. New
966
+ v4 plans never carry `inheritEnv`.
911
967
  - `timeoutMs` is still reported, because an exec unit really does inherit
912
968
  `defaults.timeout` — that number is true for it.
913
969
 
@@ -920,29 +976,21 @@ Exec units sit inside the existing workflow trust model — see
920
976
  [Security: workflow sources are executed code](https://github.com/itlackey/akm/blob/main/docs/guides/run-workflows.md#security-workflow-sources-are-executed-code).
921
977
  They do not widen it, and they do not narrow it:
922
978
 
923
- - **The child's environment is an allowlist, not an inheritance.** Be clear
924
- about what that does and does not buy. It does *not* stop a determined
925
- attacker: a command that runs at all can read the same credentials off disk
926
- that the environment would have handed it, and a workflow source is executed
927
- code either way. What it does buy is real but narrower — it bounds
928
- **accidental** exposure (the shell or CI job that invoked `akm` routinely
929
- exports tokens for unrelated services, and a third-party step that merely
930
- prints its environment, or a tool that ships one in a crash report, should
931
- not get them for free), it makes the environment surface **explicit and
932
- reviewable** (this list plus lines in the frontmatter diff, rather than
933
- "whatever the invoking shell happened to export"), and it **matches the
934
- convention akm already applies to spawned children** — agent-harness children
935
- have always been built from `envPassthrough` this way, and exec units now use
936
- the same mechanism rather than a second one. Operators who need a harder
937
- boundary still scope the *akm process* (dedicated account, ephemeral working
979
+ - **The child inherits akm's environment.** The command runs with your
980
+ environment, as if you had typed it in your shell, so a credential the shell or
981
+ CI job exported reaches it, and a value it inherited is not redacted from what
982
+ it prints. That is the same trust a workflow source already has: a command that
983
+ runs at all can read the same credentials off disk. Operators who need a
984
+ boundary scope the *akm process* (dedicated account, ephemeral working
938
985
  directory, external network/filesystem policy); that is the boundary that
939
986
  actually holds.
940
987
  - **Secrets come from `env:` bindings by name.** The frozen plan carries only
941
988
  the ref names, the replay hash carries only the ref names, and the resolved
942
989
  values are collected and scrubbed out of stdout, stderr, and the failure
943
990
  diagnostic by the same redaction contract every other dispatch uses — before
944
- anything is journaled. Never inline a secret into `command:`; argv is stored
945
- verbatim in `plan_json`.
991
+ anything is journaled. Never inline a secret value into `command:`; argv is
992
+ stored as authored in `plan_json`. A `${secrets/name}` token in argv is
993
+ stored as the token and replaced only when the unit dispatches.
946
994
  - **Read a workflow before you run it.** `exec:` makes what a workflow will run
947
995
  explicit and auditable in one place, which is a real improvement over
948
996
  instructing a model to "run the tests" — but a bundle you do not trust is
@@ -989,18 +1037,16 @@ Raising one never raises the others:
989
1037
  | --- | --- | --- |
990
1038
  | `map.concurrency` | the step | `workflow.defaultMapConcurrency`, else **4** |
991
1039
  | `execution.maxConcurrency` | `workflow.maxConcurrency` config | CPU-derived `min(16, max(1, cores − 2))` |
992
- | the selected LLM engine's concurrency | `engines.<name>.concurrency` | **1** for a loopback endpoint, **4** for a remote one |
1040
+ | the selected connection's concurrency | `connections.<name>.concurrency` | **1** for a loopback endpoint, **4** for a remote one |
993
1041
  | the host CPU safety cap | nothing — reapplied at dispatch | `min(16, max(1, cores − 2))` |
994
1042
 
995
- The engine limit is per **endpoint kind** on purpose. A local model server (LM
1043
+ The connection limit is per **endpoint kind** on purpose. A local model server (LM
996
1044
  Studio, Ollama) has one loaded model, and concurrent inference makes it reload
997
1045
  and return HTTP 500 — a hard failure, so loopback endpoints stay at 1 and a
998
1046
  `map` against a local model is still effectively serial unless you raise
999
- `engines.<name>.concurrency` yourself. Remote providers fail softly (a
1047
+ `connections.<name>.concurrency` yourself. Remote providers fail softly (a
1000
1048
  retryable 429), and four concurrent completions is well inside any hosted
1001
- provider's entry tier. Agent engines carry no concurrency limit of their own —
1002
- except an `opencode-sdk` engine that sets `llmEngine`, which inherits that
1003
- fallback engine's limit.
1049
+ provider's entry tier. A harness carries no concurrency limit of its own.
1004
1050
 
1005
1051
  #### What counts as a loopback endpoint
1006
1052
 
@@ -1022,15 +1068,15 @@ exactly as single-model as one on `127.0.0.1`.
1022
1068
  re-serializes the dotted form to the hex one before the check ever sees it. A
1023
1069
  mapped public address such as `[::ffff:8.8.8.8]` still reads as remote. The
1024
1070
  deprecated IPv4-compatible form `[::127.0.0.1]` is not recognized; if you use
1025
- it, set `engines.<name>.concurrency: 1`.
1071
+ it, set `connections.<name>.concurrency: 1`.
1026
1072
 
1027
1073
  The check is **purely syntactic — it never resolves a name.** A frozen plan has
1028
1074
  to come out the same on your laptop, on CI, and on a machine with no network at
1029
1075
  all, and a DNS lookup would make the frozen width depend on what a resolver
1030
1076
  happened to answer. So a *name* that resolves to loopback (a hosts-file alias,
1031
1077
  `host.docker.internal`, an internal DNS record) is treated as **remote**; point
1032
- the engine at the address itself, or set `engines.<name>.concurrency: 1`
1033
- explicitly. In the other direction the classification is deliberately
1078
+ the connection's endpoint at the address itself, or set
1079
+ `connections.<name>.concurrency: 1` explicitly. In the other direction the classification is deliberately
1034
1080
  conservative: an endpoint akm cannot parse at all is treated as loopback, since
1035
1081
  freezing 4 for a config it does not understand is the failure worth avoiding.
1036
1082
 
@@ -1104,17 +1150,17 @@ verdict that cannot change. So a step whose unit is `exec:` still has its
1104
1150
  artifact judged and can still be failed by the verdict; a rejection simply lands
1105
1151
  on the first evaluation, carrying the same missing criteria and feedback the
1106
1152
  one-shot case does. `gate.max_loops` on such a step is capped at 1 rather than
1107
- rejected, and an engine step's declared `max_loops` is untouched. This is the
1153
+ rejected, and a model step's declared `max_loops` is untouched. This is the
1108
1154
  same reasoning that makes an exec unit's `output:` schema miss fail without a
1109
1155
  corrective re-dispatch.
1110
1156
 
1111
1157
  **Fail-closed verification.** With no non-empty `### gate` rubric, no
1112
- verification runs. When a rubric is present, the workflow requires
1113
- `workflow.judgeEngine` to name a configured LLM or agent engine before the
1114
- plan can be frozen — see
1158
+ verification runs. When a rubric is present, the workflow requires a
1159
+ connection or a harness to judge it before the plan can be frozen: the judge
1160
+ runs where model work runs (the default connection, else the default harness; see
1161
+ [Where each process runs](configuration.md#where-each-process-runs)) — see
1115
1162
  [Author's Guide: Troubleshooting](https://github.com/itlackey/akm/blob/main/docs/guides/author-workflows.md#troubleshooting)
1116
- if that engine isn't configured yet. That verifier invocation is frozen into
1117
- the run.
1163
+ if neither is configured yet. That verifier invocation is frozen into the run.
1118
1164
 
1119
1165
  Only a well-formed `complete: true` verdict advances a criteria-bearing step.
1120
1166
  A missing verifier, dispatch failure, or malformed result rejects the gate
@@ -1131,33 +1177,32 @@ across resumes**, not just the current invocation. Hitting a ceiling aborts
1131
1177
  the step's still-pending dispatches and fails the step with a
1132
1178
  `budget exceeded (<which> ceiling)` summary — budget exhaustion is a hard
1133
1179
  stop that ignores `on_error: continue`. Because the plan is frozen, raising a
1134
- budget means starting a new run.
1180
+ budget means starting a new run. Only units that run on akm's own runtime
1181
+ report token usage; a unit on a harness or a direct model call reports none
1182
+ and adds nothing to `max_tokens`.
1135
1183
 
1136
1184
  ## Model references
1137
1185
 
1138
1186
  Reference semantic aliases in `model:` fields instead of exact model ids so a
1139
- workflow stays harness-agnostic. Aliases are defined only in the installed and
1140
- optional user `models.json` files:
1187
+ workflow stays portable across machines. The standard aliases are `fast`,
1188
+ `balanced` and `reasoning`; each connection and harness says which of its models
1189
+ answers them (`connections.<name>.models`, `harnesses.<name>.models`; Claude Code
1190
+ ships a map of its own):
1141
1191
 
1142
- ```jsonc
1143
- {
1144
- "version": 1,
1145
- "aliases": {
1146
- "fast": { "claude": "claude-haiku-4-5", "opencode": "opencode/claude-haiku-4-5" },
1147
- "balanced": { "claude": "claude-sonnet-4-6", "opencode": "opencode/claude-sonnet-4-6" },
1148
- "reasoning": { "claude": "claude-opus-4-7", "opencode": "opencode/claude-opus-4-7" }
1149
- }
1150
- }
1192
+ ```yaml
1193
+ defaults: { model: balanced }
1194
+ steps:
1195
+ - id: review
1196
+ unit:
1197
+ model: reasoning
1151
1198
  ```
1152
1199
 
1153
- Resolution checks the selected engine name or canonical harness column. A
1154
- known alias without that column fails rather than guessing a provider model;
1155
- an unknown string is treated as an exact model selector. A column may itself
1156
- be an `engine`-backed indirection (0.9.15) rather than a literal model string
1157
- — see [Model-map files](configuration.md#model-map-files) — so a step naming
1158
- `model: fast` also benefits from whatever engine-backed mapping the operator
1159
- configured for the selected engine, with no workflow-authored change. See the [Author's Guide](https://github.com/itlackey/akm/blob/main/docs/guides/author-workflows.md#choosing-engines-and-models)
1160
- for guidance on which tier to pick per step.
1200
+ Resolution looks the alias up on the connection or harness the step runs on. A
1201
+ string that is not an alias is an exact model name and is used as written. An
1202
+ alias the connection does not map answers with that connection's first model; a
1203
+ harness with no model for it passes none and uses its own default. See
1204
+ [Aliases](configuration.md#aliases) for the full rules and the author's guide
1205
+ for [which tier to pick per step](https://github.com/itlackey/akm/blob/main/docs/guides/author-workflows.md#choosing-where-a-step-runs-and-which-model).
1161
1206
 
1162
1207
  ## See also
1163
1208
 
@@ -11,9 +11,7 @@ interruption without replaying completed units.
11
11
 
12
12
  Workflows are one of the execution surfaces AKM directly orchestrates: AKM
13
13
  retrieves every supported capability type, but a workflow's declared steps —
14
- not arbitrary indexed content — are what actually gets dispatched. See
15
- [Architecture: Core Principles](https://github.com/itlackey/akm/blob/main/docs/architecture/akm-core-principles.md) for
16
- that boundary.
14
+ not arbitrary indexed content — are what actually gets dispatched.
17
15
 
18
16
  This page is a short map. The full contract now lives across four pages,
19
17
  split by what you're doing:
@@ -24,8 +22,8 @@ split by what you're doing:
24
22
  someone else's bundle.
25
23
  - **[Author's Guide: Writing Workflows](https://github.com/itlackey/akm/blob/main/docs/guides/author-workflows.md)** —
26
24
  writing and testing a workflow definition: choosing a source format, the Markdown structure, a
27
- minimal complete example, common authoring mistakes, choosing engines and
28
- models, and engine-selection troubleshooting.
25
+ minimal complete example, common authoring mistakes, choosing where a step
26
+ runs and which model, and troubleshooting a missing harness or connection.
29
27
  - **[Workflow Schema](../reference/workflow-schema.md)** — the exhaustive,
30
28
  authoritative reference: every frontmatter key, the bare-reference grammar,
31
29
  failure policy, gates, and budget ceilings, with exact syntax.
@@ -41,7 +39,7 @@ For task- or schedule-driven workflow runs — an `akm task` bound to
41
39
 
42
40
  Markdown `.md` is the one workflow source format; it preserves AKM's full prose,
43
41
  gates, maps, typed artifacts, and exec vocabulary. New starts resolve source
44
- owners and executable targets, then freeze durable plan `irVersion` 5. A
42
+ owners and executable targets, then freeze durable plan `irVersion` 8. A
45
43
  stored plan is read back as it is: one frozen at another `irVersion` that
46
44
  still decodes runs, and one this akm cannot decode is abandoned by
47
45
  `akm workflow run` with a message naming how to start a new run. See