/r2sql:annotationsfrom r2sql
Edit radare2 annotations — comments, flag/function names, local variables, bookmarks — via r2sql. Use when asked to add comments, rename functions/flags, rename or retype locals, or persist analysis state.
Ships in r2sql. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Pick this skill any time the task is a mutation: adding/editing/
removing a comment, renaming a function, deleting a flag, persisting
session state. For read-only annotation lookups, use data or
disassembly.
Mutations only land in r2's session memory. To persist them across reopens you need both:
-w (or --write) when opening the session.--project NAME so r2sql can call Ps NAME on shutdown.r2sql -w --project demo -s ./malware.exe -q "
UPDATE comments SET text = 'crypto init' WHERE addr = 0x401000;
UPDATE flags SET name = 'aes_init' WHERE addr = 0x401000;
"
# reopen — the comment + rename are still there
r2sql --project demo -s ./malware.exe -q "
SELECT text FROM comments WHERE addr = 0x401000;
"
Without --project, mutations are still visible in the current
session but vanish on exit.
| table | INSERT → r2 cmd | UPDATE → r2 cmd | DELETE → r2 cmd |
|---|---|---|---|
funcs | af @ <addr> (+afn) | afn <name> @ <addr> (rename) / afs <sig> @ <addr> (set prototype) | af- <addr> |
locals | — | afvn <new> <old> @ <fn> (rename) / afvt <name> <type> @ <fn> (retype) | — |
comments | CCu base64:<b64> @ <addr> | CCu base64:<b64> @ <addr> | CC- @ <addr> |
flags | f <name> @ <addr> | afn (if function) or fr <old> <new> | f- @ <addr> |
bookmarks | f <name> @ <addr> | fr <old> <new> | f- @ <addr> |
io_maps | om $d <vaddr> <size> <paddr> <perm> [name] | — | om-<map_id> |
types | — (use r2sql_type_define) | — | t- <name> |
projects | — (use r2sql_project_save) | — | P- <name> |
UPDATE funcs SET name='…' WHERE addr=… (issues afn).
flags also renames (it carries r2's symbol names: afn when a function lives
there, else fr).UPDATE funcs SET prototype='int parse(hdr_t *h, int len)' WHERE addr=… applies a C signature via afs (set-signature). A trailing ; is
stripped (r2's command separator); an empty/NULL prototype is rejected (r2 has no
clear-signature primitive). The read comes from aflj's signature field.UPDATE locals SET name='…' (→ afvn) or
SET type='…' (→ afvt), keyed on func_addr + the current name. Locals
are analysis-derived — no INSERT/DELETE. The type is passed verbatim (r2 takes
a bare int / char *; do NOT quote it), validated to [A-Za-z0-9_.* []].base64: so spaces, quotes, and @ are stored
verbatim and can't inject extra r2 commands.[A-Za-z0-9._$] (no spaces / r2 metacharacters) — enforced.bookmarks writes are scoped to the bookmarks flagspace (saved/selected/
restored around each write); id is synthetic and ignored.SELECT r2sql_project_save('triage1'); -- Ps: save the session as a project
SELECT name FROM projects; -- Plj: list saved projects
SELECT r2sql_project_open('triage1'); -- P: load a project mid-session
SELECT r2sql_type_define('struct hdr { int magic; int size; }'); -- td
-- rename a function (the dummy fcn.<addr> names)
UPDATE funcs SET name = 'aes_decrypt' WHERE addr = 0x401000;
-- rename / retype a local variable or argument (keyed on func_addr + name)
UPDATE locals SET name = 'key_len' WHERE func_addr = 0x401000 AND name = 'var_20h';
UPDATE locals SET type = 'int' WHERE func_addr = 0x401000 AND name = 'key_len';
-- add / edit / remove a comment
INSERT INTO comments(addr, text) VALUES (0x401000, 'crypto init');
UPDATE comments SET text = 'crypto init v2' WHERE addr = 0x401000;
DELETE FROM comments WHERE addr = 0x401000;
-- add a flag / remove one
INSERT INTO flags(addr, name) VALUES (0x401000, 'aes_sbox');
DELETE FROM flags WHERE addr = 0x401000;
-- bookmarks (bookmarks flagspace)
INSERT INTO bookmarks (addr, name) VALUES (0x401000, 'loop_start');
UPDATE bookmarks SET name = 'loop_head' WHERE addr = 0x401000;
DELETE FROM bookmarks WHERE addr = 0x401000;
UPDATE / DELETE happily take any SQL predicate, so bulk operations
just work:
-- mark every function whose name contains 'init' as analyzed
UPDATE comments SET text = 'TODO: review init logic'
WHERE addr IN (SELECT addr FROM funcs WHERE name LIKE '%init%');
-- delete every comment in a specific code section
DELETE FROM comments
WHERE addr IN (
SELECT addr FROM funcs
WHERE addr BETWEEN 0x401000 AND 0x402000
);
comments, flags, and bookmarks support INSERT. Use INSERT
when adding a new address/name pair; UPDATE only affects rows that
already match the predicate.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub 0xeb/r2sql-skills --plugin r2sql11 skills in this plugin
/analysisTriage and audit radare2 binaries via r2sql — find suspicious behavior, surface crypto/network/persistence APIs, hunt high-complexity functions, and run multi-table queries that combine code, data, and xrefs./connectConnect to radare2 sessions via r2sql and bootstrap analysis. Use when starting a new SQL session, routing to other skills, or setting up CLI/HTTP/MCP connections./dataQuery radare2 data and memory — bytes, defined data, byte patterns, strings, imports, entry points, and binary metadata — via r2sql.Other plugins' skills for the same job