## Summary
- 将所有技能文件中的硬编码 `~/.desirecore/` 和 `$HOME/.desirecore/` 路径替换为
`${DESIRECORE_ROOT}/` 变量
- 递增 manifest.json version 至 1.2.1
## Why
dev 模式下 `DESIRECORE_HOME=~/.desirecore-dev`,硬编码路径导致技能读取错误的端口文件和目录。主仓库的
`variable-substitutor.ts` 会在运行时将 `${DESIRECORE_ROOT}` 替换为实际根目录。
## Test plan
- [ ] `npm run dev` 启动后触发任意技能,确认端口路径解析为
`~/.desirecore-dev/agent-service.port`
- [ ] prod 模式确认路径为 `~/.desirecore/agent-service.port`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
13 KiB
name, description, version, type, risk_level, status, disable-model-invocation, tags, metadata, market
| name | description | version | type | risk_level | status | disable-model-invocation | tags | metadata | market | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| update-agent | 安全更新现有智能体的配置、人格、原则、技能与记忆,输出可审阅 diff 并在确认后应用与提交。Use when 用户要求修改 Agent 行为、安装/卸载技能、调整配置、回滚变更或修订规则。 | 3.0.2 | meta | low | enabled | true |
|
|
|
update-agent skill
L0: One-Sentence Summary
Safely modify an Agent's config, persona, rules, and skills through natural-language conversation.
L1: Overview and Use Cases
Capability Description
update-agent is a Meta-Skill that lets users modify various Agent configurations through conversation. All modifications produce reviewable diff patches that are applied only after user confirmation, with rollback support.
Use Cases
- The user wants to adjust the Agent's communication style ("speak more formally")
- Add new behavioral rules ("from now on, warn me before discussing sensitive topics")
- Install or uninstall skill packages ("learn how to write contracts")
- Batch-update multiple settings ("upgrade all your capabilities")
Core Value
- Safe and controllable: All changes require user confirmation, with rollback support
- Transparent and visible: Changes are presented as diffs, clear and obvious
- Version management: Versions are managed via Git, with traceable history
L2: Detailed Specification
Supported Update Types
| Update Type | Target File | Risk Level | Example |
|---|---|---|---|
| Persona update | persona.md |
Medium | Modify communication style, values |
| Principles update | principles.md |
High | Add/modify behavioral rules |
| Skills install | skills/ |
Medium | Add new skill package |
| Skills uninstall | skills/ |
Low | Remove skill package |
| Memory update | memory/ |
Low | Add knowledge entry |
| Tools config | tools/ |
High | Modify tool permissions |
Conversation Flow
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 意图识别 │ ──→ │ 变更分析 │ ──→ │ Diff 生成 │
└──────────────┘ └──────────────┘ └──────────────┘
│
↓
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ 回执生成 │ ←── │ 变更应用 │ ←── │ 用户确认 │
└──────────────┘ └──────────────┘ └──────────────┘
Stage 1: Intent Recognition
Trigger conditions (any one is sufficient):
- The user says "modify your...", "update your...", "adjust the..."
- The user says "from now on you should...", "remember this rule..."
- The user says "install/uninstall this skill..."
- The user describes dissatisfaction with current behavior and expects a change
Output: Identify the update type and target scope.
Stage 2: Change Analysis
Analysis dimensions:
| Dimension | Description |
|---|---|
| Scope of impact | Which files and behaviors are affected |
| Risk level | Low/Medium/High (see risk classification) |
| Dependency check | Whether other configs are affected |
| Conflict detection | Whether it conflicts with existing rules |
Risk classification table:
| Risk Level | Conditions | Confirmation Requirement |
|---|---|---|
| Low | Affects only non-core config (e.g. memory entry) | Simple confirmation |
| Medium | Affects persona or normal principles | Show diff, then confirm |
| High | Affects core principles or tool permissions | Detailed explanation + diff + confirm |
| Protected | Touches a protected path | Block; requires owner permission |
Stage 3: Diff Generation
Diff format example:
# persona.md
## 沟通风格
- 友好、随和、轻松幽默
+ 专业、严谨、适度幽默
## 决策偏好
保持不变...
Diff metadata:
diff_metadata:
files_affected: 1
lines_added: 1
lines_removed: 1
risk_level: medium
reversible: true
estimated_impact: '沟通风格会变得更正式'
Stage 4: User Confirmation
Confirmation interface:
变更预览
影响文件: persona.md
风险等级: 中
影响说明: 沟通风格会从"友好随和"变为"专业严谨"
--- 变更内容 ---
[展示 diff]
----------------
请确认是否应用此变更?
[应用] [取消] [修改]
Confirmation options:
- Apply: Execute the change
- Cancel: Discard the change
- Modify: Enter edit mode for fine-tuning
Stage 5: Apply Changes
Apply the change by reading and writing files directly through AgentFS. Do not call HTTP APIs, and do not operate Git directly (version management is handled automatically by the backend).
AgentFS root directory: ${DESIRECORE_ROOT}/agents/<agentId>/
Read file: Use the cat command to read the current contents of the target file.
Write file: Use a text-editing tool to write directly to the target file. After writing, re-read the file to verify the contents are correct.
Note: After writing the file directly, the backend file watcher automatically detects the change and triggers a Git commit; no manual git command is required.
Stage 6: Receipt Generation
After a successful change, present a user-friendly receipt (do not expose internal paths or technical details):
Updated the communication style of "Legal Advisor Assistant".
Change summary: Communication style adjusted from "friendly and casual" to "professional and rigorous"
If you're not satisfied, you can say "undo the previous change" anytime to roll back.
Special Operation: Version Rollback
Trigger conditions: The user says "undo the previous change", "roll back to the previous version", "restore the original settings"
Rollback flow:
- Run
git log --oneline -10in the Agent directory to view recent version history - Use
git show <commit>:<file>to fetch the file contents of the target version, and present them to the user for confirmation - After user confirmation, write the target version's contents to the corresponding file
- Show the change diff and confirm rollback success
# 查看版本历史
cd ${DESIRECORE_ROOT}/agents/<agentId>
git log --oneline -10
# 查看某个版本的文件内容
git show <commit>:persona.md
Background Knowledge
AgentFS repository structure and protected paths are detailed in
_agentfs-background.mdand_protected-paths.yaml.
Update operation reference table:
| User Intent | Target File | AgentFS Path |
|---|---|---|
| Modify personality/style | persona.md |
${DESIRECORE_ROOT}/agents/<agentId>/persona.md |
| Modify behavioral rules | principles.md |
${DESIRECORE_ROOT}/agents/<agentId>/principles.md |
| Install/uninstall skills | skills/ |
${DESIRECORE_ROOT}/agents/<agentId>/skills/ |
| Modify tools config | tools/ |
${DESIRECORE_ROOT}/agents/<agentId>/tools/ |
| Add memory | memory/ |
${DESIRECORE_ROOT}/agents/<agentId>/memory/ |
| Modify runtime config | agent.json |
${DESIRECORE_ROOT}/agents/<agentId>/agent.json |
Error Handling
| Error Scenario | Handling |
|---|---|
| Attempt to modify a protected path | Block the operation; prompt that owner permission is required |
| File does not exist | The Agent or target file does not exist; ask user to check |
| Insufficient permission | Filesystem permission error; ask user to check directory permissions |
| Rollback target version not found | List available versions and ask the user to reselect |
Permission Requirements
| Operation | Required Role |
|---|---|
| Update persona | owner, member |
| Update principles (normal rules) | owner, member |
| Update principles (safety red lines) | owner |
| Install/uninstall skills | owner, member |
| Modify tools permissions | owner |
| Version rollback | owner |
Appendix: Update Examples
Persona Modification Example
User input: "Speak a bit more formally, not too casual"
Operation flow:
# 1. 读取当前 persona.md
cat ${DESIRECORE_ROOT}/agents/legal-assistant/persona.md
# 输出示例:
# # 法律顾问小助手
# ## L0
# 专业的法律咨询助手
# ## L1
# ### Role
# 法律顾问
# ### Personality
# 友好、随和
# ### Communication Style
# 轻松幽默
# 2. 分析需要修改的部分,生成 diff 展示给用户确认
# 3. 用户确认后,直接编辑文件,将 Personality 和 Communication Style 修改为目标值
# 4. 验证写入结果
cat ${DESIRECORE_ROOT}/agents/legal-assistant/persona.md
Principles Update Example
Add New Rule
User input: "From now on, when there's a legal issue, remind me to consult a professional lawyer"
Generated diff:
# principles.md
## 必须做
- 始终保持礼貌和尊重
- 不确定时主动询问
+ - 遇到法律相关问题时,提醒用户咨询专业律师
## 绝不做
...
Modify Existing Rule
User input: "Don't remind me every time, it's too verbose"
Generated diff:
# principles.md
## 必须做
- - 每次回答后都提醒用户检查内容
+ - 仅在重要决策时提醒用户检查内容