@edihasaj/recall 1.4.0 → 1.4.14

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 (86) hide show
  1. package/README.md +17 -7
  2. package/dist/{chunk-EAFRT7RX.js → chunk-22KM2YEO.js} +7 -2
  3. package/dist/{chunk-EAFRT7RX.js.map → chunk-22KM2YEO.js.map} +1 -1
  4. package/dist/{chunk-PUMEMKGF.js → chunk-47CB7PKL.js} +7 -1
  5. package/dist/{chunk-PUMEMKGF.js.map → chunk-47CB7PKL.js.map} +1 -1
  6. package/dist/{chunk-FHEH6QDU.js → chunk-7Z3CCCS2.js} +6 -1
  7. package/dist/{chunk-FHEH6QDU.js.map → chunk-7Z3CCCS2.js.map} +1 -1
  8. package/dist/chunk-AQOI4FCW.js +23 -0
  9. package/dist/chunk-AQOI4FCW.js.map +1 -0
  10. package/dist/{chunk-JKWK73GY.js → chunk-BWKFROGW.js} +101 -11
  11. package/dist/chunk-BWKFROGW.js.map +1 -0
  12. package/dist/{chunk-JYWURG5T.js → chunk-CYAODQOH.js} +12 -2
  13. package/dist/chunk-CYAODQOH.js.map +1 -0
  14. package/dist/{chunk-UWERS646.js → chunk-DJNJQA7L.js} +8 -4
  15. package/dist/{chunk-UWERS646.js.map → chunk-DJNJQA7L.js.map} +1 -1
  16. package/dist/{chunk-6QFOCUEJ.js → chunk-GGUWKT6I.js} +111 -21
  17. package/dist/chunk-GGUWKT6I.js.map +1 -0
  18. package/dist/{chunk-JO5LRCA2.js → chunk-HFHNPOBW.js} +207 -24
  19. package/dist/chunk-HFHNPOBW.js.map +1 -0
  20. package/dist/{chunk-JSTZKFZR.js → chunk-HRUNR5JJ.js} +14 -9
  21. package/dist/{chunk-JSTZKFZR.js.map → chunk-HRUNR5JJ.js.map} +1 -1
  22. package/dist/{chunk-65XK27KK.js → chunk-HUMJTWWT.js} +81 -161
  23. package/dist/chunk-HUMJTWWT.js.map +1 -0
  24. package/dist/{chunk-53GKSF42.js → chunk-JFUMA4WV.js} +308 -169
  25. package/dist/chunk-JFUMA4WV.js.map +1 -0
  26. package/dist/{chunk-MMYLXICL.js → chunk-KOBZIF2X.js} +8 -4
  27. package/dist/{chunk-MMYLXICL.js.map → chunk-KOBZIF2X.js.map} +1 -1
  28. package/dist/{chunk-7Q5CBVUT.js → chunk-M3ASNCVM.js} +234 -49
  29. package/dist/chunk-M3ASNCVM.js.map +1 -0
  30. package/dist/chunk-Q2KCBLJO.js +594 -0
  31. package/dist/chunk-Q2KCBLJO.js.map +1 -0
  32. package/dist/{chunk-CW3XJDH7.js → chunk-RWEX4VJE.js} +6 -2
  33. package/dist/{chunk-CW3XJDH7.js.map → chunk-RWEX4VJE.js.map} +1 -1
  34. package/dist/{chunk-LUIYWYOT.js → chunk-VSEAVK7X.js} +51 -3
  35. package/dist/chunk-VSEAVK7X.js.map +1 -0
  36. package/dist/{chunk-WZWXYBP6.js → chunk-XCFTE74H.js} +6 -3
  37. package/dist/{chunk-WZWXYBP6.js.map → chunk-XCFTE74H.js.map} +1 -1
  38. package/dist/{cleanup-RHNBHBNP.js → cleanup-YCYA6BJB.js} +11 -10
  39. package/dist/cli.js +648 -793
  40. package/dist/cli.js.map +1 -1
  41. package/dist/codex-trust-Z7LNNRVT.js +74 -0
  42. package/dist/codex-trust-Z7LNNRVT.js.map +1 -0
  43. package/dist/daemon.js +181 -61
  44. package/dist/daemon.js.map +1 -1
  45. package/dist/dispatcher-FP3WS74F.js +22 -0
  46. package/dist/{embeddings-HDNAGCOS.js → embeddings-VZPCFCEY.js} +7 -5
  47. package/dist/ingest-QEKMNVL7.js +20 -0
  48. package/dist/{keychain-5KXUHKMF.js → keychain-2PXI2EGF.js} +3 -3
  49. package/dist/mcp.js +18 -14
  50. package/dist/mcp.js.map +1 -1
  51. package/dist/{memory-value-6JUQEYJZ.js → memory-value-XSPRH6KY.js} +11 -10
  52. package/dist/provenance-GJR7S7VA.js +50 -0
  53. package/dist/provenance-GJR7S7VA.js.map +1 -0
  54. package/dist/quality-TWOC3UMF.js +25 -0
  55. package/dist/retrieval-RW6YBQ6P.js +15 -0
  56. package/dist/{store-5C7ZKKZF.js → store-HIM5US7B.js} +4 -4
  57. package/dist/sync-server.js +5 -2
  58. package/dist/sync-server.js.map +1 -1
  59. package/dist/{tasks-AJ62N26N.js → tasks-TAXJSUKB.js} +11 -10
  60. package/dist/{usage-VQ5LJCNH.js → usage-XMYRFJBJ.js} +7 -4
  61. package/dist/{usage-VQ5LJCNH.js.map → usage-XMYRFJBJ.js.map} +1 -1
  62. package/drizzle/0011_compact_telemetry_dedupe_keys.sql +25 -0
  63. package/drizzle/meta/_journal.json +7 -0
  64. package/package.json +15 -12
  65. package/dist/chunk-53GKSF42.js.map +0 -1
  66. package/dist/chunk-65XK27KK.js.map +0 -1
  67. package/dist/chunk-6QFOCUEJ.js.map +0 -1
  68. package/dist/chunk-7Q5CBVUT.js.map +0 -1
  69. package/dist/chunk-JKWK73GY.js.map +0 -1
  70. package/dist/chunk-JO5LRCA2.js.map +0 -1
  71. package/dist/chunk-LUIYWYOT.js.map +0 -1
  72. package/dist/dispatcher-ON7LNX6X.js +0 -21
  73. package/dist/ingest-MHPMJPUA.js +0 -18
  74. package/dist/quality-HVTIOIXP.js +0 -24
  75. package/dist/retrieval-72EIHKRF.js +0 -13
  76. package/dist/tasks-AJ62N26N.js.map +0 -1
  77. /package/dist/{chunk-JYWURG5T.js.map → cleanup-YCYA6BJB.js.map} +0 -0
  78. /package/dist/{cleanup-RHNBHBNP.js.map → dispatcher-FP3WS74F.js.map} +0 -0
  79. /package/dist/{dispatcher-ON7LNX6X.js.map → embeddings-VZPCFCEY.js.map} +0 -0
  80. /package/dist/{embeddings-HDNAGCOS.js.map → ingest-QEKMNVL7.js.map} +0 -0
  81. /package/dist/{ingest-MHPMJPUA.js.map → keychain-2PXI2EGF.js.map} +0 -0
  82. /package/dist/{keychain-5KXUHKMF.js.map → memory-value-XSPRH6KY.js.map} +0 -0
  83. /package/dist/{memory-value-6JUQEYJZ.js.map → quality-TWOC3UMF.js.map} +0 -0
  84. /package/dist/{quality-HVTIOIXP.js.map → retrieval-RW6YBQ6P.js.map} +0 -0
  85. /package/dist/{retrieval-72EIHKRF.js.map → store-HIM5US7B.js.map} +0 -0
  86. /package/dist/{store-5C7ZKKZF.js.map → tasks-TAXJSUKB.js.map} +0 -0
