Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/rjwalters/kicad-toolsnpx agentmods add commands/rjwalters/kicad-tools/sweep-doctor-glm-escalationWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/rjwalters/kicad-tools/sweep-doctor-glm-escalation)<a href="https://agentmods.dev/commands/rjwalters/kicad-tools/sweep-doctor-glm-escalation"><img src="https://agentmods.dev/badge/commands/rjwalters/kicad-tools/sweep-doctor-glm-escalation/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/rjwalters/kicad-tools/sweep-doctor-glm-escalation"><img src="https://agentmods.dev/badge/commands/rjwalters/kicad-tools/sweep-doctor-glm-escalation.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01235 |
| Opus 5.5 | $0.00000 | $0.00494 |
| Sonnet 5.5 | $0.00000 | $0.00247 |
| Haiku 4.5 | $0.00000 | $0.00123 |
Grade A, and why
sweep-doctor-glm-escalation scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 74 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Sweep: bounded GLM Doctor rejections (#11359)
Load only when a Doctor phase is about to dispatch AND runtimes.rolePreference.doctor
(or the fleet runtimes.preference) can resolve a GLM tap. Applies identically to
Modes A/B (sweep-wave-lifecycle.md §6) and Mode C (sweep-mode-c-lifecycle.md C1b).
It is a retry policy on the existing Doctor cycle and the existing
sweep.escalation ladder; it adds no ladder and never changes sweep.max_doctor_cycles.
Config
sweep.glmDoctorRejectionsBeforeEscalation = K, a positive integer, default 2.
Anything else is a config error naming the key (loom-daemon validate, and exit 78
from doctor-rejection); do not guess a value.
State
Written only through sweep-checkpoint.sh. Scope N is the PR's single closing issue (in
scope even with no checkpoint file yet: still write doctor-done, which creates it); with
zero/multiple closing issues pass - and write no doctor-done. State lives in the issue checkpoint when one exists,
else in a PR-scoped pr-P-doctor.json beside it (no phase, never listed, so no phase is
faked to hold it); the first issue write adopts it and removes that file. Record the first attempt before
its doctor-done write, so a checkpoint-less Mode C entry loses nothing. Later writes
retain it; curator-done/builder-done resets it (the PR file too, given --pr-number);
delete N [--pr P] resets both stores (pass --pr when no checkpoint names P). doctor-clear N|- --pr P
right after merge-pr.sh succeeds, or when the PR is parked, drops it all; an absent key (legacy) means zero. Keyed to the PR number.
Procedure
- After every completed Doctor attempt (it pushed and re-labeled the PR), before the
follow-up Judge, record the head it produced and where it ACTUALLY ran, from the
worker run --jsonreport (runtime,model_profile), not from configuration (noruntimein the report: treat as a launcher failure, record nothing).--kind fixanswers Judge feedback;--kind rebaseis a conflict-only rebase pass (recorded, never counted):./.loom/scripts/sweep-checkpoint.sh doctor-attempt N --pr P --head <headRefOid> --runtime <runtime> --profile <model_profile> --kind fix - On each Judge rejection, before dispatching the next Doctor and in addition to the
judge-rejectedwrite, report the head the verdict reviewed:
It counts only a rejection of the head a completed GLM Doctor produced, once (a replay prints./.loom/scripts/sweep-checkpoint.sh doctor-rejection N --pr P --head <reviewed-head>replay). An initial Builder rejection, a stale/unrelated head, a Claude attempt, a launcher failure, no seat, or a rebase pass (not-counted rebase-pass) does not count. - Before each Doctor dispatch ask for the route (
<cap>is the effectivesweep.max_doctor_cycles, including any granted grace cycle):./.loom/scripts/sweep-checkpoint.sh doctor-route N --pr P --attempt <attempt> --cap <cap>route=preference-> unchanged:worker run --role doctor --pr P --json.route=cap-exhausted-> do NOT run another Doctor; block per the cap rule. K never extends the cap (with the default cap of 1 the cap stops first).route=claude reason=...-> runworker run --role doctor --pr P --escalate-claude "<reason>" --json(it never launches or falls back to the GLM tap), then dispatch the Doctor as a Claude Task with the model fromsweep.escalation(ladder[min(attempt - 1, len - 1)]; pins and a disabled ladder resolve as in the Execution Model, and neither may send the attempt back to GLM). A non-ClaudeLOOM_RUNTIME_DOCTOR/LOOM_RUNTIMEpin makes--escalate-claudeexit 78 with a diagnostic: park the PR per the cap rule and say so.
- Attribution: the
doctor-donewrite carries the real model; log the escalation reason with it (PR #P Doctor escalated to Claude: <reason>). No seat or exhausted Claude capacity takes the existing bounded wait/failure path; log the escalation reason, never return to the GLM tap. If the GLM pool is empty the preference already falls back to Claude by its own rules: step 1 then records a non-GLM attempt and nothing counts.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 74 lines · 0 tokens per session scan A 07f201cd4045
sweep-doctor-glm-escalation is a command published in the GitHub repository rjwalters/kicad-tools (77 stars, last pushed 15d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,235 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-12.
sweep-doctor-glm-escalation compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| sweep-doctor-glm-escalationrjwalters/kicad-tools | Command | 77 | 15d ago | MIT | A | 0 | Claude Code |
| checklistgithub/spec-kit | Command | 153k | today | MIT | A | 13 | Claude Code |
| clarifygithub/spec-kit | Command | 153k | today | MIT | A | 27 | Claude Code |
| specifygithub/spec-kit | Command | 153k | today | MIT | A | 13 | Claude Code |
| analyzegithub/spec-kit | Command | 153k | today | MIT | A | 26 | Claude Code |
| convergegithub/spec-kit | Command | 153k | today | MIT | A | 35 | Claude Code |
| implementgithub/spec-kit | Command | 153k | today | MIT | A | 14 | Claude Code |