/** * pi-loom: Auto-capture — extract implicit memories from tool results * * Mirrors context-mode's extractEvent pattern (src/session/extract.ts): * watches pi.on("tool_result") and produces memory entries for * significant events without requiring explicit loom_store() calls. * * Design constraints: * - NO LLM calls (fast, cheap, never blocks the tool response) * - Pure pattern matching on tool name + input shape * - Rate-limited & deduped by the caller in index.ts * - File edits at very low importance (0.3) — one edit is noise, * but accumulated edits on the same directory create signal * * Phase 3 (ESR integration): auto-detect entity co-occurrence edges. * When two ESR entities appear within the same tool event, a weak * REFERENCE edge is suggested for graph traversal. */ /** Normalized tool result event from Pi's tool_result hook. */ export interface ToolResultEvent { toolName: string; input: Record; output?: string; isError: boolean; } /** A memory entry to auto-store. */ export interface CapturedMemory { content: string; entity_id?: string; importance: number; tags: string[]; } /** Auto-detected entity edge from co-occurrence. */ export interface AutoEdge { source_entity: string; target_entity: string; relation_type: string; memory_id?: string; confidence: number; } /** Wraps the event + extracted memories for two-layer storage. */ export interface CaptureResult { memories: CapturedMemory[]; edges: AutoEdge[]; rawPayload: Record; } /** * Extract implicit memories from a tool result event + build raw payload. * Pure function — no side effects, no LLM calls. * * Returns captured memories AND auto-detected entity edges for ESR integration. */ export declare function captureToolResult(event: ToolResultEvent): CaptureResult; export declare const extractMemoriesFromToolResult: (event: ToolResultEvent) => CapturedMemory[];