rea-agents 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +129 -45
  2. package/bridge/ghidra/ReaGhidraBridge.java +2075 -0
  3. package/bridge/hopper_bridge.py +13 -3
  4. package/dist/application/AbortablePromise.js +25 -0
  5. package/dist/application/AnalysisProvider.js +3 -0
  6. package/dist/application/AnalysisProviderEvaluation.js +60 -0
  7. package/dist/application/AnalysisProviderRegistry.js +228 -0
  8. package/dist/application/AnalysisSnapshotCache.js +41 -21
  9. package/dist/application/AnalysisSnapshotFiles.js +5 -6
  10. package/dist/application/BinarySession.js +218 -101
  11. package/dist/application/CompositeProvider.js +20 -8
  12. package/dist/application/DirectAnalysis.js +49 -35
  13. package/dist/application/Doctor.js +54 -2
  14. package/dist/application/EnhancedTools.js +1 -1
  15. package/dist/application/InvestigationProviders.js +11 -0
  16. package/dist/application/JavaScriptArtifactAnalysis.js +299 -0
  17. package/dist/application/JavaScriptArtifactAnalysisTypes.js +1 -0
  18. package/dist/application/JavaScriptArtifactFiles.js +231 -0
  19. package/dist/application/JavaScriptArtifactGraphAccumulator.js +54 -0
  20. package/dist/application/JavaScriptArtifactGraphBuilder.js +101 -0
  21. package/dist/application/JavaScriptArtifactGraphContext.js +205 -0
  22. package/dist/application/JavaScriptArtifactGraphDocuments.js +108 -0
  23. package/dist/application/JavaScriptArtifactGraphEvidence.js +89 -0
  24. package/dist/application/JavaScriptArtifactGraphFindings.js +271 -0
  25. package/dist/application/JavaScriptArtifactGraphStructure.js +409 -0
  26. package/dist/application/JavaScriptArtifactReconstruction.js +74 -0
  27. package/dist/application/JavaScriptArtifactReconstructionInput.js +99 -0
  28. package/dist/application/MacHopper.js +20 -4
  29. package/dist/application/ProcessCaptureLifecycle.js +1 -1
  30. package/dist/application/ProcessHarness.js +1 -1
  31. package/dist/application/ProcessSampling.js +1 -1
  32. package/dist/application/SessionProviderRouter.js +219 -0
  33. package/dist/application/Setup.js +84 -60
  34. package/dist/application/SetupClients.js +1 -1
  35. package/dist/application/SetupPlan.js +9 -2
  36. package/dist/application/SupportedClients.js +40 -16
  37. package/dist/application/Upgrade.js +1 -1
  38. package/dist/application/runtime.js +9 -6
  39. package/dist/artifacts/AsarArtifactReader.js +23 -3
  40. package/dist/browser/CdpBrowserProvider.js +4 -2
  41. package/dist/browser/CdpElectronProvider.js +4 -2
  42. package/dist/browser/CdpEndpoint.js +14 -1
  43. package/dist/catalogIdentity.js +2 -41
  44. package/dist/cli.js +58 -34
  45. package/dist/cliBrowserAdvancedCommands.js +5 -4
  46. package/dist/cliBrowserCommands.js +5 -4
  47. package/dist/cliCommandNames.js +43 -0
  48. package/dist/cliElectronCommands.js +3 -2
  49. package/dist/cliEvidenceCommands.js +4 -3
  50. package/dist/cliInvestigationCommands.js +2 -1
  51. package/dist/cliPolicyCommands.js +2 -1
  52. package/dist/cliProcessCommands.js +3 -2
  53. package/dist/config.js +18 -2
  54. package/dist/contracts/browserToolContracts.js +5 -5
  55. package/dist/contracts/electronToolContracts.js +3 -3
  56. package/dist/contracts/enhancedInputs.js +2 -2
  57. package/dist/contracts/providerSelection.js +28 -0
  58. package/dist/contracts/sessionLifecycleInputs.js +2 -0
  59. package/dist/contracts/toolContracts.js +22 -20
  60. package/dist/contracts/toolOutputSchemas.js +117 -22
  61. package/dist/doctorRuntime.js +6 -0
  62. package/dist/domain/analysisProfile.js +78 -0
  63. package/dist/domain/analysisSnapshot.js +92 -46
  64. package/dist/domain/artifactGraph.js +1 -0
  65. package/dist/domain/binaryTarget.js +4 -29
  66. package/dist/domain/errors.js +81 -6
  67. package/dist/domain/evidence.js +44 -5
  68. package/dist/domain/evidenceBundle.js +9 -7
  69. package/dist/domain/functionComparison.js +9 -3
  70. package/dist/domain/functionComparisonNormalization.js +37 -0
  71. package/dist/domain/functionDossierEvidence.js +4 -1
  72. package/dist/domain/hopperValues.js +66 -9
  73. package/dist/domain/investigationWorkspace.js +2 -1
  74. package/dist/domain/javascriptApplicationEvidenceSchemas.js +361 -0
  75. package/dist/domain/javascriptApplicationGraph.js +281 -0
  76. package/dist/domain/javascriptApplicationGraphSchemas.js +132 -0
  77. package/dist/domain/javascriptAstFingerprint.js +143 -0
  78. package/dist/domain/javascriptStaticAnalysis.js +358 -0
  79. package/dist/domain/javascriptStaticAnalysisHelpers.js +264 -0
  80. package/dist/domain/javascriptStaticAnalysisState.js +17 -0
  81. package/dist/domain/javascriptStaticAnalysisTypes.js +1 -0
  82. package/dist/generatedPackageMetadata.js +1 -1
  83. package/dist/ghidra/GhidraAnalysisProfile.js +37 -0
  84. package/dist/ghidra/GhidraClient.js +400 -0
  85. package/dist/ghidra/GhidraClientTypes.js +1 -0
  86. package/dist/ghidra/GhidraDefaults.js +20 -0
  87. package/dist/ghidra/GhidraDiagnostics.js +43 -0
  88. package/dist/ghidra/GhidraDoctor.js +59 -0
  89. package/dist/ghidra/GhidraFunctionValues.js +264 -0
  90. package/dist/ghidra/GhidraInstallation.js +239 -0
  91. package/dist/ghidra/GhidraInventoryValues.js +217 -0
  92. package/dist/ghidra/GhidraLauncher.js +139 -0
  93. package/dist/ghidra/GhidraProvider.js +360 -0
  94. package/dist/ghidra/GhidraRequestQueue.js +98 -0
  95. package/dist/ghidra/GhidraResponseBuffer.js +31 -0
  96. package/dist/ghidra/GhidraResponseRouter.js +24 -0
  97. package/dist/ghidra/GhidraSessionError.js +39 -0
  98. package/dist/ghidra/GhidraSessionValues.js +62 -0
  99. package/dist/ghidra/GhidraSocketConnection.js +46 -0
  100. package/dist/ghidra/protocol.js +69 -0
  101. package/dist/hopper/BridgeLauncher.js +19 -54
  102. package/dist/hopper/HopperAnalysisProfile.js +106 -0
  103. package/dist/hopper/HopperClient.js +154 -162
  104. package/dist/hopper/HopperProvider.js +99 -7
  105. package/dist/hopper/HopperSessionValues.js +27 -0
  106. package/dist/hopper/HopperSocketConnection.js +31 -0
  107. package/dist/native/NativeMacOSProvider.js +3 -1
  108. package/dist/process/PendingOperations.js +59 -0
  109. package/dist/process/PrivateRuntimeRoot.js +33 -0
  110. package/dist/process/ProviderDeadline.js +95 -0
  111. package/dist/process/ProviderProcess.js +275 -0
  112. package/dist/server/createServer.js +1 -0
  113. package/dist/server/promptCompletion.js +9 -3
  114. package/dist/server/registerEnhancedTools.js +9 -6
  115. package/dist/server/registerOfficialTools.js +3 -0
  116. package/dist/server/registerSessionTools.js +6 -1
  117. package/package.json +8 -6
  118. package/scripts/rea.mjs +35 -1
  119. /package/dist/{application → process}/ProcessOwnership.js +0 -0
