akm-cli 0.9.17-alpha.8 → 0.9.17-alpha.9

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 (104) hide show
  1. package/CHANGELOG.md +334 -0
  2. package/STABILITY.md +9 -8
  3. package/dist/assets/hints/cli-hints-full.md +6 -7
  4. package/dist/assets/improve-strategies/catchup.json +0 -3
  5. package/dist/assets/improve-strategies/consolidate.json +0 -1
  6. package/dist/assets/improve-strategies/default.json +1 -2
  7. package/dist/assets/improve-strategies/proactive-maintenance.json +1 -2
  8. package/dist/assets/improve-strategies/quick.json +1 -2
  9. package/dist/assets/improve-strategies/reflect-distill.json +1 -2
  10. package/dist/assets/improve-strategies/thorough.json +0 -3
  11. package/dist/assets/prompts/consolidate-pair.md +20 -0
  12. package/dist/assets/stash-skeleton/facts/conventions/backlinks.md +17 -19
  13. package/dist/assets/stash-skeleton/facts/conventions/domains.md +2 -2
  14. package/dist/assets/templates/html/health.html +3 -5
  15. package/dist/cli/retired-commands.js +1 -1
  16. package/dist/commands/health/archive-usage.js +98 -0
  17. package/dist/commands/health/data-dir-usage.js +25 -13
  18. package/dist/commands/health/html-report.js +1 -4
  19. package/dist/commands/health/improve-metrics.js +0 -25
  20. package/dist/commands/health/md-report.js +1 -6
  21. package/dist/commands/health/report-view-model.js +4 -14
  22. package/dist/commands/health/windows.js +0 -1
  23. package/dist/commands/health.js +13 -0
  24. package/dist/commands/improve/consolidate/continuity-check.js +137 -0
  25. package/dist/commands/improve/consolidate/pair-pass.js +791 -0
  26. package/dist/commands/improve/consolidate.js +38 -63
  27. package/dist/commands/improve/extract-prompt.js +1 -2
  28. package/dist/commands/improve/improve-cli.js +1 -1
  29. package/dist/commands/improve/improve-strategies.js +23 -5
  30. package/dist/commands/improve/improve.js +19 -30
  31. package/dist/commands/improve/ledger.js +3 -2
  32. package/dist/commands/improve/loop-stages.js +5 -85
  33. package/dist/commands/improve/memory/memory-belief.js +3 -1
  34. package/dist/commands/improve/memory/memory-improve.js +269 -11
  35. package/dist/commands/improve/planner.js +0 -5
  36. package/dist/commands/improve/preparation.js +20 -135
  37. package/dist/commands/improve/retrieval-scope.js +19 -4
  38. package/dist/commands/improve/salience.js +1 -14
  39. package/dist/commands/improve/stage.js +0 -1
  40. package/dist/commands/lint/base-linter.js +19 -11
  41. package/dist/commands/proposal/drain.js +8 -1
  42. package/dist/commands/proposal/proposal-cli.js +16 -2
  43. package/dist/commands/proposal/proposal-types.js +7 -0
  44. package/dist/commands/proposal/proposal.js +37 -6
  45. package/dist/commands/proposal/repository.js +613 -4
  46. package/dist/commands/proposal/validators/proposals.js +9 -0
  47. package/dist/commands/read/knowledge.js +3 -2
  48. package/dist/commands/read/show.js +0 -14
  49. package/dist/commands/sources/stash-cli.js +2 -2
  50. package/dist/core/bundle-rename.js +1 -7
  51. package/dist/core/config/config-schema.js +8 -1
  52. package/dist/core/config/config.js +23 -48
  53. package/dist/core/config/engine-semantics.js +0 -2
  54. package/dist/core/config/schema/improve-processes.js +17 -42
  55. package/dist/core/config/schema/index-config.js +5 -25
  56. package/dist/core/file-change.js +13 -5
  57. package/dist/core/improve-result.js +16 -5
  58. package/dist/core/improve-types.js +0 -1
  59. package/dist/core/loopback.js +7 -12
  60. package/dist/core/parse.js +13 -16
  61. package/dist/core/state/migrations.js +15 -0
  62. package/dist/core/time.js +0 -20
  63. package/dist/indexer/db/llm-cache.js +2 -2
  64. package/dist/indexer/ensure-index.js +2 -2
  65. package/dist/indexer/index-written-assets.js +2 -3
  66. package/dist/indexer/indexer.js +18 -418
  67. package/dist/indexer/passes/metadata.js +0 -19
  68. package/dist/indexer/walk/walker.js +3 -4
  69. package/dist/llm/client.js +8 -10
  70. package/dist/llm/embedders/remote.js +1 -2
  71. package/dist/llm/feature-gate.js +0 -5
  72. package/dist/output/shapes/helpers.js +20 -4
  73. package/dist/output/text/command-format.js +0 -8
  74. package/dist/output/text/proposal-format.js +47 -1
  75. package/dist/output/text/show-format.js +0 -20
  76. package/dist/scripts/akm-migrate-node.js +917 -950
  77. package/dist/scripts/akm-migrate.js +917 -950
  78. package/dist/setup/steps/connection.js +5 -6
  79. package/dist/setup/steps/platforms.js +2 -2
  80. package/dist/sources/providers/git-stash.js +55 -4
  81. package/dist/storage/repositories/improve-ledger-repository.js +48 -7
  82. package/dist/storage/repositories/index-entries-repository.js +4 -7
  83. package/dist/storage/repositories/index-entry-schema.js +4 -2
  84. package/dist/storage/repositories/index-llm-cache-repository.js +7 -26
  85. package/dist/storage/repositories/index-schema.js +55 -104
  86. package/dist/storage/repositories/proposals-repository.js +61 -0
  87. package/dist/storage/repositories/salience-repository.js +1 -19
  88. package/docs/reference/cli.md +16 -19
  89. package/docs/reference/configuration.md +21 -12
  90. package/docs/reference/data-and-telemetry.md +0 -1
  91. package/package.json +1 -1
  92. package/schemas/akm-config.json +0 -342
  93. package/dist/assets/improve-strategies/graph-refresh.json +0 -15
  94. package/dist/assets/prompts/contradiction-judge.md +0 -33
  95. package/dist/assets/prompts/graph-extract-system.md +0 -1
  96. package/dist/assets/prompts/graph-extract-user-prompt.md +0 -35
  97. package/dist/assets/prompts/metadata-enhance-system.md +0 -1
  98. package/dist/assets/tasks/improve/akm-graph-refresh-weekly.yml +0 -4
  99. package/dist/indexer/db/graph-db.js +0 -399
  100. package/dist/indexer/graph/graph-extraction.js +0 -809
  101. package/dist/indexer/graph/graph-related.js +0 -131
  102. package/dist/indexer/graph/graph-types.js +0 -4
  103. package/dist/llm/graph-extract.js +0 -892
  104. package/dist/llm/metadata-enhance.js +0 -95
