← 返回 Skills 市场
devymex

safe-subagent-spawn

作者 Devymex · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
126
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install safe-subagent-spawn
功能描述
Safely create and manage subagents through a strict wrapper instead of calling sessions_spawn directly. Use whenever a task needs a subagent, detached helper...
安全使用建议
This skill appears to do what it says, but review a few things before installing or using it: 1) Confirm where context files are written: inspect CONTEXT_DIR (create_context.py) to ensure files go to a safe location and won't expose or overwrite sensitive directories. 2) Treat context files and preserved sessions as persistent storage: they may contain user data and are kept indefinitely by the skill's rules—decide on retention and access control policies. 3) Be careful with append_to_context.py --content-file: callers can read and append arbitrary local files into a context (make sure you don't accidentally inject secrets). 4) Understand the execution environment for subagents: safe_subagent_spawn embeds the absolute path into the child prompt and assumes the child can read that file; if the child runs remotely or in a different sandbox, this may fail or leak path information. 5) If you need stricter privacy, consider modifying the workflow to redact secrets before appending, store context files in a controlled location, or change the cleanup policy. If you want, provide the full installation path where this skill will live and the runtime environment for spawned subagents and I can point out the exact CONTEXT_DIR and any path-leakage risks.
功能分析
Type: OpenClaw Skill Name: safe-subagent-spawn Version: 1.0.0 The skill bundle provides a structured and audited framework for managing subagents via persistent Markdown context files. It uses helper scripts (create_context.py, append_to_context.py, and safe_subagent_spawn.py) to enforce sequential task execution, verbatim history logging, and strict prompt construction. The instructions in SKILL.md act as a defensive wrapper by forbidding direct calls to the underlying session spawning mechanism, ensuring all subagent activity is recorded in a permanent audit trail within the workspace.
能力评估
Purpose & Capability
The name/description match the provided scripts: create_context.py, safe_subagent_spawn.py, and append_to_context.py implement the declared workflow. No unrelated credentials, binaries, or install steps are requested. One implementation detail to note: create_context writes files under a computed CONTEXT_DIR (four parents up + 'sub-agents') which may place files in the workspace root; this is plausible for the purpose but worth verifying in your environment.
Instruction Scope
SKILL.md enforces strict rules about sequencing and that the parent should not read context files; the scripts implement and validate those rules. Two practical caveats: (1) append_to_context.py accepts --content-file and will read any file path you provide — so a caller can accidentally (or intentionally) inject arbitrary local file contents into a context file; (2) safe_subagent_spawn includes the absolute context file path in the generated 'task' text it sends to the child, which can reveal local paths in logs or payloads and assumes the child execution environment can access that path. These behaviors are coherent with the skill's purpose but have privacy/operational implications.
Install Mechanism
This is an instruction-only skill (no install spec). The package ships Python scripts but does not download or execute remote code during install. No extract/download URLs or external package installs are present.
Credentials
The skill requests no environment variables or credentials. It operates on files passed as arguments and on context files it creates; those file I/O operations are expected for the task. There is no unexplained credential access.
Persistence & Privilege
The skill explicitly requires context files to be permanent and configures spawned sessions with 'cleanup': 'keep', preserving child sessions and outputs. This creates persistent artifacts (context files and kept sessions) that may accumulate user data or sensitive content. Additionally, the default CONTEXT_DIR path construction could place these files outside the skill directory (e.g., workspace root). These are operational/privacy concerns rather than indicators of maliciousness, but you should account for retention, access controls, and potential leakage.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install safe-subagent-spawn
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /safe-subagent-spawn 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
**Initial release of safe-subagent-spawn — a reliability-focused skill for safe, standardized subagent creation and multi-round lifecycle management.** ### Why this skill exists OpenClaw's `sessions_spawn` tool accepts many parameters and supports multiple spawn modes (run, ACP, Discord session, etc.), but: 1. **Models frequently get the parameters wrong.** GPT-5.4 and other models commonly confuse `agentId` (a real agent id from `agents.list`) with model strings like `"google/gemini-2.5-pro"`, include unsupported fields, or pick incorrect default values — causing repeated trial-and-error failures that waste tokens and time. 2. **Non-run modes are fragile for most users.** ACP mode and Discord session mode depend on locally installed packages and additional infrastructure that most non-developer users don't have. These modes are a frequent source of hard-to-diagnose failures. This skill exclusively uses **run mode** — the most stable and universally available spawn mode — eliminating an entire category of setup-related errors. ### What's included - **safe_subagent_spawn.py** — Validated wrapper that generates a ready-to-use `sessions_spawn` JSON payload. Enforces correct invariants (`runtime: subagent`, `mode: run`, `thread: false`, `cleanup: keep`, no `streamTo`), validates that `agentId` and `model` are not confused, and ensures the context file contains at least one directive before allowing a spawn. The output is passed directly to `sessions_spawn` with no manual assembly required. - **create_context.py** — Creates a structured Markdown context file with metadata (timestamp, task slug, file path), standing instructions for the child, background information, and an optional first directive. Task slugs are validated (lowercase alphanumeric + hyphens, 1–48 chars). Supports deferred directives — create context with background only, then collect external information before formulating the first task. - **append_to_context.py** — Appends directives, child outputs, or external messages to an existing context file. Features include: - **Automatic round numbering** — tracks round numbers across directive/child-output pairs, keeping them in sync. - **Strict sequential ordering** — enforces that Directive Round N exists before Child Output Round N can be appended, and Child Output Round N-1 exists before Directive Round N+1. Prevents out-of-order spawns. - **External message merging** — consecutive external messages are merged into a single section without redundant headers, keeping context files clean. - **Content deduplication** — silently discards duplicate appends (identical content to the latest entry of the same role), preventing accidental double-writes. - **Flexible input** — accepts content via `--content` (inline), `--content-file` (from file), or stdin (pipe/heredoc), accommodating both short directives and large child outputs. ### Key design decisions - **Full verbatim history** — every child output is preserved in full; no summarization, no truncation. The next child in a multi-round workflow reads the entire context file and acts on the latest directive. - **Context files are permanent** — never deleted, providing a complete audit trail of all subagent interactions. - **Parent never reads back** — the parent agent tracks context files by path and task slug but never re-reads them after creation, avoiding context window pollution. - **No automatic retry** — if a subagent times out, the parent reports the failure to the user instead of silently retrying, ensuring transparency. - **No nested subagents** — standing instructions in every context file prohibit the child from spawning its own subagents, keeping the delegation tree flat and predictable.
元数据
Slug safe-subagent-spawn
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

safe-subagent-spawn 是什么?

Safely create and manage subagents through a strict wrapper instead of calling sessions_spawn directly. Use whenever a task needs a subagent, detached helper... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 126 次。

如何安装 safe-subagent-spawn?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install safe-subagent-spawn」即可一键安装,无需额外配置。

safe-subagent-spawn 是免费的吗?

是的,safe-subagent-spawn 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

safe-subagent-spawn 支持哪些平台?

safe-subagent-spawn 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 safe-subagent-spawn?

由 Devymex(@devymex)开发并维护,当前版本 v1.0.0。

💬 留言讨论