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
package/CHANGELOG.md CHANGED
@@ -15,7 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
15
15
  contract (`start`/`next`/`complete`/`status`/`list`) are unchanged**. What
16
16
  ships:
17
17
  - **Authoring.** Orchestrated workflows are YAML programs
18
- (`workflows/*.yaml`, `version: 1`) validated against a published JSON
18
+ (`workflows/*.yaml`, `version: 2`) validated against a published JSON
19
19
  Schema (`schemas/akm-workflow.json`) by `akm workflow validate`; scaffold
20
20
  one with `akm workflow template --yaml` or `akm workflow create
21
21
  <name>.yaml`. A closed `${{ … }}` expression language (exactly
@@ -31,7 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
31
31
  into a backend-agnostic Workflow Plan Graph IR (`src/workflows/ir/`) and
32
32
  freezes it on the run row (`plan_json` + `plan_hash`); a run executes the
33
33
  plan compiled at start, and edits to the source file require a new run.
34
- - **Per-step orchestration.** A step can declare a runner, model, timeout,
34
+ - **Per-step orchestration.** A step can declare an engine, model, timeout,
35
35
  fan-out (`map`/`over` with a `concurrency` cap and a `collect` | `vote`
36
36
  reducer), a typed `output` JSON Schema (validated via a `runStructured`
37
37
  retry-with-feedback loop), `env` bindings (resolved through the existing
@@ -46,9 +46,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
46
46
  `workflow_run_units` table behind a serialized writer queue.
47
47
  - **Execution (`akm workflow run`).** A semaphore-bounded scheduler fans a
48
48
  step's units out (concurrency defaults to 1 per the local-model
49
- LLM-defaults rule, capped by the engine-wide `workflow.maxConcurrency`
50
- config knob unset = `min(16, max(1, cores 2))`, explicit values
51
- clamped to `[1, 64]`), enforces per-unit
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
52
  timeouts (default 10 m) and run **budget ceilings** (`budget.max_tokens` /
53
53
  `budget.max_units`, seeded from the journal so they span resumes), and
54
54
  advances the run **strictly through `completeWorkflowStep`** so completion
@@ -105,18 +105,232 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
105
105
  result extractor; agent-identity detection and the session-log provider
106
106
  list are derived from the registry, and harness-native session ids are
107
107
  journaled opportunistically for future session reuse.
108
- - **Storage.** Additive `workflow.db` migrations 004–009 (unit journal,
108
+ - **Storage.** Additive `workflow.db` migrations 004–010 (unit journal,
109
109
  harness session ids, frozen plans + run leases, check-in heartbeats,
110
110
  attempt counter, unit claims); migrations 001–003 are untouched and linear
111
111
  workflows behave exactly as before.
112
112
 
113
113
  See "Orchestrated steps" and "Driving a run from any agent" in
114
114
  `docs/features/workflows.md`, the redesign addendum in
115
- `docs/technical/akm-workflows-orchestration-plan.md`, and `STABILITY.md`
115
+ `docs/archive/akm-workflows-orchestration-plan.md`, and `STABILITY.md`
116
116
  (Experimental).
117
117
  - **`fable` built-in model alias** — resolves to `claude-fable-5`
118
118
  (`opencode/claude-fable-5` on opencode); recommended resolution target for
119
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.
120
334
 
121
335
  ### Fixed
122
336
 
@@ -1798,7 +2012,7 @@ See `docs/migration/v0.7-to-v0.8.md` for the user-facing migration guide.
1798
2012
 
1799
2013
  ### Migration
1800
2014
 
1801
- - 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.
1802
2016
 
1803
2017
  ## [0.6.0] - 2026-04-23
1804
2018
 
@@ -1817,7 +2031,7 @@ See `docs/migration/v0.7-to-v0.8.md` for the user-facing migration guide.
1817
2031
 
1818
2032
  ### Changed (breaking)
1819
2033
 
1820
- - **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.
1821
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`.
1822
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.
1823
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:
@@ -25,15 +25,18 @@ and `workflow list` operate within the current scope only.
25
25
  akm search "<query>" # Search all sources
26
26
  akm curate "<task>" # Curate the best matches for a task
27
27
  akm search "<query>" --type workflow # Filter to workflow assets
28
+ akm search "memory:projectA/" # List a typed subtree (ref-prefix query; trailing slash required)
28
29
  akm search "<query>" --source both # Also search registries
29
30
  akm show <ref> # View asset details
30
31
  akm workflow next <ref> # Start or resume a workflow
31
32
  akm remember "Deployment needs VPN access" # Record a memory in your stash
32
33
  akm remember "note" --target my-stash # Route write to a named writable stash source
34
+ akm remember "note" --xref knowledge:auth-flow # Cite provenance in frontmatter xrefs (repeatable)
35
+ akm remember "fix" --supersedes memory:old-note # Write a correction AND demote the superseded asset
33
36
  akm import ./notes/release-checklist.md # Import a knowledge doc into your stash
34
37
  akm import ./doc.md --target my-stash # Route import to a named writable stash source
35
38
  akm wiki list # List available wikis
36
- akm wiki ingest <name> # Dispatch an agent to run the ingest workflow (uses defaults.agent or --profile)
39
+ akm wiki ingest <name> # Dispatch an agent to run the ingest workflow (uses defaults.engine or --engine)
37
40
  akm wiki stash <name> ./paper.md --target my-stash # Route wiki stash write to a named source
38
41
  akm proposal diff skill:akm-dream # Diff proposal by ref, UUID, or 8-char prefix
39
42
  akm proposal accept 7c115132 # Accept by UUID prefix
@@ -41,6 +44,7 @@ akm proposal reject skill:my-skill --reason "..." # Reject by ref
41
44
  akm feedback <ref> --positive|--negative # Record whether an asset helped
42
45
  akm add <ref> # Add a source (npm, GitHub, git, local dir)
43
46
  akm clone <ref> # Copy an asset to the working stash (optional --dest arg to clone to specific location)
47
+ akm mv memory:old-note new-note # Rename an asset: inbound refs rewritten, ranking history preserved
44
48
  akm sync # Commit (and push if writable remote) changes in the primary stash (--no-push to commit only)
45
49
  akm improve --no-sync # Run improve without the end-of-run auto-commit
46
50
  akm improve --no-push # Auto-commit but skip push for this run
@@ -60,7 +64,7 @@ akm registry search "<query>" # Search all registries
60
64
  | memory | Recalled context (read the content for background information) |
61
65
  | env | A `.env` file of related CONFIGURATION (many vars; sensitive or not — all protected); key names only. Inject with `akm env run <ref> -- <cmd>` (the agent-safe path — values stay on disk). |
62
66
  | secret | A single sensitive value for AUTHENTICATION (token, key, cert); name only. Use `akm secret path` / `akm secret run`. |
63
- | wiki | A page in a multi-wiki knowledge base. For any wiki task, start with `akm wiki list`. To ingest sources, run `akm wiki ingest <name>` — it dispatches the configured agent profile to execute the ingest workflow against the wiki's `raw/` directory. Run `akm wiki -h` for the full surface. |
67
+ | wiki | A page in a multi-wiki knowledge base. For any wiki task, start with `akm wiki list`. To ingest sources, run `akm wiki ingest <name>` — it dispatches the configured agent engine to execute the ingest workflow against the wiki's `raw/` directory. Run `akm wiki -h` for the full surface. |
64
68
 
65
69
  When an asset meaningfully helps or fails, record that with `akm feedback` so
66
70
  future search ranking can learn from real usage.
@@ -11,6 +11,7 @@
11
11
  "memoryInference": { "enabled": true },
12
12
  "graphExtraction": { "enabled": true },
13
13
  "extract": { "enabled": true, "triage": { "enabled": true, "minScore": 2 } },
14
+ "validation": { "enabled": true },
14
15
  "proactiveMaintenance": { "enabled": true, "dueDays": 30, "maxPerRun": 15 },
15
16
  "triage": { "enabled": false, "applyMode": "queue", "policy": "personal-stash" },
16
17
  "recombine": { "enabled": false },
@@ -1,5 +1,5 @@
1
1
  {
2
- "description": "Full-corpus graph extraction pass — rebuilds graph relationships across all stash files. Disables all other sub-processes. Use via `akm improve --profile graph-refresh` or the embedded `graph-refresh-weekly` task.",
2
+ "description": "Full-corpus graph extraction pass — rebuilds graph relationships across all stash files. Disables all other sub-processes. Use via `akm improve --strategy graph-refresh` or the embedded `graph-refresh-weekly` task.",
3
3
  "processes": {
4
4
  "reflect": { "enabled": false },
5
5
  "distill": { "enabled": false },
@@ -3,10 +3,9 @@
3
3
  "processes": {
4
4
  "reflect": {
5
5
  "enabled": true,
6
- "mode": "llm",
7
6
  "allowedTypes": ["agent", "command", "knowledge", "lesson", "memory", "skill", "wiki", "workflow"]
8
7
  },
9
- "distill": { "enabled": true, "mode": "llm", "allowedTypes": ["memory"] },
8
+ "distill": { "enabled": true, "allowedTypes": ["memory"] },
10
9
  "consolidate": { "enabled": false },
11
10
  "memoryInference": { "enabled": false },
12
11
  "graphExtraction": { "enabled": false },
@@ -17,7 +16,7 @@
17
16
  "policy": "personal-stash",
18
17
  "maxAcceptsPerRun": 100,
19
18
  "maxDiffLines": 200,
20
- "judgment": { "mode": "llm" }
19
+ "judgment": {}
21
20
  },
22
21
  "proactiveMaintenance": { "enabled": true, "dueDays": 30, "maxPerRun": 100 }
23
22
  },
@@ -3,12 +3,11 @@
3
3
  "processes": {
4
4
  "reflect": {
5
5
  "enabled": true,
6
- "mode": "llm",
7
6
  "allowedTypes": ["agent", "command", "knowledge", "lesson", "memory", "skill", "wiki", "workflow"]
8
7
  },
9
- "distill": { "enabled": true, "mode": "llm", "allowedTypes": ["memory"] },
8
+ "distill": { "enabled": true, "allowedTypes": ["memory"] },
10
9
  "consolidate": { "enabled": false },
11
- "memoryInference": { "enabled": true, "mode": "llm" },
10
+ "memoryInference": { "enabled": true },
12
11
  "graphExtraction": { "enabled": false },
13
12
  "extract": {
14
13
  "enabled": false,
@@ -22,7 +21,7 @@
22
21
  "policy": "personal-stash",
23
22
  "maxAcceptsPerRun": 15,
24
23
  "maxDiffLines": 200,
25
- "judgment": { "mode": "llm" }
24
+ "judgment": {}
26
25
  },
27
26
  "proactiveMaintenance": { "enabled": true, "dueDays": 30, "maxPerRun": 15 }
28
27
  },