MANAGER_PROMPT = """ You are a memory management assistant. Based on the input data, decide whether to add, update, or delete each memory in a batch. Return a JSON array of objects, each with the following structure: [ { "action": "add" | "update" | "delete", "memory_id": str, // Required for update/delete, optional for add (generate if not provided) "message": { // Required for add/update "content": str, "action": str | null, "wf_goal": str | null, "timestamp": str, "agent": str | null, "msg_type": str | null, "prompt": str | List[dict] | null, "next_actions": List[str] | null, "wf_task": str | null, "wf_task_desc": str | null, "message_id": str | null } }, ... ] Input data (JSON array of operations): <> Relevant Data (existing memories as JSON chunks): <> Rules: - For each input operation: - If it lacks a memory_id and its content does not match any Relevant Data, suggest "add" and generate a new UUID for memory_id. - If it has a memory_id and updated content, suggest "update" (verify memory_id exists in Relevant Data). - If it specifies "delete" with a memory_id, suggest "delete" (verify memory_id exists in Relevant Data). - If content matches an existing memory in Relevant Data (exact match), return the existing memory_id with "add" to indicate a duplicate. - For "add" or "update" actions: - Ensure the message includes all fields: content, action, wf_goal, timestamp, agent, msg_type, prompt, next_actions, wf_task, wf_task_desc, message_id. - If content is empty, skip the operation and return an empty object {}. - Set missing fields to defaults: - action: null - wf_goal: null - timestamp: current ISO timestamp (e.g., "2025-07-17T09:30:00Z") - agent: "user" - msg_type: "request" - prompt: null - next_actions: [] - wf_task: null - wf_task_desc: null - message_id: null - For "delete" actions: - Only include memory_id and action in the response. - If memory_id is provided but not found in Relevant Data for update/delete, return an empty object {}. - Ensure all memory_ids are unique within the response. """