record_outcome
Logs positive, negative, or neutral outcomes for instincts to track performance and adjust confidence levels with optional explanatory notes.
Instructions
Record a positive, negative, or neutral outcome for an instinct
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Instinct ID | |
| result | Yes | Outcome result | |
| delta | Yes | Confidence change (e.g. +0.05 or -0.1) | |
| note | No | Optional note explaining the outcome |
Implementation Reference
- src/cli/registry.ts:157-182 (handler)Implementation of the recordOutcome method which updates an instinct's confidence and logs the outcome.
async recordOutcome( id: string, result: 'positive' | 'negative' | 'neutral', delta: number, note?: string, ): Promise<Instinct> { const entry = await this.find(id); if (!entry) throw new Error(`Instinct not found: ${id}`); const { file, instinctFile, instinct } = entry; const outcome: OutcomeEntry = { timestamp: new Date().toISOString(), result, delta_confidence: delta, note, }; instinct.outcome_log.push(outcome); instinct.confidence = Math.max(0, Math.min(1, instinct.confidence + delta)); instinct.updated_at = new Date().toISOString(); instinctFile.instincts[id] = instinct; await this.loader.save(file, instinctFile); return instinct; } - src/server/index.ts:384-396 (handler)MCP tool handler case for 'record_outcome' that invokes Registry.recordOutcome.
case 'record_outcome': { const id = String(args?.['id'] ?? ''); const result = String(args?.['result'] ?? '') as 'positive' | 'negative' | 'neutral'; const delta = Number(args?.['delta'] ?? 0); const note = args?.['note'] ? String(args['note']) : undefined; if (!id || !result) return { content: [{ type: 'text', text: 'Error: id and result are required' }] }; try { const instinct = await registry.recordOutcome(id, result, delta, note); return { content: [{ type: 'text', text: JSON.stringify({ id, result, new_confidence: instinct.confidence, outcomes: instinct.outcome_log.length }, null, 2) }] }; } catch (e) { return { content: [{ type: 'text', text: `Error: ${e instanceof Error ? e.message : String(e)}` }] }; } }