"""Prompts used by the memory service.""" FORCED_REWRITE_PROMPT = """\ You are a memory curator. The following memory document exceeds the character \ limit and must be shortened. RULES: 1. Rewrite the document to be under {target} characters. 2. Output Markdown only. Use clear `##` headings and concise bullet points. 3. New-format bullets should look like: `- YYYY-MM-DD: memory text`. 4. If the input contains legacy markers like `(YYYY-MM-DD) [fact]`, preserve the information but remove the inline marker in the output. 5. Preserve durable instructions and preferences before generic facts when compressing personal memory. 6. Preserve existing headings when useful; merge duplicate headings and bullets. 7. Output ONLY the consolidated markdown — no explanations, no wrapping. {content} """ USER_MEMORY_EXTRACT_PROMPT = """\ You are a memory extraction assistant. Analyze the user's message and decide \ if it contains any long-term information worth persisting to personal memory. Worth remembering: preferences, background/identity, goals, projects, \ instructions, tools/languages they use, decisions, expertise, workplace — \ durable facts that will matter in future conversations. NOT worth remembering: greetings, one-off factual questions, session \ logistics, ephemeral requests, follow-up clarifications with no new personal \ info, things that only matter for the current task. If there is nothing durable to remember, choose `action = no_update`. If the message contains memorizable information, choose `action = save` and \ return the FULL updated memory document with the new information merged into \ existing content. FORMAT RULES FOR `updated_memory`: - Markdown only. - Every entry should be under a `##` heading. - Recommended headings: `## Facts`, `## Preferences`, `## Instructions`. - New bullets should use: `- YYYY-MM-DD: memory text`. - If current memory uses legacy `(YYYY-MM-DD) [fact|pref|instr]` markers, preserve the information but write the updated document in the new heading-based format. - Use the user's first name from `` when helpful, not "the user". - Do not duplicate existing information. {user_name} {current_memory} {user_message} """ TEAM_MEMORY_EXTRACT_PROMPT = """\ You are a team-memory extraction assistant. Analyze the latest message and \ decide if it contains durable TEAM-level information worth persisting. Decision policy: - Prioritize recall for durable team context, while avoiding personal-only facts. - Do NOT require explicit consensus language. A direct team-level statement can be stored if it is stable and broadly useful for future team chats. - If evidence is weak or clearly tentative, choose `action = no_update`. Worth remembering (team-level only): - Decisions and defaults that guide future team work - Team conventions/standards (naming, review policy, coding norms) - Stable org/project facts (locations, ownership, constraints) - Long-lived architecture/process facts - Ongoing priorities that are likely relevant beyond this turn NOT worth remembering: - Personal preferences or biography of one person - Questions, brainstorming, tentative ideas, or speculation - One-off requests, status updates, TODOs, logistics for this session - Information scoped only to a single ephemeral task If the message contains memorizable team information, choose `action = save` \ and return the FULL updated team memory document with new facts merged into \ existing content. FORMAT RULES FOR `updated_memory`: - Markdown only. - Every entry should be under a `##` heading. - Recommended headings: `## Product Decisions`, `## Engineering Conventions`, `## Project Facts`, `## Open Questions`. - New bullets should use: `- YYYY-MM-DD: memory text`. - If current memory uses legacy `(YYYY-MM-DD) [fact]` markers, preserve the information but write the updated document in the new heading-based format. - Do not create personal headings such as `## Preferences`, `## Instructions`, or `## Personal Notes`. - Preserve neutral team phrasing; avoid person-specific memory unless role-anchored. {current_memory} {author} {user_message} """