A portable /subtask command for launching background subagents across AI coding agents.
The goal is simple: make delegation explicit instead of asking the main agent to remember when it should use a subagent.
/subtask Count from 1 to 20 in Roman numerals.
The main conversation remains available while the child session works. When the child finishes, its result is reported back in the same conversation.
Most agent tools have a subagent mechanism, but ordinary instructions such as “please do this in a subagent” are model-discretion instructions. The agent may choose to delegate, or it may do the work directly.
/subtask gives the user a first-class workflow for delegation:
- An explicit user action triggers the command.
- The host launches the child session.
- The task is not silently replaced with a plan.
- The main conversation remains usable while the child works.
- One command launches one child by default.
This repository includes separate adapters for different agent surfaces:
- OpenCode V2, using a native command file with
subagent: true. - Antigravity 2.0, using the documented workspace or global Agent Skills locations and rules.
- Local Antigravity AGY profile, documented separately because it uses a local
skills.jsoncatalog.
The Antigravity profiles are intentionally separate. Do not install both the documented Antigravity 2.0 adapter and the local AGY profile unless you intentionally want duplicate rules or competing skill definitions.
Claude Code has similar subagent functionality under its own naming and configuration conventions. This repository does not claim that /subtask is already registered there.
.opencode/commands/subtask.md
.agents/skills/subtask/SKILL.md
.agents/rules/subtask-command.md
AGENTS.md
antigravity/README.md
antigravity/agy-skills/subtask/SKILL.md
antigravity/rules/subtask-command.md
antigravity/agy-skills.json.example
prompts/subtask-install-prompt.md
prompts/subtask-command-prompt.md
scripts/validate.mjs
scripts/install-opencode.mjs
The OpenCode and Antigravity files are surface-specific adapters. The prompts are for tools whose configuration format must be discovered before installation.
From the root of the project where you want /subtask available, run the explicit installer from the repository:
repo="/path/to/cross-agent-subtask"
node "$repo/scripts/install-opencode.mjs" --projectThe installer refuses existing command files and symlinked parent directories. It copies AGENTS.md only when the target project does not already have one. If an existing AGENTS.md is found, the installer leaves it untouched and tells you to merge the binding manually.
To make the command available in every OpenCode project, run the explicit global installer:
repo="/path/to/cross-agent-subtask"
node "$repo/scripts/install-opencode.mjs" --globalThe global installer refuses existing command files and symlinked parent directories. It does not modify any project AGENTS.md. Review the destination before using global installation.
The global command is available in every project. Add the AGENTS.md binding to a project when you want workspace-level enforcement there as well.
In an OpenCode session from the target project:
-
Run
/subtaskwith no task. It should reply exactly:What should the subtask do? -
Run:
/subtask Count from 1 to 10 and return only the numbers. -
Confirm that a child session is created, the result returns to the parent conversation, and the parent does not perform the count itself.
npm test validates repository structure. It does not replace this client-level smoke test.
Antigravity has multiple surfaces and configuration layouts. Choose the profile that matches the Antigravity version and surface you are using.
Use the documented workspace locations:
<workspace-root>/.agents/skills/subtask/SKILL.md
<workspace-root>/.agents/rules/subtask-command.md
Copy the repository's .agents/skills/subtask/SKILL.md and .agents/rules/subtask-command.md into the target workspace. The current Antigravity 2.0 documentation uses .agents/rules; some older surfaces use the legacy singular .agent/rules directory. Follow the path documented by the surface you are installing. This profile does not use skills.json.
Use the documented global locations:
~/.gemini/config/skills/subtask/SKILL.md
~/.gemini/config/rules/subtask-command.md
Copy the files from the repository's .agents/ directory. If a rule already exists at the destination, merge it deliberately instead of overwriting it.
Some local AGY configurations use:
~/.gemini/config/agy-skills/
~/.gemini/config/skills.json
For that profile, use the files under antigravity/agy-skills/ and antigravity/rules/, then add the skill catalog to the existing skills.json.
The repository recommends an absolute path for a stable catalog entry:
{
"entries": [
{
"path": "/absolute/path/to/cross-agent-subtask/antigravity/agy-skills"
}
]
}An absolute path avoids resolution ambiguity. It is a recommendation for this local profile, not a universal requirement for every Antigravity surface.
See antigravity/README.md before mixing profiles.
Use an interactive session for the Antigravity surface you installed:
-
Run
/subtaskwith no task. It should reply exactly:What should the subtask do? -
Run:
/subtask Count from 1 to 10 and return only the numbers. -
Confirm that one child session is created, the result returns to the same conversation, and the parent does not perform the count itself.
If a surface supports a print or non-interactive mode, use that surface's documented syntax for an additional smoke test. Do not assume that every Antigravity version exposes the same CLI flags.
If you do not want to copy files manually, give your agent the repository and ask it to use the guided prompt:
prompts/subtask-install-prompt.md
You can also provide this instruction:
Read the cross-agent-subtask repository and install the /subtask command for this agent. Inspect the harness before changing files, prefer workspace scope, preserve existing configuration, preview exact destinations, ask before any global write, use the correct native mechanism, and verify the command with a real subagent launch. Do not delete or overwrite unrelated configuration.
The guided prompt is intentionally conservative. It asks the agent to discover the current harness instead of assuming that every tool uses the same configuration paths.
/.opencode/commands/subtask.md uses OpenCode's command frontmatter:
subagent: trueThe command does not select a separate built-in agent or run a shell block merely to discover the project path. The host applies its configured model and permission rules.
/.agents/skills/subtask/SKILL.md contains the behavior using Antigravity's invoke_subagent tool. The rule in /.agents/rules/subtask-command.md asks the parent to load the skill and launch one child.
The exact tool schema can vary by Antigravity surface. The skill uses documented fields where possible and tells the agent to use the current surface's real schema.
The files under antigravity/ include the locally observed AGY adapter and its optional skills.json example. They are documented as a separate compatibility profile, not as the documented Antigravity 2.0 layout.
See docs/architecture.md for the complete design.
/subtask Count from 1 to 20 in Roman numerals.
/subtask Inspect the README and summarize the installation steps. Do not modify files.
/subtask Run `sleep 30`, then tell me when the 30 seconds are complete.
For the final example, the main conversation can continue while the child session is running. The result should appear when the child finishes.
This project does not bypass agent permissions. A subagent receives the permissions and tools available to it through the host application.
Before installing it:
- Read the command, skill, rule, and prompt files.
- Install only the adapter for the client and surface you use.
- Back up existing configuration before merging
AGENTS.md, rules, or skill catalogs. - Do not put API keys, tokens, private files, or credentials in prompts or task descriptions.
- Review any task that allows shell commands or file edits.
- Remember that
/subtaskis a delegation workflow, not a safety boundary. - Do not assume that a child automatically has the same permissions as a more restricted parent agent. Check the host's permission model.
The repository intentionally does not include an automatic installer that silently changes global configuration. The guided prompt asks the agent to preserve unrelated files, preview destinations, and show what it changed.
This repository has a dependency-free validation script:
npm testThe validator checks required adapters, registration examples, prompts, and security documentation. It does not replace testing the command inside each client surface.
This project is published for people to use, install, and star. It is not accepting outside contributions, and pull requests will not be reviewed or merged.
MIT. See LICENSE.