@edihasaj/recall 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{chunk-427VWTG6.js → chunk-53GKSF42.js} +5 -5
  2. package/dist/{chunk-THX57BL4.js → chunk-65XK27KK.js} +70 -31
  3. package/dist/chunk-65XK27KK.js.map +1 -0
  4. package/dist/{chunk-ZPAXZDWJ.js → chunk-6QFOCUEJ.js} +9 -9
  5. package/dist/chunk-6QFOCUEJ.js.map +1 -0
  6. package/dist/{chunk-ZXLAD4CS.js → chunk-7Q5CBVUT.js} +17 -7
  7. package/dist/{chunk-ZXLAD4CS.js.map → chunk-7Q5CBVUT.js.map} +1 -1
  8. package/dist/{chunk-FUDWE6KW.js → chunk-JO5LRCA2.js} +1 -5
  9. package/dist/{chunk-FUDWE6KW.js.map → chunk-JO5LRCA2.js.map} +1 -1
  10. package/dist/{chunk-MPWXWBSG.js → chunk-JSTZKFZR.js} +2 -2
  11. package/dist/{chunk-VP25EEOH.js → chunk-MMYLXICL.js} +2 -2
  12. package/dist/{chunk-6FE2IKPF.js → chunk-UWERS646.js} +2 -2
  13. package/dist/{cleanup-PE3BFDMV.js → cleanup-RHNBHBNP.js} +3 -3
  14. package/dist/cli.js +22 -20
  15. package/dist/cli.js.map +1 -1
  16. package/dist/daemon.js +11 -9
  17. package/dist/daemon.js.map +1 -1
  18. package/dist/{dispatcher-YCWDNYU3.js → dispatcher-ON7LNX6X.js} +3 -3
  19. package/dist/{ingest-LZXTAMEZ.js → ingest-MHPMJPUA.js} +2 -2
  20. package/dist/mcp.js +6 -6
  21. package/dist/{memory-value-L4VZNKK5.js → memory-value-6JUQEYJZ.js} +3 -3
  22. package/dist/{quality-MEI6N7IW.js → quality-HVTIOIXP.js} +4 -4
  23. package/dist/{retrieval-WDZXSBKB.js → retrieval-72EIHKRF.js} +3 -3
  24. package/dist/{tasks-6EJMXJQV.js → tasks-AJ62N26N.js} +3 -3
  25. package/package.json +1 -1
  26. package/dist/chunk-THX57BL4.js.map +0 -1
  27. package/dist/chunk-ZPAXZDWJ.js.map +0 -1
  28. /package/dist/{chunk-427VWTG6.js.map → chunk-53GKSF42.js.map} +0 -0
  29. /package/dist/{chunk-MPWXWBSG.js.map → chunk-JSTZKFZR.js.map} +0 -0
  30. /package/dist/{chunk-VP25EEOH.js.map → chunk-MMYLXICL.js.map} +0 -0
  31. /package/dist/{chunk-6FE2IKPF.js.map → chunk-UWERS646.js.map} +0 -0
  32. /package/dist/{cleanup-PE3BFDMV.js.map → cleanup-RHNBHBNP.js.map} +0 -0
  33. /package/dist/{dispatcher-YCWDNYU3.js.map → dispatcher-ON7LNX6X.js.map} +0 -0
  34. /package/dist/{ingest-LZXTAMEZ.js.map → ingest-MHPMJPUA.js.map} +0 -0
  35. /package/dist/{memory-value-L4VZNKK5.js.map → memory-value-6JUQEYJZ.js.map} +0 -0
  36. /package/dist/{quality-MEI6N7IW.js.map → quality-HVTIOIXP.js.map} +0 -0
  37. /package/dist/{retrieval-WDZXSBKB.js.map → retrieval-72EIHKRF.js.map} +0 -0
  38. /package/dist/{tasks-6EJMXJQV.js.map → tasks-AJ62N26N.js.map} +0 -0
