soul_self_evaluate
Self-evaluate a complex response by recording a descriptive summary of its dynamics, such as word count or relevance to the query.
Instructions
Record a self-evaluation of a complex response. Be descriptive: 'Response used 450 words for a simple question' not 'bad response'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| summary | Yes | Brief descriptive summary of the response and its dynamics |
Implementation Reference
- The handler function that executes the soul_self_evaluate tool logic. It takes a descriptive summary string, checks configuration, generates self-signals (MicroSignal) based on keywords in the summary (e.g., 'too long', 'too short', 'pattern match', 'successful'), and appends them to the signal store via appendSignals. Returns a formatted result string describing the number and types of signals generated.
export async function handleSoulEvaluate( summary: string, ): Promise<string> { const config = await loadConfig(); if (!config.selfEvaluation.enabled) { return "Self-evaluation is disabled in config."; } const frameworkEngine = new FrameworkEngine(); const store = await frameworkEngine.initialize(); const activeFrameworks = store.frameworks.filter( (f) => f.status === "active" || f.status === "questioning", ); // Generate self-signals from the summary const selfSignals: MicroSignal[] = []; const sessionKey = crypto.randomUUID().slice(0, 8); const selfWeight = config.selfEvaluation.weight; // 0.5x // Check for length/depth mismatch indicators if (/too (long|verbose|detailed|much)/i.test(summary)) { selfSignals.push({ timestamp: Date.now(), sessionKey, type: "disengagement", evidence: `Self-eval: ${summary.slice(0, 150)}`, source: "self", confidence: 0.6 * selfWeight, userSnippets: [], assistantSnippets: [], }); } if (/too (short|brief|terse)/i.test(summary)) { selfSignals.push({ timestamp: Date.now(), sessionKey, type: "depth_change", evidence: `Self-eval: ${summary.slice(0, 150)}`, source: "self", confidence: 0.6 * selfWeight, userSnippets: [], assistantSnippets: [], }); } if (/pattern.?match|generic|surface/i.test(summary)) { selfSignals.push({ timestamp: Date.now(), sessionKey, type: "correction", evidence: `Self-eval: detected pattern-matching instead of first-principles. ${summary.slice(0, 100)}`, source: "self", confidence: 0.5 * selfWeight, userSnippets: [], assistantSnippets: [], }); } if (/successful|well.?received|good fit|aligned/i.test(summary)) { selfSignals.push({ timestamp: Date.now(), sessionKey, type: "success", evidence: `Self-eval: ${summary.slice(0, 150)}`, source: "self", confidence: 0.5 * selfWeight, userSnippets: [], assistantSnippets: [], }); } // Always generate a general self-observation signal if (selfSignals.length === 0) { selfSignals.push({ timestamp: Date.now(), sessionKey, type: "depth_change", evidence: `Self-eval observation: ${summary.slice(0, 150)}`, source: "self", confidence: 0.4 * selfWeight, userSnippets: [], assistantSnippets: [], }); } await appendSignals(selfSignals); const frameworkNames = activeFrameworks.slice(0, 5).map((f) => f.name); return [ `Self-evaluation recorded: ${selfSignals.length} self-signal(s) (weighted at ${selfWeight}x).`, `Types: ${selfSignals.map((s) => s.type).join(", ")}`, "", `Active frameworks checked against: ${frameworkNames.join(", ")}`, "", "Self-signals will be factored into the next reflection cycle.", ].join("\n"); }