@just-every/task
Version:
Task - A Thoughtful Task Loop
52 lines • 1.94 kB
TypeScript
/**
* metacognition module for Task
*
* This module implements "thinking about thinking" capabilities for the Task system.
* It spawns an LLM agent that analyzes recent thought history and can adjust system
* parameters to improve performance.
*/
import { ResponseInput } from '@just-every/ensemble';
import type { TaskLocalState } from '../types/task-state.js';
/**
* Spawn a metacognition process to analyze and optimize agent performance
*
* Metacognition is Task's "thinking about thinking" capability. It:
* - Analyzes recent agent thoughts and tool usage patterns
* - Identifies inefficiencies, errors, and optimization opportunities
* - Can adjust system parameters (model scores, meta frequency, thought delay)
* - Injects strategic guidance into the agent's thought process
*
* The metacognition agent has access to specialized tools for system tuning
* and runs on high-quality reasoning models for optimal analysis.
*
* @param agent - The main agent being analyzed
* @param messages - The conversation history
* @param startTime - When the current task execution began (for performance analysis)
*
* @throws {TypeError} If any required parameters are invalid
*
* @example
* ```typescript
* // Triggered automatically based on meta frequency
* await spawnMetaThought(agent, messages, taskStartTime);
*
* // Metacognition might result in:
* // - Model score adjustments
* // - Injected strategic thoughts
* // - Changed meta frequency
* // - Disabled underperforming models
* ```
*/
export declare function spawnMetaThought(parent: {
agent_id?: string;
name?: string;
}, messages: ResponseInput, startTime: Date, taskRequestCount: number, taskLocalState: TaskLocalState): Promise<{
adjustments?: string[];
injectedThoughts?: string[];
toolCalls?: Array<{
name: string;
arguments: any;
summary: string;
}>;
}>;
//# sourceMappingURL=index.d.ts.map