akm-cli 0.9.0-beta.5 → 0.9.0-beta.50

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 (207) hide show
  1. package/CHANGELOG.md +709 -0
  2. package/dist/assets/profiles/default.json +9 -4
  3. package/dist/assets/profiles/frequent.json +1 -1
  4. package/dist/assets/profiles/memory-focus.json +1 -1
  5. package/dist/assets/profiles/quick.json +1 -1
  6. package/dist/assets/profiles/synthesize.json +15 -0
  7. package/dist/assets/profiles/thorough.json +1 -1
  8. package/dist/assets/prompts/consolidate-system.md +23 -0
  9. package/dist/assets/prompts/contradiction-judge.md +33 -0
  10. package/dist/assets/prompts/distill-knowledge-system.md +22 -0
  11. package/dist/assets/prompts/distill-lesson-system.md +36 -0
  12. package/dist/assets/prompts/extract-session.md +6 -2
  13. package/dist/assets/prompts/graph-extract-system.md +1 -0
  14. package/dist/assets/prompts/graph-extract-user-prompt.md +1 -1
  15. package/dist/assets/prompts/memory-infer-system.md +1 -0
  16. package/dist/assets/prompts/memory-infer-user.md +5 -0
  17. package/dist/assets/prompts/metadata-enhance-system.md +1 -0
  18. package/dist/assets/prompts/procedural-system.md +44 -0
  19. package/dist/assets/prompts/recombine-system.md +40 -0
  20. package/dist/assets/prompts/staleness-detect-system.md +6 -0
  21. package/dist/assets/prompts/validate-summary-judge.md +1 -0
  22. package/dist/assets/stash-skeleton/facts/conventions/assets/agent.md +38 -0
  23. package/dist/assets/stash-skeleton/facts/conventions/assets/command.md +38 -0
  24. package/dist/assets/stash-skeleton/facts/conventions/assets/fact.md +39 -0
  25. package/dist/assets/stash-skeleton/facts/conventions/assets/knowledge.md +40 -0
  26. package/dist/assets/stash-skeleton/facts/conventions/assets/lesson.md +43 -0
  27. package/dist/assets/stash-skeleton/facts/conventions/assets/memory.md +38 -0
  28. package/dist/assets/stash-skeleton/facts/conventions/assets/script.md +43 -0
  29. package/dist/assets/stash-skeleton/facts/conventions/assets/skill.md +40 -0
  30. package/dist/assets/stash-skeleton/facts/conventions/assets/workflow.md +43 -0
  31. package/dist/assets/templates/html/health.html +281 -111
  32. package/dist/assets/wiki/ingest-workflow-template.md +17 -10
  33. package/dist/cli/shared.js +28 -0
  34. package/dist/cli.js +15 -5
  35. package/dist/commands/agent/agent-dispatch.js +2 -2
  36. package/dist/commands/agent/agent-support.js +0 -7
  37. package/dist/commands/agent/contribute-cli.js +17 -4
  38. package/dist/commands/env/env-cli.js +16 -24
  39. package/dist/commands/env/secret-cli.js +12 -20
  40. package/dist/commands/feedback-cli.js +15 -6
  41. package/dist/commands/graph/graph-cli.js +5 -13
  42. package/dist/commands/graph/graph.js +76 -72
  43. package/dist/commands/health/checks.js +48 -0
  44. package/dist/commands/health/html-report.js +422 -80
  45. package/dist/commands/health.js +386 -9
  46. package/dist/commands/improve/calibration.js +161 -0
  47. package/dist/commands/improve/consolidate/chunking.js +141 -0
  48. package/dist/commands/improve/consolidate/eligibility.js +81 -0
  49. package/dist/commands/improve/consolidate/merge.js +145 -0
  50. package/dist/commands/improve/consolidate/sanitize.js +231 -0
  51. package/dist/commands/{lint.js → improve/consolidate/types.js} +1 -1
  52. package/dist/commands/improve/consolidate.js +635 -660
  53. package/dist/commands/improve/dedup.js +482 -0
  54. package/dist/commands/improve/distill.js +159 -69
  55. package/dist/commands/improve/eligibility.js +434 -0
  56. package/dist/commands/improve/encoding-salience.js +205 -0
  57. package/dist/commands/improve/extract-cli.js +124 -2
  58. package/dist/commands/improve/extract-prompt.js +39 -2
  59. package/dist/commands/improve/extract-watch.js +140 -0
  60. package/dist/commands/improve/extract.js +389 -40
  61. package/dist/commands/improve/feedback-valence.js +54 -0
  62. package/dist/commands/improve/homeostatic.js +467 -0
  63. package/dist/commands/improve/improve-auto-accept.js +109 -6
  64. package/dist/commands/improve/improve-cli.js +35 -60
  65. package/dist/commands/improve/improve-profiles.js +14 -0
  66. package/dist/commands/improve/improve-result-file.js +5 -23
  67. package/dist/commands/improve/improve-session.js +58 -0
  68. package/dist/commands/improve/improve.js +485 -2498
  69. package/dist/commands/improve/locks.js +154 -0
  70. package/dist/commands/improve/loop-stages.js +1083 -0
  71. package/dist/commands/improve/memory/memory-contradiction-detect.js +23 -28
  72. package/dist/commands/improve/outcome-loop.js +256 -0
  73. package/dist/commands/improve/preparation.js +1966 -0
  74. package/dist/commands/improve/proactive-maintenance.js +115 -0
  75. package/dist/commands/improve/procedural.js +418 -0
  76. package/dist/commands/improve/recombine.js +813 -0
  77. package/dist/commands/improve/reflect-noise.js +0 -0
  78. package/dist/commands/improve/reflect.js +183 -40
  79. package/dist/commands/improve/salience.js +438 -0
  80. package/dist/commands/improve/triage.js +93 -0
  81. package/dist/commands/lint/agent-linter.js +19 -24
  82. package/dist/commands/lint/base-linter.js +173 -60
  83. package/dist/commands/lint/command-linter.js +19 -24
  84. package/dist/commands/lint/env-key-rules.js +34 -1
  85. package/dist/commands/lint/fact-linter.js +39 -0
  86. package/dist/commands/lint/index.js +31 -13
  87. package/dist/commands/lint/memory-linter.js +1 -1
  88. package/dist/commands/lint/registry.js +7 -2
  89. package/dist/commands/lint/task-linter.js +3 -3
  90. package/dist/commands/lint/workflow-linter.js +26 -1
  91. package/dist/commands/proposal/drain-policies.js +5 -0
  92. package/dist/commands/proposal/drain.js +43 -50
  93. package/dist/commands/proposal/proposal-cli.js +21 -31
  94. package/dist/commands/proposal/proposal.js +5 -0
  95. package/dist/commands/proposal/propose.js +7 -2
  96. package/dist/commands/proposal/validators/proposal-quality-validators.js +9 -8
  97. package/dist/commands/proposal/validators/proposals.js +189 -63
  98. package/dist/commands/read/curate.js +414 -94
  99. package/dist/commands/read/knowledge.js +2 -2
  100. package/dist/commands/read/search-cli.js +7 -0
  101. package/dist/commands/read/search.js +1 -0
  102. package/dist/commands/read/show.js +67 -2
  103. package/dist/commands/sources/init.js +36 -9
  104. package/dist/commands/sources/installed-stashes.js +5 -1
  105. package/dist/commands/sources/schema-repair.js +13 -1
  106. package/dist/commands/sources/self-update.js +2 -2
  107. package/dist/commands/sources/stash-cli.js +28 -40
  108. package/dist/commands/sources/stash-skeleton.js +23 -8
  109. package/dist/commands/tasks/tasks-cli.js +19 -27
  110. package/dist/commands/tasks/tasks.js +1 -1
  111. package/dist/commands/wiki-cli.js +21 -35
  112. package/dist/core/asset/asset-registry.js +2 -0
  113. package/dist/core/asset/asset-spec.js +14 -0
  114. package/dist/core/asset/frontmatter.js +166 -167
  115. package/dist/core/asset/markdown.js +8 -0
  116. package/dist/core/authoring-rules.js +92 -0
  117. package/dist/core/common.js +0 -5
  118. package/dist/core/config/config-schema.js +340 -56
  119. package/dist/core/config/config-types.js +3 -3
  120. package/dist/core/config/config.js +28 -7
  121. package/dist/core/events.js +3 -7
  122. package/dist/core/improve-types.js +11 -8
  123. package/dist/core/logs-db.js +10 -66
  124. package/dist/core/parse.js +36 -16
  125. package/dist/core/paths.js +3 -0
  126. package/dist/core/standards/resolve-standards-context.js +87 -0
  127. package/dist/core/standards/resolve-stash-standards.js +99 -0
  128. package/dist/core/standards/resolve-type-conventions.js +66 -0
  129. package/dist/core/state/migrations.js +714 -0
  130. package/dist/core/state-db.js +525 -474
  131. package/dist/indexer/db/db.js +439 -247
  132. package/dist/indexer/db/graph-db.js +129 -86
  133. package/dist/indexer/ensure-index.js +152 -17
  134. package/dist/indexer/graph/graph-boost.js +51 -41
  135. package/dist/indexer/graph/graph-extraction.js +218 -4
  136. package/dist/indexer/index-writer-lock.js +99 -0
  137. package/dist/indexer/indexer.js +123 -221
  138. package/dist/indexer/passes/dir-staleness.js +114 -0
  139. package/dist/indexer/passes/memory-inference.js +10 -3
  140. package/dist/indexer/passes/staleness-detect.js +2 -5
  141. package/dist/indexer/search/db-search.js +15 -4
  142. package/dist/indexer/search/ranking-contributors.js +22 -0
  143. package/dist/indexer/search/ranking.js +4 -0
  144. package/dist/indexer/search/search-source.js +10 -24
  145. package/dist/indexer/search/semantic-status.js +4 -0
  146. package/dist/indexer/walk/matchers.js +9 -0
  147. package/dist/integrations/agent/config.js +6 -53
  148. package/dist/integrations/agent/index.js +2 -18
  149. package/dist/integrations/agent/prompts.js +74 -8
  150. package/dist/integrations/agent/runner-dispatch.js +59 -0
  151. package/dist/integrations/harnesses/claude/session-log.js +11 -1
  152. package/dist/integrations/harnesses/index.js +2 -3
  153. package/dist/integrations/harnesses/opencode/session-log.js +173 -3
  154. package/dist/integrations/harnesses/opencode-sdk/index.js +2 -2
  155. package/dist/integrations/harnesses/opencode-sdk/sdk-runner.js +0 -2
  156. package/dist/integrations/session-logs/index.js +16 -0
  157. package/dist/llm/client.js +45 -15
  158. package/dist/llm/embedder.js +42 -3
  159. package/dist/llm/embedders/deterministic.js +66 -0
  160. package/dist/llm/embedders/local.js +66 -2
  161. package/dist/llm/feature-gate.js +8 -4
  162. package/dist/llm/graph-extract.js +67 -44
  163. package/dist/llm/memory-infer.js +38 -30
  164. package/dist/llm/metadata-enhance.js +44 -31
  165. package/dist/llm/structured-call.js +49 -0
  166. package/dist/output/context.js +5 -5
  167. package/dist/output/renderers.js +73 -1
  168. package/dist/output/shapes/curate.js +14 -2
  169. package/dist/output/shapes/passthrough.js +0 -1
  170. package/dist/output/text/helpers.js +16 -1
  171. package/dist/registry/providers/skills-sh.js +21 -147
  172. package/dist/registry/providers/static-index.js +15 -157
  173. package/dist/registry/resolve.js +22 -9
  174. package/dist/runtime.js +25 -1
  175. package/dist/scripts/migrate-storage.js +2136 -1596
  176. package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +682 -433
  177. package/dist/setup/setup.js +29 -8
  178. package/dist/sources/providers/filesystem.js +0 -1
  179. package/dist/sources/providers/git-install.js +206 -0
  180. package/dist/sources/providers/git-provider.js +234 -0
  181. package/dist/sources/providers/git-stash.js +248 -0
  182. package/dist/sources/providers/git.js +10 -661
  183. package/dist/sources/providers/npm.js +2 -6
  184. package/dist/sources/providers/sync-from-ref.js +9 -1
  185. package/dist/sources/providers/tar-utils.js +16 -8
  186. package/dist/sources/providers/website.js +2 -3
  187. package/dist/sources/website-ingest.js +51 -9
  188. package/dist/sources/wiki-fetchers/registry.js +53 -0
  189. package/dist/sources/wiki-fetchers/youtube.js +239 -0
  190. package/dist/storage/database.js +45 -10
  191. package/dist/storage/managed-db.js +82 -0
  192. package/dist/storage/repositories/registry-cache.js +92 -0
  193. package/dist/storage/sqlite-pragmas.js +146 -0
  194. package/dist/tasks/backends/cron.js +1 -1
  195. package/dist/tasks/backends/launchd.js +1 -1
  196. package/dist/tasks/backends/schtasks.js +1 -1
  197. package/dist/tasks/{resolveAkmBin.js → resolve-akm-bin.js} +2 -2
  198. package/dist/tasks/runner.js +5 -13
  199. package/dist/wiki/wiki.js +37 -0
  200. package/dist/workflows/db.js +3 -4
  201. package/dist/workflows/runtime/runs.js +1 -117
  202. package/dist/workflows/runtime/workflow-asset-loader.js +125 -0
  203. package/dist/workflows/validate-summary.js +2 -7
  204. package/docs/data-and-telemetry.md +1 -0
  205. package/package.json +9 -7
  206. package/dist/commands/db-cli.js +0 -23
  207. package/dist/indexer/db/db-backup.js +0 -376
