@edihasaj/recall 0.9.7 → 0.9.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 (46) hide show
  1. package/README.md +26 -1
  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 +401 -38
  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, realpathSync } from "fs";
144
+ import { join as join12 } from "path";
140
145
 
141
146
  // src/ump/serve.ts
142
147
  import {
@@ -2220,7 +2225,7 @@ function skipped(message) {
2220
2225
 
2221
2226
  // src/cli.ts
2222
2227
  import { createRequire } from "module";
2223
- import { pathToFileURL } from "url";
2228
+ import { fileURLToPath as fileURLToPath5 } from "url";
2224
2229
 
2225
2230
  // src/doctor/report.ts
2226
2231
  import { existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
@@ -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,10 +3175,288 @@ 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");
3163
3456
  var program = new Command();
3457
+ function defaultRecallAppPath(platform = process.platform) {
3458
+ return platform === "darwin" ? "/Applications/Recall.app" : void 0;
3459
+ }
3164
3460
  program.name("recall").description("Cross-tool coding memory and instruction compiler").version(pkg.version);
3165
3461
  program.command("init").description("Initialize Recall database").action(() => {
3166
3462
  initDb();
@@ -3252,8 +3548,35 @@ dbCmd.command("restore <date>").description("Restore the local database from a d
3252
3548
  }
3253
3549
  console.log(`Restored ${result.from} -> ${result.to}`);
3254
3550
  });
3551
+ var dataCmd = program.command("data").description("Manage all local Recall data");
3552
+ 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) => {
3553
+ if (!opts.dryRun && !opts.yes) {
3554
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
3555
+ console.error("Refusing to purge without --yes in non-interactive mode.");
3556
+ process.exitCode = 2;
3557
+ return;
3558
+ }
3559
+ const confirmed = await confirmLocalDataPurge();
3560
+ if (!confirmed) {
3561
+ console.error("Aborted local data purge.");
3562
+ process.exitCode = 1;
3563
+ return;
3564
+ }
3565
+ }
3566
+ const result = purgeLocalData({
3567
+ dataDir: opts.dataDir,
3568
+ dryRun: opts.dryRun,
3569
+ keepIntegrations: opts.keepIntegrations
3570
+ });
3571
+ if (opts.json) {
3572
+ console.log(JSON.stringify(result, null, 2));
3573
+ } else {
3574
+ printLocalDataPurgeResult(result);
3575
+ }
3576
+ if (result.failures > 0) process.exitCode = 1;
3577
+ });
3255
3578
  var setupCmd = program.command("setup").description("Setup Recall for local use");
3256
- 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) => {
3579
+ setupCmd.option("--app-path <path>", "Override Recall.app path", defaultRecallAppPath()).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
3580
  if (!opts.yes && !opts.dryRun) {
3258
3581
  const confirmed = await confirmSetupWrite(opts.scope);
3259
3582
  if (!confirmed) {
@@ -3304,7 +3627,7 @@ setupCmd.option("--app-path <path>", "Override Recall.app path", "/Applications/
3304
3627
  }
3305
3628
  }
3306
3629
  });
