Skip to content

t1k:model-router:delegate

FieldValue
Modulemodel-router
Version4.0.2
Effortlow
Tools—

Keywords: cheap model, delegate, glm, intercept, kimi, model-mapping, route, route to cheap, subagent, swap model

/t1k:model-router:delegate
<agent-name> "<task>" --backend <backend> --model <model>

The kit no longer ships shim agents. The delegation contract is:

Terminal window
bash .claude/scripts/mr-delegate.sh <agent-name> "<task>" --backend <backend> --model <model>

The script:

  1. Discovers .claude/agents/<agent-name>.md (cwd → CLAUDE_PROJECT_DIR → ~/.claude/agents).
  2. Reads frontmatter for permissionMode / maxTurns / maxBudgetUsd / effort (fallback: plan / 25 / $5 / no --effort flag). effort must be one of low/medium/high/xhigh/max; an invalid value is warned and dropped, never silently passed through. MR_HOP_EFFORT env overrides a valid frontmatter value.
  3. Runs claude -p --agent <name> --model <chosen-cheap-model> against the chosen backend.
  4. Returns the agent’s text output.

Primary call path is the Task interceptor (hooks/mr-task-interceptor.cjs), not this skill. The flow:

main session → Task(subagent_type="t1k-unity-dots-core-implementer", prompt="...")
↓
PreToolUse hook reads the agent's `model:` frontmatter
↓
matches modelMapping["sonnet"] → { the hosted backend, deepseek-v4.1-flash }
(opus-family keys never get here — they hit the kit passthrough floor first)
↓
hook denies the Task, runs mr-delegate.sh, returns output as systemMessage
↓
main session sees the cheap result as if Task had succeeded

Engine-kit specialization is preserved: the Unity DOTS agent’s full prompt + tools run, just on the routed cheap backend instead of Opus.

Where the hop runs — name a worktree in the CALLER’s repo family

Section titled “Where the hop runs — name a worktree in the CALLER’s repo family”

A routed hop inherits the caller’s projectRoot as its cwd. To run it elsewhere, the brief must carry ONE canonical line, unindented and outside any fence:

worktree: /absolute/path/to/a/marked/lane/worktree

mr-lane-worktree.cjs validates it fail-closed (full contract: docs/mr-lane-worktree.md). The refusal that bites when your task names a DIFFERENT repo is foreign: the directive’s worktree must share its common git dir with the CALLER’s own repo, so a hop is relocatable only WITHIN the caller’s repo family — never into a foreign repo’s checkout.

Naming the target repo in PROSE does nothing. With no directive the hop runs at projectRoot (the caller’s main clone) and cannot reach a target elsewhere: it opens the wrong tree, and any worktree: it then tries to create is denied — a routed hop may not create repos or worktrees (the spawner does). To route work that targets another repo, run it in a session whose own projectRoot IS that repo, or have that repo’s family create a marked lane worktree and pass its path in the directive. The router never crosses repo families.

When to Use the Explicit Form (this skill)

Section titled “When to Use the Explicit Form (this skill)”

Most delegation happens automatically via the Task interceptor. Call /t1k:model-router:delegate explicitly only when:

  • You’re outside a Task spawn (e.g. running mechanical work from a Bash hook script).
  • You want to force a specific (backend, model) that overrides modelMapping.
  • You’re debugging — explicit invocation surfaces the full mr-delegate.sh output.
Terminal window
# Force an explicit backend/model, bypassing selection. NOTE: the named model must be
# enabled in the model catalog — the routing target is deepseek-v4.1-flash
# (see its _comment in the model catalog for the id's own history).
bash .claude/scripts/mr-delegate.sh t1k-code-reviewer \
"audit src/auth/ for OWASP Top 10" \
--backend ccs --model deepseek-v4.1-flash

When you call the explicit form, YOU pick (backend, model). When the interceptor fires, the mapping picks for you.

  1. Read .claude/model-capabilities.md for model strengths/costs.
  2. Read the model catalog (.claude/) for available backends.
  3. Choose the best (backend, model) for task complexity.

Pass via --backend <backend> --model <model> flags. Both required — no defaults.

NeedModelBackendWhy
Cheapest possibledeepseek-v4.1-flashthe hosted backendOnly enabled text/tool-use model; the shipped modelMapping default for sonnet and haiku (route ccs)
Best balancedeepseek-v4.1-flashthe hosted backendSole enabled text target — DeepSeek V4.1 Flash under its real the hosted backend id
Best reasoningdeepseek-v4.1-flashthe hosted backendSame model as “Cheapest possible” — carries the reasoning tag itself, only enabled target
Long contextdeepseek-v4.1-flashthe hosted backendDeclares long-context, 1M window
Vision (image blocks)deepseek-v4.1-flashthe hosted backendCarries vision and is FIRST in capabilityPipes.vision — measured on a same-family carry-over, so re-measure before relying on it; images only, no PDFs — see .claude/model-capabilities.md
Explicit failover fallbackglm-5.3-flashglmfailover.pipe is deepseek-v4.1-flash (the pick) then glm-5.3-flash (failover hop 2); glm-5.3-flash is also the video role route

Every model here is enabled: true in the model catalog. Older names still seen in issues and archived design docs — qwen3.5-plus, kimi-k2.5, glm-5.1, glm-5.2, kimi-for-coding, deepseek-v4-pro, deepseek-v4-flash and deepseek-flash (superseded; current successor deepseek-v4.1-flash), kimi-k2.6, kimi-k2.7-code-highspeed, gpt-5.4-mini, minimax-m2.7, the mimo-* family — ship disabled and are not valid --model targets unless a consumer re-enables them locally.

Full details: read .claude/model-capabilities.md.

Every delegation enforces:

  • Tool whitelist from the agent’s own frontmatter (Claude Code respects tools: / disallowedTools:).
  • Permission mode read from agent frontmatter; safe fallback (plan) if missing.
  • Max turns from agent frontmatter; default 25 if missing.
  • Budget cap from agent frontmatter; default $5 if missing.
  • Timeout (5 minutes default).
  • No nested delegation (MR_SPAWNED guard at both the script and the interceptor).
  • Write lock (single write-capable agent at a time when mode=acceptEdits).
  • Telemetry (events sent to T1K cloud for monitoring).
  • excludeAgents list in t1k-config-mr.json — any agent here is never intercepted (e.g. t1k-debugger, t1k-planner for tasks that genuinely need Opus).
  • Local logs: ~/.model-router/calls.jsonl (carries the agent name).
  • Tool usage: ~/.model-router/tool-usage.jsonl.
  • Live hop activity: bash .claude/scripts/mr-watch.sh — streams the routed hop’s own transcript (text, tool calls, results) in a separate terminal, at zero context cost. Use it when a delegation is running long and you want to see what the cheap model is actually doing; the conversation it was spawned from cannot show this, because the delegation runs inside a synchronous PreToolUse hook.
  • Worker schema: the existing role column carries the agent name (no migration).

See The1Studio/theonekit-model-router#42 for the v2 design rationale and #54 for the v3.3.0 kit-enforced Opus-family passthrough policy.