mcp-agents-memory 0.9.11 → 0.9.13

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/.env.example CHANGED
@@ -115,6 +115,9 @@ FORGET_THRESHOLD=0.5
115
115
  PROJECT_ALIAS_PROMOTER_ENABLED=false
116
116
  PROJECT_ALIAS_PROMOTER_INTERVAL_HOURS=24
117
117
  PROJECT_ALIAS_AUTO_APPLY=false
118
+ # Cap explicit user statements fed to the alias-judge prompt (most-recent N). Uncapped
119
+ # accumulation + double-serialization overflowed the 8192 ctx on local llama.cpp (Qwen3-14B).
120
+ PROJECT_ALIAS_EXPLICIT_PROMPT_CAP=5
118
121
 
119
122
  # ─────────────────────────────────────────────────────────────
120
123
  # Local LLM (ollama) — API 비용 없이 추론 가능한 역할에 적용
package/build/index.js CHANGED
@@ -56800,16 +56800,19 @@ async function judgePair(pair, tagsById, memoriesByTag) {
56800
56800
  const sourceMemories = memoriesByTag.get(source.id) ?? [];
56801
56801
  const targetMemories = memoriesByTag.get(target.id) ?? [];
56802
56802
  const allowedIds = collectAllowedMemoryIds(pair, sourceMemories, targetMemories);
56803
+ const promptSignals = { ...pair.signals };
56804
+ delete promptSignals.explicit_statement_previews;
56805
+ const explicitPromptCap = envInt("PROJECT_ALIAS_EXPLICIT_PROMPT_CAP", 5);
56803
56806
  const userPrompt = JSON.stringify(
56804
56807
  {
56805
56808
  task: "Judge whether Tag A and Tag B are the same project identity.",
56806
56809
  candidate_sources: Array.from(pair.sources),
56807
- signals: pair.signals,
56810
+ signals: promptSignals,
56808
56811
  tag_a_source_candidate: tagPayload(source),
56809
56812
  tag_b_target_candidate: tagPayload(target),
56810
56813
  tag_a_representative_memories: sourceMemories.map(formatMemoryForPrompt),
56811
56814
  tag_b_representative_memories: targetMemories.map(formatMemoryForPrompt),
56812
- explicit_user_statements: pair.explicitStatements.map(formatMemoryForPrompt)
56815
+ explicit_user_statements: pair.explicitStatements.slice(0, explicitPromptCap).map(formatMemoryForPrompt)
56813
56816
  },
56814
56817
  null,
56815
56818
  2
@@ -58924,11 +58927,10 @@ var CLUSTER_SYSTEM = `You are a keyword clustering assistant for a personal memo
58924
58927
  Given a list of d_tags (short hyphenated keywords) with their occurrence counts,
58925
58928
  group semantically similar tags that refer to the same project or topic.
58926
58929
 
58927
- OUTPUT strict JSON array:
58928
- [
58929
- { "canonical": "<best-slug>", "members": ["<tag1>", "<tag2>", ...] },
58930
- ...
58931
- ]
58930
+ OUTPUT strict JSON object (NOT a bare array):
58931
+ { "clusters": [
58932
+ { "canonical": "<best-slug>", "members": ["<tag1>", "<tag2>", ...] }
58933
+ ] }
58932
58934
 
58933
58935
  Rules:
58934
58936
  - canonical must be one of the input tags (pick the most descriptive one) or a clean slug if none fit
@@ -58936,6 +58938,25 @@ Rules:
58936
58938
  - Only group tags that clearly refer to the same project/topic
58937
58939
  - Tags with no similar counterparts become their own single-member cluster
58938
58940
  - Do NOT merge unrelated topics just because they share one word`;
58941
+ var CLUSTER_SCHEMA = {
58942
+ type: "object",
58943
+ properties: {
58944
+ clusters: {
58945
+ type: "array",
58946
+ items: {
58947
+ type: "object",
58948
+ properties: {
58949
+ canonical: { type: "string" },
58950
+ members: { type: "array", items: { type: "string" } }
58951
+ },
58952
+ required: ["canonical", "members"],
58953
+ additionalProperties: false
58954
+ }
58955
+ }
58956
+ },
58957
+ required: ["clusters"],
58958
+ additionalProperties: false
58959
+ };
58939
58960
  async function clusterDTags(tags) {
58940
58961
  if (tags.length === 0) return [];
58941
58962
  const tagList = tags.map((t) => `${t.tag} (${t.cnt}x)`).join(", ");
@@ -58946,9 +58967,10 @@ ${tagList}`;
58946
58967
  raw = await callRole("clusterer", {
58947
58968
  system: CLUSTER_SYSTEM,
58948
58969
  user: userPrompt,
58949
- responseFormat: "json",
58970
+ jsonSchema: CLUSTER_SCHEMA,
58950
58971
  enableThinking: false,
58951
- maxTokens: 512
58972
+ maxTokens: 4096
58973
+ // was 512 — 50개 태그 클러스터링 출력이 잘려 invalid JSON 폴백됨 (ctx 8192 내 여유)
58952
58974
  });
58953
58975
  } catch (err2) {
58954
58976
  console.error("\u26A0\uFE0F [DTagPromoter] clusterer call failed, falling back to no clustering:", err2);
@@ -58956,8 +58978,9 @@ ${tagList}`;
58956
58978
  }
58957
58979
  let parsed;
58958
58980
  try {
58959
- parsed = JSON.parse(raw);
58960
- if (!Array.isArray(parsed)) throw new Error("not an array");
58981
+ const obj = JSON.parse(raw);
58982
+ parsed = obj?.clusters;
58983
+ if (!Array.isArray(parsed)) throw new Error("no clusters array");
58961
58984
  } catch {
58962
58985
  console.error("\u26A0\uFE0F [DTagPromoter] clusterer returned invalid JSON, falling back:", raw.slice(0, 200));
58963
58986
  return tags.map((t) => ({ canonical: t.tag, members: [t.tag], total: t.cnt }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-agents-memory",
3
- "version": "0.9.11",
3
+ "version": "0.9.13",
4
4
  "description": "Long-term memory for AI agents with provenance tracking",
5
5
  "main": "build/index.js",
6
6
  "type": "module",