后端骨架: - curator.py / usage.py / skill_tools.py:基于使用计数的生命周期管理 + LLM 合并/归档建议(同事已有原型,集中提交) - skill_evolution_config.py:CuratorConfig 嵌套模型 - app.py:启动时按间隔触发 curator 后台线程 - tools.py:开启自我进化时一并注册 skill_list / skill_view 工具 - skill_manage_tool.py:agent 创建技能时标记 source=agent 本次新增: - skill_evolution_runtime.py:skill_evolution.json 读写,原子写入 - app_config.py:把 overrides 深合并到 AppConfig.skill_evolution, 并把 overrides 的 mtime 纳入缓存失效条件,前端 PUT 后热生效 - curator_log.py:进程内 ring buffer (maxlen=200),所有 record/get 操作内部兜异常,保证 logging 永远不会让 curator 跑挂 - curator.py 关键节点插桩:run_started / 自动转换计数 / 候选数 / LLM agent invoke / 解析结果 / archive 动作 / run complete - routers/skills.py:GET/PUT /api/curator/config(写到 skill_evolution.json + reset_app_config)+ GET /api/curator/logs 测试: - tests/test_skill_evolution_runtime.py:overrides 往返、损坏 JSON 容错、AppConfig 合并、ring buffer 线程安全、record 异常吞咽 杂项: - .gitignore:忽略 .deer-flow/* 与 skills/* 等运行时目录 - uv.lock:跟随依赖锁更新 - 清理已废弃的 agent runtime 数据 SOUL.md Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
from pydantic import BaseModel, Field
|
|
|
|
|
|
class CuratorConfig(BaseModel):
|
|
"""Configuration for the background skill curator."""
|
|
|
|
enabled: bool = Field(default=True, description="Whether the curator runs automatically.")
|
|
interval_hours: int = Field(default=168, description="Hours between curator runs (default: 7 days).")
|
|
stale_after_days: int = Field(default=30, description="Days of inactivity before a skill is marked stale.")
|
|
archive_after_days: int = Field(default=90, description="Days of inactivity before a stale skill is archived.")
|
|
|
|
|
|
class SkillEvolutionConfig(BaseModel):
|
|
"""Configuration for agent-managed skill evolution."""
|
|
|
|
enabled: bool = Field(
|
|
default=False,
|
|
description="Whether the agent can create and modify skills under skills/custom.",
|
|
)
|
|
moderation_model_name: str | None = Field(
|
|
default=None,
|
|
description="Optional model name for skill security moderation. Defaults to the primary chat model.",
|
|
)
|
|
curator: CuratorConfig = Field(
|
|
default_factory=CuratorConfig,
|
|
description="Configuration for the background skill curator.",
|
|
)
|