CLI reference
opcodex runs every engine operation from a shell, and it is also the MCP server that agent apps start. It ships with the desktop app.
- In the built-in terminal,
opcodexis onPATHand uses the app’s engine. - Elsewhere, run
%LOCALAPPDATA%\Programs\Opcodex\Application\app\support\opcodex.exe. If the app is not running, the CLI starts a private engine for the command. The first start is slow.
opcodex [--format json|jsonl|md|text|csv] [--project PATH] <command> [--param value ...]| Global option | Effect |
|---|---|
--format FORMAT | Output as json (default), jsonl, md, text or csv. It may also come after the operation name. |
--project PATH | Open the project PATH.gpr before running the command. Give the path without .gpr, or with it. |
Parameters are written in kebab case: programId becomes --program-id. A boolean flag on its own means true. --params-json '{"programId":"…"}' passes several parameters as JSON.
opcodex program.list --format textopcodex --project "$HOME\Documents\Opcodex Projects\curl" program.listopcodex code.decompile --program-id PROGRAM_ID --address 140001030 --format mdCommands
Section titled “Commands”| Command | What it does |
|---|---|
commands | List every engine operation with its class and description. |
<operation> --help | Describe an operation and its parameters. |
<operation> [--param value] | Run an operation, for example opcodex program.list. |
serve | Run a shared engine in this terminal for the desktop, the CLI and agents. |
mcp | Run the MCP server on stdin and stdout. Agent apps start this. |
setup | Register Opcodex with local agent apps. See Connect an agent. |
doctor | Check the CLI, the engine connection and agent registrations. Accepts --format json or text. |
policy get | Show the open project’s approval policy. |
policy set <mode> | Change the approval policy to ask, allow-writes or allow-all. Must be typed by a person in a terminal. See Approval policy. |
--version | Print the CLI version. |
Background jobs (job.*, and program.analyze --background) need a shared engine: the running desktop app, or opcodex serve in another terminal.
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Success. |
1 | A usage problem, or the CLI couldn’t connect to or start an engine. |
2 | The engine refused the request or it failed, for example an approval was required or an address was invalid. |
Operations
Section titled “Operations”There are 50 operations. Each has a class. read operations never change a project. write operations change it and follow the project’s approval policy. run operations run code; agents and the CLI need the allow-all policy. system operations are for the desktop app only.
Writes need --expected-revision: the program revision you last read, from program.info. A write against an older revision is refused, so two clients can’t overwrite each other.
List operations return a page of results and a nextCursor. Pass it back with --cursor. --limit sets the page size, from 1 to 1000 (default 200).
Engine and policy
Section titled “Engine and policy”| Operation | Class | Description | Parameters |
|---|---|---|---|
engine.info | read | Shows the product, edition, analysis engine version and API version. | None |
policy.get | read | Shows what agents may change in the open project without approval: ask, allow-writes or allow-all. | None |
policy.set | system | Changes what agents may change in the open project without approval. Desktop only. | --mode |
policy.requestChange | read | Starts a policy change confirmed by a person typing a one-time code at a terminal. Used by opcodex policy set; not offered to agents. | --mode |
policy.confirmChange | read | Completes a policy change with the code the person typed. One attempt per code. | --challenge, --typed |
catalog.list | read | Lists every operation with its description, class and parameter schema. | None |
The CLI does not run policy.requestChange or policy.confirmChange directly; use opcodex policy set.
Projects and programs
Section titled “Projects and programs”| Operation | Class | Description | Parameters |
|---|---|---|---|
project.create | read | Creates a new, empty project. Refuses to replace an existing project. | --dir, --name |
project.open | read | Opens an existing project. | --dir, --name |
project.close | read | Closes the open project and its programs. | None |
program.info | read | Opens a program if needed and shows its name, language and current revision. Writes need the revision. | --program-id |
program.list | read | Lists the programs in the open project. Open programs include their language and revision. | None |
program.import | write | Imports a binary into the open project. Doesn’t analyse it; call program.analyze next. | --name, and --path or --bytes-base64; optional --language, --compiler, --folder |
program.analyze | write | Runs auto-analysis on a program: finds functions, references, strings and types. | --program-id; optional --background |
--path is an absolute path. --language takes a language ID such as x86:LE:64:default; it is optional for known formats. --compiler takes a compiler spec ID such as windows or gcc. --folder is a folder inside the project, / by default.
| Operation | Class | Description | Parameters |
|---|---|---|---|
job.list | read | Lists recent jobs for the open project. | None |
job.get | read | Shows a background job’s progress and result. | --job-id |
job.cancel | write | Requests cancellation before a background job commits. | --job-id |
Reading code
Section titled “Reading code”| Operation | Class | Description | Parameters |
|---|---|---|---|
program.functions.list | read | Lists functions in address order, a page at a time, with size and call counts. | --program-id; optional --query, --limit, --cursor |
function.get | read | Describes the function containing an address: signature, body, callers and callees. | --program-id, --address |
code.decompile | read | Decompiles the function containing an address to C. Tokens link text to addresses and variables. | --program-id, --address; optional --timeout-sec (1–600, default 30) |
code.disassemble | read | Lists instructions starting at an address, with bytes, mnemonic and operands. | --program-id, --address; optional --count (1–2000, default 64) |
xrefs.to | read | Lists references that point to an address. | --program-id, --address; optional --limit, --cursor |
xrefs.from | read | Lists references made from an address. | --program-id, --address; optional --limit, --cursor |
program.strings.list | read | Lists defined strings in address order, with their encoding. | --program-id; optional --min-length (default 4), --limit, --cursor |
program.summary | read | Summarises a program for triage: format, architecture, entry points, sections with entropy, imports by library, risky API usage and notable strings. | --program-id |
memory.read | read | Reads up to 64 KiB of initialized bytes, stopping at the end of a block. | --program-id, --address, --length (up to 65536) |
--query keeps functions whose name contains the text, ignoring case.
Changes and history
Section titled “Changes and history”| Operation | Class | Description | Parameters |
|---|---|---|---|
symbol.rename | write | Renames the function or label at an address. Recorded in history and revertible. | --program-id, --address, --new-name, --expected-revision |
comment.set | write | Sets or clears a comment at an address. Recorded in history and revertible. | --program-id, --address, --kind, --text, --expected-revision |
history.list | read | Lists recorded changes to a program, newest first, with who made them and the values before and after. | --program-id; optional --actor, --limit, --cursor |
history.revert | write | Reverts one recorded change, if the value hasn’t changed again since. The revert is recorded too. | --program-id, --entry-id, --expected-revision |
--kind is one of eol, pre, post, plate or repeatable. Empty text clears the comment. Text can be up to 64 KiB. --actor filters history by desktop, cli or mcp:<client>.
Graphs
Section titled “Graphs”| Operation | Class | Description | Parameters |
|---|---|---|---|
function.graph | read | Shows a function’s basic blocks with their instructions, and the branches between them (taken, not taken, jump or fall-through). | --program-id, --address |
function.callgraph | read | Shows the functions that call a function and the functions it calls, a few calls deep. | --program-id, --address; optional --depth (1–3, default 1), --limit (1–300, default 100) |
--address can be any address inside the function. See Graph.
Debugger
Section titled “Debugger”The debugger emulates the program’s code; nothing runs natively. There is one session per program, held by the engine, so the desktop app, the CLI and agents share it. Every debug.* operation is class read: it never changes the project. Most return the debugger state: the current address, instruction, registers, the registers the last step changed, the stack and the breakpoints. See Debugger.
| Operation | Class | Description | Parameters |
|---|---|---|---|
debug.start | read | Starts debugging at an address by emulating the program’s code. Nothing runs natively, and calls to imported functions are stepped over. | --program-id, --address; optional registers (see below) |
debug.state | read | Shows the debugger’s current state. | --program-id |
debug.step | read | Steps one instruction, or count instructions, stepping into calls. | --program-id; optional --count (1–10000, default 1) |
debug.stepOver | read | Steps one instruction, running a whole call as one step. | --program-id |
debug.run | read | Runs until a breakpoint, the function returns, an error, or 2000000 instructions. | --program-id |
debug.runTo | read | Runs until an address is reached (or a breakpoint, return or error). | --program-id, --address |
debug.breakpoint.set | read | Sets a breakpoint at an address. | --program-id, --address |
debug.breakpoint.clear | read | Removes the breakpoint at an address. | --program-id, --address |
debug.register.set | read | Changes a register in the debugger. | --program-id, --name, --value |
debug.memory.read | read | Reads memory as the debugged code sees it, including the stack. | --program-id, --address, --length (1–4096) |
debug.stop | read | Ends the debugging session. | --program-id |
registers is a JSON object of register names and values. Pass it with --params-json, for example --params-json '{"address":"140001180","registers":{"RDI":"5","RSI":"0x10"}}'. Registers you don’t set start at 0. --value is decimal or 0x hex. In MCP the tool names use underscores, such as debug_step and debug_breakpoint_set.
Plugins and scripts
Section titled “Plugins and scripts”| Operation | Class | Description | Parameters |
|---|---|---|---|
plugin.list | read | Lists installed plugins with what each adds: operations, scripts and themes. | None |
plugin.themes | read | Returns the theme files of enabled plugins. | None |
plugin.install | system | Installs a plugin from a folder or .zip. Plugins run with your permissions. Desktop only. | --path |
plugin.setEnabled | system | Turns a plugin on or off. Desktop only. | --id, --enabled |
plugin.remove | system | Removes a plugin. Desktop only. | --id |
script.list | read | Lists the Java scripts you can run: your own and those of enabled plugins. | None |
script.import | system | Copies a Java script into your scripts folder. Desktop only. | --path |
script.run | run | Runs a Java script against a program as one change. It can change anything, so agents need the allow-all policy. Recorded in history; a failed script changes nothing. | --program-id, --script, --expected-revision; optional --address, args (see below) |
The four desktop-only operations are not available to the CLI or agents. Install plugins and add scripts from the Plugins screen; see Plugins and scripts. --script is a script id from script.list. --address is the current address the script sees. args is a list of strings; pass it with --params-json, for example --params-json '{"args":["one","two"]}'.
Example: rename a function
Section titled “Example: rename a function”opcodex program.list --format textopcodex program.info --program-id PROGRAM_IDopcodex symbol.rename --program-id PROGRAM_ID --address 140001030 --new-name parse_args --expected-revision 3opcodex history.list --program-id PROGRAM_ID --limit 5 --format textThe rename succeeds only if the project’s policy allows writes from the CLI. See Approval policy & history.
Environment variables
Section titled “Environment variables”| Variable | Effect |
|---|---|
OPCODEX_ENGINE_CMD | The command that starts an engine when none is running. |
OPCODEX_SESSION_DIR | Where to look for a running engine. |