mutate

A command that runs mutation testing on selected Python files. Mutation testing makes small changes to code and checks whether the test suite detects them.

In plain words
What is it for?
Use it on specified Python source files or files changed in the latest commit. It reports the mutation score, surviving changes, and suggested tests to catch them.
Why use it?
A passing test suite may still miss important bugs. Surviving mutations show where tests are too weak and which assertions could improve them.

Command

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 commands/tk-logl/sentinel/mutate
Clone the repo
git clone --depth 1 https://github.com/tk-logl/sentinel
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 622 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.00622
Opus 5 $0.00007 $0.00311
Sonnet 5 $0.00003 $0.00124
Haiku 4.5 $0.00001 $0.00062

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

Security

Grade A, and why

mutate 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 2d 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.

commands/mutate.md · 78 lines

How it starts

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

/sentinel:mutate

Run mutation testing on specified source files to verify that tests actually catch bugs.

What to Do

  1. Check if mutmut is installed:

    python3 -m mutmut --version 2>/dev/null || pip install mutmut
    
  2. Determine target files:

    • If the user specified files: use those
    • If not: find files changed since last commit:
      git diff --name-only HEAD~1 | grep '\.py$' | grep -v test_ | grep -v __pycache__
      
  3. Find corresponding test files for each target:

    • apps/{service}/module.pyapps/{service}/tests/test_module.py
    • voice/backend/module.pyvoice/backend/tests/test_module.py
  4. Run mutmut on each target file:

    python3 -m mutmut run --paths-to-mutate=<target_file> --tests-dir=<test_dir>
    
  5. Report results:

    • Show mutation score (killed / total)
    • List surviving mutants (these indicate weak tests)
    • For each survivor, show the mutation and which test should catch it
  6. Provide actionable guidance:

    • For each surviving mutant, suggest a specific test assertion that would kill it
    • Example: "Mutant changed > to >= in line 42 — add a boundary test: assert func(0) == expected"

Example Output

=== Mutation Testing Report ===
Target: apps/brain/services.py
Tests:  apps/brain/tests/test_services.py

Score: 47/50 killed (94%)

Surviving mutants:
  Line 42: changed > to >= in hybrid_search()
    → Add test: assert hybrid_search(query="x", top_k=0) raises ValueError
  
  Line 78: removed return statement in _normalize_score()
    → Add test: assert _normalize_score(0.5) == 0.5
  
  Line 95: changed True to False in is_valid_query()
    → Add test: assert is_valid_query("valid") == True

Configuration

In pyproject.toml:

[tool.mutmut]
paths_to_mutate = "apps/"
backup = false
runner = "python -m pytest --tb=no -q"
mutate_only_covered_lines = true

Notes

  • Mutation testing is SLOW (minutes, not seconds) — this is a command, not a hook
  • Only mutate changed files to keep run time practical (2-5 minutes)
  • A mutation score below 70% means tests are not constraining behavior
  • Target: 80%+ for core logic modules

Read the full file on GitHub · 78 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. 2d ago First seen · 78 lines · 14 tokens per session scan A d72ae0828608

Subscribe to this mod's changes

mutate is a command published in the GitHub repository tk-logl/sentinel (4 stars, last pushed 5mo ago), licensed MIT. It adds 14 tokens to every session and 622 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-31.