|
8 | 8 | Values: |
9 | 9 | {joined_values} |
10 | 10 |
|
11 | | -Backgrounds: |
| 11 | +Summaries: |
12 | 12 | {joined_backgrounds} |
13 | 13 |
|
14 | | -Your task: |
15 | | -- Generate a single clear English `key` (5–10 words max). |
16 | | -- Write a detailed `value` that merges the key points into a single, complete, well-structured text. This must stand alone and convey what the user should remember. |
17 | | -- Provide a list of 5–10 relevant English `tags`. |
18 | | -- Write a short `background` note (50–100 words) covering any extra context, sources, or traceability info. |
| 14 | +Please perform: |
| 15 | +1. Identify information that reflects user's experiences, beliefs, concerns, decisions, plans, or reactions — including meaningful input from assistant that user acknowledged or responded to. |
| 16 | +2. Resolve all time, person, and event references clearly: |
| 17 | + - Convert relative time expressions (e.g., “yesterday,” “next Friday”) into absolute dates using the message timestamp if possible. |
| 18 | + - Clearly distinguish between event time and message time. |
| 19 | + - If uncertainty exists, state it explicitly (e.g., “around June 2025,” “exact date unclear”). |
| 20 | + - Include specific locations if mentioned. |
| 21 | + - Resolve all pronouns, aliases, and ambiguous references into full names or identities. |
| 22 | + - Disambiguate people with the same name if applicable. |
| 23 | +3. Always write from a third-person perspective, referring to user as |
| 24 | +"The user" or by name if name mentioned, rather than using first-person ("I", "me", "my"). |
| 25 | +For example, write "The user felt exhausted..." instead of "I felt exhausted...". |
| 26 | +4. Do not omit any information that user is likely to remember. |
| 27 | + - Include all key experiences, thoughts, emotional responses, and plans — even if they seem minor. |
| 28 | + - Prioritize completeness and fidelity over conciseness. |
| 29 | + - Do not generalize or skip details that could be personally meaningful to user. |
| 30 | +5. Summarize all child memory items into one memory item. |
19 | 31 |
|
20 | 32 | Language rules: |
21 | | -- The `key`, `value`, `tags`, `background` fields must match the language of the input conversation. |
| 33 | +- The `key`, `value`, `tags`, `summary` fields must match the mostly used language of the input memory items. |
| 34 | +- Keep `memory_type` in English. |
22 | 35 |
|
23 | 36 | Return valid JSON: |
24 | | -{{ |
25 | | - "key": "<concise topic>", |
26 | | - "value": "<full memory text>", |
27 | | - "tags": ["tag1", "tag2", ...], |
28 | | - "background": "<extra context>" |
29 | | -}} |
| 37 | +{ |
| 38 | + "key": <string, a unique, concise memory title>, |
| 39 | + "memory_type": <string, Either "LongTermMemory" or "UserMemory">, |
| 40 | + "value": <A detailed, self-contained, and unambiguous memory statement — written in English if the input conversation is in English, or in Chinese if the conversation is in Chinese>, |
| 41 | + "tags": <A list of relevant thematic keywords (e.g., ["deadline", "team", "planning"])>, |
| 42 | + "summary": <a natural paragraph summarizing the above memories from user's perspective, 120–200 words, same language as the input> |
| 43 | +} |
30 | 44 | """ |
31 | 45 |
|
32 | | -LOCAL_SUBCLUSTER_PROMPT = """ |
33 | | -You are a memory organization expert. |
| 46 | +LOCAL_SUBCLUSTER_PROMPT = """You are a memory organization expert. |
34 | 47 |
|
35 | 48 | You are given a cluster of memory items, each with an ID and content. |
36 | 49 | Your task is to divide these into smaller, semantically meaningful sub-clusters. |
|
39 | 52 | - Identify natural topics by analyzing common time, place, people, and event elements. |
40 | 53 | - Each sub-cluster must reflect a coherent theme that helps retrieval. |
41 | 54 | - Each sub-cluster should have 2–10 items. Discard singletons. |
42 | | -- Each item ID must appear in exactly one sub-cluster. |
| 55 | +- Each item ID must appear in exactly one sub-cluster or be discarded. No duplicates are allowed. |
| 56 | +- All IDs in the output must be from the provided Memory items. |
43 | 57 | - Return strictly valid JSON only. |
44 | 58 |
|
45 | 59 | Example: If you have items about a project across multiple phases, group them by milestone, team, or event. |
46 | 60 |
|
47 | 61 | Language rules: |
48 | | -- The `theme` fields must match the language of the input conversation. |
| 62 | +- The `theme` fields must match the mostly used language of the clustered memories. |
49 | 63 |
|
50 | 64 | Return valid JSON: |
51 | | -{{ |
| 65 | +{ |
52 | 66 | "clusters": [ |
53 | | - {{ |
54 | | - "ids": ["id1", "id2", ...], |
55 | | - "theme": "<short label>" |
56 | | - }}, |
| 67 | + { |
| 68 | + "ids": ["<id1>", "<id2>", ...], |
| 69 | + "key": "<string, a unique, concise memory title>" |
| 70 | + }, |
57 | 71 | ... |
58 | 72 | ] |
59 | | -}} |
| 73 | +} |
60 | 74 |
|
61 | 75 | Memory items: |
62 | 76 | {joined_scene} |
|
0 commit comments