package/README.md CHANGED
@@ -30,7 +30,7 @@
30
30
 
31
31
  See a feature in an app that you want in your own product? Give the app to your agent—even without its source code. With REA, the agent can investigate the feature, explain how it works, show its evidence, and build a version adapted to your stack and requirements.
32
32
 
33
- REA gives agents one consistent way to investigate software. Today that includes deep native analysis through Hopper, complete function dossiers, reproducible Evidence v2 records, controlled process capture, passive website and Electron observation, and bounded JavaScript/source-map reconstruction. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions.
33
+ REA gives agents one consistent way to investigate software. Today that includes deep native analysis and function dossiers through Hopper or bring-your-own Ghidra on Linux, reproducible Evidence v2 records, controlled process capture, passive website and Electron observation, bounded JavaScript/source-map reconstruction, and a versioned domain graph for connecting JavaScript application layers without confusing static inference with runtime observation. The longer-term toolkit extends the same agent workflow to APIs, protocols, mobile artifacts, firmware, richer runtime behavior, and differences between versions.
34
34
 
35
35
  Reverse engineering normally makes the operator choose a tool, learn its API, move evidence between programs, and decide what to inspect next. REA gives that work to the agent through commands, skills, structured results, and repeatable investigation workflows.
36
36
 
@@ -74,14 +74,14 @@ REA shows how it reached its conclusions. It does not claim to recover original
74
74
 
