@edihasaj/recall 0.9.7 → 0.9.8

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 (46) hide show
  1. package/README.md +24 -0
  2. package/dist/{chunk-BZF6TLQ3.js → chunk-4PK3YODK.js} +2 -2
  3. package/dist/{chunk-LLIYJ6CD.js → chunk-DUTMCVI6.js} +4 -4
  4. package/dist/{chunk-KDQYI5UT.js → chunk-GJKKJYFT.js} +3 -3
  5. package/dist/{chunk-G2OSUUTC.js → chunk-MZWZKD5S.js} +3 -3
  6. package/dist/{chunk-UDMQCRTL.js → chunk-O3E7BFYL.js} +20 -5
  7. package/dist/{chunk-UDMQCRTL.js.map → chunk-O3E7BFYL.js.map} +1 -1
  8. package/dist/{chunk-BMZ2NRLH.js → chunk-PFQSIYBM.js} +7 -7
  9. package/dist/{chunk-NMFI3TIF.js → chunk-PI6SYBQR.js} +6 -6
  10. package/dist/{chunk-QEYL4ZNZ.js → chunk-Q45VSX2J.js} +2 -2
  11. package/dist/{chunk-LXJWMIBR.js → chunk-U6FQSWUL.js} +2 -2
  12. package/dist/{chunk-IWKO72WH.js → chunk-WZWXYBP6.js} +16 -1
  13. package/dist/chunk-WZWXYBP6.js.map +1 -0
  14. package/dist/{cleanup-QIYS3OCH.js → cleanup-E7TX5RAW.js} +5 -5
  15. package/dist/cli.js +384 -34
  16. package/dist/cli.js.map +1 -1
  17. package/dist/daemon.js +10 -10
  18. package/dist/{dispatcher-VRR44JFE.js → dispatcher-CWKRKVT4.js} +5 -5
  19. package/dist/{embeddings-FEYQRSRV.js → embeddings-ER6YQSRM.js} +3 -3
  20. package/dist/{ingest-N6XSNRQH.js → ingest-S2KB2EY6.js} +4 -4
  21. package/dist/{keychain-PA25RZXE.js → keychain-5KXUHKMF.js} +4 -2
  22. package/dist/mcp.js +8 -8
  23. package/dist/{memory-value-X76RRECS.js → memory-value-NM24LKJY.js} +5 -5
  24. package/dist/{quality-5TZ3B4LR.js → quality-74KRD5CP.js} +6 -6
  25. package/dist/retrieval-E5LOMDYJ.js +13 -0
  26. package/dist/{tasks-UEJORN2X.js → tasks-Y6HOLQTQ.js} +5 -5
  27. package/package.json +1 -1
  28. package/dist/chunk-IWKO72WH.js.map +0 -1
  29. package/dist/retrieval-IRYNANIM.js +0 -13
  30. /package/dist/{chunk-BZF6TLQ3.js.map → chunk-4PK3YODK.js.map} +0 -0
  31. /package/dist/{chunk-LLIYJ6CD.js.map → chunk-DUTMCVI6.js.map} +0 -0
  32. /package/dist/{chunk-KDQYI5UT.js.map → chunk-GJKKJYFT.js.map} +0 -0
  33. /package/dist/{chunk-G2OSUUTC.js.map → chunk-MZWZKD5S.js.map} +0 -0
  34. /package/dist/{chunk-BMZ2NRLH.js.map → chunk-PFQSIYBM.js.map} +0 -0
  35. /package/dist/{chunk-NMFI3TIF.js.map → chunk-PI6SYBQR.js.map} +0 -0
  36. /package/dist/{chunk-QEYL4ZNZ.js.map → chunk-Q45VSX2J.js.map} +0 -0
  37. /package/dist/{chunk-LXJWMIBR.js.map → chunk-U6FQSWUL.js.map} +0 -0
  38. /package/dist/{cleanup-QIYS3OCH.js.map → cleanup-E7TX5RAW.js.map} +0 -0
  39. /package/dist/{dispatcher-VRR44JFE.js.map → dispatcher-CWKRKVT4.js.map} +0 -0
  40. /package/dist/{embeddings-FEYQRSRV.js.map → embeddings-ER6YQSRM.js.map} +0 -0
  41. /package/dist/{ingest-N6XSNRQH.js.map → ingest-S2KB2EY6.js.map} +0 -0
  42. /package/dist/{keychain-PA25RZXE.js.map → keychain-5KXUHKMF.js.map} +0 -0
  43. /package/dist/{memory-value-X76RRECS.js.map → memory-value-NM24LKJY.js.map} +0 -0
  44. /package/dist/{quality-5TZ3B4LR.js.map → quality-74KRD5CP.js.map} +0 -0
  45. /package/dist/{retrieval-IRYNANIM.js.map → retrieval-E5LOMDYJ.js.map} +0 -0
  46. /package/dist/{tasks-UEJORN2X.js.map → tasks-Y6HOLQTQ.js.map} +0 -0
