شعار Annotations

Annotations

مؤسسة
allthingsida
annotations

Edit IDA databases. Use when asked to add comments, rename symbols, apply types, create bookmarks, write the database notepad, clean up decompiled code for review, or take undo checkpoints and roll edits back.

نظرة عامة

الناشرallthingsida
المستودعidasql-skills
اسم المهارةannotations
النجوم
50
التفريعات
10
الملفات المرفقة
4
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 4

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها allthingsida على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Annotations في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى الإضافات → المهارات.
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/allthingsida/idasql-skills/tree/main/plugins/idasql/skills/annotations
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات → المهارات → إضافة مهارة → من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/allthingsida/idasql-skills.git /tmp/idasql-skills
mkdir -p .claude/skills
cp -r /tmp/idasql-skills/plugins/idasql/skills/annotations .claude/skills/annotations
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Annotations في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج Annotations تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Annotations بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تترتب أي تكلفة على المهارة غير المستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

This skill is your guide for editing IDA databases through idasql. Use it whenever you need to annotate, rename, retype, comment, or otherwise modify decompiled output, disassembly, or type information.


Trigger Intents

Use this skill when user asks to:

  • add/edit comments (pseudocode, disassembly, function summaries)
  • rename symbols or local variables
  • apply types/enums/struct representations
  • create/update bookmarks for investigation workflow
  • read or write the database notepad (session notes that travel with the IDB)
  • checkpoint before a batch of edits, undo an agent turn, or roll back / redo edits
  • make pseudocode read more like source
  • prepare decompiled code for side-by-side review against source
  • annotate a function end-to-end, not just add one comment

Route to:

  • decompiler for analysis before editing
  • types when declarations or struct models need construction
  • re-source for recursive narrative/source recovery passes

Do This First (Warm-Start Sequence)

sql
-- 1) Confirm target row/function before editing
SELECT * FROM funcs WHERE addr = 0x401000;

-- 2) Inspect current comment state
SELECT addr, line, comment
FROM pseudocode
WHERE func_addr = 0x401000
LIMIT 30;

-- 3) Inspect existing disassembly comments
SELECT * FROM comments WHERE addr BETWEEN 0x401000 AND 0x401100;

Interpretation guidance:

  • Never edit blind: validate exact row identity before mutation.
  • Prefer deterministic keys (func_addr + addr, idx, slot) over fuzzy name matches.

Failure and Recovery

  • Update appeared to "do nothing":
    • Re-read target row, refresh decompile view, verify placement fields.
  • Wrong target mutated:
    • Tighten predicate and re-run read-first step before retry.
  • Enum/struct rendering did not change:
    • Confirm type/numform/union-selection support and target context.

Handoff Patterns

  1. annotations -> decompiler when semantic meaning is unclear.
  2. annotations -> types when edits imply missing declarations.
  3. annotations -> re-source when function-level notes must become recursive campaign notes.

Annotate a Function Contract

Treat annotate this function as a full-function workflow, not a single comment operation.

Default behavior:

  • inspect the current decompilation and local/label state
  • apply types/prototypes that make the function read more like source
  • rename locals, globals, and labels when they materially improve readability
  • add targeted line comments where they help interpretation
  • place functions into review/triage folders when the workflow creates durable buckets
  • always finish with exactly one repeatable function comment summary on funcs.rpt_comment
  • refresh with decompile(addr, 1) and verify the result

Use narrower intents only when the user asks narrowly:

  • add a comment -> comment only
  • func-summary / function summary -> summary only
  • annotate this function -> full cleanup plus summary

Why the summary is mandatory:

  • it orients a human reviewer immediately
  • it creates semantic/searchable program knowledge for later whole-program understanding

Folder-Aware Annotation Workflow

Use object-table folder_path columns to organize work as you annotate. Prefer funcs.folder_path for function-level work, names.folder_path for globals/labels, and bookmarks.folder_path for review breadcrumbs. dirtree_entries is the raw browser and dirtree_folders manages empty folders across all standard IDA dirtrees. dirtree_entries.path is absolute (/idasql/review); dirtree_folders.path and folder_path are relative (idasql/review); both compare exactly like SQL.

Common folders:

  • idasql/review/needs-types
  • idasql/review/annotated
  • idasql/review/verified
  • idasql/triage/network
  • idasql/triage/crypto
sql
-- Create a review bucket and move selected functions into it
INSERT INTO dirtree_folders(tree, path)
VALUES ('funcs', 'idasql/review/needs-types');