@@ -2,39 +2,45 @@ import {
2
2
  computeHealthScore,
3
3
  evaluateScannedMemory,
4
4
  getRepoQualityProfile,
5
+ isEphemeralTaskConstraint,
6
+ isHighRiskRule,
7
+ isNonUserCaptureContext,
5
8
  processCorrection,
6
- recordAudit,
7
9
  redactSensitiveValue,
8
10
  seedScannedConfidence
9
- } from "./chunk-65XK27KK.js";
11
+ } from "./chunk-HUMJTWWT.js";
10
12
  import {
11
13
  recordInjectionValueEvents,
12
14
  recordMemoryInjections,
13
15
  recordOutcomeValueEvent,
14
16
  resolveMemoryInjectionOutcome
15
- } from "./chunk-JSTZKFZR.js";
17
+ } from "./chunk-HRUNR5JJ.js";
16
18
  import {
17
19
  textMatchScore
18
- } from "./chunk-FHEH6QDU.js";
19
- import {
20
- asc,
21
- desc
22
- } from "./chunk-CW3XJDH7.js";
20
+ } from "./chunk-7Z3CCCS2.js";
23
21
  import {
24
22
  activityEventDedupeKey,
25
23
  confirmMemory,
24
+ containsGeneratedHistory,
26
25
  createMemory,
27
26
  demoteMemory,
28
27
  feedbackWeightedScore,
29
28
  getMemory,
30
29
  getMemoryFeedbackSummaries,
30
+ hasDirectCorrectionEvidence,
31
+ hasNonDurableProvenance,
31
32
  historySnippetDedupeKey,
32
33
  promoteMemory,
33
34
  queryMemories,
35
+ recordAudit,
34
36
  recordFeedback,
35
37
  rejectMemory,
36
38
  statusFromConfidence
37
- } from "./chunk-JO5LRCA2.js";
39
+ } from "./chunk-HFHNPOBW.js";
40
+ import {
41
+ asc,
42
+ desc
43
+ } from "./chunk-RWEX4VJE.js";
38
44
  import {
39
45
  BACKGROUND_INDEX_BATCH_SIZE,
40
46
  CONFIDENCE,
@@ -47,6 +53,7 @@ import {
47
53
  getEmbeddingCacheRoot,
48
54
  getSynonyms,
49
55
  hybridSearch,
56
+ load,
50
57
  loadEmbeddingConfigFromEnv,
51
58
  processInResponsiveBatches,
52
59
  projectEmbeddingToIndex,
@@ -54,7 +61,7 @@ import {
54
61
  readUtf8FileIfExists,
55
62
  resolveProvider,
56
63
  tagActivitySource
57
- } from "./chunk-JKWK73GY.js";
64
+ } from "./chunk-BWKFROGW.js";
58
65
  import {
59
66
  Column,
60
67
  Columns,
@@ -118,15 +125,22 @@ import {
118
125
  policyRules,
119
126
  schema_exports,
120
127
  sql
121
- } from "./chunk-LUIYWYOT.js";
128
+ } from "./chunk-VSEAVK7X.js";
129
+ import {
130
+ init_define_RECALL_BUILD_INFO
131
+ } from "./chunk-CYAODQOH.js";
122
132
 
123
133
  // src/db/client.ts
134
+ init_define_RECALL_BUILD_INFO();
124
135
  import Database from "better-sqlite3";
136
+ import { createHash } from "crypto";
125
137
 
126
138
  // node_modules/drizzle-orm/better-sqlite3/driver.js
139
+ init_define_RECALL_BUILD_INFO();
127
140
  import Client from "better-sqlite3";
128
141
 
129
142
  // node_modules/drizzle-orm/logger.js
143
+ init_define_RECALL_BUILD_INFO();
130
144
  var ConsoleLogWriter = class {
131
145
  static [entityKind] = "ConsoleLogWriter";
132
146
  write(message) {
@@ -157,7 +171,14 @@ var NoopLogger = class {
157
171
  }
158
172
  };
159
173
 
174
+ // node_modules/drizzle-orm/relations.js
175
+ init_define_RECALL_BUILD_INFO();
176
+
177
+ // node_modules/drizzle-orm/pg-core/primary-keys.js
178
+ init_define_RECALL_BUILD_INFO();
179
+
160
180
  // node_modules/drizzle-orm/pg-core/table.js
181
+ init_define_RECALL_BUILD_INFO();
161
182
  var InlineForeignKeys = /* @__PURE__ */ Symbol.for("drizzle:PgInlineForeignKeys");
162
183
  var EnableRLS = /* @__PURE__ */ Symbol.for("drizzle:EnableRLS");
163
184
  var PgTable = class extends Table {
@@ -468,7 +489,14 @@ function mapRelationalRow(tablesConfig, tableConfig, row, buildQueryResultSelect
468
489
  return result;
469
490
  }
470
491
 
492
+ // node_modules/drizzle-orm/sqlite-core/db.js
493
+ init_define_RECALL_BUILD_INFO();
494
+
495
+ // node_modules/drizzle-orm/selection-proxy.js
496
+ init_define_RECALL_BUILD_INFO();
497
+
471
498
  // node_modules/drizzle-orm/alias.js
499
+ init_define_RECALL_BUILD_INFO();
472
500
  var ColumnAliasProxyHandler = class {
473
501
  constructor(table) {
474
502
  this.table = table;
@@ -632,7 +660,11 @@ var SelectionProxyHandler = class _SelectionProxyHandler {
632
660
  }
633
661
  };
634
662
 
663
+ // node_modules/drizzle-orm/sqlite-core/query-builders/delete.js
664
+ init_define_RECALL_BUILD_INFO();
665
+
635
666
  // node_modules/drizzle-orm/query-promise.js
667
+ init_define_RECALL_BUILD_INFO();
636
668
  var QueryPromise = class {
637
669
  static [entityKind] = "QueryPromise";
638
670
  [Symbol.toStringTag] = "QueryPromise";
@@ -657,6 +689,7 @@ var QueryPromise = class {
657
689
  };
658
690
 
659
691
  // node_modules/drizzle-orm/sqlite-core/utils.js
692
+ init_define_RECALL_BUILD_INFO();
660
693
  function extractUsedTable(table) {
661
694
  if (is(table, SQLiteTable)) {
662
695
  return [`${table[Table.Symbol.BaseName]}`];
@@ -784,7 +817,17 @@ var SQLiteDeleteBase = class extends QueryPromise {
784
817
  }
785
818
  };
786
819
 
820
+ // node_modules/drizzle-orm/sqlite-core/query-builders/insert.js
821
+ init_define_RECALL_BUILD_INFO();
822
+
823
+ // node_modules/drizzle-orm/sqlite-core/query-builders/query-builder.js
824
+ init_define_RECALL_BUILD_INFO();
825
+
826
+ // node_modules/drizzle-orm/sqlite-core/dialect.js
827
+ init_define_RECALL_BUILD_INFO();
828
+
787
829
  // node_modules/drizzle-orm/casing.js
830
+ init_define_RECALL_BUILD_INFO();
788
831
  function toSnakeCase(input) {
789
832
  const words = input.replace(/['\u2019]/g, "").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g) ?? [];
790
833
  return words.map((word) => word.toLowerCase()).join("_");
@@ -837,6 +880,7 @@ var CasingCache = class {
837
880
  };
838
881
 
839
882
  // node_modules/drizzle-orm/errors.js
883
+ init_define_RECALL_BUILD_INFO();
840
884
  var DrizzleError = class extends Error {
841
885
  static [entityKind] = "DrizzleError";
842
886
  constructor({ message, cause }) {
@@ -864,6 +908,7 @@ var TransactionRollbackError = class extends DrizzleError {
864
908
  };
865
909
 
866
910
  // node_modules/drizzle-orm/sqlite-core/view-base.js
911
+ init_define_RECALL_BUILD_INFO();
867
912
  var SQLiteViewBase = class extends View {
868
913
  static [entityKind] = "SQLiteViewBase";
869
914
  };
@@ -1558,7 +1603,11 @@ var SQLiteAsyncDialect = class extends SQLiteDialect {
1558
1603
  }
1559
1604
  };
1560
1605
 
1606
+ // node_modules/drizzle-orm/sqlite-core/query-builders/select.js
1607
+ init_define_RECALL_BUILD_INFO();
1608
+
1561
1609
  // node_modules/drizzle-orm/query-builders/query-builder.js
1610
+ init_define_RECALL_BUILD_INFO();
1562
1611
  var TypedQueryBuilder = class {
1563
1612
  static [entityKind] = "TypedQueryBuilder";
1564
1613
  /** @internal */
@@ -2474,6 +2523,7 @@ var SQLiteInsertBase = class extends QueryPromise {
2474
2523
  };
2475
2524
 
2476
2525
  // node_modules/drizzle-orm/sqlite-core/query-builders/update.js
2526
+ init_define_RECALL_BUILD_INFO();
2477
2527
  var SQLiteUpdateBuilder = class {
2478
2528
  constructor(table, session, dialect, withList) {
2479
2529
  this.table = table;
@@ -2640,6 +2690,7 @@ var SQLiteUpdateBase = class extends QueryPromise {
2640
2690
  };
2641
2691
 
2642
2692
  // node_modules/drizzle-orm/sqlite-core/query-builders/count.js
2693
+ init_define_RECALL_BUILD_INFO();
2643
2694
  var SQLiteCountBuilder = class _SQLiteCountBuilder extends SQL {
2644
2695
  constructor(params) {
2645
2696
  super(_SQLiteCountBuilder.buildEmbeddedCount(params.source, params.filters).queryChunks);
@@ -2684,6 +2735,7 @@ var SQLiteCountBuilder = class _SQLiteCountBuilder extends SQL {
2684
2735
  };
2685
2736
 
2686
2737
  // node_modules/drizzle-orm/sqlite-core/query-builders/query.js
2738
+ init_define_RECALL_BUILD_INFO();
2687
2739
  var RelationalQueryBuilder = class {
2688
2740
  constructor(mode, fullSchema, schema, tableNamesMap, table, tableConfig, dialect, session) {
2689
2741
  this.mode = mode;
@@ -2828,6 +2880,7 @@ var SQLiteSyncRelationalQuery = class extends SQLiteRelationalQuery {
2828
2880
  };
2829
2881
 
2830
2882
  // node_modules/drizzle-orm/sqlite-core/query-builders/raw.js
2883
+ init_define_RECALL_BUILD_INFO();
2831
2884
  var SQLiteRaw = class extends QueryPromise {
2832
2885
  constructor(execute, getSQL, action, dialect, mapBatchResult) {
2833
2886
  super();
@@ -3146,7 +3199,11 @@ var BaseSQLiteDatabase = class {
3146
3199
  }
3147
3200
  };
3148
3201
 
3202
+ // node_modules/drizzle-orm/better-sqlite3/session.js
3203
+ init_define_RECALL_BUILD_INFO();
3204
+
3149
3205
  // node_modules/drizzle-orm/cache/core/cache.js
3206
+ init_define_RECALL_BUILD_INFO();
3150
3207
  var Cache = class {
3151
3208
  static [entityKind] = "Cache";
3152
3209
  };
@@ -3174,6 +3231,7 @@ async function hashQuery(sql2, params) {
3174
3231
  }
3175
3232
 
3176
3233
  // node_modules/drizzle-orm/sqlite-core/session.js
3234
+ init_define_RECALL_BUILD_INFO();
3177
3235
  var ExecuteResultSync = class extends QueryPromise {
3178
3236
  constructor(resultCb) {
3179
3237
  super();
@@ -3527,7 +3585,11 @@ function drizzle(...params) {
3527
3585
  drizzle2.mock = mock;
3528
3586
  })(drizzle || (drizzle = {}));
3529
3587
 
3588
+ // node_modules/drizzle-orm/better-sqlite3/migrator.js
3589
+ init_define_RECALL_BUILD_INFO();
3590
+
3530
3591
  // node_modules/drizzle-orm/migrator.js
3592
+ init_define_RECALL_BUILD_INFO();
3531
3593
  import crypto2 from "crypto";
3532
3594
  import fs from "fs";
3533
3595
  function readMigrationFiles(config) {
@@ -3570,7 +3632,7 @@ import { join, dirname } from "path";
3570
3632
  import { mkdirSync, existsSync, rmSync, statSync } from "fs";
3571
3633
  import { fileURLToPath } from "url";
3572
3634
  var __dirname = dirname(fileURLToPath(import.meta.url));
3573
- var RECALL_DB_USER_VERSION = 11;
3635
+ var RECALL_DB_USER_VERSION = 12;
3574
3636
  function getDbPath() {
3575
3637
  const dataDir = process.env.RECALL_DATA_DIR ?? join(
3576
3638
  process.env.HOME ?? process.env.USERPROFILE ?? ".",
@@ -3602,8 +3664,14 @@ var STARTUP_WAL_TRUNCATE_BYTES = (() => {
3602
3664
  return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
3603
3665
  })();
3604
3666
  function applyPragmas(sqlite) {
3667
+ sqlite.pragma("busy_timeout = 15000");
3605
3668
  sqlite.pragma("journal_mode = WAL");
3606
3669
  sqlite.pragma("foreign_keys = ON");
3670
+ sqlite.function(
3671
+ "recall_sha256",
3672
+ { deterministic: true },
3673
+ (value) => createHash("sha256").update(value).digest("hex")
3674
+ );
3607
3675
  truncateWalIfLarge(sqlite);
3608
3676
  }
3609
3677
  function truncateWalIfLarge(sqlite) {
@@ -3629,6 +3697,12 @@ function getDb(dbPath) {
3629
3697
  }
3630
3698
  return _db;
3631
3699
  }
3700
+ function createStandaloneDb(dbPath) {
3701
+ const sqlite = new Database(dbPath);
3702
+ applyPragmas(sqlite);
3703
+ const db = makeDb(sqlite);
3704
+ return { db, sqlite };
3705
+ }
3632
3706
  function migrateIfNeeded(db) {
3633
3707
  const current = Number(db.$client.pragma("user_version", { simple: true }) ?? 0);
3634
3708
  if (current >= RECALL_DB_USER_VERSION) return;
@@ -3640,6 +3714,11 @@ function initDb(dbPath) {
3640
3714
  migrateIfNeeded(db);
3641
3715
  return db;
3642
3716
  }
3717
+ function initStandaloneDb(dbPath) {
3718
+ const { db } = createStandaloneDb(dbPath);
3719
+ migrateIfNeeded(db);
3720
+ return db;
3721
+ }
3643
3722
  function closeDb() {
3644
3723
  if (_sqlite) {
3645
3724
  _sqlite.close();
@@ -3675,6 +3754,7 @@ function resetDb(dbPath, options = {}) {
3675
3754
  }
3676
3755
 
3677
3756
  // src/models/activity.ts
3757
+ init_define_RECALL_BUILD_INFO();
3678
3758
  import { randomUUID } from "crypto";
3679
3759
  function createActivityEvent(db, input) {
3680
3760
  const safeInput = {
@@ -3793,6 +3873,7 @@ function rowToActivityEvent(row) {
3793
3873
  }
3794
3874
 
3795
3875
  // src/scanner/repo.ts
3876
+ init_define_RECALL_BUILD_INFO();
3796
3877
  import { existsSync as existsSync2 } from "fs";
3797
3878
  import { join as join2, basename } from "path";
3798
3879
  import { execFileSync } from "child_process";
@@ -4115,10 +4196,23 @@ function makeGotcha(text, repo, file) {
4115
4196
  }
4116
4197
 
4117
4198
  // src/repo/discovery.ts
4199
+ init_define_RECALL_BUILD_INFO();
4118
4200
  import { existsSync as existsSync3, readdirSync } from "fs";
4119
4201
  import { execFileSync as execFileSync2 } from "child_process";
4120
4202
  import { join as join3, resolve } from "path";
4121
4203
  var repoPathCache = /* @__PURE__ */ new Map();
4204
+ function runGit(args) {
4205
+ const binaries = ["git", ...process.platform === "darwin" && existsSync3("/opt/homebrew/bin/git") ? ["/opt/homebrew/bin/git"] : []];
4206
+ let failure;
4207
+ for (const binary of binaries) {
4208
+ try {
4209
+ return execFileSync2(binary, args, { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3 }).trim();
4210
+ } catch (error) {
4211
+ failure = error;
4212
+ }
4213
+ }
4214
+ throw failure;
4215
+ }
4122
4216
  var SKIP_DIRS = /* @__PURE__ */ new Set([
4123
4217
  ".git",
4124
4218
  "node_modules",
@@ -4209,11 +4303,7 @@ function inferRepoSlugFromPath(repoPath) {
4209
4303
  const root = normalizeRepoPathHint(repoPath);
4210
4304
  if (!root) return null;
4211
4305
  try {
4212
- const remote = execFileSync2(
4213
- "git",
4214
- ["-C", root, "remote", "get-url", "origin"],
4215
- { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
4216
- ).trim();
4306
+ const remote = runGit(["-C", root, "remote", "get-url", "origin"]);
4217
4307
  return extractRepoSlugFromRemote2(remote);
4218
4308
  } catch {
4219
4309
  const parts = root.split("/").filter(Boolean);
@@ -4253,11 +4343,7 @@ function normalizeRepoPathHint(repoPath) {
4253
4343
  if (!repoPath) return null;
4254
4344
  const expanded = repoPath.trim().replace(/^~(?=\/)/, process.env.HOME ?? "~");
4255
4345
  try {
4256
- const root = execFileSync2(
4257
- "git",
4258
- ["-C", expanded, "rev-parse", "--show-toplevel"],
4259
- { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
4260
- ).trim();
4346
+ const root = runGit(["-C", expanded, "rev-parse", "--show-toplevel"]);
4261
4347
  return root || null;
4262
4348
  } catch {
4263
4349
  const resolved = resolve(expanded);
@@ -4299,6 +4385,7 @@ function walkRepos(dir, depthRemaining, seen, repos) {
4299
4385
  }
4300
4386
 
4301
4387
  // src/history/snippets.ts
4388
+ init_define_RECALL_BUILD_INFO();
4302
4389
  import { randomUUID as randomUUID2 } from "crypto";
4303
4390
  function createHistorySnippet(db, input) {
4304
4391
  const dedupeKey = historySnippetDedupeKey(input);
@@ -4386,10 +4473,11 @@ function rowToHistorySnippet(row) {
4386
4473
  }
4387
4474
 
4388
4475
  // src/history/retrieval.ts
4389
- import { createHash } from "crypto";
4476
+ init_define_RECALL_BUILD_INFO();
4477
+ import { createHash as createHash2 } from "crypto";
4390
4478
 
4391
4479
  // src/vector/sqlite-vec-history.ts
4392
- import * as sqliteVec from "sqlite-vec";
4480
+ init_define_RECALL_BUILD_INFO();
4393
4481
  var VEC_HISTORY_INDEX = "vec_history_index";
4394
4482
  var loadedClients = /* @__PURE__ */ new WeakSet();
4395
4483
  function getSqlite(db) {
@@ -4403,7 +4491,7 @@ function hasHistoryVecIndex(db) {
4403
4491
  function ensureLoaded(db) {
4404
4492
  const sqlite = getSqlite(db);
4405
4493
  if (loadedClients.has(sqlite)) return;
4406
- sqliteVec.load(sqlite);
4494
+ load(sqlite);
4407
4495
  loadedClients.add(sqlite);
4408
4496
  }
4409
4497
  function getHistoryVecDimension(rows) {
@@ -4436,8 +4524,8 @@ function ensureHistoryVecIndex(db, dimensions) {
4436
4524
  `);
4437
4525
  }
4438
4526
  function removeHistoryVecRow(db, snippetId) {
4439
- ensureLoaded(db);
4440
4527
  if (!hasHistoryVecIndex(db)) return;
4528
+ ensureLoaded(db);
4441
4529
  getSqlite(db).prepare(`delete from ${VEC_HISTORY_INDEX} where snippet_id = ?`).run(snippetId);
4442
4530
  }
4443
4531
  async function rebuildHistoryVecIndexResponsive(db, config, options = {}) {
@@ -4540,6 +4628,7 @@ function searchHistoryVecIndex(db, queryEmbedding, options = {}) {
4540
4628
  }
4541
4629
 
4542
4630
  // src/vector/sqlite-fts-history.ts
4631
+ init_define_RECALL_BUILD_INFO();
4543
4632
  var FTS_HISTORY_INDEX = "fts_history_index";
4544
4633
  var FTS_TOKENIZER = `porter unicode61 remove_diacritics 2`;
4545
4634
  function getSqlite2(db) {
@@ -4708,7 +4797,7 @@ function searchHistoryFtsIndex(db, query, options = {}) {
4708
4797
 
4709
4798
  // src/history/retrieval.ts
4710
4799
  function hashText(text) {
4711
- return createHash("sha256").update(text).digest("hex");
4800
+ return createHash2("sha256").update(text).digest("hex");
4712
4801
  }
4713
4802
  function version(config) {
4714
4803
  return config.version || `${config.provider}:${config.model}:${config.dimensions}`;
@@ -4779,8 +4868,19 @@ async function bootstrapHistoryEmbeddings(db, config, options = {}) {
4779
4868
  return total;
4780
4869
  }
4781
4870
  function verifyHistoryEmbeddings(db, config, options = {}) {
4782
- const rows = db.select().from(historySnippets).all().filter((row) => !options.repo || row.repo === options.repo);
4783
- const embeddings = db.select().from(historySnippetEmbeddings).all();
4871
+ const rows = db.select({
4872
+ id: historySnippets.id,
4873
+ repo: historySnippets.repo,
4874
+ text: historySnippets.text
4875
+ }).from(historySnippets).all().filter((row) => !options.repo || row.repo === options.repo);
4876
+ const embeddings = db.select({
4877
+ snippet_id: historySnippetEmbeddings.snippet_id,
4878
+ model: historySnippetEmbeddings.model,
4879
+ embedding_dimensions: historySnippetEmbeddings.embedding_dimensions,
4880
+ index_dimensions: historySnippetEmbeddings.index_dimensions,
4881
+ version: historySnippetEmbeddings.version,
4882
+ content_hash: historySnippetEmbeddings.content_hash
4883
+ }).from(historySnippetEmbeddings).all();
4784
4884
  const byId = new Map(embeddings.map((row) => [row.snippet_id, row]));
4785
4885
  let eligible = 0;
4786
4886
  let stale = 0;
@@ -4858,7 +4958,11 @@ async function searchHistorySnippets(db, query, options = {}) {
4858
4958
  return [...merged.values()].sort((a, b) => b.score - a.score).slice(0, limit);
4859
4959
  }
4860
4960
 
4961
+ // src/compiler/context.ts
4962
+ init_define_RECALL_BUILD_INFO();
4963
+
4861
4964
  // src/models/history-injections.ts
4965
+ init_define_RECALL_BUILD_INFO();
4862
4966
  import { randomUUID as randomUUID3 } from "crypto";
4863
4967
  function recordHistoryInjections(db, input) {
4864
4968
  if (!input.session_id || input.snippet_ids.length === 0) return 0;
@@ -4883,6 +4987,18 @@ function listInjectedHistoryIdsForSession(db, sessionId) {
4883
4987
  return new Set(rows.map((row) => row.snippet_id));
4884
4988
  }
4885
4989
 
4990
+ // src/repo/aliases.ts
4991
+ init_define_RECALL_BUILD_INFO();
4992
+ function memoryRepoAliases(db, repo) {
4993
+ if (!repo) return [repo];
4994
+ const known = db.selectDistinct({ repo: memories.repo }).from(memories).all().map((row) => row.repo).filter((name) => Boolean(name));
4995
+ const basename2 = repo.split("/").at(-1);
4996
+ const qualified = known.filter((name) => name.includes("/") && name.split("/").at(-1) === basename2);
4997
+ if (repo.includes("/") && !qualified.includes(repo)) qualified.push(repo);
4998
+ if (qualified.length !== 1) return [repo];
4999
+ return [.../* @__PURE__ */ new Set([repo, basename2, qualified[0]])];
5000
+ }
5001
+
4886
5002
  // src/compiler/context.ts
4887
5003
  var DEFAULT_CONFIG = {
4888
5004
  confidence_threshold: CONFIDENCE.ACTIVE_MIN,
@@ -4970,6 +5086,12 @@ function normalizeQueryForRetrieval(text) {
4970
5086
  }
4971
5087
  return out;
4972
5088
  }
5089
+ var NEAR_MISS_BAND = 0.1;
5090
+ function collectNearMisses(candidates, threshold) {
5091
+ return candidates.filter(
5092
+ (m) => m.confidence + CONFIDENCE_EPSILON < threshold && m.confidence >= threshold - NEAR_MISS_BAND
5093
+ ).sort((a, b) => b.confidence - a.confidence).map((m) => ({ id: m.id, confidence: m.confidence, text: m.text }));
5094
+ }
4973
5095
  function compileContext(db, req) {
4974
5096
  const profile = getRepoQualityProfile(db, req.repo);
4975
5097
  const config = {
@@ -4978,17 +5100,17 @@ function compileContext(db, req) {
4978
5100
  confidence_threshold: req.config?.confidence_threshold ?? profile.compile_confidence_threshold
4979
5101
  };
4980
5102
  const selectedHistory = selectRepoHistory(db, req.repo, config.max_history_snippets);
4981
- const repoActive = queryMemories(db, {
4982
- repo: req.repo,
5103
+ const repoActive = memoryRepoAliases(db, req.repo).flatMap((repo) => queryMemories(db, {
5104
+ repo,
4983
5105
  status: "active",
4984
5106
  auto_inject: true
4985
- });
5107
+ }));
4986
5108
  const globalActive = queryMemories(db, {
4987
5109
  scope: "global",
4988
5110
  status: "active",
4989
5111
  auto_inject: true
4990
5112
  });
4991
- const allActive = dedupeById([...repoActive, ...globalActive]);
5113
+ const allActive = dedupeById([...repoActive, ...globalActive]).filter((m) => !hasNonDurableProvenance(m));
4992
5114
  const sessionScoped = filterSessionScoped(allActive, req.session_id);
4993
5115
  const scoped = req.path ? sessionScoped.filter((m) => pathMatches(m, req.path)) : sessionScoped;
4994
5116
  const passing = scoped.filter(
@@ -4997,8 +5119,11 @@ function compileContext(db, req) {
4997
5119
  const dropped = scoped.filter(
4998
5120
  (m) => m.confidence + CONFIDENCE_EPSILON < config.confidence_threshold
4999
5121
  );
5122
+ const nearMisses = collectNearMisses(scoped, config.confidence_threshold);
5000
5123
  if (passing.length === 0 && selectedHistory.length === 0) {
5001
5124
  return {
5125
+ confidence_threshold: config.confidence_threshold,
5126
+ near_misses: nearMisses,
5002
5127
  text: "",
5003
5128
  memories_included: [],
5004
5129
  memories_dropped: dropped.map((m) => m.id),
@@ -5063,6 +5188,8 @@ function compileContext(db, req) {
5063
5188
  repo: req.repo
5064
5189
  });
5065
5190
  return {
5191
+ confidence_threshold: config.confidence_threshold,
5192
+ near_misses: nearMisses,
5066
5193
  text: finalText,
5067
5194
  memories_included: selected.map((m) => m.id),
5068
5195
  memories_dropped: [
@@ -5084,30 +5211,43 @@ async function compileContextHybrid(db, req) {
5084
5211
  const normalizedQuery = req.query_text ? normalizeQueryForRetrieval(req.query_text) : "";
5085
5212
  const effectiveQuery = normalizedQuery.length > 0 ? normalizedQuery : void 0;
5086
5213
  const selectedHistory = effectiveQuery ? await selectRelevantHistory(db, req.repo, effectiveQuery, config.max_history_snippets) : selectRepoHistory(db, req.repo, config.max_history_snippets);
5087
- const repoMemories = queryMemories(db, { repo: req.repo });
5214
+ const repoMemories = memoryRepoAliases(db, req.repo).flatMap((repo) => queryMemories(db, { repo }));
5088
5215
  const globalMemories = queryMemories(db, { scope: "global" });
5216
+ const eligibleCandidate = (memory) => {
5217
+ if (req.config?.include_candidates === false) return false;
5218
+ if (isHighRiskRule(memory.text)) return false;
5219
+ if (req.config?.include_candidates === true) return true;
5220
+ return Boolean(effectiveQuery) && hasDirectCorrectionEvidence(memory) && memory.evidence.some((entry) => entry.type === "session_correction" && Boolean(entry.context) && !isNonUserCaptureContext(entry.context ?? "") && !isEphemeralTaskConstraint(memory.text, entry.context ?? ""));
5221
+ };
5089
5222
  const allMemories = dedupeById([...repoMemories, ...globalMemories]).filter((memory) => {
5090
- const statusEligible = memory.status === "active" || config.include_candidates && memory.status === "candidate";
5223
+ if (hasNonDurableProvenance(memory)) return false;
5224
+ const statusEligible = memory.status === "active" || memory.status === "candidate" && eligibleCandidate(memory);
5091
5225
  if (!statusEligible) return false;
5092
5226
  if (memory.auto_inject) return true;
5093
- return Boolean(effectiveQuery) && memory.status === "active";
5227
+ return Boolean(effectiveQuery) && (memory.status === "active" || eligibleCandidate(memory));
5094
5228
  });
5095
5229
  const sessionScoped = filterSessionScoped(allMemories, req.session_id);
5096
5230
  const scoped = req.path ? sessionScoped.filter((memory) => pathMatches(memory, req.path)) : sessionScoped;
5097
- const candidateConfidenceFloor = Math.min(config.confidence_threshold, 0.45);
5231
+ const candidateConfidenceFloor = Math.min(config.confidence_threshold, 0.35);
5098
5232
  const passing = scoped.filter((memory) => {
5099
5233
  if (memory.status === "active") {
5100
5234
  return memory.confidence + CONFIDENCE_EPSILON >= config.confidence_threshold;
5101
5235
  }
5102
- if (memory.status === "candidate" && config.include_candidates) {
5236
+ if (memory.status === "candidate" && eligibleCandidate(memory)) {
5103
5237
  return memory.confidence >= candidateConfidenceFloor;
5104
5238
  }
5105
5239
  return false;
5106
5240
  });
5107
5241
  const passingIds = new Set(passing.map((memory) => memory.id));
5108
5242
  const dropped = scoped.filter((memory) => !passingIds.has(memory.id));
5243
+ const hybridNearMisses = collectNearMisses(
5244
+ dropped.filter((memory) => !effectiveQuery || textMatchScore(effectiveQuery, memory.text).score >= QUERY_TEXT_MATCH_FLOOR),
5245
+ config.confidence_threshold
5246
+ );
5109
5247
  if (passing.length === 0 && selectedHistory.length === 0) {
5110
5248
  return {
5249
+ confidence_threshold: config.confidence_threshold,
5250
+ near_misses: hybridNearMisses,
5111
5251
  text: "",
5112
5252
  memories_included: [],
5113
5253
  memories_dropped: dropped.map((m) => m.id),
@@ -5189,6 +5329,8 @@ async function compileContextHybrid(db, req) {
5189
5329
  repo: req.repo
5190
5330
  });
5191
5331
  return {
5332
+ confidence_threshold: config.confidence_threshold,
5333
+ near_misses: hybridNearMisses,
5192
5334
  text: historyOnlyText,
5193
5335
  memories_included: [],
5194
5336
  memories_dropped: [...dropped, ...passing].map((m) => m.id),
@@ -5197,6 +5339,8 @@ async function compileContextHybrid(db, req) {
5197
5339
  };
5198
5340
  }
5199
5341
  return {
5342
+ confidence_threshold: config.confidence_threshold,
5343
+ near_misses: hybridNearMisses,
5200
5344
  text: "",
5201
5345
  memories_included: [],
5202
5346
  memories_dropped: [...dropped, ...passing].map((m) => m.id),
@@ -5226,6 +5370,8 @@ async function compileContextHybrid(db, req) {
5226
5370
  repo: req.repo
5227
5371
  });
5228
5372
  return {
5373
+ confidence_threshold: config.confidence_threshold,
5374
+ near_misses: hybridNearMisses,
5229
5375
  text: finalText,
5230
5376
  memories_included: selected.map((m) => m.id),
5231
5377
  memories_dropped: [
@@ -5271,7 +5417,8 @@ ${sections.join("\n\n")}
5271
5417
  }
5272
5418
  function renderMemoryBullet(memory) {
5273
5419
  const prefix = memory.scope === "global" ? "[global] " : "";
5274
- return `- ${prefix}${renderMemoryText(memory)}`;
5420
+ const pending = memory.status === "candidate" ? "[unconfirmed preference; not authorization] " : "";
5421
+ return `- ${prefix}${pending}${renderMemoryText(memory)}`;
5275
5422
  }
5276
5423
  function renderMemoryText(memory) {
5277
5424
  const text = memory.text.replace(/\r\n/g, "\n").trim();
@@ -5323,7 +5470,7 @@ var HISTORY_KINDS = /* @__PURE__ */ new Set([
5323
5470
  ]);
5324
5471
  function selectRepoHistory(db, repo, limit) {
5325
5472
  if (limit <= 0) return [];
5326
- return listHistorySnippets(db, { repo, limit: Math.max(limit * 3, 6) }).filter((snippet) => !snippet.session_id && HISTORY_KINDS.has(snippet.kind)).slice(0, limit);
5473
+ return listHistorySnippets(db, { repo, limit: Math.max(limit * 3, 6) }).filter((snippet) => !snippet.session_id && HISTORY_KINDS.has(snippet.kind) && !containsGeneratedHistory(snippet.text)).slice(0, limit);
5327
5474
  }
5328
5475
  async function selectRelevantHistory(db, repo, query, limit) {
5329
5476
  if (limit <= 0) return [];
@@ -5333,7 +5480,7 @@ async function selectRelevantHistory(db, repo, query, limit) {
5333
5480
  });
5334
5481
  return results.filter(
5335
5482
  (result) => result.lexical_score >= HISTORY_LEXICAL_RELEVANCE_FLOOR || result.similarity >= HISTORY_VECTOR_RELEVANCE_FLOOR
5336
- ).map((result) => result.snippet).filter((snippet) => HISTORY_KINDS.has(snippet.kind)).slice(0, limit);
5483
+ ).map((result) => result.snippet).filter((snippet) => HISTORY_KINDS.has(snippet.kind) && !containsGeneratedHistory(snippet.text)).slice(0, limit);
5337
5484
  }
5338
5485
  var HISTORY_ENTRY_MAX_CHARS = 120;
5339
5486
  var HISTORY_MAX_ENTRIES_PER_SNIPPET = 2;
@@ -5429,6 +5576,7 @@ function filterSessionScoped(memories4, sessionId) {
5429
5576
  }
5430
5577
 
5431
5578
  // src/adapters/markdown.ts
5579
+ init_define_RECALL_BUILD_INFO();
5432
5580
  function exportMarkdown(db, repo) {
5433
5581
  const result = compileContext(db, { repo });
5434
5582
  if (!result.text) {
@@ -5457,6 +5605,7 @@ ${result.text}`;
5457
5605
  }
5458
5606
 
5459
5607
  // src/artifacts/context.ts
5608
+ init_define_RECALL_BUILD_INFO();
5460
5609
  import { mkdirSync as mkdirSync2 } from "fs";
5461
5610
  import { isAbsolute, join as join4, resolve as resolve2 } from "path";
5462
5611
  import { execFileSync as execFileSync3 } from "child_process";
@@ -5529,12 +5678,13 @@ function ensureRepoContextExcluded(repoPath) {
5529
5678
  }
5530
5679
 
5531
5680
  // src/session/lifecycle.ts
5681
+ init_define_RECALL_BUILD_INFO();
5532
5682
  function resolveLifecycleSource(input) {
5533
5683
  if (input.source) return input.source;
5534
5684
  return input.client ? tagActivitySource("hook", input.client) : "daemon";
5535
5685
  }
5536
5686
  function startSessionLifecycle(db, input) {
5537
- const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
5687
+ const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
5538
5688
  const bootstrap = ensureRepoBootstrapped(db, {
5539
5689
  repo,
5540
5690
  repoPathHint: input.repo_path
@@ -5589,7 +5739,7 @@ function startSessionLifecycle(db, input) {
5589
5739
  };
5590
5740
  }
5591
5741
  function recordSessionLifecycleEvent(db, input) {
5592
- const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
5742
+ const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
5593
5743
  createActivityEvent(db, {
5594
5744
  session_id: input.session_id,
5595
5745
  repo,
@@ -5613,7 +5763,7 @@ function recordSessionLifecycleEvent(db, input) {
5613
5763
  };
5614
5764
  }
5615
5765
  function endSessionLifecycle(db, input) {
5616
- const repo = input.repo ?? inferRepoSlugFromPath(input.repo_path) ?? null;
5766
+ const repo = input.repo ?? process.env.RECALL_REPO_OVERRIDE?.trim() ?? inferRepoSlugFromPath(input.repo_path) ?? null;
5617
5767
  createActivityEvent(db, {
5618
5768
  session_id: input.session_id,
5619
5769
  repo,
@@ -5637,6 +5787,7 @@ function endSessionLifecycle(db, input) {
5637
5787
  }
5638
5788
 
5639
5789
  // src/eval/harness.ts
5790
+ init_define_RECALL_BUILD_INFO();
5640
5791
  import { randomUUID as randomUUID4 } from "crypto";
5641
5792
  function startEvalSession(db, repo) {
5642
5793
  const id = randomUUID4();
@@ -5816,6 +5967,7 @@ function formatMetricsReport(metrics) {
5816
5967
  }
5817
5968
 
5818
5969
  // src/eval/retrieval.ts
5970
+ init_define_RECALL_BUILD_INFO();
5819
5971
  import { readFileSync } from "fs";
5820
5972
  function loadRetrievalEvalFile(path) {
5821
5973
  return RetrievalEvalFile.parse(JSON.parse(readFileSync(path, "utf8")));
@@ -6153,6 +6305,7 @@ function embeddingConfigForProvider(provider) {
6153
6305
  }
6154
6306
 
6155
6307
  // src/feedback/implicit.ts
6308
+ init_define_RECALL_BUILD_INFO();
6156
6309
  import { randomUUID as randomUUID5 } from "crypto";
6157
6310
  import { execFileSync as execFileSync4 } from "child_process";
6158
6311
  var SIGNAL_WEIGHTS = {
@@ -6201,6 +6354,7 @@ function getSignalStats(db, memoryId) {
6201
6354
  }
6202
6355
 
6203
6356
  // src/policy/engine.ts
6357
+ init_define_RECALL_BUILD_INFO();
6204
6358
  import { randomUUID as randomUUID6 } from "crypto";
6205
6359
  function createPolicy(db, orgId, ruleType, config) {
6206
6360
  const id = randomUUID6();
@@ -6340,7 +6494,7 @@ function resolveApproval(db, approvalId, status, reviewedBy, reason) {
6340
6494
  if (status === "approved") {
6341
6495
  confirmMemory(db, row.memory_id);
6342
6496
  } else {
6343
- rejectMemory(db, row.memory_id);
6497
+ rejectMemory(db, row.memory_id, "policy");
6344
6498
  }
6345
6499
  recordAudit(db, row.memory_id, "approval_resolved", reviewedBy, reason ?? null);
6346
6500
  return true;
@@ -6362,7 +6516,9 @@ function rowToPolicy(row) {
6362
6516
  }
6363
6517
 
6364
6518
  // src/pruning/pruner.ts
6519
+ init_define_RECALL_BUILD_INFO();
6365
6520
  var DEFAULT_CONFIG2 = {
6521
+ candidate_unconfirmed_days: 30,
6366
6522
  stale_days: 90,
6367
6523
  rejected_retention_days: 30,
6368
6524
  transient_retention_days: 7,
@@ -6377,18 +6533,43 @@ function pruneMemories(db, config = {}) {
6377
6533
  const now2 = Date.now();
6378
6534
  const dayMs = 864e5;
6379
6535
  const result = {
6536
+ unconfirmed_archived: [],
6380
6537
  stale_archived: [],
6381
6538
  rejected_pruned: [],
6382
6539
  transient_pruned: [],
6383
6540
  unhealthy_demoted: [],
6384
6541
  total: 0
6385
6542
  };
6543
+ const unconfirmedCutoff = new Date(
6544
+ now2 - cfg.candidate_unconfirmed_days * dayMs
6545
+ ).toISOString();
6546
+ const unconfirmed = queryMemories(db, {
6547
+ repo: cfg.repo,
6548
+ status: "candidate",
6549
+ auto_inject: true
6550
+ }).filter(
6551
+ (mem) => mem.created_at < unconfirmedCutoff && mem.repetition_count < 2 && mem.injection_count === 0
6552
+ );
6553
+ for (const mem of unconfirmed) {
6554
+ if (!cfg.dry_run) {
6555
+ db.update(memories).set({ auto_inject: false, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(memories.id, mem.id)).run();
6556
+ recordAudit(
6557
+ db,
6558
+ mem.id,
6559
+ "demoted",
6560
+ "auto-pruner",
6561
+ `Archived unconfirmed candidate after ${cfg.candidate_unconfirmed_days}d without selection or repetition`
6562
+ );
6563
+ }
6564
+ result.unconfirmed_archived.push(mem.id);
6565
+ }
6386
6566
  const staleCutoff = new Date(now2 - cfg.stale_days * dayMs).toISOString();
6387
6567
  const staleCandidates = queryMemories(db, {
6388
6568
  repo: cfg.repo,
6389
6569
  limit: void 0
6390
6570
  }).filter((mem) => mem.status !== "rejected" && mem.status !== "transient");
6391
6571
  for (const mem of staleCandidates) {
6572
+ if (result.unconfirmed_archived.includes(mem.id)) continue;
6392
6573
  const lastActivity = mem.last_validated_at ?? mem.last_injected_at ?? mem.updated_at;
6393
6574
  if (lastActivity < staleCutoff && mem.auto_inject) {
6394
6575
  if (!cfg.dry_run) {
@@ -6459,7 +6640,7 @@ function pruneMemories(db, config = {}) {
6459
6640
  result.unhealthy_demoted.push(mem.id);
6460
6641
  }
6461
6642
  }
6462
- result.total = result.stale_archived.length + result.rejected_pruned.length + result.transient_pruned.length + result.unhealthy_demoted.length;
6643
+ result.total = result.unconfirmed_archived.length + result.stale_archived.length + result.rejected_pruned.length + result.transient_pruned.length + result.unhealthy_demoted.length;
6463
6644
  return result;
6464
6645
  }
6465
6646
  function deleteMemoryAndDependents(db, memoryId) {
@@ -6480,6 +6661,7 @@ function formatPruneReport(result, dryRun) {
6480
6661
  const lines = [
6481
6662
  `${prefix}Prune Report`,
6482
6663
  ``,
6664
+ `Unconfirmed archived:${String(result.unconfirmed_archived.length).padStart(5)}`,
6483
6665
  `Stale archived: ${result.stale_archived.length}`,
6484
6666
  `Rejected pruned: ${result.rejected_pruned.length}`,
6485
6667
  `Transient pruned: ${result.transient_pruned.length}`,
@@ -6502,9 +6684,10 @@ function formatPruneReport(result, dryRun) {
6502
6684
  }
6503
6685
 
6504
6686
  // src/mcp/fallback.ts
6687
+ init_define_RECALL_BUILD_INFO();
6505
6688
  async function captureCorrectionFallback(db, input, source) {
6506
6689
  const sessionId = input.session_id ?? `${source}-capture`;
6507
- const { ids, pendingTaskId } = await processCorrection(db, input.text, {
6690
+ const { ids, pendingTaskId, blockedByRejectedExemplar } = await processCorrection(db, input.text, {
6508
6691
  sessionId,
6509
6692
  repo: input.repo,
6510
6693
  path: input.path,
@@ -6535,7 +6718,8 @@ async function captureCorrectionFallback(db, input, source) {
6535
6718
  return {
6536
6719
  ids,
6537
6720
  session_id: sessionId,
6538
- pendingTaskId
6721
+ pendingTaskId,
6722
+ blockedByRejectedExemplar
6539
6723
  };
6540
6724
  }
6541
6725
  function signalOutcomeFallback(db, input, source) {
@@ -6608,6 +6792,7 @@ export {
6608
6792
  RECALL_DB_USER_VERSION,
6609
6793
  getDbPath,
6610
6794
  initDb,
6795
+ initStandaloneDb,
6611
6796
  closeDb,
6612
6797
  getDbUserVersion,
6613
6798
  resetDb,
@@ -6667,4 +6852,4 @@ export {
6667
6852
  pruneMemories,
6668
6853
  formatPruneReport
6669
6854
  };
6670
- //# sourceMappingURL=chunk-7Q5CBVUT.js.map
6855
+ //# sourceMappingURL=chunk-M3ASNCVM.js.map