/qwreey-delegate:delegate <agy|codex> <name> <prompt file> [--mode worktree|empty] [--ref commit]from qwreey-delegate
Hand one narrow question to another model family (Gemini `agy`, OpenAI `codex`) in an isolated unprivileged worktree and verify the answer yourself before using it. Use for a root cause that several findings may share, a view from outside the current frame, merging findings that share a mechanism, an objectivity check on names, or a bug hunt scoped to one mechanism. Do not use for review rounds, full audits, decisions, or anything that should land in the main repository as is. Also when the user asks in plain words, with or without naming the skill: "codex랑 agy써서 작명 논의해봐", "제미니한테도 물어봐", "코덱스한테 물어봐", "다른 모델 시선으로 봐줘". 다른 모델 계열에게 좁은 질문 맡기기, 제미니·코덱스 위임, 외부 시선.
Ships in qwreey-delegate. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The driver is python3 -I ${CLAUDE_SKILL_DIR}/scripts/delegate.py; below D means that command. Prompt skeletons are templates/tasks.md.
Requirements: Linux as root (setpriv, unprivileged uids from the range in the plugin option harness_delegate_uids, choom), Python 3.11 or newer, the agy and/or codex CLI logged in with the user's own subscription. Without root uid isolation the driver refuses every run (exit 4); on Windows, macOS or without those CLIs use a Claude subagent instead.
Exit codes: 0 the run finished (the model's own exit code is in guard.txt), 2 usage, 3 agent or its credentials missing, 4 refused by isolation policy, 5 concurrency limit (another task of the same agent is running, or no uid of the range is free; wait for it, do not retry in a loop).
sonnet and opus are distilled from the same base, so they share vocabulary and selection bias, and asking for an "outsider view" does not narrow a model-level tendency. Another family looks from a different angle.
Use it for: a root cause, an outside view, merging findings, an objectivity check on names (three families), a bug hunt scoped to one mechanism.
Do not use it for review rounds, full audits or exhaustive comparison tables (the Claude auditor or the gate does those; an external audit the user asked for by name is the exception). Do not hand it decisions, results to apply to the main repository as is, or a judgment that needs decision history without the context. Its output is a finding, never a decision, because the main session is the most accurate verifier.
Before launching, show the user in one line what you will ask.
HARNESS_DELEGATE_MAX_CONCURRENT=1), because the token limit is per user. Widen it only when the user says there is room. Put priorities in one task instead of splitting it into overlapping ones.gemini-3.8-flash-high; treat pro as absent.gpt-6-luna, --effort medium.--timeout defaults to 3600 s. Run with Bash run_in_background and wait for the notification.HARNESS_DELEGATE_SETUP=<command> in the repository's .claude/harness.env runs once as the task uid in a new worktree, for the rare repository that needs more.AGENTS.md at its root (skeleton: templates/AGENTS.md.template). Both models load it; it holds the canonical paths, the check commands and repository-only cautions, so the driver's preamble stays project-neutral. $D doctor --all checks the uid range, secrets, the work folder path and AGENTS.md.templates/tasks.md. The driver prepends the preamble (no writes outside the task folder, no mutating git commands, ulimit plus exit-code verdicts, measured versus estimated, base commit checked by the model itself, suggestions are not decisions). In the task:
--ref (default HEAD), so commit what the task should see first.
$D run agy <name> <prompt> [--ref <commit>] # repository from the cwd (or --repo)
$D run codex <name> <prompt> --mode empty # whole context in the prompt; number code with `nl -ba`
worktree: a detached worktree it may edit and run checks in (shell allowed).empty is a restricted copy: an empty folder, everything it needs in the prompt, shell refused, file tools refused outside the folder and in the temp folders. Those refusals are agy's own permission rules, not an OS boundary; the uid is the boundary.empty. codex worktree is refused (exit 4): its bubblewrap sandbox cannot make a namespace under an unprivileged uid, so no shell runs. Turning the sandbox off (HARNESS_DELEGATE_CODEX_SANDBOX=danger-full-access, user layer) leaves the uid as the only isolation and is the user's decision.<state>/runs/<key>/<date>-<name>/ (<key> is the repository folder name plus a path hash), checks the copy byte for byte, removes the work folder, and prints collected: <folder> and report: <folder>/report.md. The folder also holds guard.txt (exit code, whether the main repository changed, worktree HEAD, files the task edited, tools agy was denied), stdout.txt, stderr.txt (agy), meta.txt, state.json, diff.patch (worktree mode) and agy/<conversation>/ (agy's scratch probes and transcript). <state> is ~/.local/state/qwreey-delegate unless HARNESS_DELEGATE_STATE moves it.
report: MISSING after agy denied: ...: agy was refused a tool it is not allowed in headless mode and ended the turn with an empty answer. Rewrite the task so it stays inside its folder (or put the material in the prompt) and run again under a new name.kept: <work folder> - automatic collect failed: nothing was deleted; read the record the line names, then $D collect and $D remove by hand. --keep on run skips the automatic collect the same way..claude/audit/<backend>/<date>-<name>.md with the main session's verification on top and commit it. runs/ is outside the repository and gc deletes it after HARNESS_DELEGATE_RUNS_DAYS (14) days, so never cite it as evidence.$D list --all, then $D gc --all (preview) and $D gc --all --apply. gc collects and removes work folders left without a live run, deletes HOMEs without an owner and results older than the retention (--days N overrides it), and skips a work folder with a live process. Old workspaces beside a repository (<dirname(repo)>/<folder name>-<agent>/) and state folders of no known repository are only listed; removing them is the user's call ($D remove, or by hand).templates/tasks.md B, E: verdict, findings[file, line_start, line_end, confidence, recommendation, evidence]). Read that block, then reproduce each finding from its file:line and evidence; a finding missing either, or a missing block, is unverified.diff.patch is reference only; never apply it as is.On this host agy --sandbox and codex -s read-only do not stop access outside the cwd and unshare -m is not permitted, so these hold the line:
setpriv (no new privileges, no capabilities), taken per run from the range; only the task folder, its .git/worktrees/<id> and the task HOME belong to it. The main working tree and .git/objects are unwritable, so no commit and nothing to push; a pre-push hook refuses anyway. One task per uid at a time. doctor checks this and that the uid cannot read ~/.claude/.credentials.json, .git-credentials or .ssh.--dangerously-skip-permissions. Its --settings deny file tools in the temp folders, allow them in the task folder, and allow the shell only in a uid worktree; anything else is refused headless and listed in guard.txt as agy denied. A task folder under a denied temp folder is refused (exit 4; doctor shows FAIL), which is why work folders live in the state folder./usr/bin:/bin (not /usr/local/bin, where the Studio tools are), TMPDIR is inside the task HOME. If an agent cannot find something, HARNESS_DELEGATE_KEEP_ENV=1 (user layer) passes the current environment, tokens included.choom -n 1000: on OOM the task dies before claude, because agy's own Bash is invisible to the PreToolUse hooks.guard.txt.Quirks:
empty mode, which runs no shell.~/.gemini without the user's history), so tasks never see the user's other conversations.The driver owns <state>/work/<key>-<agent>/ (task folder <name>/, .homes/<name>/, .hooks/, .runs/<name>/ records) and <state>/runs/; never create or edit them by hand. Beside a repository, <repo>-scratch holds throwaway experiments and <repo>-proto/<slug> holds worktrees of prototype branches (proto/<slug>); keep worktrees only there and in .claude/worktrees/ (the harness's). Never cite the state folder or a sibling directory as evidence: move what matters into the repository and commit it, because a clone has neither.
AGENTS.md is the single entry point for external models: delete GEMINI.md (agy loads both, up to 24,000 bytes each). It is a map, not knowledge: canonical paths, known-findings ledgers, check commands, repository-only cautions, under 6KB. Restated decisions go stale.
scripts/delegate.py (opens in a new tab)scripts/delegate.sh (opens in a new tab)scripts/delegate_agents.py (opens in a new tab)scripts/delegate_isolation.py (opens in a new tab)scripts/delegate_results.py (opens in a new tab)scripts/delegate_workspace.py (opens in a new tab)scripts/harness_env.py (opens in a new tab)templates/AGENTS.md.template (opens in a new tab)templates/preamble-empty.md (opens in a new tab)templates/preamble-worktree.md (opens in a new tab)templates/tasks.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub qwreey/qwreey-harness --plugin qwreey-delegate