Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
dbac035
feat: skill memory
Jan 23, 2026
36f626a
feat: split task chunks for skill memories
endxxxx Jan 23, 2026
ec9316d
fix: refine the returned format from llm and parsing
endxxxx Jan 23, 2026
7702670
Merge pull request #4 from Wang-Daoji/feat/split_chunks
Wang-Daoji Jan 24, 2026
0d33b1d
feat: add new pack oss
Jan 24, 2026
3a88419
feat: skill mem pipeline
Jan 25, 2026
2903152
feat: fill code
Jan 26, 2026
bd119d6
feat: modify code
Jan 26, 2026
4173f7b
feat: modify code
Jan 26, 2026
bccba71
feat: async add skill memory
Jan 27, 2026
14f85e0
feat: update ollama version
Jan 27, 2026
b3c79ac
feat: get memory return skill memory
Jan 27, 2026
76f1975
feat: get api add skill mem
Jan 27, 2026
687cf9d
feat: get api add skill mem
Jan 27, 2026
8555b1d
feat: modify env config
Jan 27, 2026
ae67378
feat: back set oss client
Jan 27, 2026
793b508
feat: delete tmp skill code
Jan 27, 2026
1824f5b
feat: merge main
Jan 27, 2026
e3ef4cc
feat: process new package import error
Jan 27, 2026
f14fd58
Merge remote-tracking branch 'upstream/dev-20260126-v2.0.4' into feat…
Jan 27, 2026
6ba55d3
feat: modify oss config
Jan 27, 2026
85e42d9
feat: modiy prompt and add two api
Jan 28, 2026
be17f3f
feat: merge dev-20260126-v2.0.4
Jan 28, 2026
962f804
feat: modify prompt
Jan 28, 2026
aeeb27e
feat: merge
Jan 28, 2026
bbb6e79
feat: modify code
Jan 28, 2026
a32ec5f
Merge remote-tracking branch 'upstream/dev-20260126-v2.0.4' into feat…
Jan 28, 2026
dcfb772
feat: add logger
Jan 29, 2026
bc40783
Merge remote-tracking branch 'upstream/dev-20260126-v2.0.4' into feat…
Jan 29, 2026
b0946f1
feat: fix bug in memory id
Jan 29, 2026
0269c12
Merge remote-tracking branch 'upstream/dev-20260126-v2.0.4' into feat…
Jan 29, 2026
0026443
Merge branch 'main' into feat/skill_memory
Feb 2, 2026
1661363
fix:skill OSS + LOCAL存 zip
Feb 4, 2026
b7df634
fix:skill OSS + LOCAL存 zip
Feb 4, 2026
55611b4
fix:skill OSS + LOCAL存 zip
Feb 4, 2026
97c5956
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 5, 2026
a4d8a43
feat: new code
Feb 5, 2026
f97b7e2
fix: fix name error in polardb and related code
Feb 6, 2026
fc10547
fix: bug in polardb
Feb 6, 2026
66116d8
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 6, 2026
fc85390
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5'
Feb 6, 2026
74a8f9f
feat: optimize skill
Feb 6, 2026
609de9c
feat: merge branch solve confict
Feb 6, 2026
8976d6b
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5'
Feb 6, 2026
0bd4667
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 6, 2026
68392ba
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5'
Feb 6, 2026
cef079c
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 6, 2026
ed5ef1f
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 9, 2026
707dc8d
Merge remote-tracking branch 'wangyuan/feat/skill_memory'
Feb 9, 2026
c9e2b66
Merge pull request #6 from lalaChen2002/main
Wang-Daoji Feb 9, 2026
42b66c8
feat: local deploy
Feb 9, 2026
83704d2
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 9, 2026
42c1764
fix: modify code
Feb 9, 2026
88aa5a1
Merge remote-tracking branch 'upstream/dev-20260202-v2.0.5' into feat…
Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/memos/mem_reader/read_skill_memory/process_skill_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def _extract_skill_memory_by_llm_md(
seen_messages = set()

for mem in old_memories_dict:
if mem["metadata"]["memory_type"] == "SkillMemory" and mem["metadata"]["relativity"] > 0.02:
if mem["metadata"]["memory_type"] == "SkillMemory":
old_skill_content.append(
{
"id": mem["id"],
Expand Down Expand Up @@ -524,19 +524,25 @@ def _extract_skill_memory_by_llm_md(
)
chat_history_context = chat_history_context[-chat_history_max_length:]

# Prepare prompt
lang = detect_lang(messages_context)

# Prepare old memories context
old_skill_content = (
("Exsit Skill Schemas: \n" + json.dumps(old_skill_content, ensure_ascii=False, indent=2))
"已有技能列表: \n"
if lang == "zh"
else "Exsit Skill Schemas: \n" + json.dumps(old_skill_content, ensure_ascii=False, indent=2)
if old_skill_content
else ""
)

old_memories_context = "Relavant Context:\n" + "\n".join(
[f"{k}:\n{v}" for k, v in old_memories_context.items()]
old_memories_context = (
"相关历史对话:\n"
if lang == "zh"
else "Relavant Context:\n"
+ "\n".join([f"{k}:\n{v}" for k, v in old_memories_context.items()])
)

# Prepare prompt
lang = detect_lang(messages_context)
template = (
SKILL_MEMORY_EXTRACTION_PROMPT_MD_ZH if lang == "zh" else SKILL_MEMORY_EXTRACTION_PROMPT_MD
)
Expand Down Expand Up @@ -570,6 +576,10 @@ def _extract_skill_memory_by_llm_md(
"[PROCESS_SKILLS] No skill memory extracted from conversation (LLM returned null)"
)
return None
# If no old skill content, set update to False (for llm hallucination)
if not old_skill_content:
skill_memory["old_memory_id"] = ""
skill_memory["update"] = False

return skill_memory

Expand Down
8 changes: 4 additions & 4 deletions src/memos/templates/skill_mem_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@
# Skill Extraction Principles
To define the content of a skill, comprehensively analyze the dialogue content to create a list of reusable resources, including scripts, reference materials, and resources. Please generate the skill according to the following principles:
1. **Generalization**: Extract abstract methodologies that can be applied across scenarios. Avoid specific details (e.g., 'travel planning' rather than 'Beijing travel planning'). Moreover, the skills acquired should be durable and effective, rather than tied to a specific time.
2. **Similarity Check**: If a similar skill exists, set "update": true and provide the "old_memory_id". Otherwise, set "update": false and leave "old_memory_id" blank.
2. **Similarity Check**: If the skill list in 'existing skill memory' is not empty and there are skills with the **same topic**, you need to set "update": true and "old_memory_id". Otherwise, set "update": false and leave "old_memory_id" empty.
3. **Language Consistency**: Keep consistent with the language of the dialogue.
4. **Historical Usage Constraint**: Use 'historically related dialogues' as auxiliary context. If the current historical messages are insufficient to form a complete skill, and the historically related dialogue can provide missing information in the messages that is related to the current task objectives, execution methods, or constraints, it may be considered.
5. If the abstract methodology you extract and an existing skill memory describe the same topic (such as the same life scenario), be sure to use the update operation rather than creating a new methodology. Properly append it to the existing skill memory to ensure fluency and retain the information of the existing methodology.
Note: If the similarity check result shows that an existing **skill** description covers the same topic, be sure to use the update operation and set old_memory_id to the ID of the existing skill. Do not create a new methodology; make sure to reasonably add it to the existing skill memory, ensuring smoothness while preserving the information of the existing methodology.

# Output Format and Field Specifications
## Output Format
Expand Down Expand Up @@ -320,10 +320,10 @@
# 技能提取原则
为了确定技能的内容,综合分析对话内容以创建可重复使用资源的清单,包括脚本、参考资料和资源,请你按照下面的原则来生成技能:
1. **通用化**:提取可跨场景应用的抽象方法论。避免具体细节(如"旅行规划"而非"北京旅行规划")。 而且提取的技能应该是持久有效的,而非与特定时间绑定。
2. **相似性检查**:如存在相似技能,设置"update": true 及"old_memory_id"。否则设置"update": false 并将"old_memory_id"留空。
2. **相似性检查**:如果‘现有技能记忆’中的技能列表不为空,且存在**相同主题**的技能,则需要设置"update": true 及"old_memory_id"。否则设置"update": false 并将"old_memory_id"留空。
3. **语言一致性**:与对话语言保持一致。
4. **历史使用约束**:“历史相关对话”作为辅助上下文,若当前历史消息不足以形成完整的技能,且历史相关对话能提供 messages 中缺失、且与当前任务目标、执行方式或约束相关的信息增量时,可以纳入考虑。
5. 如果你提取的抽象方法论和已有的技能记忆描述的是同一个主题(比如同一个生活场景),请务必使用更新操作,不要新建一个方法论,注意合理的追加到已有的技能记忆上,保证通顺且不丢失已有方法论的信息
注意:如果相似性检查结果是存在已有的**一个**技能描述的是同一个主题,请务必使用更新操作,并将old_memory_id设置为该历史技能的id,不要新建一个方法论,注意合理的追加到已有的技能记忆上,保证通顺的同时不丢失已有方法论的信息

# 输出格式的模版和字段规范描述
## 输出格式
Expand Down