engine7 7.1.119 → 7.1.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/cli.mjs +39870 -26290
  2. package/dist/engine-startup.mjs +61000 -34856
  3. package/dist/main.mjs +60917 -34773
  4. package/dist/mem7-worker.mjs +22969 -0
  5. package/dist/prompts/atomic-facts-memcell.md +80 -0
  6. package/dist/prompts/atomic-facts.md +108 -0
  7. package/dist/prompts/boundary.md +88 -0
  8. package/dist/prompts/case-compress.md +73 -0
  9. package/dist/prompts/case-filter.md +34 -0
  10. package/dist/prompts/case-rerank.md +12 -0
  11. package/dist/prompts/cluster-assign.md +25 -0
  12. package/dist/prompts/episode.md +65 -0
  13. package/dist/prompts/episodic-rerank.md +12 -0
  14. package/dist/prompts/foresight.md +148 -0
  15. package/dist/prompts/multi-query.md +61 -0
  16. package/dist/prompts/profile-compact.md +30 -0
  17. package/dist/prompts/profile-update.md +66 -0
  18. package/dist/prompts/profile.md +43 -0
  19. package/dist/prompts/refined-query.md +43 -0
  20. package/dist/prompts/skill-failure.md +84 -0
  21. package/dist/prompts/skill-maturity.md +49 -0
  22. package/dist/prompts/skill-rerank.md +23 -0
  23. package/dist/prompts/skill-success.md +103 -0
  24. package/dist/prompts/sufficiency.md +41 -0
  25. package/dist/prompts/tool-pre-compress.md +39 -0
  26. package/package.json +110 -95
  27. package/templates/config.template.json +25 -0
  28. package/templates/skills/email/LICENSE.txt +22 -0
  29. package/templates/skills/email/SKILL.md +115 -0
  30. package/templates/skills/email/assets/1-account-menu.jpg +0 -0
  31. package/templates/skills/email/assets/163/1-settings-menu.jpg +0 -0
  32. package/templates/skills/email/assets/163/2-service-closed.jpg +0 -0
  33. package/templates/skills/email/assets/163/3-security-warning.jpg +0 -0
  34. package/templates/skills/email/assets/163/5-imap-code.jpg +0 -0
  35. package/templates/skills/email/assets/2-security-settings-generate.jpg +0 -0
  36. package/templates/skills/email/assets/3-sms-verify.jpg +0 -0
  37. package/templates/skills/email/assets/4-wechat-send-confirm.jpg +0 -0
  38. package/templates/skills/email/assets/5-code-generated.jpg +0 -0
  39. package/templates/skills/email/package.json +12 -0
  40. package/templates/skills/email/scripts/email-config.js +114 -0
  41. package/templates/skills/email/scripts/email-config.test.js +93 -0
  42. package/templates/skills/email/scripts/email-gate.js +124 -0
  43. package/templates/skills/email/scripts/email-gate.test.js +62 -0
  44. package/templates/skills/email/scripts/imap.js +540 -0
  45. package/templates/skills/email/scripts/imap.test.js +86 -0
  46. package/templates/skills/email/scripts/smtp.js +238 -0
  47. package/templates/skills/email/scripts/smtp.test.js +44 -0
  48. package/templates/workspace/scripts/emotion_state_machine.mjs +13 -13
  49. package/src/memory/everos/python/__pycache__/agentic_search.cpython-314.pyc +0 -0
  50. package/templates/workspace/scripts/__pycache__/emotion_state_machine.cpython-310.pyc +0 -0
