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
@@ -95,6 +95,23 @@ kebab-case, at most 63 characters, and cannot start with `akm-`.
95
95
  | `llm` | `endpoint`, `model` | OpenAI-compatible chat completions |
96
96
  | `agent` | `platform` | A registered dispatch-capable harness |
97
97
 
98
+ The registered harnesses (generated from the harness registry; do not edit):
99
+
100
+ <!-- harness-table:start (generated by scripts/gen-config-schema.ts) -->
101
+ | `platform` | Harness | Binary | Session logs | Model work | Native `agent` |
102
+ | --- | --- | --- | --- | --- | --- |
103
+ | `opencode` | OpenCode | `opencode` | yes | yes | yes |
104
+ | `claude` | Claude Code | `claude` | yes | yes | yes |
105
+ | `opencode-sdk` | OpenCode SDK | in-process | no | yes | yes |
106
+ | `codex` | OpenAI Codex CLI | `codex` | yes | no | no |
107
+ | `copilot` | GitHub Copilot CLI | `copilot` | no | no | no |
108
+ | `pi` | Pi | `pi` | no | no | no |
109
+ | `gemini` | Gemini CLI | `gemini` | no | no | no |
110
+ | `aider` | Aider | `aider` | no | no | no |
111
+ | `amazonq` | Amazon Q Developer CLI | `q` | no | no | no |
112
+ | `openhands` | OpenHands | `openhands` | no | no | no |
113
+ <!-- harness-table:end -->
114
+
98
115
  LLM endpoints must be complete `http://` or `https://` chat-completions URLs
99
116
  ending in `/chat/completions`, without userinfo, query, or fragment. API keys
100
117
  are symbolic only: `$VAR` or `${VAR}`. AKM resolves them only at dispatch.
@@ -141,6 +158,33 @@ the LLM engine used as that SDK engine's fallback connection. With no
141
158
  provider, model and auth from its own configuration. `defaults.llmEngine` is
142
159
  not a substitute.
143
160
 
