Sub Agents logo

Sub Agents

Community
shinpr
sub-agents

Run agent definitions as sub-agents. Use when the user names an agent or sub-agent to run, references an agent definition, or delegates a task to an agent.

Overview

Publishershinpr
Repositorysub-agents-skills
Skill namesub-agents
Stars
101
Forks
20
Bundled files
8
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 8 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by shinpr on GitHub. Read the source before you install it.

Installation

Install the Sub Agents AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/shinpr/sub-agents-skills/tree/main/plugins/runner/skills/sub-agents
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/shinpr/sub-agents-skills.git /tmp/sub-agents-skills
mkdir -p .claude/skills
cp -r /tmp/sub-agents-skills/plugins/runner/skills/sub-agents .claude/skills/sub-agents
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sub Agents in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sub Agents on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sub Agents is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Sub-Agents - External CLI AI Task Delegation

Spawns external CLI AIs (codex, claude, cursor-agent, glm, kimi, grok, antigravity, gemini, opencode, command-code, mcode, pi) as isolated sub-agents with dedicated context.

Workflow: discover available definitions, select one from the user request, execute it, and handle the JSON response.

Resources

  • run_subagent.py - Main execution script
  • codex.md - Read before first execution from Codex; covers permissions and timeout

Script Path: Use absolute path {SKILL_DIR}/scripts/run_subagent.py where {SKILL_DIR} is the directory containing this SKILL.md file.

Interpreting User Requests

Extract parameters from user's natural language request:

ParameterSource
--agentAgent name from the user request or workflow selection
--promptTask instruction part (excluding agent specification)
--cwdCurrent working directory (absolute path)
--cliBackend override explicitly requested by the user; otherwise omit
--timeoutTimeout explicitly requested by the user, converted to milliseconds; otherwise omit (default: 600000)

Example: "Run code-reviewer on src/" → --agent code-reviewer --prompt "Review src/" --cwd $(pwd)

Important: Permission and Timeout

This script executes external CLIs that require elevated permissions.

Before first execution:

  1. Request elevated permissions via your CLI's tool parameters
  2. Set tool timeout to match --timeout argument (default: 600000ms)

For Codex CLI (most common permission issues): See references/codex.md for exact JSON parameter format.

Workflow

Step 1: List Available Agents

Always list agents first to discover available definitions:

bash
{SKILL_DIR}/scripts/run_subagent.py --list

Output:

json
{"agents": [{"name": "code-reviewer", "description": "Reviews code..."}], "agents_dir": "/path/.agents"}

When the user provides an agent name, select it if it appears in the result. If it is absent, report the available definitions and wait for a selection. When the result is empty, provide the Agent Definition Format below and wait for the user to add a definition.

When the user leaves the agent selection open:

Available agentsAction
0Report that no definitions are available, provide the Agent Definition Format below, and wait
1Select it
2+Show names and descriptions, then ask the user to select one

Step 2: Execute Agent

bash
{SKILL_DIR}/scripts/run_subagent.py \
  --agent <name> \
  --prompt "<task>" \
  --cwd <absolute-path>

Append --cli <backend> when the user specifies a backend. Append --timeout <milliseconds> when the user specifies a timeout.

Step 3: Handle Response

Parse JSON output and check status field:

json
{"result": "...", "exit_code": 0, "status": "success", "cli": "claude"}

By status:

statusMeaningAction
successTask completedUse result directly
partialTimeout but has outputReview partial result, may need retry
errorExecution failedCheck error and exit_code; retry after satisfying the reported requirement

For configuration or credential errors, retry after the required external configuration has changed.

If execution fails because run-agent is missing, retry with --cli set to the current client's backend.

By exit_code (when status is error):

exit_codeMeaningResolution
0Success-
124TimeoutIncrease --timeout or simplify task
127CLI not foundInstall required CLI (claude, codex, etc.)
1General errorCheck error field in response

Agent Definition Location

PrioritySourcePath
1Environment variable$SUB_AGENTS_DIR
2Default{cwd}/.agents/

To customize: export SUB_AGENTS_DIR=/custom/path

Agent Definition Format

Place .md files in .agents/ directory:

markdown
---
run-agent: claude
model: sonnet
permission: safe-edit
---

# Agent Name

Brief description of agent's purpose.

## Task
What this agent does.

## Output Format
How results should be structured.

run-agent supplies the backend. Pass --cli only as an explicit one-run override; execution fails with a corrective error when neither is specified.

Frontmatter fields:

FieldValuesDescription
run-agentcodex, claude, cursor-agent, glm, kimi, grok, antigravity, gemini, opencode, command-code, mcode, piWhich CLI executes this agent
modelBackend-specific model name (optional)Model passed to the selected CLI; omit to use its configured default
effortBackend/model-specific reasoning level or OpenCode variant (optional)Advanced: forwarded as an opaque value. Confirm support for the selected model before setting; omit to use its default. Unsupported on cursor-agent and gemini
permissionread-only, safe-edit (default), yoloread-only for investigation, safe-edit for workspace edits, or yolo to bypass approvals and sandboxing

Backend-specific permission behavior:

  • mcode: read-only and safe-edit both use --permission smart, which allows direct edits. A tool call that smart denies leaves the run going, so the run can still return success. yolo uses --permission full.
  • pi: read-only enables only read, grep, find, and ls, so the agent has no shell or MCP tools. safe-edit and yolo both enable Pi's default tools, including bash, edit, and write.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Sub Agents AI skill do?

Run agent definitions as sub-agents. Use when the user names an agent or sub-agent to run, references an agent definition, or delegates a task to an agent.

Why use Sub Agents on TypingMind?

Because you install it once and use it with any model. Sub Agents is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sub Agents in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/shinpr/sub-agents-skills/tree/main/plugins/runner/skills/sub-agents. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Sub Agents?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sub Agents?

As many as you like. As long as a model supports skills, you can use Sub Agents with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sub Agents AI skill free?

Yes. It is published on GitHub by shinpr under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