Skip to content

Commit e70d19a

Browse files
committed
feat(fs): update model configurations and enhance summarizer functionality
1 parent 011cabc commit e70d19a

File tree

5 files changed

+85
-18
lines changed

5 files changed

+85
-18
lines changed

reme/agent/chat/fs_cli.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from ...core.enumeration import Role, ChunkEnum
77
from ...core.op import BaseReactStream
88
from ...core.schema import Message, StreamChunk
9+
from ...tool.fs import BashTool, LsTool, ReadTool, WriteTool, EditTool
910

1011

1112
class FsCli(BaseReactStream):
@@ -52,7 +53,17 @@ async def reset(self) -> str:
5253

5354
# Summarize current conversation and save to memory files
5455
current_date = datetime.now().strftime("%Y-%m-%d")
55-
summarizer = FsSummarizer(tools=self.tools, working_dir=self.working_dir)
56+
summarizer = FsSummarizer(
57+
tools=[
58+
BashTool(cwd=self.working_dir),
59+
LsTool(cwd=self.working_dir),
60+
ReadTool(cwd=self.working_dir),
61+
WriteTool(cwd=self.working_dir),
62+
EditTool(cwd=self.working_dir),
63+
],
64+
working_dir=self.working_dir,
65+
language=self.language,
66+
)
5667