@@ -0,0 +1,80 @@
1
+
2
+ **CRITICAL LANGUAGE RULE**: You MUST output in the SAME language as the input conversation content. If the conversation content is in Chinese, ALL output MUST be in Chinese. If in English, output in English. This is mandatory.
3
+
4
+ You are an expert information extraction analyst and information architect.
5
+ Your task is to analyze the given raw conversation transcript (called "CONVERSATION_TEXT") and produce atomic facts optimized for factual retrieval.
6
+
7
+ ---
8
+
9
+ ### INPUT
10
+ - CONVERSATION_TEXT: The raw conversation transcript.
11
+ - TIME: The start time of the conversation, e.g., "March 10, 2024(Sunday) at 2:00 PM UTC".
12
+
13
+ ---
14
+
15
+ ### OUTPUT
16
+ Return **only** one valid JSON object, with the following exact structure:
17
+
18
+ {
19
+ "atomic_facts": {
20
+ "time": "<THE EXACT TIME STRING FROM INPUT TIME>",
21
+ "atomic_fact": [
22
+ "<Atomic fact sentence 1>",
23
+ "<Atomic fact sentence 2>",
24
+ ...
25
+ ]
26
+ }
27
+ }
28
+
29
+ ---
30
+
31
+ ### EXTRACTION RULES
32
+
33
+ #### 1. Atomicity
34
+ * Each entry in `"atomic_fact"` must express **exactly one coherent unit of meaning** — an action, emotion, reason, plan, decision, or statement.
35
+ * If a speaker expresses multiple ideas (e.g., an event and its reason), split them into multiple atomic facts.
36
+ * Each atomic_fact must be **independent and retrievable on its own**.
37
+
38
+ #### 2. Time & Date Handling (CRITICAL)
39
+ * The `"time"` field (at the top level) represents the conversation start time.
40
+ * **All generated timestamps must be in UTC.**
41
+ * **Preserve** explicit dates verbatim.
42
+ * **Resolve** relative or vague times (e.g., "yesterday", "last week") relative to `TIME`, and **append the resolved absolute date in parentheses** (e.g., "yesterday (March 9, 2024)").
43
+
44
+ #### 3. Content Preservation & Attribution
45
+ * **Base facts strictly on the conversation.** Do not infer information not present.
46
+ * **Explicit Attribution**: Always state WHO said or did what.
47
+ - GOOD: "John said he liked the movie."
48
+ - BAD: "The movie was liked." (Who liked it?)
49
+ * Resolve pronouns (he/she/it) to specific names where possible.
50
+
51
+ #### 4. Expression Format
52
+ * Write each atomic_fact as a **single, complete sentence** in **third-person** form (language: follow the CRITICAL LANGUAGE RULE at the top of this prompt).
53
+ * Do **not** simplify, paraphrase, or merge logically distinct ideas.
54
+
55
+ #### 5. Retrieval Clarity & Filtering
56
+ * **Filter out**: Greetings, phatic communication ("Okay", "Cool"), and low-value chatter unless it conveys specific emotional or factual content.
57
+ * **Keep**: Events, decisions, plans, preferences, specific opinions, factual statements.
58
+
59
+ #### 6. Output Requirements
60
+ * Output **only** the JSON object — no additional explanation, markdown, or commentary.
61
+ * Ensure valid JSON.
62
+
63
+ ---
64
+
65
+ ### QUALITY CHECKS
66
+ Before returning the final output, verify that:
67
+ 1. Every meaningful fact is captured.
68
+ 2. Attribution is correct (who said what).
69
+ 3. Timestamps are UTC and relative times are resolved.
70
+ 4. Redundancy is minimized.
71
+
72
+ ---
73
+
74
+ Now analyze the provided conversation content and start time carefully, apply all rules above, and return **only the JSON object** in the specified format.
75
+
76
+ Conversation start time: {TIME}
77
+ Conversation content:
78
+ {INPUT_TEXT}
79
+
80
+ **CRITICAL LANGUAGE RULE**: You MUST output in the SAME language as the input conversation content. If the conversation content is in Chinese, ALL output MUST be in Chinese. If in English, output in English. This is mandatory.
@@ -0,0 +1,108 @@
1
+ You are an expert episodic memory extraction analyst and information architect.
2
+ Your task is to analyze the given narrative or multi-turn conversation (called "EPISODE_TEXT") and produce an event log optimized for factual retrieval.
3
+
4
+ ---
5
+
6
+ ### INPUT
7
+ - EPISODE_TEXT: The memory text saved through the "episode memory".
8
+ - TIME: The start time of the episode, e.g., "March 10, 2024(Sunday) at 2:00 PM".
9
+
10
+ ---
11
+
12
+ ### OUTPUT
13
+ Return **only** one valid JSON object, with the following exact structure:
14
+
15
+ {
16
+ "event_log": {
17
+ "time": "<THE EXACT TIME STRING FROM INPUT TIME>",
18
+ "atomic_fact": [
19
+ "<Atomic fact sentence 1>",
20
+ "<Atomic fact sentence 2>",
21
+ ...
22
+ ]
23
+ }
24
+ }
25
+
26
+ ---
27
+
28
+ ### EXTRACTION RULES
29
+
30
+ #### 1. Atomicity
31
+ * Each entry in `"atomic_fact"` must express **exactly one coherent unit of meaning** — an action, emotion, reason, plan, decision, or statement.
32
+ * If a speaker expresses multiple ideas (e.g., an event and its reason), split them into multiple atomic facts.
33
+ * Each atomic_fact must be **independent and retrievable on its own**.
34
+
35
+ #### 2. Time & Date Handling
36
+ * Do **not** add or prepend timestamps such as "On March 10, 2024".
37
+ * The `"time"` field (at the top level) already represents the episode's start time.
38
+ * However, when the original text mentions **explicit or relative time expressions**, you must:
39
+ - **Preserve** explicit dates verbatim (e.g., "October 6, 2023").
40
+ - **Resolve** relative or vague times (e.g., "yesterday", "last week", "two months ago") relative to `TIME`, and **append the resolved absolute date in parentheses**.
41
+ Example: "Gina said she launched the campaign yesterday (March 9, 2024)."
42
+ - If the exact resolution is uncertain, use a normalized vague phrase (e.g., "in early 2023", "during the summer of 2021") instead of guessing.
43
+
44
+ #### 3. Content Preservation
45
+ * Preserve **all semantically meaningful information**, including:
46
+ - emotions, attitudes, reasons, intentions, consequences, conditions, and comparisons
47
+ * Resolve pronouns into explicit names or entities when unambiguous.
48
+ * Keep original wording as much as possible — only fix grammar for clarity.
49
+
50
+ #### 4. Expression Format
51
+ * Write each atomic_fact as a **single, complete English sentence** in **third-person** form.
52
+ - e.g., "Gina said that she had launched an ad campaign for her clothing store yesterday (March 9, 2024)."
53
+ * Do **not** simplify, paraphrase, or merge logically distinct ideas.
54
+
55
+ #### 5. Retrieval Clarity
56
+ * Each atomic_fact must be concise, factual, and self-contained.
57
+ * Avoid small talk or filler unless it conveys meaningful emotional or informational content.
58
+ * Ensure entities and actions are explicit and unambiguous.
59
+
60
+ #### 6. Output Requirements
61
+ * Output **only** the JSON object — no additional explanation, markdown, or commentary.
62
+ * Ensure valid JSON (proper quotes, commas, and escaping).
63
+ * The `"atomic_fact"` list should include all meaningful facts extracted from the episode.
64
+
65
+ ---
66
+
67
+ ### QUALITY CHECKS
68
+ Before returning the final output, verify that:
69
+ 1. Every meaningful fact, intention, and emotion is included.
70
+ 2. Each `atomic_fact` contains exactly one idea.
71
+ 3. All relevant time references are preserved or normalized.
72
+ 4. Wording remains faithful to the source.
73
+ 5. The output JSON is valid and follows the exact schema.
74
+
75
+ ---
76
+
77
+ ### EXAMPLE
78
+
79
+ **Input:**
80
+ TIME = "March 10, 2024(Sunday) at 2:00 PM"
81
+ EPISODE_TEXT =
82
+ "Gina said she just launched an ad campaign for her clothing store yesterday.
83
+ Jon congratulated her and asked how her dance studio search was going.
84
+ Gina explained that she was focusing on the clothing store for now but still hoped to find a suitable studio soon."
85
+
86
+ **Output:**
87
+ {
88
+ "event_log": {
89
+ "time": "March 10, 2024(Sunday) at 2:00 PM",
90
+ "atomic_fact": [
91
+ "Gina said that she had launched an ad campaign for her clothing store yesterday (March 9, 2024).",
92
+ "Jon congratulated Gina on her new campaign.",
93
+ "Jon asked Gina about the progress of her dance studio search.",
94
+ "Gina explained that she was focusing on the clothing store for now.",
95
+ "Gina said that she still hoped to find a suitable studio in the future."
96
+ ]
97
+ }
98
+ }
99
+
100
+ ---
101
+
102
+ Now analyze the provided EPISODE_TEXT and TIME carefully, apply all rules above, and return **only the JSON object** in the specified format.
103
+ ---
104
+
105
+ ### INPUT
106
+ - EPISODE_TEXT: "{{{EPISODE_TEXT}}}"
107
+ - TIME: "{{{TIME}}}" (the start time of the episode, e.g., "March 10, 2024(Sunday) at 2:00 PM")
108
+
@@ -0,0 +1,88 @@
1
+
2
+ **CRITICAL LANGUAGE RULE**: You MUST output in the SAME language as the input conversation content. If the conversation content is in Chinese, ALL output MUST be in Chinese. If in English, output in English. This is mandatory.
3
+
4
+ You are an episodic memory boundary detection expert. Your task is to find all natural "episode boundaries" in a continuous conversation and split it into meaningful, independently memorable segments (MemCells). Your core principle is **"default to merging, split cautiously"**.
5
+
6
+ ### Input Format
7
+ The following is a complete chronological conversation log. Each message is prefixed with a 1-based index and timestamp:
8
+
9
+ ```
10
+ {messages}
11
+ ```
12
+
13
+ ### When to split
14
+
15
+ Add a boundary (by message number) only when **clear signals** appear:
16
+ - **Cross-day split (highest priority):** Adjacent messages have different calendar dates — MUST split at the date boundary.
17
+ - **Substantive topic change:** Conversation shifts from one concrete topic to a completely unrelated one (e.g., project architecture → weekend plans).
18
+ - **Task completion + new topic:** A closing message ("migration done") belongs to its task's episode; split only when the **next** message opens a genuinely unrelated topic.
19
+ - **Long gap + new topic:** Time gap > 4 hours AND new messages have no clear connection to prior conversation.
20
+
21
+ **Do NOT split for:**
22
+ - Greetings, farewells ("bye", "thanks") — keep with the main episode
23
+ - Transition phrases ("by the way", "oh also") — usually continue the current episode
24
+ - Brief pauses (< 4 hours) followed by the same topic
25
+
26
+ ### `should_wait`
27
+ Set to `true` when the **last segment** has insufficient information to determine its episode context:
28
+ - **Non-text messages:** Only media placeholders (`[image]`, `[video]`, `[file]`) with no accompanying text
29
+ - **Intent-free short replies:** Minimal responses like "ok", "sure", "got it", "😂"
30
+ - **System or non-conversational messages:** System notifications (join/leave group, payment reminders, etc.) cannot themselves determine episode boundaries — wait for the next human message to decide
31
+ - **Ambiguous intermediate state:** Gap of 30 min–4 hours with content that is neither clearly continuing nor clearly starting a new topic
32
+
33
+ ### Decision Principles
34
+ - **Merge by default:** When in doubt, do not split; only split on clear signals
35
+ - **Content over form:** Greetings and farewells belong to the episode they serve, not their own
36
+ - **Process continuity:** Consecutive actions toward the same goal (e.g., create group → post first instruction) form one episode
37
+ - **System messages don't trigger splits:** System messages (e.g., `"[User X] joined the group"`) have their episode context determined by the next human message that follows them
38
+
39
+ ### Examples
40
+
41
+ **Example 1 — one boundary:**
42
+ Input messages:
43
+ ```
44
+ [1] [2024-03-10T09:00:00Z] Alice: Can you help me debug the login issue?
45
+ [2] [2024-03-10T09:01:00Z] Bob: Sure, let me check the logs.
46
+ [3] [2024-03-10T09:05:00Z] Bob: Found it — a null pointer in AuthService line 42.
47
+ [4] [2024-03-10T09:06:00Z] Alice: Fixed, thanks!
48
+ [5] [2024-03-11T10:00:00Z] Alice: Hey, are you free for lunch today?
49
+ [6] [2024-03-11T10:01:00Z] Bob: Sure, 12:30?
50
+ ```
51
+ Output:
52
+ ```json
53
+ {{
54
+ "reasoning": "Messages 1-4 are a complete bug-fix episode; message 5 starts a new day with an unrelated lunch topic.",
55
+ "boundaries": [4],
56
+ "should_wait": false
57
+ }}
58
+ ```
59
+
60
+ **Example 2 — no boundary:**
61
+ Input messages:
62
+ ```
63
+ [1] [2024-03-10T06:00:00Z] Alice: What's the status of the Q2 roadmap?
64
+ [2] [2024-03-10T06:02:00Z] Bob: About 60% done. Need to finalize the API specs.
65
+ [3] [2024-03-10T06:10:00Z] Alice: OK, let's review the specs tomorrow.
66
+ ```
67
+ Output:
68
+ ```json
69
+ {{
70
+ "reasoning": "All messages are part of the same Q2 roadmap discussion with no topic change.",
71
+ "boundaries": [],
72
+ "should_wait": false
73
+ }}
74
+ ```
75
+
76
+ ### Output Format
77
+ Return strictly in the following JSON format:
78
+ ```json
79
+ {{
80
+ "reasoning": "<one sentence explaining all boundary decisions>",
81
+ "boundaries": [<1-indexed message numbers after which to split>],
82
+ "should_wait": <boolean, whether the last segment has insufficient information>
83
+ }}
84
+ ```
85
+
86
+ **`boundaries: []` means all messages belong to the same episode — no split.**
87
+
88
+ **CRITICAL LANGUAGE RULE**: You MUST output in the SAME language as the input conversation content. If the conversation content is in Chinese, ALL output MUST be in Chinese. If in English, output in English. This is mandatory.
@@ -0,0 +1,73 @@
1
+ You are an expert at distilling agent interaction trajectories into concise experience records.
2
+
3
+ Given an agent trajectory (a JSON list of messages from a single task segment), extract ONE experience record that captures the specific problem solved and the concrete problem-solving process.
4
+
5
+ An **experience** is a compressed record of how a specific task was solved — preserving all key steps, decisions, and results. It serves two purposes:
6
+ 1. **Reference case**: When the agent encounters a similar task, it can retrieve this experience and follow a proven approach.
7
+ 2. **Raw material**: Multiple similar experiences are later refined into generalized skills (best practices).
8
+
9
+ Input messages are in OpenAI chat completion format:
10
+ - role="user": User input
11
+ - role="assistant" without tool_calls: Agent's direct response
12
+ - role="assistant" with tool_calls: Agent decides to call tools (may include reasoning in content)
13
+ - role="tool" with tool_call_id: Tool execution result (may have been pre-compressed)
14
+
15
+ Pre-processed trajectory:
16
+ {messages}
17
+
18
+ **CRITICAL LANGUAGE RULE**: You MUST output in the SAME language as the input conversation content. If the conversation content is in Chinese, ALL output MUST be in Chinese. If in English, output in English. This is mandatory.
19
+
20
+ **Extract the Experience:**
21
+
22
+ - **task_intent**: Synthesize the specific task from ALL turns into a single, self-contained statement (not a question). This serves as a retrieval key for finding similar past cases. **Max 50 tokens** — be precise and specific, avoid filler words.
23
+
24
+ - **approach**: A compressed record that decomposes the task into sub-problems. **Max 1000 tokens** — aggressively compress prose and explanations, but preserve critical technical details verbatim.
25
+ - Each numbered step = one sub-problem the agent needed to solve on the way to the overall task.
26
+ - Under each step: what the agent tried (tool used or reasoning applied) and the result obtained (findings, errors, metrics).
27
+ - If a sub-problem required multiple attempts (e.g., first attempt failed, then revised), compress them into one step showing the key attempts and the final resolution.
28
+ - End with "Outcome:" summarizing the final result of the overall task.
29
+
30
+ **Key steps preservation rules** — these MUST be kept verbatim (not paraphrased):
31
+ - **Commands**: Shell commands, CLI invocations, API calls — preserve the exact command string (e.g., `pip install --upgrade torch==2.1.0`, `curl -X POST ...`, `git rebase -i HEAD~3`)
32
+ - **Core code**: Function signatures, key logic snippets, configuration values, regex patterns, SQL queries — preserve the actual code that solved the problem (keep it minimal but exact)
33
+ - **File paths**: Exact file/directory paths that were read, modified, or created
34
+ - **Error messages**: Key error strings or status codes that drove the diagnosis
35
+ - **Numeric results**: Metrics, thresholds, counts, versions that matter to the outcome
36
+
37
+ **What to compress or omit**:
38
+ - Lengthy tool output exploration (summarize findings in 1 line)
39
+ - Intermediate reasoning that did not change the approach
40
+ - Boilerplate and repeated patterns (mention once, note repetition count)
41
+ - Verbose file contents (summarize, but keep the critical lines verbatim)
42
+
43
+ - **key_insight**: The single most critical decision, strategy shift, or knowledge application that enabled success. NOT a step summary — the pivotal moment that a different agent lacking this insight would fail at. Focus on the REASONING PRINCIPLE, not the specific domain content. **Max 40 tokens.**
44
+
45
+ **Strategy transitions are the highest-value insights.** If the agent fundamentally changed its approach mid-task (e.g., from tool-driven exploration to knowledge-driven hypothesis, from one problem framing to another), that transition IS the key insight. Capture:
46
+ - What was the agent doing before (and why it failed)
47
+ - What triggered the change
48
+ - What the agent did after (and why it succeeded)
49
+
50
+ A key_insight that merely describes "what was done" is WRONG. A key_insight that explains "why the approach shifted and why the new approach worked" is RIGHT.
51
+
52
+ - **quality_score**: A score from 0.0 to 1.0 measuring **task completion and deliverable quality** — NOT effort, exploration depth, or number of steps attempted.
53
+
54
+ **Scoring rubric (outcome-oriented):**
55
+ - **0.9 - 1.0**: Task fully completed. All requirements met, deliverable produced and verified working.
56
+ - **0.7 - 0.8**: Task mostly completed. Primary deliverable produced but with minor gaps (e.g., works but not fully optimized, passes most but not all test cases, meets 4 of 5 requirements).
57
+ - **0.4 - 0.6**: Task partially completed. Some concrete deliverable produced but significant requirements unmet (e.g., code written but fails tests, 2 of 5 sub-tasks done, output produced but incorrect).
58
+ - **0.1 - 0.3**: Task mostly failed. Minimal or no deliverable produced despite attempts. Includes: extensive exploration without producing the required output, environment setup done but core task not started, approach identified but not executed.
59
+ - **0.0**: No meaningful progress toward the task goal.
60
+
61
+ **Critical scoring rules:**
62
+ - Score based on the FINAL state of the deliverable, not the journey. A task that explored 10 approaches but produced no output = low score.
63
+ - "Timed out before completing" with no deliverable = 0.1-0.2 (not 0.5+).
64
+ - External blockers (e.g., resource unavailable, OOM kill, network restriction) that prevent completion = score the actual output achieved, not what would have been achieved.
65
+ - A well-structured approach that was never executed is NOT a partial success — it is a failure to deliver.
66
+
67
+ Return in JSON format:
68
+ {{
69
+ "task_intent": "The specific task as a self-contained statement (max 50 tokens)",
70
+ "approach": "1. <sub-problem>\n - Tried: <what was attempted, tool or reasoning>\n - Result: <what was found/achieved or why it failed>\n2. <next sub-problem>\n - Tried: <attempt>\n - Result: <outcome>\n...\n\nOutcome: <final result of the overall task>",
71
+ "key_insight": "The pivotal decision or knowledge application that enabled success (max 40 tokens)",
72
+ "quality_score": 0.0-1.0
73
+ }}
@@ -0,0 +1,34 @@
1
+ Determine whether this agent interaction is worth extracting as a reusable problem-solving experience. Apply a HIGH threshold — only extract interactions that clearly demonstrate a complete problem-solving process.
2
+
3
+ The interaction may be pure conversation OR contain a single round of tool calls. Both types must meet the same quality bar.
4
+
5
+ Conversation:
6
+ {messages}
7
+
8
+ SKIP (return {{"worth_extracting": false}}) — default unless clearly valuable:
9
+ - Casual chitchat, greetings, small talk
10
+ - Opinion/preference exchange with no actionable outcome
11
+ - Simple factual Q&A (e.g., "What is X?" with a direct answer)
12
+ - Single-turn Q&A (one user message + one assistant response)
13
+ - Multi-turn but loosely related topics (user asks unrelated follow-ups, no progressive deepening)
14
+ - Information gathering without problem resolution (user asks questions but no concrete problem is solved)
15
+ - Generic advice that anyone could give (e.g., "try restarting", "check the docs")
16
+ - Lifestyle or personal preference conversations (e.g., activity planning, movie/book/food discussions, hobby sharing, travel recommendations) — these are inherently personal and lack a transferable problem-solving methodology
17
+ - Emotional support or empathetic conversations without a concrete, replicable resolution strategy
18
+ - Single-round tool call that performs a trivial lookup or simple data fetch without meaningful reasoning, diagnosis, or multi-step problem solving (e.g., a single search call that returns a direct answer)
19
+ - Conversations where the assistant only uses basic conversational competence — structured lists, follow-up questions, empathetic acknowledgment, curated recommendations, topic transitions. These are standard LLM dialogue patterns, NOT domain-specific problem-solving expertise
20
+ - Recommendation or suggestion conversations (e.g., "what movie should I watch", "what should I cook", "where should I travel") — even if multi-turn with progressive refinement, unless the recommendation requires specialized technical diagnosis or domain expertise beyond general knowledge
21
+ - Conversations where the "problem" is merely a personal decision or preference choice (e.g., choosing a hiking trail, picking a recipe, selecting a gift) rather than a technical/analytical problem with objectively verifiable steps
22
+
23
+ EXTRACT (return {{"worth_extracting": true}}) — ALL conditions must be met:
24
+ 1. A specific, concrete problem is identified (not vague or generic)
25
+ 2. The conversation shows progressive deepening: each turn builds on the previous, narrowing down the solution
26
+ 3. The problem reaches a resolution or clear actionable conclusion
27
+ 4. The approach involves non-trivial reasoning, diagnosis, or domain expertise that would be valuable to replay
28
+ 5. The solution methodology is transferable — a different agent facing a similar problem class could follow the same steps to reach a similar outcome (personal taste, lifestyle advice, and subjective recommendations do NOT qualify)
29
+ 6. The extracted skill would go BEYOND baseline LLM capabilities — ask: "Would a competent LLM without this experience handle this significantly worse?" If the answer is no, it is not worth extracting. Examples of baseline capabilities that do NOT qualify: making structured suggestion lists, asking clarifying questions, showing empathy, giving general-knowledge recommendations, summarizing information
30
+
31
+ **Borderline cases** — when you are unsure, lean toward SKIP.
32
+
33
+ Return JSON:
34
+ {{"worth_extracting": true/false, "reason": "1 sentence, less than 20 tokens"}}
@@ -0,0 +1,12 @@
1
+ Determine whether each agent execution case's task and approach are useful for addressing the user query, preferring cases whose verified successful approach (high `quality_score`) directly applies to the query's problem. Score each case from 0.0 (no transferable experience) to 1.0 (same task pattern with a verified successful approach).
2
+
3
+ User query:
4
+ {query}
5
+
6
+ Candidates (JSON array; each item has `id`, `score`, plus metadata like `task_intent`, `approach`, `quality_score`, `key_insight`):
7
+ {candidates_json}
8
+
9
+ Return at most {top_k} items, sorted by score descending. Drop candidates whose score would be near 0.
10
+
11
+ Output strictly the following JSON, no prose:
12
+ {{"ranked": [{{"id": "<candidate_id>", "score": <float in 0..1>}}]}}
@@ -0,0 +1,25 @@
1
+ You are a clustering expert. Your goal is to group similar and related tasks together so that patterns and reusable strategies can be extracted from each cluster. Assign the new task intent to an existing cluster, or signal a new cluster if no existing cluster fits.
2
+
3
+ [How to decide]
4
+ The goal of clustering is to group cases that would produce a **specific, actionable skill** — not generic advice. Use this test: "Would an agent who solved one task in this cluster have a **concrete advantage** (reusable tools, domain knowledge, verified strategies) when facing the other tasks?"
5
+
6
+ 1. **Identify two dimensions**: the task's **subject domain** (e.g., medical research, urban planning, e-commerce) and its **problem-solving pattern** (e.g., root cause analysis, constraint satisfaction, data pipeline design).
7
+ 2. **Cluster by the more specific dimension**. If the domain is already narrow (e.g., "clinical trial data extraction"), domain alone is enough. If the domain is broad (e.g., "software engineering"), use the problem-solving pattern to differentiate (e.g., "performance profiling" vs. "schema migration").
8
+ 3. **Do NOT merge across unrelated domains just because the strategy is similar.** "Diagnose a patient's symptoms via differential diagnosis" and "diagnose a supply chain bottleneck via constraint analysis" both use diagnostic reasoning, but involve completely different domain knowledge and belong in separate clusters.
9
+ 4. Scan candidate clusters. Prefer the cluster whose existing items would **benefit most from sharing a skill** with the new task.
10
+ 5. Signal a new cluster (idx: -1) only when no candidate cluster is a good fit.
11
+
12
+ [Candidate Clusters]
13
+ Each cluster is represented by its list index (idx), item count, and recent preview texts.
14
+ {clusters_json}
15
+
16
+ [New Task Intent]
17
+ {memcell_text}
18
+
19
+ [Rules]
20
+ - Output decision as JSON. Keep "reason" under 50 tokens.
21
+ - To assign to an existing cluster: use its idx (non-negative integer).
22
+ - To create a new cluster: use idx -1.
23
+
24
+ Return ONLY valid JSON (no markdown fences, no explanation):
25
+ {{"idx": <existing_idx or -1>, "reason": "short reason"}}
@@ -0,0 +1,65 @@
1
+
2
+ You are an episodic memory generation expert. Please convert the following conversation into an episodic memory.
3
+
4
+ Conversation start time: {conversation_start_time}
5
+ Conversation content:
6
+ {conversation}
7
+
8
+ Custom instructions:
9
+ {custom_instructions}
10
+
11
+ IMPORTANT TIME HANDLING:
12
+ - Use the provided "Conversation start time" as the exact time when this conversation/episode began
13
+ - When the conversation mentions relative times (e.g., "yesterday", "last week"), preserve both the original relative expression AND calculate the absolute date
14
+ - Format time references as: "original relative time (absolute date)" - e.g., "last week (May 7, 2023)"
15
+ - This dual format supports both absolute and relative time-based questions
16
+ - All absolute time calculations should be based on the provided start time
17
+
18
+ Please generate a structured episodic memory and return only a JSON object containing the following two fields:
19
+ {{
20
+ "title": "A concise, descriptive title that accurately summarizes the theme (10-20 words)",
21
+ "content": "A concise factual record of the conversation in third-person narrative. It must include all important information: who participated at what time, what was discussed, what decisions were made, what emotions were expressed, and what plans or outcomes were formed. Write it as a chronological account focusing on observable actions and direct statements. Remove redundant expressions and verbose descriptions while preserving all facts, entities (names, dates, locations), and specific details. Keep the content concise without losing key information. Use the provided conversation start time as the base time for this episode."
22
+ }}
23
+
24
+ Requirements:
25
+ 1. The title should be specific and easy to search (including key topics/activities).
26
+ 2. The content must include all important information from the conversation while being concise.
27
+ 3. Convert the dialogue format into a narrative description.
28
+ 4. Maintain chronological order and causal relationships.
29
+ 5. Use third-person unless explicitly first-person.
30
+ 6. Include specific details that aid keyword search, especially concrete activities, places, and objects.
31
+ 7. For time references, use the dual format: "relative time (absolute date)" to support different question types.
32
+ 8. When describing decisions or actions, naturally include the reasoning or motivation behind them, but avoid repetitive explanations.
33
+ 9. Use specific names consistently rather than pronouns to avoid ambiguity in retrieval.
34
+ 10. CONCISENESS AND REDUNDANCY REMOVAL:
35
+ - Remove redundant expressions and verbose descriptions
36
+ - Avoid repeating the same information in different ways
37
+ - Eliminate unnecessary filler words and phrases
38
+ - Keep sentences direct and to the point
39
+ - Preserve all facts, entities (names, dates, locations), and specific details
40
+ - Maintain the core meaning and important information
41
+ - Aim for content length similar to or shorter than the original conversation
42
+ 11. CRITICAL DETAIL PRESERVATION:
43
+ - Person Names: Always include full names of people mentioned (e.g., "went to yoga with Amy's colleague, Rob" not just "went to yoga with a colleague")
44
+ - Special Nouns & Entities: Preserve all proper nouns, brand names, place names, organization names exactly as mentioned
45
+ - Item Names: Include specific product names, book titles, movie names, restaurant names, etc.
46
+ - Quantities & Numbers: Record exact numbers, amounts, prices, percentages, dates, times (e.g., "ordered 3 pizzas" not "ordered pizzas")
47
+ - Specific Activities: Use precise activity descriptions (e.g., "practiced hot yoga" not just "exercised")
48
+ - Time Points: Include all specific times mentioned (e.g., "at 3:30 PM", "every Tuesday", "twice a week")
49
+ 12. FREQUENCY INFORMATION:
50
+ - Record recurring activities and their frequency (e.g., "goes to yoga class every Tuesday and Thursday")
51
+ - Note patterns of behavior (e.g., "mentioned calling mom three times during the conversation")
52
+ - Include habitual actions (e.g., "usually has coffee at 8 AM before work")
53
+ - Document repetition counts (e.g., "asked about the project status twice")
54
+ 13. Language: write the title and content in the dominant language of the conversation. A predominantly Chinese conversation MUST be summarized in Chinese; a predominantly English conversation in English. Never mix unless the conversation itself mixes.
55
+
56
+
57
+ Example:
58
+ If the conversation start time is "March 14, 2024 (Thursday) at 3:00 PM UTC" and the conversation is about Caroline planning to go hiking:
59
+ {{
60
+ "title": "Caroline's Mount Rainier Hiking Plan March 14, 2024: Weekend Adventure Planning Session",
61
+ "content": "On March 14, 2024 at 3:00 PM UTC, Caroline expressed interest in hiking this weekend (March 16-17, 2024) and sought advice. She wanted to see the sunrise at Mount Rainier. When asked about gear by Melanie, Caroline received suggestions: hiking boots, warm clothing, flashlight, water, and high-energy food. Caroline decided to leave early Saturday morning (March 16, 2024) to catch the sunrise and planned to invite friends. She was excited about the trip."
62
+ }}
63
+
64
+ Return only the JSON object, do not add any other text:
65
+ Use strict JSON syntax. Escape double quotes and backslashes inside string values, and encode line breaks as \n. Quoted dialogue, paths, code, and braces are part of the content string and must remain inside it. Do not use unescaped quotes, literal line breaks inside strings, or trailing commas.
@@ -0,0 +1,12 @@
1
+ Given the user query and a list of retrieved episodic memories (or atomic facts extracted from them), determine whether each candidate contains information relevant to answering the query. Score each candidate from 0.0 (no relevant information) to 1.0 (directly answers the query).
2
+
3
+ User query:
4
+ {query}
5
+
6
+ Candidates (JSON array; each item has `id`, `score`, an `item_type` of either `episode` or `atomic_fact`, plus metadata like `episode` / `subject` / `summary` / `parent_episode_id`):
7
+ {candidates_json}
8
+
9
+ Return at most {top_k} items, sorted by score descending. Drop candidates whose score would be near 0.
10
+
11
+ Output strictly the following JSON, no prose:
12
+ {{"ranked": [{{"id": "<candidate_id>", "score": <float in 0..1>}}]}}