/** * Example: End-to-End Memory + Darwin Integration * * Closed-loop in three lines: * 1. Run an agent. * 2. After multi-critic, persist findings via McpMemoryBridge. * 3. Before the next run, fetch relevant lessons and inject them. * * Backend-agnostic: defaults to `@studiomeyer/local-memory-mcp` so it works * out of the box with no API keys. Override `localMemory()` with * `remoteMemory(url, …)` to point at any MCP-compliant memory server. * * Run demo (requires `@studiomeyer/local-memory-mcp` reachable via npx): * npx tsx examples/memory-darwin-integration.ts * * The demo deliberately uses a stub agent runner so it doesn't depend on * a live LLM connection. Replace `simulateAgentRun()` with your real * `runAgent()` call once you wire this into your codebase. */ import { type Lesson, type RetrievableFeedbackStore } from './mcp-memory-bridge.js'; import type { MultiCriticResult } from '../src/evolution/multi-critic.js'; /** * Render a list of past lessons as a context block that you can prepend to * the next agent's system prompt. Empty lessons → empty string (cheap to * call unconditionally). */ export declare function renderLessonContext(lessons: Lesson[], maxChars?: number): string; export interface AgentRunInput { agentName: string; topic: string; /** Optional context block (e.g. rendered past lessons). */ context?: string; } export interface AgentRunOutput { text: string; critic: MultiCriticResult; } /** * The orchestration shape. Bring your own implementations for the two * function fields when wiring this into a real codebase: * - runner: anything that takes (topic, context) → {text, critic} * - store: the McpMemoryBridge (or any RetrievableFeedbackStore) */ export interface ClosedLoopOptions { runner: (input: AgentRunInput) => Promise; store: RetrievableFeedbackStore; /** Cap how many lessons to inject. Default: 5. */ fetchLimit?: number; /** Override persist thresholds (same shape as persistFeedback options). */ persistThresholds?: { lowThreshold?: number; highThreshold?: number; minOutputChars?: number; }; } /** Run one closed-loop turn: fetch lessons → run → persist findings. */ export declare function runClosedLoopTurn(input: AgentRunInput, options: ClosedLoopOptions): Promise<{ run: AgentRunOutput; lessonsUsed: number; persisted: boolean; reason: string; }>; //# sourceMappingURL=memory-darwin-integration.d.ts.map