Token导航 LogoToken导航TokenDH.com
效率执行命令clawhub未标认证来源可访问clear审计通过

safe-subagent-spawn安全子 Agent 生成

Agent Skill

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

总安装

3,672

周安装

153

GitHub Stars

1

下载量

1,224
OpenClaw

安装说明

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

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

ClawHubOpenClaw
openclaw skills install safe-subagent-spawn

简介

safe-subagent-spawn 安全创建和管理子代理,避免直接调用 session_spawn。

  • 它适用于需要独立助手的复杂任务分解场景。
  • 安装后可在 OpenClaw 中调用,需定义子代理权限。
  • 使用前应验证包装器逻辑,防止权限逃逸。safe-subagent-spawn 属于效率类 Skill,可作为该场景下的辅助能力补充。
  • 建议限制子代理资源使用以避免性能问题。

SKILL.md

name
safe-subagent-spawn
description
|

Safe Subagent Spawn

Use this skill whenever you need to create a subagent. Do not call sessions_spawn directly.

Hard Rules

  1. Never call sessions_spawn directly. Always use scripts/safe_subagent_spawn.py to generate the payload.
  2. Enforced invariants (built into the script):

- runtime: "subagent" - mode: "run" - thread: false - cleanup: "keep" (preserve sessions to expose subagent issues) - streamTo: never included

  1. NEVER confuse agentId with model. agentId must be a real agent id from agents.list[].id — never a model alias or provider/model string.

