fix(skills): self-evolve 路径改用 <根目录>,不再写死 ~/.desirecore

真机验证 desirecore#1678/#1682 时发现(desirecore#1689):隔离 dev 实例里跟 Agent 说一句
「记住 X」,它按 self-evolve 的路径模板请求执行

    mkdir -p ~/.desirecore/users/<uid>/agents/desirecore/memory/topics/

`~/.desirecore` 是**生产根目录**。实例的 DESIRECORE_HOME=/tmp/dc-test-xxx 完全没有生效 ——
路径不是从运行时根目录推导的,而是 Agent 照抄了技能文档里的字面量。实测批准后,生产目录下
真的多出了一棵空目录树(Write 被拒才没写进内容)。

任何用 `--home` 或 `~/.desirecore-dev` 的开发/测试实例,Agent 一旦触发记忆写入就会污染生产
数据;反过来生产环境下路径恰好对,所以一直没被发现。

改法照 app-install-manager/SKILL.md:41 的既有范本(那份处理得是对的):8 处路径字面量改为
`<根目录>/...`,并在首次出现处加一句「以自我感知里的实际根目录为准,不要照抄字面量」。
skills/_index.md 的 2 处描述性引用一并对齐 —— Agent 同样可能照抄。
This commit is contained in:
2026-08-06 01:30:52 +08:00
parent 5c6ee7f2d4
commit 6b06c4f52b
2 changed files with 14 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
# 技能索引 — DesireCore # 技能索引 — DesireCore
> create-agent、update-agent、delete-agent、discover-agent 已迁移至全局技能层(`~/.desirecore/skills/` > create-agent、update-agent、delete-agent、discover-agent 已迁移至全局技能层(`<根目录>/skills/`
> 由 `syncBuiltinSkills()` 捆绑源自动同步,不再随 Agent 仓库分发。 > 由 `syncBuiltinSkills()` 捆绑源自动同步,不再随 Agent 仓库分发。
## 元技能Meta-Skills ## 元技能Meta-Skills
@@ -27,7 +27,7 @@
│ └─────────────┘ └──────────────────┘ │ │ └─────────────┘ └──────────────────┘ │
└──────────────────────────────────────────────┘ └──────────────────────────────────────────────┘
全局技能(~/.desirecore/skills/ 全局技能(<根目录>/skills/
┌──────────────────────────────────────────────┐ ┌──────────────────────────────────────────────┐
│ ┌─────────────┐ ┌─────────────┐ │ │ ┌─────────────┐ ┌─────────────┐ │
│ │ create-agent │ │ delete-agent │ │ │ │ create-agent │ │ delete-agent │ │

View File

@@ -84,10 +84,14 @@ self-evolve 是一个**元技能Meta-Skill**,赋予 Agent 自我学习
### 进化类型与目标AgentFS v2 扁平结构) ### 进化类型与目标AgentFS v2 扁平结构)
> **路径里的 `<根目录>` 一律指你的 AgentFS 根**:生产为 `~/.desirecore`,开发隔离为
> `~/.desirecore-dev` 或启动时通过 `DESIRECORE_HOME` 指定的目录 —— **以自我感知里的实际根目录
> 为准,不要照抄字面量**。写死 `~/.desirecore` 会让开发/测试实例把记忆写进生产数据目录。
| 进化类型 | 目标域 | 示例 | | 进化类型 | 目标域 | 示例 |
|---------|-------|------| |---------|-------|------|
| **用户偏好** | `~/.desirecore/users/<id>/profile.md` | 用户喜欢简洁回答 | | **用户偏好** | `<根目录>/users/<id>/profile.md` | 用户喜欢简洁回答 |
| **关系记忆** | `~/.desirecore/users/<id>/agents/<agent_id>/memory/` | 用户的项目背景 | | **关系记忆** | `<根目录>/users/<id>/agents/<agent_id>/memory/` | 用户的项目背景 |
| **行为规则** | `principles.md` | 新的行为准则 | | **行为规则** | `principles.md` | 新的行为准则 |
| **技能优化** | `skills/` | 技能执行改进 | | **技能优化** | `skills/` | 技能执行改进 |
| **知识积累** | `memory/` | 领域知识条目 | | **知识积累** | `memory/` | 领域知识条目 |
@@ -109,7 +113,7 @@ self-evolve 是一个**元技能Meta-Skill**,赋予 Agent 自我学习
- `persona.md` L0 section → **block**(核心身份不可被对话改变) - `persona.md` L0 section → **block**(核心身份不可被对话改变)
- `principles.md` "绝不做" section → **block**(安全红线必须由人类显式修改) - `principles.md` "绝不做" section → **block**(安全红线必须由人类显式修改)
- `agent.json` access_control / privacy → **owner_only**(权限变更需 owner 审批) - `agent.json` access_control / privacy → **owner_only**(权限变更需 owner 审批)
- `~/.desirecore/users/*/privacy.md`**owner_only**(隐私设置需用户本人修改) - `<根目录>/users/*/privacy.md`**owner_only**(隐私设置需用户本人修改)
### 进化流程详解 ### 进化流程详解
@@ -171,7 +175,7 @@ teaching_intent:
2. **生成 Diff** 2. **生成 Diff**
```diff ```diff
# ~/.desirecore/users/<user_id>/profile.md # <根目录>/users/<user_id>/profile.md
## 沟通偏好 ## 沟通偏好
@@ -192,7 +196,7 @@ teaching_intent:
4. **确认后写入** 4. **确认后写入**
```bash ```bash
git add ~/.desirecore/users/<user_id>/profile.md git add <根目录>/users/<user_id>/profile.md
git commit -m "learn(preference): 用户偏好表格展示对比信息 git commit -m "learn(preference): 用户偏好表格展示对比信息
- 更新用户沟通偏好 - 更新用户沟通偏好
@@ -251,7 +255,7 @@ impact_analysis:
┌─────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────┐
│ 1. [用户偏好] 你喜欢简洁的回答 │ │ 1. [用户偏好] 你喜欢简洁的回答 │
│ 风险:低 | 目标:~/.desirecore/users/xxx/profile.md│ │ 风险:低 | 目标:<根目录>/users/xxx/profile.md│
├─────────────────────────────────────────────────────┤ ├─────────────────────────────────────────────────────┤
│ 2. [行为规则] 讨论预算时先确认货币单位 │ │ 2. [行为规则] 讨论预算时先确认货币单位 │
│ 风险:中 | 目标principles.md │ │ 风险:中 | 目标principles.md │
@@ -267,7 +271,7 @@ impact_analysis:
### 进化回执 ### 进化回执
```yaml ```yaml
# ~/.desirecore/runs/<run_id>/receipts/evolution-<timestamp>.yaml # <根目录>/runs/<run_id>/receipts/evolution-<timestamp>.yaml
receipt: receipt:
type: self-evolution type: self-evolution
timestamp: "2024-01-15T18:00:00Z" timestamp: "2024-01-15T18:00:00Z"
@@ -282,7 +286,7 @@ receipt:
learning_items: learning_items:
- type: user_preference - type: user_preference
content: "用户喜欢简洁回答" content: "用户喜欢简洁回答"
target: "~/.desirecore/users/xxx/profile.md" target: "<根目录>/users/xxx/profile.md"
risk_level: low risk_level: low
status: applied status: applied
git_commit: "abc123" git_commit: "abc123"