tuna-agent 0.1.31 → 0.1.33
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.
|
@@ -10,7 +10,11 @@ export interface AgentMetrics {
|
|
|
10
10
|
reflectionCount: number;
|
|
11
11
|
reflectionSkipCount: number;
|
|
12
12
|
patternsLearnedCount: number;
|
|
13
|
+
rulesCount: number;
|
|
13
14
|
lastTaskAt: string | null;
|
|
15
|
+
lastReflectionAt: string | null;
|
|
16
|
+
lastPatternAt: string | null;
|
|
17
|
+
latestLearnedRule: string | null;
|
|
14
18
|
upSince: string;
|
|
15
19
|
}
|
|
16
20
|
export declare class ClaudeCodeAdapter implements AgentAdapter {
|
|
@@ -24,7 +24,11 @@ export class ClaudeCodeAdapter {
|
|
|
24
24
|
reflectionCount: 0,
|
|
25
25
|
reflectionSkipCount: 0,
|
|
26
26
|
patternsLearnedCount: 0,
|
|
27
|
+
rulesCount: 0,
|
|
27
28
|
lastTaskAt: null,
|
|
29
|
+
lastReflectionAt: null,
|
|
30
|
+
lastPatternAt: null,
|
|
31
|
+
latestLearnedRule: null,
|
|
28
32
|
upSince: new Date().toISOString(),
|
|
29
33
|
};
|
|
30
34
|
constructor(config) {
|
|
@@ -723,6 +727,7 @@ export class ClaudeCodeAdapter {
|
|
|
723
727
|
console.log(`[Reflection] Storing: "${aiReflection.substring(0, 100)}..."`);
|
|
724
728
|
await callMem0AddMemory(aiReflection, this.agentConfig.name);
|
|
725
729
|
this.metrics.reflectionCount++;
|
|
730
|
+
this.metrics.lastReflectionAt = new Date().toISOString();
|
|
726
731
|
console.log(`[Reflection] Stored for task ${task.id}`);
|
|
727
732
|
}
|
|
728
733
|
catch (err) {
|
|
@@ -811,6 +816,9 @@ export class ClaudeCodeAdapter {
|
|
|
811
816
|
fs.writeFileSync(claudeMdPath, existingContent + separator + `${SECTION_HEADER}\n${rulesBlock}\n`);
|
|
812
817
|
}
|
|
813
818
|
this.metrics.patternsLearnedCount += newPatterns.length;
|
|
819
|
+
this.metrics.rulesCount += newPatterns.length;
|
|
820
|
+
this.metrics.lastPatternAt = new Date().toISOString();
|
|
821
|
+
this.metrics.latestLearnedRule = newPatterns[newPatterns.length - 1].rule.substring(0, 500);
|
|
814
822
|
console.log(`[Self-Improve] Added ${newPatterns.length} new rules to CLAUDE.md:`);
|
|
815
823
|
newPatterns.forEach(p => console.log(`[Self-Improve] - ${p.rule}`));
|
|
816
824
|
}
|
package/dist/mcp/setup.js
CHANGED
|
@@ -308,6 +308,9 @@ export function getMcpConfigPath() {
|
|
|
308
308
|
export function writeAgentFolderMcpConfig(agentFolderPath, config) {
|
|
309
309
|
const knowledgeServerPath = path.join(__dirname, 'knowledge-server.js');
|
|
310
310
|
const browserServerPath = path.join(__dirname, 'browser-server.js');
|
|
311
|
+
// Derive agent name from folder path (e.g. ~/agents/co-founder → "co-founder")
|
|
312
|
+
// config.name is the machine name, NOT the agent name
|
|
313
|
+
const agentName = path.basename(agentFolderPath) || config.name;
|
|
311
314
|
try {
|
|
312
315
|
const mcpJsonPath = path.join(agentFolderPath, '.mcp.json');
|
|
313
316
|
// Read existing .mcp.json to preserve other servers (e.g. playwright)
|
|
@@ -332,7 +335,7 @@ export function writeAgentFolderMcpConfig(agentFolderPath, config) {
|
|
|
332
335
|
args: [browserServerPath, '--user-data-dir', path.join(process.env.HOME || '', '.config', 'tuna-browser', 'chrome-profile')],
|
|
333
336
|
},
|
|
334
337
|
};
|
|
335
|
-
const mem0Config = buildMem0McpConfig(
|
|
338
|
+
const mem0Config = buildMem0McpConfig(agentName);
|
|
336
339
|
if (mem0Config) {
|
|
337
340
|
newServers['mem0'] = mem0Config;
|
|
338
341
|
}
|