Token导航 LogoToken导航TokenDH.com
效率敏感数据clawhub未标认证来源可访问clear审计通过

recursive-spawn递归生成

Agent Skill

recursive-spawn 用于补充效率相关能力,适合在 OpenClaw 中需要让 Agent 承接效率相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,703

周安装

194

GitHub Stars

公开资料未说明

下载量

1,536
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:recursive-spawn(递归生成)
来源仓库:https://github.com/sparky0520/recursive-spawn
安装命令:
openclaw skills install recursive-spawn
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install recursive-spawn

简介

用于补充效率相关能力,适合处理复杂并行任务。

  • 可使 OpenClaw 代理生成子代理实例分解大任务。
  • 当任务太大或太复杂时启用此技能。recursive-spawn 属于效率类 Skill,可作为该场景下的辅助能力补充。
  • 通过 clawhub 安装,建议确认权限范围和维护状态。
  • 需注意是否会触发联网、命令执行或文件读写操作。

SKILL.md

name
openclaw-spawner
description
>
env
>
security
>
CREDENTIAL
Set the provider-specific API key env var for your chosen model. Never embed keys in payloads or snapshots.
FILESYSTEM
Passing file-access tools to children grants them read/write access to arbitrary paths — only pass tools you trust.
TOOLS
Tools must be in OpenAI function-call format — LiteLLM translates them per provider automatically.

Openclaw Spawner

Allows an Openclaw agent to spawn child Openclaw agents, passing them exactly the context they need to carry out their piece of work and report results back.

Helper script: scripts/spawn_openclaw.py — copy this into your project and import from it. It contains spawn_openclaw(), spawn_openclaw_async(), is_error(), and read_result().

Multi-provider: Uses LiteLLM — pass any supported model string via the model= argument. Default is "anthropic/claude-opus-4-6".

Requires: litellm Python package (pip install litellm) and the API key env var for your chosen provider (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY).

Tool format: OpenAI function-call format. LiteLLM translates to each provider's native format automatically.


Security Notes

Credential: spawn_openclaw.py uses LiteLLM to call your chosen provider. Set the matching API key env var (e.g. ANTHROPIC_API_KEY, OPENAI_API_KEY). Never put keys in a payload or snapshot.
Tool format: Tools must be in OpenAI function-call format. LiteLLM translates them to each provider's native format automatically.
Filesystem access: Passing tools= to a child agent grants that child whatever capabilities those tools carry. File-access tools allow children to read and write arbitrary paths. Only supply tools you would trust the parent to use directly. When in doubt, omit tools= — the child will return results in its summary text.
Snapshot sanitization: progress_so_far is sent to the Anthropic API and injected into the child's context. Before spawning, review snapshots and strip any secrets, credentials, personal data, or other sensitive information.

When to Spawn

Spawn a child agent when any of these are true:

  • The remaining task has a clearly separable sub-task that can run independently.
  • Two or more subtasks can proceed in parallel, saving wall-clock time.
  • The current agent's context window is approaching its limit and a fresh context would help.
  • A sub-task requires different tools, permissions, or specialization.
  • The user explicitly asks to spawn / delegate / parallelize.

Do not spawn for trivial one-step tasks; keep it in the current agent.


Spawn Depth Limit

MAX_DEPTH = 3 (configurable in scripts/spawn_openclaw.py).

