patch-code

patch-code is a command for coding agents from SetsunaYukiOvO/x64dbg-mcp. It costs 9 tokens per session (642 once invoked), scanned A, original, MIT.

A guided tool for changing machine code inside Windows executable files through x64dbg or x32dbg, with backups and checks.

In plain words
What is it for?
Use it to bypass conditions, disable calls, or force a function to return true or false. It can assemble instructions into machine code and write them to the target program.
Why use it?
It helps avoid guessing raw bytes and reduces the risk of making an executable unusable. It first examines the surrounding code and its connections before applying a patch.

Command

Part of the skills plugin — 1 skill, 11 commands shipped together

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/setsunayukiovo/x64dbg-mcp/patch-code
Clone the repo
git clone --depth 1 https://github.com/SetsunaYukiOvO/x64dbg-mcp

Or install skills, the plugin that ships this one along with the rest of its 1 skill, 11 commands.

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 patch-code

README.md
[![agentmods](https://agentmods.dev/badge/commands/setsunayukiovo/x64dbg-mcp/patch-code.svg)](https://agentmods.dev/commands/setsunayukiovo/x64dbg-mcp/patch-code)
Your own site
<a href="https://agentmods.dev/commands/setsunayukiovo/x64dbg-mcp/patch-code"><img src="https://agentmods.dev/badge/commands/setsunayukiovo/x64dbg-mcp/patch-code.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 642 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.00009 $0.00642
Opus 5 $0.00005 $0.00321
Sonnet 5 $0.00002 $0.00128
Haiku 4.5 $0.00001 $0.00064

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

Security

Grade A, and why

patch-code 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 4d 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.

skills/commands/patch-code.md · 69 lines

How it starts

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

You are a binary patching specialist connected to x64dbg/x32dbg via MCP. Modify executable code based on: $1

If "$1" is empty, ask the user to describe the patching goal and target address.

Phase 1: Understand the Target

  1. Parse "$1" for an address and goal description.
  2. Call disassembly_at at the target address with count: 30 for surrounding context.
  3. Call symbol_from_address to identify the function and module.
  4. Call function_get at the address to see function boundaries.
  5. Call disassembly_function for the complete containing function.
  6. Call xref_get at the target to understand who calls this code.

Phase 2: Design the Patch

Use assembler_assemble to convert your patch instructions to machine code. This avoids manual byte calculation.

Common patterns — use assembler_assemble for each:

  • Bypass conditional: assembler_assemble with "jmp <target>" at the JZ address
  • NOP a call: assembler_assemble with "nop" (repeat for 5 bytes, or use write_to_memory: true)
  • Force return true: assembler_assemble with "mov eax, 1" then "ret"
  • Force return false: assembler_assemble with "xor eax, eax" then "ret"
  1. For each patch instruction, call assembler_assemble with address set to the target and write_to_memory: false to preview the bytes.
  2. Show before/after comparison:
Before:
  0x...: [original disassembly]

After (assembled):
  0x...: [instruction] -> [hex bytes] ([size] bytes)

Phase 3: Apply (with user confirmation)

  1. Call memory_read at target to backup original bytes.
  2. Confirm with the user before proceeding.
  3. Call assembler_assemble with write_to_memory: true to apply the patch, OR call memory_write with the assembled bytes.
  4. Call disassembly_at to verify the patch.

Phase 4: Verify & Track

  1. Confirm: disassembly correct, instruction alignment preserved, no side effects.
  2. Call patch_list to see the patch recorded by the active debugger.
  3. Call bookmark_set at the patch address for reference.
  4. Suggest testing: set breakpoint before patch, run, step through.

Read the full file on GitHub · 69 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. 4d ago First seen · 69 lines · 9 tokens per session scan A 3254e465d133

Subscribe to this mod's changes

patch-code is a command published in the GitHub repository SetsunaYukiOvO/x64dbg-mcp (446 stars, last pushed 13d ago), licensed MIT. It adds 9 tokens to every session and 642 once invoked, about $0.0000 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.