- agentId is optional and rarely needed. Omit it unless the user explicitly names a target agent that exists in agents.list[].id. - To select a model, use the model field. - ✗ agentId: "google/gemini-2.5-pro"WRONG!! this is a model string - ✓ agentId: "main" — correct, a real agent id - ✓ omit agentId entirely — correct default

  1. The parent agent must never read a context file after creating it. Use scripts/append_to_context.py for all appends. The parent tracks each context file by its task slug (visible in the file's Metadata section and filename) and file path.
  2. No summary mechanism. Every child output is preserved verbatim.
  3. Context files are permanent and must not be deleted.
  4. Multi-round tasks are strictly sequential. The parent must wait for the child to return (Step 4) before appending a new directive and spawning the next round (Step 5). Never spawn round N+1 before receiving round N's output, unless the wait times out.
  5. No automatic retry on timeout. If a subagent times out, the parent must stop the task and report the timeout to the user. Do not silently retry or spawn a replacement subagent.
  6. Task slugs must use only a-z, 0-9, and - (lowercase ASCII letters, digits, and hyphens). Must start and end with an alphanumeric character. Maximum 48 characters. The script validates this and rejects invalid names — no silent transformation.

Scripts

ScriptPurpose
scripts/create_context.pyCreate a new context file (initial metadata + background + first directive)
scripts/safe_subagent_spawn.pyGenerate a spawn payload from an existing context file
scripts/append_to_context.pyAppend a directive, child output, or external message to a context file
All scripts/ paths are relative to this skill's installation directory.

Context File Reuse — Same Task vs New Task

When spawning a subagent, the parent must decide whether to reuse an existing context file or create a new one.

Reuse the existing context file when:

  • The new subagent is a continuation of the same logical task.
  • The new subagent needs the output of a prior subagent to proceed.
  • The user's request is a follow-up or iteration on a previous delegation.

Create a new context file when:

  • The task is unrelated to any prior subagent delegation.
  • The task requires a clean context with no prior history.
  • A different user request introduces a separate objective.

When in doubt, create a new file. Unnecessary context is worse than missing context.

Workflow

1. New task — create context file

scripts/create_context.py \
  --task "descriptive-task-slug" \
  --background "the user's original request or relevant background" \
  --directive "clear instructions for the child agent"

--directive is optional. Omit it to create a context file with only metadata and background — useful when you need to collect information (via External Messages) before formulating the first directive. A context file without a directive cannot be spawned until a directive is appended (the spawn script enforces this).

Output (stdout): the absolute path to the newly created context file.

1b. (Optional) Deferred directive — collect information first

If the context file was created without --directive, append External Messages to supply information before defining the task:

scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role external-message \
  --content "information gathered from an external source"

When ready, append the first directive:

scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role directive \
  --content "instructions for the child agent, informed by the external messages above"

Then proceed to Step 2 to generate the spawn payload.

2. Generate spawn payload

The context file must contain at least one Directive section. The script validates this and rejects files that have no directive.

scripts/safe_subagent_spawn.py \
  --context-file "<context_path>" \
  --timeout-seconds 300

Optional parameters:

  • --child-model "provider/model-name" — Override the child agent's model. Maps to the model field (string, optional) of sessions_spawn, overriding the parent's default model.
  • --agent-id "agent-name" — Target a specific agent id (must come from agents.list[].id). Rarely needed — omit unless the user explicitly names an existing agent.

--timeout-seconds should be determined by the parent agent based on task complexity. Default is 300 seconds. Use a shorter value for simple tasks and a longer value for complex ones.

Output (JSON): the spawn payload. Use it directly when calling sessions_spawn. Do not modify or add fields.

3. Spawn the subagent

Pass the JSON output from Step 2 directly to sessions_spawn as the complete argument:

sessions_spawn(<complete JSON payload from Step 2>)

Do not manually decompose or reassemble fields. The script output is the ready-to-use payload.

4. After child returns — record output

Append the child's full verbatim output to the context file:

scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role child-output <<'CHILD_EOF'
<full verbatim child output>
CHILD_EOF

For very long output, use a temp file instead:

# Write output to temp file first, then append
scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role child-output \
  --content-file /tmp/child_output.txt

5. (Optional) Append external messages

External messages can be appended in two positions:

  • Before the first directive — when the context file was created without --directive, to supply information before formulating the first task (see Step 1b).
  • Between a Child Output and the next Directive — to feed incremental information into subsequent rounds.

If the parent has incrementally obtained information (e.g., streaming results, user replies, external API responses), append it as external messages before appending the next directive:

scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role external-message \
  --content "first piece of information"

scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role external-message \
  --content "second piece of information, appended to the same section"

External messages have no round numbers and no timestamps. Multiple consecutive appends are merged into a single ## External Message section — no new header is created until the next directive starts a new round.

External messages can only appear (1) after Background and before the first Directive, or (2) between a Child Output and the next Directive. The script enforces this ordering.

6. Continue task — append directive and spawn next child

If the task requires another round, append a new directive and spawn:

# Append new directive
scripts/append_to_context.py \
  --context-file "<context_path>" \
  --role directive \
  --content "new instructions for the next round"

# Generate spawn payload (same as Step 2)
scripts/safe_subagent_spawn.py \
  --context-file "<context_path>" \
  --timeout-seconds 300

Then spawn using the output payload (same as Step 3).

The next child reads the entire context file — including all prior directives and child outputs — and executes the latest directive.

Append Format

scripts/append_to_context.py auto-detects round numbers and appends structured entries:

---

## Directive — Round 2 — 2026-04-02T12:00:00+00:00

<parent's instructions for this round>

---

## Child Output — Round 2 — 2026-04-02T12:05:00+00:00

<full verbatim output from child agent>

For external messages (no round number, no timestamp; consecutive appends merge into one section):

---

## External Message

<first piece of information>

<second piece of information, appended without a new header>

Content can be provided via:

  • --content "inline text" — for short directives
  • --content-file /path/to/file — for long content stored in a file
  • stdin (heredoc) — for piping content directly

Deduplication: If the content being appended is identical to the latest existing entry of the same role, the script silently discards the duplicate and exits successfully (exit code 0).

Context File Format

All context files are stored by default under sub-agents/ in default workspace folder, named {timestamp}-{task-slug}.md.

When --directive is omitted during creation, the file initially contains only Metadata, Standing Instructions, and Background. External Messages and the first Directive are appended later via append_to_context.py.

# Subagent Context: {task-slug}

## Metadata
- Created: {ISO-8601 timestamp}
- Task: {task-slug}
- Context File: {absolute path}

## Standing Instructions
- Do not self-append or modify this file. It is read-only context provided by the parent.
- Do not spawn additional subagents inside this subagent. All delegation must come from the parent.

## Background
{user's original request or relevant background information}

---

## Directive — Round 1 — {ISO-8601 timestamp}

{clear instructions for the child agent}

---

## Child Output — Round 1 — {ISO-8601 timestamp}

{full verbatim output from child agent}

---

## Directive — Round 2 — {ISO-8601 timestamp}

{new instructions for the next round}

---

## Child Output — Round 2 — {ISO-8601 timestamp}

{full verbatim output from child agent}

---

## External Message

{incrementally appended information from parent, before next directive}

---

## Directive — Round 3 — {ISO-8601 timestamp}

{instructions that can reference the external messages above}

When the context file is created without a directive (deferred directive pattern), the initial portion looks like:

# Subagent Context: {task-slug}

## Metadata
- Created: {ISO-8601 timestamp}
- Task: {task-slug}
- Context File: {absolute path}

## Standing Instructions
- Do not self-append or modify this file. It is read-only context provided by the parent.
- Do not spawn additional subagents inside this subagent. All delegation must come from the parent.

## Background
{user's original request or relevant background information}

---

## External Message

{information collected before the first directive}

---

## Directive — Round 1 — {ISO-8601 timestamp}

{instructions informed by the external messages above}

Design Principles

  • Full-text append, no summaries. Every child output is preserved verbatim. The parent never compresses or summarizes. Subsequent children read the complete history.
  • Parent never reads back. The parent writes the initial file and appends entries via helper scripts. It never reads the file into its own context window. Helper scripts may read the file internally (e.g., to auto-detect round numbers), but this is transparent to the parent.
  • One file per logical task. Multi-round tasks share a single context file. Unrelated tasks get separate files.
  • Permanent retention. Context files are never deleted. They serve as a permanent audit trail.
  • Session compaction is safe. Because context files are the persistent store for all subagent interactions, the parent's session can be compacted using the platform's default rules without losing information. Context files ensure continuity across compacted sessions.

Error Handling

If any step in the workflow fails — script error, subagent timeout, or wrapper unavailable:

  1. Stop immediately. Do not retry, work around, or guess at a fix.
  2. Report to the user in detail: include the failed command, exit code, and full error output.
  3. Do not fall back to calling sessions_spawn directly.

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

OpenClaw

92.99%
按下载量换算1,138

安全审计

VirusTotal

通过

ClawScan

通过

Static analysis

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 openclaw skills install safe-subagent-spawn 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

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

来源信息

继续浏览同类 Skills