75
75
  ## Why REA
76
76
 
77
- | | |
78
- | ------------------------ | ------------------------------------------------------------------------------------ |
79
- | **Built for agents** | Ask what an app does and let your agent inspect it instead of guessing. |
80
- | **CLI and MCP** | Run the same reverse-engineering capabilities from your terminal or agent. |
81
- | **Complexity handled** | REA installs and manages the reverse-engineering tools behind the scenes. |
82
- | **From insight to code** | Understand a feature, then build your own version in the same coding session. |
83
- | **Local by design** | Analysis runs on your Mac. REA does not upload the app to a hosted analysis service. |
84
- | **Keeps context** | Investigate several apps without starting over for every question. |
77
+ | | |
78
+ | ------------------------ | ----------------------------------------------------------------------------------------------------- |
79
+ | **Built for agents** | Ask what an app does and let your agent inspect it instead of guessing. |
80
+ | **CLI and MCP** | Run the same reverse-engineering capabilities from your terminal or agent. |
81
+ | **Complexity handled** | REA installs and manages the reverse-engineering tools behind the scenes. |
82
+ | **From insight to code** | Understand a feature, then build your own version in the same coding session. |
83
+ | **Local by design** | Analysis runs on your supported local host. REA does not upload the app to a hosted analysis service. |
84
+ | **Keeps context** | Investigate several apps without starting over for every question. |
85
85
 
86
86
  ## Quick start
87
87
 
@@ -94,7 +94,7 @@ rea setup
94
94
 
95
95
  Installing the CLI does not update Homebrew, Node.js, npm, Hopper, or agent configuration. `rea setup` detects what is already present, prints every proposed change, and asks before applying it.
96
96
 
97
- REA detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin. Registrations are additive, backup-first, and read back after writing. You can safely rerun setup.
97
+ REA detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin. It configures the first six when detected; Devin is reported but left unchanged because it has no documented local MCP configuration boundary. Registrations are additive, backup-first, and read back after writing. You can safely rerun setup.
98
98
 
99
99
  An optional curl wrapper installs the same CLI package and starts setup only when a terminal is available:
100
100
 
@@ -110,7 +110,7 @@ Pass installer options after `bash -s --`, for example `--dry-run`, `--no-setup`
110
110
  npx skills add morluto/rea
