Smart Patch (Binary Ninja)

Smart Patch (Binary Ninja) is a skill for Claude Code from buzzer-re/Rikugan. It costs 23 tokens per session (1,040 once invoked), scanned A, original, MIT.

A Binary Ninja procedure for changing compiled machine code from a natural-language request. Binary Ninja is a program for examining and modifying compiled binaries, and this procedure reads, assembles, writes, and checks targeted instruction changes.

In plain words
What is it for?
Use it to patch a specific function or instruction sequence in Binary Ninja when you know what behavior should change.
Why use it?
It helps make a small, deliberate binary change while preserving the original bytes for reference. It also checks instruction sizes, branch targets, and the resulting patch before finishing.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to patch a specific function or instruction sequence in Binary Ninja when you know what behavior should change.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/buzzer-re/rikugan/smart-patch-binja
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.

Any agent
npx skills add buzzer-re/Rikugan --skill smart-patch-binja
Clone the repo
git clone --depth 1 https://github.com/buzzer-re/Rikugan

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 Smart Patch (Binary Ninja)

README.md
[![agentmods](https://agentmods.dev/badge/skills/buzzer-re/rikugan/smart-patch-binja/github.svg)](https://agentmods.dev/skills/buzzer-re/rikugan/smart-patch-binja)
Your own site
<a href="https://agentmods.dev/skills/buzzer-re/rikugan/smart-patch-binja"><img src="https://agentmods.dev/badge/skills/buzzer-re/rikugan/smart-patch-binja/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.

agentmods 80×15 button for Smart Patch (Binary Ninja)

Your own site · 80×15
<a href="https://agentmods.dev/skills/buzzer-re/rikugan/smart-patch-binja"><img src="https://agentmods.dev/badge/skills/buzzer-re/rikugan/smart-patch-binja.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,040 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00023 $0.01040
Opus 5.5 $0.00009 $0.00416
Sonnet 5.5 $0.00005 $0.00208
Haiku 4.5 $0.00002 $0.00104

Measured 1mo ago against content hash fd2ce12a0b2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Smart Patch (Binary Ninja) 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.

rikugan/skills/builtins/smart-patch-binja/SKILL.md · 95 lines

How it starts

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

Task: Apply targeted binary patches in Binary Ninja based on the user's natural language description. Analyze the function, identify the minimal set of instructions to change, assemble new instructions, write them, and verify the result.

Workflow

  1. Read the target function's disassembly (read_function_disassembly) and decompiled pseudocode / get_il at HLIL level to understand its current behavior.

  2. Identify which specific instructions implement the behavior the user wants to change. Use get_instruction_info to get exact byte sizes and encodings for the target instructions.

  3. Back up the original bytes before patching. Use read_bytes at the target address for the instruction length, and print them so the user has a record:

    Original bytes at 0x{addr:x}: {hex_bytes}
    
  4. Plan the minimal patch:

    • Determine what new instruction(s) achieve the desired behavior.
    • Ensure the new instructions fit within the original byte boundaries.
    • If new instructions are shorter, the remaining bytes MUST be filled with NOPs.
    • Verify branch targets and relative offsets are correct for the patch address.
  5. Patch using execute_python with Binary Ninja's assembler and writer:

    # Assemble new instruction at the correct address
    new_bytes = bv.arch.assemble("jg 0x401300", 0x401248)
    original_size = 6  # from get_instruction_info
    
    # NOP padding if shorter
    if len(new_bytes) < original_size:
        nop = bv.arch.assemble("nop", 0)
        new_bytes += nop * (original_size - len(new_bytes))
    
    bv.write(0x401248, new_bytes)
    bv.update_analysis_and_wait()
    print(f"Patched {len(new_bytes)} bytes at 0x401248")
    
  6. Verify with redecompile_function — confirm the HLIL output reflects the desired behavior change. If it doesn't match, revert by writing back the original bytes and try a different approach.

  7. Report — If called from /modify, you MUST call:

    exploration_report(category="patch_result", address=..., summary="Patched X: old → new", original_hex="...", new_hex="...", evidence="redecompile confirms...")
    
  8. Annotate each patched address with set_comment explaining what was changed and why.

Read the full file on GitHub · 95 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. 1mo ago First seen · 95 lines · 23 tokens per session scan A fd2ce12a0b2a

Subscribe to this mod's changes

Smart Patch (Binary Ninja) is a skill published in the GitHub repository buzzer-re/Rikugan (690 stars, last pushed 8d ago), licensed MIT. It adds 23 tokens to every session and 1,040 once invoked, about $0.0001 per session on Opus 5.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.

Related

Other skills, from other repositories

create-patch

Create or continue an authorized Morphe Android patch from an APK and requested change. Use when the user wants the complete workflow: APK reconnaissance, decompilation, target discovery, smali verification, patch implementation, and local validation.

Paresh-Maheshwari/morphe-ai · 0 tokens

validate-patch

Build, list, and locally apply Morphe patches to verify registration and fingerprint matching. Use after patch source exists or when diagnosing build and match failures.

Paresh-Maheshwari/morphe-ai · 34 tokens

find-patch-targets

Find Morphe patch targets in decompiled Android source and verify each target against exact smali bytecode. Use after decompiled source and smali exist.

Paresh-Maheshwari/morphe-ai · 0 tokens

write-patch

Implement an approved Morphe patch design from smali-verified findings. Use only after target evidence exists and the user has approved the proposed source changes.

Paresh-Maheshwari/morphe-ai · 34 tokens

python-large-file-patch-{{AGENT_NAME_LOWER}}

How to patch large Python files in the {{AGENTNAME}} codebase. Covers the dual-file layout (runtime /.{{AGENTNAMELOWER}}/agent/ vs source /.{{AGENTNAMELOWER}}/source/{{AGENTNAMELOWER}}-agent/), diagnose-fallback when direct patch fails, and the copy-sync protocol to keep both copies aligned.

humanerd-drew/opencode-drewgent · 89 tokens

patch-diff-analyzer

Specialized in reverse-engineering compiled binaries (JARs, DLLs). Use this when the user asks to compare versions, find security fixes, or analyze binary patches.

zebbern/termstack · 41 tokens