From 7e6a3099359612fed4981d65b4f64918732b5e08 Mon Sep 17 00:00:00 2001 From: zhayujie Date: Tue, 9 Jun 2026 10:49:43 +0800 Subject: [PATCH] feat(evolution): default on for new installs, unify naming, add docs --- agent/evolution/executor.py | 8 +++++++ config-template.json | 3 ++- config.py | 2 +- docs/ja/memory/self-evolution.mdx | 6 ++--- docs/memory/self-evolution.mdx | 18 +++++++++++--- docs/zh/memory/self-evolution.mdx | 40 ++++++++++++++++++++----------- docs/zh/releases/overview.mdx | 2 +- docs/zh/releases/v2.1.1.mdx | 8 +++---- run.sh | 3 +++ 9 files changed, 63 insertions(+), 27 deletions(-) diff --git a/agent/evolution/executor.py b/agent/evolution/executor.py index 20f36864..278ad6b2 100644 --- a/agent/evolution/executor.py +++ b/agent/evolution/executor.py @@ -464,6 +464,14 @@ def run_evolution_for_session( append_session_evolution(workspace_dir, result, backup_id=backup_id, user_id=user_id) # Inject an [EVOLUTION] note so the main agent can honor "undo". _inject_evolution_record(agent_bridge, session_id, channel_type, result, backup_id) + # The injection appended its own messages ([SCHEDULED]/[EVOLUTION]). + # Advance the cursor past them so the next scan does not treat + # evolution's own bookkeeping as new user content and re-trigger. + try: + with agent.messages_lock: + agent._evo_done_msg_count = len(agent.messages) + except Exception: + pass # Push the summary to the user's channel. The "did a file actually # change" gate above is the only throttle we need: real evolutions are diff --git a/config-template.json b/config-template.json index 8be82885..1fa50b24 100644 --- a/config-template.json +++ b/config-template.json @@ -40,5 +40,6 @@ "agent_max_steps": 20, "enable_thinking": false, "reasoning_effort": "high", - "knowledge": true + "knowledge": true, + "self_evolution_enabled": true } diff --git a/config.py b/config.py index 1f1100fe..0f64f6fc 100644 --- a/config.py +++ b/config.py @@ -252,7 +252,7 @@ available_setting = { "reasoning_effort": "high", # Reasoning depth under thinking mode: "high" or "max" "knowledge": True, # whether to enable the knowledge base feature # Self-evolution: review idle conversations to learn memory/skills. Flat keys. - "self_evolution_enabled": False, # master switch (off until release) + "self_evolution_enabled": False, # switch to enable/disable self-evolution "self_evolution_idle_minutes": 15, # idle time before a session is reviewed "self_evolution_min_turns": 8, # min user turns (or context pressure) to trigger "skill": {}, # Per-skill runtime config; nested keys flatten to SKILL__ env vars at startup diff --git a/docs/ja/memory/self-evolution.mdx b/docs/ja/memory/self-evolution.mdx index c25fb704..7b065b92 100644 --- a/docs/ja/memory/self-evolution.mdx +++ b/docs/ja/memory/self-evolution.mdx @@ -36,13 +36,13 @@ description: Self-Evolution — 会話がアイドル状態になった後に振 ### 関連設定 -自律進化はデフォルトでは無効です。Web コンソールの「設定 → Agent 設定」(「ディープシンキング」の下)にあるスイッチで有効にできるほか、設定ファイルで調整することもできます: +自律進化は Web コンソールの「設定 → Agent 設定」(「ディープシンキング」の下)にあるスイッチで切り替えられるほか、設定ファイルで調整することもできます: | パラメータ | 説明 | デフォルト値 | | --- | --- | --- | -| `self_evolution_enabled` | 自律進化を有効にするかどうか | `false` | +| `self_evolution_enabled` | 自律進化を有効にするかどうか(新規インストールはデフォルトで有効) | `false` | | `self_evolution_idle_minutes` | 会話がアイドル状態になってからトリガーするまでの時間(分) | `15` | -| `self_evolution_min_turns` | トリガーに必要な最小会話ターン数 | `6` | +| `self_evolution_min_turns` | トリガーに必要な最小会話ターン数 | `8` | Web コンソールでは有効・無効のスイッチのみを提供しています。アイドル時間やターン数のしきい値を変更したい場合は、設定ファイルを編集してください。変更は即時に反映され、再起動は不要です。 diff --git a/docs/memory/self-evolution.mdx b/docs/memory/self-evolution.mdx index ad0ebd73..01838bc7 100644 --- a/docs/memory/self-evolution.mdx +++ b/docs/memory/self-evolution.mdx @@ -11,6 +11,10 @@ Self-Evolution lets the Agent do more than finish one task at a time; it keeps i > Self-Evolution complements [Deep Dream](/memory/deep-dream). Deep Dream organizes memory itself, while Self-Evolution goes a step further to improve skills and push unfinished tasks forward, sharpening the Agent's abilities through everyday use. + + Self-Evolution in a conversation + + ### Three Goals Self-Evolution focuses on three things: @@ -36,13 +40,17 @@ Only when both are met does a review begin. This makes sure there is something w ### Configuration -Self-Evolution is off by default. You can turn it on with the toggle in the Web console under **Settings → Agent Config** (below "Deep Thinking"), or adjust it in the config file: +You can toggle Self-Evolution in the Web console under **Settings → Agent Config** (below "Deep Thinking"), or adjust it in the config file: | Parameter | Description | Default | | --- | --- | --- | -| `self_evolution_enabled` | Whether Self-Evolution is enabled | `false` | +| `self_evolution_enabled` | Whether Self-Evolution is enabled (on by default for new installs) | `false` | | `self_evolution_idle_minutes` | How long the conversation must be idle before it triggers (minutes) | `15` | -| `self_evolution_min_turns` | Minimum conversation turns required to trigger | `6` | +| `self_evolution_min_turns` | Minimum conversation turns required to trigger | `8` | + + + Enable Self-Evolution in the Web console + The Web console only exposes the on/off toggle. To change the idle window or the turn threshold, edit the config file. Changes take effect immediately, with no restart needed. @@ -52,6 +60,10 @@ Self-Evolution is off by default. You can turn it on with the toggle in the Web Each review is recorded by date in `memory/evolution/YYYY-MM-DD.md`, viewable in the Web console under the **Memory → Self-Evolution** tab. That tab gathers both self-evolution records and dream diaries in one place, so you can look back on how the Agent has grown. + + Self-Evolution records list + + ### Rolling Back If you disagree with a change from a review, just tell the Agent in chat to undo the last change. It restores the affected files from the backup taken before the review. Every review keeps its own backup, so they never interfere with each other. diff --git a/docs/zh/memory/self-evolution.mdx b/docs/zh/memory/self-evolution.mdx index 3557f018..aaec09b4 100644 --- a/docs/zh/memory/self-evolution.mdx +++ b/docs/zh/memory/self-evolution.mdx @@ -1,19 +1,23 @@ --- -title: 自进化 -description: Self-Evolution — 会话空闲后自动复盘,沉淀记忆、优化技能、处理未完成事项 +title: 自主进化 +description: Self-Evolution:自动复盘,沉淀记忆、优化技能、处理未完成事项 --- ## 功能介绍 ### 简介 -自进化(Self-Evolution)让 Agent 不止于"完成单次任务",而是能在与你的相处中持续成长。每段对话告一段落后,它会自动"回头复盘"一次:把使用中暴露的问题修进技能、把没做完的事情接着推进,并把值得记住的沉淀进记忆与知识库。久而久之,Agent 会越来越懂你的偏好、越来越少重复犯错、越来越主动地把事情收尾,而这一切都在后台静默完成,只有真正做了事情时才会简短地告诉你。 +自主进化(Self-Evolution)让 Agent 不止于"完成单次任务",而是能在与你的相处中持续成长。在每段对话告一段落后,它会自动"回头复盘"一次:把使用中暴露的问题修进技能、把没做完的事情接着推进,并把值得记住的沉淀进记忆与知识库。久而久之,Agent 会越来越懂你的偏好、越来越少重复犯错、越来越主动地把事情收尾,而这一切都在后台静默完成,当真正做了事情时才会主动地告诉你。 -> 它与[梦境蒸馏](/zh/memory/deep-dream)互补:梦境蒸馏负责整理记忆本身,自进化则在记忆之外,进一步优化技能、推进未完成的任务,让 Agent 的能力随使用不断打磨。 +> 它与[梦境蒸馏](/zh/memory/deep-dream)互补:梦境蒸馏负责整理记忆本身,自主进化则在记忆之外,进一步优化技能、推进未完成的任务,让 Agent 的能力随使用不断打磨。 + + + 自主进化对话示例 + ### 几个目标 -自进化围绕以下几件事工作,并以「优化技能、处理未完成事项」为主,「沉淀记忆、知识」作为主对话的查缺补漏: +自主进化围绕以下几件事工作,并以「优化技能、处理未完成事项」为主,「沉淀记忆、知识」作为主对话的查缺补漏: | 目标 | 说明 | | --- | --- | @@ -28,22 +32,26 @@ description: Self-Evolution — 会话空闲后自动复盘,沉淀记忆、优 ### 触发时机 -自进化不是定时执行,而是在**一段对话自然结束、进入空闲后**才触发,避免打断正在进行的交流。需要同时满足: +自主进化不是定时执行,而是在**一段对话自然结束、进入空闲后**才触发,避免打断正在进行的交流。需要同时满足: - **对话已空闲** — 距离最后一次互动超过设定的空闲时长(默认 15 分钟) -- **对话有足够内容** — 自上次进化以来累积了足够轮次,或上下文已接近容量上限 +- **对话有足够内容** — 自上次进化以来累积了足够轮次(默认 8 轮),或上下文已接近容量上限 只有两个条件都满足,才会启动一次复盘。这样既保证有足够的内容值得复盘,又不会在你还在对话时打扰你。 ### 相关配置 -自进化默认关闭,可在 Web 控制台「配置 → Agent 配置」中通过开关启用(位于"深度思考"下方),也可在配置文件中调整: +自主进化可在 Web 控制台「配置 → Agent 配置」中通过开关启停(位于"深度思考"下方),也可在配置文件中调整: | 参数 | 说明 | 默认值 | | --- | --- | --- | -| `self_evolution_enabled` | 是否启用自进化 | `false` | +| `self_evolution_enabled` | 是否启用自主进化(新部署默认开启) | `false` | | `self_evolution_idle_minutes` | 对话空闲多久后触发(分钟) | `15` | -| `self_evolution_min_turns` | 触发所需的最少对话轮次 | `6` | +| `self_evolution_min_turns` | 触发所需的最少对话轮次 | `8` | + + + 在 Web 控制台开启自主进化 + Web 控制台只提供启用开关,若需调整空闲时长或轮次阈值,请编辑配置文件。修改后即时生效,无需重启。 @@ -51,7 +59,11 @@ description: Self-Evolution — 会话空闲后自动复盘,沉淀记忆、优 ### 进化记录 -每次进化的过程和结果会按日期记录在 `memory/evolution/YYYY-MM-DD.md` 中,可在 Web 控制台的「记忆管理 → 自进化」tab 中查看。该 tab 同时汇总了自进化记录与梦境日记,方便统一回顾 Agent 的成长轨迹。 +每次进化的过程和结果会按日期记录在 `memory/evolution/YYYY-MM-DD.md` 中,可在 Web 控制台的「记忆管理 → 自主进化」tab 中查看。该 tab 同时汇总了自主进化记录与梦境日记,方便统一回顾 Agent 的成长轨迹。 + + + 自主进化记录列表 + ### 如何回滚 @@ -59,7 +71,7 @@ description: Self-Evolution — 会话空闲后自动复盘,沉淀记忆、优 ## 实现设计 -自进化复用了系统已有的能力,保持轻量: +自主进化复用了系统已有的能力,保持轻量: - **隔离执行**:每次复盘都启动一个独立的、临时的复盘任务,使用与主对话相同的模型,但拥有受限的工具集(只能读上下文、改记忆与技能文件)。它不会污染主对话的上下文,也不会影响主对话的性能。 - **基于备份的撤销**:进化前对相关文件做快照备份,撤销时按备份还原,因此每一次改动都可追溯、可逆。 @@ -67,13 +79,13 @@ description: Self-Evolution — 会话空闲后自动复盘,沉淀记忆、优 ### 克制与安全 -自进化的设计原则是"必要时执行,减少打扰": +自主进化的设计原则是"必要时执行,减少打扰": | 机制 | 说明 | | --- | --- | | **没做事不通知** | 如果复盘后没有任何实际改动,全程静默,不产生任何通知 | | **空闲才触发** | 仅在对话空闲后运行,绝不打断正在进行的对话 | | **改动可回滚** | 每次进化前自动备份,若对结果不满意,可一键撤销本次改动 | -| **保护内置技能** | 产品自带的内置技能受保护,进化过程不会改动 | +| **保护内置技能** | 项目自带的内置技能受保护,进化过程不会改动 | | **限定工作空间** | 所有读写都限定在工作空间内,不会触碰系统其他文件 | | **后台异步** | 复盘在后台进行,不阻塞正常对话回复 | diff --git a/docs/zh/releases/overview.mdx b/docs/zh/releases/overview.mdx index 84013906..42a8ced0 100644 --- a/docs/zh/releases/overview.mdx +++ b/docs/zh/releases/overview.mdx @@ -5,7 +5,7 @@ description: CowAgent 版本更新历史 | 版本 | 日期 | 说明 | | --- | --- | --- | -| [2.1.1](/zh/releases/v2.1.1) | 2026.06.08 | 自进化能力、Web 控制台消息管理升级、MCP 跨平台增强与并发调用、新模型接入(MiniMax-M3、qwen3.7-plus 等)、多项优化 | +| [2.1.1](/zh/releases/v2.1.1) | 2026.06.08 | 自主进化能力、Web 控制台消息管理升级、MCP 跨平台增强与并发调用、新模型接入(MiniMax-M3、qwen3.7-plus 等)、多项优化 | | [2.1.0](/zh/releases/v2.1.0) | 2026.06.01 | 国际化支持、新增 Telegram / Discord / Slack / 微信客服通道、命令行交互升级(流式输出、命令模糊匹配、任务取消)、MCP Streamable HTTP、新模型接入 | | [2.0.9](/zh/releases/v2.0.9) | 2026.05.22 | 新增模型管理、MCP 协议支持、浏览器登录态持久化、新模型接入(gpt-5.5、gemini-3.5-flash、qwen3.7-max 等)、部署安全加固 | | [2.0.8](/zh/releases/v2.0.8) | 2026.05.06 | 飞书渠道全面升级(语音、流式输出和Markdown、扫码一键接入)、DeepSeek V4和百度模型新增、定时任务工具增强 | diff --git a/docs/zh/releases/v2.1.1.mdx b/docs/zh/releases/v2.1.1.mdx index bafbdeec..5f275984 100644 --- a/docs/zh/releases/v2.1.1.mdx +++ b/docs/zh/releases/v2.1.1.mdx @@ -1,13 +1,13 @@ --- title: v2.1.1 -description: CowAgent 2.1.1 - 自进化能力、Web 控制台消息管理升级、MCP 跨平台增强、多模型接入与优化 +description: CowAgent 2.1.1 - 自主进化能力、Web 控制台消息管理升级、MCP 跨平台增强、多模型接入与优化 --- 🌐 [English](https://docs.cowagent.ai/releases/v2.1.1) | [中文](https://docs.cowagent.ai/zh/releases/v2.1.1) -## 🧬 自进化能力 +## 🧬 自主进化能力 -CowAgent 新增**自进化(Self-Evolution)**能力,让 Agent 不止于完成单次任务,而是在与你的日常协作中持续成长: +CowAgent 新增**自主进化(Self-Evolution)**能力,让 Agent 不止于完成单次任务,而是在与你的日常协作中持续成长: - **自动复盘成长**:一段对话自然结束并进入空闲后,Agent 会在后台悄悄回顾刚刚的对话,沉淀值得记住的偏好和事实、修复技能中暴露的问题、并补做未完成的任务 - **越用越懂你**:随着使用,Agent 会逐渐记住你的习惯、减少重复犯错,在收尾上做得更好 @@ -16,7 +16,7 @@ CowAgent 新增**自进化(Self-Evolution)**能力,让 Agent 不止于完 默认关闭,可在 Web 控制台 **设置 → Agent 配置** 中一键开启。 -相关文档:[自进化](https://docs.cowagent.ai/zh/memory/self-evolution) +相关文档:[自主进化](https://docs.cowagent.ai/zh/memory/self-evolution) ## 💬 Web 控制台消息管理升级 diff --git a/run.sh b/run.sh index 1099eb43..1895ea67 100755 --- a/run.sh +++ b/run.sh @@ -881,6 +881,9 @@ base = { 'agent_max_context_tokens': 40000, 'agent_max_context_turns': 30, 'agent_max_steps': 15, + # New installs opt into self-evolution; existing users (no key) keep the + # code default (off) so an upgrade never silently changes their behavior. + 'self_evolution_enabled': True, } channel_map = { 'feishu': {'feishu_app_id': 'FEISHU_APP_ID', 'feishu_app_secret': 'FEISHU_APP_SECRET'},