111
111
  ```
112
112
 
113
- Ask your agent to set up REA. It will check your Mac, explain anything it needs to install, ask for approval, and guide you through system prompts. After setup, restart the agent if it asks you to load the full REA toolset.
113
+ Ask your agent to set up REA. It will check your supported host, explain anything it needs to install, ask for approval, and guide you through system prompts. After setup, restart the agent if it asks you to load the full REA toolset.
114
114
 
115
115
  Review the setup plan, approve it if appropriate, then describe the app or feature you want to understand. Hopper can run in its free demo mode; if it shows a first-run prompt, choose the demo or enter an existing license.
116
116
 
@@ -153,7 +153,7 @@ Choose either the no-install commands or the global installation. You do not nee
153
153
  - Node.js 22.19+ or 24.11+ (including newer releases)
154
154
  - npm; REA does not require or install a particular npm version
155
155
 
156
- Deep binary analysis currently uses [Hopper](https://www.hopperapp.com/), a separate desktop application with its own license. Setup reuses an existing installation. If Hopper is missing, interactive setup proposes the official package and includes it in the confirmation plan. Unattended installation requires `rea setup --yes --install-hopper`.
156
+ Deep binary operations use [Hopper](https://www.hopperapp.com/), a separate desktop application with its own license, or a caller-selected Ghidra provider. Ghidra supplies read-only inventory, function metadata, decompilation, assembly, resolved calls, typed references, xrefs, CFG, and function dossiers; GUI state and mutations remain unavailable through that provider. Setup reuses an existing Hopper installation or an operator-supplied Ghidra installation. It never downloads Ghidra or installs Java. If neither provider is ready, interactive setup proposes Hopper; unattended Hopper installation requires `rea setup --yes --install-hopper`.
157
157
 
158
158
  If something is not working, run:
159
159
 
@@ -186,6 +186,28 @@ Install the missing distribution packages and rerun `rea setup`. Linux demo auto
186
186
 
187
187
  REA defaults `HOPPER_LAUNCHER_PATH` to `/Applications/Hopper Disassembler.app/Contents/MacOS/hopper` on macOS and `/opt/hopper/bin/Hopper` on Linux. Explicit configuration always takes precedence.
188
188
 
189
+ ### Ghidra read-only analysis provider
190
+
191
+ The current Ghidra adapter supports the exact official Ghidra 12.1.2 release on Linux x64 with a 64-bit full JDK 21. Download and extract those projects yourself, then configure absolute paths:
192
+
193
+ ```bash
194
+ export GHIDRA_INSTALL_DIR=/absolute/path/to/ghidra_12.1.2_PUBLIC
195
+ export JAVA_HOME=/absolute/path/to/jdk-21 # optional when java and javac resolve from PATH
196
+ rea doctor --json
197
+ rea setup
198
+ rea providers --json
199
+ ```
200
+
201
+ Doctor distinguishes missing configuration, a bad installation root, the wrong Ghidra or Java version, a JRE without `javac`, a missing `support/analyzeHeadless`, and an unsupported platform or architecture. Approved setup only copies the verified non-secret paths into detected MCP registrations; it does not modify the Ghidra installation or install/download Ghidra or Java.
202
+
203
+ REA loads its packaged Java `HeadlessScript` with `-scriptPath`, imports the target into a mode-0700 temporary project, enables `-readOnly` and `-deleteProject`, caps auto-analysis at 300 seconds with two CPUs and a 2 GiB Java heap, and authenticates every request over a mode-0600 Unix socket. It isolates Ghidra home/cache/config/temp paths and removes the owned project, socket, process group, and runtime root on close, cancellation, timeout, or process exit.
204
+
205
+ The Ghidra adapter declares 18 direct and enhanced operations. Its ten inventory operations are `list_documents`, `list_procedures`, `list_strings`, `list_names`, `list_segments`, `address_name`, `procedure_address`, `resolve_containing_procedure`, `search_procedures`, and `search_strings`. It also admits `procedure_info`, `procedure_pseudo_code`, `procedure_assembly`, `procedure_callers`, `procedure_callees`, `procedure_references`, `xrefs`, and `analyze_function`. These capabilities enable the shared Swift/Objective-C inventory workflows, `binary_overview`, `batch_decompile`, `get_call_graph`, `find_xrefs_to_name`, `trace_feature`, and complete function dossiers. Default-space addresses are lowercase `0x` hexadecimal. Other spaces, including `EXTERNAL`, use `<percent-encoded-space>:0x<hex>`. Symbol results identify primary, dynamic, external, type, and source facts; procedures distinguish external functions and thunks; strings identify charset, missing-terminator state, byte length, and value truncation; memory-block ends are exclusive and permissions come directly from Ghidra.
206
+
207
+ The bridge serves operations only after auto-analysis completes. Each Program owns one persistent `DecompInterface`; a bounded 32-request FIFO serializes Ghidra API access, and every decompile has a 30-second native deadline. Reference results preserve Ghidra's call/jump/data/read/write/indirect/computed/external facts, while unresolved targetless flows remain explicitly unknown. Synthetic entry-point references without actionable memory sources are omitted. Pseudocode and assembly are provider-specific observations, not original source or Hopper-equivalent text. An analysis timeout, scan or inventory safety limit, request timeout, or oversized response fails explicitly instead of returning a partial result labeled complete.
208
+
209
+ `npm run verify:ghidra` compiles source-owned x86-64 debug and stripped ELF, AArch64 ELF, x86-64 PE, and x86-64 Mach-O fixtures. Against real Ghidra 12.1.2 it validates every admitted operation, direct and indirect calls, imports/exports/thunks, typed references, strings/xrefs, multi-block CFG, cancellation, deadlines, concurrency, malformed inputs, and complete process/project cleanup. Set `REA_CC`, `REA_CLANG`, or `REA_LLD_LINK` only when the corresponding compiler command is not on `PATH`.
210
+
189
211
  To remove only REA-owned MCP registrations and the managed skill:
190
212
 
191
213
  ```bash
