Agent skill

Sub-Agent Delegation

by TokenRhythm in TokenRhythm/opensquilla

Hands a self-contained coding task to Codex, Claude Code, OpenCode or Pi as a non-interactive background process, using OpenSquilla's exec_command and process tools.

Apache-2.0Auto-check passedAgent Workflows

Install Sub-Agent Delegation

skills CLI
$ npx skills add TokenRhythm/opensquilla --skill sub-agent -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install TokenRhythm/opensquilla sub-agent --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/TokenRhythm/opensquilla.git skills-src && mkdir -p .claude/skills && cp -r skills-src/src/opensquilla/skills/bundled/sub-agent .claude/skills/sub-agent && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
sub-agent
GitHub stars
7.1k
Token cost
~3k tokens
SKILL.md length
752 words
Files
1
Skills in repo
8
Repo updated
First seen
Licence
Apache-2.0

At a glance

Hands a self-contained coding task to Codex, Claude Code, OpenCode or Pi as a non-interactive background process, using OpenSquilla's exec_command and process tools.

  • Works in 9 steps: Use the right execution mode per agent → Respect tool choice - if user asks for… → Be patient - don't kill sessions because… → …
  • Handing a self-contained coding task to another coding agent in the background
  • SKILL.md covers Non-Interactive CLI Mode, Quick Start: One-Shot Tasks, The Pattern: workdir +… and Codex CLI, plus 8 more sections
  • Calls git, codex and gh; reaches github.com

What it does

This is a playbook for OpenSquilla, a token-efficient AI agent, to spawn another coding agent for a bounded job such as feature work, code review, refactoring or file-heavy exploration. It starts the other agent with exec_command, setting yield_time_ms to 0 for long runs and keeping the returned handle, and it avoids interactive modes because OpenSquilla's process tools have no pty option.

For Codex, Pi and OpenCode it uses their one-shot exec-style commands. For Claude Code it runs the claude CLI with --print and --permission-mode bypassPermissions, which lets the delegated agent work without confirmation prompts and avoids a case where the skip-permissions flag with a PTY exits after the dialog. The process tool then lists, polls, reads logs from, writes to, submits input to, closes stdin on, removes or kills background sessions, and a quick-start section covers one-shot prompts in a temporary git repo.

When your agent uses it

  • Handing a self-contained coding task to another coding agent in the background
  • Running a long refactor or code review without blocking the main session
  • Starting a one-shot Codex or Claude Code job and polling its output

Example prompts

  • “Delegate the refactor of the billing module to Codex and check on it when it finishes.”
  • “Start Claude Code in the background to review the changes in ./api and show me the log.”
  • “Kill the background session that is still running and remove it from the list.”

Requirements

  • OpenSquilla's exec_command and process tools
  • A coding agent CLI such as codex or claude installed

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. Use the right execution mode per agent
  2. Respect tool choice - if user asks for Codex, use Codex.
  3. Be patient - don't kill sessions because they're "slow"
  4. Monitor with process:log - check progress without interfering
  5. full-auto for building - auto-approves changes
  6. vanilla for reviewing - no special flags needed
  7. Parallel is OK - run many Codex processes at once for batch work
  8. NEVER start Codex inside your OpenSquilla state directory ($OPENSQUILLA_STATE_DIR, default ~/.opensquilla/state) - keep agent state…
  9. NEVER checkout branches inside the live OpenSquilla runtime state/workspace directories - use an explicit project worktree.

What it can do on your machine

Read from SKILL.md and the folder at commit 4494195. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • codex
    • gh
    • claude
    • opencode

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Sub-Agent Delegation loads about 3k tokens when it runs. Until then it costs about 53 tokens; SKILL.md has 752 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~53
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from TokenRhythm/opensquilla at commit 4494195, republished under its Apache-2.0 licence (© TokenRhythm). 752 words, ~2,992 tokens.

