claude-mem-lite 3.86.0 → 3.88.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.
package/server.mjs CHANGED
@@ -50,7 +50,7 @@ import { ensureRegistryDb, collectRegistryStats, listResourcesRanked, formatRegi
50
50
  import { IMPORT_STRING_FIELDS, importResource, removeResource, reindexResources } from './lib/registry-core.mjs';
51
51
  import { searchResources } from './registry-retriever.mjs';
52
52
  import { probeOtherSources as probeIdSources, bucketIdTokens, splitDeferredTokens } from './lib/id-routing.mjs';
53
- import { saveObservation } from './lib/save-observation.mjs';
53
+ import { saveObservation, formatSupersedeSkipped } from './lib/save-observation.mjs';
54
54
  import { applyObsUpdate } from './lib/observation-write.mjs';
55
55
  import { EXPORT_COLUMNS_SQL } from './lib/export-columns.mjs';
56
56
  import { liveObsFilterSql } from './lib/inject-search-core.mjs';
@@ -58,7 +58,7 @@ import { recallByFile } from './lib/recall-core.mjs';
58
58
  import { fetchRecent } from './lib/recent-core.mjs';
59
59
  import { AUTO_MERGE_THRESHOLD } from './lib/dedup-constants.mjs';
60
60
  import {
61
- insertDeferred, listOpenWithOrdinal, dropDeferred,
61
+ insertDeferred, listOpenWithOrdinal, dropDeferred, formatDropReasonHint,
62
62
  resolveDeferredIds, closeDeferredItems,
63
63
  getDeferredByIds, formatDeferredDetail,
64
64
  searchDeferredWork, formatDeferredSearchTrailer,
@@ -853,7 +853,9 @@ server.registerTool(
853
853
  // Resolve INSIDE tx + after dedup check so duplicate replays don't throw on
854
854
  // already-closed items. Mirrors mem-cli.mjs cmdSave shape.
855
855
  if (args.closes_deferred && args.closes_deferred.length > 0) {
856
- closesIds = resolveDeferredIds(db, project, args.closes_deferred);
856
+ // D#195: 'dropped' is closable by the close verb (kept in sync with
857
+ // mem-cli.mjs cmdSave — same policy, both faces).
858
+ closesIds = resolveDeferredIds(db, project, args.closes_deferred, { allowStatuses: ['open', 'dropped'] });
857
859
  closeDeferredItems(db, closesIds, r.id);
858
860
  }
859
861
  return r;
@@ -869,7 +871,10 @@ server.registerTool(
869
871
  }
870
872
 
871
873
  if (result.kind === 'duplicate') {
872
- return { content: [{ type: 'text', text: `Skipped: similar to existing #${result.existingId} in project "${project}". Use mem_get(ids=[${result.existingId}]) to review.` }] };
874
+ // D#201: this branch returns before the note below, so it renders its own.
875
+ const dupSkip = formatSupersedeSkipped(result.supersedeSkipped);
876
+ const dupText = `Skipped: similar to existing #${result.existingId} in project "${project}". Use mem_get(ids=[${result.existingId}]) to review.`;
877
+ return { content: [{ type: 'text', text: dupSkip ? `${dupText}\n${dupSkip}` : dupText }] };
873
878
  }
874
879
 
875
880
  const lessonNote = result.lessonCaptured ? ` 💡lesson captured` : '';
@@ -884,7 +889,10 @@ server.registerTool(
884
889
  // every save) — fill-only-empty, so an agent acting on the nudge still wins.
885
890
  const enrichNote = shouldQueueSaveEnrich(result) && queueSaveEnrich(result.id)
886
891
  ? ' (background enrichment queued)' : '';
887
- return { content: [{ type: 'text', text: `Saved as observation #${result.id} [${result.type}] in project "${project}".${lessonNote}${closedNote}${supersededNote}${enrichNote}${nudge}` }] };
892
+ // D#201: on its own line rather than inside the success sentence.
893
+ const skipNote = formatSupersedeSkipped(result.supersedeSkipped);
894
+ const savedText = `Saved as observation #${result.id} [${result.type}] in project "${project}".${lessonNote}${closedNote}${supersededNote}${enrichNote}${nudge}`;
895
+ return { content: [{ type: 'text', text: skipNote ? `${savedText}\n${skipNote}` : savedText }] };
888
896
  })
889
897
  );
890
898
 
@@ -960,7 +968,11 @@ server.registerTool(
960
968
  if (r.changed === 0) {
961
969
  return { content: [{ type: 'text', text: `D#${realId} was not in 'open' status — drop is a no-op.` }] };
962
970
  }
963
- return { content: [{ type: 'text', text: `Dropped D#${realId} in project "${project}". Reason: ${args.reason}` }] };
971
+ // D#195 (c): same advisory as the CLI's `defer drop`, so an agent reaching
972
+ // this through MCP gets the same steer toward `mem_save(closes_deferred)`.
973
+ const hint = formatDropReasonHint(args.reason);
974
+ const dropText = `Dropped D#${realId} in project "${project}". Reason: ${args.reason}`;
975
+ return { content: [{ type: 'text', text: hint ? `${dropText}\n${hint}` : dropText }] };
964
976
  })
965
977
  );
966
978