|
2 | 2 |
|
3 | 3 | Given the following child memory items: |
4 | 4 |
|
5 | | -Keys: |
6 | | -{joined_keys} |
| 5 | +{memory_items_text} |
| 6 | +
|
| 7 | +Please perform: |
| 8 | +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. |
| 9 | +2. Resolve all time, person, and event references clearly: |
| 10 | + - Convert relative time expressions (e.g., “yesterday,” “next Friday”) into absolute dates using the message timestamp if possible. |
| 11 | + - Clearly distinguish between event time and message time. |
| 12 | + - If uncertainty exists, state it explicitly (e.g., “around June 2025,” “exact date unclear”). |
| 13 | + - Include specific locations if mentioned. |
| 14 | + - Resolve all pronouns, aliases, and ambiguous references into full names or identities. |
| 15 | + - Disambiguate people with the same name if applicable. |
| 16 | +3. Always write from a third-person perspective, referring to user as |
| 17 | +"The user" or by name if name mentioned, rather than using first-person ("I", "me", "my"). |
| 18 | +For example, write "The user felt exhausted..." instead of "I felt exhausted...". |
| 19 | +4. Do not omit any information that user is likely to remember. |
| 20 | + - Include all key experiences, thoughts, emotional responses, and plans — even if they seem minor. |
| 21 | + - Prioritize completeness and fidelity over conciseness. |
| 22 | + - Do not generalize or skip details that could be personally meaningful to user. |
| 23 | +5. Summarize all child memory items into one memory item. |
7 | 24 |
|
8 | | -Values: |
9 | | -{joined_values} |
10 | | -
|
11 | | -Backgrounds: |
12 | | -{joined_backgrounds} |
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. |
| 25 | +Language rules: |
| 26 | +- The `key`, `value`, `tags`, `summary` fields must match the mostly used language of the input memory items. **如果输入是中文,请输出中文** |
| 27 | +- Keep `memory_type` in English. |
19 | 28 |
|
20 | 29 | Language rules: |
21 | 30 | - The `key`, `value`, `tags`, `background` fields must match the language of the input conversation. |
22 | 31 |
|
23 | 32 | Return valid JSON: |
24 | | -{{ |
25 | | - "key": "<concise topic>", |
26 | | - "value": "<full memory text>", |
27 | | - "tags": ["tag1", "tag2", ...], |
28 | | - "background": "<extra context>" |
29 | | -}} |
| 33 | +{ |
| 34 | + "key": <string, a unique, concise memory title>, |
| 35 | + "memory_type": <string, Either "LongTermMemory" or "UserMemory">, |
| 36 | + "value": <A detailed, self-contained, and unambiguous memory statement — written in English if the input memory items are in English, or in Chinese if the input is in Chinese>, |
| 37 | + "tags": <A list of relevant thematic keywords (e.g., ["deadline", "team", "planning"])>, |
| 38 | + "summary": <a natural paragraph summarizing the above memories from user's perspective, 120–200 words, same language as the input> |
| 39 | +} |
30 | 40 | """ |
31 | 41 |
|
32 | | -LOCAL_SUBCLUSTER_PROMPT = """ |
33 | | -You are a memory organization expert. |
| 42 | +LOCAL_SUBCLUSTER_PROMPT = """You are a memory organization expert. |
34 | 43 |
|
35 | 44 | You are given a cluster of memory items, each with an ID and content. |
36 | 45 | Your task is to divide these into smaller, semantically meaningful sub-clusters. |
|
39 | 48 | - Identify natural topics by analyzing common time, place, people, and event elements. |
40 | 49 | - Each sub-cluster must reflect a coherent theme that helps retrieval. |
41 | 50 | - Each sub-cluster should have 2–10 items. Discard singletons. |
42 | | -- Each item ID must appear in exactly one sub-cluster. |
| 51 | +- Each item ID must appear in exactly one sub-cluster or be discarded. No duplicates are allowed. |
| 52 | +- All IDs in the output must be from the provided Memory items. |
43 | 53 | - Return strictly valid JSON only. |
44 | 54 |
|
45 | 55 | Example: If you have items about a project across multiple phases, group them by milestone, team, or event. |
46 | 56 |
|
47 | 57 | Language rules: |
48 | | -- The `theme` fields must match the language of the input conversation. |
| 58 | +- The `key` fields must match the mostly used language of the clustered memories. **如果输入是中文,请输出中文** |
49 | 59 |
|
50 | 60 | Return valid JSON: |
51 | | -{{ |
| 61 | +{ |
52 | 62 | "clusters": [ |
53 | | - {{ |
54 | | - "ids": ["id1", "id2", ...], |
55 | | - "theme": "<short label>" |
56 | | - }}, |
| 63 | + { |
| 64 | + "ids": ["<id1>", "<id2>", ...], |
| 65 | + "key": "<string, a unique, concise memory title>" |
| 66 | + }, |
57 | 67 | ... |
58 | 68 | ] |
59 | | -}} |
| 69 | +} |
60 | 70 |
|
61 | 71 | Memory items: |
62 | 72 | {joined_scene} |
|
90 | 100 | - Node 2: "The venue was booked for a wedding in August." |
91 | 101 | Answer: CONFLICT |
92 | 102 |
|
93 | | -Always respond with ONE word, no matter what language is for the input nodes: [CAUSE | CONDITION | RELATE_TO | CONFLICT | NONE] |
| 103 | +Always respond with ONE word, no matter what language is for the input nodes: [CAUSE | CONDITION | RELATE | CONFLICT | NONE] |
94 | 104 | """ |
95 | 105 |
|
96 | 106 | INFER_FACT_PROMPT = """ |
|
135 | 145 | - The `key`, `value`, `tags`, `background` fields must match the language of the input. |
136 | 146 |
|
137 | 147 | Good Aggregate: |
138 | | -{{ |
| 148 | +{ |
139 | 149 | "key": "Mary's Sustainability Summit Role", |
140 | 150 | "value": "Mary organized and spoke at the 2023 sustainability summit in Berlin, highlighting renewable energy initiatives.", |
141 | 151 | "tags": ["Mary", "summit", "Berlin", "2023"], |
142 | 152 | "background": "Combined from multiple memories about Mary's activities at the summit." |
143 | | -}} |
| 153 | +} |
144 | 154 |
|
145 | 155 | If you find NO useful higher-level concept, reply exactly: "None". |
146 | 156 | """ |
|
0 commit comments