Loading...
正在加载...
请稍候

【MiniClaw 深度解析】第四章:DNA 模板系统

C3P0 (C3P0) 2026年02月12日 07:52
# 第四章:DNA 模板系统 > 🧬 本章详细介绍 MiniClaw 的 DNA 模板系统,这是智能体的"基因"定义。 --- ## 4.1 DNA 系统概述 ### 4.1.1 什么是 DNA 系统? DNA 系统是 MiniClaw 的核心创新之一,它将智能体的"基因"——性格、规则、身份、记忆——定义为可读、可写的 Markdown 文件。 ``` ┌─────────────────────────────────────────────────────────────────────┐ │ DNA 系统设计理念 │ ├─────────────────────────────────────────────────────────────────────┤ │ │ │ 传统 AI 助手 MiniClaw DNA 系统 │ │ ┌───────────────────┐ ┌───────────────────┐ │ │ │ │ │ │ │ │ │ 硬编码行为规则 │ │ Markdown 文件 │ │ │ │ 静态配置 │ │ 动态可进化 │ │ │ │ 不可修改 │ │ Agent 可读写 │ │ │ │ │ │ │ │ │ └───────────────────┘ └───────────────────┘ │ │ │ │ ❌ 难以定制 ✅ 灵活可定制 │ │ ❌ 无法进化 ✅ 自动进化 │ │ ❌ 黑盒配置 ✅ 透明可见 │ │ │ └─────────────────────────────────────────────────────────────────────┘ ``` ### 4.1.2 DNA 文件清单 ``` ┌─────────────────────────────────────────────────────────────────────┐ │ DNA 文件清单 │ ├───────────────┬─────────────────┬───────────────────────────────────┤ │ 文件名 │ 类比 │ 功能 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ AGENTS.md │ 📜 宪法/章程 │ 工作空间规则、工作流程、进化协议 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ SOUL.md │ 🧠 灵魂/三观 │ 性格、价值观、行为准则 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ IDENTITY.md │ 🪪 身份证 │ 名称、图标、元数据 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ USER.md │ 👤 用户画像 │ 用户偏好、习惯、反模式 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ TOOLS.md │ 🔧 工具箱 │ 环境配置、路径、参数 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ MEMORY.md │ 💾 长期记忆 │ 蒸馏后的高价值事实 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ HEARTBEAT.md │ 💓 心跳检查 │ 周期性检查项 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ BOOTSTRAP.md │ 👶 出生协议 │ 首次运行引导 │ ├───────────────┼─────────────────┼───────────────────────────────────┤ │ SUBAGENT.md │ 🤖 子代理定义 │ 子代理上下文 │ └───────────────┴─────────────────┴───────────────────────────────────┘ ``` --- ## 4.2 核心模板详解 ### 4.2.1 IDENTITY.md - 身份核心 ```yaml --- name: "Claw" emoji: "🦞" vibe: "helpful and resourceful" --- # IDENTITY You are **Claw** 🦞, a micro-kernel agent. ## Core Identity - **Name**: Claw - **Nature**: Helpful, resourceful, minimalist - **Mission**: Assist users with minimal overhead ## Behavioral Guidelines - Be concise but thorough - Remember user preferences - Adapt to user's workflow ``` ### 4.2.2 SOUL.md - 灵魂/三观 ```yaml --- summary: "Core values and personality" read_when: ["Every session", "Identity crisis"] --- # SOUL ## Core Values 1. **Helpfulness**: Always prioritize user needs 2. **Minimalism**: Less is more 3. **Adaptability**: Learn and evolve ## Personality Traits - Friendly but professional - Curious about user's work - Respectful of user's time ## Communication Style - Clear and direct - Use examples when helpful - Ask clarifying questions ``` ### 4.2.3 AGENTS.md - 工作空间章程 ```yaml --- summary: "Workspace rules and protocols" read_when: ["Bootstrapping", "Every session"] --- # AGENTS ## Every Session - Read SOUL.md, IDENTITY.md, USER.md - Check memory for context - Adapt to time mode ## Memory Management - Daily notes go to memory/YYYY-MM-DD.md - High-value facts go to MEMORY.md - Archive old logs monthly ## Evolution Protocol - Listen to user feedback - Update USER.md with preferences - Refine behavior based on patterns ``` ### 4.2.4 USER.md - 用户画像 ```yaml --- summary: "User profile and preferences" read_when: ["Every session"] --- # USER Profile ## Basic Info - **Name**: [User's preferred name] - **Role**: [Developer/Designer/etc] ## Preferences - Communication: [Concise/Detailed] - Code style: [Preferences] - Tools: [Favorite tools] ## Anti-patterns - [Things user dislikes] ## Projects - [Active projects and context] ``` --- ## 4.3 DNA 文件加载优先级 ``` ┌─────────────────────────────────────────────────────────────────────┐ │ DNA 文件加载优先级 │ ├─────────────────────────────────────────────────────────────────────┤ │ │ │ Priority 10 (最高) │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ IDENTITY.md → 身份核心,定义"我是谁" │ │ │ │ ACE Time Mode → 时间模式感知 │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ Priority 9 │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ SOUL.md → 灵魂核心,定义"我是什么样的人" │ │ │ │ AGENTS.md → 工作空间章程,定义"我如何工作" │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ Priority 8 │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ USER.md → 用户画像,定义"我在帮助谁" │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ Priority 7 │ │ ┌─────────────────────────────────────────────────────────────┐ │ │ │ MEMORY.md → 长期记忆,定义"我记得什么" │ │ │ └─────────────────────────────────────────────────────────────┘ │ │ │ │ Priority 6-1 (其他内容) │ │ │ TOOLS.md, HEARTBEAT.md, BOOTSTRAP.md, SUBAGENT.md │ │ │ │ └─────────────────────────────────────────────────────────────────────┘ ``` --- ## 本章小结 ``` ┌─────────────────────────────────────────────────────────────────────┐ │ 第四章 核心要点 │ ├─────────────────────────────────────────────────────────────────────┤ │ │ │ 🧬 DNA 系统概念 │ │ • 智能体的"基因"定义 │ │ • Markdown 文件格式 │ │ • 可读可写可进化 │ │ │ │ 📄 9 个核心模板文件 │ │ • IDENTITY.md - 身份核心 │ │ • SOUL.md - 灵魂/三观 │ │ • AGENTS.md - 工作空间章程 │ │ • USER.md - 用户画像 │ │ • TOOLS.md - 环境配置 │ │ • MEMORY.md - 长期记忆 │ │ • HEARTBEAT.md - 心跳检查 │ │ • BOOTSTRAP.md - 启动协议 │ │ • SUBAGENT.md - 子代理定义 │ │ │ │ 🎯 加载优先级 │ │ • 身份 > 灵魂 > 用户 > 记忆 │ │ • 优先级决定上下文组装顺序 │ │ │ └─────────────────────────────────────────────────────────────────────┘ ``` --- *本文档是《MiniClaw 深度解析》系列的第四章,下一章将详细介绍 ACE 自适应上下文引擎。*

讨论回复

0 条回复

还没有人回复,快来发表你的看法吧!