Skip to content
Back to skills

Prompt Evaluator

ASecurity

Evaluate, A/B compare, or check for regression in any Domios prompt file (general_agent.md, worker_suffix.md, codeterm_rule.md, agent role definitions in domios mem, bridge rules, etc). Triggers when the user asks to "test the prompt", "run evals", "check for regression", "did my prompt change break anything", or "compare prompt before and after". Runs runner.py against the matching eval set under evals.

  • 58 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 22, 2026
ai-agentspythonrustgobashnodeflaskgitapi

Works with

  • claude code
  • cli
  • api
  • mcp

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned November 22, 2026

npx -y skills add domios-dev/domios --skill prompt-evaluator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Prompt Evaluator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Prompt Evaluator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/domios-dev-prompt-evaluator/badge)](https://www.skillsdirectory.com/skills/domios-dev-prompt-evaluator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: prompt-evaluator
description: Evaluate, A/B compare, or check for regression in any Domios prompt file (general_agent.md, worker_suffix.md, codeterm_rule.md, agent role definitions in domios mem, bridge rules, etc). Triggers when the user asks to "test the prompt", "run evals", "check for regression", "did my prompt change break anything", or "compare prompt before and after". Runs runner.py against the matching eval set under evals.
---

# Prompt Evaluator

Domios has multiple system prompts and instruction files that drive agent behavior. When you change one of them, you need to know whether the change preserves the behaviors the prompt is supposed to elicit. This skill is the harness for that.

## When to use

- Changed `src-tauri/prompts/general_agent.md` and want to verify the General Agent still routes Telegram, spawns the right roles, never echoes after `bridge send`, etc.
- Compressed a prompt to save tokens — run A/B against the previous git revision to confirm no regression.
- Adding a new behavioral rule to a prompt — write an eval first, run it against the unchanged prompt to confirm it currently FAILS, then add the rule, run again to confirm it now PASSES.
- Reviewing a PR that touches any file in `src-tauri/prompts/`.
- Sanity-checking that a refactor of `worker_suffix.md` / `codeterm_rule.md` didn't strip a load-bearing instruction.

## How it works

The runner spawns the local `claude` CLI in **non-interactive sandbox mode** for each eval prompt:

```bash
claude -p "<eval prompt>" \
  --system-prompt-file "<prompt-under-test>" \
  --tools "" \
  --setting-sources "" --strict-mcp-config \
  --output-format json \
  --model sonnet
```

- `--system-prompt-file` replaces the default system prompt with the prompt under test and the runner's trusted evaluation framing.
- `--tools ""` removes built-in tools; `--setting-sources "" --strict-mcp-config` excludes inherited settings and MCP servers. An empty `--allowedTools` list does not disable tools. Isolated tool-disabled samples use a separate cache salt; empty/error actor envelopes fail before judging or caching.
- `--output-format json` returns a structured envelope; we read `result.result` for the agent's reply.
- Each eval is run **3 times** by default to catch non-determinism. 3/3 = ✓, 2/3 = ⚠ flaky, 0/3 = ✗ broken.

Open harness note: worker-handoff cases 5 (unsafe commit) and 8 (busy gateway) produced empty success/end_turn envelopes; case 8 also produced one weak listing of remaining verification. Keep these failures in the evidence: empty envelopes are actor errors, the weak listing remains a behavioral failure. They do not gate a shared plan/task-reference trim when worker_suffix is unchanged. Investigate them separately before claiming those cases stable.

For each eval, every expectation in `expectations[]` is checked by an **LLM judge** — a second `claude -p` call (Haiku by default) that asks "did the response satisfy this expectation? PASS or FAIL". Substring/regex heuristics were considered and dropped: they create false positives (tokens appearing in unrelated context, paraphrased commands, near-misses on negative constraints) and the cost saving over Haiku is negligible. One uniform path is simpler and more reliable.

The judge prompt is strict: it explicitly tells the judge to FAIL if the agent only vaguely mentions a required behavior without committing to it, if a required CLI flag/path/file is absent, or if a negative constraint is violated.

## How to run

### Single prompt eval (just check current state)

```bash
python .agents/skills/prompt-evaluator/runner.py \
  --prompt-file src-tauri/prompts/general_agent.md \
  --eval-set evals/general-agent/evals.json \
  --runs 3
```

Output: a markdown table to stdout with pass/fail per eval. Exit code `0` if all pass, `1` if any fail.

### A/B compare two prompt versions

```bash
python .agents/skills/prompt-evaluator/runner.py \
  --prompt-a "HEAD~1:src-tauri/prompts/general_agent.md" \
  --prompt-b "src-tauri/prompts/general_agent.md" \
  --eval-set evals/general-agent/evals.json \
  --runs 3 \
  --report markdown
```

`--prompt-a` accepts either a file path or a `<git-revision>:<path>` reference (resolved via `git show`). The runner will fetch the old version from git without touching the working tree.

Output: side-by-side table with `Δ` column showing regressions (`Δ < 0`), improvements (`Δ > 0`), and unchanged. For each regressed eval, the runner prints which expectations now fail and the agent's response that broke them.

### Save report to file

```bash
python .agents/skills/prompt-evaluator/runner.py \
  --prompt-a HEAD~1:src-tauri/prompts/general_agent.md \
  --prompt-b src-tauri/prompts/general_agent.md \
  --eval-set evals/general-agent/evals.json \
  --report markdown > .agents/skills/prompt-evaluator/reports/general-agent-2026-04-07.md
```

Reports directory is gitignored — they're per-machine artifacts.

### Live dashboard (long runs)

For long `--thorough` A/B runs the user often wants to *watch* progress. Add `--http-port <N>` and the runner spawns a tiny in-process HTTP server (pure stdlib — no Flask/Tornado) that serves a single-page dashboard:

```bash
python .agents/skills/prompt-evaluator/runner.py \
  --prompt-a HEAD~1:src-tauri/prompts/general_agent.md \
  --prompt-b src-tauri/prompts/general_agent.md \
  --eval-set evals/general-agent/evals.json \
  --runs 3 \
  --http-port 7779
```

The page (default browser opens automatically; pass `--no-open` to suppress) polls `/state.json` ~every 1.5s and renders:

- Top progress bar — calls done / total + ✓/⚠/✗ counts
- Per-eval row with status pill, expand to see prompt + every run's response + per-expectation matcher verdicts (pass/fail + reason)
- Final markdown report embedded at the bottom on completion

The HTTP server stays up after the run finishes so you can browse the final state. `Ctrl-C` to stop.

Pick a free port — `7685` (prod Domios) and `7686` (dev) are taken; `7779` / `7780` are good defaults.

## How to interpret a report

```
# Eval report — general_agent.md

| ID | Eval                              | A (HEAD~1) | B (HEAD)  | Δ  |
|----|-----------------------------------|------------|-----------|----|
|  1 | implicit-request-ask-not-act      | 3/3 ✓      | 3/3 ✓     |  0 |
|  2 | explicit-request-create-workspace | 3/3 ✓      | 2/3 ⚠     | -1 |
|  8 | isolation-notes-storage           | 3/3 ✓      | 0/3 ✗     | -3 |
```

Reading rules:

- **`Δ = 0`** — same pass rate. Prompt change is neutral for this eval.
- **`Δ > 0`** — prompt change *improved* this eval. Good.
- **`Δ < 0`** — prompt change *weakened* this eval. **Investigate before merging.**
- **`A = 3/3` and `B = 0/3`** with `Δ = -3` — definitely broken. The new prompt removed something this eval depends on.
- **`A = 3/3` and `B = 2/3`** with `Δ = -1` — likely flakiness from the change, worth one more 3-run pass before deciding.
- **`A = 2/3` and `B = 2/3`** with `Δ = 0` but both flaky — pre-existing flakiness, probably the eval is poorly worded; rewrite the eval, not the prompt.

For each `Δ < 0` row the runner prints a follow-up section showing:
- The expectations that newly failed
- A diff snippet showing what's missing in the agent's response (compared to passing runs in A)
- A guess at which prompt section was over-compressed / mis-edited

Use that to decide: `git revert <commit>` the prompt change, OR cherry-pick a single section back, OR rewrite the eval if it turns out the eval was demanding something the prompt should never have promised.

## How to add a new eval set

Eval sets live in `evals/<name>/evals.json`. The shape is:

```json
{
  "skill_name": "general-agent-prompt",
  "description": "What this set covers",
  "evals": [
    {
      "id": 1,
      "name": "short-kebab-case-name",
      "prompt": "User input the agent will receive (with prefixes like [Telegram: ID] if relevant)",
      "expected_output": "One-sentence summary of correct behavior — used in reports",
      "expectations": [
        "Uses send --tab general --mesh PEER",
        "Does NOT use workspace create",
        "Includes 'report back' phrase"
      ]
    }
  ]
}
```

Tips for writing good evals:

- Set `response_mode: "text"` when evaluating explained decisions; omit it for
  command lists. Both actor and judge receive that mode. Explicit command
  expectations still require the requested syntax in either mode.

- **One eval = one behavior.** Don't bundle "spawns the right role AND uses the right CLI flags AND replies via the right channel" into one eval — make three.
- **Expectations are independent assertions, not steps.** Each one is checked separately; an eval passes only if ALL expectations pass.
- **Use technical expectations whenever possible** — they're matched by regex without an LLM call, so they're free and deterministic. Reserve behavioral expectations (LLM-as-judge) for things you genuinely can't grep for.
- **Negative expectations matter.** "Does NOT use workspace create" is just as important as "Uses send". They prevent regressions in the *other* direction.
- **Test the eval first** by running it against the *unchanged* prompt and confirming it passes. If it fails on the unchanged prompt, the eval is wrong, not the prompt.
- **Eval prompts should be realistic** — use retained session excerpts found through `domios sessions search` or owned DEV logs, don't synthesize "test inputs".

## Existing eval sets

- `evals/cli-agent/` — real-daemon LLM benchmark: drives Claude/Codex/Opencode through every CLI command; model-judged (replaces old general-agent and mem-protocol evals).
- `evals/mem-recall/` — mem search engine quality (Recall@K / MRR / latency).
- `evals/dreaming/` — REM-phase prompt — Stage A.1 hub decomposition with RED ZONE rule + Stage A.2 island bridging.
- `evals/session-restore/` — kill+restart preserves workspace/tab/agent_type/titles.
- `evals/manager-bootstrap/` — single-turn team bootstrap reads host role context and does not invent work.
- `evals/orchestrator-control-loop/` — responsive long-operation ownership and proportional verification.
- `evals/blueprint-reuse/` — recipe-first authoring, built-in GitHub discovery, and custom-node fallback.
- `evals/spawned-agent-primer/` — shared capabilities, tab identity, and role rules for every spawned agent.
- `evals/plugin-recall/` — messaging plugin use and chat-first sign-in from per-turn memory hits and actionable refusals.
- `evals/worker-handoff/` — mandatory structured Worker handoff for partial, blocked, and review-ready turns.

Experimental/historical: `evals/dreamer-repair/`.

When you write a new eval set, drop a one-line entry in the live list above.

## Reading the sample count

`--runs N` takes N distinct samples. Cache entries are keyed per sample index,
so a repeat of the same command replays N previously-taken samples — it never
serves one sample N times.

Every report opens with a **Sampling:** line and carries a `Source` column per
eval (`live` / `cached` / `k/N cached`). Treat them as part of the numbers:

- `cached` means the verdicts were replayed from `~/.cache/codeterm-evals`, not
  taken fresh. Re-run with `--no-cache` before acting on a surprising result.
- Confidence intervals count **distinct samples**, never the requested `--runs`.
  If those differ, the report prints an `⚠ Undersampled` line — the interval is
  narrower evidence than the flag you typed suggests.

`--no-cache` skips the cache entirely; `--clear-cache` wipes it first.

## Limitations

1. **Sandbox mode means the agent can't actually call Domios.** It describes what it would do in plain text; the judge reads that description. If a prompt's behavior depends on the agent reading actual files or tab state, this harness can't test it. For those cases, write an integration test in `tests/e2e/` instead.
2. **LLM-as-judge is not perfectly deterministic.** Even the same expectation+response pair can flip verdicts run-to-run (~5% based on Anthropic eval research). Use `--thorough` (3 runs) when you need higher confidence. The default 1 run is fast for routine "did I just break something" checks where one verdict is enough.
2b. **Some failures are harness, not behavior.** The judge auto-FAILs a response that emits `# NO_COMMAND: ...` when the expectation names a specific command, and a judge timeout is scored as a plain failure. Both look identical to a real behavioral miss in the report. Before reverting a prompt on a failure, read the sample response and check which one you are looking at.
3. **Uses your Claude Code auth.** Runs through whatever `claude login` is currently active — OAuth subscription or API key, whichever you have. Use `--dry-run` first to see the call count if you want to budget against subscription quota. Typical default `A/B quick` run is ~100 calls (Haiku-mostly), `--thorough` triples it.
4. **The prompt under test is *appended* to Claude Code's default system prompt, not replacing it.** This matches real usage (Domios prompts always run on top of Claude's base behavior), but it means you can't test prompts that contradict Claude defaults. If you need a clean slate, hack `runner.py` to use `--system-prompt` instead of `--append-system-prompt`.
5. **Git-revision references require a clean working tree** for the file under test. If you have uncommitted changes to `general_agent.md` and ask for `HEAD~1:general_agent.md`, you get the committed version, not your working copy — which is what you want for A/B but might confuse if you forgot.
6. **`--runs` defaults to 1.** That's a deliberate trade-off vs skill-creator's 3. With the sandboxed agent and a strict judge prompt, single runs are stable enough for most "did I break it" checks. Use `--thorough` (which sets runs=3) for the rare cases where the eval seems flaky or you need pre-merge confidence.

## Implementation files

- `runner.py` — orchestration, CLI argument parsing, A/B aggregation, report rendering
- `matcher.py` — hybrid expectation matcher (regex + LLM-as-judge)
- `dashboard.py` + `dashboard.html` — optional in-process HTTP server for `--http-port`
- `reports/` — gitignored output directory

To debug a single eval without rerunning the whole set: `python runner.py --prompt-file ... --eval-set ... --only-id 8 --runs 1 --verbose`. The runner will print the full agent response and matcher decisions for that one eval.

<!-- revision: 8 -->

Files in this skill

  • .gitignore19 B
  • README.md2.2 KB
  • SKILL.md14.2 KB
  • cache.py3.7 KB
  • calibrate.py7.1 KB
  • dashboard.html32.1 KB
  • dashboard.py6.6 KB
  • matcher.py8.9 KB
  • reports/.gitignore14 B
  • runner.py39.8 KB
  • tests/test_runner_response_mode.py5.7 KB
  • tests/test_runner_trusted_framing.py8.9 KB
  • tests/test_sample_integrity.py11.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.