/delegate:setupfrom delegate
Detects delegation harnesses (opencode, devin, cursor-agent, codex) on the machine, asks which to allowlist, and writes the policy file. Run once per machine and after CLI installs or removals.
Ships in delegate. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The allowlist is the user's policy: the ceiling of what /delegate:route may ever
pick. Detection is the floor. Do not decide the policy for them. Ask.
Model rosters are large. opencode lists 959 models, devin 392, cursor-agent 227. So
the harness's own list command is the source of truth, and the catalog's
suggested array is only a seed. Never present a picker with hundreds of options.
node "${CLAUDE_PLUGIN_ROOT}/scripts/delegate.mjs" detect
For every harness this gives available, always_present, traits, its list
command, and a short suggested array. It also reports typesafe_key and where the
allowlist will be written.
One call, two questions. Both multiSelect: true.
available is true. A picker holds four
options. If more than four are available, ask the first four, then make a second
call for the rest. Use each harness's traits, shortened, as the option
description.subagent.suggested: haiku, sonnet, opus.
This is a small fixed set, so a picker is the right tool here.inline is always included. Do not ask about it. Without it the router can never
answer "keep this one yourself".
Say in your summary which harnesses you skipped, and that the CLI is missing.
Say verified out loud for every option you offer. local means the launch line
was confirmed first-hand. docs means it comes from documentation and has never run
on any machine here, so its first run is also its first test. The user deserves that
before they allowlist it, because the failure lands in their terminal.
Do not use AskUserQuestion for this. Four options cannot cover 959 models.
For each outside CLI the user enabled, run its list command and read the real ids:
opencode models | head -40
devin models list
cursor-agent models
codex has no list command. Its model is set by policy; use suggested.
Then propose at most eight ids for that harness, in a short table with one line each. Tell the user they can name any other id from the list instead. Take the whole list into account, not only the head of it; grep it when you are after a family.
fits line for every chosen modelfits is the entire rubric the router judges that option against, so it decides the
routing quality. Rules:
traits is added at route time, so
repeating it wastes the rubric.suggested entry, copy its fits.Some models need their own command. An opencode model routed through a named provider is the common case:
OPENCODE_CONFIG_CONTENT='{"provider":{"openrouter":{"models":{"deepseek/deepseek-v4.1-flash":{"options":{"provider":{"order":["baseten/fp8","novita/fp8"],"allow_fallbacks":true}}}}}}}' opencode run -m {model} --format json "<prompt>" < /dev/null > events.jsonl 2> err.log
Put that whole string in the entry's optional launch field. It replaces the
harness template for that entry only, and {model} is still substituted. Ask the
user for it; do not invent a provider order.
Leave launch out when the harness default is right, which is most of the time.
Pass one JSON array of entries. Each needs harness, model, and fits; launch
is optional.
node "${CLAUDE_PLUGIN_ROOT}/scripts/delegate.mjs" save '[
{"harness":"inline","model":"this-session","fits":"Short work, or work needing context only this session holds."},
{"harness":"subagent","model":"sonnet","fits":"A broad search across a repository. Not for deciding whether a contested finding is real."},
{"harness":"codex","model":"gpt-6-astra","fits":"Adversarial review of code it did not write. It cannot implement anything."}
]'
It rejects an unknown harness, an empty model, and a missing fits, so a mistake
fails loudly.
typesafe_key is false: TYPESAFE_API_KEY is unset, so route returns the
roster and the model chooses by reading rather than by probability. Setting the
key turns the judgement on. Get one at https://typesafe.ai.The overlay at ~/.claude/delegate-catalog.json survives a plugin update. Give it
the same shape as ${CLAUDE_PLUGIN_ROOT}/catalog.json. A new harness id needs bin,
traits, launch, and list.
{ "harnesses": [ { "id": "aider", "bin": "aider", "list": "aider --list-models",
"traits": "An outside CLI that edits files in place.",
"launch": "aider --model {model} --message \"<prompt>\"", "models": [] } ] }
To add a model, you do not need the overlay. Rerun this skill, or edit the allowlist directly.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
2 skills in this plugin
npx claudepluginhub lahfir/claude-plugins --plugin delegateOther plugins' skills for the same job