@@ -11,7 +11,7 @@ import {
11
11
  listInjectedHistoryIdsForSession,
12
12
  signalOutcomeFallback,
13
13
  startSessionLifecycle
14
- } from "./chunk-ZXLAD4CS.js";
14
+ } from "./chunk-7Q5CBVUT.js";
15
15
  import {
16
16
  detectCorrections,
17
17
  isHighRiskRule,
@@ -19,7 +19,7 @@ import {
19
19
  isWorkspaceRootAlias,
20
20
  peekTasks,
21
21
  redactSensitiveText
22
- } from "./chunk-THX57BL4.js";
22
+ } from "./chunk-65XK27KK.js";
23
23
  import {
24
24
  detectAndRecordRetrievalMissesSemantic,
25
25
  listInjectedMemoryIdsForSession,
@@ -27,7 +27,7 @@ import {
27
27
  pathMatchesMemory,
28
28
  recordCompletionUseValueEventsSemantic,
29
29
  toolCallTouchesMemory
30
- } from "./chunk-MPWXWBSG.js";
30
+ } from "./chunk-JSTZKFZR.js";
31
31
  import {
32
32
  textMatches
33
33
  } from "./chunk-FHEH6QDU.js";
@@ -37,7 +37,7 @@ import {
37
37
  import {
38
38
  hookCallDedupeKey,
39
39
  queryMemories
40
- } from "./chunk-FUDWE6KW.js";
40
+ } from "./chunk-JO5LRCA2.js";
41
41
  import {
42
42
  tagActivitySource
43
43
  } from "./chunk-JKWK73GY.js";
@@ -1196,4 +1196,4 @@ export {
1196
1196
  readCodexSessionEndInputFromStdin,
1197
1197
  dispatchCodexNotify
1198
1198
  };
