Skip to content

JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.

Python

feature:轨迹落盘使用默认目录

Zql9965a229011ec5
diff --git a/docs/en/Configuration.md b/docs/en/Configuration.md
index c3b865bba7..571c0ca34c 100644
--- a/docs/en/Configuration.md
+++ b/docs/en/Configuration.md
@@ -239,9 +239,8 @@ The frontend shows the following options under **Self-Evolution Configuration**:
| **Soft review trigger** | `react.evolution.review_trigger` | `false` | When enabled, periodically enqueue review self-check follow-ups. Env `EVOLUTION_REVIEW_TRIGGER` takes precedence |
| **Auto-save approvals** | `react.evolution.auto_save` | `false` | When enabled, evolution approvals auto-pass without user clicks |
| **Auto-suggest new skill creation** | `react.evolution.skill_create` | `false` | When enabled, the system can propose creating a new Skill when no suitable Skill exists. Env `SKILL_CREATE` takes precedence |
-| **Trajectory dump directory** | `react.evolution.trajectory_dir` | `agent/evolution_trajectories` | Directory for skill-evolution execution trajectories (JSONL). Relative paths are resolved against the workspace root; absolute paths are used as-is. Env `EVOLUTION_TRAJECTORY_DIR` takes precedence; if neither is set, defaults to `~/.jiuwenswarm/agent/evolution_trajectories` |
-> 💡 **Note**: `react.evolution.enabled` is the product master switch (on by default). After the evolution rail is mounted, passive scanning is always on; there is no separate `auto_scan` / `signal_trigger` sub-switch. `review_trigger` / `auto_save` / `skill_create` are optional. With `skill_create` off and `review_trigger` off, passive scanning still runs and manual `/evolve` remains available.
+> 💡 **Note**: `react.evolution.enabled` is the product master switch (on by default). After the evolution rail is mounted, passive scanning is always on; there is no separate `auto_scan` / `signal_trigger` sub-switch. `review_trigger` / `auto_save` / `skill_create` are optional. With `skill_create` off and `review_trigger` off, passive scanning still runs and manual `/evolve` remains available. Execution trajectories always dump to the default directory `~/.jiuwenswarm/agent/evolution_trajectories`; config and env overrides are not supported.
> 📖 For details on the self-evolution mechanism, see [Skill Self-Evolution](SkillSelfEvolution.md).
diff --git "a/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md" "b/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md"
index e3a249adbc..60dfe6a65b 100644
--- "a/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md"
+++ "b/docs/zh/\351\205\215\347\275\256\344\277\241\346\201\257.md"
@@ -237,9 +237,8 @@ Embed 模型的主要作用:
| **软触发 Review** | `react.evolution.review_trigger` | `false` | 开启后周期性入队 review 自检 follow-up。环境变量 `EVOLUTION_REVIEW_TRIGGER` 优先 |
| **自动保存审批** | `react.evolution.auto_save` | `false` | 开启后演进审批无需用户点击即可自动通过 |
| **自动建议创建新技能** | `react.evolution.skill_create` | `false` | 开启后,系统可以在缺少合适 Skill 时提出自动创建建议。环境变量 `SKILL_CREATE` 优先 |
-| **执行轨迹落盘目录** | `react.evolution.trajectory_dir` | `agent/evolution_trajectories` | 技能演进执行轨迹 JSONL 目录。相对路径相对工作区根目录;绝对路径直接使用。环境变量 `EVOLUTION_TRAJECTORY_DIR` 优先;均未设置时默认 `~/.jiuwenswarm/agent/evolution_trajectories` |
-> 💡 **说明**:`react.evolution.enabled` 是产品总开关(默认开启)。挂载演进 Rail 后被动扫描始终开启,不再提供独立的 `auto_scan` / `signal_trigger` 子开关。`review_trigger` / `auto_save` / `skill_create` 为可选子开关;当 `skill_create` 关闭且未开启 `review_trigger` 时,系统仍会做被动扫描,并响应手动 `/evolve` 指令。
+> 💡 **说明**:`react.evolution.enabled` 是产品总开关(默认开启)。挂载演进 Rail 后被动扫描始终开启,不再提供独立的 `auto_scan` / `signal_trigger` 子开关。`review_trigger` / `auto_save` / `skill_create` 为可选子开关;当 `skill_create` 关闭且未开启 `review_trigger` 时,系统仍会做被动扫描,并响应手动 `/evolve` 指令。执行轨迹固定落盘到默认目录 `~/.jiuwenswarm/agent/evolution_trajectories`,不再通过配置项或环境变量覆盖。
> 📖 **详情**:关于自演进机制的详细说明,请参考 [Skill 自演进](Skill自演进.md) 文档。
diff --git a/jiuwenswarm/resources/.env.template b/jiuwenswarm/resources/.env.template
index 48c4751f05..7ed2793dc1 100644
--- a/jiuwenswarm/resources/.env.template
+++ b/jiuwenswarm/resources/.env.template
@@ -138,11 +138,6 @@ NO_PROXY=localhost,127.0.0.1,api.openai.rnd.huawei.com
# Memory mode (default is "local" when empty)
MEMORY_MODE=
-# Skill evolution trajectory dump directory (JSONL).
-# Overrides react.evolution.trajectory_dir. Empty = use config / default
-# (~/.jiuwenswarm/agent/evolution_trajectories).
-# EVOLUTION_TRAJECTORY_DIR=
-
# Extension package search dirs, separated by ';'
EXTENSION_DIRS=""
diff --git a/jiuwenswarm/resources/config.team.distributed.leader.yaml b/jiuwenswarm/resources/config.team.distributed.leader.yaml
index 5670e74be6..5d4be8f009 100644
--- a/jiuwenswarm/resources/config.team.distributed.leader.yaml
+++ b/jiuwenswarm/resources/config.team.distributed.leader.yaml
@@ -239,7 +239,6 @@ react:
review_trigger: # true / false = 软触发 review follow-up;默认 false
auto_save: false # true = 自演进审批无需用户点击自动通过(内部开关)
skill_base_dir: "agent/skills" # Skill 根目录
- trajectory_dir: "agent/evolution_trajectories" # 执行轨迹 JSONL 落盘目录;相对路径相对工作区,可用 EVOLUTION_TRAJECTORY_DIR 覆盖
a2x_registry:
base_url: "http://127.0.0.1:8000"
timeout: 30.0
diff --git a/jiuwenswarm/resources/config.team.distributed.teammate.yaml b/jiuwenswarm/resources/config.team.distributed.teammate.yaml
index 896ec19bbc..90183ecbd0 100644
--- a/jiuwenswarm/resources/config.team.distributed.teammate.yaml
+++ b/jiuwenswarm/resources/config.team.distributed.teammate.yaml
@@ -244,7 +244,6 @@ react:
skill_create: false # true = 注册 SkillCreateRail(单 agent)及 TeamSkillCreateRail(leader)
auto_save: false # true = 自演进审批无需用户点击自动通过(内部开关)
skill_base_dir: "agent/skills" # Skill 根目录
- trajectory_dir: "agent/evolution_trajectories" # 执行轨迹 JSONL 落盘目录;相对路径相对工作区,可用 EVOLUTION_TRAJECTORY_DIR 覆盖
a2x_registry:
base_url: "http://127.0.0.1:8000"
timeout: 30.0
diff --git a/jiuwenswarm/resources/config.yaml b/jiuwenswarm/resources/config.yaml
index 0d7ae7cabd..bbc1216c81 100644
--- a/jiuwenswarm/resources/config.yaml
+++ b/jiuwenswarm/resources/config.yaml
@@ -48,7 +48,6 @@ symphony:
auto_save: true # true = 自演进审批无需用户点击自动通过(内部开关)
skill_create: true # true = 注册 SkillCreateRail(单 agent)及 TeamSkillCreateRail(leader)
skill_base_dir: "agent/skills" # Skill 根目录
- trajectory_dir: "agent/evolution_trajectories" # 执行轨迹 JSONL 落盘目录;相对路径相对工作区,可用 EVOLUTION_TRAJECTORY_DIR 覆盖
orchestration:
# fast is the default one-shot path; beam enables bidirectional search.
@@ -568,7 +567,6 @@ react:
auto_save: false # true = 自演进审批无需用户点击自动通过(内部开关)
skill_create: false # true = 注册 SkillCreateRail(单 agent)及 TeamSkillCreateRail(leader)
skill_base_dir: "agent/skills" # Skill 根目录
- trajectory_dir: "agent/evolution_trajectories" # 执行轨迹 JSONL 落盘目录;相对路径相对工作区,可用 EVOLUTION_TRAJECTORY_DIR 覆盖
a2x_registry:
base_url: "http://127.0.0.1:8000"
timeout: 30.0
diff --git a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
index 5a1ca41755..7f30b1da95 100644
--- a/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
+++ b/jiuwenswarm/server/runtime/agent_adapter/interface_deep.py
@@ -5355,22 +5355,8 @@ class JiuWenSwarmDeepAdapter:
return skill_rail
@staticmethod
- def _resolve_evolution_trajectory_dir(config: dict[str, Any]) -> Path:
- """Resolve directory for FileTrajectoryStore (env > config > default)."""
- env_dir = (os.getenv("EVOLUTION_TRAJECTORY_DIR") or "").strip()
- if env_dir:
- return Path(env_dir).expanduser().resolve()
-
- configured = _get_evolution_config(config).get("trajectory_dir")
- if configured:
- path = Path(str(configured).strip())
- if path.is_absolute():
- return path
- workspace = get_multi_tenant_user_workspace_dir("default", "default")
- if workspace is not None:
- return (workspace / path).resolve()
- return (get_agent_root_dir().parent / path).resolve()
-
+ def _resolve_evolution_trajectory_dir() -> Path:
+ """Resolve directory for FileTrajectoryStore (always use default)."""
return get_agent_evolution_trajectories_dir()
def _build_skill_evolution_rail(self, config: dict[str, Any]) -> SkillEvolutionRail | None:
@@ -5379,7 +5365,7 @@ class JiuWenSwarmDeepAdapter:
evolution_review_trigger = get_evolution_review_trigger_enabled(config)
evolution_auto_save = get_evolution_auto_save_enabled(config)
model_name = self._default_model_name or config.get("model_name", "gpt-4")
- trajectory_dir = self._resolve_evolution_trajectory_dir(config)
+ trajectory_dir = self._resolve_evolution_trajectory_dir()
skill_evolution_rail = SkillEvolutionRail(
skills_dir=self._resolve_skill_dirs(),
llm=self._model,
@@ -5419,7 +5405,7 @@ class JiuWenSwarmDeepAdapter:
if self._skill_manager is not None
else []
)
- trajectory_dir = self._resolve_evolution_trajectory_dir(self._config_cache or {})
+ trajectory_dir = self._resolve_evolution_trajectory_dir()
await configure_skill_evolution_runtime(
self._instance,
skills_dir=self._resolve_skill_dirs(),
diff --git a/tests/unit_tests/agentserver/test_evolution_trajectory_store.py b/tests/unit_tests/agentserver/test_evolution_trajectory_store.py
index c030a64113..84708e8807 100644
--- a/tests/unit_tests/agentserver/test_evolution_trajectory_store.py
+++ b/tests/unit_tests/agentserver/test_evolution_trajectory_store.py
@@ -20,46 +20,13 @@ def test_get_agent_evolution_trajectories_dir_under_agent_root():
assert get_agent_evolution_trajectories_dir() == get_agent_root_dir() / "evolution_trajectories"
-def test_resolve_evolution_trajectory_dir_prefers_env(tmp_path, monkeypatch):
- env_dir = tmp_path / "from-env"
- monkeypatch.setenv("EVOLUTION_TRAJECTORY_DIR", str(env_dir))
- resolved = JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir(
- {"react": {"evolution": {"trajectory_dir": str(tmp_path / "from-config")}}}
- )
- assert resolved == env_dir.resolve()
-
-
-def test_resolve_evolution_trajectory_dir_absolute_config(tmp_path, monkeypatch):
- monkeypatch.delenv("EVOLUTION_TRAJECTORY_DIR", raising=False)
- abs_dir = tmp_path / "abs-traj"
- resolved = JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir(
- {"react": {"evolution": {"trajectory_dir": str(abs_dir)}}}
- )
- assert resolved == abs_dir
-
-
-def test_resolve_evolution_trajectory_dir_relative_config(tmp_path, monkeypatch):
- monkeypatch.delenv("EVOLUTION_TRAJECTORY_DIR", raising=False)
- workspace = tmp_path / "workspace"
- workspace.mkdir()
- with patch(
- "jiuwenswarm.server.runtime.agent_adapter.interface_deep.get_multi_tenant_user_workspace_dir",
- return_value=workspace,
- ):
- resolved = JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir(
- {"react": {"evolution": {"trajectory_dir": "agent/evolution_trajectories"}}}
- )
- assert resolved == (workspace / "agent" / "evolution_trajectories").resolve()
-
-
-def test_resolve_evolution_trajectory_dir_default(monkeypatch):
- monkeypatch.delenv("EVOLUTION_TRAJECTORY_DIR", raising=False)
- resolved = JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir({"react": {"evolution": {}}})
+def test_resolve_evolution_trajectory_dir_always_default(monkeypatch):
+ monkeypatch.setenv("EVOLUTION_TRAJECTORY_DIR", str(Path("/tmp/should-not-use")))
+ resolved = JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir()
assert resolved == get_agent_evolution_trajectories_dir()
def test_build_skill_evolution_rail_passes_file_trajectory_store(tmp_path, monkeypatch):
- monkeypatch.delenv("EVOLUTION_TRAJECTORY_DIR", raising=False)
traj_dir = tmp_path / "traj"
captured: dict = {}
@@ -87,9 +54,7 @@ def test_build_skill_evolution_rail_passes_file_trajectory_store(tmp_path, monke
return_value=object(),
),
):
- rail = adapter._build_skill_evolution_rail(
- {"react": {"evolution": {"trajectory_dir": str(traj_dir)}}}
- )
+ rail = adapter._build_skill_evolution_rail({"react": {"evolution": {}}})
assert rail is not None
store = captured.get("trajectory_store")
@@ -99,7 +64,6 @@ def test_build_skill_evolution_rail_passes_file_trajectory_store(tmp_path, monke
@pytest.mark.asyncio
async def test_ensure_active_evolution_rails_passes_file_trajectory_store(tmp_path, monkeypatch):
- monkeypatch.delenv("EVOLUTION_TRAJECTORY_DIR", raising=False)
traj_dir = tmp_path / "configured-traj"
configure = AsyncMock()
@@ -107,7 +71,7 @@ async def test_ensure_active_evolution_rails_passes_file_trajectory_store(tmp_pa
adapter._instance = object()
adapter._model = object()
adapter._default_model_name = "gpt-test"
- adapter._config_cache = {"react": {"evolution": {"trajectory_dir": str(traj_dir)}}}
+ adapter._config_cache = {"react": {"evolution": {}}}
adapter._skill_manager = SimpleNamespace(list_execution_disabled_skills=lambda: [])
adapter._skill_evolution_rail = SimpleNamespace(_language="cn")
diff --git a/tests/unit_tests/agentserver/test_evolve_command_edges.py b/tests/unit_tests/agentserver/test_evolve_command_edges.py
index ceb3ec0579..505e7e80cd 100644
--- a/tests/unit_tests/agentserver/test_evolve_command_edges.py
+++ b/tests/unit_tests/agentserver/test_evolve_command_edges.py
@@ -184,9 +184,7 @@ async def test_evolve_slash_lazy_init_registers_active_review_rails(monkeypatch,
call = dict(configure_calls[0])
store = call.pop("trajectory_store")
assert isinstance(store, FileTrajectoryStore)
- assert store._base_dir == JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir( # pylint: disable=protected-access
- adapter._config_cache # pylint: disable=protected-access
- )
+ assert store._base_dir == JiuWenSwarmDeepAdapter._resolve_evolution_trajectory_dir() # pylint: disable=protected-access
assert call == {
"skills_dir": [str(interface_deep_module.get_agent_skills_dir())],
"llm": adapter._model, # pylint: disable=protected-access