Skip to content

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, opcodex is on PATH and 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 optionEffect
--format FORMATOutput as json (default), jsonl, md, text or csv. It may also come after the operation name.
--project PATHOpen 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.

Terminal window
opcodex program.list --format text
opcodex --project "$HOME\Documents\Opcodex Projects\curl" program.list
opcodex code.decompile --program-id PROGRAM_ID --address 140001030 --format md
CommandWhat it does
commandsList every engine operation with its class and description.
<operation> --helpDescribe an operation and its parameters.
<operation> [--param value]Run an operation, for example opcodex program.list.
serveRun a shared engine in this terminal for the desktop, the CLI and agents.
mcpRun the MCP server on stdin and stdout. Agent apps start this.
setupRegister Opcodex with local agent apps. See Connect an agent.
doctorCheck the CLI, the engine connection and agent registrations. Accepts --format json or text.
policy getShow 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.
--versionPrint the CLI version.

Background jobs (job.*, and program.analyze --background) need a shared engine: the running desktop app, or opcodex serve in another terminal.

CodeMeaning
0Success.
1A usage problem, or the CLI couldn’t connect to or start an engine.
2The engine refused the request or it failed, for example an approval was required or an address was invalid.

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).

OperationClassDescriptionParameters
engine.inforeadShows the product, edition, analysis engine version and API version.None
policy.getreadShows what agents may change in the open project without approval: ask, allow-writes or allow-all.None
policy.setsystemChanges what agents may change in the open project without approval. Desktop only.--mode
policy.requestChangereadStarts 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.confirmChangereadCompletes a policy change with the code the person typed. One attempt per code.--challenge, --typed
catalog.listreadLists 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.

OperationClassDescriptionParameters
project.createreadCreates a new, empty project. Refuses to replace an existing project.--dir, --name
project.openreadOpens an existing project.--dir, --name
project.closereadCloses the open project and its programs.None
program.inforeadOpens a program if needed and shows its name, language and current revision. Writes need the revision.--program-id
program.listreadLists the programs in the open project. Open programs include their language and revision.None
program.importwriteImports 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.analyzewriteRuns 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.

OperationClassDescriptionParameters
job.listreadLists recent jobs for the open project.None
job.getreadShows a background job’s progress and result.--job-id
job.cancelwriteRequests cancellation before a background job commits.--job-id
OperationClassDescriptionParameters
program.functions.listreadLists functions in address order, a page at a time, with size and call counts.--program-id; optional --query, --limit, --cursor
function.getreadDescribes the function containing an address: signature, body, callers and callees.--program-id, --address
code.decompilereadDecompiles 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.disassemblereadLists instructions starting at an address, with bytes, mnemonic and operands.--program-id, --address; optional --count (1–2000, default 64)
xrefs.toreadLists references that point to an address.--program-id, --address; optional --limit, --cursor
xrefs.fromreadLists references made from an address.--program-id, --address; optional --limit, --cursor
program.strings.listreadLists defined strings in address order, with their encoding.--program-id; optional --min-length (default 4), --limit, --cursor
program.summaryreadSummarises a program for triage: format, architecture, entry points, sections with entropy, imports by library, risky API usage and notable strings.--program-id
memory.readreadReads 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.

OperationClassDescriptionParameters
symbol.renamewriteRenames the function or label at an address. Recorded in history and revertible.--program-id, --address, --new-name, --expected-revision
comment.setwriteSets or clears a comment at an address. Recorded in history and revertible.--program-id, --address, --kind, --text, --expected-revision
history.listreadLists recorded changes to a program, newest first, with who made them and the values before and after.--program-id; optional --actor, --limit, --cursor
history.revertwriteReverts 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>.

OperationClassDescriptionParameters
function.graphreadShows a function’s basic blocks with their instructions, and the branches between them (taken, not taken, jump or fall-through).--program-id, --address
function.callgraphreadShows 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.

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.

OperationClassDescriptionParameters
debug.startreadStarts 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.statereadShows the debugger’s current state.--program-id
debug.stepreadSteps one instruction, or count instructions, stepping into calls.--program-id; optional --count (1–10000, default 1)
debug.stepOverreadSteps one instruction, running a whole call as one step.--program-id
debug.runreadRuns until a breakpoint, the function returns, an error, or 2000000 instructions.--program-id
debug.runToreadRuns until an address is reached (or a breakpoint, return or error).--program-id, --address
debug.breakpoint.setreadSets a breakpoint at an address.--program-id, --address
debug.breakpoint.clearreadRemoves the breakpoint at an address.--program-id, --address
debug.register.setreadChanges a register in the debugger.--program-id, --name, --value
debug.memory.readreadReads memory as the debugged code sees it, including the stack.--program-id, --address, --length (1–4096)
debug.stopreadEnds 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.

OperationClassDescriptionParameters
plugin.listreadLists installed plugins with what each adds: operations, scripts and themes.None
plugin.themesreadReturns the theme files of enabled plugins.None
plugin.installsystemInstalls a plugin from a folder or .zip. Plugins run with your permissions. Desktop only.--path
plugin.setEnabledsystemTurns a plugin on or off. Desktop only.--id, --enabled
plugin.removesystemRemoves a plugin. Desktop only.--id
script.listreadLists the Java scripts you can run: your own and those of enabled plugins.None
script.importsystemCopies a Java script into your scripts folder. Desktop only.--path
script.runrunRuns 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"]}'.

Terminal window
opcodex program.list --format text
opcodex program.info --program-id PROGRAM_ID
opcodex symbol.rename --program-id PROGRAM_ID --address 140001030 --new-name parse_args --expected-revision 3
opcodex history.list --program-id PROGRAM_ID --limit 5 --format text

The rename succeeds only if the project’s policy allows writes from the CLI. See Approval policy & history.

VariableEffect
OPCODEX_ENGINE_CMDThe command that starts an engine when none is running.
OPCODEX_SESSION_DIRWhere to look for a running engine.