@jungjaehoon/clawdbot-mama 0.2.0 → 0.2.1

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 (2) hide show
  1. package/index.ts +25 -2
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -23,6 +23,29 @@ const MAMA_MODULE_PATH = require.resolve("@jungjaehoon/mama-server/src/mama/mama
23
23
  let initialized = false;
24
24
  let mama: any = null;
25
25
 
26
+ /**
27
+ * Format reasoning with link extraction
28
+ * Shows truncated reasoning + preserves builds_on/debates/synthesizes links
29
+ */
30
+ function formatReasoning(reasoning: string, maxLen: number = 80): string {
31
+ if (!reasoning) return "";
32
+
33
+ // Extract link patterns
34
+ const linkMatch = reasoning.match(/(builds_on|debates|synthesizes):\s*[\w\[\],\s_-]+/i);
35
+
36
+ // Truncate main reasoning
37
+ const truncated = reasoning.length > maxLen
38
+ ? reasoning.substring(0, maxLen) + "..."
39
+ : reasoning;
40
+
41
+ // Add link info if found and not already in truncated part
42
+ if (linkMatch && !truncated.includes(linkMatch[0])) {
43
+ return `${truncated}\n 🔗 ${linkMatch[0]}`;
44
+ }
45
+
46
+ return truncated;
47
+ }
48
+
26
49
  /**
27
50
  * Initialize MAMA (lazy, once)
28
51
  */
@@ -99,7 +122,7 @@ const mamaPlugin = {
99
122
  const pct = Math.round((r.similarity || 0) * 100);
100
123
  content += `- **${r.topic}** [${pct}%]: ${r.decision}`;
101
124
  if (r.outcome) content += ` (${r.outcome})`;
102
- content += `\n _${(r.reasoning || "").substring(0, 100)}..._\n`;
125
+ content += `\n _${formatReasoning(r.reasoning, 100)}_\n`;
103
126
  content += ` ID: \`${r.id}\`\n`;
104
127
  });
105
128
  content += "\n";
@@ -251,7 +274,7 @@ const mamaPlugin = {
251
274
  const pct = Math.round((r.similarity || 0) * 100);
252
275
  output += `**${idx + 1}. ${r.topic}** [${pct}% match]\n`;
253
276
  output += ` Decision: ${r.decision}\n`;
254
- output += ` Reasoning: ${(r.reasoning || "").substring(0, 150)}...\n`;
277
+ output += ` Reasoning: ${formatReasoning(r.reasoning, 150)}\n`;
255
278
  output += ` ID: \`${r.id}\` | Outcome: ${r.outcome || "pending"}\n\n`;
256
279
  });
257
280
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jungjaehoon/clawdbot-mama",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "MAMA Memory Plugin for Clawdbot - Semantic decision memory with reasoning graph",
5
5
  "type": "module",
6
6
  "main": "index.ts",