tuna-agent 0.1.14 → 0.1.16
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.
|
@@ -651,37 +651,21 @@ export class ClaudeCodeAdapter {
|
|
|
651
651
|
if (task.enableReflection === false)
|
|
652
652
|
return;
|
|
653
653
|
if (!process.env.MEM0_SSH_HOST)
|
|
654
|
-
return;
|
|
655
|
-
// Skip trivial tasks (< 30s would have no meaningful reflection)
|
|
654
|
+
return;
|
|
656
655
|
const MIN_DESCRIPTION_LENGTH = 20;
|
|
657
656
|
if (task.description.length < MIN_DESCRIPTION_LENGTH)
|
|
658
657
|
return;
|
|
659
|
-
const
|
|
660
|
-
const
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
Task: ${truncatedDesc}
|
|
664
|
-
Status: ${status}
|
|
665
|
-
Result summary: ${truncatedResult}
|
|
666
|
-
|
|
667
|
-
Instructions:
|
|
668
|
-
1. Think about what went well and what could be improved (2-3 sentences max)
|
|
669
|
-
2. Call the mem0 add_memory tool to store your reflection
|
|
670
|
-
3. Do NOT do anything else — no file edits, no other tool calls`;
|
|
658
|
+
const taskContext = task.description.substring(0, 150);
|
|
659
|
+
const resultContext = resultSummary.substring(0, 200);
|
|
660
|
+
const statusLabel = status === 'done' ? 'COMPLETED' : 'FAILED';
|
|
661
|
+
const memoryText = `[TASK ${statusLabel}] "${taskContext}". Result: ${resultContext}`;
|
|
671
662
|
try {
|
|
672
|
-
console.log(`[Reflection]
|
|
673
|
-
await
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
maxTurns: 3,
|
|
677
|
-
outputFormat: 'json',
|
|
678
|
-
timeoutMs: 30000,
|
|
679
|
-
permissionMode: 'bypassPermissions',
|
|
680
|
-
});
|
|
681
|
-
console.log(`[Reflection] Reflection complete for task ${task.id}`);
|
|
663
|
+
console.log(`[Reflection] Storing reflection for task ${task.id} (${status})`);
|
|
664
|
+
const { callMem0AddMemory } = await import('../mcp/setup.js');
|
|
665
|
+
await callMem0AddMemory(memoryText, this.agentConfig.name);
|
|
666
|
+
console.log(`[Reflection] Reflection stored for task ${task.id}`);
|
|
682
667
|
}
|
|
683
668
|
catch (err) {
|
|
684
|
-
// Non-fatal — don't let reflection failure affect task flow
|
|
685
669
|
console.warn(`[Reflection] Failed for task ${task.id}:`, err instanceof Error ? err.message : err);
|
|
686
670
|
}
|
|
687
671
|
}
|
|
@@ -691,9 +675,13 @@ Instructions:
|
|
|
691
675
|
async storeRatingMemory(data) {
|
|
692
676
|
if (!process.env.MEM0_SSH_HOST)
|
|
693
677
|
return;
|
|
694
|
-
const
|
|
695
|
-
const
|
|
696
|
-
const
|
|
678
|
+
const rating = data.score > 0 ? 'GOOD (👍)' : 'BAD (👎)';
|
|
679
|
+
const taskContext = (data.taskTitle || data.taskDescription).substring(0, 100);
|
|
680
|
+
const parts = [`[USER RATING: ${rating}] Task: "${taskContext}"`];
|
|
681
|
+
if (data.comment) {
|
|
682
|
+
parts.push(`User comment: "${data.comment}"`);
|
|
683
|
+
}
|
|
684
|
+
const memoryText = parts.join('. ');
|
|
697
685
|
try {
|
|
698
686
|
console.log(`[Rating→Mem0] Storing rating for task "${data.taskTitle}" (${data.score > 0 ? '👍' : '👎'})`);
|
|
699
687
|
const { callMem0AddMemory } = await import('../mcp/setup.js');
|