akm-cli 0.9.0-rc.1 → 0.9.0-rc.2

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 (228) hide show
  1. package/CHANGELOG.md +223 -9
  2. package/SECURITY.md +23 -24
  3. package/dist/assets/help/help-improve.md +10 -10
  4. package/dist/assets/hints/cli-hints-full.md +44 -10
  5. package/dist/assets/hints/cli-hints-short.md +6 -2
  6. package/dist/assets/{profiles → improve-strategies}/default.json +1 -0
  7. package/dist/assets/{profiles → improve-strategies}/graph-refresh.json +1 -1
  8. package/dist/assets/{profiles → improve-strategies}/proactive-maintenance.json +2 -3
  9. package/dist/assets/{profiles → improve-strategies}/reflect-distill.json +3 -4
  10. package/dist/assets/stash-skeleton/README.md +28 -0
  11. package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +6 -0
  12. package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +6 -0
  13. package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +12 -1
  14. package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +11 -1
  15. package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +6 -0
  16. package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +9 -0
  17. package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +7 -0
  18. package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +7 -0
  19. package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +6 -0
  20. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +98 -0
  21. package/dist/assets/stash-skeleton/facts/conventions/domains.md +63 -0
  22. package/dist/assets/stash-skeleton/facts/conventions/organization.md +127 -0
  23. package/dist/assets/tasks/core/backup.yml +1 -0
  24. package/dist/assets/tasks/core/extract.yml +1 -0
  25. package/dist/assets/tasks/core/improve.yml +1 -0
  26. package/dist/assets/tasks/core/index-refresh.yml +1 -0
  27. package/dist/assets/tasks/core/sync.yml +1 -0
  28. package/dist/assets/tasks/core/version-check.yml +1 -0
  29. package/dist/assets/tasks/graph-refresh-weekly.yml +4 -4
  30. package/dist/assets/templates/html/health.html +5 -1
  31. package/dist/cli/config-migrate.js +31 -138
  32. package/dist/cli/config-validate.js +10 -8
  33. package/dist/cli.js +48 -14
  34. package/dist/commands/agent/agent-dispatch.js +17 -16
  35. package/dist/commands/agent/agent-support.js +0 -24
  36. package/dist/commands/agent/contribute-cli.js +5 -15
  37. package/dist/commands/backup-cli.js +54 -0
  38. package/dist/commands/config-cli.js +45 -159
  39. package/dist/commands/env/secret.js +8 -5
  40. package/dist/commands/health/checks.js +130 -83
  41. package/dist/commands/health/html-report.js +4 -0
  42. package/dist/commands/health/improve-metrics.js +30 -32
  43. package/dist/commands/health/llm-usage.js +19 -19
  44. package/dist/commands/health/md-report.js +4 -0
  45. package/dist/commands/health/metrics.js +2 -1
  46. package/dist/commands/health/surfaces.js +5 -4
  47. package/dist/commands/health.js +1 -1
  48. package/dist/commands/improve/consolidate/chunking.js +2 -2
  49. package/dist/commands/improve/consolidate.js +28 -25
  50. package/dist/commands/improve/distill/promote-memory.js +5 -12
  51. package/dist/commands/improve/distill/quality-gate.js +5 -7
  52. package/dist/commands/improve/distill.js +16 -5
  53. package/dist/commands/improve/eligibility.js +22 -12
  54. package/dist/commands/improve/extract-cli.js +47 -19
  55. package/dist/commands/improve/extract.js +110 -62
  56. package/dist/commands/improve/improve-cli.js +38 -16
  57. package/dist/commands/improve/improve-result-file.js +30 -24
  58. package/dist/commands/improve/improve-strategies.js +137 -0
  59. package/dist/commands/improve/improve.js +60 -30
  60. package/dist/commands/improve/locks.js +66 -45
  61. package/dist/commands/improve/loop-stages.js +75 -33
  62. package/dist/commands/improve/memory/memory-belief.js +79 -7
  63. package/dist/commands/improve/memory/memory-contradiction-detect.js +12 -4
  64. package/dist/commands/improve/preparation.js +71 -73
  65. package/dist/commands/improve/procedural.js +3 -2
  66. package/dist/commands/improve/recombine.js +2 -1
  67. package/dist/commands/improve/reflect.js +119 -214
  68. package/dist/commands/improve/shared.js +11 -5
  69. package/dist/commands/lint/base-linter.js +152 -42
  70. package/dist/commands/mv-cli.js +809 -0
  71. package/dist/commands/proposal/proposal-cli.js +18 -8
  72. package/dist/commands/proposal/propose.js +64 -69
  73. package/dist/commands/read/knowledge.js +436 -4
  74. package/dist/commands/read/remember-cli.js +39 -2
  75. package/dist/commands/read/search-cli.js +6 -1
  76. package/dist/commands/registry-cli.js +29 -14
  77. package/dist/commands/remember.js +2 -0
  78. package/dist/commands/sources/init.js +13 -14
  79. package/dist/commands/sources/schema-repair.js +2 -4
  80. package/dist/commands/sources/source-add.js +62 -73
  81. package/dist/commands/sources/source-manage.js +50 -46
  82. package/dist/commands/sources/stash-cli.js +41 -4
  83. package/dist/commands/tasks/default-tasks.js +12 -12
  84. package/dist/commands/tasks/tasks-cli.js +7 -3
  85. package/dist/commands/tasks/tasks.js +113 -18
  86. package/dist/commands/wiki-cli.js +9 -10
  87. package/dist/core/asset/frontmatter.js +12 -2
  88. package/dist/core/common.js +5 -3
  89. package/dist/core/config/config-io.js +28 -17
  90. package/dist/core/config/config-schema.js +358 -66
  91. package/dist/core/config/config-types.js +3 -3
  92. package/dist/core/config/config-version.js +29 -0
  93. package/dist/core/config/config-walker.js +98 -27
  94. package/dist/core/config/config.js +132 -266
  95. package/dist/core/config/deep-merge.js +41 -0
  96. package/dist/core/config/engine-semantics.js +32 -0
  97. package/dist/core/errors.js +2 -2
  98. package/dist/core/extra-params.js +61 -0
  99. package/dist/core/file-lock.js +201 -56
  100. package/dist/core/improve-result.js +178 -0
  101. package/dist/core/maintenance-barrier.js +119 -0
  102. package/dist/core/migration-backup.js +416 -0
  103. package/dist/core/paths.js +3 -0
  104. package/dist/core/redaction.js +358 -0
  105. package/dist/core/state/migrations.js +17 -2
  106. package/dist/core/state-db.js +44 -1
  107. package/dist/indexer/db/db.js +116 -1
  108. package/dist/indexer/graph/graph-extraction.js +28 -16
  109. package/dist/indexer/index-writer-lock.js +31 -24
  110. package/dist/indexer/index-written-assets.js +15 -6
  111. package/dist/indexer/indexer.js +47 -2
  112. package/dist/indexer/passes/memory-inference.js +10 -6
  113. package/dist/indexer/passes/metadata.js +250 -0
  114. package/dist/indexer/search/db-search.js +111 -44
  115. package/dist/indexer/search/fts-query.js +41 -0
  116. package/dist/indexer/search/ranking-contributors.js +48 -0
  117. package/dist/indexer/search/ranking.js +36 -23
  118. package/dist/indexer/search/search-fields.js +11 -1
  119. package/dist/integrations/agent/builder-shared.js +7 -0
  120. package/dist/integrations/agent/builders.js +5 -52
  121. package/dist/integrations/agent/config.js +3 -143
  122. package/dist/integrations/agent/detect.js +17 -2
  123. package/dist/integrations/agent/engine-resolution.js +202 -0
  124. package/dist/integrations/agent/index.js +1 -2
  125. package/dist/integrations/agent/model-aliases.js +7 -2
  126. package/dist/integrations/agent/profiles.js +6 -99
  127. package/dist/integrations/agent/runner-dispatch.js +76 -13
  128. package/dist/integrations/agent/runner.js +76 -207
  129. package/dist/integrations/agent/spawn.js +4 -6
  130. package/dist/integrations/harnesses/aider/agent-builder.js +2 -3
  131. package/dist/integrations/harnesses/aider/index.js +0 -1
  132. package/dist/integrations/harnesses/amazonq/agent-builder.js +2 -3
  133. package/dist/integrations/harnesses/amazonq/index.js +0 -1
  134. package/dist/integrations/harnesses/claude/agent-builder.js +2 -3
  135. package/dist/integrations/harnesses/claude/index.js +0 -2
  136. package/dist/integrations/harnesses/codex/agent-builder.js +2 -3
  137. package/dist/integrations/harnesses/codex/index.js +0 -1
  138. package/dist/integrations/harnesses/copilot/agent-builder.js +2 -3
  139. package/dist/integrations/harnesses/copilot/index.js +0 -1
  140. package/dist/integrations/harnesses/gemini/agent-builder.js +2 -3
  141. package/dist/integrations/harnesses/gemini/index.js +0 -1
  142. package/dist/integrations/harnesses/index.js +1 -24
  143. package/dist/integrations/harnesses/opencode/agent-builder.js +2 -3
  144. package/dist/integrations/harnesses/opencode/index.js +0 -6
  145. package/dist/integrations/harnesses/opencode-sdk/harness.js +1 -6
  146. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +274 -191
  147. package/dist/integrations/harnesses/openhands/agent-builder.js +2 -3
  148. package/dist/integrations/harnesses/openhands/index.js +0 -1
  149. package/dist/integrations/harnesses/pi/agent-builder.js +2 -3
  150. package/dist/integrations/harnesses/pi/index.js +0 -1
  151. package/dist/integrations/harnesses/types.js +1 -32
  152. package/dist/integrations/lockfile.js +32 -21
  153. package/dist/llm/client.js +48 -14
  154. package/dist/llm/feature-gate.js +15 -47
  155. package/dist/llm/graph-extract.js +1 -1
  156. package/dist/llm/index-passes.js +8 -42
  157. package/dist/llm/memory-infer-impl.js +1 -1
  158. package/dist/llm/usage-persist.js +4 -0
  159. package/dist/llm/usage-telemetry.js +35 -5
  160. package/dist/output/shapes/helpers.js +2 -1
  161. package/dist/output/shapes/passthrough.js +2 -0
  162. package/dist/output/text/helpers.js +3 -1
  163. package/dist/schemas/akm-config.json +11013 -8600
  164. package/dist/schemas/akm-task.json +87 -0
  165. package/dist/schemas/akm-workflow.json +57 -13
  166. package/dist/scripts/migrate-storage.js +8591 -509
  167. package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +8623 -484
  168. package/dist/setup/detected-engines.js +142 -0
  169. package/dist/setup/engine-config.js +89 -0
  170. package/dist/setup/setup.js +236 -132
  171. package/dist/setup/steps/connection.js +61 -32
  172. package/dist/setup/steps/platforms.js +4 -4
  173. package/dist/setup/steps.js +3 -2
  174. package/dist/storage/database.js +13 -1
  175. package/dist/storage/engines/sqlite-migrations.js +1 -0
  176. package/dist/storage/repositories/improve-runs-repository.js +5 -5
  177. package/dist/storage/repositories/task-history-repository.js +78 -0
  178. package/dist/storage/repositories/workflow-runs-repository.js +9 -8
  179. package/dist/tasks/parser.js +138 -52
  180. package/dist/tasks/runner.js +71 -75
  181. package/dist/tasks/schema.js +1 -1
  182. package/dist/tasks/validator.js +11 -6
  183. package/dist/wiki/wiki.js +9 -8
  184. package/dist/workflows/authoring/workflow-program-template.yaml +3 -3
  185. package/dist/workflows/concurrency-policy.js +15 -0
  186. package/dist/workflows/db.js +65 -13
  187. package/dist/workflows/exec/brief.js +18 -24
  188. package/dist/workflows/exec/frozen-judge.js +47 -0
  189. package/dist/workflows/exec/native-executor.js +124 -65
  190. package/dist/workflows/exec/report.js +93 -33
  191. package/dist/workflows/exec/run-workflow.js +38 -25
  192. package/dist/workflows/exec/scheduler.js +12 -41
  193. package/dist/workflows/exec/step-work.js +91 -35
  194. package/dist/workflows/ir/compile.js +13 -26
  195. package/dist/workflows/ir/freeze.js +243 -0
  196. package/dist/workflows/ir/plan-hash.js +40 -5
  197. package/dist/workflows/ir/schema.js +542 -1
  198. package/dist/workflows/parser.js +7 -0
  199. package/dist/workflows/program/parser.js +132 -23
  200. package/dist/workflows/program/project.js +3 -4
  201. package/dist/workflows/program/schema.js +2 -2
  202. package/dist/workflows/resource-limits.js +20 -0
  203. package/dist/workflows/runtime/plan-classifier.js +187 -0
  204. package/dist/workflows/runtime/runs.js +54 -47
  205. package/dist/workflows/runtime/workflow-asset-loader.js +0 -22
  206. package/dist/workflows/validator.js +25 -0
  207. package/docs/data-and-telemetry.md +2 -2
  208. package/docs/migration/release-notes/0.6.0.md +1 -1
  209. package/docs/migration/release-notes/0.7.0.md +5 -4
  210. package/docs/migration/v0.8-to-v0.9.md +401 -0
  211. package/package.json +4 -2
  212. package/schemas/akm-config.json +16638 -0
  213. package/schemas/akm-task.json +87 -0
  214. package/schemas/akm-workflow.json +372 -0
  215. package/dist/commands/improve/improve-profiles.js +0 -168
  216. package/dist/core/config/config-migration.js +0 -602
  217. package/dist/core/deep-merge.js +0 -38
  218. package/dist/llm/call-ai.js +0 -62
  219. package/dist/setup/legacy-config.js +0 -106
  220. package/docs/README.md +0 -104
  221. /package/dist/assets/{profiles → improve-strategies}/catchup.json +0 -0
  222. /package/dist/assets/{profiles → improve-strategies}/consolidate.json +0 -0
  223. /package/dist/assets/{profiles → improve-strategies}/frequent.json +0 -0
  224. /package/dist/assets/{profiles → improve-strategies}/memory-focus.json +0 -0
  225. /package/dist/assets/{profiles → improve-strategies}/quick.json +0 -0
  226. /package/dist/assets/{profiles → improve-strategies}/recombine-only.json +0 -0
  227. /package/dist/assets/{profiles → improve-strategies}/synthesize.json +0 -0
  228. /package/dist/assets/{profiles → improve-strategies}/thorough.json +0 -0