package/CHANGELOG.md CHANGED
@@ -6,6 +6,715 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Fixed
10
+
11
+ - **improve/recombine: cap-aware decay — the `maxClustersPerRun` cap no longer
12
+ traps recurring hypotheses below `confirmThreshold` (#658).** Recombine is a
13
+ two-pass design: a cluster must be re-induced on `confirmThreshold` (=2) runs
14
+ before its `type:hypothesis` proposal promotes to an auto-accepted
15
+ `type:lesson`. But only the top-`maxClustersPerRun` (=5) clusters are
16
+ processed per run, and `decayUnseenRecombineHypotheses` hard-reset the
17
+ confirmation streak of every hypothesis not processed that run. A cluster that
18
+ genuinely re-forms every run but is displaced out of the top-5 (slots are tied
19
+ on member-count and broken by an arbitrary alphabetical tiebreak) had its
20
+ streak zeroed — it could never win two consecutive slots, so its proposal sat
21
+ pending forever (6 such proposals were stuck in one production stash).
22
+ `decayUnseenRecombineHypotheses` is now **cap-aware**: `recombine.ts` passes
23
+ the FULL pre-cap cluster set, and a hypothesis is spared from reset when its
24
+ cluster still Jaccard-matches a present cluster (same signature, overlap ≥ 0.7
25
+ — the same rule used for re-induction). Only hypotheses with no matching
26
+ current cluster (the corpus stopped supporting them) decay. This does **not**
27
+ lower the recurrence bar: the confirmation count is still advanced only by
28
+ genuine re-induction in the processed slice (`recordRecombineInduction`);
29
+ sparing merely avoids an artificial reset, so a genuinely non-recurring
30
+ hypothesis still decays to 0 and never confirms (no new bland-hypothesis churn,
31
+ cf. #632/#633). No schema change. The cap now lives in a new `capClusters`
32
+ helper split out of `buildRelatednessClusters` so the full ranked set stays
33
+ available for the decay sweep.
34
+ - **`improve` reflect no longer emits proposals doomed to fail the
35
+ `invalid-description` gate when the source asset has no frontmatter
36
+ `description` (#636).** Reflect echoed the source frontmatter, so for assets
37
+ that carry other keys but no `description` (notably scraped docs:
38
+ `source`/`title`/`scraped`) the proposal inherited the missing/empty
39
+ description and the promote-time validator (`isValidDescription`, 20–400
40
+ chars) rejected it — observed as ~14/16 rejects in one triage pass, blocking
41
+ the whole scraped-doc/knowledge cluster from reflect improvement. The fix is
42
+ **generation-time only**: (1) `buildReflectPrompt` now injects an explicit
43
+ "synthesize a `description`" instruction whenever the source lacks a non-empty
44
+ `description` and the asset type requires one (per `authoring-rules.ts`
45
+ `DESCRIPTION_TYPES`), telling the model it MUST author a valid 20–400-char
46
+ plain-prose description from the asset's `title:`/first `# Heading`/opening
47
+ body; and (2) a deterministic reflect-side belt-and-suspenders in
48
+ `sanitizeReflectPayload` — if a source that already had frontmatter still ends
49
+ up with a missing/empty description after generation, reflect derives one
50
+ deterministically from `title:`/first heading (validated against
51
+ `isValidDescription`, never free-form invention) **before** the proposal is
52
+ created. The validator, `authoring-rules.ts` bounds, `repairProposalContent`,
53
+ and the drain are unchanged — nothing in the validator/promote path fabricates
54
+ content to pass itself.
55
+ - **The high-salience improve admission lane (#608) now requires a
56
+ content-derived encoding score, not the per-type weight stub (#655,
57
+ #608/#644 follow-up).** The lane previously admitted any zero-feedback ref
58
+ whose `asset_salience.encoding_salience >= salienceThreshold` (default 0.75).
59
+ But for assets distill has not content-scored, `encoding_salience` is just the
60
+ per-type WEIGHT STUB (skill/agent 0.9, command/workflow 0.8, lesson 0.75), so
61
+ "high-salience" degenerated into "is a skill/agent/command/lesson" — which
62
+ selected the type-stub `lore-writer` agent on every run (prod: 1 content-scored
63
+ / 37 type-stub / 1826 NULL-legacy rows). The gate now also requires
64
+ `isContentEncodingRow(row, parseAssetRef(ref).type)` (the #644 provenance
65
+ helper), so only genuinely content-scored assets qualify. This preserves
66
+ #608's intent — distilled assets, the lane's real targets, keep their real
67
+ content score and still qualify — while cutting the type-stub waste; type-stub
68
+ rows must earn retrieval/feedback signal via the other lanes. NULL-legacy rows
69
+ follow `isContentEncodingRow`'s differs-from-stub heuristic. An aggregated log
70
+ line now reports how many refs the lane admitted so lane composition is
71
+ observable. The threshold, type-weight table, 10% cap, and `isContentEncodingRow`
72
+ are unchanged.
73
+
74
+ - **Auto-sync no longer refuses to commit akm's own changes when unrelated
75
+ non-akm files are present in the stash working tree.** When a stash root is
76
+ shared with a project repo, stray files written into the stash root (e.g. a
77
+ `tasks.bak-…` backup dir or report artifacts like `data.js`,
78
+ `akm-health-report.html`, `reports/`) previously tripped the #476 safety
79
+ guard, which threw `refusing to push: … has uncommitted non-akm changes` on
80
+ **every** `akm improve` end-of-run auto-sync, `akm sync`, and `akm push`. In
81
+ one production incident this silently blocked all commits for ~1.5 days while
82
+ akm kept accepting proposals it never persisted. `saveGitStash` now **scopes
83
+ what it stages** instead of refusing: (1) an explicit modified-file list when
84
+ the caller passes `opts.paths`, else (2) the akm-managed pathspecs
85
+ (`TYPE_DIRS` values + `.akm`) that exist on disk — which by construction never
86
+ stages non-akm WIP, preserving the #476 protection without an all-or-nothing
87
+ refusal — and only as a last resort (3) `git add -A` when no managed pathspec
88
+ can be resolved. If nothing akm-managed is staged the run returns
89
+ `nothing to commit` (no empty commit, no throw). Unrelated non-akm files are
90
+ left untouched and uncommitted.
91
+
92
+ ### Changed
93
+
94
+ - **BEHAVIOR CHANGE — `akm init --dir <path>` no longer silently repoints your
95
+ default stash.** Previously, `akm init --dir X` unconditionally wrote
96
+ `stashDir: X` to `config.json` whenever `X` differed from the configured
97
+ default — so initializing a throwaway or secondary stash (e.g.
98
+ `akm init --dir /tmp/scratch`) would hijack the user's real default stash
99
+ pointer (the footgun documented in `memory:akm-init-persists-stashdir-warning`).
100
+ Now `init` persists `stashDir` to config **only** when one of the following
101
+ holds: (a) **no `--dir`** was provided (the default `~/akm` setup flow —
102
+ unchanged), (b) `--dir` was provided and **no `stashDir` exists in config yet**
103
+ (first-time bootstrap), or (c) `--dir` was provided **with the new
104
+ `--set-default` flag** (explicit opt-in). Otherwise `init` still scaffolds and
105
+ backfills the target dir exactly as before, but **leaves your default stash
106
+ pointer untouched** and prints:
107
+ `Your default stash is unchanged (<existing>). Re-run with --set-default to make <dir> the default.`
108
+ The `InitResponse` JSON gains `defaultStashUpdated: boolean` and an optional
109
+ `previousStashDir`. To make a `--dir` target your default, pass
110
+ `akm init --dir <path> --set-default`. (`akm setup` is unaffected — it remains
111
+ the explicit configuration flow and always sets the default.)
112
+
113
+ ### Added
114
+
115
+ - **Per-type SOFT authoring conventions are now user-editable stash facts.** A
116
+ third authoring-guidance layer joins the hard rules (#645) and general stash
117
+ standards (#642): a stash owner can author
118
+ `facts/conventions/assets/<type>.md` (e.g. `…/skill.md`, `…/command.md`) to
119
+ capture soft, type-specific guidance — voice, structure, length *preference*,
120
+ naming style. When an agent authors a `skill:x`, the body of
121
+ `fact:conventions/assets/skill` is injected (type-scoped — authoring
122
+ `command:y` pulls the `command` convention, never the `skill` one), labeled
123
+ as soft guidance and kept separate from the validator-enforced hard rules.
124
+ The basename must be a `getAssetTypes()`-validated asset type; facts are read
125
+ straight from disk (no index rebuild) and degrade to empty safely. When no
126
+ per-type fact exists, the built-in `TYPE_HINTS` fallback is unchanged (no
127
+ regression). These facts carry soft conventions only and can never weaken the
128
+ authoring contract the gate enforces (`authoringRulesForType` remains the sole
129
+ source of validator-rejecting rules). The general convention/meta resolver now
130
+ excludes `facts/conventions/assets/*` so per-type guidance never leaks
131
+ un-type-scoped into other authoring flows. (#646)
132
+ - **`akm init` now seeds default per-type SOFT convention templates.** Starter
133
+ `facts/conventions/assets/<type>.md` templates ship in the stash skeleton for
134
+ the authored types (`lesson, skill, command, agent, knowledge, memory,
135
+ workflow, script, fact`; `wiki`/`env`/`secret` excluded) so a stash owner has
136
+ an editable starting point. Each expands the matching built-in `TYPE_HINTS`
137
+ one-liner into soft starter guidance, carries `category: convention`
138
+ frontmatter, and states in-body that it is advice, not enforced — it carries
139
+ **no** validator-rejecting rules, so editing or deleting one cannot weaken the
140
+ gate (#645). The stash-skeleton copy is now recursive (preserving nested
141
+ subpaths), and `akm init` seeds **unconditionally** rather than only on first
142
+ create: re-running it on an existing stash backfills any missing skeleton,
143
+ convention, or `.meta/index.md` files. Seeding stays absent-only and never
144
+ overwrites a user-edited file. (#646)
145
+
146
+ ## [0.9.0-beta.36] — 2026-06-22
147
+
148
+ ### Added
149
+
150
+ - **Stash standards + wiki schemas are surfaced to authoring agents at write
151
+ time.** When an agent edits a page under `wikis/<name>/`, that wiki's
152
+ `schema.md` body is injected into the prompt; when it creates/edits a non-wiki
153
+ asset, the bodies of `category: convention`/`meta` `fact` assets are injected.
154
+ Two mutually-exclusive features selected by target type, sharing one
155
+ `standardsContext` prompt seam. Wired into reflect, propose, and every
156
+ improve authoring pass (distill, consolidate, recombine, procedural, extract,
157
+ schema-repair). (#642)
158
+ - **Unified, validator-sourced authoring-rules seam.** A new
159
+ `authoringRulesForType(type)` injects the hard authoring rules (no
160
+ pseudo-frontmatter in body, exactly two `---` fences, description/`when_to_use`
161
+ length + shape) into every authoring prompt. The numeric bounds live in one
162
+ module that the validators import, so the prompt can no longer drift from what
163
+ the gate enforces. (#645)
164
+
165
+ ### Fixed
166
+
167
+ - **High-salience reflect lane now reflects each asset at most once.** The
168
+ `#608` admission gate lacked the cooldown its sibling high-retrieval gate has,
169
+ so zero-feedback assets were re-selected on every run (auto-accept emits
170
+ `promoted`, not `feedback`), burning LLM calls and churning assets. (#643)
171
+ - **Stuck validation-failing proposals no longer dead-end.** The triage drain no
172
+ longer overwrites an `auto-rejected` gate stamp with a misleading
173
+ `auto-accepted` (the failure stays truthful and visible). A bounded,
174
+ content-preserving auto-repair (strip pseudo-frontmatter / stray `---`, repair
175
+ truncated descriptions) runs at the promote boundary and re-validates — fixable
176
+ proposals promote; genuinely unrepairable ones stay `pending` for manual
177
+ review, with nothing fabricated and validation never bypassed. (#645)
178
+ - Corrected a prompt/validator drift where the distill system prompt asked for an
179
+ 80–200 char description while the gate enforced 20–400. (#645)
180
+
181
+ ## [0.9.0-beta.35] — 2026-06-21
182
+
183
+ ### Fixed
184
+
185
+ - **Default extract discovery window is now "since the last run" (floored at 48h),
186
+ not a fixed 24h.** An intermittently-online host that was off for longer than
187
+ the old 24h window could permanently miss sessions that ended during the gap.
188
+ Discovery now looks back to the last recorded extract run for the harness, never
189
+ less than 48h. Widening is free of redundant LLM cost — the content-hash ledger
190
+ skips unchanged sessions with zero LLM calls. An explicit `--since`/`defaultSince`
191
+ still wins.
192
+ - **Per-session lock prevents concurrent double-extraction.** A session-end hook
193
+ firing `extract --session-id` while the periodic `akm improve` extract pass runs
194
+ discovery could both LLM-process the SAME session (duplicate spend + near-dup
195
+ proposals). A per-(harness, session) advisory lock (co-located with state.db,
196
+ PID + age staleness recovery) now makes the second run skip without any LLM call.
197
+ - **`minNewSessions` is read from the ACTIVE improve profile, not always `default`.**
198
+ A non-default profile (e.g. `frequent`) setting `minNewSessions` was silently
199
+ ignored because the gate (and its candidate-count discovery window) read
200
+ `profiles.improve.default`. They now read the resolved active profile, matching
201
+ how `extract.enabled` already resolves.
202
+
203
+ ### Docs
204
+
205
+ - Documented that `processes.extract.indexSessions` (default on) makes a second
206
+ LLM call per processed session (the session summary); set it to `false` to halve
207
+ per-session extract cost. Unchanged/skipped sessions still cost zero.
208
+
209
+ ## [0.9.0-beta.34] — 2026-06-21
210
+
211
+ ### Fixed
212
+
213
+ - **`akm extract --type opencode` reads opencode's SQLite session store.** opencode
214
+ migrated session storage from per-file JSON (`storage/session/<projectId>/<id>.json`
215
+ + `storage/message/<id>/*.json`) to a single Drizzle-managed database at
216
+ `<base>/opencode.db` (tables `session`/`message`/`part`; message text lives in
217
+ `part` rows with `data` JSON `type:"text"`). The legacy JSON layout went stale
218
+ ~2026-02, so extract discovered 0 sessions on current opencode and the
219
+ `session.idle` extract hook had nothing to read. `OpenCodeProvider` now prefers
220
+ `opencode.db` when present (read-only, via the cross-driver `openDatabase` seam)
221
+ and falls back to the JSON layout. Verified end-to-end through the plugin's
222
+ `session.idle` hook.
223
+
224
+ ## [0.9.0-beta.33] — 2026-06-21
225
+
226
+ ### Fixed
227
+
228
+ - **`akm extract` decoupled from the improve-stage toggle.** `processes.extract.enabled`
229
+ now gates extract only as a STAGE of `akm improve` (the active improve profile, per
230
+ #593/#594); an explicit `akm extract` command always runs. Previously dropping extract
231
+ from the daily improve profile silently disabled the standalone command (and its LLM
232
+ calls, via the shared `session_extraction` feature gate).
233
+ - **`extract --session-id` now respects the content-hash ledger; `--force` overrides.**
234
+ Explicit single-session extraction previously bypassed the #602 already-extracted skip
235
+ unconditionally — re-paying the LLM on every call and risking double-extraction against
236
+ the cron. Now a targeted `extract --session-id <id>` is idempotent (skips an unchanged,
237
+ already-extracted session with zero LLM calls) and only `--force` re-extracts. This
238
+ makes a session-end hook firing `extract --session-id <id>` precise AND idempotent.
239
+
240
+ ## [0.9.0-beta.32] — 2026-06-21
241
+
242
+ ### Added
243
+
244
+ - **Recombine acceptance path — confirmed lessons now auto-accept.** Recombine
245
+ hypotheses that reach the confirmation threshold (promoted to `type: lesson`,
246
+ #625/#633) now flow to ACCEPTED by reusing the existing drain mechanism instead
247
+ of piling up pending forever: the `personal-stash` drain policy gains a
248
+ `{ generator: "recombine", requireType: "lesson", maxDiffLines: 200 }` rule, via
249
+ a new optional `requireType` frontmatter filter on `DrainAcceptRule`. Only
250
+ confirmed `type: lesson` proposals auto-accept; unconfirmed `type: hypothesis`
251
+ proposals stay pending; the existing proposal quality gate still applies.
252
+ - **`processes.reflect.lowValueFilter` (opt-in, default OFF)** — deterministic
253
+ semantic value-floor that defers trivial reflect rewrites (#639A).
254
+ - **`processes.extract.triage.proceduralAwareFloor` (opt-in, default OFF)** —
255
+ triage floor requiring markers/edits so real lessons always pass (#641).
256
+
257
+ ### Fixed
258
+
259
+ - **Select-time proactive cooldown leak.** `selectProactiveMaintenanceRefs` plans
260
+ the due set BEFORE acquiring `reflect-distill.lock`, so overlapping/back-to-back
261
+ improve runs reused stale due-state and re-reflected the same asset repeatedly
262
+ (observed up to ~16× in a day). The orchestrator now re-applies the dueDays gate
263
+ with freshly-read timestamp maps INSIDE the lock (`filterProactiveDue`), dropping
264
+ refs a concurrent run already reflected.
265
+
266
+ ## [0.9.0-beta.31] — 2026-06-20
267
+
268
+ ### Changed
269
+
270
+ - **#632 — recombine now filters junk tags structurally.** Frontmatter tags that
271
+ are pure numbers, dates (`20260529`), short hex hashes (`002c624c`), version
272
+ strings (`0.8.0`, `v2`), single chars, or common English stopwords (`is`, `the`,
273
+ `for`, `when`, …) carry no topical signal and never form a recombine cluster.
274
+ Unlike `excludeTags` (a fixed project list), this catches the OPEN-ENDED junk —
275
+ every new date or commit hash — with no config upkeep. Exposed as `isJunkTag`.
276
+ On the live stash this turns the recombine cluster set from generic 66–171-member
277
+ buckets into tight topical clusters (`auth`, `architecture`, `patterns`, …).
278
+
279
+ ## [0.9.0-beta.30] — 2026-06-20
280
+
281
+ ### Changed / Fixed
282
+
283
+ - **#632 — recombine cluster tuning (opt-in, default-preserving).** Recombine
284
+ clustered memories by frontmatter tag and preferred the LARGEST buckets, so it
285
+ always picked the coarsest whole-stash tags (`session`/`claude`/`akm`, 63–171
286
+ members) and produced bland generalizations. Two new `processes.recombine` knobs:
287
+ `maxClusterSize` (skip clusters larger than N, so over-broad buckets no longer
288
+ reach/starve the largest-first slice) and `excludeTags` (tags that may never form
289
+ a tag cluster). Both UNSET = byte-identical to prior behavior.
290
+ - **#633 — recombine confirmation loop fixed.** The hypothesis confirmation streak
291
+ was keyed on a hash of the EXACT member set, so a growing stash drifted the key
292
+ every run → a fresh row at count 1 → `confirmThreshold` never reached → no
293
+ hypothesis ever promoted to a lesson (a dead two-pass loop). A freshly-induced
294
+ cluster now matches an existing pending row by signature + Jaccard
295
+ membership-overlap (≥ 0.7) and reuses its stable ref, so the streak accumulates
296
+ through membership drift. First/non-overlapping induction is unchanged.
297
+
298
+ ## [0.9.0-beta.29] — 2026-06-20
299
+
300
+ ### Reverted
301
+
302
+ - **#630 — `fact` asset type phase 2 reverted (#631).** The pinned-core assembly +
303
+ `akm fact` CLI shipped in beta.28 was reverted pending rework. Phase 1 (#629, the
304
+ `fact` asset type itself) remains in place.
305
+
306
+ ## [0.9.0-beta.27] — 2026-06-20
307
+
308
+ All new behavior is **opt-in / default-preserving** — default runs are byte-identical.
309
+
310
+ ### Added
311
+
312
+ - **#624 P2 — priority-ranked graph extraction.** `processes.graphExtraction.topN`:
313
+ when set, the graph-extraction pass ranks eligible files by asset utility
314
+ (`utility_scores`, read-only join) and processes only the top-N per run, so
315
+ high-value assets get graphed first instead of a ~55h full-corpus sweep. Unset
316
+ (default) = no ranking, byte-identical.
317
+ - **#624 P3 — lazy on-demand graph extraction.** New `graph_extraction_queue` table
318
+ + `enqueueGraphExtraction`/`drainExtractionQueue`/`extractGraphForSingleFile`.
319
+ `akm curate` enqueues an ungraphed hit (non-blocking); `akm show` can extract a
320
+ missing graph inline — gated on `index.graph.lazyGraphExtraction: true`
321
+ (**default off**: `show` makes no LLM call by default), model-guarded, and bounded
322
+ by a 30s timeout so it never hangs. The pass drains the queue before the ranked
323
+ sweep. This **closes #624** (all three layers shipped).
324
+ - **#616 — bounded multi-cycle phasing.** `profiles.improve.<name>.maxCycles`
325
+ (default 1): when > 1, the improve passes run in an N-cycle loop so gate-accepted
326
+ output of cycle N feeds cycle N+1 within the same run (re-running ensureIndex +
327
+ ref selection each cycle), stopping at a fixed point and respecting the run budget.
328
+ `maxCycles: 1` = byte-identical to today.
329
+
330
+ ### Fixed
331
+
332
+ - **Release CI unblocked.** `runCliCapture` (test harness) restored `process.exitCode`
333
+ to a captured `undefined`, which under `bun test` does not clear a previously-set
334
+ non-zero exit code — so the unit suite exited 1 with 0 failures at `TEST_PARALLEL=1`
335
+ (exactly how `release.yml` runs), silently blocking every npm publish since beta.11.
336
+ Fixed to restore to `0`. (This is why beta.26 was the first successful workflow publish.)
337
+
338
+ ### Changed
339
+
340
+ - **CI/release tests sharded across runner jobs (~15 min → ~2 min).** Bun 1.3.x
341
+ in-process test parallelism (`--parallel=N`, N>1) hits an intermittent
342
+ `epoll_ctl EEXIST` race / busy-spin hang on the `--isolate` workers, which had
343
+ forced fully-sequential (`TEST_PARALLEL=1`) runs. Tests now shard across separate
344
+ runner jobs (each a separate process tree, so no cross-shard fd/epoll collisions)
345
+ with `--parallel=1` within each shard; the matrix runs shards concurrently. The
346
+ release gate runs the identical set of tests. Local `bun run check` defaults to
347
+ sequential too (the only safe mode on this Bun version). Coverage unchanged.
348
+ Each shard runs through `scripts/run-test-shard.sh`, which retries **only on a
349
+ hang/timeout** (the busy-spin can rarely fire even at `--parallel=1`) and never
350
+ on a real test failure, so genuine red tests still fail fast and are never masked.
351
+
352
+ ## [0.9.0-beta.26] — 2026-06-20
353
+
354
+ ### Added
355
+
356
+ - **#628 — configurable SQLite journal mode (`AKM_SQLITE_JOURNAL_MODE`) for network
357
+ filesystems.** AKM previously opened every database with `PRAGMA journal_mode = WAL`
358
+ unconditionally, which cannot run on a network filesystem (NFS/SMB/Azure Files) —
359
+ WAL's `-shm` shared-memory wal-index can't be `mmap`'d over a network mount. You can
360
+ now set `AKM_SQLITE_JOURNAL_MODE` to `WAL` (default), `DELETE`, or `TRUNCATE`, applied
361
+ at **all five** db openers (`state.db`, `index.db` ×2 paths, `workflow.db`, `logs.db`).
362
+ At the `WAL` default AKM auto-detects a network mount for the data dir and transparently
363
+ falls back to `DELETE` (rollback journal + `synchronous = FULL`) with a one-line warning;
364
+ invalid values warn once and fall back to `WAL`. **Default behavior is byte-identical.**
365
+ This lets the AKM database subtree live on a shared volume (e.g. Azure Files under
366
+ Azure Container Apps). New docs section "Hosting AKM databases on a network share
367
+ (NFS/SMB)" in `docs/configuration.md`.
368
+
369
+ ## [0.9.0-beta.25] — 2026-06-19
370
+
371
+ Completes the recombine / extract-efficiency / graph thread. All new improve
372
+ passes are **opt-in (default off)**, so default behavior is unchanged.
373
+
374
+ ### Added
375
+
376
+ - **#606 — event-driven extract (`akm extract --watch`).** Opt-in watch mode: an
377
+ injectable, debounced watcher triggers extraction shortly after a session file
378
+ appears, with a clean `stop()` handle. The `8,28,48` cron remains the fallback;
379
+ no daemon is auto-launched.
380
+ - **#625 — recombine second pass (hypothesis → lesson).** The opt-in `recombine`
381
+ process (#609) now consumes `confirmThreshold` (default 2): a generalization
382
+ re-induced that many consecutive runs is promoted from a `type: hypothesis`
383
+ proposal to a `type: lesson` proposal through the normal queue + quality gate
384
+ (never a direct stash write). Hypotheses that stop recurring decay. Backed by a
385
+ new `recombine_hypotheses` table in `state.db`.
386
+
387
+ ### Changed
388
+
389
+ - **#624 (P1) — graph storage decoupled from `entries.id`.** `graph_files` is
390
+ re-keyed on `(stash_root, file_path, body_hash)`, so extracted graph data now
391
+ **survives a reindex** of unchanged files instead of being cascade-wiped. The
392
+ upgrade is migrated in a **targeted, graph-only path** that preserves existing
393
+ graph data and leaves the entry index, embeddings, FTS, and LLM-enrichment cache
394
+ untouched — **no full index rebuild and no re-embed** on upgrade. (P2 priority-
395
+ ranked extraction and P3 lazy/on-demand extraction remain deferred.)
396
+
397
+ ### Fixed
398
+
399
+ - Graph re-key migration no longer triggers a destructive full-index rebuild: it
400
+ is a graph-scoped table migration (no `DB_VERSION` bump), and it **copies** the
401
+ existing graph rows into the new schema rather than dropping them.
402
+ - Test-suite `/tmp` hygiene: sandbox teardown now fires on `SIGINT`/`SIGTERM`/
403
+ `SIGHUP` (not just clean exit), and a `sweep:tmp` step reclaims stale `akm-*`
404
+ sandbox dirs left by force-killed workers — eliminating the tmpfs accumulation
405
+ that caused intermittent `EEXIST: epoll_ctl` test flakes.
406
+
407
+ ## [0.9.0-beta.20] — 2026-06-18
408
+
409
+ ### Fixed
410
+
411
+ - **`akm update --all` no longer fails for writable `github:` entries stored as `source:"git"`**. `updateRegistryEntry` was using `synced.source` (re-derived from the ref scheme as `"github"`) instead of the existing `entry.source`, causing the config validator to reject `writable:true` on every update cycle.
412
+
413
+ ## [0.9.0-beta.19] — 2026-06-17
414
+
415
+ ### Fixed
416
+
417
+ - **`akm feedback` now completes in ~0.3s** (was 3+ minutes). Root cause: the command was calling `ensureIndex` with `mode: "blocking"` inside `withIndexWriterLease`, triggering a full reindex on every feedback call. Fix: removed the `ensureIndex` call entirely (feedback only needs the index to exist, not be current — a stale index is fine for ref lookup); removed the application-level writer lock (SQLite WAL + `busy_timeout=30s` handles concurrent access with `akm improve`); added a fast DB-exists guard with a clear error for first-time users.
418
+ - **`akm health --format html` now completes in ~11s** (was ~18s). Root cause: `akmHealth()` was called twice — once for the main result and once to get `deltas`. Fix: merged into a single call passing both `groupBy: "run"` and `windowCompare` together.
419
+
420
+ ## [0.9.0-beta.18] — 2026-06-17
421
+
422
+ ### Changed
423
+
424
+ - **Health report: Recent Runs table now shows all filtered runs in descending order** (newest first) instead of capping at the last 10.
425
+ - **Health report: Removed "Command Set Used" section.**
426
+ - **Health report: All timestamps now display in the viewer's local timezone** (chart axis labels, runs table, freshness line, executive summary, footer). Server-rendered ISO strings are wrapped in `<time data-iso>` elements and converted to local time by client-side JS on page load.
427
+
428
+ ### Changed (migration required)
429
+
430
+ - **WS-2 outcome loop (#613) — default-off weight change (state.db migration 010).**
431
+ Every `akm improve` run now writes an `asset_outcome` row per processed asset
432
+ (state.db migration `010`) and computes a differential usefulness signal
433
+ (`outcome_score`) per ref. The outcome signal is persisted and visible in the
434
+ health report, but the **weight change is gated behind a config flag** (see
435
+ below). Ranking is unchanged from WS-1 by default.
436
+
437
+ **Opt-in weight change.** The WS-2 projection weights (`w_e=0.25, w_o=0.15,
438
+ w_r=0.60`) affect ranking only when you explicitly set
439
+ `improve.salience.outcomeWeightEnabled: true` in your `akm.yaml`. The default
440
+ (`false`) keeps WS-1 parity weights (`w_e=0.30, w_r=0.70`, `w_o=0`), so
441
+ existing users see no ranking change on upgrade.
442
+
443
+ **Part-V measurement gate.** Before enabling the weight change, run the Part-V
444
+ T0 baseline (`scripts/akm-eval` + `akm health`; confirm proactive accept
445
+ ≥ 0.9× reactive; reversion ≤ 0.15; retrieval-delta ≥ 0; coverage not
446
+ regressed). That gate requires a running production stash and cannot be
447
+ exercised in CI. Once confirmed, set
448
+ `improve.salience.outcomeWeightEnabled: true` to activate the three-way split.
449
+
450
+ **Outcome loop mechanics.** `outcome_score` is a differential prediction-error
451
+ signal: `(retrieval_delta − expected_delta) − PENALTY × retrieval_delta × (1 −
452
+ accepted_change_rate) + valence`, tracked via an EMA (α=0.3). New rows are
453
+ warm-started from the utility EMA score (clipped to 0.3) so the signal is
454
+ non-zero from launch. A stash-wide diversity floor (10% of the max score) prevents
455
+ rare-but-correct assets from being permanently outcompeted. An inverted-proxy
456
+ tripwire (`corr(outcome_score, accepted_change_rate) < −0.3`) emits an
457
+ `outcome_proxy_inverted` health event when the signal degrades.
458
+
459
+ `review_pressure` is computed and persisted per asset but is **not yet wired into
460
+ the admission policy** — that is deferred to a later work stream per plan §Part-VI
461
+ #613. The column is present and populated; routing it into the consolidation-
462
+ selection filter is the next step.
463
+
464
+ - **WS-1 salience vector (#618) — default-on ranking change.** The eligibility sort
465
+ for all `akm improve` runs (whole-stash, type, and ref scope) has changed from
466
+ `combinedEligibilityScore = utility·0.7 + negativeOnlyRatio·0.3` to
467
+ `rankScore = (0.3·encodingSalience + 0.7·retrievalSalience) × sizePenalty`
468
+ (feedback valence and utility EMA dropped from ordering until WS-2 re-introduces
469
+ outcome salience). Assets are now ranked by retrieval frequency × recency × type
470
+ importance rather than by feedback magnitude. Because the old
471
+ `combinedEligibilityScore` ordering was never persisted, a forgetting comparison is
472
+ not possible on the first run; instead a one-time `improve_salience_first_run` marker
473
+ event is emitted to record the transition. On every subsequent run a stash-wide
474
+ `improve_salience_rank_change` drift report (including `stashSize`) is emitted so
475
+ rank movement under the new scoring can be tracked over time.
476
+ The Part-V measurement protocol (T0 baseline via `scripts/akm-eval` + health report,
477
+ throughput/quality gate) is deferred to the WS-2 milestone, when outcome salience
478
+ re-joins the projection and re-tuning is triggered.
479
+
480
+ ## [0.9.0-beta.12] - 2026-06-15
481
+
482
+ Improve-tuning work streams (all **default-off / parity-preserving** — no behavior
483
+ change until explicitly enabled).
484
+
485
+ ### Added
486
+
487
+ - **#617 — deterministic near-duplicate memory dedup** (`processes.consolidate.dedup`,
488
+ default off). A cheap no-LLM pre-pass in front of consolidation collapses obvious
489
+ duplicates — `.derived`+origin pairs and content twins (normalized content-hash
490
+ equality, or embedding cosine ≥ `cosineThreshold`, default 0.97). Each dropped
491
+ variant is archived + backed up before deletion; hot memories are never
492
+ collapsed; distinct-but-related memories fall through to the LLM.
493
+ - **#581 — judged-state cache for consolidation** (`processes.consolidate.judgedCache`,
494
+ default off). New state.db table (`consolidation_judged`) records each memory's
495
+ content hash + outcome when the LLM judges it; subsequent runs skip
496
+ judged-unchanged memories, converting coverage from O(time-window) to
497
+ O(changed/new) so a run can sweep the full corpus. Fails open; failed chunks
498
+ and dry-runs never poison the cache. (state.db migration `007`.)
499
+ - **#612 — auto-accept gate calibration** (`improve.calibration`, auto-tune default
500
+ off). Joins predicted gate confidence to realized accept/reject outcomes into a
501
+ reliability table + calibration gap, surfaced in `akm health` (+ summary rows in
502
+ the HTML report). Opt-in bounded threshold auto-tune nudges the accept threshold
503
+ within a configured band toward a target accept rate, logged via a
504
+ `calibration_autotune` event. (Replay-prioritization from prediction error is
505
+ deferred — it depends on the #610 replay budget, a 0.10 item.)
506
+
507
+ ### Fixed
508
+
509
+ - **#614 — symmetric valence weighting** (`profiles.improve.*.symmetricValence`,
510
+ default off). The eligibility sort weighted feedback negative-only; when enabled
511
+ it uses a symmetric `|valence|` magnitude so strong positive and strong negative
512
+ feedback both drive attention (utility stays the dominant factor), routing
513
+ high-negative → fix and high-positive → reinforce lanes.
514
+
515
+ ## [0.9.0-beta.11] - 2026-06-15
516
+
517
+ ### Added
518
+
519
+ - **`extract.maxSessionsPerRun`** (default 25) — caps the NEW sessions the
520
+ extract pass LLM-processes in a single run so a backlog (e.g. after downtime)
521
+ can't push one run past its scheduled-task timeout. Overflow sessions stay
522
+ unseen and are picked up by later runs, so coverage is preserved. `0` disables.
523
+
524
+ ### Fixed
525
+
526
+ - **Auto-accept validation failures are no longer a blind leak.** When a
527
+ confidence-passing proposal fails promotion validation, the gate now captures
528
+ the reason (the `validateProposal` finding kind, e.g. `validation:description-quality`),
529
+ records it on the proposal (`akm proposal show` explains the rejection), logs
530
+ it, and exposes `failedByReason` on the gate result — so the ~5% leak is
531
+ diagnosable instead of silently warned-and-dropped.
532
+ - **Inflated skip-reason aggregates in `akm health`.** `no_new_signal` /
533
+ `profile_filtered_all_passes` are per-run snapshots of a stable set; the
534
+ window aggregator summed their per-run counts (≈2.7M / 3M). It now uses the
535
+ most recent run's count for these aggregated-snapshot reasons while still
536
+ summing genuine per-occurrence skips.
537
+
538
+ ## [0.9.0-beta.10] - 2026-06-15
539
+
540
+ ### Added
541
+
542
+ - **#603** — `akm health` pool-saturation advisory. Instead of alerting on the
543
+ raw `sessionsScanned` count (which false-alarmed on normal cadence changes),
544
+ a new `pool-saturation` advisory reports the ratio of new (unseen) sessions
545
+ to the total session pool: informational below 10% (expected steady state),
546
+ warning below 2% (possible discovery/dedup bug). Heuristic, never gates
547
+ overall status.
548
+ - **#576** — the `akm health` HTML report now renders the real per-stage LLM
549
+ token/time aggregate (a "🧠 LLM Work" KPI card + LLM token/call/wall-time
550
+ summary rows) from the captured `llm_usage` events, replacing the GPU-time
551
+ proxy.
552
+ - **Built-in `akm health --format html` report overhaul** — the report is now a
553
+ strict superset of (and supersedes) the external `akm-health-report` stash
554
+ skill. Restored the interactive filter bar (time-slice 1d–21d, task, status)
555
+ with client-side chart/table re-render and the Last-10 "Task" column;
556
+ reordered sections to a decision-first flow (verdict → action items → KPIs →
557
+ table → charts); added a synthesized one-sentence **Verdict** (status + 2–3
558
+ drivers) and a freshness line; merged the duplicate Advisories / What-to-Watch
559
+ into one prioritized, de-duplicated **Action Items** list (P1/P2/P3 +
560
+ remediation command); added a per-stage **LLM token** stacked-bar chart and
561
+ `dataZoom` sliders on dense charts; fixed the failed-run scatter x-alignment
562
+ (now shape-encoded); KPI-card colors are now health signals (not decoration);
563
+ added metric-glossary tooltips, chart `aria-label`s, contrast fixes, and
564
+ empty-state overlays. Deterministic output preserved.
565
+
566
+ ### Fixed
567
+
568
+ - **Health report accuracy** (follow-ups to the overhaul): the per-run **Task**
569
+ column/filter now show the real scheduled task (`akm-improve-frequent`, …) via
570
+ a ±5min `task_history` join instead of the run's scope (which is `all` for
571
+ every scheduled run); the time-**slice** filter options are now derived from
572
+ the report's `--since` window (e.g. All/3d/1d/12h/6h for a 7d report) and
573
+ default to "All" — replacing the hard-coded 1d–21d list that didn't match the
574
+ window; and the trend **deltas** now default their compare window to `--since`
575
+ (like-for-like, e.g. last 7d vs prior 7d) instead of a fixed 24h, which had
576
+ produced nonsensical period-over-period percentages on multi-day reports.
577
+ - **Inflated stash-snapshot metrics in `akm health`.** `memorySummary`
578
+ (derived/eligible) and `profileFilteredRefs` are whole-stash snapshots recorded
579
+ on every run, but the window aggregator was **summing** them across all runs —
580
+ e.g. "915,258 of 1,226,025 eligible" and a 2.4M filtered-ref count. They now
581
+ take the most recent run's snapshot (the current state). Per-run *work* metrics
582
+ (promoted, MI written, graph entities, …) remain genuine window sums.
583
+ - **Health report polish:** the akm version is stamped in the header (under the
584
+ AKM logo) and footer; the steady-state `no new signal since last proposal`
585
+ distill reason is excluded from the skip-reason chart (it drowned out the
586
+ actionable reasons); and the Consolidation Output chart now draws Promoted as a
587
+ line on a secondary right-hand axis (it dwarfs merged/deleted) with merged and
588
+ deleted as bars on the left axis.
589
+
590
+ - **#598** — process-level tuning fields (`consolidate.incrementalSince`,
591
+ `minPoolSize`, `neighborsPerChanged`, `extract.minContentChars`, per-process
592
+ `enabled` flags) now survive an `akm config` rewrite. They are first-class
593
+ typed `ImproveProcessConfigSchema` fields, so the load→save round trip no
594
+ longer silently drops them. Unknown process sub-keys hard-error at load
595
+ (`ConfigError`) rather than being silently discarded — the deliberate,
596
+ documented resolution. Regression-guarded by
597
+ `tests/config-process-roundtrip.test.ts`.
598
+
599
+ ## [0.9.0-beta.9] - 2026-06-14
600
+
601
+ Restore and instrument `akm improve` steady-state output. The reflect/distill
602
+ self-improvement lanes had been near-zero in steady state because the
603
+ signal-delta eligibility gate was the only lane (cache "no-access = no-work"
604
+ pathology) and the high-retrieval fallback was structurally dead. This release
605
+ revives proactive improvement, adds attribution + a measurement/kill-criterion
606
+ system so the lane must prove its value, and right-sizes reflect budgets to
607
+ their task timeouts.
608
+
609
+ ### Added
610
+
611
+ - **Proactive maintenance selector** (`proactiveMaintenance` improve process):
612
+ due-gated, composite-priority (`importance × log(1+retrievalFreq) ×
613
+ recencyDecay / log(size)`), bounded rotating top-N reflect/distill over
614
+ stale/never-reflected assets. **Disabled by default**; enable per profile.
615
+ - **Eligibility attribution**: every reflect/distill proposal is stamped
616
+ `eligibilitySource ∈ {signal-delta, high-retrieval, proactive, scope,
617
+ unknown}` on `reflect_invoked`/`distill_invoked`/`promoted` events and the
618
+ proposal record, so outcomes are sliceable by lane.
619
+ - **Measurement system** under `scripts/akm-eval/`: a real-query retrieval suite
620
+ generated from `usage_events`, and `akm-eval-proactive-verdict` — a read-only
621
+ kill-criterion runner comparing the proactive lane (treatment) vs due-but-
622
+ untouched assets (control). Emits PASS/FAIL/INCONCLUSIVE and recommends
623
+ disabling the lane on FAIL. New `proactive_selected` event +
624
+ `proactiveSelected`/`proactiveDueTotal`/`proactiveNeverReflected` fields on
625
+ `improve_completed`.
626
+
627
+ ### Fixed
628
+
629
+ - Revived the P0-A high-retrieval fallback: genuinely zero-feedback assets were
630
+ routed to the fully-skipped branch one phase before the fallback could see
631
+ them, so frequently-retrieved-but-never-rated assets were never improved.
632
+ - `getRetrievalCounts` now normalizes bare vs `origin//`-prefixed refs (it was
633
+ dropping ~half the retrieval signal) and counts `curate` events
634
+ (`akm curate` now records per-item `entry_ref`).
635
+ - The fully-skipped `no_new_signal` branch emitted one `improve_skipped` event
636
+ per ref (~11K writes/run, ~400K rows/day) — a contributor to 900s improve
637
+ timeouts and state.db bloat. Collapsed into one aggregated counted event.
638
+
639
+ ## [0.9.0-beta.8] - 2026-06-13
640
+
641
+ Fix multi-process SQLite contention in `index.db` and harden concurrent proposal
642
+ queue mutations.
643
+
644
+ ### Changed
645
+
646
+ - Added a global `index.db` writer lease used by foreground indexing,
647
+ background auto-index, improve maintenance index writers, graph updates, and
648
+ feedback writes.
649
+ - Replaced the racy background index PID-file dedup flow with lease-based
650
+ coordination and explicit handoff to the spawned worker.
651
+ - `akm feedback` now uses blocking index preparation and writes under the same
652
+ `index.db` lease, avoiding self-inflicted `database is locked` failures.
653
+ - Proposal queue create/archive/gate-decision mutations now run under
654
+ `BEGIN IMMEDIATE` state.db transactions so concurrent processes serialize on
655
+ live queue state.
656
+
657
+ ## [0.9.0-beta.7] - 2026-06-13
658
+
659
+ Fix the `akm improve` regression introduced by background `ensureIndex`.
660
+
661
+ ### Changed
662
+
663
+ - Added an explicit `ensureIndex` mode so callers choose `background` or
664
+ `blocking` behavior directly instead of relying on hidden environment state.
665
+ - `akm improve` now uses blocking index preparation before collecting eligible
666
+ refs, restoring the post-upgrade empty-index recovery path.
667
+ - Removed the `AKM_INDEX_INLINE` test-only override so tests exercise the same
668
+ index behavior model as production.
669
+
670
+ ## [0.9.0-beta.6] - 2026-06-12
671
+
672
+ Pipeline optimization: new per-process config fields wire up the consolidation
673
+ and improve pipeline knobs exposed by the optimization report — incremental
674
+ consolidation, pool caps, distill gating, and memory inference throttling.
675
+
676
+ ### Added
677
+
678
+ - **`consolidate.incrementalSince`** — profile config field that narrows the
679
+ consolidation candidate pool to memories modified within the given window
680
+ (e.g. `"1h"`, `"4h"`) plus their graph neighbours. Enables frequent
681
+ consolidation passes (e.g. `quick-shredder` every 15 min) without full-pool
682
+ sweeps. Absent = full-pool sweep (correct for nightly runs).
683
+ - **`consolidate.limit`** — hard cap on memories processed per consolidation
684
+ pass, applied after incremental narrowing. Prevents runaway full-pool sweeps
685
+ in the nightly default profile.
686
+ - **`consolidate.neighborsPerChanged`** — configurable graph-neighbour count
687
+ per changed memory during incremental consolidation (was hardcoded to 5).
688
+ `quick-shredder` sets this to 3 for a 40% candidate reduction per burst.
689
+ - **`distill.requirePlannedRefs`** — when `true`, the distill process is
690
+ skipped entirely for distill-only refs when the reflect phase produced zero
691
+ planned refs. Eliminates hundreds of `distill-skipped` events on quiet passes
692
+ where all refs are on reflect cooldown.
693
+ - **`memoryInference.minPendingCount`** — minimum pending split-parent memory
694
+ count below which the inference pass is skipped entirely (zero LLM calls).
695
+ Prevents lock acquisition on passes where there is nothing to infer.
696
+ - **`reflect.limit`** — per-process ref limit for the reflect/distill loop,
697
+ applied as the improve run limit when no CLI `--limit` is given.
698
+ - **New `reflect-distill` improve profile** — dedicated reflect + distill +
699
+ memoryInference + triage profile for the every-4h `akm-improve-frequent`
700
+ task. `reflect.limit: 25` bounds LLM cost per pass.
701
+
702
+ ### Changed
703
+
704
+ - **`quick-shredder` profile tuned**: `incrementalSince` `4h` → `1h`,
705
+ `maxChunkSize` 25 → 35, added `minPoolSize: 10`, `neighborsPerChanged: 3`,
706
+ `memoryInference.minPendingCount: 5`. All `profile: "qwen-9b-shredder"`
707
+ process references removed — falls back to default LLM.
708
+ - **`default` improve profile** (nightly): extract disabled (dedicated
709
+ `akm-extract` task runs at 01:48), consolidate gets `limit: 500`,
710
+ reflect gets `limit: 100` and `allowedTypes`, distill gets
711
+ `requirePlannedRefs: true`, triage enabled at 50 accepts/run,
712
+ graphExtraction explicitly enabled.
713
+ - **Cron schedule optimised**: extract reverted to `8,28,48 * * * *` (3×/hr),
714
+ quick-shredder shifted to `4,19,34,49` (4-min extract gap), health-report
715
+ shifted to `:03` (avoids `:00` collision), `akm-improve-frequent` re-enabled
716
+ at `45 */4` with `reflect-distill` profile.
717
+
9
718
  ## [0.9.0-beta.3] - 2026-06-12
10
719
 
11
720
  Stabilization batch closing the remaining 0.9.0 milestone: DB-locking and