5768
result = await summarizer.call(
5869
messages=self.messages,
@@ -113,7 +124,7 @@ async def compact(self, force_compact: bool = False) -> str:
113124
left_messages = cut_result.get("left_messages", [])
114125

115126
# Step 2: Generate summary via Compactor
116-
compactor = FsCompactor()
127+
compactor = FsCompactor(language=self.language)
117128
summary_content = await compactor.call(
118129
messages_to_summarize=messages_to_summarize,
119130
turn_prefix_messages=turn_prefix_messages,

reme/agent/fs/fs_summarizer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
class FsSummarizer(BaseReact):
1414
"""Retrieve personal memories through vector search and history reading."""
1515

16-
def __init__(self, memory_dir: str = "memory", version: str = "default", **kwargs):
16+
def __init__(self, working_dir: str, memory_dir: str = "memory", version: str = "default", **kwargs):
1717
super().__init__(**kwargs)
18+
self.working_dir: str = working_dir
1819
self.memory_dir: str = memory_dir
1920
self.version: str = version
2021

@@ -29,6 +30,7 @@ async def build_messages(self) -> list[Message]:
2930
content=self.prompt_format(
3031
"user_message_default",
3132
conversation=format_messages(messages, add_index=False),
33+
working_dir=self.working_dir,
3234
date=date_str,
3335
memory_dir=self.memory_dir,
3436
),

reme/agent/fs/fs_summarizer.yaml

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,78 @@ user_message: |
1010
If nothing to store, reply with [SILENT].
1111
1212
user_message_default: |
13+
Pre-compaction memory flush turn.
14+
The session is near auto-compaction; capture durable memories to disk.
15+
16+
Current Date: {date}
17+
Working Dir: {working_dir}
18+
19+
Store durable memories now (use {memory_dir}/YYYY-MM-DD.md).
20+
21+
Workflow:
22+
1. Use read_tool to read {memory_dir}/YYYY-MM-DD.md (if file doesn't exist, read_tool tool will return an error)
23+
2. Intelligently merge new information with existing content (skip if file doesn't exist):
24+
- Avoid duplicating information that's already recorded
25+
- Enrich existing entries with new details when relevant
26+
- Maintain chronological order when applicable
27+
3. Write the updated content:
28+
- Use edit_tool to update specific sections when possible
29+
- Use write_tool to overwrite the entire file if major restructuring is needed
30+
4. Create {memory_dir}/ if it doesn't exist
31+
32+
Principles:
33+
- Always preserve timestamps, dates, and time-related context
34+
- Only add truly new or enriching information
35+
- Keep entries concise but complete
36+
- If nothing meaningful to store, reply with [SILENT]
37+
38+
39+
user_message_default_zh: |
40+
预压缩内存刷新轮次。
41+
当前会话即将进入自动压缩阶段;请将持久化记忆捕获并写入磁盘。
42+
43+
当前日期:{date}
44+
工作目录:{working_dir}
45+
46+
立即存储持久化记忆(使用路径 {memory_dir}/YYYY-MM-DD.md)。
47+
48+
工作流程:
49+
1. 使用 read_tool 读取 {memory_dir}/YYYY-MM-DD.md(如文件不存在,read_tool 会返回错误提示)
50+
2. 智能合并新信息与现有内容(若文件不存在则跳过合并):
51+
- 避免重复已记录的信息
52+
- 在相关时丰富现有条目的新细节
53+
- 在适用时保持时间顺序
54+
3. 写入更新后的内容:
55+
- 尽可能使用 edit_tool 更新特定部分
56+
- 如需大幅重构则使用 write_tool 覆盖整个文件
57+
4. 如 {memory_dir}/ 不存在则创建
58+
59+
原则:
60+
- 始终保留时间戳、日期和时间相关上下文
61+
- 仅添加真正新的或有丰富价值的信息
62+
- 保持条目简洁但完整
63+
- 若无有意义的内容可存储,请回复 [SILENT]
64+
65+
66+
user_message_v1: |
1367
<conversation>
1468
{conversation}
1569
</conversation>
1670
1771
The conversation is about to be compacted. Please extract persistent memories to disk.
1872
Current Date: {date}
73+
Working Dir: {working_dir}
1974
2075
Execution Flow:
2176
1. Determine if the conversation contains information worth storing
2277
- If no: Reply with reason + [SILENT]
2378
- If yes: Continue to step 2
2479
25-
2. Check file {memory_dir}/YYYY-MM-DD.md (use actual date)
26-
- File doesn't exist: Write new memories directly
27-
- File exists:
28-
a) Read existing content
29-
b) Compare and identify new/updated information
30-
c) Prefer edit_tool for precise additions (preserves existing content); write_tool overwrites entire file
80+
2. Use Read tool to read {memory_dir}/YYYY-MM-DD.md (use actual date)
81+
- If file doesn't exist (Read returns error): Write new memories directly
82+
- If file exists:
83+
a) Compare and identify new/updated information from the read content
84+
c) Prefer `edit_tool` for precise additions (preserves existing content); `write_tool` overwrites entire file
3185
d) If no new information: Reply with explanation + [SILENT]
3286
3387
Update Principles:
@@ -41,25 +95,25 @@ user_message_default: |
4195
4296
Please store persistent memories, keeping entries concise and well-structured.
4397
44-
user_message_default_zh: |
98+
user_message_v1_zh: |
4599
<conversation>
46100
{conversation}
47101
</conversation>
48102
49103
conversation即将压缩,请提取持久性记忆存储至磁盘。
50104
当前日期:{date}
105+
工作目录: {working_dir}
51106
52107
执行流程:
53108
1. 判断对话是否包含值得存储的信息
54109
- 若无:回复原因 + [SILENT]
55110
- 若有:继续步骤 2
56111
57-
2. 检查文件 {memory_dir}/YYYY-MM-DD.md(使用实际日期)
58-
- 文件不存在:直接写入新记忆
112+
2. 使用 Read 工具读取 {memory_dir}/YYYY-MM-DD.md(使用实际日期)
113+
- 文件不存在(Read 返回错误):直接使用 `write_tool` 写入新记忆
59114
- 文件已存在:
60-
a) 读取现有内容
61-
b) 对比识别新增/更新信息
62-
c) 优先使用 edit_tool 精准添加新信息(保留已有内容),write_tool 会覆盖整个文件
115+
a) 从读取的内容中对比识别新增/更新信息
116+
c) 优先使用 `edit_tool` 精准添加新信息(保留已有内容)
63117
d) 若无新信息:回复说明 + [SILENT]
64118
65119
更新原则:

reme/config/default.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ flows:
2020
llms:
2121
default:
2222
backend: openai
23-
# model_name: qwen3-30b-a3b-instruct-2507
24-
model_name: qwen3-next-80b-a3b-thinking
23+
model_name: qwen3-30b-a3b-instruct-2507
2524
# model_name: qwen3-30b-a3b-thinking-2507
2625
request_interval: 1
2726
# temperature: 0.0001

reme/config/fs.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ llms:
44
default:
55
backend: openai
66
# model_name: qwen3-30b-a3b-instruct-2507
7-
model_name: qwen3-30b-a3b-thinking-2507
7+
# model_name: qwen3-30b-a3b-thinking-2507
8+
model_name: qwen3-235b-a22b-thinking-2507
89
request_interval: 1
910
# temperature: 0.0001
1011

0 commit comments

Comments
 (0)