package/dist/cli.js CHANGED
@@ -23,15 +23,17 @@ import {
23
23
  readCodexSessionStartInputFromStdin,
24
24
  readCodexToolInputFromStdin,
25
25
  restoreBackup
26
- } from "./chunk-NMFI3TIF.js";
26
+ } from "./chunk-PI6SYBQR.js";
27
27
  import {
28
28
  RECALL_DB_USER_VERSION,
29
+ closeDb,
29
30
  compileContext,
30
31
  compileContextHybrid,
31
32
  computeMetrics,
32
33
  createActivityEvent,
33
34
  createPolicy,
34
35
  deletePolicy,
36
+ discoverLocalRepos,
35
37
  endEvalSession,
36
38
  evaluatePolicy,
37
39
  exportClaude,
@@ -43,6 +45,7 @@ import {
43
45
  formatValueRetrievalEvalReport,
44
46
  getDbPath,
45
47
  getDbUserVersion,
48
+ getRepoContextArtifactPath,
46
49
  getSignalStats,
47
50
  inferRepoSlugFromPath,
48
51
  initDb,
@@ -66,7 +69,7 @@ import {
66
69
  summarizeValueRetrievalEval,
67
70
  togglePolicy,
68
71
  writeRepoContextArtifact
69
- } from "./chunk-UDMQCRTL.js";
72
+ } from "./chunk-O3E7BFYL.js";
70
73
  import {
71
74
  autoResolveContradictions,
72
75
  computeAllHealthScores,
@@ -84,8 +87,8 @@ import {
84
87
  recordAudit,
85
88
  resolveContradiction,
86
89
  rollbackMemory
87
- } from "./chunk-LLIYJ6CD.js";
88
- import "./chunk-KDQYI5UT.js";
90
+ } from "./chunk-DUTMCVI6.js";
91
+ import "./chunk-GJKKJYFT.js";
89
92
  import "./chunk-FHEH6QDU.js";
90
93
  import "./chunk-CW3XJDH7.js";
91
94
  import "./chunk-PUMEMKGF.js";
@@ -99,7 +102,7 @@ import {
99
102
  listRepos,
100
103
  queryMemories,
101
104
  rejectMemory
102
- } from "./chunk-BZF6TLQ3.js";
105
+ } from "./chunk-4PK3YODK.js";
103
106
  import {
104
107
  atomicWriteUtf8File,
105
108
  bootstrapEmbeddings,
@@ -114,13 +117,15 @@ import {
114
117
  searchMemoryFtsIndex,
115
118
  semanticSearch,
116
119
  verifyEmbeddings
117
- } from "./chunk-LXJWMIBR.js";
120
+ } from "./chunk-U6FQSWUL.js";
118
121
  import {
122
+ deleteApiKey,
123
+ hasKeychainApiKey,
119
124
  init_keychain,
120
125
  init_outbound_url,
121
126
  keychain_exports,
122
127
  normalizeSyncRemoteUrl
123
- } from "./chunk-IWKO72WH.js";
128
+ } from "./chunk-WZWXYBP6.js";
124
129
  import "./chunk-EAFRT7RX.js";