1199
- //# sourceMappingURL=chunk-427VWTG6.js.map
1199
+ //# sourceMappingURL=chunk-53GKSF42.js.map
@@ -12,7 +12,6 @@ import {
12
12
  defineOwn,
13
13
  demoteMemory,
14
14
  getMemory,
15
- getMemoryFeedback,
16
15
  incrementMemoryRepetition,
17
16
  listMemories,
18
17
  memoryDedupeKey,
@@ -21,7 +20,7 @@ import {
21
20
  queryMemories,
22
21
  restoreAutoInject,
23
22
  updateMemoryCaptureContext
24
- } from "./chunk-FUDWE6KW.js";
23
+ } from "./chunk-JO5LRCA2.js";
25
24
  import {
26
25
  CONFIDENCE,
27
26
  LlmCredentialError,
@@ -614,6 +613,10 @@ function buildExtractRulesFromPromptPrompt(task) {
614
613
  " (a) Imperative \u2014 telling the agent what to always/never do, or what to prefer.",
615
614
  " (b) Durable \u2014 the user expects it to apply across future sessions, not just this one task.",
616
615
  " (c) Specific \u2014 concrete enough that an agent can follow it without further clarification.",
616
+ "Judge durability from MEANING and conversational context in whatever language the user used; never require magic keywords or a special syntax. Habitual behavior, standing preferences, defaults, and repo/team conventions can be durable even without words equivalent to 'always' or 'never'.",
617
+ "Current-task authorization is NOT durable memory: 'don't commit', 'do not push', 'no commit/push', 'work in the existing worktree', and semantic equivalents in any language normally apply only to the live task. Explicit persistence wording is strong evidence, but not required when the meaning clearly describes an ongoing policy.",
618
+ "For every returned rule set durability='durable'|'ephemeral'|'ambiguous' and durability_evidence to an exact short quote from USER PROMPT in its original language that supports the judgment. Return only durable rules; the other labels are accepted defensively but will be discarded.",
619
+ "Do not return scope='session'. Session-only instructions remain in conversation context and must not enter the persistent memory store.",
617
620
  "Recognize rules in ANY natural language (English, Spanish, French, German, Italian, Portuguese, Russian, Chinese, Japanese, Albanian, Turkish, Arabic, \u2026). When the source is non-English, return the cleaned rule TEXT in English so memories are searchable across sessions.",
618
621
  "REJECT (return empty list):",
619
622
  " \u2022 Questions ('should we use X?'), one-off task requests ('please fix this bug now'), narration ('I never use X' as description of past behavior), code paste, error logs, transcripts.",
@@ -638,7 +641,7 @@ function buildExtractRulesFromPromptPrompt(task) {
638
641
  `USER PROMPT:`,
639
642
  JSON.stringify(payload.raw_prompt ?? ""),
640
643
  "",
641
- 'Return JSON: {"rules": [{"text": string, "type": "rule"|"decision"|"review_pattern"|"command"|"gotcha", "scope": "session"|"path"|"repo"|"team"|"global", "path_scope": string|null, "confidence": number, "is_destructive_risky": boolean, "rationale": string}], "dropped_reason": string?}',
644
+ 'Return JSON: {"rules": [{"text": string, "type": "rule"|"decision"|"review_pattern"|"command"|"gotcha", "scope": "session"|"path"|"repo"|"team"|"global", "path_scope": string|null, "confidence": number, "durability": "durable"|"ephemeral"|"ambiguous", "durability_evidence": string|null, "is_destructive_risky": boolean, "rationale": string}], "dropped_reason": string?}',
642
645
  'When the prompt contains no durable rule, return {"rules": []} with a brief dropped_reason.'
643
646
  ].join("\n");
644
647
  return { system, user, max_output_tokens: 1600 };
@@ -1276,6 +1279,47 @@ var INJECTION_ARTIFACT_RE = new RegExp(
1276
1279
  "i"
1277
1280
  );
1278
1281
  var EPHEMERAL_TASK_CONTEXT_RE = /(?:^\s*\/goal\b|pause for (?:the )?user\b|this is task def(?:inition)?:|key details\s+description\s+(?:goal|background)\b|link to jira ticket|what(?:'|’)s changed\?|this article lists the tools we use for development|required software on node)/i;
1282
+ var OPERATIONAL_REPORT_MARKERS = [
1283
+ /(?:^|\n)\s*(?:✏️|❓|✅|❌)\s*(?:review|test|checkout)\s*:/iu,
1284
+ /\bTouch-map\s*:/i,
1285
+ /\b\d+\/\d+ gates passed\b/i,
1286
+ /\b(?:gates|checkout) skipped\b/i,
1287
+ /\bUsage Error\s*:/i,
1288
+ /\b(?:no provider review|verdict from gates only)\b/i,
1289
+ /\bLocal review only for this repo\b/i
1290
+ ];
1291
+ function looksLikePastedOperationalReport(text) {
1292
+ if (text.length < 500 || !text.includes("\n")) return false;
1293
+ const leadingRequest = text.split(/\r?\n\s*\r?\n/, 1)[0] ?? "";
1294
+ if (DURABLE_INTENT_MARKER_RE.test(leadingRequest)) return false;
1295
+ const markerCount = OPERATIONAL_REPORT_MARKERS.reduce(
1296
+ (count, marker) => count + (marker.test(text) ? 1 : 0),
1297
+ 0
1298
+ );
1299
+ return markerCount >= 2;
1300
+ }
1301
+ var DURABLE_INTENT_MARKER_RE = /\b(?:always|never|from now on|going forward|henceforth|every time|whenever|by default|make (?:this|it) a rule|remember this|save this|for this repo|for this project|repo-wide|project-wide|across (?:all )?(?:repos|projects)|globally|everywhere)\b/i;
1302
+ var GENERIC_CHANGE_CONTROL_RE = new RegExp(
1303
+ [
1304
+ "(?:do\\s+not|don't|no)\\s+(?:commit|push)(?:\\s*(?:\\/|or|and)\\s*(?:commit|push))?(?:\\s+(?:any\\s+)?(?:changes?|work|anything|repository\\s+changes?|from\\s+this\\s+worktree))?",
1305
+ "without\\s+(?:committing|pushing)(?:\\s+or\\s+(?:committing|pushing))?"
1306
+ ].join("|"),
1307
+ "i"
1308
+ );
1309
+ function changeControlClauses(text) {
1310
+ return text.split(/(?:\r?\n|[.!?;])+/).map((clause) => clause.trim()).filter((clause) => /\b(?:commit|push|committing|pushing)\b/i.test(clause));
1311
+ }
1312
+ function isEphemeralTaskConstraint(ruleText, rawPrompt) {
1313
+ if (!GENERIC_CHANGE_CONTROL_RE.test(ruleText)) return false;
1314
+ if (/\b(?:secret|credential|token|private key|\.env|config(?:uration)?|generated file|lockfile)s?\b/i.test(ruleText)) {
1315
+ return false;
1316
+ }
1317
+ const sourceClauses = changeControlClauses(rawPrompt);
1318
+ if (sourceClauses.length === 0) return false;
1319
+ const matchingClauses = sourceClauses.filter((clause) => GENERIC_CHANGE_CONTROL_RE.test(clause));
1320
+ if (matchingClauses.length === 0) return false;
1321
+ return matchingClauses.every((clause) => !DURABLE_INTENT_MARKER_RE.test(clause));
1322
+ }
1279
1323
  var LLM_WORKER_PROMPT_RE = /(?:^\s*you are (?:the|an?)\s+[^\n]{0,80}?\b(?:worker|judge|extractor|summari[sz]er|compactor|classifier|grader|scorer|labeler)\b|\bfor a personal agent runtime\b|\breturn json only\b[^\n]{0,60}\bno (?:markdown|prose)\b)/i;
1280
1324
  var CODEX_INTERNAL_PROMPT_RE = /(?:^\s*generate a title and a git branch name for a coding agent\b|^\s*#\s*overview\s+generate\s+0\s+to\s+3\s+hyperpersonalized suggestions for what this user can do with codex\b|^\s*you are an expert at upholding safety and compliance standards for codex ambient suggestions\b|^\s*you are the implementation worker for one isolated git worktree\b|^\s*you are reviewing github pull request\b[^\n]*\bon behalf of the maintainer\b|^\s*#\s*github issue workorder\s*:|^\s*continue the previous coding task using user-provided context only\b)/i;
1281
1325
  function looksLikeQuestionContext(text) {
@@ -1292,7 +1336,7 @@ function looksLikeQuestionContext(text) {
1292
1336
  return /\?\s*$/.test(text.trim()) || /(?:^|[.!?]\s+)(?:how|why|what|where|which|who|can|could|should|would|do|does|did|is|are|was|were|have|has)\b/i.test(text);
1293
1337
  }
1294
1338
  function isNonUserCaptureContext(text) {
1295
- return SYSTEM_SCAFFOLD_RE.test(text) || NON_USER_CONTEXT_RE.test(text) || INJECTION_ARTIFACT_RE.test(text) || EPHEMERAL_TASK_CONTEXT_RE.test(text) || LLM_WORKER_PROMPT_RE.test(text) || CODEX_INTERNAL_PROMPT_RE.test(text) || looksLikeQuestionContext(text);
1339
+ return SYSTEM_SCAFFOLD_RE.test(text) || NON_USER_CONTEXT_RE.test(text) || INJECTION_ARTIFACT_RE.test(text) || EPHEMERAL_TASK_CONTEXT_RE.test(text) || looksLikePastedOperationalReport(text) || LLM_WORKER_PROMPT_RE.test(text) || CODEX_INTERNAL_PROMPT_RE.test(text) || looksLikeQuestionContext(text);
1296
1340
  }
1297
1341
 
1298
1342
  // src/scanner/signal.ts
@@ -2020,11 +2064,13 @@ function planPromoteRepeats(db) {
2020
2064
  text: memories.text,
2021
2065
  repetition_count: memories.repetition_count,
2022
2066
  source: memories.source,
2023
- status: memories.status
2067
+ status: memories.status,
2068
+ scope: memories.scope
2024
2069
  }).from(memories).where(and(eq(memories.status, "candidate"), eq(memories.source, "user_correction"))).all();
2025
2070
  const out = [];
2026
2071
  for (const row of rows) {
2027
2072
  const text = row.text.trim();
2073
+ if (row.scope === "session") continue;
2028
2074
  if (qualityReasons(text).length > 0) continue;
2029
2075
  if (isDestructiveRisky(text)) continue;
2030
2076
  if (row.repetition_count >= 2) {
@@ -2568,6 +2614,7 @@ var TRANSCRIPT_MARKERS = [
2568
2614
  var DURABLE_DECISION_HINT = /\b(repo|repository|project|default|defaults|convention(?:al|s)?|configured|config|editorconfig|prettier|eslint|tsconfig|package\.json|ci|workflow|style|pattern|architecture|runtime|database|sqlite|pnpm|yarn|npm|uv|pytest|vitest)\b/i;
2569
2615
  var TRANSCRIPT_LINE_RE = /^(?:[⏺⎿❯✻※]|(?:Bash|Edit|Write|Read|Grep|Glob|Task|TodoWrite)\(|\s*(?:│|├|┌|└|─)|\s*…|\s*={3,})/u;
2570
2616
  function looksLikePastedTranscript(text) {
2617
+ if (looksLikePastedOperationalReport(text)) return true;
2571
2618
  if (text.length < 1200) return false;
2572
2619
  const markerCount = TRANSCRIPT_MARKERS.reduce(
2573
2620
  (total, marker) => total + (text.includes(marker) ? 1 : 0),
@@ -2592,7 +2639,7 @@ function isDurableDecision(segment, first, second) {
2592
2639
  async function processCorrection(db, text, ctx) {
2593
2640
  text = redactSensitiveText(text);
2594
2641
  if (isNonUserCaptureContext(text)) return { ids: [] };
2595
- if (process.env.RECALL_LLM_CAPTURE_DISABLED !== "true" && hasAnyLlmProvider() && isPromptWorthLLM(text)) {
2642
+ if (process.env.RECALL_LLM_CAPTURE_DISABLED !== "true" && hasAnyLlmProvider() && (ctx.force_semantic_capture || isPromptWorthLLM(text))) {
2596
2643
  const promptId = stablePromptId(ctx.sessionId, ctx.repo, text);
2597
2644
  const taskId = enqueueExtractRulesFromPrompt(db, {
2598
2645
  prompt_id: promptId,
@@ -2608,6 +2655,14 @@ async function processCorrection(db, text, ctx) {
2608
2655
  return { ids: [], pendingTaskId: taskId ?? `dedup:${promptId}` };
2609
2656
  }
2610
2657
  const corrections = detectCorrections(text);
2658
+ if (corrections.length === 0 && ctx.force_semantic_capture) {
2659
+ corrections.push({
2660
+ type: "rule",
2661
+ text: ensureSentence(text),
2662
+ confidence: 0.35,
2663
+ original: text
2664
+ });
2665
+ }
2611
2666
  if (corrections.length === 0) return { ids: [] };
2612
2667
  const profile = getRepoQualityProfile(db, ctx.repo);
2613
2668
  const ids = [];
@@ -2673,6 +2728,7 @@ async function processCorrection(db, text, ctx) {
2673
2728
  original_text: text
2674
2729
  }
2675
2730
  );
2731
+ if (inferredScope.scope === "session") continue;
2676
2732
  const input = {
2677
2733
  type: correction.type,
2678
2734
  text: correction.text,
@@ -2688,7 +2744,6 @@ async function processCorrection(db, text, ctx) {
2688
2744
  capture_context: captureContext
2689
2745
  };
2690
2746
  const id = createMemory(db, input);
2691
- maybePromoteGroupCandidate(db, id);
2692
2747
  enqueueVerifyCapture(db, {
2693
2748
  id,
2694
2749
  text: input.text,
@@ -2705,29 +2760,6 @@ function stablePromptId(sessionId, repo, text) {
2705
2760
  const hash = createHash("sha256").update(`${sessionId}${repo ?? ""}${normalizeDedupeText(text)}`).digest("hex").slice(0, 16);
2706
2761
  return `prompt:${sessionId}:${hash}`;
2707
2762
  }
2708
- function maybePromoteGroupCandidate(db, candidateId) {
2709
- const candidate = getMemory(db, candidateId);
2710
- if (!candidate || candidate.status !== "candidate") return;
2711
- if (isHighRiskRule(candidate.text)) return;
2712
- const followedCount = queryMemories(db, {
2713
- repo: candidate.repo ?? void 0,
2714
- type: candidate.type,
2715
- scope: candidate.scope
2716
- }).filter((memory) => memory.id !== candidate.id).reduce((total, memory) => total + getMemoryFeedback(db, memory.id).filter((entry) => entry.outcome === "followed").length, 0);
2717
- if (followedCount < 3) return;
2718
- const before = candidate;
2719
- promoteMemory(db, candidate.id, "repeat_correction");
2720
- const after = getMemory(db, candidate.id);
2721
- recordAuditWithSnapshot(
2722
- db,
2723
- candidate.id,
2724
- "promoted",
2725
- "system",
2726
- `repetition:group_followed:${followedCount}`,
2727
- before,
2728
- after ?? null
2729
- );
2730
- }
2731
2763
  function buildCaptureContext(ctx) {
2732
2764
  const recentToolCalls = (ctx.recent_tool_calls ?? []).slice(-5).map((toolCall) => ({
2733
2765
  name: toolCall.name,
@@ -3126,6 +3158,9 @@ function applyExtractRulesFromPrompt(db, task, result) {
3126
3158
  const reinforcedIds = [];
3127
3159
  const sessionId = payload.session_id ?? "unknown";
3128
3160
  for (const rule of result.rules) {
3161
+ if (rule.scope === "session" || rule.durability === "ephemeral" || rule.durability === "ambiguous" || rule.durability !== "durable" && isEphemeralTaskConstraint(rule.text, payload.raw_prompt ?? "")) {
3162
+ continue;
3163
+ }
3129
3164
  const evidence = {
3130
3165
  type: "session_correction",
3131
3166
  session: sessionId,
@@ -3821,6 +3856,10 @@ var ExtractedRule = z.object({
3821
3856
  scope: MemoryScope,
3822
3857
  path_scope: z.string().max(512).nullable().optional(),
3823
3858
  confidence: z.number().min(0).max(1),
3859
+ // Optional for compatibility with already-queued tasks and older model
3860
+ // responses. New extraction prompts require this semantic judgment.
3861
+ durability: z.enum(["durable", "ephemeral", "ambiguous"]).optional(),
3862
+ durability_evidence: z.string().max(500).nullable().optional(),
3824
3863
  is_destructive_risky: z.boolean().optional(),
3825
3864
  rationale: z.string().max(500).nullable().optional()
3826
3865
  });
@@ -4079,4 +4118,4 @@ export {
4079
4118
  processCorrection,
4080
4119
  processReviewFeedback
4081
4120
  };
4082
- //# sourceMappingURL=chunk-THX57BL4.js.map
4121
+ //# sourceMappingURL=chunk-65XK27KK.js.map