invoke
GitHub参数化编排器,按规范顺序调度专家子代理执行审计、开发等任务。支持断点续跑与上下文传递,管理运行状态文件,确保多阶段工作流有序进行。
Trigger Scenarios
Install
npx skills add AjayIrkal23/agentic-mercy-10x --skill invoke -g -y
SKILL.md
Frontmatter
{
"name": "invoke",
"description": "Parametric orchestrator: `\/invoke <acts...> [-- task]` runs one specialist subagent per act in canonical order; artifacts in .claude\/runs\/<ts>-<slug>\/; closers only after code-mutating acts.",
"argument-hint": "<acts...> [--run <dir>] [-- task]",
"user-invocable": true
}
/invoke $ARGUMENTS
1. Parse $ARGUMENTS
- Tokens before
--are acts (plus the optional--run <dir>); everything after is the TASK (empty → the request already in the conversation). - Valid acts, canonical order:
audit spec plan debug test impl refactor design clean security review docs verify. - Reorder the requested acts into canonical order regardless of how they were typed.
- Unknown token → report
unknown act "<x>" — valid: audit spec plan debug test impl refactor design clean security review docs verifyand continue with the rest. No valid act → print this usage and stop.
2. Run folder + intel (once, yourself — no dispatch)
- New run:
SLUG= kebab-case of at most 4 task words (runif empty);RUN="$(git rev-parse --show-toplevel)/.claude/runs/$(date -u +%Y%m%dT%H%M)-$SLUG"(no git repo → the cwd instead of the toplevel);mkdir -p "$RUN".$RUNis absolute: every prompt and closer gets the same path. Resume:--run <dir>→RUN= that folder, made absolute; read itsrun.json, skip every act already inrun.json.done, add the new acts toacts, and give the remaining agents every artifact already in$RUN/(BRIEF, an approved plan) as input; never redo them. Make sure.claude/runs/is git-ignored (add it to.gitignorewith Edit when missing). Every file below is written with the Write/Edit tools, never a shell heredoc or redirect. - Intel (new run): jcodemunch
plan_turn(query = TASK) +assemble_task_contexton the impacted area; graphifyquery_graphonly ifgraphify-out/exists; readCODEX.mdand the root→targetCLAUDE.mdchain when present. - New run:
Writetool →$RUN/BRIEF.md: task, surfaces (FE / BE / infra), impacted files, contracts at risk, acceptance criteria, open questions. - New run:
Writetool →$RUN/run.json; a resumed run is updated with Edit, never replaced. The one schema (the team playbookagents/team-lead.mduses the same):{"task": "<TASK>", "slug": "<SLUG>", "run": ".claude/runs/<ts>-<slug>", "started_utc": "<ISO-8601 UTC>", "start_sha": "<git rev-parse HEAD, or null>", "acts": ["<act>"], "done": [], "models": {"<act>": "<model>"}, "team": false, "expected_artifacts": {"<subagent_type or teammate name>": "<ARTIFACT>.md"}}runis the folder relative to the repo root;expected_artifactsmaps the dispatchedsubagent_type(or a teammatename) to the artifact's file name inside the run folder;teamis true only while you lead a team./invoke-status, the TeammateIdle gate and the suite gate read this file — keep it current.
Every specialist receives $RUN/BRIEF.md plus every artifact already in $RUN/; later acts start warm and never re-derive earlier context.
3. Dispatch — one specialist per act, canonical order
| act | agent | artifact (in $RUN/) |
model (default) | mutates | checkpoint |
|---|---|---|---|---|---|
audit |
audit-specialist | AUDIT-{date}.md |
sonnet | no | no |
spec |
spec-architect | SPEC-{slug}.md |
opus | no | yes |
plan |
planning-director | plan-{date}-{slug}.md |
opus | no | yes |
debug |
debug-detective | ROOTCAUSE.md |
opus | no | no |
test |
test-author | TEST-REPORT.md |
sonnet | no | no |
impl |
implementation-engineer | IMPL-REPORT.md |
sonnet | yes | no |
refactor |
refactor-specialist | REFACTOR-REPORT.md |
sonnet | yes | no |
design |
frontend-uiux-designer | DESIGN-REPORT.md |
opus | yes | no |
clean |
deadcode-reaper | REAP-REPORT.md |
sonnet | yes | no |
security |
security-sentinel | SECURITY-REPORT.md |
sonnet | no | no |
review |
santa-reviewer | SANTA-REVIEW.md |
opus | no | no |
docs |
docs-sync-agent | DOCS-SYNC-REPORT.md |
sonnet | no | no |
verify |
qa-verifier | VERIFY-REPORT.md |
sonnet | no | no |
model is what opus-guard resolves by default: opus judges, sonnet executes. Execution agents escalate to opus when the prompt reports a failed previous attempt, or when it names no plan/spec artifact and the task is large. Do not pass model=: opus-guard ignores it for pinned agents and executors unless the user's own turn names the model ("use opus").
For each act, in order:
- Set
run.json.expected_artifacts["<agent>"] = "<artifact>"(the file name) before dispatching. Agent(subagent_type="<agent>", description="<act>: <TASK>", prompt=...). The prompt names$RUN/BRIEF.md, each prior artifact path, and the exact output path$RUN/<artifact>; opus-guard adds the model and its[label]. Plain delegation: noname=(teams only for the mixedimplcase below).- Wait for it, then append the act to
run.json.done. Artifact missing or the act failed → re-dispatch once with the prompt prefixedPrevious attempt failed: <one-line reason>.(this escalates execution agents to opus); still failing → stop and report.
Act-specific rules:
impl[sonnet] surface-routes from the BRIEF: frontend →frontend-implementor-specialist; backend →backend-implementor-specialist(contract-first, publishesIMPL-REPORT-BE.md ## CONTRACT); general / infra →implementation-engineer. Mixed (FE + BE) → you (the main session) are the team lead. A subagent cannot lead a team (teammates cannot spawn teammates), so never dispatch ateam-leadagent: follow the playbook~/.claude/agents/team-lead.md. Setrun.json.team = trueandexpected_artifacts{"impl-be": "IMPL-REPORT-BE.md","impl-fe": "IMPL-REPORT-FE.md","integrator": "INTEGRATION-REPORT.md"}, then spawnAgent(name="impl-be", subagent_type="backend-implementor-specialist", ...),Agent(name="impl-fe", subagent_type="frontend-implementor-specialist", ...),Agent(name="integrator", subagent_type="integrator-specialist", ...); the integrator starts once both reports exist. Teams unavailable (the Agent tool rejectsname, or no SendMessage) or the user asked for no teams → plain sequential dispatchbackend-implementor-specialist→frontend-implementor-specialist→integrator-specialist, each after the previous artifact exists, same artifacts keyed bysubagent_type. A plan artifact in$RUN/satisfiesrequires: plan; without one the implementor writes a mini-plan first.design[opus] —frontend-uiux-designer; every raster/video/3D/audio asset comes from Higgsfield (higgsfield-generate), never placeholders. If Higgsfield needs its one-time login (the router says so once per session), ask the user once, batched with any other login, and usemcp__higgsfield__authenticate; until then report the assets as pending.refactor—refactor-specialistedits the main working tree (no worktree: nothing is committed, so nothing would merge back).cleanedits code — treat REAP edits as real changes; the closers review them.- Checkpoints (after
spec,plan): interactive session → stop, show the artifact path + a 5-line summary, ask "continue with?" and wait for the answer. Non-interactive ( -p) → continue. - Security auto-add: after the last mutating act,
git diff --name-only <start_sha>(plus untracked files) matched against**/auth/**,**/middleware/**,**/security/**,**/api/**,**/routes/**,**/handlers/**,**/controllers/**,**/*login*,**/*session*,**/*token*,**/*password*,**/*oauth*,**/*jwt*,**/*secret*,**/*credential*,**/*validat*,**/*sanitiz*— any hit andsecuritynot requested → addsecurityto the run before the closers.
4. Closers — only if an act that mutates (impl, refactor, design, clean) ran
Skip any closer whose act already ran explicitly in this run. Artifacts go to $RUN/.
deadcode-reaper[sonnet] (clean) — sequential first; it edits code.- In ONE message (parallel):
santa-reviewer[opus] (review),security-sentinel[sonnet] (security),docs-sync-agent[sonnet] (docs). qa-verifier[sonnet] (verify) — last, on the final tree.
No mutating act → no closers; say so in one line.
5. Finish
Mark every act done in run.json, then report: $RUN, the artifact list, and the verdicts (Santa PASS / CHANGES REQUESTED, security PASS / BLOCK, QA PASS / FAIL). A BLOCK or FAIL is the headline, not a footnote. To resume later: /invoke <pending acts> --run $RUN -- <task>.
Fallback — Agent tool unavailable
Read references/rosters.md and run each act's skills yourself via the Skill tool, in canonical order. Never silently drop an act.
Optional deterministic flow (explicit opt-in)
~/.claude/workflows/invoke-fullstack.js runs spec → plan → BE → FE → integrator → parallel(santa, security, docs) → qa as a Workflow script. Only the user starts it (/invoke-fullstack, or Workflow with args: {"task", "run", "slug"} after creating the run folder in step 2, run = the absolute $RUN). Never launch it on the user's behalf.
Version History
- 2315578 Current 2026-10-18 19:22


