Spawner — Instant Agent Hiring
Takes job postings → spawns the right agent → passes context → tracks completion.
Activation
Invoked by the orchestrator after JOB_BOARD.md is written with job postings.
Can also be invoked directly when the user says "spawn an agent to do X".
Input
Read workspace/JOB_BOARD.md for pending job postings.
Each posting has:
- - Job title
- Bucket (BUILD/OUTREACH/etc)
- Task description
- Context (files, prior work)
- Acceptance criteria
- Workspace path
- Timeout
- Dependencies
- Expected outputs
Spawning Rules
Concurrency
- - Max 3 sub-agents running at once. Period.
- Before spawning, check
subagents list for active count. - If at limit, queue the job and wait for a completion event.
Agent Configuration by Bucket
| Bucket | Label Pattern | Timeout | Key Context to Pass | Notes |
|---|
| 🏗️ BUILD | INLINECODE2 | 600s | webdev-sop, project files, WORK_BUCKETS.md | Always include "npm run build must pass, git commit + push" |
| 📬 OUTREACH |
outreach-[target] | 300s | outreach-infrastructure.md, warmup state, suppression list | Include SSH commands for droplet |
| 💰 SALES |
sales-[client] | 300s | business-strategy.md, client project file | Include pitch framework |
| 🔧 MAINTAIN |
fix-[project]-[issue] | 300s | Project memory file, error description | Include "verify fix works" step |
| 🧠 STRATEGY |
research-[topic] | 300s | business-strategy.md, OUTSTANDING.md | Include "cite sources" requirement |
| 📦 PRODUCT |
product-[item] | 300s | product-catalog-registry.md, casefinder docs | Include unit economics requirement |
| 🤖 SYSTEM |
system-[tool] | 300s | Relevant skill files, OpenClaw docs | Include "test the skill" step |
| 💼 CAREER |
career-[company] | 300s | Ryan's resume, target role | Include "output PDF" requirement |
| 💡 IDEATION |
ideation-[source] | 600s | batch-cognition skill, value-stack.md | Include ICE scoring requirement |
Task Description Template
For each sub-agent spawn, construct the task as:
CODEBLOCK0
Dependency Handling
- - Check the "Depends On" field of each job.
- If dependency job is ✅ DONE → spawn immediately.
- If dependency job is still running → queue, spawn after completion event.
- If dependency job ❌ FAILED → mark this job as BLOCKED, notify orchestrator.
Context Passing Between Related Jobs
When jobs in the same wave are related:
- - Job A produces
output/analysis.md → Job B needs it as input - Include in Job B's context: "Read [path] for context from related job"
- If Job A hasn't finished yet, Job B waits (dependency handling above)
Spawn Execution
CODEBLOCK1
Completion Tracking
When a sub-agent completion event arrives:
- 1. Match to job in JOB_BOARD.md by session key or label.
- Check acceptance criteria:
- Does the expected output exist?
- Did the build pass?
- Did it push to git?
- 3. Mark job: ✅ DONE (with artifact link) or ❌ FAILED (with reason) or ⚠️ PARTIAL.
- Update JOB_BOARD.md.
- Check if any QUEUED jobs can now be spawned (dependency resolved).
- If all jobs in current wave done → start next wave.
Failure Handling
| Failure Type | Action |
|---|
| Sub-agent timeout | Kill agent, mark ⚠️, retry once with simpler scope |
| Sub-agent error |
Mark ❌, log error, notify orchestrator |
| Build failure | Mark ⚠️, check build output, fix inline if trivial |
| Dependency failed | Mark BLOCKED, skip, notify orchestrator |
| 3 consecutive failures | Stop spawning, escalate to Ryan |
Anti-patterns
- - ❌ Spawning 10 agents at once (max 3)
- ❌ Spawning an agent for a 2-minute task (do it inline)
- ❌ Not passing context (agent wastes time re-reading)
- ❌ Marking ✅ without checking output exists
- ❌ Polling subagents in a loop (wait for push events)
- ❌ Spawning duplicate agents for the same job
- ❌ Not killing stale agents (> timeout + 5 min buffer)
Output
Update workspace/JOB_BOARD.md with:
- - Status per job (⏳ → 🔄 → ✅/❌/⚠️)
- Agent session key (for tracking)
- Artifact link (file path, URL, commit hash)
- Completion time
When all jobs complete, notify orchestrator for reconciliation.
Spawner — 即时代理雇佣
接收职位发布 → 生成合适的代理 → 传递上下文 → 跟踪完成情况。
激活
由编排器在JOB_BOARD.md写入职位发布后调用。
当用户说生成一个代理来做X时,也可以直接调用。
输入
读取workspace/JOB_BOARD.md中的待处理职位发布。
每个发布包含:
- - 职位标题
- 分类(BUILD/OUTREACH等)
- 任务描述
- 上下文(文件、先前工作)
- 验收标准
- 工作空间路径
- 超时时间
- 依赖关系
- 预期输出
生成规则
并发
- - 最多同时运行3个子代理。 没有例外。
- 在生成之前,检查subagents list的活跃数量。
- 如果达到上限,将任务排队并等待完成事件。
按分类的代理配置
| 分类 | 标签模式 | 超时时间 | 传递的关键上下文 | 备注 |
|---|
| 🏗️ BUILD | build-[项目] | 600秒 | webdev-sop、项目文件、WORK_BUCKETS.md | 始终包含npm run build必须通过,git commit + push |
| 📬 OUTREACH |
outreach-[目标] | 300秒 | outreach-infrastructure.md、预热状态、抑制列表 | 包含droplet的SSH命令 |
| 💰 SALES | sales-[客户] | 300秒 | business-strategy.md、客户项目文件 | 包含推销框架 |
| 🔧 MAINTAIN | fix-[项目]-[问题] | 300秒 | 项目记忆文件、错误描述 | 包含验证修复是否有效步骤 |
| 🧠 STRATEGY | research-[主题] | 300秒 | business-strategy.md、OUTSTANDING.md | 包含引用来源要求 |
| 📦 PRODUCT | product-[项目] | 300秒 | product-catalog-registry.md、casefinder文档 | 包含单位经济要求 |
| 🤖 SYSTEM | system-[工具] | 300秒 | 相关技能文件、OpenClaw文档 | 包含测试技能步骤 |
| 💼 CAREER | career-[公司] | 300秒 | Ryan的简历、目标职位 | 包含输出PDF要求 |
| 💡 IDEATION | ideation-[来源] | 600秒 | batch-cognition技能、value-stack.md | 包含ICE评分要求 |
任务描述模板
对于每个子代理生成,构建任务如下:
你正在处理:[工作空间路径]
任务
[分类表情符号] [分类名称]:[职位标题]
需要做什么
[来自职位发布的详细任务描述]
上下文
[相关文件内容或摘要 — 保持在2K tokens以下]
[代理可以自行读取的完整文件引用]
验收标准
[具体的、可测试的条件 — 从职位发布复制]
- - [ ] [标准1]
- [ ] [标准2]
- [ ] [标准3]
约束条件
- - [上表中的分类特定约束]
- 不要修改包含真实密钥的.env文件
- 提交前构建必须通过
- 使用描述性消息进行Git提交
依赖处理
- - 检查每个任务的依赖字段。
- 如果依赖任务已完成 ✅ → 立即生成。
- 如果依赖任务仍在运行 → 排队,在完成事件后生成。
- 如果依赖任务失败 ❌ → 将此任务标记为BLOCKED,通知编排器。
相关任务之间的上下文传递
当同一波次中的任务相关时:
- - 任务A生成output/analysis.md → 任务B需要将其作为输入
- 在任务B的上下文中包含:读取[路径]获取相关任务的上下文
- 如果任务A尚未完成,任务B等待(上述依赖处理)
生成执行
python
生成逻辑的伪代码
for wave in execution_plan.waves:
active = get
activesubagents()
for job in wave.jobs:
if job.effort == QUICK:
execute_inline(job) # 不需要子代理
job.status = ✅
continue
# 等待插槽
while len(active) >= 3:
waitforcompletion_event()
active = getactivesubagents()
# 检查依赖
if job.dependson and not alldone(job.depends_on):
job.status = QUEUED
continue
# 生成
agent = sessions_spawn(
label=f{bucket_prefix}-{job.slug},
mode=run,
runTimeoutSeconds=job.timeout,
task=buildtaskdescription(job)
)
job.status = 🔄
job.agent_key = agent.childSessionKey
active.append(agent)
# 等待波次完成后再进入下一波
waitforallwavecompletions(wave)
完成跟踪
当子代理完成事件到达时:
- 1. 通过会话密钥或标签匹配JOB_BOARD.md中的任务。
- 检查验收标准:
- 预期输出是否存在?
- 构建是否通过?
- 是否推送到git?
- 3. 标记任务:✅ 完成(带工件链接)或 ❌ 失败(带原因)或 ⚠️ 部分完成。
- 更新JOB_BOARD.md。
- 检查是否有任何QUEUED任务现在可以生成(依赖已解决)。
- 如果当前波次中的所有任务都完成 → 开始下一波。
失败处理
| 失败类型 | 操作 |
|---|
| 子代理超时 | 终止代理,标记⚠️,简化范围后重试一次 |
| 子代理错误 |
标记❌,记录错误,通知编排器 |
| 构建失败 | 标记⚠️,检查构建输出,如果简单则内联修复 |
| 依赖失败 | 标记BLOCKED,跳过,通知编排器 |
| 连续3次失败 | 停止生成,升级给Ryan |
反模式
- - ❌ 一次生成10个代理(最多3个)
- ❌ 为2分钟的任务生成代理(内联执行)
- ❌ 不传递上下文(代理浪费时间重新读取)
- ❌ 不检查输出是否存在就标记✅
- ❌ 循环轮询子代理(等待推送事件)
- ❌ 为同一任务生成重复代理
- ❌ 不终止过期代理(> 超时时间 + 5分钟缓冲)
输出
更新workspace/JOB_BOARD.md:
- - 每个任务的状态(⏳ → 🔄 → ✅/❌/⚠️)
- 代理会话密钥(用于跟踪)
- 工件链接(文件路径、URL、提交哈希)
- 完成时间
当所有任务完成时,通知编排器进行协调。