import { z } from 'zod';
export type AgentMemoryMap = Record<string, string>;
export type AgentMemoryUpdateCallback = (filePath: string, content: string) => Promise<void>;
/**
 * A function that calls an LLM and returns the response text.
 * Provided by the caller (AIAgentBubble) so all LLM calls go through the same infrastructure.
 */
export type LLMCallFn = (prompt: string) => Promise<string>;
/**
 * Format the core memory files + indexes for injection into the system prompt.
 * This is always injected — it's the agent's identity and awareness of what it knows.
 */
export declare function formatCoreMemoryForPrompt(memory: AgentMemoryMap): string;
/**
 * Self-improvement prompt appended to the system prompt.
 */
export declare const MEMORY_SELF_IMPROVEMENT_PROMPT = "You have persistent memory across conversations. Your known topics, recent events, and core identity are above.\n\n## Before You Respond\n\n**Always recall first.** Before responding to the user or delegating to a capability, use recall_memory to retrieve full details about any people or topics mentioned in the conversation. The indexes above are summaries \u2014 the full context is in the topic files. Don't respond with partial knowledge when you could look it up.\n\n## Remembering\n\nYou have two memory tools:\n\n**create_memory** \u2014 Create a new memory file for someone or something you haven't seen before:\n- People & topics: file=\"topics/{slug}.md\", content=\"...\", topicName=\"Sarah Chen\", topicAliases=[\"Sarah\"]\n- Events: file=\"events/2025-02-15.md\", content=\"...\", eventSummary=\"Met Sarah, discussed Redis caching\"\n\n**update_memory** \u2014 Add new information to an existing memory file:\n- file=\"topics/sarah-chen.md\", content=\"Prefers bullet points over paragraphs\"\n\nWhen you meet someone new who isn't in your Known Topics, create a topic for them immediately with the specific date (e.g., \"Met on 2025-02-15, PST timezone\"). Always use the actual date, never say \"today\".\n\nYour personality (soul.md) and identity (identity.md) evolve automatically after each conversation \u2014 you don't need to update those yourself.\n\n## Delegating\n\nWhen delegating to a capability, include relevant context from memory (timezone, preferences, prior decisions) in your task description. The capability agent doesn't have access to your memory.";
/**
 * Extracts person names from conversation history and returns matching topic content.
 * Conversation history messages have the format: "[Name (timezone)]: message" or "[Name]: message"
 */
export declare function autoRecallPersonTopics(memory: AgentMemoryMap, conversationHistory: Array<{
    role: string;
    content: string;
}>): string;
/**
 * Build the recall_memory custom tool.
 * Uses simple keyword/alias matching to find relevant files,
 * then returns their combined content.
 */
export declare function buildMemoryRecallTool(memory: AgentMemoryMap): {
    name: string;
    description: string;
    schema: z.ZodObject<{
        query: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        query: string;
    }, {
        query: string;
    }>;
    func: (input: Record<string, unknown>) => Promise<string>;
};
/**
 * Build the create_memory custom tool.
 * Creates new topic/event files and updates indexes.
 * Zero LLM calls — direct file write + index update.
 */
export declare function buildMemoryCreateTool(memory: AgentMemoryMap, updateCallback: AgentMemoryUpdateCallback): {
    name: string;
    description: string;
    schema: z.ZodObject<{
        file: z.ZodString;
        content: z.ZodString;
        topicName: z.ZodOptional<z.ZodString>;
        topicAliases: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
        eventSummary: z.ZodOptional<z.ZodString>;
    }, "strip", z.ZodTypeAny, {
        content: string;
        file: string;
        topicName?: string | undefined;
        topicAliases?: string[] | undefined;
        eventSummary?: string | undefined;
    }, {
        content: string;
        file: string;
        topicName?: string | undefined;
        topicAliases?: string[] | undefined;
        eventSummary?: string | undefined;
    }>;
    func: (input: Record<string, unknown>) => Promise<string>;
};
/**
 * Build the update_memory custom tool.
 * Updates existing topic/event files. Uses callLLM only for merging topic content.
 * No routing LLM — the master agent decides which file to target.
 */
export declare function buildMemoryUpdateTool(memory: AgentMemoryMap, updateCallback: AgentMemoryUpdateCallback, callLLM: LLMCallFn): {
    name: string;
    description: string;
    schema: z.ZodObject<{
        file: z.ZodString;
        content: z.ZodString;
    }, "strip", z.ZodTypeAny, {
        content: string;
        file: string;
    }, {
        content: string;
        file: string;
    }>;
    func: (input: Record<string, unknown>) => Promise<string>;
};
interface ConversationMessage {
    role: string;
    content: string;
}
/**
 * Run a post-execution reflection over the conversation.
 * Only updates soul.md and identity.md — implicit personality shaping.
 * Topics and events are left for the agent to update explicitly via update_memory.
 * Called after the agent finishes responding.
 */
export declare function runMemoryReflection(conversationMessages: ConversationMessage[], memory: AgentMemoryMap, updateCallback: AgentMemoryUpdateCallback, callLLM: LLMCallFn): Promise<void>;
export {};
//# sourceMappingURL=agent-memory.d.ts.map