@@ -47,6 +47,7 @@ export const STATE_MIGRATION_SAFETY_BY_ID = Object.freeze({
47
47
  "026-proposals-strip-legacy-fragment-refs": "data-preserving-rebuild",
48
48
  "027-extract-sessions-seen-harness-rename": "data-preserving-rebuild",
49
49
  "028-improve-ledger": "historical-destructive",
50
+ "029-improve-ledger-content-hash": "additive",
50
51
  });
51
52
  export const STATE_MIGRATIONS = [
52
53
  // ── Migration 001 — initial schema ──────────────────────────────────────────
@@ -1284,6 +1285,20 @@ export const STATE_MIGRATIONS = [
1284
1285
  DROP TABLE IF EXISTS canary_queries;
1285
1286
  `,
1286
1287
  },
1288
+ // ── Migration 029 — improve_ledger.content_hash ───────────────────────────
1289
+ //
1290
+ // The consolidate pair pass (alpha.9) selects initiators by content change,
1291
+ // not a time window: no row means eligible, a row whose content_hash
1292
+ // differs from the asset's current body means eligible, otherwise not
1293
+ // (src/commands/improve/consolidate/pair-pass.ts, selectInitiators). Every
1294
+ // other source still uses next_eligible_at; this column is additional, not
1295
+ // a replacement.
1296
+ {
1297
+ id: "029-improve-ledger-content-hash",
1298
+ up: `
1299
+ ALTER TABLE improve_ledger ADD COLUMN content_hash TEXT DEFAULT NULL;
1300
+ `,
1301
+ },
1287
1302
  ];
1288
1303
  assertMigrationRegistry(STATE_MIGRATIONS);
1289
1304
  function assertStateMigrationSafetyRegistry() {
package/dist/core/time.js CHANGED
@@ -95,23 +95,3 @@ export function parseSinceToIso(since) {
95
95
  }
96
96
  return parsed.toISOString();
97
97
  }
98
- /**
99
- * LENIENT variant for config-driven since-values that may be a duration
100
- * shorthand (e.g. `"30m"`, `"24h"`, `"7d"` per {@link DURATION_UNITS}):
101
- * a matching duration resolves to the ISO timestamp of `now - duration`;
102
- * anything else is returned UNCHANGED (assumed to already be an ISO
103
- * timestamp) — this function never throws.
104
- *
105
- * Deliberately distinct from {@link parseSinceToIso}, which rejects
106
- * unparseable input with a UsageError: the identity fallback here is
107
- * behavior consumers rely on (consolidate's incremental narrowing compares
108
- * the returned string lexicographically against file-mtime ISO strings, so
109
- * garbage input silently selects nothing rather than failing the run —
110
- * pinned by tests/commands/goldens-duration-flags.test.ts).
111
- */
112
- export function parseSinceToIsoLenient(since) {
113
- const ms = parseDuration(since, DURATION_UNITS);
114
- if (ms === null)
115
- return since;
116
- return new Date(Date.now() - ms).toISOString();
117
- }
@@ -27,10 +27,10 @@ import { computeBodyHash, getLlmCacheEntry, upsertLlmCacheEntry, } from "../../s
27
27
  * already hashed the body (e.g. to reuse it elsewhere)
28
28
  * should pass this to avoid the redundant work.
29
29
  * @param cacheVariant - Namespace token for the cache row so different passes'
30
- * rows do not collide (e.g. memory-inference vs graph).
30
+ * rows do not collide (e.g. memory-inference vs metadata-enhance).
31
31
  * @param hooks - Optional event sink for telemetry (see {@link WithLlmCacheHooks}).
32
32
  */
33
- export async function withLlmCache(db, cacheKey, body, reEnrich, llmFn, validate, precomputedHash, cacheVariant = "", hooks) {
33
+ export async function withLlmCache(db, cacheKey, body, reEnrich, llmFn, validate, precomputedHash, cacheVariant, hooks) {
34
34
  const bodyHash = precomputedHash ?? computeBodyHash(body);
35
35
  if (!reEnrich) {
36
36
  const cacheHit = bestEffort(() => {
@@ -115,8 +115,8 @@ function hasNewerIndexableFiles(stashDir, builtAt, indexedPaths, indexedHashes)
115
115
  continue;
116
116
  // Newer than the last full build — only stale if its current content
117
117
  // actually differs from what is indexed. No stored hash means the row
118
- // predates content-hash tracking (or a hash-less enrichment pass), so
119
- // fall back to the conservative mtime-stale answer.
118
+ // predates content-hash tracking, so fall back to the conservative
119
+ // mtime-stale answer.
120
120
  const indexedHash = indexedHashes.get(file);
121
121
  if (indexedHash === undefined)
122
122
  return true;
@@ -15,9 +15,8 @@
15
15
  * This is NOT a general reindex. It upserts exactly the files the caller just
16
16
  * wrote: frontmatter/metadata via the shared matcher pipeline, the canonical
17
17
  * row with its transactionally owned FTS projection, and vectors for changed
18
- * entry IDs when semantic search is enabled. Index-time LLM passes, graph
19
- * extraction, `builtAt`, and the per-dir walk cache remain full-index
20
- * responsibilities.
18
+ * entry IDs when semantic search is enabled. `builtAt` and the per-dir walk
19
+ * cache remain full-index responsibilities.
21
20
  */
22
21
  import fs from "node:fs";
23
22
  import path from "node:path";