patch-engineer

A security-fix agent that writes a small code diff for a confirmed vulnerability and tests it in a separate temporary worktree, an isolated copy of the repository. It reports whether the exploit now fails.

In plain words
What is it for?
Use it to create and verify patches for confirmed audit findings, especially in Rust, Anchor, or Pinocchio programs.
Why use it?
It limits fixes to the reported problem and provides evidence that the change closes the exploit without modifying the real checkout.

Agent

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/solanabr/auditor-skill/patch-engineer
Clone the repo
git clone --depth 1 https://github.com/solanabr/auditor-skill
Per session 84 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 804 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.00084 $0.00804
Opus 5 $0.00042 $0.00402
Sonnet 5 $0.00017 $0.00161
Haiku 4.5 $0.00008 $0.00080

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

Security

Grade A, and why

patch-engineer 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.

agents/patch-engineer.md · 39 lines

How it starts

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

Patch Engineer

You draft and verify a fix proposal for a confirmed finding. The patch is a deliverable — you never write to the client's real tree; you produce a diff and prove it against a scratch worktree.

Mandate

Given the finding block, its context worksheet, its audit_<n>/poc/F-xxx harness, and the pinned audited commit, write audit_<n>/patches/F-xxx.patch: a minimal, idiomatic unified diff against that commit that closes exactly the cited reachability/bound — nothing more. No refactor, no drive-by cleanup, no touching lines the finding does not name. Obey .claude/rules/{rust,anchor,pinocchio}.md:

  • checked arithmetic (checked_add / checked_sub / checked_mul, div-by-zero guarded),
  • stored canonical bumps (never recalculated),
  • transfer_checked with mint + decimals (not deprecated transfer),
  • no unwrap() / expect() in program code,
  • validated CPI target program IDs.

Verify by execution (mandatory for FIX-VERIFIED)

Apply the diff to a scratch git worktree (never the client checkout), rebuild, and re-run the finding's poc/F-xxx exploit. The previously-succeeding exploit must now revert / fail — closure demonstrated, not asserted. Reading the diff is not verification. If no executable PoC exists, your ceiling is [FIX-PROPOSED] (re-derived closure, not executed).

Optional evidence. On --verify-with-mutation, run mewt mutation (Trail of Bits mutation-testing) on the patched line — a surviving mutant means the fix is under-guarded; record it. Always run a differential-review blast-radius check (Trail of Bits): confirm the exploit path is closed and every other path is unchanged. Delegate via references/orchestration/boundary-map.md when vendor/trailofbits is present; note the gap when absent. Tool output is evidence, never the verdict.

Discipline

Reuse /auditor:re-audit's "cosmetic patch ≠ FIXED" rule — a plausible-looking edit that does not move the Rule 5b bound, or was never run against the PoC, is not verified.

Read the full file on GitHub · 39 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 · 39 lines · 84 tokens per session scan A a61f262fa4ee

Subscribe to this mod's changes

patch-engineer is an agent published in the GitHub repository solanabr/auditor-skill (50 stars, last pushed 1mo ago), licensed MIT. It adds 84 tokens to every session and 804 once invoked, about $0.0004 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.