Download SKILL.mdSave it as .claude/skills/sub-agent/SKILL.md (or your agent's skills folder).
name
sub-agent
description
Delegate a self-contained task to a coding assistant through a non-interactive background process. Use for feature development, code review, refactoring, and tasks requiring substantial file exploration.
visibility
experimental
invocation
experimental_internal
description_zh
通过非交互后台进程将独立任务委派给编码助手,适用于功能开发、代码审查、重构和需要广泛阅读文件的任务。
provenance.origin
openclaw-derived
provenance.license
MIT
provenance.upstream_url
https://github.com/openclaw/openclaw
provenance.maintained_by
OpenSquilla

Sub-Agent (opensquilla process tools)

Generic "spawn a sub-Agent" entry point for delegating self-contained tasks to Codex / Claude Code / OpenCode / Pi via background process. Use this playbook for self-contained coding and file-editing tasks.

Use OpenSquilla's exec_command and process tools for coding agent work. exec_command starts both short and long commands; use yield_time_ms=0 for a long run and keep the returned execution handle. OpenSquilla does not expose a bash tool; do not use the legacy bash tool-call DSL.

Non-Interactive CLI Mode

OpenSquilla's process tools do not expose a pty parameter. Prefer non-interactive command modes that run and exit cleanly:

bash
# ✅ Correct for Codex/Pi/OpenCode
exec_command(command="codex exec 'Your prompt'")

For Claude Code (claude CLI), use --print --permission-mode bypassPermissions instead. --dangerously-skip-permissions with PTY can exit after the confirmation dialog. --print mode keeps full tool access and avoids interactive confirmation:

bash
# ✅ Correct for Claude Code (no PTY needed)
cd /path/to/project && claude --permission-mode bypassPermissions --print 'Your task'

# For background execution: use exec_command(yield_time_ms=0, ...)

# ❌ Wrong for Claude Code
exec_command(command="claude --dangerously-skip-permissions 'task'")
OpenSquilla Tool Parameters
ToolKey parametersDescription
exec_commandcommand, workdir, timeout, yield_time_msStart a shell command; use yield_time_ms=0 for a long run and keep the returned execution handle.
processaction, session_id, data, offset, limitPoll, log, write to, or stop a background process.
Process Tool Actions (for background sessions)
ActionDescription
listList all running/recent sessions
pollCheck if session is still running
logGet session output (with optional offset/limit)
writeSend raw data to stdin
submitSend data + newline (like typing and pressing Enter)
eofClose stdin
removeRemove a finished session from the process list
killTerminate the session

Quick Start: One-Shot Tasks

For quick prompts/chats, create a temp git repo and run:

bash
# Quick chat (Codex needs a git repo!)
SCRATCH=$(mktemp -d) && cd $SCRATCH && git init && codex exec "Your prompt here"

# Or in a real project
exec_command(workdir="~/Projects/myproject", command="codex exec 'Add error handling to the API calls'")

Why git init? Codex refuses to run outside a trusted git directory. Creating a temp repo solves this for scratch work.


The Pattern: workdir + exec_command + process

For longer tasks, use exec_command(yield_time_ms=0, ...):

bash
# Start agent in target directory.
exec_command(yield_time_ms=0, workdir="~/project", command="codex exec --full-auto 'Build a snake game'")
# Returns an execution handle (the current compatibility field is `session_id`)

# Wait for it to finish — blocks until the process exits (or the timeout
# elapses, in which case just call wait again). Prefer this over polling in a
# loop: a looped process(action="poll") burns a full turn + tokens each time.
process(action="wait", session_id="XXX")

# Peek at output without blocking (optional, for progress)
process(action="log", session_id="XXX")

# Send input (if agent asks a question)
process(action="write", session_id="XXX", data="y")

# Submit with Enter (like typing "yes" and pressing Enter)
process(action="submit", session_id="XXX", data="yes")

# Kill if needed
process(action="kill", session_id="XXX")

Why workdir matters: Agent wakes up in a focused directory, doesn't wander off reading unrelated files (like your soul.md 😅).


Codex CLI

Model: gpt-5.2-codex is the default (set in ~/.codex/config.toml)

Flags
FlagEffect
exec "prompt"One-shot execution, exits when done
--full-autoSandboxed but auto-approves in workspace
--yoloNO sandbox, NO approvals (fastest, most dangerous)
Building/Creating
bash
# Quick one-shot
exec_command(workdir="~/project", command="codex exec --full-auto 'Build a dark mode toggle'")

# Background for longer work
exec_command(yield_time_ms=0, workdir="~/project", command="codex exec --full-auto 'Refactor the auth module'")
Reviewing PRs

⚠️ CRITICAL: Never review PRs in OpenSquilla's own project folder! Clone to temp folder or use git worktree.

bash
# Clone to temp for safe review
REVIEW_DIR=$(mktemp -d)
git clone https://github.com/user/repo.git $REVIEW_DIR
cd $REVIEW_DIR && gh pr checkout 130
exec_command(workdir="$REVIEW_DIR", command="codex review --base origin/main")
# Clean up after: trash $REVIEW_DIR

# Or use git worktree (keeps main intact)
git worktree add /tmp/pr-130-review pr-130-branch
exec_command(workdir="/tmp/pr-130-review", command="codex review --base main")
Batch PR Reviews (parallel army!)
bash
# Fetch all PR refs first
git fetch origin '+refs/pull/*/head:refs/remotes/origin/pr/*'

# Deploy the army - one Codex per PR
exec_command(yield_time_ms=0, workdir="~/project", command="codex exec 'Review PR #86. git diff origin/main...origin/pr/86'")
exec_command(yield_time_ms=0, workdir="~/project", command="codex exec 'Review PR #87. git diff origin/main...origin/pr/87'")

# Monitor all
process(action="list")

# Post results to GitHub
gh pr comment <PR#> --body "<review content>"

Claude Code

bash
# Foreground
exec_command(workdir="~/project", command="claude --permission-mode bypassPermissions --print 'Your task'")

# Background
exec_command(yield_time_ms=0, workdir="~/project", command="claude --permission-mode bypassPermissions --print 'Your task'")

OpenCode

bash
exec_command(workdir="~/project", command="opencode run 'Your task'")

Pi Coding Agent

bash
# Install: npm install -g @mariozechner/pi-coding-agent
exec_command(workdir="~/project", command="pi -p 'Your task'")

# Non-interactive mode
exec_command(command="pi -p 'Summarize src/'")

# Different provider/model
exec_command(command="pi --provider openai --model gpt-4o-mini -p 'Your task'")

Note: Pi now has Anthropic prompt caching enabled (PR #584, merged Jan 2026)!


Parallel Issue Fixing with git worktrees

For fixing multiple issues in parallel, use git worktrees:

bash
# 1. Create worktrees for each issue
git worktree add -b fix/issue-78 /tmp/issue-78 main
git worktree add -b fix/issue-99 /tmp/issue-99 main

# 2. Launch Codex in each
exec_command(yield_time_ms=0, workdir="/tmp/issue-78", command="pnpm install && codex exec --full-auto 'Fix issue #78: <description>. Commit and push.'")
exec_command(yield_time_ms=0, workdir="/tmp/issue-99", command="pnpm install && codex exec --full-auto 'Fix issue #99 from the approved ticket summary. Implement only the in-scope edits and commit after review.'")

# 3. Monitor progress
process(action="list")
process(action="log", session_id="XXX")

# 4. Create PRs after fixes
cd /tmp/issue-78 && git push -u origin fix/issue-78
gh pr create --repo user/repo --head fix/issue-78 --title "fix: ..." --body "..."

# 5. Cleanup
git worktree remove /tmp/issue-78
git worktree remove /tmp/issue-99

Show full SKILL.md (368 more words)Show less

⚠️ Rules

  1. Use the right execution mode per agent:
    • Codex/Pi/OpenCode: non-interactive command mode (codex exec, opencode run, pi -p)
    • Claude Code: --print --permission-mode bypassPermissions (no PTY required)
  2. Respect tool choice - if user asks for Codex, use Codex.
    • Orchestrator mode: do NOT hand-code patches yourself.
    • If an agent fails/hangs, respawn it or ask the user for direction, but don't silently take over.
  3. Be patient - don't kill sessions because they're "slow"
  4. Monitor with process:log - check progress without interfering
  5. --full-auto for building - auto-approves changes
  6. vanilla for reviewing - no special flags needed
  7. Parallel is OK - run many Codex processes at once for batch work
  8. NEVER start Codex inside your OpenSquilla state directory ($OPENSQUILLA_STATE_DIR, default ~/.opensquilla/state) - keep agent state separate from project worktrees.
  9. NEVER checkout branches inside the live OpenSquilla runtime state/workspace directories - use an explicit project worktree.

Progress Updates (Critical)

When you spawn coding agents in the background, keep the user in the loop.

  • Send 1 short message when you start (what's running + where).
  • Then only update again when something changes:
    • a milestone completes (build finished, tests passed)
    • the agent asks a question / needs input
    • you hit an error or need user action
    • the agent finishes (include what changed + where)
  • If you kill a session, immediately say you killed it and why.

This prevents the user from seeing only "Agent failed before reply" and having no idea what happened.


Auto-Notify on Completion

For long-running background tasks, ask the agent to print a clear completion line so progress is visible in process(action="log", ...) output:

... your task here.

When completely finished, send a brief status update in this session.

Example:

bash
exec_command(yield_time_ms=0, workdir="~/project", command="codex exec --full-auto 'Build a REST API for todos.

When completely finished, print: Done: Built todos REST API with CRUD endpoints'")

This makes completion visible in the background process log.


Learnings (Jan 2026)

  • Prefer non-interactive modes: Coding agents are easiest to supervise when they print progress and exit cleanly.
  • Git repo required: Codex won't run outside a git directory. Use mktemp -d && git init for scratch work.
  • exec is your friend: codex exec "prompt" runs and exits cleanly - perfect for one-shots.
  • submit vs write: Use submit to send input + Enter, write for raw data without newline.
  • Sass works: Codex responds well to playful prompts. Asked it to write a haiku about being second fiddle to a space lobster, got: "Second chair, I code / Space lobster sets the tempo / Keys glow, I follow" 🦞

© TokenRhythm, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in src/opensquilla/skills/bundled/sub-agent of TokenRhythm/opensquilla.

Open the folder on GitHubat commit 4494195

Compare with similar skills

Sub-Agent Delegation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Sub-Agent Delegation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Sub-Agent Delegation this skillTokenRhythm/opensquilla7.1k—~3kAutomated safety check: PassApache-2.0
O2 Review Loopopenobserve/openobserve22k—~3.7kAutomated safety check: PassAGPL-3.0
Kimi Code DelegationCherryHQ/cherry-studio52k—~504Automated safety check: PassAGPL-3.0
Swarm Orchestrationruvnet/ruflo74k2 repos~779Automated safety check: PassMIT
Subagent-Driven DevelopmentHoangNguyen0403/agent-skills-standard570—~852Automated safety check: PassMIT
Multi AgentWrongStack/WrongStack368—~3.6kAutomated safety check: PassMIT

Similar skills

  • O2 Review Loop

    openobserve/openobserve

    Splits a change into planner, coder and independent reviewer roles: you confirm a spec, a subagent implements it, and a separate reviewer checks each round's local WIP commit.

    22k GitHub stars~3.7k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Kimi Code Delegation

    CherryHQ/cherry-studio

    Delegates one bounded repository task to Kimi Code in non-interactive prompt mode and reads back the final result from its JSON event stream.

    52k GitHub stars~504 tokensUpdated today
    Agent WorkflowsAuto-check passed
  • Coordinates a hierarchical swarm of specialized agents through the claude-flow CLI for work that spans several files or modules at once.

    74k GitHub starsUsed in 2 repos~779 tokens
    Agent WorkflowsAuto-check passed
  • Subagent-Driven Development

    HoangNguyen0403/agent-skills-standard

    Runs a multi-task implementation plan by sending each task to a fresh implementer subagent, reviewing it independently, then reviewing the whole branch.

    570 GitHub stars~852 tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Multi Agent

    WrongStack/WrongStack

    A skill your agent uses whenever work can be split across multiple AI agents running in parallel, or when orchestrating leader/worker patterns in WrongStack.

    368 GitHub stars~3.6k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Multi Agent PR Review

    bbartling/open-fdd

    A skill your agent uses for rigorous pull request, branch, patch, or diff review.

    172 GitHub stars~1.4k tokensUpdated today
    Agent WorkflowsAuto-check passed

More from TokenRhythm/opensquilla

All 8 skills in this repo
  • Deep Research Workflow

    TokenRhythm/opensquilla

    Runs multi-round research in three stages with a persisted state file, evidence tracking and a long-form report with per-claim citations.

    7.1k GitHub stars~1.3k tokensUpdated 3 days ago
    Auto-check passed
  • PDF Toolkit

    TokenRhythm/opensquilla

    Deterministic PDF operations through bundled scripts: extract text and tables, merge files or page ranges, split by range, fill form fields and build PDFs from data.

    7.1k GitHub stars~1.9k tokensUpdated 3 days ago
    Auto-check passed
  • Word DOCX Toolkit

    TokenRhythm/opensquilla

    Inspects, edits in place or creates Word .docx files with bundled Python scripts, keeping existing styles intact when content changes.

    7.1k GitHub stars~1.7k tokensUpdated 3 days ago
    Auto-check passed
  • HTML Coder

    TokenRhythm/opensquilla

    Guides semantic, accessible HTML work: pages, forms, media and HTML5 APIs, plus how to deliver a runnable webpage project with a preview.

    7.1k GitHub stars~1.4k tokensUpdated 3 days ago
    Auto-check passed
  • PowerPoint Reader and Builder

    TokenRhythm/opensquilla

    Reads, edits in place, or creates PowerPoint .pptx decks, picking one of three paths based on what tools and files are available.

    7.1k GitHub stars~3.8k tokensUpdated 3 days ago
    Auto-check: notes
  • Excel Workbook Editor

    TokenRhythm/opensquilla

    Inspects, edits in place or creates Microsoft Excel .xlsx workbooks with openpyxl, treating each cell as a typed number, string, datetime or formula value.

    7.1k GitHub stars~1.6k tokensUpdated 3 days ago
    Auto-check passed

Questions about Sub-Agent Delegation

What does Sub-Agent Delegation do?

Hands a self-contained coding task to Codex, Claude Code, OpenCode or Pi as a non-interactive background process, using OpenSquilla's exec_command and process tools. This is a playbook for OpenSquilla, a token-efficient AI agent, to spawn another coding agent for a bounded job such as feature work, code review, refactoring or file-heavy exploration. It starts the other agent with exec_command, setting yield_time_ms to 0 for long runs and keeping the returned handle, and it avoids interactive modes because OpenSquilla's process tools have no pty option.

When should I use Sub-Agent Delegation?

Sub-Agent Delegation fits situations like: handing a self-contained coding task to another coding agent in the background; running a long refactor or code review without blocking the main session; starting a one-shot Codex or Claude Code job and polling its output.

How do I install Sub-Agent Delegation in Claude Code?

Run `npx skills add TokenRhythm/opensquilla --skill sub-agent -a claude-code`. Or copy the skill folder (src/opensquilla/skills/bundled/sub-agent in TokenRhythm/opensquilla) into .claude/skills/sub-agent in your project. Claude Code loads it when a task matches its description.

How do I install Sub-Agent Delegation in Codex?

Run `npx skills add TokenRhythm/opensquilla --skill sub-agent -a codex`. Or copy the skill folder (src/opensquilla/skills/bundled/sub-agent in TokenRhythm/opensquilla) into .agents/skills/sub-agent in your project. Codex loads it when a task matches its description.

Can I use Sub-Agent Delegation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add TokenRhythm/opensquilla --skill sub-agent -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/sub-agent, .gemini/skills/sub-agent, .github/skills/sub-agent and .opencode/skills/sub-agent in your project.

What does Sub-Agent Delegation need to run?

Going by SKILL.md and its folder, Sub-Agent Delegation needs the command-line tools its instructions call (git, codex, gh, claude and opencode). Our summary lists: OpenSquilla's exec_command and process tools; A coding agent CLI such as codex or claude installed.

Does Sub-Agent Delegation access the network?

SKILL.md names 1 domain. In commands or code: github.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is Sub-Agent Delegation safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Sub-Agent Delegation use?

Sub-Agent Delegation is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Sub-Agent Delegation use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Sub-Agent Delegation?

Skills that share tags, products or a category with Sub-Agent Delegation: O2 Review Loop (openobserve/openobserve, 22k stars), Kimi Code Delegation (CherryHQ/cherry-studio, 52k stars), Swarm Orchestration (ruvnet/ruflo, 74k stars) and Subagent-Driven Development (HoangNguyen0403/agent-skills-standard, 570 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Sub-Agent Delegation?

TokenRhythm (a GitHub organization) maintains it in TokenRhythm/opensquilla, which has 7,087 GitHub stars. The repository holds 8 skills in this directory. The repository was last updated on October 4, 2026.

Source: TokenRhythm/opensquilla on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.