[GH-ISSUE #2927] [Feature] CLI batch mode: run several tool calls in one provider session #1030

Open
opened 2026-10-15 18:30:29 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @matbrgz on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2927

Type: Feature Domain: Reverse Engineering Status: Proposed Ecosystem: REA

Before submitting

  • Searched (batch CLI, CLI session reuse, persistent session, re-import). Related: #1048 (pre-imported Ghidra project), #479 (Hopper window reuse). This asks for a CLI-level batch entry point, which is independent of the provider.
  • Contribution scope understood. No private data.

Area

CLI

Current limitation

Each CLI invocation is a separate process (docs/cli.md), so with a deep provider every command pays the full import and auto-analysis cost. On a 7.1 MB Delphi PE32 with Ghidra 12.1.4 that is about 70 s per command. An investigation step typically needs 5–20 queries (search, trace, callers, decompile, bytes). Today the only ways to amortize the import are an MCP-capable agent or a hand-written MCP stdio client. We wrote one (tools/rea_session.mjs, ~50 lines using @modelcontextprotocol/client) to run REA from scripts and CI.

Proposed outcome

rea batch <calls.json|-> [--provider ghidra] [--out DIR|--jsonl]:

  • input: an ordered list of {id, tool, arguments} using the MCP tool names and schemas;
  • one session: open the target once (first call or --target), run the calls in order, close (optionally saving --snapshot);
  • output: one Evidence/result per call (JSONL or DIR/<id>.json), a per-call ok|error with the original error contract, and timing;
  • --stop-on-error / --continue semantics; cancellation closes the provider cleanly.

Use cases

Reproducible reverse-engineering notebooks and CI checks (e.g. "after a vendor update, re-run these 15 queries and diff the Evidence"), without registering REA as an agent MCP server.

Repro of the cost

AUTORIZADOR_VER6630.exe (sha256 0c79af43ce52a9317591e081ebfc9f29f70d5575033b2eb9e177d0828a634c44) → innoextract -e → app/AUTORIZADOR.exe (sha256 1398d55a71a9e4ac04f7a12f5f1bec9d0b4343fbd1c0f8635938d261f18fa363). Running rea decompile <exe> 0x65caac --provider ghidra twice with different addresses takes ~70 s each. The same two queries in one MCP session: ~70 s + ~1 s.

Suggested approach

Reuse the MCP server's tool registry in-process (the CLI already shares workflows with MCP) and drive it from the batch file. No new provider work is needed.

Originally created by @matbrgz on GitHub (Oct 13, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2927 [![Type: Feature](https://img.shields.io/badge/type-feature-blue.svg?style=flat-square)](https://github.com/morluto/rea) [![Domain: Reverse Engineering](https://img.shields.io/badge/domain-reverse_engineering-blueviolet.svg?style=flat-square)](https://github.com/morluto/rea) [![Status: Proposed](https://img.shields.io/badge/status-proposed-blue.svg?style=flat-square)](https://github.com/morluto/rea) [![Ecosystem: REA](https://img.shields.io/badge/ecosystem-morluto%2Frea-8A2BE2.svg?style=flat-square)](https://github.com/morluto/rea) ### Before submitting - [x] Searched (`batch CLI`, `CLI session reuse`, `persistent session`, `re-import`). Related: #1048 (pre-imported Ghidra project), #479 (Hopper window reuse). This asks for a CLI-level batch entry point, which is independent of the provider. - [x] Contribution scope understood. No private data. ### Area CLI ### Current limitation Each CLI invocation is a separate process (docs/cli.md), so with a deep provider every command pays the full import and auto-analysis cost. On a 7.1 MB Delphi PE32 with Ghidra 12.1.4 that is about **70 s per command**. An investigation step typically needs 5–20 queries (search, trace, callers, decompile, bytes). Today the only ways to amortize the import are an MCP-capable agent or a hand-written MCP stdio client. We wrote one (`tools/rea_session.mjs`, ~50 lines using `@modelcontextprotocol/client`) to run REA from scripts and CI. ### Proposed outcome `rea batch <calls.json|-> [--provider ghidra] [--out DIR|--jsonl]`: - input: an ordered list of `{id, tool, arguments}` using the MCP tool names and schemas; - one session: open the target once (first call or `--target`), run the calls in order, close (optionally saving `--snapshot`); - output: one Evidence/result per call (JSONL or `DIR/<id>.json`), a per-call `ok|error` with the original error contract, and timing; - `--stop-on-error` / `--continue` semantics; cancellation closes the provider cleanly. ### Use cases Reproducible reverse-engineering notebooks and CI checks (e.g. "after a vendor update, re-run these 15 queries and diff the Evidence"), without registering REA as an agent MCP server. ### Repro of the cost `AUTORIZADOR_VER6630.exe` (sha256 `0c79af43ce52a9317591e081ebfc9f29f70d5575033b2eb9e177d0828a634c44`) → `innoextract -e` → `app/AUTORIZADOR.exe` (sha256 `1398d55a71a9e4ac04f7a12f5f1bec9d0b4343fbd1c0f8635938d261f18fa363`). Running `rea decompile <exe> 0x65caac --provider ghidra` twice with different addresses takes ~70 s each. The same two queries in one MCP session: ~70 s + ~1 s. ### Suggested approach Reuse the MCP server's tool registry in-process (the CLI already shares workflows with MCP) and drive it from the batch file. No new provider work is needed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1030
No description provided.