Ailogic

From radareorg/radare2-skills · View interactive version

Ailogic is an AI agent skill from the GitHub repository radareorg/radare2-skills. Find logic bugs in C code for radare2 by analyzing control flow, state transitions, and silent assumptions.

How to use this skill

Skill file

Introduction

Logic bugs are not syntax errors and the compiler will not catch them. They live in branches that look reasonable, in loops that almost terminate, and in assumptions that are never written down. This skill focuses on radare2's C codebase, where most logic bugs come from misuse of libr APIs, unchecked return values, and state that leaks across calls.

When this skill is used: read AGENTS.md first and follow the project rules. Patches must be surgical, behavior-preserving, and small.

Steps

  1. Understand the function contract before reading the body
  1. Identify inputs and boundaries
  1. Trace control flow with radare2

```

aaa

pdf @ sym.function_name

VV @ sym.function_name

```

  1. Track variable state
  1. Analyze loops
  1. Verify return values and error paths
  1. Hunt silent assumptions
  1. Confirm dynamically when possible

```

ood

db sym.function_name

dc

dr; px

```

Drive the suspect path with a real input and observe the state. A reproducer beats any amount of static reasoning.

  1. Reduce to a minimal case

Common logic bug patterns in radare2

radare2 quick commands

aaa            # analyze all
pdf            # disassemble function
afvd           # show variables and arguments
VV             # visual graph
axt            # find xrefs to symbol
db / dc        # breakpoint / continue
dr / px        # registers / memory

Output

Write findings to a report file (default: ailogic-report.md) so the user can iterate on it while fixing. If the file exists, append new findings under a fresh dated section instead of overwriting; mark resolved entries with ✅ rather than deleting them, so progress is visible across runs.

Report structure

# ailogic report — YYYY-MM-DD

## Summary
1-2 sentences on what was audited (branch, files, functions) and the verdict:
✅ Clean / ⚠️ Issues found / ❌ Critical issues found

## Findings
<one @@@task block per finding, ordered by severity>

Task note format

Each finding is a @@@task block, mirroring aireview so the same tooling can consume both:

@@@task
# 🔴 Short title of the bug

The invariant or assumption that is violated, in at most 2 sentences.

## Trigger
The input, call sequence, or state that exercises the bug. Include an r2
oneliner reproducer when feasible.

## Suggested Commit Message
Short, capitalized, imperative. One line.

## Suggested Fix
What should change, surgically. Reference helpers to use (`r_list_delete_iter`,
`call_at`, `R_RETURN_*`, etc.) instead of describing rewrites.

filePath: libr/core/foo.c

lineRange: 120...138

context: function_name

@@@

Severity: 🔴 high | 🟠 medium | 🟡 low

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.