AgentSkillsCN

sub

通过运行 `codex exec` 并输入指定的提示,将子任务委派给 Codex 处理,实时输出执行结果,随后再基于这些结果继续推进主任务。当用户输入 `/sub PROMPT`,或要求对某一特定子任务执行嵌套的 Codex 执行时,可使用此技能。

SKILL.md
--- frontmatter
name: sub
description: Delegate a subtask by running `codex exec` with a provided prompt, streaming its output, and then continuing the main task using those results. Use when the user types `/sub PROMPT` or asks to run a nested Codex execution for a focused subtask.

Sub

Overview

Run a subtask through codex exec and fold its output back into the primary task without losing context.

Workflow

1) Parse the /sub command

  • Treat /sub <prompt> as a command.
  • If the prompt is missing, ask the user for the prompt text.
  • Preserve the prompt as provided unless the user requests edits.

2) Execute the subtask

  • Prefer the bundled script to run and stream output:
    • Locate this skill directory by the path of SKILL.md.
    • Run: python3 <skill_dir>/scripts/codex_exec.py --prompt "<prompt>".
    • If the prompt contains $ or other shell-sensitive text, write it to a temp file and pass --prompt-file <path> to avoid shell expansion.
  • The wrapper has no overall timeout, but it will terminate if there is no stdout for 120s. Override with --idle-timeout <seconds> or set --idle-timeout 0 to disable.
  • If the script is unavailable, run codex exec "<prompt>" directly.

3) Monitor and capture output

  • Let the command run to completion.
  • Capture the full output (stdout + stderr) and note the exit code.
  • If the command fails, surface the error output and decide whether to retry, adjust the prompt, or proceed without the subtask.

4) Continue the main task

  • Summarize the subtask result in 1-3 sentences.
  • Continue the higher-level task using the subtask output as inputs.
  • If the subtask returned actionable artifacts (files, commands, or decisions), apply them directly or ask for confirmation when needed.

Resources

scripts/

  • scripts/codex_exec.py: Run codex exec with a prompt and stream output for monitoring and reuse.
  • scripts/test_codex_exec.py: Unit tests for the wrapper script.