UPDATE funcs
SET folder_path = 'idasql/review/needs-types'
WHERE addr = 0x401000;

-- Mark a function as annotated while adding the required repeatable summary
UPDATE funcs
SET folder_path = 'idasql/review/annotated',
    rpt_comment = 'Parses command records, validates the opcode, and dispatches to command handlers.'
WHERE addr = 0x401000;

UPDATE names
SET folder_path = 'idasql/names/globals'
WHERE name LIKE 'g_%';

UPDATE bookmarks
SET folder_path = 'idasql/bookmarks/review'
WHERE description LIKE '%review%';

-- Review progress
SELECT folder_path, COUNT(*) AS functions
FROM funcs
WHERE folder_path LIKE 'idasql/%'
GROUP BY folder_path
ORDER BY folder_path;

Use UPDATE ... SET folder_path = NULL WHERE ... to move an object back to root. DELETE FROM dirtree_folders removes only empty folders. Folder writes use relative / paths and reject ./.., duplicate separators, backslashes, and renames to an already-existing destination.


Editing Function Comments

True IDA function comments live on funcs, not on pseudocode and not on the address-level comments table.

Use:

  • funcs.comment for the regular function comment
  • funcs.rpt_comment for the repeatable function comment

Default function-summary behavior:

  • treat singular add function comment as UPDATE funcs SET rpt_comment = ...
  • use funcs.comment only when the user explicitly asks for a non-repeatable function comment
  • use a heading-style pseudocode block comment only when the user explicitly asks for a decompiler note/summary rather than a true function comment

Canonical SQL pattern:

sql
SELECT addr, name, comment, rpt_comment
FROM funcs
WHERE addr = 0x401000;

UPDATE funcs
SET rpt_comment = 'One-paragraph summary of what the function does, inputs/outputs, and key behavior.'
WHERE addr = 0x401000;

Editing Decompiler Comments (Pseudocode)

The pseudocode table is the editing surface for decompiler comments. Use decompile(addr) to view; use the table to edit. For full table schema, see decompiler skill.

Important separation:

  • pseudocode.comment edits Hex-Rays decompiler comments only.
  • pseudocode writes never call set_func_cmt().
  • Use funcs.comment / funcs.rpt_comment for true function comments.

Writable columns: comment, comment_placement. Placements: semi (after ;), block1 (own line above), block2, curly1, curly2, brace1, brace2, colon, case, else, do, asm, try. An unrecognized placement string is silently coerced to semi.

Anchor guidance:

  • Prefer a concrete pseudocode statement row, not a guessed function-entry row.
  • If an addr maps to multiple pseudocode rows ({, statement, }), resolve a unique non-brace anchor first.
  • Use line_num only to inspect candidate rows. Comment writes persist by addr + comment_placement; shared-addr rows need extra care, so do not assume every displayed shared-addr row is independently writable.

Inspect anchors before writing:

sql
SELECT line_num, addr, line, comment
FROM pseudocode
WHERE func_addr = 0x401000
ORDER BY line_num;
sql
-- The example UPDATEs below assume 0x401020 is an already resolved writable
-- non-brace anchor from the inspection query above; do not substitute func_addr.
-- Edit: Add inline comment to decompiled code
UPDATE pseudocode SET comment_placement = 'semi',
                      comment = 'buffer overflow here'
WHERE func_addr = 0x401000 AND addr = 0x401020;

-- Edit: Add block comment (own line above statement)
UPDATE pseudocode SET comment_placement = 'block1', comment = 'vulnerable call'
WHERE func_addr = 0x401000 AND addr = 0x401020;

-- Edit: Delete comments at a resolved unique anchor
-- Warning: comment = NULL currently clears all placements at that addr.
UPDATE pseudocode SET comment = NULL
WHERE func_addr = 0x401000 AND addr = 0x401020;

-- Read edited pseudocode with comments
SELECT addr, line, comment FROM pseudocode WHERE func_addr = 0x401000;

Cleaning Up Orphan Decompiler Comments

If the database contains stale decompiler comments that no longer attach to current pseudocode, use the orphan comment surfaces instead of trying to clear them through pseudocode.

Read-first pattern:

sql
SELECT func_addr, func_name, orphan_count
FROM pseudocode_v_orphan_comment_groups
ORDER BY orphan_count DESC
LIMIT 20;

SELECT addr, comment_placement, orphan_comment
FROM pseudocode_orphan_comments
WHERE func_addr = 0x401000
ORDER BY addr, comment_placement;