161
+ An `opencode` or `opencode-sdk` engine has no setting for the OpenCode major: akm
162
+ detects it. With no `bin`, the engine runs the most recent OpenCode on `PATH`
163
+ (`opencode2`, OpenCode 2's own alias, when present, else `opencode`); with a
164
+ `bin`, it runs that binary. akm runs `<bin> --version` once per binary per
165
+ process and uses the OpenCode 2 or OpenCode 1 adapters to match. OpenCode 1 keeps
166
+ working and logs a warning recommending OpenCode 2. A `--version` akm cannot read
167
+ (or a major it does not know) uses the OpenCode 2 adapters and logs a warning
168
+ with the raw output. To run a particular OpenCode, set the engine's `bin`, e.g.
169
+ `{"kind":"agent","platform":"opencode-sdk","bin":"/opt/opencode1/bin/opencode"}`.
170
+
171
+ **Permissions in a dispatch.** akm answers every OpenCode permission request of a
172
+ dispatch with "reject" (there is no one to approve it), and the rejection reaches
173
+ the model as a tool error. akm changes no OpenCode permission default, so what
174
+ gets asked is OpenCode's own setting:
175
+
176
+ - **OpenCode 1** asks before reading or writing outside the project directory
177
+ (`external_directory`), so akm rejects it.
178
+ - **OpenCode 2** (2.0.26) does not ask: a read or write outside the project
179
+ directory just runs, and akm's rejection never happens, unless your OpenCode
180
+ config says to ask. Add a rule to the global `opencode.json`, e.g.
181
+ `"permissions": [{"action": "external_directory", "resource": "*", "effect": "ask"}]`
182
+ (`"read"` and `"shell"` are actions too).
183
+
184
+ On OpenCode 2 a rejection ends the turn: the dispatch returns `ok: false` with
185
+ `reason: "aborted"` and the declined tool call in `error`. On OpenCode 1 the model
186
+ carries on.
187
+
144
188
  On an engine without `timeoutMs`, model work (an improve process, a quality or
145
189
  triage judge, or an index pass) stops after 600 seconds, whatever the engine's
146
190
  kind; other work on an agent engine runs until it finishes. An improve stage's
@@ -191,7 +235,7 @@ Reasoning effort has one word in a request, `reasoningEffort`. `effort`, as a
191
235
  Unattended model work is the work akm hands a model with no one watching:
192
236
  - the improve processes (reflect, distill, consolidate, memory inference,
193
237
  extract, and validation's repair);
194
- - the quality, triage and retrieval-gate judges;
238
+ - the quality and triage judges;
195
239
  - index passes;
196
240
  - `akm remember --enrich`.
197
241
 
@@ -209,7 +253,7 @@ cannot enforce:
209
253
  | LLM | No tools. |
210
254
  | `claude` | Read and Edit inside the working directory, and Bash for `akm search` and `akm show` only. akm runs it with `--restricted`, so your user, project and local settings cannot widen that. |
211
255
  | `opencode`, `opencode-sdk` | Read, grep and glob in the working directory and the stash, edit in the working directory only, and `akm_search` and `akm_show`, through an injected `akm-model-work` agent. No bash, because opencode cannot stop a redirect such as `akm show x > file` from writing elsewhere. |
212
- | `codex`, `copilot`, `pi`, `gemini`, `aider`, `amazonq`, `openhands` | Cannot run model work: akm refuses the request before it starts. |
256
+ | Every other `agent` harness | Cannot run model work: akm refuses the request before it starts. |
213
257
 
214
258
  **The one rule.** Every key model work reads its engine from must name an
215
259
  LLM engine or a `claude`, `opencode` or `opencode-sdk` agent engine. Those
@@ -235,7 +279,9 @@ key, the engine and its platform. Other engine keys, `defaults.engine` and
235
279
  - opencode model work may read the stash and write only its working directory.
236
280
  `akm_search` and `akm_show` come from the akm-opencode plugin (0.9.21 or
237
281
  later), which akm does not load: put it in your opencode config
238
- (`"plugin": ["akm-opencode"]`). akm turns off the plugin's curation, learning
282
+ (`"plugin": ["akm-opencode"]` for OpenCode 1; for OpenCode 2 install
283
+ `akm-opencode-v2` with `opencode plugin add akm-opencode-v2`, see
284
+ [Use AKM With Any Agent](https://github.com/itlackey/akm/blob/main/docs/guides/use-with-any-agent.md#opencode-plugins-one-package-per-opencode-major)). akm turns off the plugin's curation, learning
239
285
  and write gate for these dispatches and keeps its state in akm's state
240
286
  directory. The stash is protected from edits only while the temporary
241
287
  directory is outside a git repository.
@@ -442,11 +488,21 @@ can select `engine`, `model`, `timeoutMs`, and LLM request overrides:
442
488
 
443
489
  An improve process's engine follows
444
490
  [the one rule](#engines-for-unattended-model-work); an explicit invalid or
445
- incompatible engine never falls back to another engine. Built-in strategies
446
- are complete presets. User-defined strategies inherit omitted fields from the
447
- built-in `default` strategy before applying their own overrides. The built-in
448
- strategies other than `default` and `consolidate` are Experimental (see
449
- [STABILITY.md](../../STABILITY.md)): 0.10 measures each and keeps, folds or removes it.
491
+ incompatible engine never falls back to another engine. The built-in strategies
492
+ are `default` and `consolidate`. `consolidate` is a patch that
493
+ is deep-merged onto `default`, and a user-defined strategy of the same name is
494
+ merged on top of that; so every strategy, built-in or user-defined, inherits
495
+ omitted fields from `default`. `quick`, `reflect-distill`, `thorough`,
496
+ `catchup` were removed in 0.10 (#1130): measured, none beat `default` (`thorough`
497
+ and `catchup` added only a judged triage drain, and `catchup` was identical to
498
+ `consolidate`). `proactive-maintenance` was removed too (#1129): its lane now
499
+ lives in `default`. A `improve.strategies.<name>` block with one of those names is
500
+ now an ordinary user-defined strategy that inherits `default`, so it no longer
501
+ carries the old built-in's settings; `--strategy` or `defaults.improveStrategy`
502
+ naming one with no such block fails with an error that names `default`. To keep
503
+ the old judged drain, set `processes.triage` (`enabled`, `applyMode: "promote"`,
504
+ `judgment: true`) in your own strategy. The built-in strategies other than
505
+ `default` and `consolidate` are Experimental (see [STABILITY.md](../../STABILITY.md)).
450
506
 
451
507
  `processes.triage.judgment` explicitly controls the optional judgment tier.
452
508
  Use `true` to enable it, `false` to disable it, or an object with `enabled`,
@@ -457,6 +513,22 @@ the retired `mode` and `profile` keys continue to report their engine migration
457
513
  guidance. When enabled, engine selection is judgment → triage → strategy →
458
514
  `defaults.llmEngine`, and resolution fails closed if none is available.
459
515
 
516
+ The `default` strategy runs triage in `promote` mode with judgment off and
517
+ `maxAcceptsPerRun: 200` (#1143), so the proposal backlog drains through the
518
+ deterministic gates without `experimental.improveAutonomy`. Turning judgment on
519
+ in a promote strategy is what that opt-in gates.
520
+
521
+ Judgment is off in every built-in strategy, and the judgment tier may accept
522
+ only a consolidate promotion. Retirements and reflect revisions it
523
+ would accept are left for a person. This is measured, not cautious by habit
524
+ (#1132, #1094): with `experimental.improveAutonomy` and judgment over every
525
+ proposal kind, the nightly eval solved 0.49 (gpt-5.6-terra) and 0.53
526
+ (qwen3.8-27b) of its items while harming 14 and 11, and changed 18 and 21 notes
527
+ outside the planted set; the judge accepted unsafe retirements and applied exact
528
+ fixes unreviewed. Judging promotions alone was reasonable: on qwen3.8-27b it
529
+ had precision 0.87 and recall 0.78 and accepted 4.8% of bad promotions; on
530
+ gpt-5.6-terra it was very cautious (precision 1.0, recall 0.17).
531
+
460
532
  ```jsonc
461
533
  {
462
534
  "improve": {
@@ -557,10 +629,15 @@ off too. Every entry must be a non-empty string, or the config does not load.
557
629
  ```
558
630
 
559
631
  No shipped strategy turns improve-stage session extraction on.
560
- `proactiveMaintenance` is on only in the `proactive-maintenance` preset; run
561
- `akm improve --strategy proactive-maintenance` to use that opt-in preset.
562
- Because strategies inherit from `default`, a preset that omits either process
563
- also inherits the off value. User strategy overrides
632
+ `proactiveMaintenance` is on in `default` and off in `consolidate`, the only
633
+ other shipped strategy. It plans stable assets that have had no feedback: at most
634
+ `maxPerRun` (default 15) per run, only assets not reflected or distilled for
635
+ `dueDays` (default 30), so each comes up at most once a month, and reflect's
636
+ `limit` (25) still bounds the run. A preset that omits either process
637
+ inherits the `default` value; set `processes.proactiveMaintenance.enabled: false` in the
638
+ selected strategy to turn the lane off. A proposal from this lane is never
639
+ accepted by `proposal drain`: it waits for a person (reason
640
+ `proactive-needs-review`, #1147). User strategy overrides
564
641
  are applied last, so an explicit `enabled: true` still opts the selected
565
642
  strategy in.
566
643
 
@@ -789,8 +866,7 @@ explicit destination flag is given and the command isn't already scoped to a
789
866
  specific source. It must name a configured bundle; setting it with no
790
867
  `bundles` configured, or naming an unconfigured bundle, is rejected at
791
868
  `config set` (or config load) time. The full write-target resolution order
792
- is the command's destination flag (`--bundle` on `remember`/`clone`/
793
- `improve`, `--target` on `env`/`secret create`) -> `defaultWriteTarget` ->
869
+ is the command's destination flag (`--bundle`) -> `defaultWriteTarget` ->
794
870
  working bundle (`defaultBundle`) -> `ConfigError`.
795
871
 
796
872
  ### Memory scope
@@ -857,7 +933,8 @@ section, an absent key, and an explicit `false` all read identically as off.
857
933
  ```
858
934
 
859
935
  - **`experimental.improveAutonomy`** — gates only the autonomous
860
- `memoryInference`, `triagePromote`, and `memoryCleanup` lanes. `akm improve`
936
+ `memoryInference`, `triagePromote` (a promote with triage judgment on; a
937
+ deterministic-only promote runs without it), and `memoryCleanup` lanes. `akm improve`
861
938
  itself always runs; this only gates mutations without a human in the loop.
862
939
  Consolidation is not gated: it remains advisory and emits reviewable
863
940
  proposals. `sync.push` is deliberately **not** gated by this key.
@@ -1034,11 +1111,15 @@ network filesystem for the data directory and falls back to `DELETE`.
1034
1111
 
1035
1112
  ## Retired Configuration
1036
1113
 
1037
- `profiles`, `llm`, `agent`, `features`, `stashes`, `defaults.llm`,
1038
- `defaults.agent`, and `defaults.improve` are rejected in 0.9. Recreate the
1039
- configuration using `engines`, `defaults.engine`, `defaults.llmEngine`, and
1040
- `improve.strategies`; AKM deliberately does not infer or rename ambiguous
1041
- profile identities.
1114
+ `profiles`, `llm`, `agent`, `features`, and `stashes` are rejected in 0.9.
1115
+ Recreate the configuration using `engines`, `defaults.engine`,
1116
+ `defaults.llmEngine`, and `improve.strategies`; AKM deliberately does not infer
1117
+ or rename ambiguous profile identities. `defaults.llm`, `defaults.agent`,
1118
+ `defaults.improve`, `index.stalenessDetection`, the engine settings that used to
1119
+ sit under `index.<pass>` (`endpoint`, `provider`, `apiKey`, `baseUrl`,
1120
+ `temperature`, `maxTokens`, `capabilities`) and the `feedbackDistillation`
1121
+ process (use `processes.distill.enabled`) load like any other unknown key: named
1122
+ once by the unknown-key warning, ignored, and dropped by `akm migrate apply`.
1042
1123
 
1043
1124
  `embedding.chunkSize` was never read by anything under `src/` (#954), so a
1044
1125
  config that still sets it is simply ignored — it still loads, unvalidated
@@ -163,7 +163,7 @@ the set of types the code actually emits at HEAD (verified against every
163
163
  | `sync` | `akm sync` | `name`, `message`, `ok` |
164
164
  | `index_db_vacuumed` | `akm index` VACUUMed index.db, after an index layout migration or because more than half its pages were free | `pagesBefore`, `pagesAfter`, `freelistRatioBefore` |
165
165
  | `index_completed` | `akm index`, once when a run finishes | `mode`, `totalMs`, `walkMs`, `llmMs`, `embedMs`, `ftsMs`, `finalizeMs` (phase timings in milliseconds) |
166
- | `stash_synced` | `akm improve`'s internal auto-sync pass (the `sync.push` feature), **distinct from** the `akm sync` command above | `committed`, `pushed`, `skipped`, `reason`, `attributed` (paths the run wrote and staged), `unattributed` (in-scope paths that went dirty during the run without the run writing them — left for their author) |
166
+ | `stash_synced` | `akm improve`'s internal sync passes (the `sync.push` feature), before the run and at its end, **distinct from** the `akm sync` command above | `phase` (`pre-run` or `end-of-run`), `committed`, `pushed`, `skipped`, `reason`, `attributed` (paths the run wrote and staged), `unattributed` (in-scope paths that went dirty during the run without the run writing them — left for their author) |
167
167
  | `env_access` | `akm env run <name> -- <command>` (audit trail: key **names** only, values never recorded) | `ref`, `keys` |
168
168
  | `secret_access` | `akm secret run <ref> <VAR> -- <command>` (audit trail: var **name** only, value never recorded) | `ref`, `var` |
169
169
 
@@ -189,7 +189,7 @@ the set of types the code actually emits at HEAD (verified against every
189
189
  | `improve_invoked` | Start of an `akm improve` run | `ref` (scope); `strategy`, `scope`, `dryRun`, `eligibleCount` |
190
190
  | `improve_completed` | `akm improve` run finished | run stats |
191
191
  | `improve_failed` | `akm improve` run errored | error |
192
- | `improve_skipped` | `akm improve` left a ref, a lane, or a group of refs out | `reason` (`no_new_signal`, `not_retrieved`, `distill_no_new_signal`, `budget_exhausted`, `budget_exhausted_batch`, `asset_missing_on_disk`, `strategy_filtered_all_passes`, `autonomy_gated`, `engine_unavailable`, `pool_below_min_size`, `consolidation_no_memory_updates`, `below_min_new_sessions`, `derived_memory_reflect_skipped`, `memory_distill_requires_feedback`, `distill_flagged_wrong`, `distill_positive_without_reason`, `distill_deprecated_or_superseded`); `count`, `remaining`, `strategy`, `lane` or `configKey` where they apply |
192
+ | `improve_skipped` | `akm improve` left a ref, a lane, or a group of refs out | `reason` (`no_new_signal`, `not_retrieved`, `distill_no_new_signal`, `budget_exhausted`, `budget_exhausted_batch`, `asset_missing_on_disk`, `strategy_filtered_all_passes`, `autonomy_gated`, `engine_unavailable`, `consolidation_no_memory_updates`, `below_min_new_sessions`, `derived_memory_reflect_skipped`, `memory_distill_requires_feedback`, `distill_flagged_wrong`, `distill_positive_without_reason`, `distill_deprecated_or_superseded`); `count`, `remaining`, `strategy`, `lane` or `configKey` where they apply |
193
193
  | `improve_lock_recovered` | Stale improve lock cleared at startup | |
194
194
  | `improve_review_needed` | `akm feedback` pushed a high-utility asset's utility below the review threshold — a review-needed escalation is recorded (not a proposal, so it can't accidentally overwrite the asset) | `ref`, `previousUtility`, `nextUtility` |
195
195
  | `reflect_invoked` | Start of reflect phase in `akm improve` | `ref`, engine |
@@ -0,0 +1,126 @@
1
+ # Environment & Secrets
2
+
3
+ Reference for `akm env` and `akm secret` — the two protected-value asset
4
+ types. For task-oriented guidance on capturing knowledge in general, see
5
+ [Capture Knowledge](../guides/capture-knowledge.md); this page states exact
6
+ contract, defaults, and security behavior.
7
+
8
+ ## env vs secret
9
+
10
+ `akm env` manages a `.env`-backed group of configuration (a whole `.env` file
11
+ loaded wholesale). `akm secret` manages a single standalone sensitive value —
12
+ one value per file, mirroring Docker's secret model. There is no `akm vault`
13
+ command; use `env` or `secret`.
14
+
15
+ | | `env` | `secret` |
16
+ | --- | --- | --- |
17
+ | Purpose | configuration — related settings for an app/service | authentication — one sensitive value |
18
+ | Holds | a `.env` file of many `KEY=value` pairs | one value per file |
19
+ | Discoverable | key *names* (not values) | name only (the whole file is the value) |
20
+ | Injects | many vars at once (`env run`) | one var (`secret run <ref> <VAR>`) |
21
+
22
+ ## Core security guarantee
23
+
24
+ Values never appear in akm's structured output. `env list` and `akm show
25
+ env/<name>` surface key names only — comment text is never surfaced either,
26
+ since comments routinely contain commented-out credentials and are treated
27
+ like values. `secret list` surfaces the secret's name only; the file content
28
+ is never shown. Values reach a process only through the safe injection
29
+ paths, `akm env run` and `akm secret run`, which pass values directly into
30
+ the child process — never through akm's own stdout, the index, or `akm
31
+ show`.
32
+
33
+ ```sh
34
+ akm env create prod # create an empty .env group
35
+ akm env create prod --from-file ./.env # or ingest an existing .env
36
+
37
+ # akm does not manage individual keys — edit the whole file with your own editor:
38
+ $EDITOR "$(akm env path env/prod --quiet)"
39
+
40
+ akm env list
41
+ akm show env/prod # key names only
42
+
43
+ # Inject the whole .env into a subprocess (never onto stdout):
44
+ akm env run env/prod -- ./deploy.sh
45
+ akm env run env/prod -- $SHELL # interactive session with the env loaded
46
+ akm env run env/prod --only DATABASE_URL -- ./migrate
47
+
48
+ # Store a single credential as a secret:
49
+ printf '%s' "$TOKEN" | akm secret set secrets/deploy-token
50
+ akm secret run secrets/deploy-token GITHUB_TOKEN -- gh release create v1.0.0
51
+
52
+ # Write into a specific source instead of the working bundle:
53
+ akm secret set secrets/deploy-token --bundle team --from-file ./token
54
+ ```
55
+
56
+ `env export --out <file>` writes a safe, sourceable `export KEY='value'`
57
+ script (re-serialised single-quoted, so shell substitutions in the source
58
+ `.env` become literal strings) — it requires `--out` and never prints values
59
+ to stdout.
60
+
61
+ ## File modes and storage
62
+
63
+ `.env` files are stored at mode 0600 under `env/` in the target bundle;
64
+ standalone secrets are stored at mode 0600 under `secrets/`. A secret write
65
+ is atomic under an exclusive per-secret lock held in akm's data directory;
66
+ maximum secret size is 5 MB.
67
+ Values never cross argv (no `/proc/cmdline` exposure). An `env` file or
68
+ secret can carry a sibling `.sensitive` marker that excludes it from `list`
69
+ output and from the search index entirely; the value remains usable via
70
+ `run`.
71
+
72
+ ## Write-target resolution
73
+
74
+ Env/secret **mutations** (`env create`, `env remove`, `secret set`) choose
75
+ their write destination like every other write command: an explicit
76
+ `--bundle <source>` wins, else `defaultWriteTarget`, else the working
77
+ bundle. The chosen source must be writable — a non-writable target fails
78
+ with a `ConfigError` before anything is written — and a git-backed writable
79
+ target commits the mutation at a single operation boundary. Reads (`list`,
80
+ `show`, `path`, `run`, `export`) still span all configured sources.
81
+
82
+ ## Subprocess residency
83
+
84
+ `akm env run` and `akm secret run` inject values directly into the child
85
+ process — never through a shell — but the child controls its own
86
+ stdout/stderr, so a command that prints its own environment will still leak
87
+ values into your terminal or agent transcript. Injected values live in the
88
+ child process environment for its entire lifetime and are visible to every
89
+ subprocess the child spawns.
90
+
91
+ - Prefer `akm secret run secrets/<name> <VAR> -- <command>` over `akm env
92
+ run` when a command only needs one value.
93
+ - Avoid `env run` / `secret run` for long-lived daemon or server processes;
94
+ for those, point the process at the secret file directly
95
+ (`<bundle>/secrets/<name>`) so the value never sits in a process
96
+ environment variable at all.
97
+ - Avoid running commands that print the environment (`env`, `printenv`,
98
+ shell tracing, verbose diagnostics) in agent contexts unless you
99
+ explicitly intend to expose the child environment.
100
+ - Before spawning, injected key names are scanned for known
101
+ process-hijacking variables (`LD_PRELOAD`, `PATH`, `GIT_CONFIG_*`, ...): a
102
+ first-party bundle warns and proceeds, a third-party-sourced bundle is
103
+ refused.
104
+
105
+ ## Stability
106
+
107
+ `env list`, `env path`, `env export`, `env run`, `secret list`, and `secret
108
+ run` — the read-and-inject surface — are Stable. `env create`, `env remove`,
109
+ and `secret set` — the write verbs — are Experimental. Check
110
+ [STABILITY.md](../../STABILITY.md) for the current tier of any command
111
+ before depending on its exact output shape.
112
+
113
+ ## What this page does not cover
114
+
115
+ This page documents akm's own guarantees for these two asset types, not the
116
+ broader threat model (what a compromised bundle or malicious script could
117
+ still do, what filesystem-level exposure remains, how this compares to a
118
+ dedicated secrets manager). See [SECURITY.md](../../SECURITY.md) for that
119
+ fuller picture, including plaintext-at-rest scope and rotation guidance.
120
+
121
+ ## See also
122
+
123
+ - [Capture Knowledge](../guides/capture-knowledge.md) — `remember`, `import`,
124
+ and when to reach for each
125
+ - [CLI Reference](cli.md) — full flag documentation for `env` and `secret`
126
+ - [SECURITY.md](../../SECURITY.md) — full threat model
@@ -0,0 +1,124 @@
1
+ # Memory
2
+
3
+ Reference for the `memory` asset type: capture, belief states, and derived
4
+ memories.
5
+
6
+ ## Contract
7
+
8
+ Memories are context fragments — observations, decisions, snippets —
9
+ captured as markdown files. Capture one directly in your working bundle with
10
+ `akm remember "..."`, or point akm at any directory of memory files written
11
+ by another tool:
12
+
13
+ ```sh
14
+ # File-based memory store from another tool
15
+ akm bundle add ~/my-agent/memories
16
+ ```
17
+
18
+ Memory assets appear in search results with the `memory` type, giving agents
19
+ access to recalled context from previous sessions.
20
+
21
+ ## Schema
22
+
23
+ Memories captured with `akm remember` can carry optional YAML frontmatter
24
+ that the indexer records:
25
+
26
+ | Field | Purpose |
27
+ | --- | --- |
28
+ | `tags` | Free-form categorization |
29
+ | `source` | Where the memory came from (also used as the derived-memory parent backref — see below) |
30
+ | `observed_at` | When the observation happened |
31
+ | `expires` | When the memory should stop being considered current |
32
+ | `subjective` | Marks the memory as opinion/preference rather than fact |
33
+ | `description` | Short human-readable summary |
34
+ | `captureMode` | `hot` (written via `akm remember`) or `background` (inferred by `akm improve`) |
35
+ | `beliefState` | See belief states below |
36
+ | `supersededBy` | Points at the memory that replaced this one |
37
+
38
+ Supply frontmatter fields explicitly with `--tag`/`--expires`/`--source`,
39
+ derive them from the body heuristically with `--auto`, or have the
40
+ configured LLM propose them with `--enrich`. See
41
+ [`akm remember`](cli.md#remember) for the full flag list.
42
+
43
+ ### Belief states
44
+
45
+ Memories carry a `beliefState` field that records how current they are.
46
+ Search ranking does not read it; the `--belief` filter below does. The
47
+ supported values, from strongest to weakest authority:
48
+
49
+ | State | When it's set | `--belief` |
50
+ | --- | --- | --- |
51
+ | `asserted` | Written directly by `akm remember` (user-explicit) | current |
52
+ | `active` | Default for memories with no explicit state | current |
53
+ | `deprecated` | Marked as no-longer-current but not yet superseded; frozen (never auto-refreshed) | historical |
54
+ | `superseded` | Replaced by another memory via the `supersededBy` field | historical |
55
+ | `contradicted` | Marked as contradicted by other evidence | historical |
56
+ | `archived` | Soft-deleted; retained for audit | historical |
57
+
58
+ `akm search` filters via `--belief current|historical|all`:
59
+
60
+ - `current` → `active` + `asserted`
61
+ - `historical` → `deprecated` + `superseded` + `contradicted` + `archived`
62
+ - `all` (default — no filter) → every belief state, including `archived` and
63
+ `contradicted` memories, is eligible to surface.
64
+
65
+ ### Derived memories as retrieval shortcuts
66
+
67
+ When `akm improve` infers a derived memory from a parent (e.g. distilling a
68
+ verbose memory into a focused summary), the derived memory is written with a
69
+ `source:` frontmatter backref naming the parent, and the indexer records the
70
+ parent/child link in the `derived_from` column. This provenance backref is a
71
+ sanctioned internal channel that carries a bare parent name, not a public
72
+ [ref](refs.md) — agents never construct it.
73
+
74
+ Search hits for the parent memory are then enriched in-place: the parent's
75
+ description and tags are swapped with the derived child's surface text, and
76
+ an `expandTo: memories/<derived>` field on the hit points at the richer
77
+ derived ref. The parent ref itself is preserved on the hit, so existing
78
+ automation keeps working — agents that want the deeper summary follow
79
+ `expandTo`.
80
+
81
+ ## Defaults
82
+
83
+ - Hot-path memories (those written via `akm remember`) receive
84
+ `captureMode: hot` and `beliefState: asserted` in their frontmatter
85
+ automatically.
86
+ - Background-derived memories (those inferred from other assets by `akm
87
+ improve`) receive `captureMode: background`.
88
+ - A memory with no explicit `beliefState` defaults to `active`.
89
+ - `akm search --belief` defaults to `all` — no filter is applied unless you
90
+ pass `current` or `historical` explicitly.
91
+
92
+ ## Security / persistence implications
93
+
94
+ - Memories are plain markdown files inside a bundle directory; there is no
95
+ separate memory store. `akm improve` and `akm lint` only operate on
96
+ writable sources — a read-only registry-cached memory source is excluded
97
+ from cleanup and derivation passes even if it's indexed.
98
+ - The derived-memory `source:` backref and the index's `derived_from` column
99
+ are an internal provenance channel, not a ref an agent should read,
100
+ construct, or rely on programmatically. Use the `expandTo` field on a
101
+ search hit instead.
102
+ - Belief-state frontmatter is rewritten in place by `akm improve`'s memory
103
+ cleanup lane when autonomy is enabled (`experimental.improveAutonomy`);
104
+ with autonomy off, cleanup is analyzed but not applied. See
105
+ `STABILITY.md`'s "`akm improve` autonomy" section.
106
+
107
+ ## Stability
108
+
109
+ Per `STABILITY.md`, **memory belief-state transitions are Experimental**:
110
+ `captureMode`, `beliefState`, contradiction edges, and the consolidate
111
+ journal are observable but the algorithm that writes them is tuning across
112
+ patch releases. Do not script against the exact transition logic — the
113
+ frontmatter fields and their meanings above are the stable-enough surface to
114
+ read, but when and how akm assigns them is still settling. The `lesson`
115
+ asset type, which shares the same distillation pipeline, is also
116
+ Experimental for the same reason.
117
+
118
+ ## See also
119
+
120
+ - [Concepts](../guides/concepts.md) — how a memory fits the capability model
121
+ - [Refs](refs.md) — the public ref grammar (distinct from the internal derived-memory backref)
122
+ - [Asset Types](asset-types.md) — where `memory` sits in the full type taxonomy
123
+ - [`akm remember`](cli.md#remember) — the capture command and its flags
124
+ - `STABILITY.md` — the full stability tier index, including `akm improve` autonomy
@@ -0,0 +1,156 @@
1
+ # Refs
2
+
3
+ Reference for the ref grammar `akm search` emits and `akm show` consumes,
4
+ rename semantics, and namespacing conventions.
5
+
6
+ ## Contract
7
+
8
+ A **ref** is a compact handle identifying one capability. Agents should
9
+ treat refs as opaque tokens — get them from search or curate, pass them to
10
+ show. The structured `conceptId` and `bundle` fields in search results
11
+ provide the same information in parseable form; never parse a ref string by
12
+ hand.
13
+
14
+ ## Grammar
15
+
16
+ ```text
17
+ [bundle//]conceptId[#fragment]
18
+ ```
19
+
20
+ | Part | Required | Description |
21
+ | --- | --- | --- |
22
+ | `bundle` | no | Narrows lookup to one installed bundle, separated from the rest of the ref by `//`. Omit it and the ref resolves against the workspace `defaultBundle`, then the remaining bundles in installation-priority order. |
23
+ | `conceptId` | yes | Subdir-qualified within its bundle: the placement subdirectory followed by the item's canonical name (extension stripped for markdown-like types; scripts and secrets keep their natural filename). `type` is not part of a ref — the subdirectory carries that signal. |
24
+ | `fragment` | no | A selector for part of the item. Input-only — never stored. |
25
+
26
+ Examples: `scripts/deploy.sh`, `agents/reviewer`, `knowledge/api-guide`,
27
+ `workflows/ship-release`, `team-catalog//scripts/deploy.sh`,
28
+ `personal//knowledge/guide`, `knowledge/api-guide#authentication`.
29
+
30
+ Source locators like `github:owner/repo` and `npm:@scope/pkg` are **install
31
+ refs**, a distinct grammar accepted only by `akm bundle add` and `akm
32
+ clone`. They are not asset refs and are never addressable through `akm
33
+ show`.
34
+
35
+ This reference page is deliberately non-normative prose over the same
36
+ grammar; [`docs/architecture/specs/ref.md`](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/ref.md)
37
+ is the normative spec, including the `parseBundleRef` grammar, fragment
38
+ resolution rules, and reserved-name handling.
39
+
40
+ ## Namespacing
41
+
42
+ AKM supports **physical-subdirectory namespacing** — no extra flags
43
+ required. Drop assets under nested directories beneath the type folder and
44
+ the path becomes part of the ref's name:
45
+
46
+ ```text
47
+ memories/projectA/auth-tip.md → memories/projectA/auth-tip
48
+ memories/teamA/clientX/notes.md → memories/teamA/clientX/notes
49
+ skills/projectB/lint-fix.md → skills/projectB/lint-fix
50
+ knowledge/clientX/api-guide.md → knowledge/clientX/api-guide
51
+ ```
52
+
53
+ This works for **any** asset type. The subpath segments become part of the
54
+ conceptId, so `akm search "projectA" --type memory` narrows results to that
55
+ subtree, and `akm show memories/projectA/auth-tip` resolves the full ref.
56
+
57
+ There is also a **ref-prefix query syntax** — a query that is a conceptId
58
+ prefix ending in `/` enumerates that subtree instead of keyword-matching:
59
+
60
+ ```sh
61
+ akm search "memories/" # every memory
62
+ akm search "memories/projectA/" # exactly that subtree
63
+ akm search "team-catalog//" # every item in one bundle
64
+ akm search "team-catalog//skills/" # one subtree of one bundle
65
+ ```
66
+
67
+ Enumeration is `/`-boundary exact — a sibling `projectAlpha/` scope does not
68
+ leak — and hits are a deterministic listing with the fixed browse score `1`,
69
+ not a relevance ranking. Because it matches conceptIds, it works for items
70
+ from every adapter, and you can copy a ref prefix straight out of search
71
+ output and paste it back as a query. A complete ref
72
+ (`memories/projectA/auth-tip`, no trailing `/`) stays an ordinary keyword
73
+ search — resolving a single ref is `akm show`'s job.
74
+
75
+ **Recommendation:** use physical subdirectories now to organize multi-project
76
+ or multi-team bundles. They sort cleanly on disk and require no
77
+ configuration.
78
+
79
+ **Which subdirectory?** Choose the partition axis by asset **type**:
80
+ scope-born types (`memory`, `lesson`, `task`, `env`, `secret`) take the
81
+ current **project/client** slug; reuse-born types (`knowledge`, `skill`,
82
+ `fact`, `script`) take a stable **domain**; global types (`command`, `agent`,
83
+ `workflow`) stay at the type root or a tool slug. The full rules — depth
84
+ limits, no-volatile-facets, off-axis facets as tags, and how to cross-link
85
+ for retrieval — ship as the `facts/conventions/organization`,
86
+ `facts/conventions/backlinks`, and `facts/conventions/domains` convention
87
+ facts in the bundle skeleton, and are surfaced to agents automatically at
88
+ authoring time.
89
+
90
+ ### Planned
91
+
92
+ Not part of the current stability contract; see
93
+ [ROADMAP.md](../../ROADMAP.md) for what's committed:
94
+
95
+ - A `--namespace <ns>` flag to provide a thin name-prefix normalizer on
96
+ `search`, `remember`, `improve`, and `feedback` so the same prefix doesn't
97
+ have to be typed every time.
98
+ - A `::` delimiter (for example `projectA::memories/auth-tip`) to provide
99
+ strict isolation so refs from different namespaces never collide in
100
+ ranking or recall.
101
+
102
+ Until those land, physical subdirectories remain the recommended pattern.
103
+
104
+ ## Renames and moves
105
+
106
+ **Treat a ref as permanent.** A rename is **delete plus create**: the new
107
+ path is a new identity, so the destination starts with fresh learned state
108
+ (utility, salience, usage history) and any inbound refs to the old path
109
+ dangle. When you must rename:
110
+
111
+ ```sh
112
+ mv ~/akm/memories/old-note.md ~/akm/memories/new-note.md
113
+ # update any intentional refs (they are fully qualified: bundle//memories/old-note)
114
+ akm index
115
+ akm lint # confirms nothing dangles
116
+ ```
117
+
118
+ Moving an item between bundles is copy/import followed by deletion from the
119
+ source — both the bundle and the concept identity change. `akm mv`, which
120
+ promised identity-preserving renames, was removed in 0.9.0: its inbound-ref
121
+ rewriting targeted bare conceptIds rather than the anchored
122
+ `bundle//conceptId` prose form, so it could rewrite non-refs while leaving
123
+ real refs dangling. The procedure above is the only supported path today.
124
+
125
+ To carry an asset's earned signal (feedback, usage, salience/outcome
126
+ history) across a rename, the maintainer script `scripts/rekey-asset-ref.ts`
127
+ re-keys those rows onto the new ref before `akm index` runs; it is Internal
128
+ tooling, not a supported command surface. See
129
+ [the decision record](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/0.9.0-decisions.md#d3--renames-are-delete--create-akm-mv-ships-experimental).
130
+
131
+ ## Refs in prose
132
+
133
+ Refs embedded in prose must use the fully-qualified `bundle//conceptId` form
134
+ — the bundle-slug charset makes such a token lexically anchored — or a
135
+ native link form owned by the adapter (OKF links, wiki links). A bare
136
+ conceptId in prose is ordinary text, not a ref, and no akm tool rewrites it.
137
+
138
+ ## Stability
139
+
140
+ Per `STABILITY.md`, this is **Stable** surface: the
141
+ `[bundle//]conceptId[#fragment]` grammar (durable state always stores the
142
+ fully-qualified `bundle//conceptId`; the short form is accepted input only),
143
+ conceptId-prefix enumeration, and the rename-is-delete-plus-create procedure
144
+ are all named explicitly in the Stable tier, and the ref grammar is called
145
+ out as frozen at 1.0 alongside the supported source model, search behavior,
146
+ and write-target rules. The `--namespace` flag and `::` delimiter above are
147
+ On the horizon, not yet part of the contract. See `STABILITY.md` for the
148
+ full command- and surface-level tier index.
149
+
150
+ ## See also
151
+
152
+ - [Concepts](../guides/concepts.md) — where refs fit in the retrieval loop
153
+ - [Asset Types](asset-types.md) — how a conceptId's subdirectory maps to an asset type
154
+ - [Memory](memory.md) — parent/derived-memory provenance backrefs
155
+ - [`docs/architecture/specs/ref.md`](https://github.com/itlackey/akm/blob/main/docs/architecture/specs/ref.md) — the normative ref grammar spec
156
+ - [ROADMAP.md](../../ROADMAP.md) — planned ref-syntax additions