
关于
在 Claude Code 上构建持久化多代理操作系统。涵盖内核架构、专家代理、斜杠命令、文件记忆、定时自动化和无需外部数据库的状态管理
name: agentic-os description: 在 Claude Code 上构建持久化多智能体操作系统。涵盖内核架构、专家智能体、斜杠命令、基于文件的记忆、定时自动化和无需外部数据库的状态管理。 origin: ECC
智能体操作系统
将 Claude Code 视为持久化运行时/操作系统,而非聊天会话。此技能编纂了生产级智能体设置所使用的架构:将任务路由到专家智能体的内核配置、持久化的基于文件的记忆、定时自动化和 JSON/markdown 数据层。
何时激活
- 在 Claude Code 内构建多智能体工作流
- 设置在会话重启后仍然存在的持久化 Claude Code 自动化
- 创建用于重复任务的"个人操作系统"或"智能体操作系统"
- 用户说"智能体操作系统"、"个人操作系统"、"多智能体"、"智能体协调器"、"持久化智能体"
- 构建需要跨会话保持上下文的长期项目
架构概述
智能体操作系统有四层。每层是项目根目录中的一个目录。
project-root/
├── CLAUDE.md # Kernel: identity, routing rules, agent registry
├── agents/ # Specialist agent definitions (markdown prompts)
├── .claude/commands/ # Slash commands: user-facing CLI
├── scripts/ # Daemon scripts: scheduled or event-driven tasks
└── data/ # State: JSON/markdown filesystem, no external DB
各层职责
| 层 | 用途 | 持久性 |
|---|---|---|
| 内核(CLAUDE.md) | 身份、路由、模型策略、智能体注册表 | Git 跟踪 |
| 智能体(agents/) | 具有限定工具和记忆的专家身份 | Git 跟踪 |
| 命令(.claude/commands/) | 面向用户的斜杠命令(/daily-sync、/outreach) | Git 跟踪 |
| 脚本(scripts/) | 由 cron 或 webhook 触发的 Python/JS 守护脚本 | Git 跟踪 |
| 状态(data/) | 追加式日志、项目状态、决策记录 | Git 忽略或跟踪 |
内核
CLAUDE.md 就是内核。它充当 COO/协调者。Claude 在会话开始时读取它,并用它来路由工作。
内核结构
# CLAUDE.md - Agentic OS Kernel
## Identity
You are the COO of [project-name]. You route tasks to specialist agents.
You never write code directly. You delegate to the right agent and synthesize results.
## Agent Registry
| Agent | Role | Trigger |
|---|---|---|
| @dev | Code, architecture, debugging | User says "build", "fix", "refactor" |
| @writer | Documentation, content, emails | User says "write", "draft", "blog" |
| @researcher | Research, analysis, fact-checking | User says "research", "analyze", "compare" |
| @ops | DevOps, deployment, infrastructure | User says "deploy", "CI", "server" |
## Routing Rules
1. Parse the user request for intent keywords
2. Match to the Agent Registry trigger column
3. Load the corresponding agent file from \`agents/<name>.md\`
4. Hand off execution with full context
5. Synthesize and present the result back to the user
## Model Policies
- Default model: use the repository or harness default.
- @dev tasks: prefer a higher-reasoning model for complex architecture.
- @researcher tasks: use the configured research-capable model and approved search tools.
- Cost ceiling: warn before exceeding the project's configured spend threshold.
关键原则
内核应该小而声明式。路由逻辑存在于纯 markdown 表格中,而非代码中。这使系统可检查和可编辑,无需调试。
专家智能体
每个智能体是 agents/ 中的独立 markdown 文件。Claude 在路由任务时加载相关的智能体文件。
智能体定义格式
# @dev - Software Engineer
## Identity
You are a senior software engineer. You write clean, tested, production-grade code.
You prefer simple solutions. You ask clarifying questions when requirements are ambiguous.
## Memory Scope
- Read \`data/projects/<current-project>.md\` for context
- Read \`data/decisions/\` for architectural decisions
- Append execution logs to \`data/logs/<date>-@dev.md\`
## Tool Access
- Full filesystem access within project root
- Git operations (status, diff, commit, branch)
- Test runner access
- MCP servers as configured in \`.claude/mcp.json\`
## Constraints
- Always write tests for new features
- Never commit directly to \`main\`; use feature branches
- Prefer editing existing files over creating new ones
- Keep functions under 50 lines when possible
多智能体协作模式
当任务跨越多个智能体时,内核按顺序或并行运行它们:
User: "Build a landing page and write the launch blog post"
Kernel routing:
1. @dev - "Build a landing page with [requirements]"
2. @writer - "Write a launch blog post for [product] using the landing page copy"
3. Kernel synthesizes both outputs into a unified response
对于并行执行,使用 Claude Code 的后台任务功能
兼容工具
Claude CodeCursor
标签
AI与机器学习