125
130
  import {
126
131
  eq,
@@ -134,9 +139,9 @@ import {
134
139
 
135
140
  // src/cli.ts
136
141
  import { Command } from "commander";
137
- import { resolve as resolve7 } from "path";
138
- import { writeFileSync as writeFileSync7, readFileSync as readFileSync7 } from "fs";
139
- import { join as join11 } from "path";
142
+ import { resolve as resolve8 } from "path";
143
+ import { writeFileSync as writeFileSync7, readFileSync as readFileSync8 } from "fs";
144
+ import { join as join12 } from "path";
140
145
 
141
146
  // src/ump/serve.ts
142
147
  import {
@@ -3120,6 +3125,19 @@ function formatDoctorReport(report) {
3120
3125
  return lines.join("\n");
3121
3126
  }
3122
3127
 
3128
+ // src/data/purge.ts
3129
+ import { execFileSync as execFileSync6 } from "child_process";
3130
+ import {
3131
+ existsSync as existsSync10,
3132
+ readFileSync as readFileSync7,
3133
+ readdirSync,
3134
+ rmSync as rmSync4,
3135
+ rmdirSync
3136
+ } from "fs";
3137
+ import { homedir as homedir4 } from "os";
3138
+ import { dirname as dirname8, join as join11, parse, resolve as resolve7 } from "path";
3139
+ init_keychain();
3140
+
3123
3141
  // src/daemon/service.ts
3124
3142
  var isLinux = process.platform === "linux";
3125
3143
  var isDarwin = process.platform === "darwin";
@@ -3157,6 +3175,281 @@ function defaultServiceLabel() {
3157
3175
  return isLinux ? "recall-daemon" : "com.recall.daemon";
3158
3176
  }
3159
3177
 
3178
+ // src/data/purge.ts
3179
+ var GENERATED_CONTEXT_MARKER = "<!-- Auto-generated by Recall. Do not edit manually. -->";
3180
+ var PROVIDERS = [
3181
+ "openai",
3182
+ "anthropic",
3183
+ "azure-openai"
3184
+ ];
3185
+ function resolveRecallDataDir(options = {}) {
3186
+ const home = resolve7(options.homeDir ?? homedir4());
3187
+ return resolve7(options.dataDir ?? process.env.RECALL_DATA_DIR ?? join11(home, ".recall"));
3188
+ }
3189
+ function purgeLocalData(options = {}) {
3190
+ const dryRun = options.dryRun ?? false;
3191
+ const home = resolve7(options.homeDir ?? homedir4());
3192
+ const dataDir = resolveRecallDataDir({ dataDir: options.dataDir, homeDir: home });
3193
+ assertSafeDataDir(dataDir, home);
3194
+ const repoRoots = options.repoRoots ?? configuredRepoRoots(home);
3195
+ const actions = [];
3196
+ const contextPaths = findGeneratedContextArtifacts(repoRoots);
3197
+ if (options.keepIntegrations) {
3198
+ actions.push({
3199
+ category: "integration",
3200
+ target: "agent hooks, rules, and MCP registrations",
3201
+ status: "retained",
3202
+ detail: "--keep-integrations"
3203
+ });
3204
+ actions.push({
3205
+ category: "service",
3206
+ target: defaultServiceLabel(),
3207
+ status: "retained",
3208
+ detail: "--keep-integrations"
3209
+ });
3210
+ } else if (dryRun) {
3211
+ actions.push(...plannedIntegrationActions(repoRoots));
3212
+ } else {
3213
+ actions.push(...removeIntegrations(repoRoots));
3214
+ actions.push(removeDaemonService());
3215
+ }
3216
+ for (const provider of PROVIDERS) {
3217
+ if (dryRun) {
3218
+ actions.push({
3219
+ category: "credential",
3220
+ target: `macOS Keychain ${provider}`,
3221
+ status: "planned"
3222
+ });
3223
+ continue;
3224
+ }
3225
+ const present = hasKeychainApiKey(provider);
3226
+ const removed = present ? deleteApiKey(provider) : false;
3227
+ actions.push({
3228
+ category: "credential",
3229
+ target: `macOS Keychain ${provider}`,
3230
+ status: removed ? "removed" : present ? "failed" : "absent",
3231
+ detail: present && !removed ? "credential still present" : void 0
3232
+ });
3233
+ }
3234
+ for (const contextPath of contextPaths) {
3235
+ if (dryRun) {
3236
+ actions.push({
3237
+ category: "artifact",
3238
+ target: contextPath,
3239
+ status: "planned"
3240
+ });
3241
+ continue;
3242
+ }
3243
+ try {
3244
+ rmSync4(contextPath, { force: true });
3245
+ removeDirectoryIfEmpty(dirname8(contextPath));
3246
+ actions.push({
3247
+ category: "artifact",
3248
+ target: contextPath,
3249
+ status: "removed"
3250
+ });
3251
+ } catch (error) {
3252
+ actions.push(failed("artifact", contextPath, error));
3253
+ }
3254
+ }
3255
+ if (dryRun) {
3256
+ actions.push({
3257
+ category: "data",
3258
+ target: dataDir,
3259
+ status: existsSync10(dataDir) ? "planned" : "absent",
3260
+ detail: "database, WAL, backups, logs, caches, models, and sync state"
3261
+ });
3262
+ } else {
3263
+ try {
3264
+ closeDb();
3265
+ const existed = existsSync10(dataDir);
3266
+ rmSync4(dataDir, { recursive: true, force: true });
3267
+ actions.push({
3268
+ category: "data",
3269
+ target: dataDir,
3270
+ status: existed ? "removed" : "absent",
3271
+ detail: "database, WAL, backups, logs, caches, models, and sync state"
3272
+ });
3273
+ } catch (error) {
3274
+ actions.push(failed("data", dataDir, error));
3275
+ }
3276
+ }
3277
+ return {
3278
+ dry_run: dryRun,
3279
+ data_dir: dataDir,
3280
+ integrations_retained: options.keepIntegrations ?? false,
3281
+ actions,
3282
+ failures: actions.filter((action) => action.status === "failed").length
3283
+ };
3284
+ }
3285
+ function assertSafeDataDir(dataDir, home) {
3286
+ const root = parse(dataDir).root;
3287
+ if (dataDir === root || dataDir === home) {
3288
+ throw new Error(`Refusing unsafe Recall data directory: ${dataDir}`);
3289
+ }
3290
+ }
3291
+ function configuredRepoRoots(home) {
3292
+ const configured = process.env.RECALL_REPO_ROOTS?.split(",").map((value) => value.trim()).filter(Boolean);
3293
+ return configured?.length ? configured.map((value) => resolve7(value)) : [join11(home, "Projects")];
3294
+ }
3295
+ function findGeneratedContextArtifacts(repoRoots) {
3296
+ const paths = /* @__PURE__ */ new Set();
3297
+ for (const repo of discoverLocalRepos(repoRoots)) {
3298
+ const candidate = getRepoContextArtifactPath(repo.repo_path);
3299
+ if (isGeneratedContext(candidate)) paths.add(candidate);
3300
+ }
3301
+ const cwdCandidate = getRepoContextArtifactPath(process.cwd());
3302
+ if (isGeneratedContext(cwdCandidate)) paths.add(cwdCandidate);
3303
+ return [...paths].sort();
3304
+ }
3305
+ function isGeneratedContext(path) {
3306
+ if (!existsSync10(path)) return false;
3307
+ try {
3308
+ return readFileSync7(path, "utf8").startsWith(GENERATED_CONTEXT_MARKER);
3309
+ } catch {
3310
+ return false;
3311
+ }
3312
+ }
3313
+ function plannedIntegrationActions(repoRoots) {
3314
+ const actions = [
3315
+ planned("service", defaultServiceLabel()),
3316
+ planned("integration", "Claude Code hooks, memory override, and Recall MCP"),
3317
+ planned("integration", "Codex hooks and Recall MCP")
3318
+ ];
3319
+ for (const agent of listAgentNames().filter(isHooklessAgent)) {
3320
+ actions.push(planned("integration", `${agent} Recall MCP and managed rules`));
3321
+ }
3322
+ for (const repo of discoverLocalRepos(repoRoots)) {
3323
+ actions.push(planned("integration", `${repo.repo_path} managed Recall rules`));
3324
+ }
3325
+ return actions;
3326
+ }
3327
+ function removeIntegrations(repoRoots) {
3328
+ const actions = [];
3329
+ actions.push(fromInstallResult(
3330
+ "Claude Code hooks",
3331
+ uninstallClaudeCodeHooks()
3332
+ ));
3333
+ actions.push(fromInstallResult(
3334
+ "Claude Code memory override",
3335
+ uninstallClaudeCodeMemoryOverride()
3336
+ ));
3337
+ actions.push(fromInstallResult("Codex hooks", uninstallCodexHooks()));
3338
+ actions.push(removeCliMcp("claude", ["mcp", "remove", "recall", "-s", "user"]));
3339
+ actions.push(removeCliMcp("codex", ["mcp", "remove", "recall"]));
3340
+ const hookless = listAgentNames().filter(isHooklessAgent);
3341
+ for (const name of hookless) {
3342
+ const adapter = resolveAdapter(name);
3343
+ if (adapter.removeMcpFallback) {
3344
+ actions.push(fromInstallResult(
3345
+ `${name} Recall MCP`,
3346
+ adapter.removeMcpFallback()
3347
+ ));
3348
+ }
3349
+ if (adapter.rulesScope === "global" && adapter.uninstallRules) {
3350
+ actions.push(fromInstallResult(
3351
+ `${name} managed rules`,
3352
+ adapter.uninstallRules()
3353
+ ));
3354
+ }
3355
+ }
3356
+ for (const repo of discoverLocalRepos(repoRoots)) {
3357
+ for (const name of hookless) {
3358
+ const adapter = resolveAdapter(name);
3359
+ if (adapter.rulesScope !== "project" || !adapter.uninstallRules) continue;
3360
+ actions.push(fromInstallResult(
3361
+ `${name} managed rules in ${repo.repo_path}`,
3362
+ adapter.uninstallRules({ cwd: repo.repo_path })
3363
+ ));
3364
+ }
3365
+ actions.push(removeCliMcp(
3366
+ "claude",
3367
+ ["mcp", "remove", "recall", "-s", "project"],
3368
+ repo.repo_path
3369
+ ));
3370
+ }
3371
+ return actions;
3372
+ }
3373
+ function removeCliMcp(command, args, cwd) {
3374
+ const target = `${command} Recall MCP${cwd ? ` in ${cwd}` : ""}`;
3375
+ try {
3376
+ execFileSync6(command, ["mcp", "get", "recall"], {
3377
+ cwd,
3378
+ stdio: "ignore",
3379
+ timeout: 1e4
3380
+ });
3381
+ } catch {
3382
+ return {
3383
+ category: "integration",
3384
+ target,
3385
+ status: "absent",
3386
+ detail: "not registered or CLI unavailable"
3387
+ };
3388
+ }
3389
+ try {
3390
+ execFileSync6(command, args, {
3391
+ cwd,
3392
+ stdio: "ignore",
3393
+ timeout: 1e4
3394
+ });
3395
+ return { category: "integration", target, status: "removed" };
3396
+ } catch (error) {
3397
+ return {
3398
+ category: "integration",
3399
+ target,
3400
+ status: "failed",
3401
+ detail: error instanceof Error ? error.message : "MCP removal failed"
3402
+ };
3403
+ }
3404
+ }
3405
+ function removeDaemonService() {
3406
+ const label = defaultServiceLabel();
3407
+ if (process.platform !== "darwin" && process.platform !== "linux") {
3408
+ return {
3409
+ category: "service",
3410
+ target: label,
3411
+ status: "absent",
3412
+ detail: `unsupported platform ${process.platform}`
3413
+ };
3414
+ }
3415
+ try {
3416
+ const status = uninstallService(label);
3417
+ return {
3418
+ category: "service",
3419
+ target: label,
3420
+ status: status.installed || status.loaded ? "failed" : "removed",
3421
+ detail: status.installed || status.loaded ? "service still reports installed or loaded" : void 0
3422
+ };
3423
+ } catch (error) {
3424
+ return failed("service", label, error);
3425
+ }
3426
+ }
3427
+ function planned(category, target) {
3428
+ return { category, target, status: "planned" };
3429
+ }
3430
+ function fromInstallResult(target, result) {
3431
+ return {
3432
+ category: "integration",
3433
+ target,
3434
+ status: result.ok ? result.changed ? "removed" : "absent" : "failed",
3435
+ detail: result.message
3436
+ };
3437
+ }
3438
+ function failed(category, target, error) {
3439
+ return {
3440
+ category,
3441
+ target,
3442
+ status: "failed",
3443
+ detail: error instanceof Error ? error.message : String(error)
3444
+ };
3445
+ }
3446
+ function removeDirectoryIfEmpty(path) {
3447
+ try {
3448
+ if (readdirSync(path).length === 0) rmdirSync(path);
3449
+ } catch {
3450
+ }
3451
+ }
3452
+
3160
3453
  // src/cli.ts
3161
3454
  var require2 = createRequire(import.meta.url);
3162
3455
  var pkg = require2("../package.json");
@@ -3252,6 +3545,33 @@ dbCmd.command("restore <date>").description("Restore the local database from a d
3252
3545
  }
3253
3546
  console.log(`Restored ${result.from} -> ${result.to}`);
3254
3547
  });
3548
+ var dataCmd = program.command("data").description("Manage all local Recall data");
3549
+ dataCmd.command("purge").description("Permanently erase local Recall data, credentials, exports, and integrations").option("--dry-run", "Show what would be erased without changing anything").option("--yes", "Confirm permanent erasure without an interactive prompt").option("--json", "Emit a stable JSON result").option("--keep-integrations", "Keep daemon, hooks, rules, and MCP registrations").option("--data-dir <dir>", "Override the Recall data directory").action(async (opts) => {
3550
+ if (!opts.dryRun && !opts.yes) {
3551
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3552
+ console.error("Refusing to purge without --yes in non-interactive mode.");
3553
+ process.exitCode = 2;
3554
+ return;
3555
+ }
3556
+ const confirmed = await confirmLocalDataPurge();
3557
+ if (!confirmed) {
3558
+ console.error("Aborted local data purge.");
3559
+ process.exitCode = 1;
3560
+ return;
3561
+ }
3562
+ }
3563
+ const result = purgeLocalData({
3564
+ dataDir: opts.dataDir,
3565
+ dryRun: opts.dryRun,
3566
+ keepIntegrations: opts.keepIntegrations
3567
+ });
3568
+ if (opts.json) {
3569
+ console.log(JSON.stringify(result, null, 2));
3570
+ } else {
3571
+ printLocalDataPurgeResult(result);
3572
+ }
3573
+ if (result.failures > 0) process.exitCode = 1;
3574
+ });
3255
3575
  var setupCmd = program.command("setup").description("Setup Recall for local use");