Delete-only mutation pattern:

sql
UPDATE pseudocode_orphan_comments
SET orphan_comment = NULL
WHERE func_addr = 0x401000
  AND addr = 0x401020
  AND comment_placement = 'semi';

Notes:

  • pseudocode_orphan_comments is delete-only.
  • Non-empty writes are rejected.
  • Use the grouped surface for triage, then the precise table for cleanup.
  • After triage, switch to WHERE func_addr = ... on both surfaces for the fast path.

Function Summary (func-summary)

Use function summary and func-summary as equivalent intent.

Trigger contract:

  • If the user says function summary or func-summary, add or update exactly one repeatable function comment on funcs.rpt_comment.
  • If the user says add function comment (singular) without line-specific targets, treat it as a repeatable function comment update.
  • If the user explicitly asks for a decompiler heading note or pseudocode block comment, use pseudocode.comment with a resolved writable anchor instead.
  • Only add many line comments when the user explicitly asks for line-by-line/deep annotation.

Default behavior:

  • Write the summary to funcs.rpt_comment.
  • Use funcs.comment only when the user explicitly asks for a non-repeatable function comment.
  • Do not expand into line-by-line annotation unless the user explicitly asks for deep annotation.
  • When a function is being fully annotated, always add/update this summary as the last semantic step.

Length guidance:

  • Use one paragraph minimum when applicable.
  • For trivial wrappers/thunks, a shorter concise summary is acceptable.
  • Capture function role, key inputs/outputs, important state changes, and notable side effects when relevant.

Canonical SQL pattern:

sql
SELECT addr, name, comment, rpt_comment
FROM funcs
WHERE addr = 0x401000;

UPDATE funcs
SET rpt_comment = 'One-paragraph summary of what the function does, inputs/outputs, and key behavior.'
WHERE addr = 0x401000;

Prompt examples:

  • function summary 0x401000
  • func-summary DriverEntry
  • func-summary this function

Editing Disassembly Comments

Read disassembly-level comments from the comments table:

sql
SELECT COALESCE(NULLIF(comment, ''), NULLIF(rpt_comment, '')) AS comment
FROM comments
WHERE addr = 0x401000
LIMIT 1;

Upsert semantics: for the names and comments tables, INSERT at an address that already has a value replaces the existing entry (IDA allows only one name and one comment-slot per EA). UPDATE is equivalent for the in-place case. For names, IDA's SN_CHECK flag also auto-disambiguates global name conflicts (e.g. foo may become foo_0 if the name is already used at a different EA) — read back the row after writing to see what was actually stored.

The comments table supports INSERT, UPDATE, and DELETE:

TableINSERTUPDATE columnsDELETE
commentsYescomment, rpt_commentYes
sql
INSERT INTO comments(addr, comment) VALUES (0x401000, 'regular comment');
INSERT INTO comments(addr, rpt_comment) VALUES (0x401000, 'repeatable comment');
UPDATE comments SET comment = 'updated comment' WHERE addr = 0x401000;
DELETE FROM comments WHERE addr = 0x401000;

Notes:

  • comments edits address comments via set_cmt().
  • funcs.comment / funcs.rpt_comment edit true function comments via set_func_cmt().

bookmarks

The bookmarks table supports full CRUD for editing marked positions and folder organization:

ColumnTypeDescription
slotINTBookmark slot index
addrINTBookmarked address
descriptionTEXTBookmark description
inodeINTRead-only dirtree inode
folder_pathTEXTWritable bookmark folder; NULL means root
full_pathTEXTRead-only full dirtree path
sql
-- List all bookmarks
SELECT printf('0x%X', addr) as addr, description, folder_path FROM bookmarks;

-- Edit: Add bookmark
INSERT INTO bookmarks (addr, description) VALUES (0x401000, 'interesting branch');

-- Edit: Update bookmark description
UPDATE bookmarks SET description = 'confirmed branch' WHERE slot = 0;

-- Edit: Move bookmark into a review folder
UPDATE bookmarks SET folder_path = 'idasql/bookmarks/confirmed' WHERE slot = 0;

-- Edit: Delete bookmark
DELETE FROM bookmarks WHERE slot = 0;

For canonical schema and owner mapping, see ../connect/references/schema-catalog.md (bookmarks).


notepad (the database notepad)

notepad is IDA's "Database notepad": one free-text note per database, saved inside the IDB. Use it for a human-readable summary of an analysis session that should travel with the database.

ColumnTypeDescription
textTEXTWritable. The notepad text, line ends shown as LF; '' when empty
sizeINTRead-only. Bytes as stored (CRLF line ends), without the terminating NUL
sql
-- Read it
SELECT text FROM notepad;

-- Replace it (written with CRLF line ends, as IDA's notepad window does)
UPDATE notepad SET text = 'Session notes' || char(10) || '- entry point reviewed';

-- Append a line
UPDATE notepad SET text = text || char(10) || '- crypto routine at 0x401000';

-- Clear it (the row stays, with empty text)
DELETE FROM notepad;

Rules:

  • There is always exactly one row; INSERT is refused.
  • Text above 1,024,000 bytes (with CRLF line ends and the terminating NUL, the most IDA's notepad window holds) is refused, and so are NULL and NUL bytes. A refused UPDATE leaves the notepad unchanged.
  • In the GUI, an open notepad window shows the new text at IDA's next UI refresh (about a tenth of a second) and loses anything typed there but not yet saved. Say so before overwriting a user's notepad, and prefer appending.
  • The window stores what is typed in it when it closes or loses focus and when the database is saved (save_database() included). A window that closes before that refresh writes its own text back over the UPDATE, so read the notepad back after writing it while the user has it open.
  • Like every write, it reaches the IDB file only when the database is saved (save_database() or -w).

Editing Local Variables (Rename, Retype, Comment)

The ctree_lvars table is the editing surface for decompiler local variables. Writable columns: name, type, comment. For full table schema, see decompiler skill.

Local-variable edit guidance:

  • Inspect/select one deterministic idx, then update by func_addr + idx.
  • Use UPDATE ctree_lvars SET name = ..., type = ..., or comment = ... for local edits.
  • For old name-based workflows, first query the candidate rows by func_addr + name, choose one idx, then update by idx.
  • A type UPDATE is read back and fails ("Hex-Rays kept ...") when the decompiler keeps the old type. That is usual for the result variable (is_result = 1), whose type follows the function prototype: change the return type with UPDATE funcs SET prototype = ... instead. Its comment is writable like any other.
  • Hex-Rays may re-order a function's locals after a rename, so re-select by idx (or by mreg/stkoff) before the next edit instead of reusing an old idx.
sql
-- Inspect current locals before renaming
SELECT idx, name, type, comment
FROM ctree_lvars
WHERE func_addr = 0x401000
ORDER BY idx;

-- Edit: Rename a local variable by index (canonical, deterministic)
UPDATE ctree_lvars SET name = 'buffer_size' WHERE func_addr = 0x401000 AND idx = 2;

-- Edit: Rename by current name after selecting one deterministic idx
UPDATE ctree_lvars SET name = 'buffer_size'
WHERE func_addr = 0x401000
  AND idx = (
    SELECT idx FROM ctree_lvars
    WHERE func_addr = 0x401000 AND name = 'v2'
    ORDER BY idx LIMIT 1
  );

-- Edit: Set local-variable comment by index
UPDATE ctree_lvars SET comment = 'points to decrypted buffer' WHERE func_addr = 0x401000 AND idx = 2;

-- Edit: Change variable type
UPDATE ctree_lvars SET type = 'char *'
WHERE func_addr = 0x401000 AND idx = 2;

Editing Decompiler Labels

Read the current labels first, then rename the exact label you observed. Prefer label_num identity over guessing from line text.

sql
-- Inspect labels before renaming
SELECT label_num, name, printf('0x%X', item_addr) AS item_addr
FROM ctree_labels
WHERE func_addr = 0x401000
ORDER BY label_num;

-- Rename deterministically by label number
UPDATE ctree_labels SET name = 'fail' WHERE func_addr = 0x401000 AND label_num = 12;

-- Equivalent UPDATE path
UPDATE ctree_labels
SET name = 'fail'
WHERE func_addr = 0x401000 AND label_num = 12;

Editing Types (Create, Modify, Apply)

For type creation, member CRUD, enum values, parse_decls(), applied_types, and name writes via names/funcs, see types skill.

Quick apply patterns used in annotation workflows:

sql
-- Apply type to a function
UPDATE funcs SET prototype = 'void __fastcall exec_command(command_t *cmd);'
WHERE addr = 0x140001BD0;

-- Apply/replace the type at any mapped address
INSERT INTO applied_types(addr, decl)
VALUES (0x140001BD0, 'void __fastcall exec_command(command_t *cmd);');

Editing Operand Representation (Enum/Struct in Disassembly)

The instructions table operand*_format_spec columns allow editing operand display:

sql
-- Edit: Apply enum representation to operand 1
UPDATE instructions
SET operand1_format_spec = 'enum:MY_ENUM'
WHERE addr = 0x401020;

-- Edit: Apply struct-offset representation
UPDATE instructions
SET operand0_format_spec = 'stroff:MY_STRUCT,delta=0'
WHERE addr = 0x401030;

-- Edit: Nested member path uses '/' to separate type names
UPDATE instructions
SET operand0_format_spec = 'stroff:OUTER_T/INNER_T'
WHERE addr = 0x401030;

-- Edit: Clear representation back to plain
UPDATE instructions
SET operand1_format_spec = 'clear'
WHERE addr = 0x401020;

All of these work at the disassembly level — no IDAPython needed. The UPDATE is verified after apply and surfaces a SQL error if the representation didn't take.

The full operand*_format_spec vocabulary also covers number bases and other display forms:

sql
-- Number base / character
UPDATE instructions SET operand1_format_spec = 'hex'  WHERE addr = 0x401020;  -- also dec/oct/bin
UPDATE instructions SET operand1_format_spec = 'char' WHERE addr = 0x401020;

-- Offsets, sizeof, forced operand text
UPDATE instructions SET operand1_format_spec = 'offset:tbl_start' WHERE addr = 0x401020;
UPDATE instructions SET operand1_format_spec = 'sizeof:MY_STRUCT' WHERE addr = 0x401020;
UPDATE instructions SET operand1_format_spec = 'forced:5 shl 3'   WHERE addr = 0x401020;

-- Sign / bitwise-not modifiers (combine with a base, or use alone)
UPDATE instructions SET operand1_format_spec = 'dec,signed' WHERE addr = 0x401020;

Other kinds: float, segment, stkvar, and the ,unsigned / ,bnot / ,nobnot modifiers. See the disassembly skill for the full table.


Editing Union Selection in Decompiled Code

For union selection helpers (set_union_selection*, get_union_selection*), see decompiler skill.


Editing Number Format (Enum Rendering in Decompiled Code)

Recommended: Retype the variable to an enum type — IDA's decompiler will then automatically render all constants using enum names:

sql
-- 1. Define the enum type (skip if it already exists)
SELECT parse_decls('typedef enum { DLL_PROCESS_DETACH=0, DLL_PROCESS_ATTACH=1 } fdw_reason_t;');

-- 2. Retype the parameter/variable
UPDATE ctree_lvars SET type = 'fdw_reason_t'
WHERE func_addr = 0x180001050 AND idx = 1;

-- 3. Verify
SELECT decompile(0x180001050, 1);

For per-operand numform control (set_numform*, get_numform*), see decompiler skill.


Undo Checkpoints (Roll Edits Back)

A checkpoint is a named IDA undo point. Take one before a batch of edits; if the edits were wrong, roll back to it; if the rollback was wrong, redo. It needs no IDAPython and works headless and in the GUI. Every idasql write rolls back: names, comments, prototypes, types, members, enums, folders, bookmarks, segments, bytes, operand formats, make_code, netnodes, lvars, pseudocode comments, callee types, the notepad, and ida_config keys with persisted = 1.

sql
INSERT INTO checkpoints(label) VALUES ('before renames');
UPDATE funcs SET name = 'parse_header' WHERE addr = 0x401000;
SELECT seq, label, kind, writes_since, state FROM checkpoints ORDER BY seq;
UPDATE checkpoints SET state = 'undone' WHERE label = 'before renames';   -- roll back
UPDATE checkpoints SET state = 'live' WHERE label = 'before renames';     -- redo
SELECT next_undo_label, next_redo_label, redo_safe FROM undo_state;
ColumnMeaning
seqCreation order (the rowid)
labelUnique among live checkpoints; omitted on INSERT: checkpoint N. Empty and auto#... labels are refused
created_atISO time
kinduser (INSERT) or auto (auto_checkpoint)
writes_sinceChanges made after it that are still applied (a count of changes, not rows). 0: rolling back changes nothing
statementFor auto: the statement that wrote; NULL for user
statelive or undone. Writable: 'undone' rolls back to it (newer checkpoints too), 'live' redoes the next undone one

Rules:

  • Session-scoped. Checkpoints live in IDA's undo history: they survive save_database(), not closing the database, so they need a long-lived session (the plugin, --http, --mcp, -i).
  • Rollback takes everything since the checkpoint, GUI and IDAPython edits included (undo_state.last_rollback_foreign says how many such steps it undid). A WHERE that matches no checkpoint undoes nothing. A checkpoint IDA no longer has (history trimmed, or undone outside idasql) fails, and the database is left as it was.
  • Redo is one checkpoint at a time, oldest first, and is refused once anything was written after the rollback: IDA would re-apply the old step and silently drop the newer change. Reads, decompiling included, do not count. Check undo_state.redo_safe first.
  • SQLite ROLLBACK is not undo. It does not revert IDA writes and does not remove a checkpoint.
  • Session settings are not database state. runtime_settings and ida_config keys with persisted = 0 are not rolled back.
  • DELETE FROM checkpoints is refused. Needs IDA 9.0 SP1 or later: on IDA 9.0 GA, creating a checkpoint and auto_checkpoint = 'statement' fail with that reason.

Per-statement undo: every top-level statement that writes gets its own checkpoint (kind = 'auto', label auto#N). SQL issued from Python through import idasql belongs to the statement that ran the Python, and right after a rollback, reads do not create one (that would end the redo branch). While it is on, idasql keeps one undo point ready for the next statement: undo_state.next_undo_label can name an auto#N not listed yet (it is listed once a statement writes), and a rollback past it counts it as one step.

sql
UPDATE runtime_settings SET value = 'statement' WHERE key = 'auto_checkpoint';
UPDATE funcs SET comment = 'reviewed' WHERE addr = 0x401000;
UPDATE checkpoints SET state = 'undone'
WHERE seq = (SELECT MAX(seq) FROM checkpoints WHERE state = 'live');      -- undo the last statement
UPDATE runtime_settings SET value = 'off' WHERE key = 'auto_checkpoint';

Per-turn checkpoints for an agent session (a prompt-submit hook that checkpoints every turn, with rollback / redo / list / status commands): references/checkpoints.md.


Mandatory Mutation Loop (For All Edits)

Follow the read -> edit -> refresh -> verify cycle defined in connect Global Agent Contracts.


Performance Tips for Batch Editing

When editing many functions or annotations, keep these costs in mind:

  • decompile(addr, 1) triggers a full re-decompilation (~50-200ms per function). When editing multiple items in the same function, batch all edits before the refresh:
    sql
    -- Good: structural typing first, then refresh, then naming cleanup
    UPDATE ctree_lvars SET type = 'MY_CTX *' WHERE func_addr = 0x401000 AND idx = 0;
    SELECT decompile(0x401000, 1);
    UPDATE ctree_lvars SET name = 'ctx' WHERE func_addr = 0x401000 AND idx = 0;
    UPDATE ctree_lvars SET name = 'size' WHERE func_addr = 0x401000 AND idx = 1;
    SELECT decompile(0x401000, 1);  -- final refresh after cleanup
  • pseudocode comment writes (re)decompile the target function — each write decompiles the containing function to resolve the comment anchor, persists to IDA's user comments store, then invalidates that function's decompiler cache so the next decompile(addr) re-renders. You do not need to call decompile(addr, 1) yourself between comment writes, but the write is not free — it costs one decompilation of that function.
  • ctree_lvars type changes invalidate the decompiler cache — after changing a variable type, refresh before you trust idx/name-based cleanup. The decompiler may split locals or re-render expressions.
  • save_database() can be costly on large databases. Batch all writes and save once at the end of an annotation campaign, not after each edit.

Additional Resources


See Also

  • types — define and modify type dictionary entries; apply them via applied_types or funcs.prototype.
  • decompiler — pseudocode comments (UPDATE pseudocode SET comment = ...); ctree lvar renames/retypes.
  • disassembly — rename code labels (names), apply instruction-level operand formats.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة أثناء تحميل المهارة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Annotations؟

Edit IDA databases. Use when asked to add comments, rename symbols, apply types, create bookmarks, write the database notepad, clean up decompiled code for review, or take undo checkpoints and roll edits back.

لماذا تستخدم Annotations على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Annotations عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Annotations في TypingMind؟

افتح الإضافات → المهارات → التثبيت من GitHub في TypingMind والصق https://github.com/allthingsida/idasql-skills/tree/main/plugins/idasql/skills/annotations. يقرأ TypingMind ملف SKILL.md الخاص بها، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Annotations؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Annotations؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Annotations معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Annotations مجانية؟

نشرها allthingsida على GitHub. راجع المستودع للاطلاع على شروط الترخيص. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا البريدية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