Documentation Index
Fetch the complete documentation index at: https://docs.trytrellis.app/llms.txt
Use this file to discover all available pages before exploring further.
Custom Sub-agents
Trellis ships three sub-agents (trellis-implement, trellis-check, trellis-research). You can modify them or add your own. This chapter walks through the Claude Code format as the main example, then lists the frontmatter differences on other platforms.
Sub-agents ship on 11 of 14 configured platforms: Claude Code, Cursor, OpenCode, Codex, Kiro,
Gemini CLI, Qoder, CodeBuddy, Copilot, Droid, Pi Agent. The agent file format varies by platform
(Markdown / TOML / JSON), and on platforms without a
PreToolUse hook or extension equivalent the
sub-agents read implement.jsonl / check.jsonl themselves via a pull-based prelude instead of
having it injected. Kilo, Antigravity, and Windsurf do not expose a sub-agent primitive — the
implement / check work runs inline in the main session.Sub-agent definition (Claude Code example)
A sub-agent definition file lives at.claude/agents/{name}.md and uses YAML frontmatter:
| Field | Meaning |
|---|---|
name | Sub-agent identifier used in Task(subagent_type="...") calls |
description | Used by the main session to decide when to spawn this sub-agent |
tools | Comma-separated list of tools the sub-agent may call |
model | Optional model override. Omit to inherit the session model; this is the current recommendation so Cursor users and similar are not billed on a forced Opus default |
Sub-agent file format is platform-specific
The file extension, frontmatter shape, and tool-declaration syntax differ per platform:| Platform | File | Tool / permission field | Example value |
|---|---|---|---|
| Claude Code | .claude/agents/{name}.md | tools: (comma list) | Read, Write, Edit, Bash, Glob, Grep, Task, Skill |
| Claude Code | (MCP tools) | same field, prefixed names | mcp__exa__web_search_exa, mcp__chrome-devtools__* |
| Cursor | .cursor/agents/{name}.md | CC-style tools: comma list | Read, Write, Edit, Bash |
| OpenCode | .opencode/agents/{name}.md | permission: (object) | { read: allow, write: allow, bash: allow, "mcp__exa__*": allow } |
| Codex | .codex/agents/{name}.toml | TOML sandbox_mode + tool toggles | sandbox_mode = "workspace-write" |
| Kiro | .kiro/agents/{name}.json | JSON tools: (lowercase array) | ["read", "write", "bash"] |
| Gemini CLI | .gemini/agents/{name}.md | CC-style tools: comma list | Read, Write, Edit, Bash |
| Qoder | .qoder/agents/{name}.md | CC-style tools: comma list | Read, Write, Edit, Bash |
| CodeBuddy | .codebuddy/agents/{name}.md | CC-style tools: comma list | Read, Write, Edit, Bash |
| Copilot | .github/agents/{name}.agent.md | CC-style tools: comma list | Read, Write, Edit, Bash |
| Droid | .factory/droids/{name}.md | CC-style tools: comma list | Read, Write, Edit, Bash |
| Pi Agent | .pi/agents/{name}.md | CC-style tools: comma list + extension context | Read, Write, Edit, Bash |
Pi Agent model and thinking config
Pi sub-agent definitions live under.pi/agents/{name}.md. They use Markdown with YAML frontmatter, like Claude-style agents, plus optional Pi run configuration:
| Config | Child Pi args |
|---|---|
model + thinking | --model <model>:<thinking> unless the model already has a thinking suffix |
model only | --model <model> |
thinking only | --thinking <level> |
model / thinking passed to the Pi subagent tool overrides frontmatter for that one child run. fallbackModels / fallback_models is parsed for pi-subagents-compatible files, but Trellis does not pass it to Pi CLI because Pi has no documented stable fallback-model flag.
For custom context injection, use a task-local JSONL file convention and extend .pi/extensions/trellis/index.ts to handle the new sub-agent name. Pi Agent does not load Python hook scripts.
If you author a sub-agent that should work on multiple platforms, put the canonical Claude-Code version in packages/cli/src/templates/claude/agents/ and add platform adapters in packages/cli/src/configurators/ that translate the frontmatter into each platform’s native syntax. Trellis already does this for the shipped trellis-implement / trellis-check / trellis-research.
Modifying a shipped sub-agent
Example: add a timeout and a stricter tool budget totrellis-check.
.trellis/spec/backend/ (or wherever your convention lives) instead of the agent definition, so the sub-agent’s behavior changes through spec injection rather than a fork.
Creating a new sub-agent
Example: atrellis-test sub-agent that writes tests for the current diff.
Context injection
If you want your sub-agent to receive spec context the way the shipped ones do:- Accept a JSONL name convention (e.g.
test.jsonl) in each task directory. - On platforms with a
PreToolUse(sub-agent) hook or extension equivalent — Claude Code, Cursor, OpenCode, CodeBuddy, Droid, Pi Agent — editinject-subagent-contextor the Pi extension to handle the new sub-agent type. - On platforms without that injection point (Codex, Kiro, Gemini, Qoder, Copilot), follow the “pull-based prelude” pattern the shipped sub-agents use: prepend a block at the top of the agent file telling the sub-agent to
Readits own JSONL before acting.