3256
3576
  setupCmd.option("--app-path <path>", "Override Recall.app path", "/Applications/Recall.app").option("--hooks-only", "Install hooks only").option("--mcp-only", "Install MCP wiring only").option("--agent <agent>", "Restrict setup to a single agent (repeatable)", collectAgents, []).option("--uninstall-hooks", "Remove Recall-managed hooks while leaving MCP configured").option("--dry-run", "Show planned setup changes without writing").option("--scope <scope>", "Hook config scope: global or project", "global").option("--no-prompt-injection", "Opt out of per-prompt memory injection (writes RECALL_HOOK_INJECT_PROMPT=false inline into the agent hook command)").option("--no-claude-md", "Skip installing the managed CLAUDE.md memory-override block for Claude Code (the block stops Claude's built-in auto-memory from racing Recall)").option("--yes", "Skip confirmation prompt").action(async (opts) => {
3257
3577
  if (!opts.yes && !opts.dryRun) {
@@ -3331,17 +3651,17 @@ function safeHookAction(event, action) {
3331
3651
  } catch (error) {
3332
3652
  let logPath = "~/.recall/logs/hook-errors.log";
3333
3653
  try {
3334
- const { appendFileSync, mkdirSync: mkdirSync7, statSync, renameSync: renameSync4, rmSync: rmSync4 } = await import("fs");
3335
- const { homedir: homedir4 } = await import("os");
3336
- const dir = join11(homedir4(), ".recall", "logs");
3654
+ const { appendFileSync, mkdirSync: mkdirSync7, statSync, renameSync: renameSync4, rmSync: rmSync5 } = await import("fs");
3655
+ const { homedir: homedir5 } = await import("os");
3656
+ const dir = join12(homedir5(), ".recall", "logs");
3337
3657
  mkdirSync7(dir, { recursive: true });
3338
- logPath = join11(dir, "hook-errors.log");
3658
+ logPath = join12(dir, "hook-errors.log");
3339
3659
  try {
3340
3660
  const maxBytes = parseInt(process.env.RECALL_HOOK_LOG_MAX_BYTES ?? String(1024 * 1024), 10);
3341
3661
  if (maxBytes > 0 && statSync(logPath).size >= maxBytes) {
3342
3662
  const rotated = `${logPath}.1`;
3343
3663
  try {
3344
- rmSync4(rotated, { force: true });
3664
+ rmSync5(rotated, { force: true });
3345
3665
  } catch {
3346
3666
  }
3347
3667
  renameSync4(logPath, rotated);
@@ -3492,7 +3812,7 @@ program.command("ump").description("Serve the Universal Memory Protocol (UMP) ov
3492
3812
  });
3493
3813
  program.command("scan").description("Scan a repository and bootstrap memories").argument("[path]", "Repository path", ".").option("-s, --session <id>", "Session ID").action((path, opts) => {
3494
3814
  const db = initDb();
3495
- const repoPath = resolve7(path);
3815
+ const repoPath = resolve8(path);
3496
3816
  const ids = scanAndStore(db, repoPath);
3497
3817
  const artifact = writeRepoContextArtifact(db, {
3498
3818
  repo: inferRepoSlugFromPath(repoPath),
@@ -3738,7 +4058,7 @@ program.command("export").description("Export memories as markdown instruction f
3738
4058
  console.error(`Could not resolve local repo path for ${opts.repo}`);
3739
4059
  process.exit(1);
3740
4060
  }
3741
- content = readFileSync7(artifact.output_path, "utf-8");
4061
+ content = readFileSync8(artifact.output_path, "utf-8");
3742
4062
  if (!opts.output) {
3743
4063
  console.log(content);
3744
4064
  return;
@@ -3757,7 +4077,7 @@ program.command("export").description("Export memories as markdown instruction f
3757
4077
  });
3758
4078
  program.command("publish").description("Write repo-local .recall/context.md for the current repo").argument("[path]", "Repository path", ".").action((path) => {
3759
4079
  const db = initDb();
3760
- const repoPath = resolve7(path);
4080
+ const repoPath = resolve8(path);
3761
4081
  const artifact = writeRepoContextArtifact(db, {
3762
4082
  repo: inferRepoSlugFromPath(repoPath),
3763
4083
  repo_path: repoPath
@@ -3886,7 +4206,7 @@ evalCmd.command("value-retrieval").description("Run retrieval eval cases synthes
3886
4206
  });
3887
4207
  let snapshot = null;
3888
4208
  if (opts.snapshot) {
3889
- const { computeQualityReport, recordQualitySnapshot } = await import("./quality-5TZ3B4LR.js");
4209
+ const { computeQualityReport, recordQualitySnapshot } = await import("./quality-74KRD5CP.js");
3890
4210
  const qualityReport = computeQualityReport(db, { sinceIso: report.since });
3891
4211
  snapshot = recordQualitySnapshot(
3892
4212
  db,
@@ -4378,7 +4698,7 @@ graphCmd.command("stats").description("Show entity/relation counts").action(asyn
4378
4698
  });
4379
4699
  graphCmd.command("backfill").description("Run the heuristic extractor over every active memory (idempotent)").option("--repo <repo>", "Limit to a single repo").option("--limit <n>", "Cap rows processed", "10000").option("--rebuild", "Clear all existing entities/relations first, then re-extract").action(async (opts) => {
4380
4700
  const db = initDb();
4381
- const { ingestMemoryHeuristic } = await import("./ingest-N6XSNRQH.js");
4701
+ const { ingestMemoryHeuristic } = await import("./ingest-S2KB2EY6.js");
4382
4702
  if (opts.rebuild) {
4383
4703
  const { clearGraph } = await import("./store-5C7ZKKZF.js");
4384
4704
  clearGraph(db);
@@ -4421,8 +4741,8 @@ graphCmd.command("entities").description("List entities").option("--repo <repo>"
4421
4741
  });
4422
4742
  graphCmd.command("query <query...>").description("Run graph-aware retrieval for a query").option("--repo <repo>", "Restrict to repo").option("--hops <n>", "Graph hops", "2").option("--limit <n>", "Max hits", "10").action(async (queryTokens, opts) => {
4423
4743
  const db = initDb();
4424
- const { graphQuery } = await import("./retrieval-IRYNANIM.js");
4425
- const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-FEYQRSRV.js");
4744
+ const { graphQuery } = await import("./retrieval-E5LOMDYJ.js");
4745
+ const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-ER6YQSRM.js");
4426
4746
  const embeddingConfig = loadEmbeddingConfigFromEnv2();
4427
4747
  const result = await graphQuery(db, queryTokens.join(" "), embeddingConfig, {
4428
4748
  repo: opts.repo,
@@ -4438,7 +4758,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
4438
4758
  });
4439
4759
  var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
4440
4760
  maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
4441
- const { getTaskStats } = await import("./tasks-UEJORN2X.js");
4761
+ const { getTaskStats } = await import("./tasks-Y6HOLQTQ.js");
4442
4762
  const db = initDb();
4443
4763
  const stats = getTaskStats(db);
4444
4764
  console.log(`Total tasks: ${stats.total}`);
@@ -4464,7 +4784,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
4464
4784
  }
4465
4785
  });
4466
4786
  maintenanceCmd.command("list").description("List tasks (default: pending)").option("-s, --status <status>", "pending|claimed|completed|abandoned", "pending").option("-k, --kind <kind>", "Filter by kind").option("-r, --repo <repo>", "Filter by repo").option("-n, --limit <n>", "Max entries", "20").action(async (opts) => {
4467
- const { listTasks } = await import("./tasks-UEJORN2X.js");
4787
+ const { listTasks } = await import("./tasks-Y6HOLQTQ.js");
4468
4788
  const db = initDb();
4469
4789
  const tasks = listTasks(db, {
4470
4790
  status: opts.status,
@@ -4486,7 +4806,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
4486
4806
  }
4487
4807
  });
4488
4808
  maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)").argument("<task-id>", "Task id or prefix").action(async (taskIdArg) => {
4489
- const { deleteTask, listTasks } = await import("./tasks-UEJORN2X.js");
4809
+ const { deleteTask, listTasks } = await import("./tasks-Y6HOLQTQ.js");
4490
4810
  const db = initDb();
4491
4811
  const all = listTasks(db, { limit: 1e4 });
4492
4812
  const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
@@ -4505,7 +4825,7 @@ maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)")
4505
4825
  });
4506
4826
  var credentialsCmd = maintenanceCmd.command("credentials").description("Manage LLM provider API keys in macOS Keychain (env fallback on other platforms)");
4507
4827
  credentialsCmd.command("list", { isDefault: true }).description("Show which providers have credentials available").action(async () => {
4508
- const { listCredentials } = await import("./keychain-PA25RZXE.js");
4828
+ const { listCredentials } = await import("./keychain-5KXUHKMF.js");
4509
4829
  const creds = listCredentials();
4510
4830
  if (creds.length === 0) {
4511
4831
  console.log("No API keys configured. Set one with:");
@@ -4519,7 +4839,7 @@ credentialsCmd.command("list", { isDefault: true }).description("Show which prov
4519
4839
  }
4520
4840
  });
4521
4841
  credentialsCmd.command("set").description("Store credentials for an LLM provider in the macOS Keychain").argument("<provider>", "openai|anthropic|azure").argument("[key]", "API key (prompts via stdin if omitted; required for openai/anthropic and for azure unless --stdin-json is used)").option("--endpoint <url>", "Azure OpenAI resource endpoint (e.g. https://myresource.openai.azure.com)").option("--deployment <name>", "Azure OpenAI deployment name").option("--api-version <version>", "Azure OpenAI api-version (e.g. 2024-10-21)").option("--stdin-json", "Read the azure config (endpoint/deployment/api_version/key) as a JSON object from stdin").action(async (providerArg, keyArg, opts) => {
4522
- const { setApiKey, setAzureConfig } = await import("./keychain-PA25RZXE.js");
4842
+ const { setApiKey, setAzureConfig } = await import("./keychain-5KXUHKMF.js");
4523
4843
  const provider = providerArg === "azure" ? "azure-openai" : providerArg;
4524
4844
  if (provider === "openai" || provider === "anthropic") {
4525
4845
  const key = keyArg ?? await readStdinKey();
@@ -4581,19 +4901,19 @@ credentialsCmd.command("set").description("Store credentials for an LLM provider
4581
4901
  process.exit(1);
4582
4902
  });
4583
4903
  credentialsCmd.command("clear").description("Remove provider credentials from the macOS Keychain").argument("<provider>", "openai|anthropic|azure").action(async (providerArg) => {
4584
- const { deleteApiKey } = await import("./keychain-PA25RZXE.js");
4904
+ const { deleteApiKey: deleteApiKey2 } = await import("./keychain-5KXUHKMF.js");
4585
4905
  const provider = providerArg === "azure" ? "azure-openai" : providerArg;
4586
4906
  if (provider !== "openai" && provider !== "anthropic" && provider !== "azure-openai") {
4587
4907
  console.error(`Provider must be "openai", "anthropic", or "azure", got "${providerArg}".`);
4588
4908
  process.exit(1);
4589
4909
  }
4590
- const removed = deleteApiKey(provider);
4910
+ const removed = deleteApiKey2(provider);
4591
4911
  if (removed) console.log(`Removed ${provider} credentials from Keychain.`);
4592
4912
  else console.log(`No ${provider} credentials found in Keychain.`);
4593
4913
  });
4594
4914
  maintenanceCmd.command("dispatch").description("Run the daemon-owned dispatcher once against pending maintenance tasks (requires a configured LLM provider)").option("--provider <provider>", "openai|anthropic|azure-openai (defaults to whichever is configured)").option("--model <model>", "Model override").option("--kind <kind>", "Restrict to a single task kind (repeatable)", (value, acc = []) => [...acc, value], []).option("--repo <repo>", "Restrict to a single repo").option("--max <n>", "Max tasks to run this round", "5").option("--dry-run", "Show which tasks would be dispatched; do not call the LLM").option("--preview", "Show the actual prompts that would be sent (no provider needed; no LLM call)").option("--json", "Emit the raw JSON report").action(async (opts) => {
4595
- const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-VRR44JFE.js");
4596
- const { listTasks } = await import("./tasks-UEJORN2X.js");
4915
+ const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-CWKRKVT4.js");
4916
+ const { listTasks } = await import("./tasks-Y6HOLQTQ.js");
4597
4917
  const db = initDb();
4598
4918
  if (opts.preview) {
4599
4919
  const pending = listTasks(db, {
@@ -4650,7 +4970,7 @@ ${p.prompt.max_output_tokens}
4650
4970
  console.log(formatDispatchReport(report));
4651
4971
  });
4652
4972
  maintenanceCmd.command("cleanup").description("Run deterministic, LLM-free cleanup for duplicate, low-quality, stale, and mis-scoped memories").option("--apply", "Persist changes (default is dry-run)").option("--only <action>", "Restrict to one action: dedupe_exact_merge|reject_fragment_candidate|promote_repeat_correction|suppress_unproductive_command|globalize_cross_repo|reject_test_fixture_repo|reject_invalid_scope|reject_generic_scanned_tooling").option("--revert <run-id>", "Revert a previous cleanup run (id or 8-char prefix)").option("--list", "List recent cleanup runs").option("--json", "Emit the raw JSON report").action(async (opts) => {
4653
- const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-QIYS3OCH.js");
4973
+ const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-E7TX5RAW.js");
4654
4974
  const db = initDb();
4655
4975
  if (opts.list) {
4656
4976
  const runs = listCleanupRuns(db);
@@ -4704,7 +5024,7 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
4704
5024
  recordQualitySnapshot,
4705
5025
  listQualitySnapshots,
4706
5026
  diffQualitySnapshots
4707
- } = await import("./quality-5TZ3B4LR.js");
5027
+ } = await import("./quality-74KRD5CP.js");
4708
5028
  const db = initDb();
4709
5029
  if (opts.history) {
4710
5030
  const snaps = listQualitySnapshots(db);
@@ -4765,7 +5085,7 @@ maintenanceCmd.command("value-backfill").description("Backfill memory value even
4765
5085
  const {
4766
5086
  backfillMemoryValueEvents,
4767
5087
  formatMemoryValueBackfillReport
4768
- } = await import("./memory-value-X76RRECS.js");
5088
+ } = await import("./memory-value-NM24LKJY.js");
4769
5089
  const db = initDb();
4770
5090
  const report = backfillMemoryValueEvents(db, {
4771
5091
  sinceIso: opts.since,
@@ -4861,6 +5181,36 @@ async function confirmSetupWrite(scope) {
4861
5181
  rl.close();
4862
5182
  }
4863
5183
  }
5184
+ async function confirmLocalDataPurge() {
5185
+ const { createInterface } = await import("readline/promises");
5186
+ const rl = createInterface({
5187
+ input: process.stdin,
5188
+ output: process.stdout
5189
+ });
5190
+ try {
5191
+ console.log(
5192
+ "This permanently erases Recall databases, backups, logs, model caches, Keychain credentials, generated repo context, daemon service, hooks, rules, and MCP registrations."
5193
+ );
5194
+ const answer = await rl.question('Type "PURGE" to continue: ');
5195
+ return answer.trim() === "PURGE";
5196
+ } finally {
5197
+ rl.close();
5198
+ }
5199
+ }
5200
+ function printLocalDataPurgeResult(result) {
5201
+ console.log(result.dry_run ? "Recall local data purge plan:" : "Recall local data purge:");
5202
+ for (const action of result.actions) {
5203
+ const detail = action.detail ? ` (${action.detail})` : "";
5204
+ console.log(` ${action.status.padEnd(8)} ${action.target}${detail}`);
5205
+ }
5206
+ if (result.dry_run) {
5207
+ console.log("No changes made. Run with --yes to permanently erase these items.");
5208
+ } else if (result.failures === 0) {
5209
+ console.log("Local Recall data erased.");
5210
+ } else {
5211
+ console.error(`Purge incomplete: ${result.failures} action(s) failed.`);
5212
+ }
5213
+ }
4864
5214
  function findByPrefix(db, prefix) {
4865
5215
  const exact = getMemory(db, prefix);
4866
5216
  if (exact) return exact;