akm-cli 0.9.30 → 0.10.261001-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 (384) hide show
  1. package/CHANGELOG.md +438 -0
  2. package/README.md +10 -10
  3. package/ROADMAP.md +112 -0
  4. package/STABILITY.md +99 -57
  5. package/dist/api-node.mjs +20 -0
  6. package/dist/api.d.ts +23 -0
  7. package/dist/api.js +45 -0
  8. package/dist/assets/hints/cli-hints-full.md +15 -29
  9. package/dist/assets/hints/cli-hints-short.md +2 -2
  10. package/dist/assets/improve-strategies/default.json +3 -3
  11. package/dist/assets/prompts/consolidate-pair.md +9 -7
  12. package/dist/assets/stash-skeleton/README.md +1 -1
  13. package/dist/assets/tasks/improve/akm-improve-consolidate.yml +1 -1
  14. package/dist/cli/shared.js +31 -48
  15. package/dist/cli/unknown-flags.js +6 -43
  16. package/dist/cli.js +8 -34
  17. package/dist/commands/agent/contribute-cli.js +1 -1
  18. package/dist/commands/completions.js +1 -2
  19. package/dist/commands/config-cli.js +5 -28
  20. package/dist/commands/env/env-cli.js +5 -5
  21. package/dist/commands/env/secret-cli.js +2 -2
  22. package/dist/commands/feedback-cli.js +75 -49
  23. package/dist/commands/health/checks.js +41 -16
  24. package/dist/commands/health/plugin-staleness.js +52 -22
  25. package/dist/commands/improve/autonomy-gate.js +5 -3
  26. package/dist/commands/improve/consolidate/chunking.js +3 -10
  27. package/dist/commands/improve/consolidate/continuity-check.js +4 -4
  28. package/dist/commands/improve/consolidate/pair-pass.js +29 -10
  29. package/dist/commands/improve/consolidate.js +10 -65
  30. package/dist/commands/improve/distill/lesson-update.js +91 -0
  31. package/dist/commands/improve/distill-guards.js +1 -43
  32. package/dist/commands/improve/distill.js +148 -21
  33. package/dist/commands/improve/eligibility.js +14 -1
  34. package/dist/commands/improve/extract-cli.js +1 -1
  35. package/dist/commands/improve/extract-prompt.js +17 -7
  36. package/dist/commands/improve/extract.js +5 -7
  37. package/dist/commands/improve/improve-cli.js +125 -118
  38. package/dist/commands/improve/improve-strategies.js +8 -12
  39. package/dist/commands/improve/improve.js +134 -52
  40. package/dist/commands/improve/loop-stages.js +18 -5
  41. package/dist/commands/improve/planner.js +0 -1
  42. package/dist/commands/improve/preparation.js +40 -99
  43. package/dist/commands/improve/proactive-maintenance.js +2 -2
  44. package/dist/commands/improve/reflect-noise.js +3 -55
  45. package/dist/commands/improve/reflect.js +29 -34
  46. package/dist/commands/improve/retrieval-queries.js +37 -0
  47. package/dist/commands/improve/retrieval-scope.js +2 -2
  48. package/dist/commands/improve/salience.js +2 -9
  49. package/dist/commands/improve/session-asset.js +4 -1
  50. package/dist/commands/improve/stage.js +23 -12
  51. package/dist/commands/lint/index.js +5 -20
  52. package/dist/commands/observability-cli.js +3 -9
  53. package/dist/commands/proposal/drain.js +43 -6
  54. package/dist/commands/proposal/proposal-cli.js +11 -31
  55. package/dist/commands/proposal/repository.js +20 -14
  56. package/dist/commands/proposal/validators/proposal-quality-validators.js +0 -3
  57. package/dist/commands/read/knowledge.js +3 -3
  58. package/dist/commands/read/remember-cli.js +0 -13
  59. package/dist/commands/read/search-cli.js +29 -97
  60. package/dist/commands/read/search.js +0 -11
  61. package/dist/commands/read/show.js +0 -19
  62. package/dist/commands/sources/plugin-upgrade.js +164 -101
  63. package/dist/commands/sources/sources-cli.js +1 -15
  64. package/dist/commands/sources/stash-cli.js +6 -14
  65. package/dist/commands/tasks/tasks-cli.js +4 -115
  66. package/dist/commands/workflow/plan.js +11 -33
  67. package/dist/commands/workflow-cli.js +2 -7
  68. package/dist/core/adapter/adapter-ids.js +1 -2
  69. package/dist/core/adapter/adapters/agent-skills-adapter.js +0 -4
  70. package/dist/core/adapter/adapters/akm-adapter.js +9 -48
  71. package/dist/core/adapter/adapters/akm-lint.js +10 -26
  72. package/dist/core/adapter/adapters/akm-metadata.js +2 -72
  73. package/dist/core/adapter/adapters/akm-task-adapter.js +0 -5
  74. package/dist/core/adapter/adapters/akm-workflow-adapter.js +9 -28
  75. package/dist/core/adapter/adapters/dotenv-adapter.js +1 -20
  76. package/dist/core/adapter/adapters/generic-files-adapter.js +0 -10
  77. package/dist/core/adapter/adapters/llm-wiki-adapter.js +0 -4
  78. package/dist/core/adapter/adapters/tool-dir-shared.js +0 -24
  79. package/dist/core/adapter/adapters/website-snapshot-adapter.js +4 -4
  80. package/dist/core/adapter/recognize-match.js +3 -4
  81. package/dist/core/common.js +18 -2
  82. package/dist/core/config/config-schema.js +12 -15
  83. package/dist/core/config/config-types.js +6 -15
  84. package/dist/core/config/config-walker.js +6 -23
  85. package/dist/core/config/config.js +17 -80
  86. package/dist/core/config/engine-semantics.js +7 -3
  87. package/dist/core/config/schema/engines.js +7 -7
  88. package/dist/core/config/schema/improve-processes.js +10 -63
  89. package/dist/core/config/schema/improve.js +2 -21
  90. package/dist/core/config/schema/index-config.js +6 -39
  91. package/dist/core/env-secret-ref.js +2 -45
  92. package/dist/core/errors.js +1 -2
  93. package/dist/core/extra-params.js +2 -86
  94. package/dist/core/file-lock.js +12 -7
  95. package/dist/core/improve-result.js +13 -1
  96. package/dist/core/mutation-target.js +2 -2
  97. package/dist/core/paths.js +4 -0
  98. package/dist/core/recognition-util.js +4 -5
  99. package/dist/core/run-lock.js +1 -1
  100. package/dist/core/subprocess.js +49 -0
  101. package/dist/core/warn.js +21 -4
  102. package/dist/core/write-source.js +3 -3
  103. package/dist/execution/target-ref.js +1 -2
  104. package/dist/indexer/indexer.js +15 -6
  105. package/dist/indexer/passes/memory-inference.js +15 -6
  106. package/dist/indexer/search/db-search.js +49 -36
  107. package/dist/indexer/search/fts-query.js +0 -19
  108. package/dist/indexer/search/ranking.js +29 -1
  109. package/dist/indexer/usage/usage-events.js +21 -16
  110. package/dist/integrations/agent/engine-resolution.js +5 -2
  111. package/dist/integrations/agent/index.js +1 -1
  112. package/dist/integrations/agent/profiles.js +41 -98
  113. package/dist/integrations/agent/request-lowering.js +3 -3
  114. package/dist/integrations/harnesses/aider/index.js +5 -0
  115. package/dist/integrations/harnesses/amazonq/index.js +1 -0
  116. package/dist/integrations/harnesses/claude/config-import.js +2 -3
  117. package/dist/integrations/harnesses/claude/index.js +5 -0
  118. package/dist/integrations/harnesses/codex/index.js +1 -0
  119. package/dist/integrations/harnesses/copilot/index.js +1 -0
  120. package/dist/integrations/harnesses/gemini/index.js +1 -0
  121. package/dist/integrations/harnesses/index.js +18 -39
  122. package/dist/integrations/harnesses/opencode/agent-builder.js +60 -35
  123. package/dist/integrations/harnesses/opencode/config-import.js +121 -52
  124. package/dist/integrations/harnesses/opencode/index.js +22 -0
  125. package/dist/integrations/harnesses/opencode/plugin-layout.js +68 -0
  126. package/dist/integrations/harnesses/opencode/session-log-types.js +12 -0
  127. package/dist/integrations/harnesses/opencode/session-log-v1.js +72 -0
  128. package/dist/integrations/harnesses/opencode/session-log-v2.js +140 -0
  129. package/dist/integrations/harnesses/opencode/session-log.js +104 -115
  130. package/dist/integrations/harnesses/opencode/version.js +98 -0
  131. package/dist/integrations/harnesses/opencode-sdk/{harness.js → index.js} +5 -17
  132. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +105 -206
  133. package/dist/integrations/harnesses/opencode-sdk/v1-adapter.js +199 -0
  134. package/dist/integrations/harnesses/opencode-sdk/v2-adapter.js +254 -0
  135. package/dist/integrations/harnesses/opencode-sdk/wire.js +66 -0
  136. package/dist/integrations/harnesses/openhands/index.js +1 -0
  137. package/dist/integrations/harnesses/pi/index.js +1 -0
  138. package/dist/integrations/harnesses/shared.js +2 -0
  139. package/dist/integrations/harnesses/types.js +2 -0
  140. package/dist/llm/client.js +74 -14
  141. package/dist/output/cli-hints.js +1 -1
  142. package/dist/output/context.js +10 -19
  143. package/dist/output/format-exempt.js +5 -8
  144. package/dist/output/shapes/helpers.js +1 -22
  145. package/dist/output/shapes/passthrough.js +0 -1
  146. package/dist/output/shapes.js +3 -31
  147. package/dist/output/stdout.js +5 -1
  148. package/dist/output/text/command-format.js +6 -1
  149. package/dist/output/text/workflow-format.js +4 -22
  150. package/dist/scripts/akm-migrate-node.js +15769 -16731
  151. package/dist/scripts/akm-migrate.js +16339 -17297
  152. package/dist/setup/detect.js +10 -4
  153. package/dist/setup/harness-config-import.js +5 -14
  154. package/dist/setup/setup.js +1 -1
  155. package/dist/setup/steps/tasks.js +12 -13
  156. package/dist/sources/providers/git-stash.js +94 -13
  157. package/dist/storage/repositories/index-utility-repository.js +2 -32
  158. package/dist/storage/repositories/index-vec-repository.js +4 -0
  159. package/dist/storage/repositories/task-history-repository.js +0 -5
  160. package/dist/storage/repositories/workflow-runs-repository.js +5 -15
  161. package/dist/tasks/embedded.js +2 -1
  162. package/dist/tasks/run/run-command-task.js +9 -1
  163. package/dist/tasks/run/run-workflow-task.js +4 -3
  164. package/dist/tasks/run/task-history.js +0 -2
  165. package/dist/tasks/run/task-log.js +38 -1
  166. package/dist/tasks/schedule-gates.js +39 -0
  167. package/dist/tasks/scheduler-binding.js +0 -16
  168. package/dist/tasks/scheduler-sync.js +3 -97
  169. package/dist/tasks/source/bounded-document.js +1 -1
  170. package/dist/tasks/source/task-source-v4.js +2 -12
  171. package/dist/tasks/task-run-reserved-flags.js +2 -31
  172. package/dist/workflows/authoring/authoring.js +6 -6
  173. package/dist/workflows/compile.js +8 -65
  174. package/dist/workflows/exec/child-workflow.js +22 -3
  175. package/dist/workflows/exec/native-executor.js +12 -147
  176. package/dist/workflows/exec/run-workflow.js +31 -103
  177. package/dist/workflows/exec/step-work.js +9 -178
  178. package/dist/workflows/exec/unit-dispatch.js +0 -10
  179. package/dist/workflows/freeze/environment.js +3 -44
  180. package/dist/workflows/freeze/freeze.js +8 -41
  181. package/dist/workflows/freeze/targets/child-workflow.js +27 -63
  182. package/dist/workflows/freeze/targets/command.js +2 -16
  183. package/dist/workflows/freeze/targets/shell.js +0 -2
  184. package/dist/workflows/freeze/task-bindings.js +2 -28
  185. package/dist/workflows/ir/params.js +12 -2
  186. package/dist/workflows/parser.js +82 -232
  187. package/dist/workflows/plan.js +1 -1
  188. package/dist/workflows/renderer.js +10 -19
  189. package/dist/workflows/runtime/run-plan.js +11 -53
  190. package/dist/workflows/runtime/runs.js +4 -27
  191. package/dist/workflows/source-files.js +12 -16
  192. package/dist/workflows/source-semantics.js +1 -93
  193. package/docs/README.md +43 -42
  194. package/docs/agents/README.md +15 -0
  195. package/docs/agents/agent-install.md +14 -0
  196. package/docs/architecture/0.10-process-rules.md +827 -0
  197. package/docs/architecture/README.md +67 -0
  198. package/docs/architecture/adapters.md +258 -0
  199. package/docs/architecture/akm-architecture-decision-history.md +2055 -0
  200. package/docs/architecture/akm-core-principles.md +126 -0
  201. package/docs/architecture/architecture.md +578 -0
  202. package/docs/architecture/comparisons/claude-code-vs-akm-workflows-full.md +550 -0
  203. package/docs/architecture/decisions/0001-no-interpolation-attached-structured-context.md +72 -0
  204. package/docs/architecture/decisions/0002-unit-reuse-and-input-hash-scope.md +142 -0
  205. package/docs/architecture/decisions/0003-child-env-allowlist-and-provenance.md +189 -0
  206. package/docs/architecture/decisions/0004-task-input-contract-and-flag-coercion.md +97 -0
  207. package/docs/architecture/decisions/0005-task-result-vocabulary-and-legacy-read-mapping.md +108 -0
  208. package/docs/architecture/decisions/0006-task-source-version-routing.md +124 -0
  209. package/docs/architecture/decisions/0007-workflow-composition-bounds.md +83 -0
  210. package/docs/architecture/decisions/0008-task-binding-normalization.md +88 -0
  211. package/docs/architecture/decisions/0009-child-run-publication-column-parity.md +80 -0
  212. package/docs/architecture/decisions/0010-driver-protocol-cut.md +36 -0
  213. package/docs/architecture/decisions/0011-engine-run-loop-invariants.md +125 -0
  214. package/docs/architecture/decisions/README.md +62 -0
  215. package/docs/architecture/improvement.md +479 -0
  216. package/docs/architecture/internals/classification.md +154 -0
  217. package/docs/architecture/internals/fresh-host-rebuild-runbook.md +40 -0
  218. package/docs/architecture/internals/functional-contract-patterns.md +340 -0
  219. package/docs/architecture/internals/health-advisories.md +110 -0
  220. package/docs/architecture/internals/improve-workflow.md +719 -0
  221. package/docs/architecture/internals/indexing.md +498 -0
  222. package/docs/architecture/internals/registry-network-boundary.md +57 -0
  223. package/docs/architecture/internals/search.md +248 -0
  224. package/docs/architecture/internals/storage-locations.md +943 -0
  225. package/docs/architecture/persisted-data-compat.md +68 -0
  226. package/docs/architecture/reviews/env-secret-access.md +319 -0
  227. package/docs/architecture/runtime-boundary-design.md +153 -0
  228. package/docs/architecture/specs/0.9.0-close-out-plan.md +361 -0
  229. package/docs/architecture/specs/0.9.0-decisions.md +532 -0
  230. package/docs/architecture/specs/0.9.0-docs-code-drift-register.md +745 -0
  231. package/docs/architecture/specs/0.9.0-open-items-register.md +135 -0
  232. package/docs/architecture/specs/0.9.0-public-api-issue-backlog.md +740 -0
  233. package/docs/architecture/specs/0.9.0-release-surface-review.md +636 -0
  234. package/docs/architecture/specs/agent-command-engine-model-design.md +513 -0
  235. package/docs/architecture/specs/akm-0.9.0-bundle-adapter-spec.md +501 -0
  236. package/docs/architecture/specs/akm-0.9.0-ref-grammar-decision.md +291 -0
  237. package/docs/architecture/specs/akm-format-neutral-bundle-workspace-spec.md +2059 -0
  238. package/docs/architecture/specs/di-seams-plan.md +539 -0
  239. package/docs/architecture/specs/driver-protocol-keep-or-cut.md +275 -0
  240. package/docs/architecture/specs/fact-asset-type.md +142 -0
  241. package/docs/architecture/specs/improve-collapse-churn-detector-design.md +634 -0
  242. package/docs/architecture/specs/okf-support.md +148 -0
  243. package/docs/architecture/specs/ref.md +329 -0
  244. package/docs/architecture/specs/reviews/task-workflow-unification/README.md +72 -0
  245. package/docs/architecture/specs/reviews/task-workflow-unification/findings-consolidated.md +152 -0
  246. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-alternatives.md +352 -0
  247. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-bunqueue.md +300 -0
  248. package/docs/architecture/specs/reviews/task-workflow-unification/library-eval-openworkflow.md +402 -0
  249. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-1.md +758 -0
  250. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-2.md +645 -0
  251. package/docs/architecture/specs/reviews/task-workflow-unification/opus-review-3.md +602 -0
  252. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-adversarial.md +27 -0
  253. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-architecture.md +27 -0
  254. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-coverage.md +74 -0
  255. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r1-security.md +15 -0
  256. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-adversarial.md +132 -0
  257. package/docs/architecture/specs/reviews/task-workflow-unification/panel-r2-verification.md +147 -0
  258. package/docs/architecture/specs/stash-conventions-code-spec.md +275 -0
  259. package/docs/architecture/specs/stash-organization-conventions.md +377 -0
  260. package/docs/architecture/specs/task-workflow-format-unification.md +721 -0
  261. package/docs/architecture/specs/workflow-engine-buy-vs-build.md +231 -0
  262. package/docs/architecture/specs/workflow-format-unification.md +432 -0
  263. package/docs/architecture/testing/manual-testing-checklist.md +3411 -0
  264. package/docs/architecture/testing/okf-v0.2-conformance-runbook.md +924 -0
  265. package/docs/architecture/testing/task-workflow-manual-tests.md +1720 -0
  266. package/docs/architecture/testing/testing-workflow.md +446 -0
  267. package/docs/architecture/workflow-engine.md +223 -0
  268. package/docs/guides/README.md +33 -0
  269. package/docs/guides/author-bundles.md +310 -0
  270. package/docs/guides/author-workflows.md +490 -0
  271. package/docs/guides/bundles.md +323 -0
  272. package/docs/guides/capture-knowledge.md +136 -0
  273. package/docs/guides/claude-code-vs-akm-workflows.md +29 -0
  274. package/docs/guides/concepts.md +93 -0
  275. package/docs/guides/discover-and-load.md +158 -0
  276. package/docs/guides/getting-started.md +240 -0
  277. package/docs/guides/improve-the-library.md +247 -0
  278. package/docs/guides/knowledge-management.md +18 -0
  279. package/docs/guides/recipes/headless-install.md +97 -0
  280. package/docs/guides/recipes/website-source.md +28 -0
  281. package/docs/guides/run-workflows.md +279 -0
  282. package/docs/guides/scheduling.md +131 -0
  283. package/docs/guides/use-with-any-agent.md +174 -0
  284. package/docs/guides/wikis.md +81 -0
  285. package/docs/integration/bundling-akm.md +7 -6
  286. package/docs/maintainers/README.md +19 -0
  287. package/docs/maintainers/curate-workmap.md +335 -0
  288. package/docs/maintainers/eval.md +3 -0
  289. package/docs/maintainers/local-development.md +108 -0
  290. package/docs/maintainers/release-checklist.md +135 -0
  291. package/docs/migration/README.md +4 -2
  292. package/docs/migration/release-notes/0.0.13.md +1 -1
  293. package/docs/migration/release-notes/0.1.0.md +1 -1
  294. package/docs/migration/release-notes/0.10.0.md +201 -0
  295. package/docs/migration/release-notes/0.2.0.md +1 -1
  296. package/docs/migration/release-notes/0.3.0.md +1 -1
  297. package/docs/migration/release-notes/0.5.0.md +1 -1
  298. package/docs/migration/release-notes/0.6.0.md +1 -1
  299. package/docs/migration/release-notes/0.7.0.md +1 -1
  300. package/docs/migration/release-notes/0.7.3.md +2 -2
  301. package/docs/migration/release-notes/0.7.4.md +1 -1
  302. package/docs/migration/release-notes/0.7.5.md +1 -1
  303. package/docs/migration/release-notes/0.8.0.md +1 -1
  304. package/docs/migration/release-notes/0.9.0.md +1 -1
  305. package/docs/migration/release-notes/0.9.14.md +1 -1
  306. package/docs/migration/release-notes/0.9.15.md +1 -1
  307. package/docs/migration/release-notes/0.9.16.md +1 -1
  308. package/docs/migration/release-notes/0.9.17.md +1 -1
  309. package/docs/migration/release-notes/0.9.19.md +1 -1
  310. package/docs/migration/release-notes/0.9.2.md +1 -1
  311. package/docs/migration/release-notes/README.md +28 -31
  312. package/docs/migration/v0.5-to-v0.6.md +759 -0
  313. package/docs/migration/v0.8-to-v0.9.md +1 -1
  314. package/docs/migration/v0.9-to-v0.10.md +507 -0
  315. package/docs/plans/0.9.2-agent-command-workflow-plan.md +423 -0
  316. package/docs/posts/README.md +30 -0
  317. package/docs/posts/akm-command-tour.md +495 -0
  318. package/docs/posts/akm-logo-sized.webp +0 -0
  319. package/docs/posts/belief-aware-memory-12.md +139 -0
  320. package/docs/posts/config-v2-lessons-16.md +191 -0
  321. package/docs/posts/improve-loop-autonomous-10.md +225 -0
  322. package/docs/posts/improve-pipeline-debugging-0803.md +179 -0
  323. package/docs/posts/intro-part-01.md +76 -0
  324. package/docs/posts/intro-part-02.md +221 -0
  325. package/docs/posts/intro-part-03.md +190 -0
  326. package/docs/posts/intro-part-04.md +221 -0
  327. package/docs/posts/llm-mode-reflect-13.md +166 -0
  328. package/docs/posts/openpalm-built-on-akm.md +86 -0
  329. package/docs/posts/progressive-disclosure-06.md +129 -0
  330. package/docs/posts/proposal-safety-net-15.md +112 -0
  331. package/docs/posts/release-0.5.0.md +247 -0
  332. package/docs/posts/release-0.6.0.md +117 -0
  333. package/docs/posts/release-0.7.0.md +159 -0
  334. package/docs/posts/release-0.8.0.md +332 -0
  335. package/docs/posts/scattered-skills-05.md +100 -0
  336. package/docs/posts/task-assets-persistent-workflows-11.md +222 -0
  337. package/docs/posts/team-skills-07.md +198 -0
  338. package/docs/posts/wiki-agent-knowledge-08.md +223 -0
  339. package/docs/posts/workflows-vaults-09.md +321 -0
  340. package/docs/product-surface.md +54 -0
  341. package/docs/reference/README.md +2 -2
  342. package/docs/reference/api.md +65 -0
  343. package/docs/reference/asset-types.md +166 -0
  344. package/docs/reference/bundle-types.md +2 -4
  345. package/docs/reference/cli.md +163 -192
  346. package/docs/reference/configuration.md +101 -20
  347. package/docs/reference/data-and-telemetry.md +2 -2
  348. package/docs/reference/env-and-secrets.md +126 -0
  349. package/docs/reference/memory.md +124 -0
  350. package/docs/reference/refs.md +156 -0
  351. package/docs/reference/registry.md +489 -0
  352. package/docs/reference/supported-formats.md +3 -4
  353. package/docs/reference/tasks.md +12 -19
  354. package/docs/reference/website-sources.md +141 -0
  355. package/docs/reference/workflow-schema.md +89 -317
  356. package/docs/reference/workflows.md +20 -48
  357. package/package.json +23 -16
  358. package/schemas/akm-config.json +2 -243
  359. package/schemas/akm-task.json +2 -3
  360. package/schemas/akm-workflow.json +47 -84
  361. package/dist/assets/improve-strategies/catchup.json +0 -41
  362. package/dist/assets/improve-strategies/proactive-maintenance.json +0 -24
  363. package/dist/assets/improve-strategies/quick.json +0 -17
  364. package/dist/assets/improve-strategies/reflect-distill.json +0 -29
  365. package/dist/assets/improve-strategies/thorough.json +0 -49
  366. package/dist/assets/prompts/retrieval-relevance-judge.md +0 -6
  367. package/dist/assets/tasks/improve/akm-improve-catchup.yml +0 -6
  368. package/dist/assets/tasks/improve/akm-improve-frequent.yml +0 -4
  369. package/dist/assets/tasks/improve/akm-improve-nightly.yml +0 -4
  370. package/dist/cli/retired-commands.js +0 -118
  371. package/dist/commands/improve/retrieval-gate.js +0 -132
  372. package/dist/commands/tasks/validate.js +0 -176
  373. package/dist/core/config/legacy-source-shape-shim.js +0 -117
  374. package/dist/indexer/feedback/utility-policy.js +0 -75
  375. package/dist/integrations/harnesses/ids.js +0 -28
  376. package/dist/tasks/source/task-source-v3-frozen.js +0 -424
  377. package/dist/tasks/source/task-to-v4.js +0 -863
  378. package/dist/workflows/exec/worktree.js +0 -372
  379. package/dist/workflows/freeze/child-output-references.js +0 -83
  380. package/dist/workflows/freeze/identity.js +0 -22
  381. package/dist/workflows/freeze/targets/script.js +0 -50
  382. package/dist/workflows/freeze/targets/task.js +0 -124
  383. package/dist/workflows/github-yaml.js +0 -506
  384. package/dist/workflows/runtime/run-outputs.js +0 -80
