get_insights
Retrieve processed cognitive insights from Claude's contemplation loop, filtered by thought type, significance, and quantity for analysis.
Instructions
Retrieve processed insights from contemplation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thought_type | No | Filter by thought type | |
| limit | No | Maximum insights to return (default 10) | |
| min_significance | No | Minimum significance score 1-10 (default 5) |
Implementation Reference
- src/index.ts:176-217 (handler)Core handler function implementing the get_insights tool logic: prunes, aggregates, filters, sorts insights by significance and recency, marks as used, and returns top results.async getInsights(thoughtType?: string, limit: number = 10): Promise<Insight[]> { // First, clean up old/low-value insights this.pruneInsights(); // Aggregate similar insights this.aggregateSimilarInsights(); // Filter unused insights above threshold let filtered = this.insights.filter(i => !i.used && i.significance >= this.significanceThreshold ); if (thoughtType) { filtered = filtered.filter(i => i.thought_type === thoughtType); } // Sort by significance and recency filtered.sort((a, b) => { // Prioritize aggregated insights if (a.similar_count && b.similar_count) { const countDiff = (b.similar_count || 1) - (a.similar_count || 1); if (countDiff !== 0) return countDiff; } if (b.significance !== a.significance) { return b.significance - a.significance; } return new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(); }); // Mark as used and clean from memory const results = filtered.slice(0, limit); results.forEach(insight => { insight.used = true; // Remove high-frequency patterns after use to prevent repetition if (insight.similar_count && insight.similar_count > 3) { this.removeInsight(insight.id); } }); return results; }
- src/index.ts:412-431 (schema)Input schema for the get_insights tool, defining parameters thought_type, limit, and min_significance with validation.inputSchema: { type: 'object', properties: { thought_type: { type: 'string', enum: ['pattern', 'connection', 'question', 'general'], description: 'Filter by thought type' }, limit: { type: 'number', description: 'Maximum insights to return (default 10)' }, min_significance: { type: 'number', description: 'Minimum significance score 1-10 (default 5)', minimum: 1, maximum: 10 } }, },
- src/index.ts:409-432 (registration)Registration of the get_insights tool in the ListTools response, including name, description, and input schema.{ name: 'get_insights', description: 'Retrieve processed insights from contemplation', inputSchema: { type: 'object', properties: { thought_type: { type: 'string', enum: ['pattern', 'connection', 'question', 'general'], description: 'Filter by thought type' }, limit: { type: 'number', description: 'Maximum insights to return (default 10)' }, min_significance: { type: 'number', description: 'Minimum significance score 1-10 (default 5)', minimum: 1, maximum: 10 } }, }, },
- src/index.ts:518-533 (registration)Dispatch handler in CallToolRequest that processes get_insights calls, sets threshold if provided, invokes the handler, and formats response.case 'get_insights': { const { thought_type, limit, min_significance } = args as { thought_type?: string; limit?: number; min_significance?: number; }; if (min_significance) { contemplation.setThreshold(min_significance); } const insights = await contemplation.getInsights(thought_type, limit); return { content: [{ type: 'text', text: JSON.stringify(insights, null, 2) }], }; }
- src/index.ts:88-97 (schema)Type schema for Insight objects, which are the output structure of the get_insights tool.interface Insight { id: string; thought_type: string; content: string; significance: number; timestamp: string; used: boolean; similar_count?: number; aggregated_ids?: string[]; }