@@ -0,0 +1,401 @@
1
+ # Migrating from akm 0.8.x to 0.9.0
2
+
3
+ 0.9.0 is a strict engine and strategy cutover. It removes the CLI deprecation
4
+ aliases introduced during the 0.8 stabilization window and the deprecated
5
+ `vault` asset type. It does not translate profile-based configuration, workflow,
6
+ or task files automatically. Create the recovery backup before changing a live
7
+ installation, then migrate the affected assets deliberately.
8
+
9
+ ## Engine And Task Assets
10
+
11
+ Before editing a 0.8 configuration, create a recovery bundle:
12
+
13
+ ```sh
14
+ akm backup create --for 0.9.0
15
+ ```
16
+
17
+ The immutable bundle is stored under `$CACHE/migration-backups/0.9.0`
18
+ (`$XDG_CACHE_HOME/akm` by default on Linux). It records both present and absent files for
19
+ `config.json`, `state.db`, and `workflow.db`, verifies every captured file by
20
+ SHA-256, and is created automatically before AKM first opens either canonical
21
+ durable database for the 0.9 engine migrations. Do not move individual files
22
+ into or out of the bundle; verification fails closed on any mismatch.
23
+
24
+ Replace `profiles.llm.<name>` and `profiles.agent.<name>` with one
25
+ `engines.<name>` map. Replace `defaults.llm`, `defaults.agent`, and
26
+ `defaults.improve` with `defaults.llmEngine`, `defaults.engine`, and
27
+ `defaults.improveStrategy`. Replace `profiles.improve.<name>` with
28
+ `improve.strategies.<name>`, process `mode`/`profile` with `engine`, and CLI
29
+ `--profile` with `--strategy` for improve or `--engine` for execution.
30
+
31
+ Do not reuse a colliding LLM and agent profile name without deciding which new
32
+ engine names make the distinction clear. AKM cannot safely infer that choice.
33
+
34
+ Task files are strict YAML v2. Add `version: 2`, replace prompt `profile:` with
35
+ `engine:`, and retain only fields valid for the target:
36
+
37
+ ```yaml
38
+ version: 2
39
+ schedule: "@daily"
40
+ prompt: Review the previous day's changes.
41
+ engine: reviewer
42
+ model: claude-sonnet-4-6
43
+ timeoutMs: 600000
44
+ enabled: true
45
+ ```
46
+
47
+ Prompt tasks may use `engine`, `model`, `timeoutMs`, and `llm`; command tasks
48
+ may use `timeoutMs`; workflow tasks may use `params`. Unknown and wrong-target
49
+ keys are errors. `akm tasks list`, `sync`, and `doctor` report stale v1 files;
50
+ `show`, `run`, `enable`, and `disable` reject them without mutation. Regenerate
51
+ the known default improve tasks or replace `akm improve --profile <name>` with
52
+ `akm improve --strategy <name>` yourself. AKM never rewrites arbitrary shell
53
+ commands.
54
+
55
+ ## CLI rename table (old → new, removed 0.9.0)
56
+
57
+ Every old spelling prints a stderr deprecation warning in 0.8.x (suppressed
58
+ under `--quiet`) and delegates to the canonical form. JSON stdout is unaffected.
59
+
60
+ | Old spelling (0.8, deprecated) | Canonical (use this) | Notes |
61
+ | --- | --- | --- |
62
+ | `akm proposals` | `akm proposal list` | bare `akm proposal` also lists |
63
+ | `akm show proposal <id>` | `akm proposal show <id>` | |
64
+ | `akm diff <id>` | `akm proposal diff <id>` | |
65
+ | `akm accept <id>` | `akm proposal accept <id>` | |
66
+ | `akm reject <id>` | `akm proposal reject <id>` | |
67
+ | `akm revert <id>` | `akm proposal revert <id>` | |
68
+ | `--detail summary` | `--shape summary` | `--detail` is now verbosity only (`brief\|normal\|full`) |
69
+ | `--detail agent` | `--shape agent` | |
70
+ | `--for-agent` | `--shape agent` | |
71
+ | `--source` (on `accept`/`reject`/`history`) | `--generator` | unchanged on `search`/`curate`/`graph`/`remember` |
72
+ | `akm save` | `akm sync` | `sync` = commit + optional push; adds `--no-push` |
73
+ | `akm enable <component>` | `akm config enable <component>` | |
74
+ | `akm disable <component>` | `akm config disable <component>` | |
75
+ | `akm events` | `akm log` | `log` is primary in 0.9.0; `history` is a different (asset-scoped) surface |
76
+ | `akm wiki remove --force` | `akm wiki remove -y` | `--force` skips the new confirmation prompt; use `-y`/`--yes` |
77
+ | `akm feedback --note <text>` | `akm feedback --reason <text>` | |
78
+ | `akm workflow next --dry-run` | (removed) | the flag is gone; `next` never supported a dry run |
79
+
80
+ Additive (non-breaking) singular aliases also shipped in 0.8: `akm task`
81
+ (= `akm tasks`) and `akm lesson` (= `akm lessons`).
82
+
83
+ ## Safety guards added in 0.8 (behavior change for non-interactive callers)
84
+
85
+ Two previously-unguarded destructive paths now confirm before acting. **Scripts
86
+ that invoked these non-interactively must add `-y` / `--yes`:**
87
+
88
+ - `akm registry remove <name>` — prompts before removing the registry; pass `-y`
89
+ to skip. Non-interactive use without `-y` aborts.
90
+ - `akm proposal accept --generator <g>` (the **bulk** form) — prompts before
91
+ promoting every matching proposal. Single-id accept is unchanged (revertable).
92
+
93
+ ## Proposal triage replaces the `process-proposals` prompt task
94
+
95
+ Move a 0.8 triage process into the selected 0.9 improve strategy. The folded
96
+ pre-pass remains the recommended shape:
97
+
98
+ ```jsonc
99
+ {
100
+ "improve": {
101
+ "strategies": {
102
+ "default": {
103
+ "processes": {
104
+ "triage": {
105
+ "enabled": true,
106
+ "applyMode": "queue",
107
+ "policy": "personal-stash"
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ If a separate schedule is required, replace the old agent prompt task with a
117
+ strict task YAML v2 command:
118
+
119
+ ```yaml
120
+ version: 2
121
+ schedule: "20 * * * *"
122
+ command: akm proposal drain --policy personal-stash --yes
123
+ enabled: true
124
+ name: Drain AKM proposal queue
125
+ ```
126
+
127
+ Task files live in your stash and AKM does not rewrite them. The deterministic
128
+ `akm proposal drain` verb, or the folded strategy pre-pass, is the supported
129
+ 0.9 path.
130
+
131
+ ## Single batch-at-boundary git commit (`options.pushOnCommit` deprecated)
132
+
133
+ 0.9.0 unifies the two commit models for git-backed sources onto a single
134
+ **batch-at-boundary** model (issue #507). Previously, writing an asset to a
135
+ writable git `--target` committed (and optionally pushed) **per asset**, gated
136
+ on `options.pushOnCommit`. That staged only the single asset file (leaving
137
+ `.akm/` state dirty) and produced one noisy commit per asset.
138
+
139
+ Now every write/delete to a source is a plain filesystem operation with **no**
140
+ per-asset commit. Git-backed targets are committed **once** at the end of the
141
+ operation (e.g. `akm remember --target <git-source>`, proposal accept/revert,
142
+ consolidate) as a single complete commit (`git add -A` staging `.akm/` + assets
143
+ together), pushed under the same `writable + remote` gate as `akm save`/`akm sync`.
144
+
145
+ **Migration:** `options.pushOnCommit` is **deprecated**. Existing configs still
146
+ parse — its push intent is honored via the batch push gate, and akm prints a
147
+ one-time deprecation warning when it encounters the option. Remove
148
+ `pushOnCommit` from your source config and rely on `writable: true` (plus a
149
+ configured remote) to push. No behavior is lost: a writable git target with a
150
+ remote is still pushed; a target without a remote (or with push disabled)
151
+ commits only.
152
+
153
+ ## `vault` → `env` / `secret`
154
+
155
+ 0.9.0 also removes the deprecated `vault` asset type. Its replacement, the `env`
156
+ asset type, shipped in 0.8.0 alongside a deprecation shim and an automatic
157
+ `vaults/` → `env/` migration. This guide explains what changed, how to migrate,
158
+ and what 0.9.0 removes.
159
+
160
+ > **TL;DR:** In 0.8.0, run the migration (`akm-migrate-storage --yes`) to copy
161
+ > `vaults/` → `env/`, then switch your scripts from `akm vault …` to
162
+ > `akm env …` and from `source "$(akm vault path …)"` to
163
+ > `akm env run env:<name> -- <command>` (or `-- $SHELL` for an interactive
164
+ > session). Everything keeps working through 0.8.x; the `vault` verb and
165
+ > `vault:` refs are removed in 0.9.0.
166
+
167
+ ## Table of contents
168
+
169
+ - [Why `vault` → `env`](#why-vault--env)
170
+ - [What changed in 0.8.0](#what-changed-in-080)
171
+ - [Running the migration](#running-the-migration)
172
+ - [Command mapping](#command-mapping)
173
+ - [The safe shell-load path](#the-safe-shell-load-path)
174
+ - [Single values are now secrets](#single-values-are-now-secrets)
175
+ - [What 0.9.0 removes](#what-090-removes)
176
+ - [Verifying the migration](#verifying-the-migration)
177
+ - [Rolling back](#rolling-back)
178
+
179
+ ## Why `vault` → `env`
180
+
181
+ The old `vault` type managed individual `KEY=value` entries: `vault set`,
182
+ `vault unset`, comment management, and bespoke value quoting. That hand-rolled
183
+ write surface was the riskiest part of the feature. 0.8.0 simplifies the model
184
+ and splits it by **purpose**:
185
+
186
+ - **`env`** — a group of related **configuration** for an app/service (URLs,
187
+ flags, and any credentials it needs) in one `.env` file, sourced or injected
188
+ **wholesale**. Values may or may not be sensitive — all are protected. akm no
189
+ longer edits entries; you edit the file with your own editor and akm loads it.
190
+ - **`secret`** — a single **sensitive value** used on its own for authentication
191
+ (one file = one value: a token, key, or cert), for the cases where
192
+ `vault set <ref> <KEY>` was used to store one credential.
193
+
194
+ Both protect values identically (never written to stdout, the index, or any
195
+ structured output); env additionally surfaces key names for discoverability
196
+ (comment text is never surfaced — comments can contain commented-out
197
+ credentials). Pick `env` for configuration, `secret` for a standalone
198
+ authentication credential.
199
+
200
+ ## What changed in 0.8.0
201
+
202
+ | Area | 0.7.x / early 0.8 | 0.8.0+ |
203
+ | --- | --- | --- |
204
+ | Asset type | `vault` | `env` (`vault` is a deprecated alias) |
205
+ | Directory | `vaults/` | `env/` (`vaults/` frozen after migration) |
206
+ | Ref prefix | `vault:prod` | `env:prod` (also accepts `environment:`; `vault:` still resolves) |
207
+ | Shell load | `source "$(akm vault path …)"` | `akm env run env:prod -- $SHELL` (or `export --out <file>` then source) |
208
+ | Run | `akm vault run vault:prod[/KEY] -- …` | `akm env run env:prod [--only K] -- …` |
209
+ | Set one value | `akm vault set vault:prod KEY` | `akm secret set secret:key` (or edit the `.env`) |
210
+ | Ingest a `.env` | (hand-copy into `vaults/`) | `akm env create prod --from-file ./.env` |
211
+ | Delete | (hand-delete the file) | `akm env remove env:prod` |
212
+ | Renderer | `vault-env` | `env-file` |
213
+ | Audit event | `vault_access` | `env_access` (`metadata.deprecatedAlias` when reached via the `vault` shim) |
214
+
215
+ The `akm vault` verb still works in 0.8.x: it prints a stderr deprecation
216
+ warning and delegates `list` / `path` / `export` / `run` / `create` to the
217
+ `env` handlers. `vault set` / `vault unset` and the single-key
218
+ `vault run <ref>/KEY` form are **hard-errors** with a signpost — silent changes
219
+ to secret-handling behaviour are unacceptable.
220
+
221
+ ## Running the migration
222
+
223
+ The migration copies `<stash>/vaults/` → `<stash>/env/`. It is **copy, never
224
+ move**: the legacy `vaults/` tree is left intact as a frozen copy and a
225
+ `vaults/.migrated` marker is written so re-runs are no-ops.
226
+
227
+ ```sh
228
+ # Preview (no changes written)
229
+ akm-migrate-storage --dry-run
230
+
231
+ # Apply
232
+ akm-migrate-storage --yes
233
+
234
+ # From a source clone:
235
+ bun scripts/migrate-storage.ts --yes
236
+ ```
237
+
238
+ What the `vaults/ → env/` step does:
239
+
240
+ 1. Skips entirely if there is no `vaults/` directory, if the `.migrated` marker
241
+ already exists, or if `vaults/` contains no `.env` files (e.g. a fresh
242
+ install).
243
+ 2. Copies every file under `vaults/` into `env/` as **opaque bytes** (`.env`,
244
+ `.sensitive`, and `.lock` sidecars alike) — contents are never read or
245
+ re-serialised.
246
+ 3. **Never overwrites** an `env/` file you already authored (those are skipped
247
+ and preserved).
248
+ 4. Tightens permissions on the copied tree: `0600` files, `0700` directories,
249
+ then verifies the mode. (The generic copy helper checks size only, so this
250
+ pass guarantees migrated secret material does not land at the umask default.)
251
+ 5. Verifies the post-copy `.env` count is at least the source count, then writes
252
+ the `vaults/.migrated` marker.
253
+
254
+ After migrating, run `akm index` to refresh search so entries surface under
255
+ `env:` rather than `vault:`.
256
+
257
+ ## Command mapping
258
+
259
+ ```sh
260
+ # List
261
+ akm vault list → akm env list
262
+
263
+ # Inspect keys (values never shown)
264
+ akm show vault:prod → akm show env:prod
265
+
266
+ # Load values into a shell (use a subshell — safe, nothing on disk)
267
+ source "$(akm vault path vault:prod)" → akm env run env:prod -- $SHELL
268
+
269
+ # Run a command with the env injected
270
+ akm vault run vault:prod -- ./deploy.sh → akm env run env:prod -- ./deploy.sh
271
+
272
+ # Create / ingest an existing .env
273
+ akm vault create prod → akm env create prod
274
+ # or: akm env create prod --from-file ./.env
275
+
276
+ # Edit (akm no longer manages entries)
277
+ akm vault set vault:prod DB_URL → $EDITOR "$(akm env path env:prod --quiet)"
278
+ # or: akm secret set secret:db-url
279
+ ```
280
+
281
+ Existing `vault:` refs embedded in your own assets are **not** rewritten (akm
282
+ never mutates your content). They keep resolving through 0.8.x: the resolver
283
+ prefers `env/` and falls back to the frozen `vaults/` copy.
284
+
285
+ ## The safe load paths
286
+
287
+ `env path` prints the **raw** file path. Do **not** `source` it: a hand-edited
288
+ or migrated `.env` containing `X=$(rm -rf ~)` would execute on `source`.
289
+
290
+ - **Processes / agents / interactive** — `akm env run env:prod -- <cmd>` (or
291
+ `-- $SHELL`). Values go straight into the child process, never through a shell
292
+ and never onto stdout. **This is the only path safe for AI agents** —
293
+ `env export`/`env path` put value-bearing data where a captured context would
294
+ ingest it.
295
+ - **A sourceable file** (a tool that must `source` a script) — `akm env export
296
+ env:prod --out <file>` writes single-quote-escaped `export KEY='value'` lines
297
+ to a file (mode 0600); the values are re-serialised so sourcing it can never
298
+ execute a substitution. `export` never prints values to stdout, so it requires
299
+ `--out`.
300
+ - **Docker `_FILE` / `--env-file`** — `akm env path env:prod --quiet` prints the
301
+ raw file path for tools that read it themselves.
302
+
303
+ ## Single values are now secrets
304
+
305
+ If you used `vault set <ref> <KEY>` to store a single credential, store it as a
306
+ [secret](../cli.md#secret) instead:
307
+
308
+ ```sh
309
+ printf '%s' "$TOKEN" | akm secret set secret:deploy-token
310
+ akm secret run secret:deploy-token GITHUB_TOKEN -- gh release create v1.0.0
311
+ ```
312
+
313
+ `akm env run` injects the **whole** file; the single-key `vault run <ref>/KEY`
314
+ form was removed because silently changing which variables a child process sees
315
+ is a security-relevant behaviour change.
316
+
317
+ ## What 0.9.0 removes
318
+
319
+ - The entire `akm vault` verb and its subcommands.
320
+ - The `vault:` ref alias (parsing a `vault:` ref becomes an unknown-type error
321
+ pointing at `env:`).
322
+ - The `vault` asset-spec entry, renderer (`vault-env`), and the `vault_access`
323
+ audit-event alias.
324
+ - The frozen `vaults/` directory is deleted **only** after explicit per-path
325
+ confirmation — the migration never auto-removes it.
326
+
327
+ Switch to `akm env` / `akm secret` and the `akm env run env:<name> -- <cmd>`
328
+ idiom before upgrading to 0.9.0.
329
+
330
+ ### If you upgraded straight to 0.9.0 without migrating
331
+
332
+ Because 0.9.0 removed the `vault` asset type, the indexer **no longer scans
333
+ `vaults/` at all**. If you jumped from 0.7/0.8 to 0.9.0 and never ran
334
+ `akm-migrate-storage`, the `.env` data still sitting in `vaults/` was never
335
+ copied to `env/` and will **not** appear under `env:` — it is silently
336
+ un-indexed (the files themselves are untouched on disk).
337
+
338
+ To make this non-silent, 0.9.0 adds a **one-time, read-only guard**: whenever
339
+ `akm index` (or any auto-index path) runs against a stash whose `vaults/`
340
+ directory holds `.env` files but has no `vaults/.migrated` marker, akm prints a
341
+ single warning pointing here and at `akm-migrate-storage`. The guard never
342
+ reads secret contents, and never writes, moves, or deletes anything — it only
343
+ detects the un-migrated state. The fix is the same idempotent, non-destructive
344
+ command as on 0.8:
345
+
346
+ ```sh
347
+ akm-migrate-storage --yes # copies vaults/ -> env/, leaving vaults/ intact
348
+ akm index # refresh search so entries surface under env:
349
+ ```
350
+
351
+ The `vaults/ → env/` migration step still ships in 0.9.0's
352
+ `akm-migrate-storage` (it is part of the `0.8 → 0.9` migration) precisely so a
353
+ late migration on a 0.9.0 install still works.
354
+
355
+ ## Verifying the migration
356
+
357
+ ```sh
358
+ # env/ now contains your former vault files
359
+ akm env list
360
+
361
+ # The frozen copy + marker are present
362
+ ls -la "$(akm config get stashDir)/vaults/.migrated"
363
+
364
+ # Values still never leak
365
+ akm show env:prod # key names only
366
+ akm search <a-secret-value> # no hits
367
+ ```
368
+
369
+ ## Restoring or downgrading the engine cutover
370
+
371
+ Stop scheduled AKM jobs and all running `akm improve`, `akm extract`, and
372
+ workflow engine processes first. Restore refuses while a live process lock or
373
+ workflow lease exists. Then, while still running the 0.9 binary, restore the
374
+ complete pre-cutover snapshot:
375
+
376
+ ```sh
377
+ akm backup restore --for 0.9.0 --confirm
378
+ ```
379
+
380
+ Restore verifies the manifest, permissions, sizes, and checksums before
381
+ replacing anything. It restores each original file and removes a canonical DB
382
+ that the manifest recorded as originally absent, including its WAL/SHM
383
+ sidecars. Restore also holds the global maintenance barrier from its last
384
+ lock/lease check through replacement, so a new index writer, improve/extract
385
+ lock, lockfile writer, or workflow engine lease cannot start in that window.
386
+ The recovery bundle itself remains in `$CACHE` for repeatable recovery. If
387
+ verification reports corruption, preserve the bundle and recover
388
+ from an independent backup; do not delete the manifest or regenerate it from a
389
+ post-cutover config.
390
+
391
+ Only after restore succeeds should you install the older AKM binary. A 0.8
392
+ binary must not run against a 0.9 config or against `state.db` migration 017 /
393
+ `workflow.db` migration 010. If no valid pre-cutover bundle exists, do not
394
+ downgrade in place: preserve the current config and databases, create a separate
395
+ 0.8 data/config root, and manually reconstruct the profile-based configuration.
396
+
397
+ ## Rolling back the vault copy
398
+
399
+ The migration is non-destructive — `vaults/` is untouched. To roll back, delete
400
+ the generated `env/` directory and remove the `vaults/.migrated` marker, then
401
+ downgrade akm. Because `env/` is a copy, no data is lost either way.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akm-cli",
3
- "version": "0.9.0-rc.1",
3
+ "version": "0.9.0-rc.2",
4
4
  "type": "module",
5
5
  "description": "akm (Agent Knowledge Management) — A package manager for AI agent skills, commands, tools, and knowledge. Works with Claude Code, OpenCode, Cursor, and any AI coding assistant.",
6
6
  "keywords": [
@@ -43,7 +43,9 @@
43
43
  "LICENSE",
44
44
  "docs/migration/release-notes",
45
45
  "docs/migration/v0.7-to-v0.8.md",
46
- "docs/data-and-telemetry.md"
46
+ "docs/migration/v0.8-to-v0.9.md",
47
+ "docs/data-and-telemetry.md",
48
+ "schemas"
47
49
  ],
48
50
  "bin": {
49
51
  "akm": "dist/akm",