@@ -240,13 +262,15 @@ Exports never replace an existing file unless `--overwrite` is explicit. Imports
240
262
 
241
263
  Provider-neutral analysis snapshots persist successful, immutable REA calls and
242
264
  their Evidence v2 records. They are exact caches rather than Hopper databases:
243
- REA reuses an entry only when the binary digest, format, architecture, operation
244
- parameters, loader arguments, and provider identity match. Custom Hopper loader
245
- overrides disable snapshots because their provider configuration cannot be
246
- replayed safely. Cursor-dependent and mutating calls are never cached. Snapshot
247
- files can contain proprietary analysis results and local
248
- paths, so REA keeps them local, writes them with owner-only permissions, and
249
- requires a separate approved root:
265
+ REA reuses a v2 entry only when the binary digest, kind, format, architecture,
266
+ operation parameters, concrete provider build, and canonical analysis-profile
267
+ digest match. Hopper loader defaults and configured overrides are normalized by
268
+ the Hopper adapter and committed to that profile, so overrides occupy a distinct
269
+ safe cache partition instead of disabling snapshots. Snapshot v1 cannot prove
270
+ those semantics and is rejected with recapture guidance. Cursor-dependent and
271
+ mutating calls are never cached. Snapshot files can contain proprietary analysis
272
+ results and local paths, so REA keeps them local, writes them with owner-only
273
+ permissions, and requires a separate approved root:
250
274
 
251
275
  ```bash
252
276
  export REA_ANALYSIS_SNAPSHOT_ROOTS_JSON='["/absolute/path/to/analysis"]'
@@ -255,7 +279,7 @@ rea analyze /absolute/path/to/app --snapshot /absolute/path/to/analysis/app.json
255
279
  rea analyze /absolute/path/to/app --snapshot /absolute/path/to/analysis/app.json
256
280
  ```
257
281
 
258
- Exact CLI evidence replays happen before any provider starts. In MCP sessions,
282
+ Exact CLI evidence replays happen before any provider process starts. In MCP sessions,
259
283
  pass `snapshot_path` to `open_binary` to import a snapshot atomically while
260
284
  opening its matching target; MCP providers may still start before a cached call
261
285
  is replayed. Pass `snapshot_path` and, when required, `overwrite: true` to
@@ -310,11 +334,14 @@ The public interface describes what the agent is trying to learn. Providers deci
310
334
 
311
335
  ## Current status
312
336
 
313
- REA is already useful for native application investigation on macOS:
337
+ REA is already useful for native application, browser, and Electron investigation on supported macOS and Linux hosts:
314
338
 
315
- - Open Mach-O, ELF, PE, `.app`, ZIP, APK, IPA, ASAR, plist, JavaScript, source-map, and Hopper database targets.
339
+ - Open Mach-O, ELF, PE, `.app`, ZIP, APK, IPA, ASAR, plist, JavaScript, source-map, and generic analysis-database targets; Hopper remains the only adapter that accepts legacy `.hop` databases.
340
+ - Discover deep-analysis candidates without starting them, choose deterministically, and retain one immutable provider/profile binding until an explicit switch or close; provider failures never trigger transparent fallback.
316
341
  - Attach to a user-owned Chrome-family browser over a configured loopback CDP endpoint; capture exact-origin web structure, safe metadata, approved value-free payload shapes, bundle/source-map evidence, WebMCP declarations, user-action timelines, capture diffs, and explicitly approved screenshots without navigation or JavaScript evaluation.
317
342
  - Inspect Electron `file://` renderer pages through a separate canonical-root permission boundary without invoking Electron APIs; script contents remain separately approved and byte bounded.
