Skip to main content
ClaudeWave
Skill4.1k repo starsupdated today

sub-agent

The sub-agent skill spawns a background LLM process (Codex, Claude Code, or Pi) to handle self-contained tasks requiring full tool access and reasoning. Use it for building features, reviewing pull requests, refactoring large codebases, or any iterative work needing file exploration and LLM agency. Avoid it for simple edits, code reading, or tasks already running in an interactive chat session.

Install in Claude Code
Copy
git clone --depth 1 https://github.com/opensquilla/opensquilla /tmp/sub-agent && cp -r /tmp/sub-agent/src/opensquilla/skills/bundled/sub-agent ~/.claude/skills/sub-agent
Then start a new Claude Code session; the skill loads automatically.

SKILL.md

# 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.
Wrapping CLIs are coding-oriented, but the skill itself is used as
the generic sub-Agent slot by meta-skill DAGs for any LLM-driven
sub-task (file edits, document generation, policy review, etc.).

Use opensquilla's `exec_command`, `background_process`, and `process` tools for coding agent work. 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 background_process

# ❌ Wrong for Claude Code
exec_command(command="claude --dangerously-skip-permissions 'task'")
```

### OpenSquilla Tool Parameters

| Tool | Key parameters | Description |
| ---- | -------------- | ----------- |
| `exec_command` | `command`, `workdir`, `timeout` | Run a foreground shell command. |
| `background_process` | `command`, `workdir`, `timeout` | Start a long-running command and return `session_id`. |
| `process` | `action`, `session_id`, `data`, `offset`, `limit` | Poll, log, write to, or stop a background process. |

### Process Tool Actions (for background sessions)

| Action      | Description                                          |
| ----------- | ---------------------------------------------------- |
| `list`      | List all running/recent sessions                     |
| `poll`      | Check if session is still running                    |
| `log`       | Get session output (with optional offset/limit)      |
| `write`     | Send raw data to stdin                               |
| `submit`    | Send data + newline (like typing and pressing Enter) |
| `eof`       | Close stdin                                          |
| `remove`    | Remove a finished session from the process list      |
| `kill`      | Terminate 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 + background_process

For longer tasks, use `background_process`:

```bash
# Start agent in target directory.
background_process(workdir="~/project", command="codex exec --full-auto 'Build a snake game'")
# Returns session_id for tracking

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

# Check if done
process(action="poll", 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

| Flag            | Effect                                             |
| --------------- | -------------------------------------------------- |
| `exec "prompt"` | One-shot execution, exits when done                |
| `--full-auto`   | Sandboxed but auto-approves in workspace           |
| `--yolo`        | NO 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
background_process(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
background_process(workdir="~/project", command="codex exec 'Review PR #86. git diff origin/main...origin/pr/86'")
background_process(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
background_process(workdir="~/project", command="claude --permission-mode bypassPermissions --print 'Your task'")
```

---

## OpenCode

```bash
exec_command(wor
advanced-dubbing-studioSkill

Submit audio or video for multilingual dubbing, poll status, and download dubbed audio. Use when the user asks for dubbing, 多语言配音, 视频翻译配音, 译制片, or wants a source clip dubbed into another language.

ai-video-scriptSkill

Generate a structured short-video shooting script from a topic. Emits a strict, machine-parseable shot list (3 shots by default) with image prompt + video prompt + voiceover + on-screen text per shot. Trigger when the user asks for a video script, 分镜, 短视频文案, AI视频, 短剧脚本, or wants visual prompts ready for image/video generation.

cronSkill

Use when the user asks to schedule recurring tasks, one-off reminders, timers, or cron-style jobs through the OpenSquilla cron tool.

deep-researchSkill

Multi-round research with explicit methodology, evidence tracking, and citation-tagged synthesis. Trigger on 'deep dive', 'research report', 'literature review', 'investigate X across sources', 'multi-round investigation'. Distinct from the `summarize` skill, which is a single-pass condensation; this skill maintains a state file across iterations, tracks coverage, and produces a long-form report with per-claim citations. Three execution stages: plan (scope into sub-questions), iterate (record evidence per round), compile (synthesize report). The skill itself does not fetch the web — it tells the host agent which fetches to perform via OpenSquilla's existing web tools, and records what comes back.

docxSkill

Read, edit, or create Microsoft Word `.docx` files. Trigger this skill whenever the user mentions a Word document, .docx file, contract, report, brief, memo, or asks to extract text, modify an existing doc, generate one from a brief, or audit tracked changes. Three execution paths: text-and-structure extraction, in-place edit-by-run (preserves styles), and create-from-scratch with python-docx. Falls back to OOXML unzip-and-patch for layout work python-docx cannot reach.

git-diffSkill

Capture the current git diff (staged, working-tree, or staged file list) as text. Direct shell call for workflows that need repository diffs without an LLM agent loop.

githubSkill

GitHub operations via `gh` CLI: issues, PRs, CI runs, code review, API queries. Use when: (1) checking PR status or CI, (2) creating/commenting on issues, (3) listing/filtering PRs or issues, (4) viewing run logs. NOT for: complex web UI interactions requiring manual browser flows (use browser tooling when available), bulk operations across many repos (script with gh api), or when gh auth is not configured.

history-explorerSkill

Query the per-turn DecisionEntry log for skill co-occurrence patterns, meta-skill usage stats, and the router fixture corpus. Returns a JSON summary suitable for downstream LLM consumption. Used by meta-skill-creator's harvest step but also useful standalone for 'which skills did I use most this week?'