akm-cli 0.9.28-alpha.1 → 0.9.28-alpha.3

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 (38) hide show
  1. package/CHANGELOG.md +51 -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/templates/html/metrics.html +977 -0
  6. package/dist/cli/shared.js +5 -4
  7. package/dist/cli.js +11 -1
  8. package/dist/commands/health/accept-rate.js +8 -4
  9. package/dist/commands/health/html-report.js +3 -8
  10. package/dist/commands/health/llm-usage.js +17 -6
  11. package/dist/commands/health/renderers.js +4 -4
  12. package/dist/commands/improve/consolidate/pair-pass.js +3 -0
  13. package/dist/commands/improve/distill.js +6 -0
  14. package/dist/commands/improve/improve-report.js +4 -2
  15. package/dist/commands/improve/improve.js +22 -10
  16. package/dist/commands/metrics/collect.js +439 -0
  17. package/dist/commands/metrics/html-report.js +82 -0
  18. package/dist/commands/metrics/md-report.js +44 -0
  19. package/dist/commands/metrics/metrics-cli.js +213 -0
  20. package/dist/commands/metrics/report-view.js +243 -0
  21. package/dist/commands/metrics/types.js +4 -0
  22. package/dist/commands/read/search.js +5 -0
  23. package/dist/indexer/indexer.js +64 -14
  24. package/dist/indexer/usage/usage-events.js +3 -1
  25. package/dist/integrations/session-logs/pre-filter.js +1 -0
  26. package/dist/llm/usage-persist.js +22 -11
  27. package/dist/llm/usage-telemetry.js +4 -0
  28. package/dist/output/html-render.js +15 -8
  29. package/dist/output/shapes/passthrough.js +1 -0
  30. package/dist/output/text/metrics.js +39 -0
  31. package/dist/output/text.js +2 -0
  32. package/dist/scripts/akm-migrate-node.js +281 -8
  33. package/dist/scripts/akm-migrate.js +281 -8
  34. package/dist/storage/repositories/index-utility-repository.js +24 -0
  35. package/dist/storage/repositories/metrics-repository.js +80 -0
  36. package/docs/reference/cli.md +63 -4
  37. package/docs/reference/data-and-telemetry.md +42 -8
  38. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,57 @@ 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.3] - 2026-10-08
10
+
11
+ ### Changed
12
+
13
+ - A consolidate pair-pass retire proposal now records the judge's claim lists in its `retirement` metadata as `onlyInRetired` and `onlyInSuccessor`, named by role rather than by the judge's A/B, so what the judge found only on each side survives past the run. Proposals minted before this lack both fields; no row is added for a pair akm keeps.
14
+
15
+ - A distill lesson the quality gate rejects or sends to review now keeps its text: the `distill_invoked` event and the distill result carry `rejectedContent`, cut to 2000 characters (the judge prompt's cap). Before, a rejected lesson left only its score and reason. It stays local in `state.db`.
16
+
17
+ ## [0.9.28-alpha.2] - 2026-10-08
18
+
19
+ ### Added
20
+
21
+ - **`akm metrics` (experimental) reports what akm has recorded, in every `--format`.** One
22
+ read-only command covers asset usage (searches, shows, curates, selects, the
23
+ queries that returned nothing), feedback with its reasons and tags, utility
24
+ and outcome scores, LLM tokens, latency, task runs,
25
+ proposals and workflow token spend. `--since` (default `30d`) sets the window start; the window ends now, counts
26
+ `user`-source usage and keeps the top 20 of every ranked list. The
27
+ window rows (usage rows as recorded, LLM calls summed per day, engine, model, process and stage) ride along with
28
+ `--format html` and `--detail full`. A window
29
+ longer than a store's retention says so in `notes`.
30
+
31
+ - **`akm metrics` renders as text and Markdown.** `--format text` prints aligned
32
+ Usage, Feedback, Utility, LLM, Index, Tasks, Proposals and Workflows sections
33
+ with top-N tables (cut to 5 at `--detail brief`); `--format md` prints one
34
+ heading per section with GFM tables.
35
+
36
+ - **`akm metrics --format html` writes a self-contained dashboard.** The page
37
+ carries the window's raw rows, so you can filter by date, bundle, source and
38
+ event type, sort the tables, open an asset to see its timeline, queries and
39
+ feedback, and download any table as CSV, all in the browser. Charts load
40
+ ECharts from the same CDN tag as `akm health --report`. A page keeps the most
41
+ recent 50,000 usage rows and says so when it cuts older ones.
42
+
43
+ ### Changed
44
+
45
+ - **LLM usage is recorded for every command.** `akm index`, curate, workflow,
46
+ agent dispatch and `akm command run` now persist their `llm_usage` events
47
+ like `improve` and `proposal drain` already did; before, a call made outside
48
+ those two was dropped. An improve run still keeps its own sink and the
49
+ process-wide one resumes when it ends.
50
+
51
+ - 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.
52
+
53
+ ### Fixed
54
+
55
+ - **Usage-event retention no longer deletes a day early.** The purge on `akm index`
56
+ compared the space-separated `created_at` against an ISO cutoff, so every row on
57
+ the cutoff's date was removed up to 24 hours before its 90 days were up. Both
58
+ sides are now normalized before the comparison.
59
+
9
60
  ## [0.9.28-alpha.1] - 2026-10-08
10
61
 
11
62
  ### Fixed
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