343
+ - Validate and canonically serialize a provider-neutral [JavaScript Application Graph v1](docs/javascript-application-graph.md) spanning packages, ASAR entries, Electron roles, JavaScript/source-map entities, browser/runtime instances, IPC, endpoints, storage, and native add-ons. This shipped domain contract performs no extraction or I/O by itself.
344
+ - Reconstruct bounded static package, entrypoint, Webpack/Rspack module, import, worker, endpoint, storage, source-map, and native-add-on structure from a local directory or ASAR through an AST-only [application service](docs/javascript-artifact-reconstruction.md). The service does not execute bootstrap code and does not add a standalone CLI/MCP tool yet.
318
345
  - Traverse content-addressed artifact graphs without extraction; on macOS, read-only DMG traversal additionally requires `native_mount_approved: true` and `REA_ARTIFACT_NATIVE_MOUNT_ENABLED=true`. Materialize only approved occurrences into absent output roots.
319
346
  - Build bounded function dossiers with pseudocode, assembly, CFG edges, comments, calls, references, strings, and names.
320
347
  - Search and trace features across symbols, strings, metadata, references, and call paths.
@@ -350,26 +377,37 @@ rea inspect-web-page http://127.0.0.1:9222 TARGET_ID --approved --json
350
377
 
351
378
  All eight browser tools expose the same Evidence v2 contracts over CLI and MCP. Inspection is passive: REA does not evaluate page JavaScript, navigate, click, close the page, or close the browser. Query values, credentials, cookies, authorization headers, storage values, and raw JSON or WebSocket values are never retained. Separately approved captures can retain bounded redacted console primitives, value-free JSON/WebSocket shapes, script sources, accessibility text, or screenshot pixels. Existing activity before attach is explicitly unavailable. See [Website observation with CDP](docs/browser-observation.md) for browser startup, schemas, limits, and the threat model.
352
379
 
380
+ Exact package, tool-family, provider, setup-client, public schema-version, and CLI facts are generated from source in [`docs/product-catalog.json`](docs/product-catalog.json). `npm run docs:check` verifies that this catalog, the narrative documentation, TypeDoc, and generated schemas have not drifted.
381
+
353
382
  ## Roadmap
354
383
 
