rr-debug-logic

rr-debug-logic is a skill for Claude Code from karellen/karellen-rr-mcp. It costs 42 tokens per session (931 once invoked), scanned A, original, Apache-2.0.

A method for finding the cause of a program's wrong result by recording its execution and replaying it backward. rr is a debugging tool for replaying a recorded program run.

In plain words
What is it for?
Use it when output, values, or behavior are wrong without a crash, especially in programs where you need to set breakpoints and inspect earlier execution.
Why use it?
Logic bugs often do not crash the program, so the failure point is unclear. Reverse replay helps trace a wrong value from where it appears back to where it was calculated incorrectly.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the karellen-rr-mcp plugin — 4 skills, 1 agent, 3 hooks, 1 MCP server shipped together

Good fit Use it when output, values, or behavior are wrong without a crash, especially in programs where you need to set breakpoints and inspect earlier execution.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/karellen/karellen-rr-mcp/rr-debug-logic
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 karellen/karellen-rr-mcp --skill rr-debug-logic
Clone the repo
git clone --depth 1 https://github.com/karellen/karellen-rr-mcp

Made for: Claude Code.

Or install karellen-rr-mcp, the plugin that ships this one along with the rest of its 4 skills, 1 agent, 3 hooks, 1 MCP server.

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 rr-debug-logic

README.md
[![agentmods](https://agentmods.dev/badge/skills/karellen/karellen-rr-mcp/rr-debug-logic/github.svg)](https://agentmods.dev/skills/karellen/karellen-rr-mcp/rr-debug-logic)
Your own site
<a href="https://agentmods.dev/skills/karellen/karellen-rr-mcp/rr-debug-logic"><img src="https://agentmods.dev/badge/skills/karellen/karellen-rr-mcp/rr-debug-logic/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 rr-debug-logic

Your own site · 80×15
<a href="https://agentmods.dev/skills/karellen/karellen-rr-mcp/rr-debug-logic"><img src="https://agentmods.dev/badge/skills/karellen/karellen-rr-mcp/rr-debug-logic.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 931 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.
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.00042 $0.00931
Opus 5 $0.00021 $0.00465
Sonnet 5 $0.00008 $0.00186
Haiku 4.5 $0.00004 $0.00093

Measured 11d ago against content hash a1908567640e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

rr-debug-logic 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 11d 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/rr-debug-logic/SKILL.md · 149 lines

How it starts

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

Debug Logic Bug with rr

Use this skill when a program produces wrong output, returns an incorrect value, or behaves incorrectly without crashing. Unlike crashes (which have a clear failure point), logic bugs require you to first identify WHERE the wrong value becomes observable, then work backwards to find WHERE the computation went wrong.

Workflow

1. Record the Program

rr_record(command=$ARGUMENTS, trace_dir="<project>/rr-trace-<random>")

The program will run to completion (it doesn't crash). rr captures everything.

2. Start Replay

rr_ps(trace_dir="<trace>")
rr_replay_start(trace_dir="<trace>", pid=<pid>)

3. Set Breakpoints at the Observable Bug

You need to stop execution at the point where the wrong behavior is visible. Strategies:

If you know the function that returns the wrong value:

rr_breakpoint_set("compute_result")
rr_continue()

Step through and find where the return value is wrong.

If you know the line that produces wrong output:

rr_breakpoint_set("output.cpp:42")
rr_continue()

If you know the condition that should hold but doesn't:

rr_breakpoint_set("process_data", condition="result < 0")
rr_continue()

If the bug is in iteration N of a loop:

rr_breakpoint_set("loop_body.cpp:100", condition="i == 42")
rr_continue()

4. Confirm the Wrong Value

At the breakpoint, examine the state:

rr_locals()
rr_evaluate("result")
rr_evaluate("expected_value")

Verify that the value is indeed wrong at this point. Save a checkpoint:

rr_checkpoint_save()

5. Trace the Value Backwards

Now work backwards to find where the wrong value originated.

For a simple variable:

rr_watchpoint_set("result")
rr_continue(reverse=True)

This stops at the exact write that set result to its current (wrong) value.

For a computed value (e.g., a + b is wrong): Check which input is wrong:

rr_evaluate("a")
rr_evaluate("b")

Then watchpoint the wrong input:

rr_watchpoint_set("a")
rr_continue(reverse=True)

Read the full file on GitHub · 149 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. 11d ago First seen · 149 lines · 42 tokens per session scan A a1908567640e

Subscribe to this mod's changes

rr-debug-logic is a skill published in the GitHub repository karellen/karellen-rr-mcp (3 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 42 tokens to every session and 931 once invoked, about $0.0002 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.

Related

Other skills, from other repositories

x64dbg-mcp-server

You are controlling x64dbg through MCP tools.

duty1g/x64dbg-mcp-server · 0 tokens

agentsight-bugfix

A five-stage workflow for fixing bugs in AgentSight: understand the report, reproduce the problem, find its cause, make a small code change, and verify the result. AgentSight is a system that observes and analyses agent activity.

alibaba/anolisa · 67 tokens

debug-live

Guides root-cause investigations with debugging capabilities by setting breakpoints, starting a debug session, stepping through execution, inspecting variables, and tracing symptoms back to their origin. Prefer it for runtime bugs, failing tests, exceptions, crashes, hangs, wrong/null values, and unexpected output…

microsoft/DebugMCP · 84 tokens

gearsystem-debugging

Debug and trace Sega Master System, Game Gear, and SG-1000 games using the Gearsystem emulator MCP server. Provides workflows for Z80 CPU debugging, breakpoint management, VDP/PSG/YM2413 hardware inspection, disassembly analysis, execution tracing, and rewind/time-travel debugging. Use when the user wants to debug an…

drhelius/Gearsystem · 178 tokens

art-of-debugging

Systematic methodology and concrete tool recipes for debugging Unix, Python, and PyTorch programs - crashes, hangs, segfaults, wrong output, CUDA OOM, NaN/Inf, slowness, and multi-node/multi-GPU issues. Use when a program crashes, hangs, deadlocks, segfaults, runs out of memory (OOM), produces NaN/Inf or wrong…

stas00/the-art-of-debugging · 193 tokens

self-healing

Detect service failures and system anomalies. Diagnose root causes. Auto-remediate using NixOS rollback, service restart, or config repair. Every action logged to the hash-chained audit ledger.

bolivian-peru/os-moda · 43 tokens