一键导入
orchestrate
Orchestrate multiple agents programmatically using anvil-repl
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Orchestrate multiple agents programmatically using anvil-repl
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Debug issues using E2E tests, log analysis, and dev server management
Query ClickHouse observability logs over HTTP API
Iterate on bug hypotheses using Playwright repro scripts, structured logs, and source code analysis
Address unresolved inline diff comments and mark them resolved
Run a long task across multiple agent contexts using breadcrumb progress files
Recursively decompose a task into sub-plans with dependency ordering, then execute in topological waves
| name | orchestrate |
| description | Orchestrate multiple agents programmatically using anvil-repl |
| user-invocable | true |
You can programmatically spawn and coordinate child agents using the anvil-repl command. This runs TypeScript/JavaScript code with an injected anvil SDK object.
Call the Bash tool with a anvil-repl heredoc:
anvil-repl <<'ANVIL_REPL'
// your code here — `anvil` object is available
ANVIL_REPL
anvil.spawn({ prompt, contextShortCircuit? }) — Spawn a child agentSpawns a new agent process and waits for it to complete. Returns the child's last assistant message as a string.
const result = await anvil.spawn({ prompt: "Fix the failing auth tests" });
// result is a string — the child's last assistant message content
Optional: contextShortCircuit nudges the child to save progress when context pressure gets high:
await anvil.spawn({
prompt: "Implement the auth module",
contextShortCircuit: {
limitPercent: 80,
message: "You are running low on context. Save progress to plans/auth-progress.md, then stop.",
},
});
anvil.log(message) — Log a messageanvil.log("Starting parallel test fixes...");
anvil.context — Parent context (read-only)anvil.context.threadId // parent thread ID
anvil.context.repoId // repository ID
anvil.context.worktreeId // worktree ID
anvil.context.workingDir // parent working directory
anvil.context.permissionModeId // current permission mode
anvil-repl <<'ANVIL_REPL'
const [authResult, apiResult] = await Promise.all([
anvil.spawn({ prompt: "Fix auth module tests" }),
anvil.spawn({ prompt: "Fix API endpoint tests" }),
]);
return `Auth: ${authResult.slice(0, 200)}\nAPI: ${apiResult.slice(0, 200)}`;
ANVIL_REPL
anvil-repl <<'ANVIL_REPL'
const analysis = await anvil.spawn({ prompt: "Analyze test failures and list them" });
const fix = await anvil.spawn({ prompt: `Fix these issues:\n${analysis}` });
return fix;
ANVIL_REPL
anvil-repl <<'ANVIL_REPL'
const files = ["auth.ts", "api.ts", "db.ts"];
const results = await Promise.all(
files.map(f => anvil.spawn({ prompt: `Review ${f} for security issues` }))
);
return results.map((r, i) => `${files[i]}: ${r.slice(0, 100)}`).join("\n");
ANVIL_REPL
run_in_background: true when invoking anvil-repl. The REPL manages long-running execution internally. Always run in the foreground.return to send data back.anvil.spawn() returns a string — the child's last assistant message content.anvil.spawn() blocks until the child completes — use Promise.all for parallelism.ts.transpileModule).anvil.spawn() calls with Promise.all. Avoid writing business logic, file parsing, or complex algorithms in REPL code. If you need to read files, reason about data, or edit files, do that as the agent using your normal tools (Read/Edit/Write), not programmatically in the REPL.