Categories and Delegation
Domain routing via categories, generated shuttle agents, and delegation topology rules
Categories define domain routing in Weave. Each category automatically generates a specialized shuttle agent that inherits from the base shuttle agent with category-specific overrides. This page covers how categories work, how shuttle agents are generated, and the delegation filtering rules that govern which agents can delegate to whom.
Category Syntax
Section titled “Category Syntax”Categories are declared in .weave configuration files using the category block:
category backend { description "Backend APIs, services, persistence" models ["anthropic/claude-sonnet-4-5"] patterns ["src/api/**", "src/server/**", "src/db/**", "**/*.go"] prompt_append "Focus on API contracts, data integrity, and backwards compatibility." temperature 0.2
tool_policy { read allow write allow delegate deny }}
category frontend { description "Frontend UI, styling, accessibility" models ["openai/gpt-5"] patterns ["src/components/**", "src/pages/**", "**/*.tsx", "**/*.css"] prompt_append "Preserve accessibility, responsive behavior, and design-system consistency."}Category Fields
Section titled “Category Fields”| Field | Type | Description |
|---|---|---|
description |
string | Human-readable label shown in harness UI |
models |
string[] | Model preference list for this category’s shuttle agent |
patterns |
string[] | Glob patterns that route files to this category |
prompt_append |
string | Text appended to the base shuttle prompt for this category |
prompt_append_file |
string | File path appended to the base shuttle prompt (mutually exclusive with prompt_append) |
temperature |
number | Temperature hint for this category’s shuttle agent |
variant |
string | Free-form string for model variant selection, passed through to the generated shuttle agent. |
tool_policy |
block | Tool policy overrides for this category’s shuttle agent |
Generated Shuttle Agents
Section titled “Generated Shuttle Agents”Each category automatically generates a shuttle agent descriptor named shuttle-{category-name}. For example:
category backendgeneratesshuttle-backendcategory frontendgeneratesshuttle-frontendcategory infrastructuregeneratesshuttle-infrastructure
These generated agents inherit from the base shuttle agent and apply category-specific overrides:
- Models: The category’s
modelslist replaces the base shuttle’s model preferences - Prompt: The category’s
prompt_appendorprompt_append_fileis appended to the base shuttle prompt - Temperature: The category’s
temperatureoverrides the base shuttle’s temperature - Tool Policy: The category’s
tool_policyis merged with the base shuttle’s policy
The generated shuttle agent is a first-class agent descriptor available for delegation routing. Adapters decide how these descriptors are materialized in a concrete harness.
Delegation Filtering Rules
Section titled “Delegation Filtering Rules”Delegation targets are computed during prompt composition and filtered according to these rules:
1. No Self-Delegation
Section titled “1. No Self-Delegation”An agent cannot delegate to itself. The composing agent’s own name is excluded from the delegation target list.
2. No Primary-to-Primary Delegation
Section titled “2. No Primary-to-Primary Delegation”Agents with mode: "primary" are excluded from delegation target lists. Primary agents are user-facing orchestrators, not delegation targets.
3. No Shuttle-to-Shuttle Cross-Delegation
Section titled “3. No Shuttle-to-Shuttle Cross-Delegation”If the target agent name starts with shuttle- and the composing agent is either shuttle or already a shuttle-* agent, that target is excluded. This prevents the shared shuttle agent and generated category shuttles from advertising one another as delegation targets.
4. Shuttle-to-Primary Allowed
Section titled “4. Shuttle-to-Primary Allowed”Shuttle agents can delegate back to primary agents (such as loom or pattern) when appropriate. This enables shuttles to escalate complex decisions or request planning assistance.
5. Disabled Agents Excluded
Section titled “5. Disabled Agents Excluded”Any agent listed in config.disabled.agents is removed from delegation target lists.
6. Delegation Must Be Allowed
Section titled “6. Delegation Must Be Allowed”If the composing agent’s tool_policy.delegate is not "allow", the delegation target list is empty regardless of other rules.
Delegation Topology Example
Section titled “Delegation Topology Example”Consider this configuration:
agent loom { description "Loom (Main Orchestrator)" prompt_file "loom.md" models ["claude-sonnet-4-5"] mode primary tool_policy { delegate allow }}
agent shuttle { description "Shuttle (Domain Specialist)" prompt_file "shuttle.md" models ["claude-sonnet-4-5"] mode subagent tool_policy { delegate allow }}
category backend { description "Backend APIs, services, persistence" patterns ["src/api/**", "**/*.go"]}
category frontend { description "Frontend UI, styling, accessibility" patterns ["src/components/**", "**/*.tsx"]}This configuration generates the following delegation topology:
graph TD loom[loom<br/>primary] shuttle[shuttle<br/>subagent] backend[shuttle-backend<br/>subagent] frontend[shuttle-frontend<br/>subagent]
loom -->|can delegate to| shuttle loom -->|can delegate to| backend loom -->|can delegate to| frontend
shuttle -.->|cannot delegate to| backend shuttle -.->|cannot delegate to| frontend backend -.->|cannot delegate to| shuttle backend -.->|cannot delegate to| frontend frontend -.->|cannot delegate to| shuttle frontend -.->|cannot delegate to| backend
shuttle -->|can delegate to| loom backend -->|can delegate to| loom frontend -->|can delegate to| loomKey observations:
loom(primary) can delegate to all shuttle agentsshuttle,shuttle-backend, andshuttle-frontendcannot delegate to one another (shuttle-to-shuttle cross-delegation is blocked)- All shuttle agents can delegate back to
loom(shuttle-to-primary is allowed)
Delegation Triggers and Routing Hints
Section titled “Delegation Triggers and Routing Hints”Agents can declare triggers to provide routing guidance for delegation decisions:
agent loom { description "Loom (Main Orchestrator)" prompt_file "loom.md" models ["claude-sonnet-4-5"] mode primary
tool_policy { delegate allow }
triggers [ { domain "Orchestration" trigger "Complex multi-step tasks" routing_hint "Use for work spanning multiple files or components" } { domain "Architecture" trigger "System design and planning" routing_hint "Use when design decisions need to be made before implementation" } ]}Each trigger entry includes:
- domain: A high-level category for the trigger (e.g. “Orchestration”, “Architecture”)
- trigger: A concise description of when to delegate to this agent
- routing_hint: Optional prescriptive “Use when…” guidance for delegation routing
These triggers are included in the delegation.targets template context and can be rendered in agent prompts using Mustache templates:
## Delegation
{{#delegation.targets}}- **{{name}}**{{#description}} - {{description}}{{/description}} {{#triggers}} - {{domain}}: {{trigger}}{{#routing_hint}} ({{routing_hint}}){{/routing_hint}} {{/triggers}}{{/delegation.targets}}Pattern Matching
Section titled “Pattern Matching”Category patterns use glob syntax to match file paths:
**/*.gomatches all Go files in any directorysrc/api/**matches all files undersrc/api/src/components/**/*.tsxmatches all TypeScript React files undersrc/components/
When a task involves files matching a category’s patterns, the orchestrator can route that work to the corresponding shuttle agent.
Category-Specific Overrides
Section titled “Category-Specific Overrides”Categories allow you to specialize shuttle behavior for different domains:
Backend category (focus on data integrity):
category backend { description "Backend APIs, services, persistence" models ["anthropic/claude-sonnet-4-5"] patterns ["src/api/**", "src/server/**", "**/*.go"] prompt_append "Focus on API contracts, data integrity, and backwards compatibility." temperature 0.2}Frontend category (focus on accessibility):
category frontend { description "Frontend UI, styling, accessibility" models ["openai/gpt-5"] patterns ["src/components/**", "**/*.tsx", "**/*.css"] prompt_append "Preserve accessibility, responsive behavior, and design-system consistency." temperature 0.3}Each generated shuttle agent receives the category-specific guidance in its composed prompt, enabling domain-appropriate behavior without duplicating the entire shuttle prompt.
Related Documentation
Section titled “Related Documentation”- DSL Configuration - Categories - Full category DSL specification
- Prompt Composition - How category prompts are composed
- Tool Policy - How tool policies are resolved
- Adapters - How adapters materialize shuttle agents