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,174 @@
1
+ # Use AKM With Any Agent
2
+
3
+ AKM works from any shell-capable coding agent — Claude Code, OpenCode, Cursor,
4
+ Windsurf, Aider, and others. No plugins or SDKs are required for the core
5
+ workflow: a three-line system prompt block plus shell access is all an agent
6
+ needs to start using your bundle.
7
+
8
+ ## AGENTS.md / CLAUDE.md snippet
9
+
10
+ Add this block to your `AGENTS.md`, `CLAUDE.md`, or system prompt. It tells
11
+ the agent that `akm` is available and how to discover it.
12
+
13
+ ```markdown
14
+ ## Resources & Capabilities
15
+
16
+ You have access to a searchable library of scripts, skills, commands, agents,
17
+ knowledge, workflows, env files, secrets, lessons, memories, tasks, sessions,
18
+ and facts via the `akm` CLI. Use `akm -h` for details.
19
+ ```
20
+
21
+ That is the minimum. The agent can then run `akm curate <task>` at the start
22
+ of any complex task to pull the most relevant assets into context, and
23
+ `akm show <ref>` to load any asset by ref.
24
+
25
+ For a longer, agent-facing instruction block — usage patterns, flag guidance,
26
+ the full ref format — generate one instead of hand-writing it:
27
+
28
+ ```sh
29
+ akm hints --detail brief >> AGENTS.md
30
+ ```
31
+
32
+ The output is stable across patch releases and designed for agents rather
33
+ than humans: it describes the lookup workflow (`curate` → `show` →
34
+ `feedback`) and explains how refs work. It prints a short guide by default;
35
+ pass `--full` for the complete one.
36
+
37
+ ## The retrieval loop: curate, show, feedback
38
+
39
+ Once an agent knows `akm` is available, the working pattern is always the
40
+ same three calls:
41
+
42
+ ```sh
43
+ # 1. Curate assets for the current task
44
+ akm curate "deploy to production" --limit 3
45
+
46
+ # 2. Load the best match by ref from the curate output
47
+ akm show workflows/deploy-to-prod
48
+
49
+ # 3. Record outcome
50
+ akm feedback workflows/deploy-to-prod --positive --reason "Completed without issues"
51
+ ```
52
+
53
+ **Get refs from search.** Agents should call `akm search --detail agent` or
54
+ `akm curate` to discover refs — not guess them. The `ref` field in search
55
+ results is the stable token to pass to `akm show`. Feedback closes the loop.
56
+ Record `--negative` only when the asset's content is wrong or stale; a note that
57
+ simply did not fit the task is not negative feedback, so record nothing for it.
58
+ `akm feedback <ref> --negative --reason "<what is wrong and what should change>"`
59
+ flags the asset, and the next improve run may repair its description, title or
60
+ `when_to_use` from your reason. Once you have verified the correct fact, attach
61
+ the exact fix with `--replace`, `--with` and `--source`. `--positive` records
62
+ that an asset helped (it raises its ranking) and does not trigger a rewrite. See
63
+ [Improve the Library](improve-the-library.md) for what happens to feedback after
64
+ it's recorded.
65
+
66
+ ## Compatibility matrix
67
+
68
+ Not every agent surface integrates with AKM the same way. The table below
69
+ sets expectations by environment.
70
+
71
+ | Environment | Core support | Optional/extended support |
72
+ | --- | --- | --- |
73
+ | Shell-capable coding agent | `curate` / `show` / `feedback` via the CLI | Generated prompt block (`akm hints`) or a platform plugin |
74
+ | Claude/OpenCode project layout | Indexed in place through a `BundleAdapter` — no migration needed | `akm clone` selected assets into a writable bundle for editing |
75
+ | IDE assistant without shell access | Not a direct core integration | Requires a plugin, an `akm task`, or an external bridge that can shell out on the assistant's behalf |
76
+
77
+ A Claude Code `.claude` directory or an OpenCode `.opencode` directory is
78
+ recognized and indexed automatically once added as a source — see
79
+ [Bundle Types](../reference/bundle-types.md) for the full adapter list and
80
+ which formats are read-only versus writable in the current release.
81
+ The native directory remains the source of truth: AKM translates recognized
82
+ assets while reading the bundle and does not synchronize, copy, or write them
83
+ back. The approved target execution rules for these translated agents and
84
+ commands are documented in
85
+ [Agent, Command, Engine, and Model Resolution](../architecture/specs/agent-command-engine-model-design.md).
86
+
87
+ ## AKM complements, rather than replaces
88
+
89
+ AKM is not a competitor to assistant-native rules/skills or to MCP — it fills
90
+ a different layer. Assistant-native rules and skills give a specific tool
91
+ built-in, tool-specific activation. MCP exposes live tools and resources over
92
+ a protocol. AKM manages portable, versionable capability assets — and the
93
+ retrieval loop that finds and loads them — across whichever tool you're
94
+ sitting in. In short, AKM complements MCP and assistant-native skills rather
95
+ than replacing either.
96
+
97
+ ## Also available
98
+
99
+ - **Tab completion.** `akm completions --install` sets up shell completions
100
+ for subcommands and flags. See [CLI Reference](../reference/cli.md#completions).
101
+ - **Dispatching a bundle agent asset.** `akm agent agents/<name> --engine
102
+ <engine> --prompt "..."` runs a bundle `agents/<name>` persona and model
103
+ defaults through a named engine — including built-in model aliases like
104
+ `sonnet` and `opus` that resolve per platform. The current CLI rejects a
105
+ nonempty tool request at its separate authorization boundary; asset metadata
106
+ is never authorization by itself. See
107
+ [Configuration](../reference/configuration.md#engines) for the alias table
108
+ and [Architecture](../architecture/architecture.md) for how dispatch is
109
+ built into platform-specific CLI argv per backend.
110
+ - **Install refs vs. asset refs.** `npm:@scope/pkg` and `github:owner/repo`
111
+ are install refs, accepted only by `akm bundle add`/`akm clone`, and are a
112
+ different grammar from the `[bundle//]conceptId` refs `show`/`search` use.
113
+ See [Refs](../reference/refs.md) for the full grammar.
114
+ - **Plugin integrations.** For tighter editor and agent integrations,
115
+ platform-specific plugins are available in
116
+ [akm-plugins](https://github.com/itlackey/akm-plugins) (current
117
+ integrations include OpenCode). Plugins add richer UX — in-editor asset
118
+ browsing, automatic context injection — but the core `akm` CLI works
119
+ without them.
120
+
121
+ ## OpenCode plugins: one package per OpenCode major
122
+
123
+ OpenCode 1 and OpenCode 2 load different plugin APIs, so akm ships one plugin
124
+ package for each. Install only the one that matches the `opencode` you run; akm
125
+ never installs or replaces the `opencode` binary, and `akm upgrade` never adds
126
+ one plugin to the other major's config.
127
+
128
+ | OpenCode | Plugin package | Config key | Plugin cache |
129
+ | --- | --- | --- | --- |
130
+ | 1 | `akm-opencode` | `"plugin"` | `~/.cache/opencode/packages/akm-opencode@<tag>/` |
131
+ | 2 | `akm-opencode-v2` | `"plugins"` (the key `opencode plugin add` writes) | `~/.cache/opencode/npm/akm-opencode-v2@<tag>/<build>/` |
132
+
133
+ (`$XDG_CACHE_HOME` and `$XDG_CONFIG_HOME` move both.) Both packages declare the
134
+ same `akm-cli` dependency.
135
+
136
+ **OpenCode 1.** Add `akm-opencode` to the global config
137
+ (`~/.config/opencode/opencode.json`):
138
+
139
+ ```json
140
+ { "plugin": ["akm-opencode"] }
141
+ ```
142
+
143
+ **OpenCode 2.**
144
+
145
+ ```sh
146
+ opencode plugin add akm-opencode-v2
147
+ ```
148
+
149
+ This installs the package and adds it to `plugins` in the global config.
150
+
151
+ **Updating.** `akm upgrade` refreshes the cached plugin of each major it finds,
152
+ holds the CLI to the `akm-cli` those plugins pin, and leaves a plugin alone
153
+ whose config pins another spec such as `akm-opencode@0.8.0`. Use
154
+ `akm upgrade --next` with `akm-opencode@next` / `akm-opencode-v2@next` in the
155
+ config to follow prereleases. The exact rules are in the
156
+ [`akm upgrade` reference](../reference/cli.md#harness-plugins). `akm health`
157
+ warns when either plugin's bundled `akm-cli` differs from the running CLI.
158
+
159
+ **Which OpenCode akm drives** is detected, not configured: an `opencode` or
160
+ `opencode-sdk` agent engine runs the most recent OpenCode on `PATH` (or its own
161
+ `bin`) and uses the adapters for the major that binary reports; OpenCode 1 logs a
162
+ warning recommending OpenCode 2 (see
163
+ [Configuration](../reference/configuration.md#engines)). It does not change
164
+ which plugin you install, and the plugin choice does not change it.
165
+
166
+ ## See also
167
+
168
+ - [Configuration](../reference/configuration.md#engines) — named agent engines and model aliases
169
+ - [Discover and Load](discover-and-load.md) — the full curate → show retrieval path
170
+ - [Knowledge Management](knowledge-management.md) — capturing agent-generated memories
171
+ - [Improve the Library](improve-the-library.md) — feeding back usage signals
172
+ - [CLI Reference](../reference/cli.md) — `completions`, `agent`, and `hints` command documentation
173
+ - [Concepts](concepts.md) — refs, origins, and the asset type system
174
+ - [Bundle Types](../reference/bundle-types.md) — how AKM indexes existing project layouts in place
@@ -0,0 +1,81 @@
1
+ # LLM Wikis
2
+
3
+ akm supports [Andrej Karpathy's LLM
4
+ Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
5
+ pattern: a markdown-based knowledge base that an LLM agent maintains
6
+ together with a human, on a filesystem it can read and write directly,
7
+ with no special SDK.
8
+
9
+ **As of 0.9.0 an LLM wiki is a bundle format, not an akm asset type.**
10
+ The `akm wiki` command family was removed with the 0.9.0 bundle-adapter
11
+ architecture; recognition moved into the first-class LLM Wiki adapter.
12
+
13
+ ## The design
14
+
15
+ A wiki is a directory. Full stop.
16
+
17
+ ```
18
+ <wiki-root>/
19
+ schema.md rulebook the agent reads first
20
+ index.md catalog of pages, regenerable
21
+ log.md append-only activity log
22
+ raw/ immutable ingested sources (never edit)
23
+ pages/<page>.md agent-authored pages
24
+ pages/<topic>/<page>.md optional nesting
25
+ ```
26
+
27
+ Three layers, from Karpathy's gist:
28
+
29
+ - **Raw sources** (`raw/`) — what you ingest. Articles, papers,
30
+ transcripts, notes. Immutable.
31
+ - **Wiki pages** (`pages/<page>.md`, optionally nested) — what the agent
32
+ writes. Summaries, entity pages, concept pages, FAQs. Cross-referenced
33
+ via `xrefs:` frontmatter; provenance recorded via `sources:`
34
+ frontmatter pointing at the cited raw files.
35
+ - **Schema** (`schema.md`) — the per-wiki configuration: voice, page
36
+ kinds, contradiction policy, any conventions the agent should follow.
37
+ akm never touches it.
38
+
39
+ ### Principle — akm surfaces, the agent writes
40
+
41
+ Karpathy's workflow is a conversation between a human, an agent, and a
42
+ filesystem. akm is not that agent. Page writes — create, append, xref,
43
+ log — all use the agent's native `Read` / `Write` / `Edit` tools. akm's
44
+ job is recognition and discovery: it mounts the wiki, indexes the pages,
45
+ and makes them searchable alongside every other asset.
46
+
47
+ No LLM calls are made anywhere in the wiki surface. No network access.
48
+
49
+ ## How akm sees a wiki (0.9.0)
50
+
51
+ The LLM Wiki adapter recognizes a wiki **deterministically at install
52
+ time**: a bundle component whose root holds a `schema.md` plus a
53
+ `pages/` directory is mounted as an `llm-wiki` component. From there:
54
+
55
+ - `pages/**.md` are indexed as searchable documents; each page's ref is
56
+ `bundle//conceptId`, where the conceptId is the root-relative path
57
+ minus `.md` (a page at `pages/attention.md` in bundle `research-wiki`
58
+ is `research-wiki//pages/attention`).
59
+ - `raw/**.md` **are** indexed — as first-class, addressable, searchable
60
+ `wiki-source` documents (not `page`-type items; a ref looks like
61
+ `bundle//raw/<slug>`), so citations resolve and raw content is
62
+ discoverable by search too.
63
+ - `schema.md`, `index.md`, and `log.md` are structural and are never
64
+ indexed as a concept.
65
+ - `xrefs:` frontmatter becomes cross-reference edges; `sources:`
66
+ frontmatter becomes citation edges back to raw files.
67
+
68
+ ## Working with a wiki
69
+
70
+ ```sh
71
+ akm bundle add github:team/research-wiki # install a wiki bundle (or point at a local dir)
72
+ akm search "attention" # pages rank alongside all other indexed content
73
+ akm show research-wiki//pages/attention # read a page by ref
74
+ akm show research-wiki//pages/attention#history
75
+ ```
76
+
77
+ To build a new wiki, create the directory shape above by hand (or have
78
+ your agent do it — `schema.md` plus an empty `pages/` is enough for
79
+ recognition), then add it as a bundle. Ingesting raw sources, writing
80
+ pages, and maintaining `index.md`/`log.md` are the agent's job, guided
81
+ by `schema.md`.
@@ -30,10 +30,11 @@ akm migrate apply
30
30
  In order, every run applies (or, under `status`/`--dry-run`, plans):
31
31
 
32
32
  1. **config.json in its current shape** (`configFile`): retired and unknown
33
- keys dropped, legacy `extraParams` lifted onto first-class fields, the
34
- legacy `stashDir`/`sources[]`/`installed` layout converted to
35
- `bundles`/`defaultBundle`. Config loading already does all of this in
36
- memory; this persists it under a backup.
33
+ keys dropped, `configVersion` set. Config loading already does this in
34
+ memory; this persists it under a backup. A config older than 0.9.15 (the
35
+ legacy `stashDir`/`sources[]`/`installed` layout, an `extraParams` key
36
+ that shadows a first-class field) is not converted by 0.10: it blocks
37
+ with a message to run `akm migrate apply` under akm 0.9.x first.
37
38
  2. **Pending `state.db` migrations**, historical-destructive ones included
38
39
  (`stateMigrations`). This is the only path (besides `akm upgrade`, which
39
40
  calls the same code) that is allowed to apply a destructive migration to an
@@ -98,7 +99,7 @@ same step names):
98
99
  `status` is one of:
99
100
 
100
101
  - **`current`** — no task-source file needs converting, and no config
101
- extraParams lift is pending. A no-op boot.
102
+ rewrite is pending. A no-op boot.
102
103
  - **`ready`** — task sources have eligible changes and no config-lift
103
104
  conflict; a real `apply` will clear them.
104
105
  - **`blocked`** — at least one item cannot be applied automatically (a
@@ -244,7 +245,7 @@ akm-migrate apply
244
245
 
245
246
  `akm migrate status`/`apply` (under the `akm` CLI) are a thin wrapper over
246
247
  this same executable — same plan, same exit codes. Reach for `akm-migrate`
247
- directly when you don't want `akm`'s `--format`/`--shape`/`--detail` output
248
+ directly when you don't want `akm`'s `--format`/`--detail` output
248
249
  handling in the way, e.g. a shell script that just wants the raw JSON line
249
250
  on stdout and a plain exit code.
250
251
 
@@ -0,0 +1,19 @@
1
+ # Maintainer Docs
2
+
3
+ This is maintainer/contributor documentation, not user-facing. It covers how
4
+ to work on `akm` itself — running it from source, measuring whether changes
5
+ actually improve it, and the current state of the `curate` implementation.
6
+
7
+ - [Local Development](local-development.md) — the explicit launcher for each
8
+ kind of contributor check (live source, built launcher, packed-package
9
+ acceptance, global checkout install) and the verification commands to run
10
+ before pushing.
11
+ - [Release Checklist](release-checklist.md) — local release validation, exact
12
+ candidate-SHA semantic/Docker/native-scheduler gates, and the evidence links
13
+ required before publication.
14
+ - [akm-eval](https://github.com/itlackey/akm-eval) — the evals and benchmarks
15
+ that measure whether `akm improve` and retrieval changes are actually
16
+ working. The old in-repo toolkit is retired: see [eval.md](eval.md).
17
+ - [Curate Workmap](curate-workmap.md) — the current `akm curate` contract,
18
+ where its implementation diverges from intended behavior, and the
19
+ highest-value next fixes.
@@ -0,0 +1,335 @@
1
+ # Curate Workmap
2
+
3
+ > **Implementation note (added later, verified against `src/commands/read/curate.ts`):**
4
+ > much of the "Preferred direction" / "Next Fix Candidates" work below has
5
+ > already shipped. `curateSearchResults` now selects via `selectCuratedStashHits`
6
+ > (score-first ranking through `annotateCurateHit`/`compareCurateHits`/
7
+ > `passesCurateScoreFloor`, not "take the first hit per type"),
8
+ > `collapseCurateFamilies`/`preferBroadRootRepresentative`/`getCurateFamily`
9
+ > implement the asset-family root/child collapsing this document recommends,
10
+ > `shouldRunCurateFallback` triggers fallback on a weak result set (not only
11
+ > on zero hits, reversing the "Fallback Search Behavior" section below), and
12
+ > `appendCurateSupportRef`/`mergeCurateSupportRefs` attach graph-derived
13
+ > support refs (the "Graph Leverage" recommendation). The `orderCuratedTypes`
14
+ > function this document's "Execution Path" section names no longer exists —
15
+ > regex-based type reordering was replaced by the scoring pipeline above. The
16
+ > "Current Behavior" / "Current Curate Contract" sections below were accurate
17
+ > at the time they were written but are now describing the PRE-fix state in
18
+ > several places; re-verify against the functions above before trusting any
19
+ > specific "current behavior" claim in this document. Not fully re-audited
20
+ > line by line — this note flags the drift rather than rewriting the
21
+ > analysis.
22
+
23
+ ## When To Read This
24
+
25
+ Read this before changing `akm curate` ranking, fallback, follow-up generation, or agent-facing output.
26
+
27
+ This page is the shortest path to understanding:
28
+ - how `akm curate` currently works
29
+ - which tests pin that behavior
30
+ - where the current implementation diverges from intended product behavior
31
+ - what fix direction has the strongest support from recent review
32
+
33
+ ## Debate Outcome
34
+
35
+ Recent multi-agent review converged on the same conclusion:
36
+
37
+ - `curate` should be relevance-first, not diversity-first
38
+ - search ranking should remain the backbone of the shortlist
39
+ - type diversity should be a soft preference for later slots, not a hard override
40
+ - fallback search should run when the initial result set is weak or noisy, not only when it is empty
41
+ - `followUp` should become more action-aware over time, but ranking/fallback correctness comes first
42
+
43
+ Recommended fix order:
44
+
45
+ 1. Make curate selection score-first and diversity-second.
46
+ 2. Relax fallback suppression so one weak phrase hit does not block token fallback.
47
+ 3. Revisit follow-up generation after ranking quality improves.
48
+
49
+ Additional debate outcome:
50
+
51
+ - simple type-aware reranking is useful only as a thin post-search correction layer
52
+ - root-vs-derived asset families should usually be collapsed to one representative in the top-level shortlist
53
+ - graph data is better suited for attached support refs or navigation hints than for primary reranking in the first iteration
54
+
55
+ ## Current Curate Contract
56
+
57
+ - CLI entry lives in `src/commands/read/search-cli.ts`.
58
+ - Public entry point is `akmCurate()` in `src/commands/read/curate.ts`.
59
+ - Default curated limit is `4`.
60
+ - Default search source is `stash`.
61
+ - Curate fetches more search hits than it returns: `limit * 4`, minimum `12`.
62
+ - `--type <type>` bypasses diversification and returns top hits of that type.
63
+ - Default multi-type curate currently keeps one best hit per type, then reorders types using regex heuristics.
64
+ - Registry hits only fill leftover slots and are capped at `2`.
65
+ - Bundle items are enriched via `akmShowUnified()` best-effort.
66
+ - Bundle `followUp` is always `akm show <ref>` today.
67
+ - Curate logs both a summary event and per-item retrieval rows for bundle refs.
68
+
69
+ ## Execution Path
70
+
71
+ Read these first:
72
+
73
+ - `src/commands/read/search-cli.ts`
74
+ - `src/commands/read/curate.ts`
75
+ - `src/output/shapes/curate.ts`
76
+ - `src/output/text/helpers.ts`
77
+ - `src/commands/read/search.ts`
78
+ - `src/commands/read/show.ts`
79
+
80
+ Key functions in `src/commands/read/curate.ts` (current names; `orderCuratedTypes()`
81
+ no longer exists — see the implementation note above):
82
+
83
+ - `akmCurate()`
84
+ - `searchForCuration()`
85
+ - `deriveCurateFallbackQueries()`
86
+ - `mergeCurateSearchResponses()`
87
+ - `curateSearchResults()`
88
+ - `selectCuratedStashHits()` / `annotateCurateHit()` / `compareCurateHits()` / `passesCurateScoreFloor()`
89
+ - `collapseCurateFamilies()` / `preferBroadRootRepresentative()` / `getCurateFamily()`
90
+ - `shouldRunCurateFallback()`
91
+ - `appendCurateSupportRef()` / `mergeCurateSupportRefs()`
92
+ - `enrichCuratedStashHit()`
93
+
94
+ ## Ranking And Selection Rules
95
+
96
+ Current behavior:
97
+
98
+ - Search returns scored, ordered hits.
99
+ - Curate then discards most of that ordering by taking the first hit per type.
100
+ - Those per-type winners are reordered using query regex boosts such as `deploy`, `review`, `guide`, `agent`, and `memory`.
101
+ - This can promote obviously lower-score items above much stronger hits.
102
+
103
+ Why this is a problem:
104
+
105
+ - search already has strong ranking tests and should remain the primary relevance signal
106
+ - current curate can surface irrelevant filler to satisfy type variety
107
+ - users experience curate as a flagship shortlist, so wrong top results damage trust more than low variety does
108
+
109
+ Preferred direction:
110
+
111
+ - preserve top-ranked overall hits first
112
+ - allow diversity only when alternatives are close in score and plausibly relevant
113
+ - keep explicit `--type` behavior unchanged
114
+
115
+ Small type-aware corrections that are considered in-bounds:
116
+
117
+ - prefer runnable `script` / concrete `command` over similarly scored `memory` for execution-heavy queries
118
+ - prefer `workflow` / `skill` over adjacent explanation docs for multi-step task queries
119
+ - include `agent` mainly for explicit delegation / persona / prompt-building queries
120
+ - keep `memory` for recall/context queries, not as generic filler
121
+
122
+ Corrections that are currently considered too risky:
123
+
124
+ - hard one-per-type quotas
125
+ - large hand-authored type matrices
126
+ - LLM reranking
127
+ - blanket demotion of `memory` or `agent` as types
128
+
129
+ ## Asset Families
130
+
131
+ Curate should think in terms of asset families, not just isolated types.
132
+
133
+ Practical examples in this repo:
134
+
135
+ - `skills/docker-homelab`
136
+ - `knowledge/skills/docker-homelab/references/compose`
137
+
138
+ Desired behavior:
139
+
140
+ - broad query like `docker homelab` -> prefer the root asset
141
+ - narrow query like `docker compose reference` -> prefer the child reference page
142
+ - if both are useful, attach the weaker sibling as support instead of spending two top-level slots by default
143
+
144
+ This should start as an explicit structural heuristic, not semantic lineage inference.
145
+
146
+ ## Fallback Search Behavior
147
+
148
+ Current behavior:
149
+
150
+ - `searchForCuration()` only runs fallback token searches when the initial query returns zero hits
151
+ - if the initial query returns even one weak or irrelevant hit, fallback does not run
152
+ - fallback token extraction removes filler words, dedupes tokens, drops tokens shorter than 3 chars, and caps the set at 6
153
+ - fallback is also skipped when normalization leaves only one usable token
154
+
155
+ Why this is a problem:
156
+
157
+ - one weak phrase hit can block much better token hits
158
+ - prompt-style queries like `the docker` do not get the obvious one-token fallback
159
+ - meaningful short tokens such as `ai`, `ci`, `cd`, `go`, `js`, or `ts` are lost today
160
+
161
+ Preferred direction:
162
+
163
+ - suppress fallback only when the initial result set is actually strong enough
164
+ - allow one-token fallback when that token is clearly the meaningful residue of a prompt-style query
165
+ - preserve a narrow allowlist of meaningful short tokens
166
+
167
+ ## Enrichment And Follow-Up Fields
168
+
169
+ Current behavior:
170
+
171
+ - curate enriches bundle hits by calling `akmShowUnified({ ref })`
172
+ - if show fails, enrichment silently degrades to raw search-hit data
173
+ - bundle follow-up remains `akm show <ref>` even for runnable scripts with a concrete `run`
174
+ - registry follow-up uses the registry action, usually `akm bundle add ...`
175
+
176
+ Product implication:
177
+
178
+ - output is inspect-first, not act-first
179
+ - this is acceptable for now, but becomes more visible once result quality improves
180
+
181
+ For agent consumers, the desired optimization order is:
182
+
183
+ - actionability
184
+ - relevance
185
+ - low duplication / root-asset preference
186
+ - navigability
187
+ - type diversity
188
+
189
+ ## Output Shape And Formatting
190
+
191
+ Read:
192
+
193
+ - `src/output/shapes/curate.ts`
194
+ - `src/output/text/helpers.ts`
195
+
196
+ Important details:
197
+
198
+ - `curate` has a dedicated output shaper now
199
+ - `brief` still keeps `followUp` and `reason`
200
+ - `--detail agent` trims fields down for agent use
201
+ - text output prints fixed `Next steps:` guidance that assumes `akm show <ref>` is the next action
202
+
203
+ ## Telemetry And Retrieval Signal
204
+
205
+ Read:
206
+
207
+ - `src/commands/read/curate.ts`
208
+ - `tests/integration/get-retrieval-counts.test.ts`
209
+
210
+ Important detail:
211
+
212
+ - curate writes per-item `usage_events` rows for bundle refs so curated items count as retrieval signal
213
+
214
+ This means ranking changes do not just affect UX. They also affect downstream improvement-loop evidence.
215
+
216
+ ## Graph Leverage
217
+
218
+ > **Retired (0.9.17-alpha.9):** the LLM entity graph this section recommends
219
+ > leveraging is gone — `graph-extraction`, `graph_meta`/`graph_files`/
220
+ > `graph_file_entities`/`graph_file_relations`, and `akm show`'s `related`
221
+ > block it fed are all deleted. It was already superseded before that: #935
222
+ > (0.9.17-alpha.8) added the first-class asset->asset edge table this section
223
+ > says doesn't exist (`asset_links`, declared links), and curate's support
224
+ > refs (`buildCurateSupportRefs` in `src/commands/read/curate.ts`) come from
225
+ > declared links now, not graph data — the implementation note at the top of
226
+ > this document already flags that rename. Kept below for historical context
227
+ > only; do not implement against it.
228
+
229
+ Existing graph signal:
230
+
231
+ - there is no first-class asset->asset edge table
232
+ - asset relatedness is already derivable via shared-entity overlap
233
+ - `listRelatedPathsForFile()` in `src/indexer/graph/graph-boost.ts` returns related assets with `ref`, `type`, `sharedEntities`, and `relationCount`
234
+ - `akm show` already exposes a lightweight `related` block using that signal
235
+
236
+ Limits:
237
+
238
+ - graph coverage depends on graph extraction having run
239
+ - graph is thin or absent on cold bundles
240
+ - graph quality is uneven and generic entities can over-connect assets
241
+ - graph coverage is strongest for `knowledge` / `memory` and should not be assumed for every asset family
242
+
243
+ Recommended first graph-aware use in curate:
244
+
245
+ - do not use graph as a primary reranker yet
246
+ - use graph to attach 1-2 support refs or navigation hints to a top-level curated result
247
+ - prefer hints like `see also`, `related`, or `inspect next` over full graph payloads
248
+ - keep full graph exploration in `akm show`'s `related` block
249
+
250
+ What not to do yet:
251
+
252
+ - no graph-only reranking
253
+ - no graph-required curate path
254
+ - no full graph dumps in curate output
255
+ - no semantic asset-lineage inference from sparse graph data
256
+
257
+ ## Tests That Pin Behavior
258
+
259
+ Start with these:
260
+
261
+ - `tests/integration/curate-command.test.ts`
262
+ - `tests/curate-logic.test.ts`
263
+ - `tests/integration/curate-search-for-curation.test.ts`
264
+
265
+ What they cover:
266
+
267
+ - CLI JSON/text output
268
+ - shape/detail behavior
269
+ - usage logging
270
+ - fallback token derivation
271
+ - merge semantics
272
+ - type ordering
273
+ - diversification logic
274
+ - registry filler cap
275
+ - blank query rejection
276
+ - default limit
277
+ - phrase-hit fallback suppression
278
+ - current quality baselines showing irrelevant filler
279
+
280
+ Search-ranking baselines that curate should respect:
281
+
282
+ - `tests/integration/db-scoring.test.ts` (no `tests/commands/search.test.ts` exists in the current tree; this is the closest surviving search-scoring baseline, not a confirmed direct successor)
283
+ - `tests/integration/ranking-regression.test.ts`
284
+
285
+ ## Known Gaps / Mismatches
286
+
287
+ - `docs/guides/discover-and-load.md` currently says curate prefers one strong match per type; that wording is too strong if curate becomes relevance-first.
288
+ - `docs/reference/cli.md` documents `--type`, `--limit`, and `--source`, but does not currently explain the effective `--detail` and `--shape` behavior alongside curate.
289
+ - Some historical AKM refs about curate output shaping are stale because curate now has a dedicated shape implementation.
290
+
291
+ ## Safe Edit Checklist
292
+
293
+ Before editing curate:
294
+
295
+ 1. Read the three curate-focused test files.
296
+ 2. Read `src/commands/read/curate.ts` top to bottom.
297
+ 3. Confirm whether you are changing:
298
+ - post-search selection
299
+ - fallback triggering
300
+ - fallback token extraction
301
+ - output contract
302
+ - telemetry side effects
303
+ 4. Keep CLI surface and output-shape tests passing unless you intentionally change the public contract.
304
+ 5. If you improve ranking quality, convert current characterization tests that encode bad behavior into regression tests for the new intended behavior.
305
+
306
+ ## Useful AKM Queries And Refs
307
+
308
+ Queries:
309
+
310
+ ```sh
311
+ akm search "curate rerank"
312
+ akm search "curate output shape"
313
+ akm search "search discovery curate"
314
+ akm search "curate telemetry usage_events"
315
+ akm search "curate fallback query"
316
+ akm search "curate quality baseline"
317
+ ```
318
+
319
+ Historical context refs:
320
+
321
+ - `memories/curate-weak-for-ui-test-audit.derived`
322
+ - `knowledge/curate-command-flags-inert`
323
+
324
+ Note: `knowledge/curate-command-flags-inert` is historical context only. It describes an older output-shaping limitation that is no longer current now that `src/output/shapes/curate.ts` exists.
325
+
326
+ ## Next Fix Candidates
327
+
328
+ Highest-value next changes:
329
+
330
+ 1. Replace hard one-per-type selection with score-first shortlist selection plus optional soft diversity.
331
+ 2. Replace empty-only fallback triggering with weak-result fallback triggering.
332
+ 3. Add simple family-aware root/child collapsing for obvious structural bundles.
333
+ 4. Add regression tests asserting that docker-specific curate queries stop surfacing unrelated `commands/release-manager` filler.
334
+ 5. Attach lightweight related-asset hints using existing graph data after ranking quality is fixed.
335
+ 6. Revisit `followUp` generation after ranking quality is fixed.
@@ -0,0 +1,3 @@
1
+ # akm-eval — retired from this repository
2
+
3
+ The `scripts/akm-eval/` toolkit has left akm: its code is kept, to read and not to run, in [`retired/akm-scripts-akm-eval/`](https://github.com/itlackey/akm-eval/tree/main/retired/akm-scripts-akm-eval) of [itlackey/akm-eval](https://github.com/itlackey/akm-eval), where [`reports/retired-evals.md`](https://github.com/itlackey/akm-eval/blob/main/reports/retired-evals.md) says what each retired eval asked, found and why it ended. It is also in this repository's history, at commit `f57a7fd44b37` and in the tag `v0.9.27-alpha.1`.