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.

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 skills/buzzer-re/rikugan/smart-patch-binja
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.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.svg" alt="Measured on agentmods" 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. 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.1 $0.00023 $0.01040
Opus 5 $0.00012 $0.00520
Sonnet 5 $0.00005 $0.00208
Haiku 4.5 $0.00002 $0.00104

Measured 6d ago against content hash fd2ce12a0b2a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, 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 6d 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. 6d 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 (672 stars, last pushed 2mo ago), licensed MIT. It adds 23 tokens to every session and 1,040 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.

Related

Other skills, from other repositories

Reverse Engineering & Binary Analysis

Binary analysis, assembly interpretation, disassembly, decompilation, firmware RE, and protocol reverse engineering.

Masriyan/Claude-Code-CyberSecurity-Skill · 26 tokens

forgetful-files

File binary content into the knowledge base — screenshots, PDFs, diagrams, fonts, assets. Use when a binary artifact is worth keeping alongside knowledge, or when a stored procedure needs a bundled asset. The description is the entire search surface: say what the file shows and when to reach for it.

ScottRBK/forgetful · 63 tokens

arkana-analyze

Binary analysis skill for Arkana. Handles malware triage, reverse engineering, PE/ELF/Mach-O analysis, shellcode emulation, firmware inspection, vulnerability auditing, C2 config extraction, unpacking, deobfuscation, and threat intelligence. Triggers on: binary, malware, PE, ELF, Mach-O, shellcode, firmware, analyze…

JameZUK/Arkana · 158 tokens

arkana-learn

Interactive reverse engineering tutor using Arkana. Teaches binary analysis concepts from beginner to expert, adapting to the learner's level. Guides users through hands-on analysis or structured lessons using Arkana's 308 tools as the teaching platform. Triggers on: teach, learn, tutorial, lesson, explain, guide, how…

JameZUK/Arkana · 118 tokens

codex

Run the Codex CLI as an independent, read-only reviewer for kbupdate commits, staged changes, uncommitted changes, or selected files. Use when the user asks for a Codex review, an external second opinion, review iteration, or a final code-quality verdict.

potatoqualitee/kbupdate · 58 tokens

cis-aws-foundations-3.2.2

Ensure the Auto Minor Version Upgrade feature is enabled for RDS instances.

CyberStrikeus/CyberStrike · 25 tokens