akm-cli 0.9.0-rc.0 → 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 (262) hide show
  1. package/CHANGELOG.md +339 -2
  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/prompts/workflow-unit-preamble.md +26 -0
  11. package/dist/assets/stash-skeleton/README.md +28 -0
  12. package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +6 -0
  13. package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +6 -0
  14. package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +12 -1
  15. package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +11 -1
  16. package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +6 -0
  17. package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +9 -0
  18. package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +7 -0
  19. package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +7 -0
  20. package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +6 -0
  21. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +98 -0
  22. package/dist/assets/stash-skeleton/facts/conventions/domains.md +63 -0
  23. package/dist/assets/stash-skeleton/facts/conventions/organization.md +127 -0
  24. package/dist/assets/tasks/core/backup.yml +1 -0
  25. package/dist/assets/tasks/core/extract.yml +1 -0
  26. package/dist/assets/tasks/core/improve.yml +1 -0
  27. package/dist/assets/tasks/core/index-refresh.yml +1 -0
  28. package/dist/assets/tasks/core/sync.yml +1 -0
  29. package/dist/assets/tasks/core/version-check.yml +1 -0
  30. package/dist/assets/tasks/graph-refresh-weekly.yml +4 -4
  31. package/dist/assets/templates/html/health.html +5 -1
  32. package/dist/cli/config-migrate.js +31 -138
  33. package/dist/cli/config-validate.js +10 -8
  34. package/dist/cli.js +48 -14
  35. package/dist/commands/agent/agent-dispatch.js +17 -16
  36. package/dist/commands/agent/agent-support.js +0 -24
  37. package/dist/commands/agent/contribute-cli.js +5 -15
  38. package/dist/commands/backup-cli.js +54 -0
  39. package/dist/commands/config-cli.js +45 -159
  40. package/dist/commands/env/env-binding.js +95 -0
  41. package/dist/commands/env/env-cli.js +8 -65
  42. package/dist/commands/env/secret.js +8 -5
  43. package/dist/commands/health/checks.js +130 -83
  44. package/dist/commands/health/html-report.js +4 -0
  45. package/dist/commands/health/improve-metrics.js +30 -32
  46. package/dist/commands/health/llm-usage.js +19 -19
  47. package/dist/commands/health/md-report.js +4 -0
  48. package/dist/commands/health/metrics.js +2 -1
  49. package/dist/commands/health/surfaces.js +5 -4
  50. package/dist/commands/health.js +1 -1
  51. package/dist/commands/improve/consolidate/chunking.js +2 -2
  52. package/dist/commands/improve/consolidate.js +28 -25
  53. package/dist/commands/improve/distill/promote-memory.js +5 -12
  54. package/dist/commands/improve/distill/quality-gate.js +5 -7
  55. package/dist/commands/improve/distill.js +16 -5
  56. package/dist/commands/improve/eligibility.js +22 -12
  57. package/dist/commands/improve/extract-cli.js +47 -19
  58. package/dist/commands/improve/extract.js +110 -62
  59. package/dist/commands/improve/improve-cli.js +38 -16
  60. package/dist/commands/improve/improve-result-file.js +30 -24
  61. package/dist/commands/improve/improve-strategies.js +137 -0
  62. package/dist/commands/improve/improve.js +60 -30
  63. package/dist/commands/improve/locks.js +66 -45
  64. package/dist/commands/improve/loop-stages.js +75 -33
  65. package/dist/commands/improve/memory/memory-belief.js +79 -7
  66. package/dist/commands/improve/memory/memory-contradiction-detect.js +12 -4
  67. package/dist/commands/improve/preparation.js +71 -73
  68. package/dist/commands/improve/procedural.js +3 -2
  69. package/dist/commands/improve/recombine.js +2 -1
  70. package/dist/commands/improve/reflect.js +119 -214
  71. package/dist/commands/improve/shared.js +11 -5
  72. package/dist/commands/lint/base-linter.js +152 -42
  73. package/dist/commands/mv-cli.js +809 -0
  74. package/dist/commands/proposal/proposal-cli.js +18 -8
  75. package/dist/commands/proposal/propose.js +64 -69
  76. package/dist/commands/read/knowledge.js +436 -4
  77. package/dist/commands/read/remember-cli.js +39 -2
  78. package/dist/commands/read/search-cli.js +6 -1
  79. package/dist/commands/registry-cli.js +29 -14
  80. package/dist/commands/remember.js +2 -0
  81. package/dist/commands/sources/init.js +13 -14
  82. package/dist/commands/sources/migration-help.js +7 -4
  83. package/dist/commands/sources/schema-repair.js +2 -4
  84. package/dist/commands/sources/source-add.js +62 -73
  85. package/dist/commands/sources/source-manage.js +50 -46
  86. package/dist/commands/sources/stash-cli.js +41 -4
  87. package/dist/commands/tasks/default-tasks.js +12 -12
  88. package/dist/commands/tasks/tasks-cli.js +7 -3
  89. package/dist/commands/tasks/tasks.js +113 -18
  90. package/dist/commands/wiki-cli.js +9 -10
  91. package/dist/commands/workflow-cli.js +276 -12
  92. package/dist/core/asset/asset-spec.js +58 -1
  93. package/dist/core/asset/frontmatter.js +12 -2
  94. package/dist/core/common.js +5 -3
  95. package/dist/core/config/config-io.js +28 -17
  96. package/dist/core/config/config-schema.js +379 -66
  97. package/dist/core/config/config-types.js +3 -3
  98. package/dist/core/config/config-version.js +29 -0
  99. package/dist/core/config/config-walker.js +98 -27
  100. package/dist/core/config/config.js +132 -266
  101. package/dist/core/config/deep-merge.js +41 -0
  102. package/dist/core/config/engine-semantics.js +32 -0
  103. package/dist/core/errors.js +2 -2
  104. package/dist/core/extra-params.js +61 -0
  105. package/dist/core/file-lock.js +201 -56
  106. package/dist/core/improve-result.js +178 -0
  107. package/dist/core/json-schema.js +142 -0
  108. package/dist/core/maintenance-barrier.js +119 -0
  109. package/dist/core/migration-backup.js +416 -0
  110. package/dist/core/paths.js +3 -0
  111. package/dist/core/redaction.js +358 -0
  112. package/dist/core/state/migrations.js +17 -2
  113. package/dist/core/state-db.js +44 -1
  114. package/dist/indexer/db/db.js +118 -2
  115. package/dist/indexer/graph/graph-extraction.js +28 -16
  116. package/dist/indexer/index-writer-lock.js +31 -24
  117. package/dist/indexer/index-written-assets.js +15 -6
  118. package/dist/indexer/indexer.js +47 -2
  119. package/dist/indexer/passes/memory-inference.js +10 -6
  120. package/dist/indexer/passes/metadata.js +250 -0
  121. package/dist/indexer/search/db-search.js +111 -44
  122. package/dist/indexer/search/fts-query.js +41 -0
  123. package/dist/indexer/search/ranking-contributors.js +48 -0
  124. package/dist/indexer/search/ranking.js +36 -23
  125. package/dist/indexer/search/search-fields.js +11 -1
  126. package/dist/indexer/walk/matchers.js +39 -0
  127. package/dist/integrations/agent/builder-shared.js +7 -0
  128. package/dist/integrations/agent/builders.js +5 -50
  129. package/dist/integrations/agent/config.js +3 -143
  130. package/dist/integrations/agent/detect.js +17 -2
  131. package/dist/integrations/agent/engine-resolution.js +202 -0
  132. package/dist/integrations/agent/index.js +1 -2
  133. package/dist/integrations/agent/model-aliases.js +16 -2
  134. package/dist/integrations/agent/profiles.js +36 -62
  135. package/dist/integrations/agent/runner-dispatch.js +91 -4
  136. package/dist/integrations/agent/runner.js +76 -207
  137. package/dist/integrations/agent/spawn.js +141 -20
  138. package/dist/integrations/harnesses/aider/agent-builder.js +112 -0
  139. package/dist/integrations/harnesses/aider/index.js +57 -0
  140. package/dist/integrations/harnesses/aider/result-extractor.js +53 -0
  141. package/dist/integrations/harnesses/amazonq/agent-builder.js +152 -0
  142. package/dist/integrations/harnesses/amazonq/index.js +58 -0
  143. package/dist/integrations/harnesses/amazonq/result-extractor.js +48 -0
  144. package/dist/integrations/harnesses/claude/agent-builder.js +46 -8
  145. package/dist/integrations/harnesses/claude/index.js +25 -25
  146. package/dist/integrations/harnesses/claude/result-extractor.js +52 -0
  147. package/dist/integrations/harnesses/codex/agent-builder.js +136 -0
  148. package/dist/integrations/harnesses/codex/index.js +62 -0
  149. package/dist/integrations/harnesses/codex/result-extractor.js +73 -0
  150. package/dist/integrations/harnesses/copilot/agent-builder.js +121 -0
  151. package/dist/integrations/harnesses/copilot/index.js +59 -0
  152. package/dist/integrations/harnesses/copilot/result-extractor.js +151 -0
  153. package/dist/integrations/harnesses/gemini/agent-builder.js +120 -0
  154. package/dist/integrations/harnesses/gemini/index.js +59 -0
  155. package/dist/integrations/harnesses/gemini/result-extractor.js +121 -0
  156. package/dist/integrations/harnesses/index.js +27 -28
  157. package/dist/integrations/harnesses/opencode/agent-builder.js +2 -3
  158. package/dist/integrations/harnesses/opencode/index.js +15 -22
  159. package/dist/integrations/harnesses/opencode-sdk/harness.js +60 -0
  160. package/dist/integrations/harnesses/opencode-sdk/index.js +8 -32
  161. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +681 -108
  162. package/dist/integrations/harnesses/openhands/agent-builder.js +125 -0
  163. package/dist/integrations/harnesses/openhands/index.js +57 -0
  164. package/dist/integrations/harnesses/openhands/result-extractor.js +103 -0
  165. package/dist/integrations/harnesses/pi/agent-builder.js +103 -0
  166. package/dist/integrations/harnesses/pi/index.js +57 -0
  167. package/dist/integrations/harnesses/pi/result-extractor.js +135 -0
  168. package/dist/integrations/harnesses/types.js +8 -32
  169. package/dist/integrations/lockfile.js +32 -21
  170. package/dist/integrations/session-logs/index.js +24 -11
  171. package/dist/llm/client.js +48 -14
  172. package/dist/llm/feature-gate.js +15 -47
  173. package/dist/llm/graph-extract.js +1 -1
  174. package/dist/llm/index-passes.js +8 -42
  175. package/dist/llm/memory-infer-impl.js +1 -1
  176. package/dist/llm/usage-persist.js +4 -0
  177. package/dist/llm/usage-telemetry.js +35 -5
  178. package/dist/output/renderers.js +3 -2
  179. package/dist/output/shapes/helpers.js +2 -1
  180. package/dist/output/shapes/passthrough.js +6 -0
  181. package/dist/output/text/helpers.js +215 -2
  182. package/dist/output/text/workflow.js +3 -1
  183. package/dist/schemas/akm-config.json +16638 -0
  184. package/dist/schemas/akm-task.json +87 -0
  185. package/dist/schemas/akm-workflow.json +372 -0
  186. package/dist/scripts/migrate-storage.js +10944 -8801
  187. package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +9247 -350
  188. package/dist/setup/detected-engines.js +142 -0
  189. package/dist/setup/engine-config.js +89 -0
  190. package/dist/setup/setup.js +236 -132
  191. package/dist/setup/steps/connection.js +61 -32
  192. package/dist/setup/steps/platforms.js +4 -4
  193. package/dist/setup/steps.js +3 -2
  194. package/dist/storage/database.js +13 -1
  195. package/dist/storage/engines/sqlite-migrations.js +1 -0
  196. package/dist/storage/repositories/improve-runs-repository.js +5 -5
  197. package/dist/storage/repositories/task-history-repository.js +78 -0
  198. package/dist/storage/repositories/workflow-runs-repository.js +190 -1
  199. package/dist/tasks/parser.js +138 -52
  200. package/dist/tasks/runner.js +71 -75
  201. package/dist/tasks/schema.js +1 -1
  202. package/dist/tasks/validator.js +11 -6
  203. package/dist/text-import-hook.mjs +1 -1
  204. package/dist/wiki/wiki.js +9 -8
  205. package/dist/workflows/authoring/authoring.js +123 -10
  206. package/dist/workflows/authoring/workflow-program-template.yaml +31 -0
  207. package/dist/workflows/cli.js +4 -0
  208. package/dist/workflows/concurrency-policy.js +15 -0
  209. package/dist/workflows/db.js +200 -13
  210. package/dist/workflows/exec/brief.js +478 -0
  211. package/dist/workflows/exec/frozen-judge.js +47 -0
  212. package/dist/workflows/exec/native-executor.js +1034 -0
  213. package/dist/workflows/exec/param-secrets.js +115 -0
  214. package/dist/workflows/exec/report.js +1355 -0
  215. package/dist/workflows/exec/run-workflow.js +609 -0
  216. package/dist/workflows/exec/scheduler.js +71 -0
  217. package/dist/workflows/exec/step-work.js +1212 -0
  218. package/dist/workflows/exec/unit-writer.js +23 -0
  219. package/dist/workflows/exec/watch.js +116 -0
  220. package/dist/workflows/exec/worktree.js +171 -0
  221. package/dist/workflows/ir/compile.js +375 -0
  222. package/dist/workflows/ir/freeze.js +243 -0
  223. package/dist/workflows/ir/params.js +54 -0
  224. package/dist/workflows/ir/plan-hash.js +68 -0
  225. package/dist/workflows/ir/schema.js +545 -0
  226. package/dist/workflows/parser.js +10 -1
  227. package/dist/workflows/program/expressions.js +369 -0
  228. package/dist/workflows/program/parser.js +869 -0
  229. package/dist/workflows/program/project.js +104 -0
  230. package/dist/workflows/program/schema.js +54 -0
  231. package/dist/workflows/renderer.js +82 -5
  232. package/dist/workflows/resource-limits.js +20 -0
  233. package/dist/workflows/runtime/agent-identity.js +59 -14
  234. package/dist/workflows/runtime/plan-classifier.js +187 -0
  235. package/dist/workflows/runtime/runs.js +246 -69
  236. package/dist/workflows/runtime/unit-checkin.js +45 -0
  237. package/dist/workflows/runtime/workflow-asset-loader.js +42 -1
  238. package/dist/workflows/validate-summary.js +24 -3
  239. package/dist/workflows/validator.js +26 -1
  240. package/docs/data-and-telemetry.md +4 -3
  241. package/docs/migration/release-notes/0.6.0.md +1 -1
  242. package/docs/migration/release-notes/0.7.0.md +5 -4
  243. package/docs/migration/release-notes/0.9.0-beta.60.md +19 -0
  244. package/docs/migration/v0.8-to-v0.9.md +401 -0
  245. package/package.json +4 -2
  246. package/schemas/akm-config.json +16638 -0
  247. package/schemas/akm-task.json +87 -0
  248. package/schemas/akm-workflow.json +372 -0
  249. package/dist/commands/improve/improve-profiles.js +0 -168
  250. package/dist/core/config/config-migration.js +0 -602
  251. package/dist/core/deep-merge.js +0 -38
  252. package/dist/llm/call-ai.js +0 -62
  253. package/dist/setup/legacy-config.js +0 -106
  254. package/docs/README.md +0 -104
  255. /package/dist/assets/{profiles → improve-strategies}/catchup.json +0 -0
  256. /package/dist/assets/{profiles → improve-strategies}/consolidate.json +0 -0
  257. /package/dist/assets/{profiles → improve-strategies}/frequent.json +0 -0
  258. /package/dist/assets/{profiles → improve-strategies}/memory-focus.json +0 -0
  259. /package/dist/assets/{profiles → improve-strategies}/quick.json +0 -0
  260. /package/dist/assets/{profiles → improve-strategies}/recombine-only.json +0 -0
  261. /package/dist/assets/{profiles → improve-strategies}/synthesize.json +0 -0
  262. /package/dist/assets/{profiles → improve-strategies}/thorough.json +0 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,343 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Added