@@ -0,0 +1,67 @@
1
+ # Architecture Index
2
+
3
+ How akm is built: system overview, normative specs, decision history, and
4
+ subsystem internals.
5
+
6
+ - [Architecture](architecture.md) -- How akm's bundles, cache, index, and registries fit together
7
+ - [Core Principles](akm-core-principles.md) -- Design principles and constraints
8
+ - [Adapters](adapters.md) -- The `BundleAdapter` contract: what a bundle's files *are*, how they're indexed, linted, and written
9
+ - [Architecture: The Workflow Engine](workflow-engine.md) -- How a workflow compiles to a frozen plan, persists run/unit state, dispatches work, and resumes without replaying completed steps
10
+ - [Architecture: The Improvement Loop](improvement.md) -- Purpose and boundary of the improvement loop
11
+ - [Runtime Boundary Design](runtime-boundary-design.md) -- Isolating `bun:sqlite`/`Bun.*` from the core
12
+ - [Architecture Decision History](akm-architecture-decision-history.md) -- ADR-style record of the major architecture rulings
13
+
14
+ ## Specs (`specs/`)
15
+
16
+ Normative specifications and binding conventions.
17
+
18
+ - [OKF format support](specs/okf-support.md) -- OKF is a first-class format supported through the built-in `okf` adapter
19
+ - [0.9.0 surface decisions](specs/0.9.0-decisions.md) -- The decision record (D1-D12) behind the 0.9.0 breaking changes
20
+ - [Bundle & Adapter Spec (0.9.0)](specs/akm-0.9.0-bundle-adapter-spec.md) -- Normative spec for bundles, adapters, and bundle recognition
21
+ - [Ref Grammar Decision (0.9.0)](specs/akm-0.9.0-ref-grammar-decision.md) -- The `[bundle//]conceptId` ref grammar
22
+ - [Ref Format](specs/ref.md) -- Wire format for asset references
23
+ - [Format-Neutral Bundle Workspace Spec](specs/akm-format-neutral-bundle-workspace-spec.md) -- The format-neutral workspace model
24
+ - [Agent, Command, Engine, and Model Resolution](specs/agent-command-engine-model-design.md) -- Approved target semantics for native agent/command bundles, configuration cascading, model maps, and dispatch
25
+ - [0.9.2 Agent/Command/Task/Workflow Implementation Plan](../plans/0.9.2-agent-command-workflow-plan.md) -- Sequenced work packages, [GitHub milestone tracker](https://github.com/itlackey/akm/issues/801), migration rules, support boundaries, and release evidence for the coherent execution MVP
26
+ - [Fact Asset Type](specs/fact-asset-type.md) -- The `fact` asset type
27
+ - [Bundle Conventions Code Spec](specs/stash-conventions-code-spec.md) -- Code-level bundle conventions
28
+ - [Bundle Organization Conventions](specs/stash-organization-conventions.md) -- How a bundle is laid out
29
+ - [DI Seams Plan](specs/di-seams-plan.md) -- Dependency-injection seams used by the test suite
30
+ - [Improve Collapse/Churn Detector](specs/improve-collapse-churn-detector-design.md) -- Longitudinal collapse/churn detection design (§6.3 is the operator runbook referenced by `akm health`)
31
+
32
+ Historical review registers (0.9.0 release-review audit trail, kept for provenance, not normative going forward):
33
+
34
+ - [0.9.0 Docs–Code Drift Register](specs/0.9.0-docs-code-drift-register.md) -- Ruled record of places documentation and code disagreed, and open-intent questions (Q-01..Q-19)
35
+ - [0.9.0 Public API Issue Backlog](specs/0.9.0-public-api-issue-backlog.md) -- Implementation-only findings from the CLI surface review
36
+ - [0.9.0 Release Surface Review](specs/0.9.0-release-surface-review.md) -- Reconciled action list from the end-to-end user-facing surface sweep
37
+
38
+ ## Internals (`internals/`)
39
+
40
+ Current-truth subsystem references.
41
+
42
+ - [Storage Locations](internals/storage-locations.md) -- Authoritative inventory of every on-disk read/write path
43
+ - [Search](internals/search.md) -- Hybrid search architecture and scoring
44
+ - [Indexing](internals/indexing.md) -- How the search index is built
45
+ - [Classification](internals/classification.md) -- Matcher and renderer behavior
46
+ - [Improve Workflow](internals/improve-workflow.md) -- `akm improve` command surface and pipeline reference
47
+ - [Health Advisories](internals/health-advisories.md) -- `akm health` advisory-to-action map for operators
48
+ - [Registry Network Boundary](internals/registry-network-boundary.md) -- Outbound registry request inventory, destination policy, redirects, and DNS guarantees
49
+ - [Functional Contract Patterns](internals/functional-contract-patterns.md) -- Quick reference for contributor pipelines and small process contracts
50
+ - [Fresh-Host Rebuild Runbook](internals/fresh-host-rebuild-runbook.md) -- Rebuild an akm install on a new machine
51
+ - [Persisted-Data Compatibility Contract](persisted-data-compat.md) -- What a reader owes data an earlier release wrote, per persisted format
52
+
53
+ ## Reviews (`reviews/`)
54
+
55
+ Point-in-time architecture reviews of a specific subsystem question.
56
+
57
+ - [Runtime secret resolution for in-process source fetchers](reviews/env-secret-access.md) -- Why secret reads are injected as a `SecretResolver` capability instead of imported inside the fetcher subgraph
58
+
59
+ ## Comparisons (`comparisons/`)
60
+
61
+ - [Workflow architecture: Claude Code workflows vs. akm workflows](comparisons/claude-code-vs-akm-workflows-full.md) -- Full technical comparison of the Claude Code `Workflow` tool and akm workflows; see [the short vendor-neutral guide](../guides/claude-code-vs-akm-workflows.md) for the decision-level version
62
+
63
+ ## Testing (`testing/`)
64
+
65
+ - [Testing Workflow](testing/testing-workflow.md) -- End-to-end, Docker, deployment, and upgrade validation, plus the coverage gap guide
66
+ - [Manual Testing Checklist](testing/manual-testing-checklist.md) -- Pre-release manual QA checklist
67
+ - [OKF v0.2 Conformance Re-Evaluation Runbook](testing/okf-v0.2-conformance-runbook.md) -- Acceptance procedure to re-run after changing adapters, indexing, refs, writes, or lint behavior
@@ -0,0 +1,258 @@
1
+ # Adapters
2
+
3
+ A **`BundleAdapter`** (`src/core/adapter/bundle-adapter.ts`) is the code that
4
+ decides what a bundle's files *are*, how they're indexed, how `akm lint`
5
+ validates them, and where a new item would be placed. 0.9.0 ships 11
6
+ built-in adapters — one per format in
7
+ [Supported Formats](../reference/supported-formats.md). This page is the
8
+ write-path and internals reference; that page is the compatibility table.
9
+
10
+ For read-only native tool bundles, recognition is runtime translation, not
11
+ conversion: the adapter projects native files into AKM's index/runtime shapes
12
+ while the source file remains authoritative. AKM does not synchronize native
13
+ formats, maintain translated canonical copies, or write agent/command assets
14
+ back through the Claude/OpenCode adapters. See
15
+ [Agent, Command, Engine, and Model Resolution](specs/agent-command-engine-model-design.md).
16
+
17
+ > **Stability note.** The adapter set, bundle-recognition rules, and the
18
+ > `bundles` config shape are still evolving — see [STABILITY.md](../../STABILITY.md).
19
+
20
+ ---
21
+
22
+ ## Probe order
23
+
24
+ Each bundle root is owned by exactly **one** adapter, decided once at
25
+ install/index time:
26
+
27
+ 1. If the bundle's config entry sets `components.<id>.adapter` explicitly,
28
+ that adapter wins — no detection runs.
29
+ 2. Otherwise, every built-in adapter's `looksLikeRoot(root)` probe runs in a
30
+ **fixed order**, most-specific markers first. The first probe that
31
+ returns `true` claims the root.
32
+ 3. If no probe fires, the bundle falls back to the `akm` adapter.
33
+
34
+ The order is pinned by `BUILTIN_ADAPTERS` (`src/core/adapter/adapters/index.ts`)
35
+ and enforced by the conformance suite's ordered-owner matrix — it, not any
36
+ prose spec listing, is authoritative:
37
+
38
+ ```text
39
+ website-snapshot -- root manifest.json {url, fetchedAt}
40
+ agent-skills -- a <name>/SKILL.md package at the bundle root
41
+ claude -- root CLAUDE.md + commands/|agents/|skills/
42
+ opencode -- opencode.json(c), or root AGENTS.md + a tool dir
43
+ dotenv -- every top-level dir is env/ and/or secrets/
44
+ akm-workflow -- a top-level .md with explicit type: workflow
45
+ akm-task -- a top-level valid task source v4 .yml (schedule optional)
46
+ llm-wiki -- root schema.md + pages/
47
+ akm -- .stash marker, or 2+ native subdirs, or fallback
48
+ okf -- root index.md, or any .md with frontmatter type
49
+ generic-files -- never auto-selected; explicit config only
50
+ ```
51
+
52
+ The rationale for the ordering:
53
+
54
+ - The three loosest probes — `llm-wiki`, `akm`, and `okf` — stay **last**.
55
+ Native AKM evidence wins before OKF because AKM Markdown is an OKF
56
+ superset; the `akm` probe is strict enough not to claim an OKF bundle
57
+ merely because it contains one familiar directory name.
58
+ - `akm.looksLikeRoot` fires on any root carrying a bundle-subdir-named
59
+ directory — which includes a `.claude`/`.opencode` tool dir (`commands/`,
60
+ `agents/`, `skills/`) and a dotenv bundle (`env/`, `secrets/`). So
61
+ `claude`/`opencode`/`dotenv` come **ahead of** `akm`; their tighter markers
62
+ claim those roots first, and `akm` still wins its own workspace root
63
+ (which those tighter probes reject).
64
+ - `website-snapshot`, `agent-skills`, `akm-workflow`, and `akm-task` carry
65
+ disjoint, specific markers that fire on none of the other roots, so they
66
+ sit at the front for clarity.
67
+ - `generic-files` is explicit-config-only — its `looksLikeRoot` never fires —
68
+ so it's last and can never shadow anything.
69
+
70
+ ---
71
+
72
+ ## `BundleAdapter` interface contract
73
+
74
+ Transcribed from `src/core/adapter/bundle-adapter.ts`:
75
+
76
+ ```ts
77
+ interface BundleAdapter {
78
+ readonly id: string;
79
+ readonly version: string; // feeds incrementality + fingerprints
80
+ readonly extensions: readonly string[]; // longest-match stripping + collision priority
81
+
82
+ // REQUIRED — single-file recognition primitive.
83
+ recognize(c: BundleComponent, file: FileContext): IndexDocument | null;
84
+
85
+ // OPTIONAL — full-component scan for non-per-file layouts (website
86
+ // snapshots, llm-wiki multi-file semantics). Absent -> the core walk
87
+ // (git-aware, symlink-safe, skip-dirs) drives recognize() per file.
88
+ index?(inst: BundleInstallation, c: BundleComponent): AsyncIterable<IndexDocument>;
89
+
90
+ // OPTIONAL — item-scoped incrementality. Default: identity (one file = one item).
91
+ affectedItems?(c: BundleComponent, changedPaths: string[]): string[];
92
+
93
+ // REQUIRED — native validation (change-transaction pre-commit + lint --fix).
94
+ // Adapters MUST NOT write and MUST NOT read the live filesystem: ctx serves
95
+ // a run snapshot with pending changes overlaid, plus a read-only
96
+ // resolveRef for link/xref existence.
97
+ validate(c: BundleComponent, changes: FileChange[], ctx: ValidateContext): Promise<Diagnostic[]>;
98
+
99
+ // OPTIONAL — the CLOSED-FORM set of existing-file placements/read aliases
100
+ // that could own `conceptId`, used for first-owner arbitration without
101
+ // reading authored bytes or walking the bundle.
102
+ readCandidates?(c: BundleComponent, conceptId: string): Array<{ path: string; conceptId: string }>;
103
+
104
+ // OPTIONAL — discovery.
105
+ directoryList?(c: BundleComponent): string[]; // owned dirs; feeds git exact-path staging
106
+ looksLikeRoot?(root: string): boolean; // install-time probe
107
+ }
108
+ ```
109
+
110
+ `recognize` and `validate` are required on every adapter; `index`,
111
+ `affectedItems`, `readCandidates`, `directoryList`, and
112
+ `looksLikeRoot` are optional capability methods. An adapter overriding `index()` must keep
113
+ `recognize()` coherent with it (conformance: `index()` == fold of
114
+ `recognize()` over the core walk) or declare component-level
115
+ incrementality.
116
+
117
+ `readCandidates` is intentionally distinct from `extensions`: extensions are
118
+ non-exhaustive walk hints. Read candidates preserve canonical directory
119
+ manifests (for example `skills/<name>/SKILL.md`) so lookup, index-backed show, and workflow runtime share one
120
+ physical-owner decision. Each candidate carries its canonical concept identity,
121
+ so a byte-denying ownership probe never has to infer identity from the query.
122
+ Path-derived recognition (`toCanonicalName`/`toAssetPath`, `src/core/asset/asset-placement.ts`)
123
+ is a deterministic function of a file's path, so its inverse — every physical
124
+ spelling that could own one conceptId — is computable in CLOSED FORM (#857):
125
+ the canonical placement under the type's own bundle subdir, the loose
126
+ off-canonical placement (an authored path elsewhere in the bundle, keyed off
127
+ its full path relative to the bundle root instead of the type subdir — this
128
+ is what `readCandidates` returns for it), and any type-specific duality (for
129
+ example `env`'s `.env`/`<name>.env` spellings for the "default" alias).
130
+ `readCandidates` enumerates the complete closed-form set directly from the
131
+ conceptId; no bundle walk is needed, so no scan bound applies. The shared
132
+ authority (`src/indexer/lookup/adapter-concept-owner.ts`) still probes every
133
+ candidate with a byte-denying `FileContext` before trusting it, so an
134
+ adapter returning a candidate the file does not actually own is harmless —
135
+ it is simply filtered out.
136
+
137
+ The core walk — the live indexer's per-dir walk, drained by
138
+ `drainDirDocuments` — is one implementation carrying the security policy
139
+ (symlink-safety, skip-dirs, git-awareness); adapters never reimplement it.
140
+
141
+ Cross-component ref existence is a **core** base check, not an adapter
142
+ concern.
143
+
144
+ ---
145
+
146
+ ## Placement
147
+
148
+ Adapters do not place new items. AKM-native writes resolve through AKM's own
149
+ flat type→directory placement table (`src/core/asset/asset-placement.ts`'s
150
+ `PLACEMENT_SPECS`), which is correct for akm-layout bundles — the only bundles
151
+ the write commands touch in practice. A per-adapter `placeNew()` existed
152
+ through 0.9 but nothing called it, and it was removed in 0.10. Supporting
153
+ writable bundles in another layout would need it back: see
154
+ [#1163](https://github.com/itlackey/akm/issues/1163).
155
+
156
+ ---
157
+
158
+ ## Write allowlists
159
+
160
+ Which bundles AKM-native write commands are allowed to touch at all is decided by a
161
+ small allowlist check, `assertAkmAssetWrite` (`src/core/write-source.ts`),
162
+ run before any write command touches the filesystem. It compares the target
163
+ bundle's detected (or configured) adapter id against an allowlist and throws
164
+ a `UsageError` on a miss.
165
+
166
+ The default allowlist is `["akm"]`. Two command families widen it explicitly:
167
+
168
+ | Command | Allowlist adds |
169
+ | --- | --- |
170
+ | `akm env create` / `env remove` / `secret set` | `dotenv` |
171
+ | `akm workflow create` | `akm-workflow` |
172
+
173
+ Every other adapter (`agent-skills`, `claude`, `opencode`, `akm-task`,
174
+ `generic-files`, and so on) is rejected by every AKM-native write command.
175
+ `akm task add` in particular uses the *default* allowlist (`akm` only), so a
176
+ standalone `akm-task` bundle is read-only through AKM-native write commands.
177
+
178
+ Reading, searching, and `akm lint` are unaffected by this allowlist — only
179
+ creating, editing, or deleting through AKM's own commands is restricted.
180
+ "Read-only" in [Supported Formats](../reference/supported-formats.md) means
181
+ this write-command restriction, not a filesystem permission.
182
+
183
+ This allowlist boundary is also where AKM's [execution
184
+ boundary](../guides/concepts.md) principle shows up on the write side: AKM
185
+ retrieves and validates every supported format, but it only lets its own
186
+ write commands mutate a narrow, explicitly-declared set of targets — it
187
+ does not widen write access to a format just because it can read it.
188
+
189
+ ---
190
+
191
+ ## Task adapter
192
+
193
+ The native and standalone `akm-task` paths delegate to the authoritative task
194
+ source parser, `parseTaskSource`, which accepts only `version: 4` (task
195
+ source v4). A task source v4 document declares exactly one executable
196
+ selector (`uses` or `run`), but its scheduling is OPTIONAL — a document with
197
+ no `schedule:` is valid and runnable manually. A `version: 3` or `version: 2`
198
+ document is no longer read by `src` at all: it fails closed with
199
+ `TASK_SCHEMA_VERSION_UNSUPPORTED`, naming `akm migrate` as the path forward.
200
+ See [Tasks](../reference/tasks.md) for the public source contract and the
201
+ migration path.
202
+
203
+ ---
204
+
205
+ ## Implementation caveats
206
+
207
+ A few adapter-specific behaviors are easy to assume differently from how
208
+ they actually work:
209
+
210
+ - **`agent-skills` recognition/validation are decoupled.** The per-change
211
+ half of `validate()` only inspects changes that resolve to an actual
212
+ `SKILL.md`, so an invalid skill is still indexed as `skill` (with its raw,
213
+ invalid name projected) and its field violations surface only for files
214
+ that exist. `missing-skill-md` is the exception and runs as a separate
215
+ directory pass over `ValidateContext.list`: a **top-level** directory that
216
+ holds files but no `SKILL.md` anywhere within three levels is flagged. A
217
+ package's own resource dirs (`pdf-processing/reference/`) are part of the
218
+ item, not candidate packages, and are never considered.
219
+ - **`claude`/`opencode` share one codec** (`tool-dir-shared.ts`) and differ
220
+ only in instruction filename and adapter/component ids. Both accept only
221
+ the canonical plural tool directories.
222
+ - **`dotenv` redaction is a hard, adapter-level contract.** No frontmatter
223
+ `type:` override can bypass it: `env` entries surface only key names,
224
+ `secret` entries surface only the file name, never content. A `.env`
225
+ file placed under `secrets/` is a secret (name-only), not an env group —
226
+ the directory gate wins over the `.env` suffix.
227
+ - **Task adapters share one task source parser.** A standalone `akm-task`
228
+ bundle and task files owned by the native `akm` adapter both route through
229
+ `parseTaskSource`, which accepts only `version: 4` (task source v4) — a
230
+ `version: 3` or `version: 2` document fails closed with
231
+ `TASK_SCHEMA_VERSION_UNSUPPORTED` and is never indexed, validated, or run.
232
+ Task source v4 requires exactly one `uses` or `run` executable selector,
233
+ but its `schedule:` is OPTIONAL. It recognizes `akm/command`, `commands/`,
234
+ `workflows/`, and `scripts/` targets, refuses the github-action `uses:`
235
+ variant entirely (removed in v4 — no equivalent spelling), and refuses
236
+ agent/task refs and unsupported actions. `.yaml` is a collection hint only:
237
+ recognition still gates on `.yml`, so the near miss is diagnosed but never
238
+ indexed or scheduled. See the [Tasks reference](../reference/tasks.md).
239
+ - **`llm-wiki`, `akm`, and `okf` all reserve `index.md`/`log.md`** as
240
+ structural files — never indexed as concepts, never valid write targets —
241
+ at any depth.
242
+ - **`okf`'s lenient wording is not a lenient gate.** `missing-type` and
243
+ broken-link findings are labelled `info:`/`warning:` in the diagnostic
244
+ text, but diagnostics carry no severity field: `akm lint` funnels every
245
+ finding into one `flagged` list, and `--fail-on-flagged` fails on any
246
+ non-empty list.
247
+ - **`generic-files` is the only adapter with no auto-detection at all.**
248
+ `looksLikeRoot` always returns `false`; a bundle only gets this adapter
249
+ through an explicit `components.<id>.adapter: "generic-files"` override.
250
+
251
+ ---
252
+
253
+ ## See also
254
+
255
+ - [Supported Formats](../reference/supported-formats.md) — the compatibility table this page's internals back
256
+ - [Asset Types](../reference/asset-types.md) — the `akm` adapter's 14 native asset types
257
+ - [Concepts](../guides/concepts.md) — the retrieval loop and execution boundary these adapters serve
258
+ - [Architecture](architecture.md) — sources, refs, the search pipeline, and the write-source chokepoint