DepthRole
0Root / parent agent
1Direct child (default spawn)
2Grandchild (only if child's sub_task explicitly permits spawning)
3+Blocked — raises ValueError

Always pass depth=<current_depth + 1> when calling spawn_openclaw() from inside a child.


Spawn Payload Schema

Every spawn call must include these three fields:

{
  "main_task_title": "<short human-readable title of the overall parent task>",
  "progress_so_far": "<markdown summary of what has already been done, decisions made, artefacts produced, and anything the sub-agent must know to avoid redoing work>",
  "sub_task": "<clear, self-contained description of exactly what this child agent must do, including expected output format and where/how to return results>"
}

Field Guidelines

FieldRules
main_task_title≤ 10 words. Stable across all children of the same parent.
progress_so_farInclude: steps completed, key decisions, files written, variables/state the child needs. Exclude: raw data the child doesn't need. Keep it dense but readable.
sub_taskMust be self-contained. Assume the child has zero memory of the parent conversation. Include: what to do, inputs, expected output format, where to put results (file path, return value, etc.).

Step-by-Step Spawning Protocol

1 — Decide to Spawn

Confirm the sub-task is genuinely separable. If in doubt, handle it yourself.

2 — Freeze Parent State

Before spawning, write a progress snapshot. This becomes progress_so_far for the child and serves as the parent's own checkpoint in case it needs to resume.

Sanitize before spawning. progress_so_far is sent to the Anthropic API and injected into the child's context. Remove any secrets, API keys, passwords, tokens, or personal data before including them in the snapshot.
## Progress Snapshot — <main_task_title>
**Completed:**
- <step 1>
- <step 2>

**Artifacts produced:**
- <file or output name>: <one-line description>

**Decisions made:**
- <decision>: <rationale>

**Pending (what the child will handle):**
- <sub-task description>

3 — Build the Spawn Payload

Fill in the three required fields from the snapshot above.

4 — Spawn the Openclaw Sub-Instance

Import from scripts/spawn_openclaw.py:

Important: Without tools=, the child is a pure language model — it can reason and produce text but cannot read or write files. If the sub_task requires file I/O, pass the appropriate tool definitions (e.g. Anthropic computer-use tools, custom file tools). When tools are omitted, collect the child's result from the summary string directly rather than calling read_result().
from spawn_openclaw import spawn_openclaw, is_error, read_result

# my_tools = [...]  # OpenAI function-call format tools if the child needs file I/O

payload = {
    "main_task_title": "Refactor authentication module",
    "progress_so_far": (
        "## Progress Snapshot\
"
        "**Completed:**\
- Audited existing auth flow\
- Identified 3 outdated JWT helpers\
\
"
        "**Artifacts produced:**\
- `/tmp/audit_report.md`: full list of issues\
\
"
        "**Decisions made:**\
- Use PyJWT 2.x API; drop legacy HS256 fallback\
\
"
        "**Pending (child handles):**\
- Rewrite auth/jwt_helpers.py per audit report"
    ),
    "sub_task": (
        "Rewrite `/src/auth/jwt_helpers.py` using PyJWT 2.x. "
        "Read `/tmp/audit_report.md` for issues to fix. "
        "Write the rewritten file to `/tmp/jwt_helpers_new.py` and a "
        "one-paragraph summary to `/tmp/jwt_helpers_changes.md`."
    ),
}

try:
    # Swap model= to use any LiteLLM-supported provider:
    # "openai/gpt-4o", "gemini/gemini-2.0-flash", "groq/llama-3.3-70b-versatile", etc.
    summary = spawn_openclaw(payload, depth=1, model="anthropic/claude-opus-4-6", tools=my_tools)
except (ValueError, FileNotFoundError) as exc:
    raise  # bad depth, missing payload key, or SKILL.md not found — fix the call

if is_error(summary):
    print("Child failed:", summary)
else:
    result = read_result("/tmp/jwt_helpers_changes.md")
    if result is None:
        print("WARNING: child did not write expected result file.")

If SKILL.md is not adjacent to spawn_openclaw.py, pass the path explicitly:

import pathlib
summary = spawn_openclaw(payload, depth=1, skill_path=pathlib.Path("/your/path/to/SKILL.md"))

5 — Await and Integrate Results

  1. Check is_error(summary) — handle failures before reading files.
  2. Use read_result(path) to safely read child output; treat None as child failure.
  3. Merge into parent progress snapshot.
  4. Continue with the next step of the parent task — or spawn another child if needed.

Spawning Strategies

StrategyWhen to useParent blocks?
SequentialChild output is needed for next parent stepYes, until child done
Parallel-gatherMultiple independent children; parent needs all before continuingYes, until all done
Fire-and-forgetChild works on a separable track; parent has its own work nowNo — merge later

Strategy A — Sequential

Use spawn_openclaw(payload, depth=1) as shown in Step 4. Read result, check for errors, continue.


Strategy B — Parallel Gather

import asyncio
from spawn_openclaw import spawn_openclaw_async, is_error, read_result

async def main():
    payloads = [
        {
            "main_task_title": "Generate market research report",
            "progress_so_far": "Outline approved. Three sections assigned in parallel.",
            "sub_task": "Write 'Competitive Landscape' (600 words). Save to /tmp/section_competitive.md."
        },
        {
            "main_task_title": "Generate market research report",
            "progress_so_far": "Outline approved. Three sections assigned in parallel.",
            "sub_task": "Write 'Customer Segments' (600 words). Save to /tmp/section_customers.md."
        },
        {
            "main_task_title": "Generate market research report",
            "progress_so_far": "Outline approved. Three sections assigned in parallel.",
            "sub_task": "Write 'Market Trends' (600 words). Save to /tmp/section_trends.md."
        },
    ]

    summaries = await asyncio.gather(
        *[spawn_openclaw_async(p, depth=1, model="openai/gpt-4o", tools=my_tools) for p in payloads],
        return_exceptions=True,
    )

    result_paths = [
        "/tmp/section_competitive.md",
        "/tmp/section_customers.md",
        "/tmp/section_trends.md",
    ]

    for summary, path in zip(summaries, result_paths):
        if isinstance(summary, BaseException):
            print(f"Child raised exception for {path}: {summary}")
            continue
        if is_error(summary):
            print(f"Child failed for {path}:", summary)
            continue
        content = read_result(path)
        if content is None:
            print(f"WARNING: no result file at {path}")
        else:
            print(f"Merging {path} ({len(content)} chars)")
            # merge content into parent output ...

Strategy C — Fire-and-Forget

The parent delegates a sub-task and immediately continues its own work. The child writes results to a known file path. The parent checks at a planned merge point.

Parent:  ──[spawn child]──────────────────────────[merge point]──▶ continue
Child:            └──[work independently]──[write result file]──▶ done
import asyncio
from spawn_openclaw import spawn_openclaw_async, is_error, read_result

async def main():
    child_result_path = "/tmp/child_analysis.md"
    payload = {
        "main_task_title": "Refactor authentication module",
        "progress_so_far": (
            "Audit complete. Parent is now rewriting core auth logic. "
            "Child is assigned to analyse test coverage gaps in parallel."
        ),
        "sub_task": (
            f"Read `/tmp/audit_report.md`. Identify which functions lack test coverage. "
            f"Write a markdown report of gaps to `{child_result_path}`. "
            f"Include function name, file, and suggested test cases for each gap."
        ),
    }

    # Spawn — returns immediately, child runs in background
    child_task = asyncio.create_task(
        spawn_openclaw_async(payload, depth=1, model="anthropic/claude-opus-4-6", tools=my_tools)
    )

    # Parent does its OWN work right now
    await do_parent_work()

    # Merge point — collect child
    try:
        summary = await child_task
    except (ValueError, FileNotFoundError) as exc:
        print("Child raised configuration error:", exc)
        return
    if is_error(summary):
        print("Child failed:", summary)
    else:
        content = read_result(child_result_path)
        if content is None:
            print("WARNING: child did not write expected result file.")
        else:
            await integrate_child_output(content)


async def do_parent_work():
    pass  # replace with actual parent steps

async def integrate_child_output(text: str):
    print(f"Merging {len(text)} chars from child...")

Rules for fire-and-forget

  1. Always specify result_path in sub_task — it is the only rendezvous.
  2. Plan your merge point before spawning — know exactly when the parent will need the child's output.
  3. Use read_result() — returns None safely on any filesystem error (missing file, permission denied, etc.).
  4. One result file per child — if a child produces multiple artefacts, have it write a manifest JSON listing them all.
  5. Don't fire-and-forget if parent needs the result immediately — use Sequential instead.

Error Handling

What raises vs. what returns an error string:

SituationBehaviour
Anthropic API error (network, rate limit, etc.)Returns JSON error string — never raises
Empty or non-text API responseReturns JSON error string — never raises
depth >= MAX_DEPTHRaises ValueError — programmer error, fix your call
Missing required payload key (main_task_title, progress_so_far, sub_task)Raises ValueError — fix your payload
Non-JSON-serializable value in payloadRaises ValueError — fix your payload
SKILL.md not foundRaises FileNotFoundError — fix your path config

Always check with is_error() after a successful call. Wrap the call itself in try/except if you need to handle the two programmer-error exceptions gracefully:

try:
    summary = spawn_openclaw(payload, depth=1)
except (ValueError, FileNotFoundError) as exc:
    print("Configuration error:", exc)
    raise  # or handle

if is_error(summary):
    import json
    err = json.loads(summary)
    print("Runtime error:", err["error"])
    print("Partial results at:", err.get("partial_results"))  # may be None
    # decide: retry, fallback, abort parent
else:
    # success — read result files
    result = read_result("/tmp/some_output.md")
    if result is not None:
        # merge result ...
        pass
    else:
        print("WARNING: child did not write expected result file.")

Anti-Patterns to Avoid

Anti-PatternWhy It's BadFix
Sending the full conversation history as progress_so_farWastes tokens; child gets confusedSummarize: only what the child needs
Including secrets in progress_so_farSnapshot is sent to Anthropic API and visible to childStrip API keys, passwords, tokens, and personal data before spawning
Passing overly-permissive tools to childrenChildren gain filesystem or network access beyond what their sub_task needsScope tools to minimum required capability; omit tools= if the task only needs text output
Vague sub_task like "handle the rest"Child doesn't know what to doBe explicit: inputs, steps, output location
Spawning for a 2-line taskOverhead > benefitDo it in the parent
Not writing a progress snapshot before spawningParent loses state if it crashesAlways freeze state first
Omitting tools= when sub_task requires file I/OChild is a pure LM — it cannot read or write files; read_result() always returns NonePass tool definitions or collect results from the summary string instead
Ignoring is_error() on child summarySilent failures; parent merges nothingAlways check before reading result files
Fire-and-forget with no result fileNo rendezvous; parent can't collect outputAlways specify result_path in sub_task
Awaiting fire-and-forget child immediately after spawnDefeats the purposePut await child_task at the merge point
Omitting depth= when spawning from inside a childDepth check never triggers; runaway treesAlways pass depth=current_depth + 1
Child spawning further children without explicit permissionRunaway tree; hard to debugOnly spawn if sub_task explicitly says so

Quick Reference Card

SPAWN CHECKLIST
───────────────────────────────────────────
[ ] Sub-task is genuinely separable?
[ ] depth= will stay within MAX_DEPTH (default 3)?
[ ] Progress snapshot written (parent state frozen)?
[ ] main_task_title: ≤ 10 words, stable
[ ] progress_so_far: dense summary, no raw dumps
[ ] sub_task: self-contained, explicit result_path

STRATEGY SELECTION
[ ] Parent needs result before next step?        → Sequential (A)
[ ] Multiple children, all needed before merge?  → Parallel-gather (B)
[ ] Parent has its own work to do right now?     → Fire-and-forget (C)

AFTER EVERY SPAWN
[ ] is_error(summary) checked?
[ ] read_result(path) used (handles missing files safely)?
[ ] None result handled — don't merge silently?

FIRE-AND-FORGET EXTRAS
[ ] result_path agreed before spawning?
[ ] merge point placed after parent's own work?

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

77.56%
按下载量换算1,191

安全审计

VirusTotal

未展示

ClawScan

通过

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills