内容取之于gitup下awesome-openclaw-usecases-main工程下的30篇英文的用例文章,也是为了学习方便,今天开始逐一翻译留下笔记,供openclaw使用中的学习。

翻译内容

使用子智能体进行自主项目管理

使用多个并行工作流管理复杂项目令人精疲力竭。你最终会不断切换上下文,跨工具追踪状态,并手动协调交接。

此用例实现了一种去中心化的项目管理模式,其中子智能体自主处理任务,通过共享状态文件进行协调,而非中央编排器。

痛点

传统的编排器模式会产生瓶颈——主智能体变成了交通警察。对于复杂项目(多仓库重构、研究冲刺、内容流水线),你需要能够并行工作而无需持续监督的智能体。

功能描述

  • 去中心化协调:智能体读写共享的 STATE.yaml 文件

  • 并行执行:多个子智能体同时处理独立任务

  • 无编排器开销:主会话保持精简(CEO模式——仅负责策略)

  • 自文档化:所有任务状态持久化保存在版本控制文件中

核心模式:STATE.yaml

每个项目维护一个 STATE.yaml 文件,作为唯一事实来源:

# STATE.yaml - 项目协调文件
project: website-redesign
updated: 2026-02-10T14:30:00Z
​
tasks:
  - id: homepage-hero
    status: in_progress
    owner: pm-frontend
    started: 2026-02-10T12:00:00Z
    notes: "Working on responsive layout"
​
  - id: api-auth
    status: done
    owner: pm-backend
    completed: 2026-02-10T14:00:00Z
    output: "src/api/auth.ts"
​
  - id: content-migration
    status: blocked
    owner: pm-content
    blocked_by: api-auth
    notes: "Waiting for new endpoint schema"
​
next_actions:
  - "pm-content: Resume migration now that api-auth is done"
  - "pm-frontend: Review hero with design team"

工作原理

  1. 主智能体接收任务 → 生成具有特定范围的子智能体

  2. 子智能体读取 STATE.yaml → 找到其分配的任务

  3. 子智能体自主工作 → 在进度更新时更新 STATE.yaml

  4. 其他智能体轮询 STATE.yaml → 拾取未阻塞的工作

  5. 主智能体定期检查 → 审查状态,调整优先级

所需技能

  • sessions_spawn / sessions_send 用于子智能体管理

  • 文件系统访问权限以操作 STATE.yaml

  • Git 用于状态版本控制(可选但推荐)

设置:AGENTS.md 配置

## PM 委托模式
​
主会话 = 仅协调器。所有执行都交给子智能体。
​
工作流程:
1. 新任务到达
2. 检查 PROJECT_REGISTRY.md 寻找现有的 PM
3. 如果 PM 存在 → sessions_send(label="pm-xxx", message="[task]")
4. 如果是新项目 → sessions_spawn(label="pm-xxx", task="[task]")
5. PM 执行,更新 STATE.yaml,报告返回
6. 主智能体向用户总结
​
规则:
- 主会话:最多 0-2 个工具调用(仅 spawn/send)
- PM 拥有其 STATE.yaml 文件
- PM 可以为并行子任务生成子子智能体
- 所有状态更改提交到 git

示例:生成一个 PM

User: "Refactor the auth module and update the docs"
​
Main agent:
1. Checks registry → no active pm-auth
2. Spawns: sessions_spawn(
     label="pm-auth-refactor",
     task="Refactor auth module, update docs. Track in STATE.yaml"
   )
3. Responds: "Spawned pm-auth-refactor. I'll report back when done."
​
PM subagent:
1. Creates STATE.yaml with task breakdown
2. Works through tasks, updating status
3. Commits changes
4. Reports completion to main

关键洞见

  • STATE.yaml > 编排器:基于文件的协调比消息传递更具可扩展性

  • Git 作为审计日志:提交 STATE.yaml 更改以获取完整历史记录

  • 标签约定很重要:使用 pm-{project}-{scope} 以便于追踪

  • 精简的主会话:主智能体做得越少,响应速度越快

基于

此模式受 Nicholas Carlini 的方法 启发,用于自主编码智能体——让智能体自组织,而不是微观管理它们。