355
- REA is growing into a toolkit for understanding software across static artifacts and observed behavior. The next capability families are:
384
+ REA is growing into a toolkit for understanding software across static artifacts and observed behavior. The [current status](#current-status) above is the shipped baseline; the items below are planned work.
385
+
386
+ ### Now
387
+
388
+ 1. **Maintain truthful product metadata** — extend the shipped canonical catalog and drift checks whenever versions, tools, providers, schemas, setup clients, or CLI capabilities change.
389
+ 2. **Electron boundary extraction and high-level surface** — extend the shipped static artifact projector with contextBridge, IPC, utility-process, and native-export boundaries, then expose one provider-neutral CLI/MCP workflow without widening authority.
390
+ 3. **Cross-provider conformance growth** — add source-owned architectures and difficult indirect/thunk cases while preserving semantic comparison and provider-specific text boundaries.
391
+
392
+ ### Next
393
+
394
+ 1. **Cross-layer tracing and version comparison** — trace renderer behavior through preload, IPC, main-process, storage, network, and native boundaries, then compare those paths across application versions.
395
+ 2. **Deeper JavaScript and source recovery** — add historical-source matching, rechunked/minified cross-version matching, and stronger static/runtime reconciliation on top of the shipped AST-only Webpack/Rspack reconstruction.
396
+ 3. **Deterministic behavior harnesses** — extend process ownership, protocol fixtures, filesystem observation, reconnects, and cross-version behavioral comparison.
397
+
398
+ ### Later
356
399
 
357
- 1. **Artifact decomposition** — DMG, ASAR, ZIP, packages, universal-binary slices, application resources, embedded frameworks, mobile packages, and artifact graphs.
358
- 2. **Web and Electron investigation** — extend the shipped passive CDP, bundle, visual-diff, and file-page observation with approved interaction, controlled replay, Electron IPC observation, semantic UI differences, and deeper JavaScript reconstruction.
359
- 3. **Deterministic behavior harnesses** — stronger process-tree ownership, protocol fixtures, network policy, filesystem tracing, signals, reconnects, and cross-version comparison.
360
- 4. **JavaScript and source recovery** — bundle indexing, AST/module reconstruction, source-map discovery, historical-source matching, and CodeDB-backed cross-references.
361
- 5. **Runtime observation** — approval-gated LLDB, Frida, system logs, process and filesystem observers, and native API tracing.
362
- 6. **More static-analysis providers** — native platform utilities first, followed by Ghidra, IDA/Hex-Rays, Binary Ninja, Rizin, LIEF, and other engines behind provider-neutral capabilities.
363
- 7. **More targets and platforms** — Windows-native providers and ConPTY verification, Linux parity, websites and APIs, mobile artifacts, firmware, document formats, and other software-defined systems.
364
- 8. **Differential reconstruction expansion** — add automatic function matching, protocol/UI comparison, controlled replay, residual-unknown planning, and reconstruction verification to persistent version runs.
400
+ 1. **Controlled interaction and replay** — keep approved JavaScript execution, browser interaction, Electron instrumentation, and fuzzing behind a separate authority from passive observation.
401
+ 2. **Native runtime observation** — approval-gated LLDB, Frida, system logs, process/filesystem observers, and native API tracing.
402
+ 3. **Additional providers and targets** — evaluate IDA/Hex-Rays, Binary Ninja, Rizin, LIEF, Windows-native providers, mobile artifacts, firmware, document formats, and other software-defined systems.
365
403
 
366
- Roadmap items describe direction, not shipped support. New providers must produce the same evidence and safety metadata as existing capabilities before they become part of the public workflow. Once REA has multiple optional toolchains, setup can become capability-selective; the consent rules for that future work are recorded in the [installation roadmap](docs/roadmap.md).
404
+ New providers must produce the same evidence and safety metadata as existing capabilities before they become part of the public workflow. Once REA has multiple optional toolchains, setup can become capability-selective; the consent rules for that future work are recorded in the [installation roadmap](docs/roadmap.md).
367
405
 
368
- See the [static-analysis provider evaluation](docs/provider-evaluation.md) for the current research matrix and admission gate.
406
+ See the [static-analysis provider evaluation](docs/provider-evaluation.md) for the shipped Ghidra function-analysis boundary, remaining admission gates, and provider comparison matrix, and [ADR-0001](docs/adr/0001-provider-selection-and-analysis-profiles.md) for the binding, selection, profile, snapshot, and compatibility decisions.
369
407
 
370
408
  ## Using REA with other agents
371
409
 
372
- Setup currently configures Claude Desktop and Cursor automatically. Any agent that supports local MCP servers can use REA with the configuration below.
410
+ Setup detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin. It automatically configures the first six when present; detected Devin installations are reported but left unchanged. Any agent that supports local MCP servers can use REA with the configuration below.
373
411
 
374
412
  ### Manual MCP configuration
375
413
 
@@ -396,14 +434,17 @@ flowchart LR
396
434
  Agent["Agent"] --> REA["REA<br/>CLI + MCP"]
397
435
  Terminal --> REA
398
436
  REA --> Workspace["Investigation workspace<br/>evidence + artifacts + captures"]
399
- Workspace --> Router["Capability router"]
400
- Router --> Hopper["Hopper provider"]
401
- Router --> Native["Native macOS provider"]
402
- Router --> Artifact["Artifact graph provider"]
403
- Router --> Browser["Browser CDP provider"]
404
- Router --> Process["Process capture provider"]
405
- Router -. roadmap .-> More["Dynamic and additional<br/>static providers"]
406
- Hopper --> Target["Target software"]
437
+ REA --> Session["Target-bound session router"]
438
+ Session --> Registry["Deep-provider registry<br/>deterministic selection"]
439
+ Registry --> Hopper["Hopper provider"]
440
+ Registry --> Ghidra["Ghidra provider<br/>read-only inventory + function analysis"]
441
+ Hopper --> Runtime["Owned provider runtime<br/>deadline + bounded diagnostics + cleanup"]
442
+ Ghidra --> Runtime
443
+ Session --> Native["Native macOS provider"]
444
+ Session --> Artifact["Artifact graph provider"]
445
+ REA --> Browser["Browser CDP provider"]
446
+ REA --> Process["Process capture provider"]
447
+ Runtime --> Target["Target software"]
407
448
  Process --> Target
408
449
  Native --> Target
409
450
  Artifact --> Target
@@ -444,6 +485,42 @@ rea mcp
444
485
 
445
486
  REA accepts a Mac `.app` folder directly. If an agent cannot find an app by name, tell it where the app is installed.
446
487
 
488
+ ### Choosing a deep-analysis provider
489
+
490
+ Every deep-analysis open resolves a provider before creating its client. The
491
+ same selector and precedence apply to the CLI, MCP, and startup configuration:
492
+
493
+ ```bash
494
+ rea providers --json
495
+ rea analyze /absolute/path/to/program --provider hopper
496
+ REA_ANALYSIS_PROVIDER=hopper rea decompile /absolute/path/to/program 0x1000
497
+ ```
498
+
499
+ For MCP, pass the optional selector on `open_binary`:
500
+
501
+ ```json
502
+ {
503
+ "path": "/absolute/path/to/program",
504
+ "provider_id": "hopper"
505
+ }
506
+ ```
507
+
508
+ The request-level `provider_id` or `--provider` wins over
509
+ `REA_ANALYSIS_PROVIDER`; all accept a provider ID or `auto`. Automatic selection
510
+ binds the sole usable deep candidate, reports `ambiguous` when several are
511
+ usable, and can leave an artifact-only target unbound so its disjoint artifact
512
+ operations still work. An explicit unknown, unavailable, or unsupported
513
+ provider fails with candidate IDs, stable rejection codes, and actionable local
514
+ diagnostics. `binary_session`, `rea providers`, and `rea capabilities` expose
515
+ the authoritative `analysis_provider_candidates` and
516
+ `analysis_provider_binding` fields. Reopening the same target without a selector
517
+ keeps its binding; runtime failure never selects another provider silently.
518
+ Ghidra can appear as an available, target-compatible candidate after doctor
519
+ validates its exact installation. Its capability list contains the 18 admitted
520
+ read-only inventory and function-analysis operations; selecting it still does
521
+ not make Hopper-only GUI or mutation operations available and never triggers a
522
+ silent fallback.
523
+
447
524
  ### CLI exit status
448
525
 
449
526
  | Status | Meaning |
@@ -506,7 +583,7 @@ unpacked; REA does not silently accept the mismatched artifact.
506
583
 
507
584
  ## Security model
508
585
 
509
- REA does not provide a hosted analysis service. Hopper communication uses an authenticated private local socket. Dynamic capabilities are disabled by default and require both operator policy and explicit per-call approval. REA is not a security sandbox: providers and launched targets run with the current user's permissions, and each capability reports its side effects and limitations. Report vulnerabilities through the private process in [SECURITY.md](SECURITY.md).
586
+ REA does not provide a hosted analysis service. Hopper and Ghidra bridge communication uses authenticated private local sockets. Dynamic capabilities are disabled by default and require both operator policy and explicit per-call approval. REA is not a security sandbox: providers and launched targets run with the current user's permissions, and each capability reports its side effects and limitations. Report vulnerabilities through the private process in [SECURITY.md](SECURITY.md).
510
587
 
511
588
  ## FAQ
512
589
 
@@ -531,6 +608,13 @@ No. Setup can install Hopper for you, but Hopper remains separate software with
531
608
 
532
609
  </details>
533
610
 
611
+ <details>
612
+ <summary><strong>Does REA install or include Ghidra or Java?</strong></summary>
613
+
614
+ No. Ghidra support is bring-your-own. REA packages only its Java bridge source, validates the exact supported Ghidra 12.1.2 and 64-bit JDK 21 installation, and loads that bridge through Ghidra's external script path after setup approval records the paths.
615
+
616
+ </details>
617
+
534
618
  <details>
535
619
  <summary><strong>Does REA upload the app?</strong></summary>
536
620
 
@@ -548,7 +632,7 @@ No decompiler can guarantee the original source. REA gives an agent pseudocode,
548
632
  <details>
549
633
  <summary><strong>Which agents can use REA?</strong></summary>
550
634
 
551
- Any agent that can run a local MCP server can use the manual configuration. Setup currently detects and configures Claude Desktop and Cursor automatically.
635
+ Any agent that can run a local MCP server can use the manual configuration. Setup detects Claude Code, Claude Desktop, Codex, Cursor, Gemini CLI, Windsurf, and Devin; it automatically configures the first six when present and reports Devin without modifying it.
552
636
 
553
637
  </details>
554
638
 
@@ -558,7 +642,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, architecture, tests, and relea
558
642
 
559
643
  ## Project links
560
644
 
561
- [npm](https://www.npmjs.com/package/rea-agents) · [Issues](https://github.com/morluto/rea/issues) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) · [Hopper](https://www.hopperapp.com/)
645
+ [npm](https://www.npmjs.com/package/rea-agents) · [Issues](https://github.com/morluto/rea/issues) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) · [Hopper](https://www.hopperapp.com/) · [Ghidra](https://github.com/NationalSecurityAgency/ghidra)
562
646
 
563
647
  ## License
564
648