10
+
11
+ - **Workflow orchestration engine (experimental).** akm can now execute
12
+ multi-step workflows as deterministic **YAML programs**, driven either by a
13
+ native engine or by any agent session. This is a new, self-contained
14
+ surface; classic linear **markdown workflows and the stable workflow CLI
15
+ contract (`start`/`next`/`complete`/`status`/`list`) are unchanged**. What
16
+ ships:
17
+ - **Authoring.** Orchestrated workflows are YAML programs
18
+ (`workflows/*.yaml`, `version: 2`) validated against a published JSON
19
+ Schema (`schemas/akm-workflow.json`) by `akm workflow validate`; scaffold
20
+ one with `akm workflow template --yaml` or `akm workflow create
21
+ <name>.yaml`. A closed `${{ … }}` expression language (exactly
22
+ `params.<name>`, `steps.<id>.output.<path>`, `item`, `item_index`, parsed
23
+ once into an AST) wires steps together. `validate` also surfaces non-fatal
24
+ **warnings** (a step with no typed `output:` schema; a `${{ params.<name> }}`
25
+ reference to a param the declared `params:` block omits) that never change
26
+ the frozen plan or its hash. Creating a workflow whose canonical name
27
+ collides with an existing asset of a **different** extension (`foo.yaml`
28
+ while `foo.md` exists, or vice-versa) is refused, since the two would
29
+ silently shadow each other.
30
+ - **Compilation + frozen plans.** `akm workflow start` compiles the program
31
+ into a backend-agnostic Workflow Plan Graph IR (`src/workflows/ir/`) and
32
+ freezes it on the run row (`plan_json` + `plan_hash`); a run executes the
33
+ plan compiled at start, and edits to the source file require a new run.
34
+ - **Per-step orchestration.** A step can declare an engine, model, timeout,
35
+ fan-out (`map`/`over` with a `concurrency` cap and a `collect` | `vote`
36
+ reducer), a typed `output` JSON Schema (validated via a `runStructured`
37
+ retry-with-feedback loop), `env` bindings (resolved through the existing
38
+ `akm env run` machinery — secret tokens, dangerous-key policy, keys-only
39
+ audit events), classify-and-dispatch `route` steps, and `depends_on`
40
+ ordering.
41
+ - **Determinism + replay.** Journaled unit identity is content-derived
42
+ (`<step>:<sha256(item)[:12]>`, `:solo` for a single unit), so cached
43
+ results survive item-list reordering; a completed unit whose recorded
44
+ inputs differ on replan is a hard **replay-divergence** failure naming the
45
+ unit, never a silent re-dispatch. Every unit is recorded in the new
46
+ `workflow_run_units` table behind a serialized writer queue.
47
+ - **Execution (`akm workflow run`).** A semaphore-bounded scheduler fans a
48
+ step's units out (concurrency defaults to 1 per the local-model
49
+ LLM-defaults rule and is the minimum of the map request, frozen workflow
50
+ limit, selected frozen LLM engine limit, and current host safety limit),
51
+ enforces per-unit
52
+ timeouts (default 10 m) and run **budget ceilings** (`budget.max_tokens` /
53
+ `budget.max_units`, seeded from the journal so they span resumes), and
54
+ advances the run **strictly through `completeWorkflowStep`** so completion
55
+ gates are never bypassed. Every dispatched unit gets a standard akm
56
+ preamble (run/unit ids, knowledge + env/secret + reporting contract).
57
+ - **Typed artifacts + honest gates.** A step's promoted artifact is
58
+ validated against its declared `output` schema before completion; a
59
+ criteria-bearing gate judges that **artifact** (canonical JSON, clipped)
60
+ rather than machine prose, and each engine-driven evaluation is journaled
61
+ as a gate unit row. `gate.max_loops` bounds an evaluator-optimizer retry
62
+ loop (feedback threaded into re-dispatched unit prompts); `gate.required`
63
+ (or the run-wide `--require-gates`) makes a gate with no available judge
64
+ **block** for a human instead of failing open.
65
+ - **Failure policy.** Per-unit `on_error: fail | continue` (fail-fast
66
+ default) plus bounded `retry: { max, on: [<failure_reason>…] }` keyed on
67
+ the persisted failure taxonomy.
68
+ - **Isolation + leases.** `isolation: worktree` runs each file-mutating unit
69
+ in a fresh detached git worktree (journaled path; clean trees
70
+ auto-removed, dirty ones retained). A run **lease** (`engine_lease_*`)
71
+ ensures a run is driven by exactly one engine or one external driver at a
72
+ time; manual `complete` is refused while a live engine lease is held.
73
+ - **Harness-neutral driver protocol.** An orchestrated run can be driven by
74
+ ANY agent session (Claude Code, opencode, Codex, a human at a shell), not
75
+ only the native engine. **`akm workflow brief <run>`** is read-only (takes
76
+ no lease, mutates nothing) and emits the active step's expected work-list —
77
+ per-unit content-derived id, resolved instructions + input hash
78
+ (byte-identical to the engine's dispatch), output schema, env binding
79
+ NAMES only, and the exact `report` command lines. **`akm workflow report
80
+ <run> --unit <id> --status completed|failed|running`** is the one mutating
81
+ verb, ingesting a unit's result through the SAME shared step semantics the
82
+ engine uses (idempotent same-hash re-report, replay-divergence on a
83
+ differing hash, budget enforcement, schema validation, and the
84
+ artifact-judged gate/`max_loops` completion path). `--status running`
85
+ claims/heartbeats a unit for stale-driver detection without advancing the
86
+ spine; `--rerun` records a fresh attempt for a failed unit (carrying its
87
+ prior token total forward). Every report command carries `--expect-step`
88
+ (refused if the spine has moved since the brief), and `report --settle`
89
+ (no `--unit`) advances a step that dispatches no reportable units — a
90
+ params-only route, an empty fan-out, or an all-unresolvable work-list — so
91
+ a driver is never wedged. The engine and the brief/report surfaces are
92
+ proven to produce **identical unit graphs**
93
+ (`tests/workflows/conformance/driver-parity.test.ts`).
94
+ - **Observability.** `akm workflow watch <run>` tails the run's `workflow_*`
95
+ / `workflow_unit_*` events as NDJSON (`--stream` foreground-polls to a
96
+ terminal status, no daemon); `akm workflow status --units` lists per-unit
97
+ diagnostics (failure reason + result/error text) without feeding them into
98
+ the deterministic artifact graph; unit lifecycle emits
99
+ `workflow_unit_started` / `workflow_unit_finished` events carrying
100
+ ids/status/enums only. `akm show workflow:<name>` summarizes each step's
101
+ orchestration.
102
+ - **Harness adapters.** Seven local coding-agent CLIs are first-class
103
+ dispatch targets — Codex, Copilot CLI, Pi, Gemini, Aider, Amazon Q, and
104
+ OpenHands — each registered in `HARNESS_REGISTRY` with a command builder +
105
+ result extractor; agent-identity detection and the session-log provider
106
+ list are derived from the registry, and harness-native session ids are
107
+ journaled opportunistically for future session reuse.
108
+ - **Storage.** Additive `workflow.db` migrations 004–010 (unit journal,
109
+ harness session ids, frozen plans + run leases, check-in heartbeats,
110
+ attempt counter, unit claims); migrations 001–003 are untouched and linear
111
+ workflows behave exactly as before.
112
+
113
+ See "Orchestrated steps" and "Driving a run from any agent" in
114
+ `docs/features/workflows.md`, the redesign addendum in
115
+ `docs/archive/akm-workflows-orchestration-plan.md`, and `STABILITY.md`
116
+ (Experimental).
117
+ - **`fable` built-in model alias** — resolves to `claude-fable-5`
118
+ (`opencode/claude-fable-5` on opencode); recommended resolution target for
119
+ the `deep` workflow model tier.
120
+ - **`akm lint` now checks the frontmatter xref channels for broken refs.**
121
+ The existing `missing-ref` check additionally scans the `xrefs:`,
122
+ `supersededBy:`, and `contradictedBy:` frontmatter keys of non-wiki markdown
123
+ assets (memories, knowledge, lessons, facts, agents, commands, skills,
124
+ workflows) — the channels the stash back-linking conventions route
125
+ provenance and correction links through, and previously the only ref channel
126
+ with zero checking. Dangling refs are flagged with a detail naming the key
127
+ (`missing ref: <ref> (frontmatter <key>; resolved to <relPath>)`). The
128
+ `refs: []` body-scan carve-out does not suppress the new pass; `lint_skip:
129
+ [missing-ref]` suppresses both; non-ref values (URLs, `raw/<slug>`,
130
+ `<placeholder>` templates, shell vars) are ignored; refs resolving in a
131
+ configured extra stash root stay clean. **Note for `--fail-on-flagged` CI
132
+ users:** stashes with already-dangling xrefs (e.g. from past renames) will
133
+ gain new `missing-ref` findings on upgrade — fix the refs or add
134
+ `lint_skip: [missing-ref]` per file. `sources:`, `source_refs:`, and
135
+ `evidenceSources:` are deliberately not checked (wiki `sources:` is covered
136
+ by `akm wiki lint`; the latter two legitimately point at merged-away
137
+ assets).
138
+ - **`--xref <ref>` on `akm remember` and `akm import` — write-time
139
+ cross-references with validation.** The stash back-linking conventions route
140
+ provenance and associative links through `xrefs:` frontmatter, but neither
141
+ CLI write flow could express them (remember always generated its own
142
+ frontmatter block; import wrote content verbatim). The new repeatable flag
143
+ records refs in the written asset's `xrefs:` frontmatter list, which the
144
+ indexer folds into search hints — the new asset becomes findable from
145
+ searches for its source. `remember` merges the refs into its generated
146
+ frontmatter (composes with `--tag`/scope flags; does not trigger the
147
+ tags-required check); `import` dedupe-appends into the document's existing
148
+ frontmatter, or adds a block when the document has none — never a nested
149
+ second block. A document whose existing frontmatter is not a parseable YAML
150
+ mapping aborts the import (exit 2, nothing written) rather than being
151
+ rewritten lossily; importing it without `--xref` still preserves it
152
+ verbatim. Every ref is validated before anything is written, against the
153
+ write target plus all configured sources (read-only cross-stash sources
154
+ count): an unresolvable ref fails with the standard usage envelope (exit 2)
155
+ and leaves the stash untouched. The conventions' ~5-xref cap stays soft —
156
+ exceeding it warns on stderr but still writes. Additionally, a type-root
157
+ write (no `--path`, flat name) into a stash carrying convention facts now
158
+ returns an additive `hint` output key pointing at the stash's placement
159
+ conventions (`fact:conventions/organization` when that fact exists), so CLI
160
+ writers see the conventions that LLM flows already receive by injection.
161
+ - **`--supersedes <ref>` on `akm remember` and `akm import` — atomic
162
+ correction + demotion of the superseded asset.** The stash conventions'
163
+ corrections pattern needs TWO writes (the new correction asset with an xref
164
+ to what it corrects, plus a metadata edit demoting the old asset), which
165
+ previously meant hand-editing the old file's frontmatter and remembering to
166
+ reindex it. The new repeatable flag does both: the correction is written
167
+ with the old ref folded into its `xrefs:` (correction provenance), and the
168
+ old asset gains `beliefState: superseded` +
169
+ `supersededBy: [<new ref>]` via the shared `writeSupersededEdge` primitive
170
+ (sibling of `writeContradictEdge`) — a metadata-only frontmatter edit that
171
+ preserves every other key and the body byte-for-byte, sorted-set-appended
172
+ and idempotent across re-runs. The mutated old file is reindexed by the
173
+ write path, so `--belief current` hides it and ranking demotes it
174
+ immediately. An unresolvable ref is input validation: exit 2 with the
175
+ standard `{ok:false,error,code}` envelope and NOTHING written or demoted
176
+ (no partial correction); a ref resolving to the asset being written itself
177
+ (self-supersede via `--force` overwrite) is rejected the same way instead
178
+ of letting a correction demote itself. An old asset that resolves only
179
+ outside the write target and the working stash (in a read-only source, or
180
+ in a writable source that is not this write's target) is not mutated: the
181
+ correction still writes, stderr warns, and the JSON output reports the
182
+ additive `superseded: [{ref, applied: false, reason}]` key (`applied: true`
183
+ on success) — the reason names the `--target` remedy when one exists. An
184
+ old asset whose existing frontmatter is not parseable YAML is likewise
185
+ skipped (`applied: false`) rather than rewritten through the lossy lenient
186
+ parser. On a git write target the demotion is ordered before the
187
+ batch-at-boundary commit, so the correction and the demoted old asset land
188
+ in one commit.
189
+ - **Ref-prefix search queries — `akm search "<type>:<prefix>/"` now enumerates
190
+ that subtree.** A query shaped like a ref prefix (trailing slash required:
191
+ `memory:projectA/`; a bare `memory:` lists the whole type) translates to a
192
+ typed index enumeration narrowed to entry names under the prefix, instead of
193
+ degenerating into the AND-token FTS query its sanitized form used to produce
194
+ (`"memory projectA"` — noise, since `entry_type` is not an FTS column). The
195
+ listing is recursive and `/`-boundary exact (`projectA/` cannot leak a
196
+ sibling `projectAlpha/…` scope), matches names case-insensitively (the CLI
197
+ lowercases queries; on-disk scope directories may carry mixed case), and
198
+ composes with `--limit`, `--belief`, `--filter`, and named `--source`
199
+ narrowing exactly like the existing empty-query enumeration — hits carry the
200
+ fixed browse score `1` in deterministic listing order, not a relevance
201
+ ranking. The parsed type is explicit intent: a bare `session:` enumerates
202
+ sessions just like `--type session` (the default session exclusion is an
203
+ untyped-path policy), while an explicit `--type` flag always wins over the
204
+ type parsed from the query (the branch fires only on untyped searches). A
205
+ full ref without the trailing slash (`memory:projectA/auth-tip`) stays an
206
+ ordinary keyword search — resolving a single ref is `akm show`'s job.
207
+ **Stable-surface note:** `akm search` is Stable; this changes results for a
208
+ query shape that previously returned noise or nothing. A user literally
209
+ keyword-searching for the string `memory:x/` loses the old fuzzy token
210
+ behavior — accepted as negligible.
211
+ - **The `category:` frontmatter key is now captured into the index** as
212
+ `entry.category` (entry_json only — no schema migration). The key already
213
+ drives convention-fact prompt injection (`resolveStashStandards`) and the
214
+ fact linter, but the indexer never captured it, so no category-keyed search
215
+ or ranking policy was implementable. Captured for all markdown asset types
216
+ alongside `beliefState` (trimmed; blank/non-string values ignored; no
217
+ default invented), and whitelisted through the `.stash.json` entry
218
+ round-trip. Search results and ranking are unchanged — this is capture
219
+ only (a unit test pins that `category` never enters the FTS search
220
+ fields). **Requires a reindex to take effect** for existing entries. The
221
+ companion rank-time demotion of `category: convention` facts on untyped
222
+ queries was NOT shipped: the prescribed measurement (full skeleton
223
+ convention facts plus a real `knowledge/auth` asset, untyped `auth` query,
224
+ semantic off) shows no crowding — FTS is exact-first, so prefix expansion
225
+ onto the facts' tokens only happens when nothing matches the query exactly,
226
+ and a real domain asset always outranks the facts. That invariant is pinned
227
+ by `tests/search-convention-fact-demotion.test.ts`, which becomes the
228
+ regression guard if a demotion contributor is ever revisited.
229
+ - **Config-gated indexing of the self-situating body opening —
230
+ `index.indexBodyOpening` (default `false`).** Body prose is not indexed
231
+ (the FTS `content` column carries only TOC headings and parameters), which
232
+ is why the stash conventions route orientation into
233
+ `description:`/`when_to_use:`. With the new flag enabled, the metadata pass
234
+ captures the first prose paragraph of each markdown asset body — skipping
235
+ headings (ATX and setext), fenced code blocks, thematic breaks, and a
236
+ leading nested frontmatter block (only when its content is actually
237
+ frontmatter-shaped: prose wrapped in decorative `---` lines is captured,
238
+ not discarded); capped at 280 chars with word-boundary truncation and a
239
+ trailing ellipsis — into `entry.bodyOpening`, which folds into the
240
+ lowest-weight `content` FTS column (bm25 weight 1.0, so a name match always
241
+ outranks a body-opening-only match) and into the search/embedding text.
242
+ Secret and env files are never read for it, and session-kind memories
243
+ (`akm_memory_kind` in outer or nested inner frontmatter) are excluded —
244
+ their bodies are raw transcripts. Both indexing walks and write-path
245
+ indexing honor the flag (the metadata pass reads the user config directly).
246
+ With the flag absent or `false`, entries and search fields stay
247
+ byte-identical to before. **Costs of toggling (either direction):** indexed
248
+ text changes, so collapse-detector canary recall baselines shift — re-mint
249
+ via `akm improve canary --refresh` — and embeddings are NOT regenerated for
250
+ entries that already have one, while incremental runs re-extract only
251
+ changed files. Run `akm index --full` after toggling: it re-extracts every
252
+ entry and wipes embeddings so they rebuild from the new text; until then
253
+ `akm index` warns that the flag differs from the state the index was built
254
+ with. The conventions' `description:`/`when_to_use:` orientation routing
255
+ remains primary — this flag makes body openings additionally pay retrieval
256
+ rent, it does not replace structured metadata. See `docs/configuration.md`.
257
+ - **`akm mv <ref> <new-name>` — rename with inbound-xref rewrite and
258
+ utility-history preservation (Experimental).** The stash conventions'
259
+ forced-rename procedure ("grep and fix inbound xrefs in the same pass") was
260
+ agent-executable except for the part only the CLI can do: a rename used to
261
+ mint a new index row, orphaning the `utility_scores` /
262
+ `utility_scores_scoped` / embeddings / salience rows keyed by entry id —
263
+ the "rename resets learned ranking" cost the conventions warn about. The
264
+ new verb does the whole pass: it moves the file (a memory's `.derived.md`
265
+ twin moves together, keeping the `entry_key + ".derived"` belief-inheritance
266
+ coupling), rewrites inbound refs across the writable stash's markdown files
267
+ — body prose, frontmatter ref-list keys (`xrefs:`/`refs:`/`supersededBy:`/
268
+ …), and fenced code blocks — with complete-ref boundary matching (a longer
269
+ ref sharing the old ref as a prefix is untouched), and re-keys the index
270
+ row **in place** so the row id and every id-keyed ranking table survive;
271
+ the moved row and rewritten citers are FTS-refreshed so search reflects the
272
+ new name immediately. Scope v1: flat-markdown asset types (`memory`,
273
+ `knowledge`, `command`, `agent`, `workflow`, `lesson`, `session`, `fact`)
274
+ in the primary writable stash only, and the source ref must be the
275
+ canonical spelling — a ref that resolves only through one of lint's
276
+ fallback resolutions (knowledge-subdir alias, direct-path) is rejected
277
+ naming the canonical ref, since a fallback-keyed move would strand the
278
+ index row and dangle canonical citers. Wiki refs, cross-type targets,
279
+ existing targets, unresolvable refs, type-root escapes, `.derived` twin
280
+ refs as the source (rename the base — the twin follows), and target names
281
+ ending in `.derived` (reserved twin suffix) are rejected with the
282
+ standard envelope (exit 2, nothing moved). Read-only sources are scanned
283
+ but never written — their citing files are reported in `readOnlyCiters` as
284
+ manual follow-ups. Output:
285
+ `{ok, from, to, rewrote: [{file, count}], readOnlyCiters, utilityPreserved}`;
286
+ a successful move appends an `mv` event. The operation spans FS + DB and is
287
+ not transactional, but its ordering (plan rewrites → apply citer edits →
288
+ rename last → re-key index last) makes an interrupted run safely
289
+ re-runnable; with no local index built, the rename still succeeds and the
290
+ next `akm index` picks it up, and `utilityPreserved: false` discloses when
291
+ an existing index could not be re-keyed (the ranking history then resets
292
+ on the next full index). Added to the v1 §9.4 command surface as an
293
+ Experimental-tier additive entry (see `STABILITY.md`).
294
+
295
+ ### Changed
296
+
297
+ - **Directory (scope/domain) tokens now always merge into `tags` at index
298
+ time**, even when an asset sets explicit `tags:` frontmatter. Previously
299
+ explicit tags suppressed all path-derived tags, so a nested asset like
300
+ `memory:projectA/auth-tip` with `tags: [auth]` silently lost the exact
301
+ tag-match ranking boost for its scope token unless the author restated it.
302
+ The merged tokens come from the canonical ref subpath
303
+ (`extractDirTagsFromName`), which also fixes the flat-walk indexing path
304
+ losing directory segments in the empty-tags fallback. Filename tokens are
305
+ still auto-derived only when `tags` is empty (they already live in the FTS
306
+ name column and aliases), and the empty-tags fallback itself is unchanged.
307
+ **Operator notes:** the change takes effect on the next reindex and alters
308
+ indexed tag text for nested assets with explicit tags, so collapse-detector
309
+ canary recall baselines may shift — re-mint them with `akm improve canary
310
+ --refresh`. Embeddings are not regenerated when indexed text changes; the
311
+ drift here is small (the merged tokens already appear in the name field),
312
+ but a purge/re-embed picks up the new text exactly.
313
+ - **Demoting belief states now cap an entry's final search score**
314
+ (superseded ≤ 0.25, contradicted ≤ 0.2, archived ≤ 0.15, deprecated ≤
315
+ 0.28). The existing additive belief penalties are applied inside the
316
+ multiplicative boost sum on a min-max-normalized FTS base (rank-1 vs rank-2
317
+ base can differ by up to 0.7), so a superseded incumbent that was the best
318
+ keyword match stayed clamp-pinned at 1.0 above its own correction — the
319
+ demotion was invisible exactly when the corrections pattern needs it. The
320
+ ceiling is applied once at the end of the single scoring pipeline (sort
321
+ order and displayed scores stay consistent); demoted entries remain listed
322
+ under the default `--belief all`, keep their relative ordering, and the
323
+ `--belief` filter axis is unchanged. Semantic-only hits are judged against
324
+ the `search.minScore` floor by their pre-ceiling score, so a ceiling below
325
+ the floor (archived 0.15 < default 0.2) ranks the hit last instead of
326
+ silently dropping it. Ordering changes only for stashes containing
327
+ belief-flagged assets.
328
+ - **`mutateFrontmatter` (belief-edge writers: supersede/contradict edges,
329
+ belief refresh) now preserves the body bytes verbatim** when the file
330
+ already has a frontmatter block, instead of re-normalizing the
331
+ fence-to-body separator through `assembleAsset`. A metadata edit is no
332
+ longer a (whitespace-level) content edit; files gaining their first
333
+ frontmatter block still use the canonical shape.
334
+
335
+ ### Fixed
336
+
337
+ - **Check-in directives now survive plain-text output and `workflow
338
+ status`** (check-in review C2/M1): `formatWorkflowNextPlain` and
339
+ `formatWorkflowStatusPlain` render the `CONTINUE` directive, and every
340
+ run-detail response (status/start/complete) evaluates the check-in instead
341
+ of only `workflow next`.
342
+ - Workflow frontmatter validator error message now lists the actually-allowed
343
+ keys (`name`, `updated` were missing); removed the documented-but-nonexistent
344
+ `akm workflow step` alias from `docs/features/workflows.md`.
345
+
9
346
  ## [0.9.0] — 2026-06-30
10
347
 
11
348
  ### Fixed
@@ -1675,7 +2012,7 @@ See `docs/migration/v0.7-to-v0.8.md` for the user-facing migration guide.
1675
2012
 
1676
2013
  ### Migration
1677
2014
 
1678
- - See [`docs/migration/release-notes/0.7.0.md`](docs/migration/release-notes/0.7.0.md) for the operator summary and [`docs/migration/v1.md`](docs/migration/v1.md) for the canonical per-surface delta from any 0.6.x baseline.
2015
+ - See [`docs/migration/release-notes/0.7.0.md`](docs/migration/release-notes/0.7.0.md) for the operator summary and the [archived pre-1.0 plan](docs/archive/pre-1.0-migration.md) for the historical per-surface delta from any 0.6.x baseline.
1679
2016
 
1680
2017
  ## [0.6.0] - 2026-04-23
1681
2018
 
@@ -1694,7 +2031,7 @@ See `docs/migration/v0.7-to-v0.8.md` for the user-facing migration guide.
1694
2031
 
1695
2032
  ### Changed (breaking)
1696
2033
 
1697
- - **v1 architecture refactor.** The internal architecture was rebuilt around a single minimal `SourceProvider` interface (`{ name, kind, init, path, sync? }`), a unified FTS5 index that owns search and show, and a single `writeAssetToSource` helper that owns all writes. The CLI command surface and all user-visible config keys are unchanged. See `docs/migration/v1.md` for the full guide.
2034
+ - **v1 architecture refactor.** The internal architecture was rebuilt around a single minimal `SourceProvider` interface (`{ name, kind, init, path, sync? }`), a unified FTS5 index that owns search and show, and a single `writeAssetToSource` helper that owns all writes. The CLI command surface and all user-visible config keys are unchanged. See `docs/archive/pre-1.0-migration.md` for the historical guide.
1698
2035
  - **Config key `stashes[]` renamed to `sources[]`.** Configs with the legacy key load with one deprecation warning and are auto-migrated in memory; the new key is persisted on the next `akm config` write. New configs should use `sources[]`. Configs that contain both keys are rejected with `ConfigError`.
1699
2036
  - **Error hints surface without `--verbose`.** Error classes own their `hint()` text; the regex-on-message hint chain in `cli.ts` is removed. Hints print to stderr inline alongside the error message.
1700
2037
  - **Registry providers loop through a uniform interface.** Context Hub is no longer a special-cased provider type. Add it as a regular git source (`akm add github:andrewyng/context-hub`) or include it as a kit in your registry index. Legacy `type: "context-hub"` entries normalize to `type: "git"` at load time.
package/SECURITY.md CHANGED
@@ -7,9 +7,9 @@ Security fixes are made on the latest minor release line of `akm-cli`. The
7
7
 
8
8
  | Version | Supported |
9
9
  | --- | --- |
10
- | 0.8.x | ✅ active |
11
- | 0.7.x | ❌ no longer maintained |
12
- | < 0.7 | ❌ no longer maintained |
10
+ | 0.9.x | ✅ active |
11
+ | 0.8.x | ❌ no longer maintained |
12
+ | < 0.8 | ❌ no longer maintained |
13
13
 
14
14
  ## Reporting a vulnerability
15
15
 
@@ -42,7 +42,7 @@ bugs, but you should be aware of them:
42
42
 
43
43
  Workflow steps run in your shell with your PATH and your environment
44
44
  variables — including any secrets you have exported or loaded via
45
- `akm vault load`. **Only add workflow sources you trust.** See
45
+ `akm env run` / `akm secret run`. **Only add workflow sources you trust.** See
46
46
  [`docs/features/workflows.md` — "Security: workflow sources are executed
47
47
  code"](docs/features/workflows.md#security-workflow-sources-are-executed-code)
48
48
  for the full discussion.
@@ -61,33 +61,32 @@ maintainer could write a system prompt that instructs the LLM to read
61
61
  sensitive files in your working tree and exfiltrate them via the LLM
62
62
  response. Audit the prompt body the same way you'd audit a script.
63
63
 
64
- ### Vaults are plaintext on disk
64
+ ### Environment and secret assets are plaintext on disk
65
65
 
66
- `akm vault` files are `0o600`-permissioned plaintext at
67
- `<stash>/vaults/<name>.env`. They are protected against other local users
68
- by filesystem permissions but not encrypted at rest. Do not commit vault
69
- files to source control they are `.gitignore`d in the default stash
70
- layout for that reason. The `akm vault show` / `akm vault list` commands
71
- never echo values; `akm vault load` produces shell-eval output meant to be
72
- piped to `eval`, never displayed.
66
+ `env` and `secret` assets are owner-permissioned plaintext under `<stash>/env/`
67
+ and `<stash>/secrets/`. They are protected against other local users by
68
+ filesystem permissions but are not encrypted at rest. Do not commit these
69
+ files to source control. Normal `akm env` and `akm secret` output never echoes
70
+ values; materialize values only at the command boundary with `akm env run`,
71
+ `akm secret run`, or `akm secret path`.
73
72
 
74
73
  ### Improve / propose / distill send asset content to the configured LLM
75
74
 
76
75
  `akm improve`, `akm propose`, `akm distill`, `akm reflect`, and `akm
77
- consolidate` send asset frontmatter and body to whatever LLM endpoint is
78
- configured in `~/.config/akm/config.json` (under `llm.endpoint`). If you
79
- have configured a third-party LLM, your asset content goes to that
80
- third-party. Use a local model (`http://localhost:11434` via Ollama, etc.)
81
- for assets containing secrets or private notes.
76
+ consolidate` can send asset frontmatter and body to the named LLM engine selected
77
+ by the command, strategy, or current defaults. LLM connections live under
78
+ `engines.<name>` in `~/.config/akm/config.json`. If you configure a third-party
79
+ LLM, your asset content goes to that third party. Use a local engine endpoint
80
+ (for example, `http://localhost:11434/v1/chat/completions` via Ollama) for assets
81
+ containing secrets or private notes.
82
82
 
83
83
  ## Known non-issues
84
84
 
85
- - **`akm` requires Bun or the prebuilt binary** — Node.js is not supported
86
- in 0.8.0 because Bun-specific APIs are used in hot paths. This is a
87
- compatibility limitation, not a security risk; the prebuilt binary is a
88
- Bun-compiled standalone executable.
85
+ - **`akm` requires Bun, Node.js >= 20.12, or the prebuilt binary.** Older
86
+ Node.js versions are unsupported because required runtime APIs are missing.
87
+ This is a compatibility limitation, not a security risk.
89
88
  - **Workflows can read any file the akm process can read.** This is not a
90
89
  bug — see "Threat model" above.
91
- - **`bun install -g akm-cli` runs the preinstall hook.** The hook only
92
- emits an error message and exits non-zero on Node.js; it does not phone
93
- home or write outside the install directory.
90
+ - **Installing `akm-cli` runs the preinstall hook.** The hook only validates
91
+ the runtime version and exits non-zero when it is unsupported; it does not
92
+ phone home or write outside the install directory.
@@ -41,25 +41,25 @@ Options:
41
41
  consolidation will prompt interactively on HTTP paths
42
42
  Note: until proposals carry real confidence scores, any non-`false`
43
43
  value behaves like the legacy "safe" mode (whole-batch auto-accept).
44
- --profile <name> Improve profile to apply. Built-ins: default, quick,
44
+ --strategy <name> Improve strategy to apply. Built-ins: default, quick,
45
45
  thorough, memory-focus, frequent, catchup, consolidate,
46
46
  graph-refresh, synthesize, reflect-distill,
47
- proactive-maintenance, recombine-only. User-defined
48
- profiles under `profiles.improve.<name>` in config are
49
- also accepted. Profiles bundle process gating, type
47
+ proactive-maintenance, recombine-only. User-defined
48
+ strategies under `improve.strategies.<name>` in config are
49
+ also accepted. Strategies bundle process gating, type
50
50
  filters, and run-level autoAccept/limit defaults. Falls
51
- back to `defaults.improve` in config, then to "default".
51
+ back to `defaults.improveStrategy` in config, then to "default".
52
52
  An unknown name is a hard error listing the valid names
53
53
  (no silent fallback to default).
54
- Sync behavior by profile: default and thorough enable
54
+ Sync behavior by strategy: default and thorough enable
55
55
  auto-commit + push; quick and memory-focus skip sync.
56
56
  --sync Commit (and optionally push) the git-backed primary
57
57
  stash when the run finishes. Use --no-sync to disable.
58
- Default: per profile config (enabled for default and
58
+ Default: per strategy config (enabled for default and
59
59
  thorough, disabled for quick and memory-focus).
60
60
  --push Push after the end-of-run sync commit when the stash
61
61
  is writable and has a remote configured. Use --no-push
62
- to commit only. Default: per profile config (true when
62
+ to commit only. Default: per strategy config (true when
63
63
  sync is enabled).
64
64
  --consolidate-recovery <mode>
65
65
  Recovery mode for stale consolidate journals: abort (default) or clean
@@ -78,7 +78,7 @@ Examples:
78
78
  akm improve skill
79
79
  akm improve skill:code-review
80
80
  akm improve workflow:incident-response --task "reduce duplication"
81
- akm improve --profile quick
82
- akm improve --profile memory-focus
81
+ akm improve --strategy quick
82
+ akm improve --strategy memory-focus
83
83
  akm improve --no-sync
84
84
  akm improve --no-push
@@ -12,6 +12,8 @@ akm search "<query>" --source both # Also search registries
12
12
  akm search "<query>" --source registry # Search registries only
13
13
  akm search "<query>" --limit 10 # Limit results
14
14
  akm search "<query>" --detail full # Include scores, paths, timing
15
+ akm search "memory:projectA/" # Enumerate a typed subtree (ref-prefix; trailing slash required)
16
+ akm search "knowledge:" # List every asset of a type
15
17
  ```
16
18
 
17
19
  | Flag | Values | Default |
@@ -23,6 +25,12 @@ akm search "<query>" --detail full # Include scores, paths, timing
23
25
  | `--detail` | `brief`, `normal`, `full` | `brief` |
24
26
  | `--shape` | `human`, `agent`, `summary` (`summary` only on `show`) | `human` |
25
27
 
28
+ Ref-prefix queries (`"<type>:<prefix>/"` or a bare `"<type>:"`) return a
29
+ deterministic listing, not a relevance ranking. A full ref without the
30
+ trailing slash (`memory:projectA/auth-tip`) stays an ordinary keyword search —
31
+ resolving a single ref is `akm show`'s job — and an explicit `--type` flag
32
+ wins over the type parsed from the query.
33
+
26
34
  ## Curate
27
35
 
28
36
  Combine search + follow-up hints into a dense summary for a task or prompt.
@@ -60,7 +68,7 @@ akm show knowledge:my-doc # Show content (local or remote)
60
68
  | memory | `content` (recalled context) |
61
69
  | env | `keys` (key names only — values and comment text never returned) |
62
70
  | secret | `name` only (the whole file is the value — never returned) |
63
- | wiki | `content` (same view modes as knowledge). For any wiki task, run `akm wiki list`. To ingest sources, `akm wiki ingest <name>` dispatches the configured agent (defaults.agent or `--profile`) to execute the ingest workflow. |
71
+ | wiki | `content` (same view modes as knowledge). For any wiki task, run `akm wiki list`. To ingest sources, `akm wiki ingest <name>` dispatches the configured agent (`defaults.engine` or `--engine`) to execute the ingest workflow. |
64
72
 
65
73
  ## Capture Knowledge While You Work
66
74
 
@@ -68,12 +76,16 @@ akm show knowledge:my-doc # Show content (local or remote)
68
76
  akm remember "Deployment needs VPN access" # Record a memory in your stash
69
77
  akm remember --name release-retro < notes.md # Save multiline memory from stdin
70
78
  akm remember "note" --target my-other-stash # Route write to a named writable stash source
79
+ akm remember "note" --xref knowledge:auth-flow # Cite provenance in frontmatter xrefs (repeatable; ref must resolve)
80
+ akm remember "fix" --supersedes memory:old-note # Write a correction AND demote the old asset (beliefState: superseded)
71
81
  akm import ./docs/auth-flow.md # Import a file as knowledge
82
+ akm import ./doc.md --xref knowledge:auth-flow # Merge provenance xrefs into the imported doc's frontmatter
83
+ akm import ./new.md --supersedes knowledge:old # Import a correction AND demote the doc it replaces
72
84
  akm import - --name scratch-notes < notes.md # Import stdin as a knowledge doc
73
85
  akm import https://example.com/docs/auth # Fetch one URL and import it as knowledge
74
86
  akm import ./doc.md --target my-other-stash # Route import to a named writable stash source
75
87
  akm workflow create ship-release # Create a workflow asset in the stash
76
- akm workflow validate workflows/foo.md # Validate a workflow file or ref; lists every error
88
+ akm workflow validate workflows/foo.yaml # Validate a YAML v2/markdown workflow or ref; lists every error
77
89
  akm workflow next workflow:ship-release # Start or resume the next workflow step
78
90
  akm feedback skill:code-review --positive # Record that an asset helped
79
91
  akm feedback agent:reviewer --negative # Record that an asset missed the mark
@@ -103,15 +115,15 @@ akm wiki stash research https://example.com/paper # Fetch one URL into raw/<slug
103
115
  akm wiki stash research ./paper.md --target my-stash # Route write to a named writable stash source
104
116
  echo "..." | akm wiki stash research - # stdin form
105
117
  akm wiki lint research # Structural checks: orphans, broken xrefs, uncited raws, stale index
106
- akm wiki ingest research # Dispatch defaults.agent to run the ingest workflow on this wiki
107
- akm wiki ingest research --profile claude --model sonnet # Override profile and model
108
- akm wiki ingest research --timeout-ms 600000 # Override agent CLI timeout (default: profile setting)
118
+ akm wiki ingest research # Dispatch defaults.engine to run the ingest workflow on this wiki
119
+ akm wiki ingest research --engine claude --model sonnet # Override engine and model
120
+ akm wiki ingest research --timeout-ms 600000 # Override the invocation timeout
109
121
  akm wiki remove research -y # Delete pages/schema/index/log; preserves raw/ (--force is a deprecated alias for -y)
110
122
  akm wiki remove research -y --with-sources # Full nuke, including raw/
111
123
  ```
112
124
 
113
125
  **For any wiki task, start with `akm wiki list`. Then `akm wiki ingest <name>`
114
- dispatches the configured agent (defaults.agent or `--profile`) to execute
126
+ dispatches the configured agent (`defaults.engine` or `--engine`) to execute
115
127
  the wiki's ingest workflow end-to-end — schema read, source dedup, search,
116
128
  page create/update, log entry, lint, reindex.** Wiki pages are also addressable as
117
129
  `wiki:<name>/<page-path>` and show up in stash-wide `akm search` as
@@ -155,7 +167,7 @@ akm secret remove secret:deploy-token # Delete the secret
155
167
 
156
168
  ## Workflows
157
169
 
158
- Step-based workflows stored as `<stashDir>/workflows/<name>.md`.
170
+ Workflows live under `<stashDir>/workflows/` as markdown or YAML v2 (`.yaml`/`.yml`).
159
171
 
160
172
  Ref-based workflow commands are scoped to the current project/worktree/directory,
161
173
  so one active run does not block unrelated directories from starting the same
@@ -186,6 +198,28 @@ akm clone "npm:@scope/pkg//script:deploy.sh" # Clone from remote package
186
198
 
187
199
  When `--dest` is provided, `akm init` is not required first.
188
200
 
201
+ ## Move / Rename (Experimental)
202
+
203
+ Rename an asset within its type directory in the primary writable stash. Prefer
204
+ NOT renaming (a ref is chosen once); when a rename is forced, `akm mv` does the
205
+ whole convention pass: it moves the file (a memory's `.derived.md` twin moves
206
+ together), rewrites inbound refs across the writable stash — body prose,
207
+ frontmatter ref lists (`xrefs:`/`refs:`/`supersededBy:`), and fenced examples —
208
+ and re-keys the index row in place so the asset's learned ranking history
209
+ survives.
210
+
211
+ ```sh
212
+ akm mv memory:projectA/old-note projectA/new-note # Rename; subdirectories allowed in the new name
213
+ akm mv memory:solo memory:renamed-solo # Same-type ref-shaped target also accepted
214
+ ```
215
+
216
+ Wiki refs, cross-type targets, existing targets, `../` escapes, non-canonical
217
+ source spellings (the error names the canonical ref), `.derived` twin sources
218
+ (rename the base — the twin follows), and `.derived`-suffixed target names are
219
+ rejected (exit 2, nothing moved). Read-only sources are scanned but never
220
+ written — their citing files come back in `readOnlyCiters` as manual
221
+ follow-ups. Verify with `akm lint` (missing-ref) afterwards.
222
+
189
223
  ## Sync
190
224
 
191
225
  Commit local changes in a git-backed stash. Behaviour adapts automatically.
@@ -209,13 +243,13 @@ akm sync my-skills -m "Update patterns" # Sync named stash with message
209
243
  The `--sync` / `--no-sync` and `--push` / `--no-push` flags control this:
210
244
 
211
245
  ```sh
212
- akm improve # auto-sync per profile default (default/thorough: on; quick/memory-focus: off)
246
+ akm improve # auto-sync per strategy default (default/thorough: on; quick/memory-focus: off)
213
247
  akm improve --no-sync # skip the end-of-run commit
214
248
  akm improve --no-push # commit but skip push for this run
215
- akm improve --sync # force sync even on profiles that disable it
249
+ akm improve --sync # force sync even on strategies that disable it
216
250
  ```
217
251
 
218
- Profile sync defaults: `default` and `thorough` auto-commit + push; `quick` and
252
+ Strategy sync defaults: `default` and `thorough` auto-commit + push; `quick` and
219
253
  `memory-focus` skip sync entirely. Override with `--sync` / `--no-sync` flags.
220
254
 
221
255
  The `--writable` flag on `akm add` opts a remote git stash into push-on-sync: