Assembly — 99 Operations for AI Agents
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Assembly code through the act MCP server. 99 operations available: 25 refactor, 18 query, 42 analysis, 14 verification. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.
Worked Assembly examples
act101 edits raw x86/ARM assembly at the instruction level: it can wrap a range of instructions in a #ifdef/#endif preprocessor guard, append a comment to a named instruction line, and inline a .equ constant back into every instruction that references it, removing the directive. Every operation here is anchored to a specific line and column inside the file, so a rename or removal changes only the instructions it names and leaves the surrounding routine untouched. Each example below is the verbatim output of the command shown, run against the file shown.
Wrap an instruction in a preprocessor guard
setup issues a syscall that should only run on x86-64 targets.
$ act refactor-lang wrap_in_ifdef --file setup.asm --params '{"start_line":3,"end_line":3,"symbol":"X86_64","line":3,"column":1}'
Before
setup:
mov rax, 0
syscall
ret
After
setup:
mov rax, 0
#ifdef X86_64
syscall
#endif
ret
The syscall line is wrapped between #ifdef X86_64 and #endif; mov rax, 0 and ret stay outside the guard.
Document an instruction line
start zeroes the counter register without explanation.
$ act refactor-lang add_comment --file start.asm --params '{"line":2,"comment_text":"initialize counter","column":1}'
Before
start:
mov eax, 0
ret
After
start:
mov eax, 0 ; initialize counter
ret
A ; initialize counter comment is appended to the mov line; the label and ret lines are untouched.
Inline a constant back into its instructions
counter.asm defines LIMIT with a .equ directive and uses it in two instructions.
$ act refactor-lang inline_constant --file counter.asm --params '{"constant_name":"LIMIT","line":1,"column":1}'
Before
.equ LIMIT, 100
check:
cmp eax, LIMIT
jge done
add eax, LIMIT
done:
ret
After
check:
cmp eax, 100
jge done
add eax, 100
done:
ret
Both LIMIT operands become the literal 100, and the now-unreferenced .equ LIMIT, 100 directive is removed.
Query
18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.
callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch
Refactor
| Operation | Description |
|---|---|
add-comment |
Add a ; comment to an instruction or label line |
add-label |
Insert a label before an instruction line |
extract-address |
Extract an address or label reference to a named constant |
extract-constant |
Extract an immediate value to a named .equ constant |
extract_function |
Extract a code selection into a new function — automatically infers parameters, return types, and inserts the call site. Use instead of manually cutting/pasting code. Works without LSP; LSP improves type inference. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool), receipt (bool)] |
extract_variable |
Extract an expression into a named variable — inserts the declaration and replaces the expression with the variable name. Works without LSP. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool)] |
generate-function-epilogue |
Generate function epilogue (cleanup/return) for a target architecture |
generate-function-prologue |
Generate function prologue (stack setup) for a target architecture |
generate-function-stub |
Generate complete function skeleton with prologue and epilogue |
generate-label |
Generate a new unique label definition |
generate-macro |
Generate a .macro/.endm skeleton |
inline |
Inline a variable, function, or method — replace every usage with its definition body, then remove the original. The inverse of extract. Works without LSP (single-file); LSP enables cross-file inlining. Params: file (string), symbol (string) [, line (u32), preview (bool), receipt (bool)] |
inline-constant |
Inline a .equ constant, replacing all references with its value |
insert_body |
Replace a function's implementation body with new code. AST-validated — rejects if the result has parse errors, so you can't accidentally break syntax. Use instead of manual text editing for function rewrites. Params: file (string), symbol (string), code (string) [, commit (bool)] |
move_symbol |
Move a function, class, or type to a different file and automatically update all imports across the codebase. Use instead of manually cut/paste + fixing imports. Works without LSP (single-file); LSP enables cross-file import updates. Params: file (string), symbol (string), destination (string) [, preview (bool), receipt (bool)] |
recipe_run |
Run a codemod recipe: declarative match → transform → optional verify across modeled grammars. Preview lists matches; apply writes with optional E7 receipts and all-or-nothing rollback. Returns a per-site report. |
remove-comment |
Remove the trailing comment from a line |
remove-dead-code |
Remove unreachable instructions after an unconditional jump |
remove-instruction |
Remove a single instruction line |
remove-label |
Remove an unused label line |
rename |
Rename a symbol and automatically update ALL references across the codebase. Safer and faster than find-and-replace — AST-aware, won't rename strings or comments. Works without LSP (single-file); LSP enables cross-file renames. Params: file (string), old_name (string), new_name (string) [, line (u32), column (u32), preview (bool), receipt (bool)] |
rename-label |
Rename a label and all its jump/call references |
rename-register |
Rename a register across all uses in scope |
unwrap-ifdef |
Remove #ifdef/#endif wrapper, keeping the body |
wrap-in-ifdef |
Wrap instructions in #ifdef/#endif conditional assembly |
Analysis
42 analysis tools, the same on every supported language. Descriptions live in the shared reference: /docs/analysis-tools.
analyze_api_diff analyze_chokepoints analyze_clones analyze_clusters analyze_cohesion analyze_conformance analyze_coupling analyze_cycle_risk analyze_cycles analyze_dead_code analyze_depth analyze_entry_points analyze_export analyze_extraction analyze_fan_balance analyze_features analyze_hotspots analyze_impact analyze_inconsistencies analyze_inheritance analyze_interface_bloat analyze_interfaces analyze_layers analyze_orphan_types analyze_patterns analyze_platform_deps analyze_readiness analyze_roles analyze_seams analyze_stability analyze_surface analyze_test_gaps analyze_thickness analyze_type_completeness churn_hotspots co_change_clusters coverage_overlay ownership_map profile_overlay simulate split_module trace_overlay
Verify
14 verify tools, the same on every supported language. Descriptions live in the shared reference: /docs/verification.
bisect_regression gate generate_test_harness scan secret_surface summarize_pr taint_flow unsafe_surface verify_behavioral_equivalence verify_contract_preserved verify_diff_semantics verify_port_parity verify_side_effects verify_test_impact