akm-cli 0.9.27 → 0.9.28-alpha.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 (40) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/STABILITY.md +4 -0
  3. package/dist/assets/hints/cli-hints-full.md +3 -0
  4. package/dist/assets/hints/cli-hints-short.md +1 -0
  5. package/dist/assets/prompts/consolidate-pair.md +1 -1
  6. package/dist/assets/templates/html/metrics.html +977 -0
  7. package/dist/cli/shared.js +5 -4
  8. package/dist/cli.js +11 -1
  9. package/dist/commands/health/accept-rate.js +8 -4
  10. package/dist/commands/health/html-report.js +3 -8
  11. package/dist/commands/health/llm-usage.js +17 -6
  12. package/dist/commands/health/renderers.js +4 -4
  13. package/dist/commands/improve/improve-report.js +4 -2
  14. package/dist/commands/improve/improve.js +22 -10
  15. package/dist/commands/improve/loop-stages.js +8 -1
  16. package/dist/commands/improve/preparation.js +16 -0
  17. package/dist/commands/improve/stage.js +1 -1
  18. package/dist/commands/metrics/collect.js +439 -0
  19. package/dist/commands/metrics/html-report.js +82 -0
  20. package/dist/commands/metrics/md-report.js +44 -0
  21. package/dist/commands/metrics/metrics-cli.js +213 -0
  22. package/dist/commands/metrics/report-view.js +243 -0
  23. package/dist/commands/metrics/types.js +4 -0
  24. package/dist/commands/read/search.js +5 -0
  25. package/dist/indexer/indexer.js +64 -14
  26. package/dist/indexer/usage/usage-events.js +3 -1
  27. package/dist/integrations/session-logs/pre-filter.js +1 -0
  28. package/dist/llm/usage-persist.js +22 -11
  29. package/dist/llm/usage-telemetry.js +4 -0
  30. package/dist/output/html-render.js +15 -8
  31. package/dist/output/shapes/passthrough.js +1 -0
  32. package/dist/output/text/metrics.js +39 -0
  33. package/dist/output/text.js +2 -0
  34. package/dist/scripts/akm-migrate-node.js +281 -8
  35. package/dist/scripts/akm-migrate.js +281 -8
  36. package/dist/storage/repositories/index-utility-repository.js +24 -0
  37. package/dist/storage/repositories/metrics-repository.js +80 -0
  38. package/docs/reference/cli.md +63 -4
  39. package/docs/reference/data-and-telemetry.md +41 -8
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,71 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.28-alpha.2] - 2026-10-08
10
+
11
+ ### Added
12
+
13
+ - **`akm metrics` (experimental) reports what akm has recorded, in every `--format`.** One
14
+ read-only command covers asset usage (searches, shows, curates, selects, the
15
+ queries that returned nothing), feedback with its reasons and tags, utility
16
+ and outcome scores, LLM tokens, latency, task runs,
17
+ proposals and workflow token spend. `--since` (default `30d`) sets the window start; the window ends now, counts
18
+ `user`-source usage and keeps the top 20 of every ranked list. The
19
+ window rows (usage rows as recorded, LLM calls summed per day, engine, model, process and stage) ride along with
20
+ `--format html` and `--detail full`. A window
21
+ longer than a store's retention says so in `notes`.
22
+
23
+ - **`akm metrics` renders as text and Markdown.** `--format text` prints aligned
24
+ Usage, Feedback, Utility, LLM, Index, Tasks, Proposals and Workflows sections
25
+ with top-N tables (cut to 5 at `--detail brief`); `--format md` prints one
26
+ heading per section with GFM tables.
27
+
28
+ - **`akm metrics --format html` writes a self-contained dashboard.** The page
29
+ carries the window's raw rows, so you can filter by date, bundle, source and
30
+ event type, sort the tables, open an asset to see its timeline, queries and
31
+ feedback, and download any table as CSV, all in the browser. Charts load
32
+ ECharts from the same CDN tag as `akm health --report`. A page keeps the most
33
+ recent 50,000 usage rows and says so when it cuts older ones.
34
+
35
+ ### Changed
36
+
37
+ - **LLM usage is recorded for every command.** `akm index`, curate, workflow,
38
+ agent dispatch and `akm command run` now persist their `llm_usage` events
39
+ like `improve` and `proposal drain` already did; before, a call made outside
40
+ those two was dropped. An improve run still keeps its own sink and the
41
+ process-wide one resumes when it ends.
42
+
43
+ - Search latency is recorded in the search summary usage row (`totalMs`, plus `rankMs` and `embedMs` when present), and every `akm index` run appends an `index_completed` event with its phase timings.
44
+
45
+ ### Fixed
46
+
47
+ - **Usage-event retention no longer deletes a day early.** The purge on `akm index`
48
+ compared the space-separated `created_at` against an ISO cutoff, so every row on
49
+ the cutoff's date was removed up to 24 hours before its 90 days were up. Both
50
+ sides are now normalized before the comparison.
51
+
52
+ ## [0.9.28-alpha.1] - 2026-10-08
53
+
54
+ ### Fixed
55
+
56
+ - **Distill skips a memory marked `beliefState: deprecated` or `superseded`.** Such a note is no longer true and gave
57
+ no lesson (26 of about 900 memories carry the state; distill ran on 17 of them). The improve loop records a
58
+ `distill-skipped` action and an `improve_skipped` event (`distill_deprecated_or_superseded`), and the attempt goes
59
+ in the ledger as `unchanged`; an explicit `--scope` ref still runs. `contradicted` is still distilled.
60
+ - The distill judge scores a lesson 1–2 on non-redundancy when a listed asset
61
+ states most of what it says, not only when it states the same rule, and is
62
+ told to compare only with the listed assets, never with the source memory.
63
+ Before, a lesson that restated a skill the library holds scored 3 ("largely
64
+ redundant") and went to a reviewer. Judge-only replay of the lessons the
65
+ writer produced (local qwen3.8-27b, 3 repeats): of 4 public lessons for
66
+ memories that deserve none, 12 verdicts passed 3 before and 1 after, and of
67
+ 12 such own lessons 33 of 36 passed before and 27 after, while the 31
68
+ lesson-worthy own lessons lost no verdict (2 of 93 rejected before, 0 after).
69
+ - **The pair judge's reason no longer swaps A and B.** In a replay of 120 recorded pairs, 18 of 90 retirement
70
+ reasons said the opposite of what the judge's claim lists decided (for example "B contains all claims from A" for a
71
+ pair where B was retired). The lists were right, so no retirement changed, but the reason a reviewer reads was
72
+ wrong. The prompt now asks the reason to name the asset that can be deleted; two replays gave 0 and 1 of about 85.
73
+
9
74
  ## [0.9.27] - 2026-10-07