相关链接                                        

原文:

 Autonomous Project Management with Subagents

Managing complex projects with multiple parallel workstreams is exhausting. You end up context-switching constantly, tracking status across tools, and manually coordinating handoffs.

This use case implements a decentralized project management pattern where subagents work autonomously on tasks, coordinating through shared state files rather than a central orchestrator.

 Pain Point

Traditional orchestrator patterns create bottlenecks—the main agent becomes a traffic cop. For complex projects (multi-repo refactors, research sprints, content pipelines), you need agents that can work in parallel without constant supervision.

What It Does

- **Decentralized coordination**: Agents read/write to a shared `STATE.yaml` file
- **Parallel execution**: Multiple subagents work on independent tasks simultaneously
- **No orchestrator overhead**: Main session stays thin (CEO pattern—strategy only)
- **Self-documenting**: All task state persists in version-controlled files

## Core Pattern: STATE.yaml

Each project maintains a `STATE.yaml` file that serves as the single source of truth:

```yaml
# STATE.yaml - Project coordination file
project: website-redesign
updated: 2026-02-10T14:30:00Z

tasks:
  - id: homepage-hero
    status: in_progress
    owner: pm-frontend
    started: 2026-02-10T12:00:00Z
    notes: "Working on responsive layout"
    
  - id: api-auth
    status: done
    owner: pm-backend
    completed: 2026-02-10T14:00:00Z
    output: "src/api/auth.ts"
    
  - id: content-migration
    status: blocked
    owner: pm-content
    blocked_by: api-auth
    notes: "Waiting for new endpoint schema"

next_actions:
  - "pm-content: Resume migration now that api-auth is done"
  - "pm-frontend: Review hero with design team"
```

## How It Works

1. **Main agent receives task** → spawns subagent with specific scope
2. **Subagent reads STATE.yaml** → finds its assigned tasks
3. **Subagent works autonomously** → updates STATE.yaml on progress
4. **Other agents poll STATE.yaml** → pick up unblocked work
5. **Main agent checks in periodically** → reviews state, adjusts priorities

## Skills You Need

- `sessions_spawn` / `sessions_send` for subagent management
- File system access for STATE.yaml
- Git for state versioning (optional but recommended)

## Setup: AGENTS.md Configuration

```text
## PM Delegation Pattern

Main session = coordinator ONLY. All execution goes to subagents.

Workflow:
1. New task arrives
2. Check PROJECT_REGISTRY.md for existing PM
3. If PM exists → sessions_send(label="pm-xxx", message="[task]")
4. If new project → sessions_spawn(label="pm-xxx", task="[task]")
5. PM executes, updates STATE.yaml, reports back
6. Main agent summarizes to user

Rules:
- Main session: 0-2 tool calls max (spawn/send only)
- PMs own their STATE.yaml files
- PMs can spawn sub-subagents for parallel subtasks
- All state changes committed to git
```

## Example: Spawning a PM

```text
User: "Refactor the auth module and update the docs"

Main agent:
1. Checks registry → no active pm-auth
2. Spawns: sessions_spawn(
     label="pm-auth-refactor",
     task="Refactor auth module, update docs. Track in STATE.yaml"
   )
3. Responds: "Spawned pm-auth-refactor. I'll report back when done."

PM subagent:
1. Creates STATE.yaml with task breakdown
2. Works through tasks, updating status
3. Commits changes
4. Reports completion to main
```

## Key Insights

- **STATE.yaml > orchestrator**: File-based coordination scales better than message-passing
- **Git as audit log**: Commit STATE.yaml changes for full history
- **Label conventions matter**: Use `pm-{project}-{scope}` for easy tracking
- **Thin main session**: The less the main agent does, the faster it responds

## Based On

This pattern is inspired by [Nicholas Carlini's approach](https://nicholas.carlini.com/) to autonomous coding agents—let agents self-organize rather than micromanaging them.

## Related Links

- [OpenClaw Subagent Docs](https://github.com/openclaw/openclaw)
- [Anthropic: Building Effective Agents](https://www.anthropic.com/research/building-effective-agents)

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