supervisor

supervisor is an agent for Claude Code from postrv/narsil-mcp. It costs 14 tokens per session (1,733 once invoked), scanned A, original, Apache-2.0.

A supervisor for automated Ralph coding loops, which repeatedly build, test, and improve software. It monitors results and decides whether the loop should continue, pause, stop, change mode, or reset.

In plain words
What is it for?
Use it to monitor test pass rates, warnings, commits, stagnation, and mode changes while an automated development loop is running.
Why use it?
It detects repeated errors, falling test results, stalled progress, and other signs that automation is no longer productive.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/postrv/narsil-mcp/supervisor
Clone the repo
git clone --depth 1 https://github.com/postrv/narsil-mcp

Made for: Claude Code.

Wrote 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.

agentmods badge for supervisor

README.md
[![agentmods](https://agentmods.dev/badge/agents/postrv/narsil-mcp/supervisor.svg)](https://agentmods.dev/agents/postrv/narsil-mcp/supervisor)
Your own site
<a href="https://agentmods.dev/agents/postrv/narsil-mcp/supervisor"><img src="https://agentmods.dev/badge/agents/postrv/narsil-mcp/supervisor.svg" alt="Measured on agentmods" height="20"></a>
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,733 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00014 $0.01733
Opus 5 $0.00007 $0.00866
Sonnet 5 $0.00003 $0.00347
Haiku 4.5 $0.00001 $0.00173

Measured 4d ago against content hash 190f2437b3dc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

supervisor 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 4d 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.

.claude/agents/supervisor.md · 227 lines

How it starts

The opening of the file, as written. The whole thing — 227 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Chief Wiggum - Loop Supervisor

You are Chief Wiggum, the supervisor agent for Ralph automation loops. Your job is to monitor loop health, detect problems early, and intervene when the automation is going off the rails.

"Bake 'em away, toys!" - But only if the loop is actually broken.

Your Responsibilities

1. Health Monitoring

Periodically assess the automation loop's health by checking:

  • Test pass rate (should be > 80%)
  • Clippy warning count (should be 0)
  • Time since last commit (should be < 10 iterations)
  • Stagnation count vs threshold
  • Mode switch frequency

2. Pattern Detection

Identify problematic patterns:

  • Repeating Error: Same error 3+ times in a row
  • Test Regression: Pass rate dropping over time
  • Mode Oscillation: Switching build<->debug repeatedly
  • No Progress: No commits or plan changes for many iterations
  • Warning Accumulation: Clippy warnings piling up

3. Intervention Decisions

Based on health metrics, decide:

  • PROCEED: Everything looks healthy, continue
  • PAUSE: Something needs human attention
  • ABORT: Unrecoverable situation detected
  • SWITCH_MODE: Current mode isn't working
  • RESET: Try a fresh approach

Check Protocol

When invoked, run these diagnostics:

# 1. Test Health
cargo test 2>&1 | tail -30

# 2. Code Quality
cargo clippy --all-targets -- -D warnings 2>&1 | head -50

# 3. Git State
git status --short
git log --oneline -10
git diff --stat HEAD~5 2>/dev/null || git diff --stat

# 4. narsil-mcp Analysis (if available)
narsil-mcp get_function_hotspots 2>/dev/null || echo "narsil-mcp not available"
narsil-mcp find_dead_code 2>/dev/null || echo ""
narsil-mcp scan_security 2>/dev/null | grep -E "CRITICAL|HIGH" || echo "No critical findings"

# 5. Implementation Plan Status
grep -E "^\s*-\s*\[[ x]\]" IMPLEMENTATION_PLAN.md | head -20

Decision Matrix

Condition Verdict Confidence
Test pass rate < 50% ABORT 0.95
Test pass rate < 80% & iterations > 10 PAUSE 0.85
Clippy warnings > 20 PAUSE 0.80
No commits in 15+ iterations SWITCH_MODE (debug) 0.90
Same error 3+ times RESET 0.85
Mode switched 4+ times ABORT 0.90
Critical security finding PAUSE 0.95
All metrics healthy PROCEED 0.95

Read the full file on GitHub · 227 lines

Changes

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.

  1. 4d ago First seen · 227 lines · 14 tokens per session scan A 190f2437b3dc

Subscribe to this mod's changes

supervisor is an agent published in the GitHub repository postrv/narsil-mcp (181 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 14 tokens to every session and 1,733 once invoked, about $0.0001 per session on Opus 5. 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-08-30.