10
75
 
11
76
  The stable release of the 0.9.27 line: 0.9.27-alpha.1, alpha.2 and alpha.3.
package/STABILITY.md CHANGED
@@ -46,6 +46,7 @@ enumeration of the whole `proposal` noun group.
46
46
  | `akm setup` | Stable | |
47
47
  | `akm index` | Stable | |
48
48
  | `akm health` | Evolving | Exit codes are Evolving; report *content* and rendered `md`/`html` layout are Experimental — do not script against report layout. |
49
+ | `akm metrics` | Experimental | New in 0.9.28. Report content, JSON shape and the `html` dashboard may change. |
49
50
  | `akm info` | Stable | |
50
51
  | `akm bundle create` | Stable | |
51
52
  | `akm bundle add` | Stable | |
@@ -341,6 +342,9 @@ CHANGELOG with a migration note.
341
342
  Subject to change without notice within minor releases. Not yet recommended
342
343
  for scripted use.
343
344
 
345
+ - **`akm metrics`** — new in 0.9.28. What it reports, its JSON shape and the
346
+ `--format html` dashboard may change in any release; do not script against
347
+ them.
344
348
  - **`lesson` asset type** — schema (`when_to_use`, `description`) is
345
349
  stable, but lesson-distillation triggers and ranking are tuning targets.
346
350
  - **`--shape agent` and `--shape summary`** — the output-projection axis
@@ -416,6 +416,9 @@ akm agent --model sonnet --prompt "..." # Model override (aliases or exa
416
416
  akm info # Capabilities, bundle dir, index stats, semantic-search status
417
417
  akm health # Runtime diagnostics; exit 0 ok / 4 warn / 1 fail
418
418
  akm health --report # Adds accept-rate metrics
419
+ akm metrics # Usage, feedback, utility, LLM tokens, tasks, workflows (last 30d, read-only)
420
+ akm metrics --since 7d # Narrow the window
421
+ akm metrics --format html --output metrics.html # Self-contained dashboard with the window's rows (filter, sort, export CSV)
419
422
  akm log # Append-only event stream (mutations, feedback, indexing)
420
423
  akm log --ref <ref> # One asset's event trail
421
424
  akm log --since @offset:<id> # Durable row-id cursor — poll this to follow the stream
@@ -47,6 +47,7 @@ akm clone <ref> # Copy an asset to the working bun
47
47
  akm sync # Commit (and push if writable remote) changes in the primary bundle (--no-push to commit only)
48
48
  akm improve --no-sync # Run improve without the end-of-run auto-commit
49
49
  akm improve --no-push # Auto-commit but skip push for this run
50
+ akm metrics --since 7d # What was searched, shown and rated, and which assets went unused (--format html: dashboard)
50
51
  akm search "<query>" --from registry # Search all registries (registry search was folded into search)
51
52
  ```
52
53
 
@@ -16,4 +16,4 @@ Then classify the relation as exactly one of:
16
16
 
17
17
  Set "redundant" to the asset that could be deleted with no loss: "A" for "duplicate", the asset with the empty list for "subsumed", "A" for "supersedes"; else null. Set "stale" to "A" when the relation is "supersedes", else null.
18
18
 
19
- Answer ONLY with JSON: {"onlyInA": ["..."], "onlyInB": ["..."], "relation": "...", "redundant": "A"|"B"|null, "stale": "A"|null, "confidence": 0.0-1.0, "reason": "<at most 25 words>"}
19
+ Answer ONLY with JSON: {"onlyInA": ["..."], "onlyInB": ["..."], "relation": "...", "redundant": "A"|"B"|null, "stale": "A"|null, "confidence": 0.0-1.0, "reason": "<at most 25 words: name the asset that can be deleted and what the other asset still holds>"}