3307
- setupCmd.command("local").description("Configure local agent MCP + hooks against the installed Recall.app").option("--app-path <path>", "Override Recall.app path", "/Applications/Recall.app").option("--codex-only", "Configure only Codex").option("--claude-only", "Configure only Claude").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").action((opts) => {
3630
+ setupCmd.command("local").description("Configure local agent MCP + hooks against the installed Recall.app").option("--app-path <path>", "Override Recall.app path", defaultRecallAppPath()).option("--codex-only", "Configure only Codex").option("--claude-only", "Configure only Claude").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").action((opts) => {
3308
3631
  const result = runLocalSetup({
3309
3632
  appPath: opts.appPath,
3310
3633
  codex: opts.claudeOnly ? false : true,
@@ -3331,17 +3654,17 @@ function safeHookAction(event, action) {
3331
3654
  } catch (error) {
3332
3655
  let logPath = "~/.recall/logs/hook-errors.log";
3333
3656
  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");
3657
+ const { appendFileSync, mkdirSync: mkdirSync7, statSync, renameSync: renameSync4, rmSync: rmSync5 } = await import("fs");
3658
+ const { homedir: homedir5 } = await import("os");
3659
+ const dir = join12(homedir5(), ".recall", "logs");
3337
3660
  mkdirSync7(dir, { recursive: true });
3338
- logPath = join11(dir, "hook-errors.log");
3661
+ logPath = join12(dir, "hook-errors.log");
3339
3662
  try {
3340
3663
  const maxBytes = parseInt(process.env.RECALL_HOOK_LOG_MAX_BYTES ?? String(1024 * 1024), 10);
3341
3664
  if (maxBytes > 0 && statSync(logPath).size >= maxBytes) {
3342
3665
  const rotated = `${logPath}.1`;
3343
3666
  try {
3344
- rmSync4(rotated, { force: true });
3667
+ rmSync5(rotated, { force: true });
3345
3668
  } catch {
3346
3669
  }
3347
3670
  renameSync4(logPath, rotated);
@@ -3492,7 +3815,7 @@ program.command("ump").description("Serve the Universal Memory Protocol (UMP) ov
3492
3815
  });
3493
3816
  program.command("scan").description("Scan a repository and bootstrap memories").argument("[path]", "Repository path", ".").option("-s, --session <id>", "Session ID").action((path, opts) => {
3494
3817
  const db = initDb();
3495
- const repoPath = resolve7(path);
3818
+ const repoPath = resolve8(path);
3496
3819
  const ids = scanAndStore(db, repoPath);
3497
3820
  const artifact = writeRepoContextArtifact(db, {
3498
3821
  repo: inferRepoSlugFromPath(repoPath),
@@ -3738,7 +4061,7 @@ program.command("export").description("Export memories as markdown instruction f
3738
4061
  console.error(`Could not resolve local repo path for ${opts.repo}`);
3739
4062
  process.exit(1);
3740
4063
  }
3741
- content = readFileSync7(artifact.output_path, "utf-8");
4064
+ content = readFileSync8(artifact.output_path, "utf-8");
3742
4065
  if (!opts.output) {
3743
4066
  console.log(content);
3744
4067
  return;
@@ -3757,7 +4080,7 @@ program.command("export").description("Export memories as markdown instruction f
3757
4080
  });
3758
4081
  program.command("publish").description("Write repo-local .recall/context.md for the current repo").argument("[path]", "Repository path", ".").action((path) => {
3759
4082
  const db = initDb();
3760
- const repoPath = resolve7(path);
4083
+ const repoPath = resolve8(path);
3761
4084
  const artifact = writeRepoContextArtifact(db, {
3762
4085
  repo: inferRepoSlugFromPath(repoPath),
3763
4086
  repo_path: repoPath
@@ -3886,7 +4209,7 @@ evalCmd.command("value-retrieval").description("Run retrieval eval cases synthes
3886
4209
  });
3887
4210
  let snapshot = null;
3888
4211
  if (opts.snapshot) {
3889
- const { computeQualityReport, recordQualitySnapshot } = await import("./quality-5TZ3B4LR.js");
4212
+ const { computeQualityReport, recordQualitySnapshot } = await import("./quality-74KRD5CP.js");
3890
4213
  const qualityReport = computeQualityReport(db, { sinceIso: report.since });
3891
4214
  snapshot = recordQualitySnapshot(
3892
4215
  db,
@@ -4378,7 +4701,7 @@ graphCmd.command("stats").description("Show entity/relation counts").action(asyn
4378
4701
  });
4379
4702
  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
4703
  const db = initDb();
4381
- const { ingestMemoryHeuristic } = await import("./ingest-N6XSNRQH.js");
4704
+ const { ingestMemoryHeuristic } = await import("./ingest-S2KB2EY6.js");
4382
4705
  if (opts.rebuild) {
4383
4706
  const { clearGraph } = await import("./store-5C7ZKKZF.js");
4384
4707
  clearGraph(db);
@@ -4421,8 +4744,8 @@ graphCmd.command("entities").description("List entities").option("--repo <repo>"
4421
4744
  });
4422
4745
  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
4746
  const db = initDb();
4424
- const { graphQuery } = await import("./retrieval-IRYNANIM.js");
4425
- const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-FEYQRSRV.js");
4747
+ const { graphQuery } = await import("./retrieval-E5LOMDYJ.js");
4748
+ const { loadEmbeddingConfigFromEnv: loadEmbeddingConfigFromEnv2 } = await import("./embeddings-ER6YQSRM.js");
4426
4749
  const embeddingConfig = loadEmbeddingConfigFromEnv2();
4427
4750
  const result = await graphQuery(db, queryTokens.join(" "), embeddingConfig, {
4428
4751
  repo: opts.repo,
@@ -4438,7 +4761,7 @@ graphCmd.command("query <query...>").description("Run graph-aware retrieval for
4438
4761
  });
4439
4762
  var maintenanceCmd = program.command("maintenance").description("Inspect and manage the delegated maintenance task queue");
4440
4763
  maintenanceCmd.command("stats").description("Show backlog counts, completion stats, and mean latency").action(async () => {
4441
- const { getTaskStats } = await import("./tasks-UEJORN2X.js");
4764
+ const { getTaskStats } = await import("./tasks-Y6HOLQTQ.js");
4442
4765
  const db = initDb();
4443
4766
  const stats = getTaskStats(db);
4444
4767
  console.log(`Total tasks: ${stats.total}`);
@@ -4464,7 +4787,7 @@ maintenanceCmd.command("stats").description("Show backlog counts, completion sta
4464
4787
  }
4465
4788
  });
4466
4789
  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");
4790
+ const { listTasks } = await import("./tasks-Y6HOLQTQ.js");
4468
4791
  const db = initDb();
4469
4792
  const tasks = listTasks(db, {
4470
4793
  status: opts.status,
@@ -4486,7 +4809,7 @@ maintenanceCmd.command("list").description("List tasks (default: pending)").opti
4486
4809
  }
4487
4810
  });
4488
4811
  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");
4812
+ const { deleteTask, listTasks } = await import("./tasks-Y6HOLQTQ.js");
4490
4813
  const db = initDb();
4491
4814
  const all = listTasks(db, { limit: 1e4 });
4492
4815
  const matches = all.filter((t) => t.id === taskIdArg || t.id.startsWith(taskIdArg));
@@ -4505,7 +4828,7 @@ maintenanceCmd.command("drop").description("Delete a task by id (or id prefix)")
4505
4828
  });
4506
4829
  var credentialsCmd = maintenanceCmd.command("credentials").description("Manage LLM provider API keys in macOS Keychain (env fallback on other platforms)");
4507
4830
  credentialsCmd.command("list", { isDefault: true }).description("Show which providers have credentials available").action(async () => {
4508
- const { listCredentials } = await import("./keychain-PA25RZXE.js");
4831
+ const { listCredentials } = await import("./keychain-5KXUHKMF.js");
4509
4832
  const creds = listCredentials();
4510
4833
  if (creds.length === 0) {
4511
4834
  console.log("No API keys configured. Set one with:");
@@ -4519,7 +4842,7 @@ credentialsCmd.command("list", { isDefault: true }).description("Show which prov
4519
4842
  }
4520
4843
  });
4521
4844
  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");
4845
+ const { setApiKey, setAzureConfig } = await import("./keychain-5KXUHKMF.js");
4523
4846
  const provider = providerArg === "azure" ? "azure-openai" : providerArg;
4524
4847
  if (provider === "openai" || provider === "anthropic") {
4525
4848
  const key = keyArg ?? await readStdinKey();
@@ -4581,19 +4904,19 @@ credentialsCmd.command("set").description("Store credentials for an LLM provider
4581
4904
  process.exit(1);
4582
4905
  });
4583
4906
  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");
4907
+ const { deleteApiKey: deleteApiKey2 } = await import("./keychain-5KXUHKMF.js");
4585
4908
  const provider = providerArg === "azure" ? "azure-openai" : providerArg;
4586
4909
  if (provider !== "openai" && provider !== "anthropic" && provider !== "azure-openai") {
4587
4910
  console.error(`Provider must be "openai", "anthropic", or "azure", got "${providerArg}".`);
4588
4911
  process.exit(1);
4589
4912
  }
4590
- const removed = deleteApiKey(provider);
4913
+ const removed = deleteApiKey2(provider);
4591
4914
  if (removed) console.log(`Removed ${provider} credentials from Keychain.`);
4592
4915
  else console.log(`No ${provider} credentials found in Keychain.`);
4593
4916
  });
4594
4917
  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");
4918
+ const { dispatchPendingTasks, formatDispatchReport, buildPrompt } = await import("./dispatcher-CWKRKVT4.js");
4919
+ const { listTasks } = await import("./tasks-Y6HOLQTQ.js");
4597
4920
  const db = initDb();
4598
4921
  if (opts.preview) {
4599
4922
  const pending = listTasks(db, {
@@ -4650,7 +4973,7 @@ ${p.prompt.max_output_tokens}
4650
4973
  console.log(formatDispatchReport(report));
4651
4974
  });
4652
4975
  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");
4976
+ const { runDeterministicCleanup, formatCleanupReport, revertCleanupRun, listCleanupRuns } = await import("./cleanup-E7TX5RAW.js");
4654
4977
  const db = initDb();
4655
4978
  if (opts.list) {
4656
4979
  const runs = listCleanupRuns(db);
@@ -4704,7 +5027,7 @@ maintenanceCmd.command("quality").description("Show injection outcome distributi
4704
5027
  recordQualitySnapshot,
4705
5028
  listQualitySnapshots,
4706
5029
  diffQualitySnapshots
4707
- } = await import("./quality-5TZ3B4LR.js");
5030
+ } = await import("./quality-74KRD5CP.js");
4708
5031
  const db = initDb();
4709
5032
  if (opts.history) {
4710
5033
  const snaps = listQualitySnapshots(db);
@@ -4765,7 +5088,7 @@ maintenanceCmd.command("value-backfill").description("Backfill memory value even
4765
5088
  const {
4766
5089
  backfillMemoryValueEvents,
4767
5090
  formatMemoryValueBackfillReport
4768
- } = await import("./memory-value-X76RRECS.js");
5091
+ } = await import("./memory-value-NM24LKJY.js");
4769
5092
  const db = initDb();
4770
5093
  const report = backfillMemoryValueEvents(db, {
4771
5094
  sinceIso: opts.since,
@@ -4861,6 +5184,36 @@ async function confirmSetupWrite(scope) {
4861
5184
  rl.close();
4862
5185
  }
4863
5186
  }
5187
+ async function confirmLocalDataPurge() {
5188
+ const { createInterface } = await import("readline/promises");
5189
+ const rl = createInterface({
5190
+ input: process.stdin,
5191
+ output: process.stdout
5192
+ });
5193
+ try {
5194
+ console.log(
5195
+ "This permanently erases Recall databases, backups, logs, model caches, Keychain credentials, generated repo context, daemon service, hooks, rules, and MCP registrations."
5196
+ );
5197
+ const answer = await rl.question('Type "PURGE" to continue: ');
5198
+ return answer.trim() === "PURGE";
5199
+ } finally {
5200
+ rl.close();
5201
+ }
5202
+ }
5203
+ function printLocalDataPurgeResult(result) {
5204
+ console.log(result.dry_run ? "Recall local data purge plan:" : "Recall local data purge:");
5205
+ for (const action of result.actions) {
5206
+ const detail = action.detail ? ` (${action.detail})` : "";
5207
+ console.log(` ${action.status.padEnd(8)} ${action.target}${detail}`);
5208
+ }
5209
+ if (result.dry_run) {
5210
+ console.log("No changes made. Run with --yes to permanently erase these items.");
5211
+ } else if (result.failures === 0) {
5212
+ console.log("Local Recall data erased.");
5213
+ } else {
5214
+ console.error(`Purge incomplete: ${result.failures} action(s) failed.`);
5215
+ }
5216
+ }
4864
5217
  function findByPrefix(db, prefix) {
4865
5218
  const exact = getMemory(db, prefix);
4866
5219
  if (exact) return exact;
@@ -4874,10 +5227,20 @@ function findByPrefix(db, prefix) {
4874
5227
  }
4875
5228
  return void 0;
4876
5229
  }
4877
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
5230
+ function isDirectCliInvocation(moduleUrl, argvPath) {
5231
+ if (!argvPath) return false;
5232
+ try {
5233
+ return realpathSync(fileURLToPath5(moduleUrl)) === realpathSync(argvPath);
5234
+ } catch {
5235
+ return false;
5236
+ }
5237
+ }
5238
+ if (isDirectCliInvocation(import.meta.url, process.argv[1])) {
4878
5239
  await program.parseAsync(process.argv);
4879
5240
  }
4880
5241
  export {
5242
+ defaultRecallAppPath,
5243
+ isDirectCliInvocation,
4881
5244
  program
4882
5245
  };
4883
5246
  //# sourceMappingURL=cli.js.map