rea-agents 2.0.0 → 2.2.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 (273) hide show
  1. package/README.md +103 -38
  2. package/bridge/ghidra/ReaGhidraBridge.java +96 -11
  3. package/dist/application/AndroidApplicationService.js +17 -0
  4. package/dist/application/AppleApplicationService.js +17 -0
  5. package/dist/application/ArtifactExtraction.js +1 -1
  6. package/dist/application/ArtifactInventory/classify.js +42 -0
  7. package/dist/application/ArtifactInventory/hash.js +43 -0
  8. package/dist/application/ArtifactInventory/reader.js +41 -0
  9. package/dist/application/ArtifactInventory/scanCanonical.js +155 -0
  10. package/dist/application/ArtifactInventory/scanReader.js +124 -0
  11. package/dist/application/ArtifactInventory/types.js +10 -0
  12. package/dist/application/ArtifactInventory.js +9 -351
  13. package/dist/application/AuthorizedArtifactInventory.js +2 -2
  14. package/dist/application/BinarySession.js +47 -270
  15. package/dist/application/BinarySessionExecution.js +28 -0
  16. package/dist/application/BinarySessionOpen.js +39 -0
  17. package/dist/application/BinarySessionRecords.js +149 -0
  18. package/dist/application/BinarySessionStatus.js +75 -0
  19. package/dist/application/CapabilityInventory.js +24 -2
  20. package/dist/application/ClientRegistrationStatus.js +11 -4
  21. package/dist/application/CrossVersionInventory.js +8 -2
  22. package/dist/application/CrossVersionInvestigation.js +1 -23
  23. package/dist/application/CrossVersionInvestigationCollections.js +23 -0
  24. package/dist/application/DirectAnalysis.js +47 -44
  25. package/dist/application/Doctor.js +156 -238
  26. package/dist/application/DoctorDiagnostics.js +180 -0
  27. package/dist/application/ElectronBoundaryAnalysis.js +23 -7
  28. package/dist/application/ElectronBoundaryGraphWindows.js +32 -8
  29. package/dist/application/EnhancedToolPagination.js +22 -0
  30. package/dist/application/EnhancedToolTypes.js +4 -0
  31. package/dist/application/EnhancedTools.js +20 -37
  32. package/dist/application/InstrumentedJavaScriptReplayHost.js +36 -0
  33. package/dist/application/InventoryProjectionEvidence.js +41 -0
  34. package/dist/application/InvestigationProviders.js +12 -0
  35. package/dist/application/InvestigationWorkspaceStore.js +24 -10
  36. package/dist/application/JavaScriptArtifactAnalysis.js +45 -6
  37. package/dist/application/JavaScriptArtifactFiles.js +6 -2
  38. package/dist/application/JavaScriptArtifactGraphBuilder.js +23 -1
  39. package/dist/application/JavaScriptArtifactGraphBundlers.js +225 -0
  40. package/dist/application/JavaScriptArtifactGraphContext.js +37 -36
  41. package/dist/application/JavaScriptArtifactGraphDocuments.js +27 -4
  42. package/dist/application/JavaScriptArtifactGraphFindings.js +54 -8
  43. package/dist/application/JavaScriptArtifactGraphStructure.js +29 -101
  44. package/dist/application/JavaScriptArtifactPathResolution.js +269 -0
  45. package/dist/application/JavaScriptArtifactReconstruction.js +1 -1
  46. package/dist/application/JavaScriptJsonModules.js +39 -0
  47. package/dist/application/JavaScriptModuleRelationships.js +262 -0
  48. package/dist/application/JavaScriptReplayPermission.js +16 -0
  49. package/dist/application/JavaScriptReplayService.js +182 -156
  50. package/dist/application/LinuxHopper.js +10 -0
  51. package/dist/application/MacHopper.js +22 -11
  52. package/dist/application/NodeRuntimeCharacterizationService.js +196 -0
  53. package/dist/application/PermissionAuthority.js +106 -63
  54. package/dist/application/ProcessCaptureCapability.js +1 -1
  55. package/dist/application/ProcessCapturePermission.js +13 -0
  56. package/dist/application/ProcessCli.js +2 -12
  57. package/dist/application/ProcessHarness.js +1 -1
  58. package/dist/application/ProcessPairedExperiment.js +72 -0
  59. package/dist/application/ProjectPermissionStore.js +48 -9
  60. package/dist/application/RealHopperAssertions.js +76 -0
  61. package/dist/application/ReconstructionCoverageService.js +69 -0
  62. package/dist/application/ReconstructionCoverageWorkspaceStore.js +31 -0
  63. package/dist/application/RuntimeExecutableDiagnostics.js +172 -0
  64. package/dist/application/Setup.js +148 -260
  65. package/dist/application/SetupClientConfiguration.js +224 -0
  66. package/dist/application/SetupClients.js +24 -2
  67. package/dist/application/SetupPlan.js +124 -12
  68. package/dist/application/SetupSkill.js +54 -36
  69. package/dist/application/SupportedClients.js +1 -0
  70. package/dist/application/Uninstall.js +12 -3
  71. package/dist/application/Upgrade.js +16 -1
  72. package/dist/application/WindowsCapabilities.js +86 -0
  73. package/dist/artifacts/AsarArtifactReader.js +11 -0
  74. package/dist/browser/BrowserProcessStartup.js +88 -0
  75. package/dist/browser/CdpCaptureDocuments.js +12 -8
  76. package/dist/browser/CdpCaptureEventBodyShapes.js +75 -0
  77. package/dist/browser/CdpCaptureEventHandlers.js +336 -0
  78. package/dist/browser/CdpCaptureEventHelpers.js +71 -0
  79. package/dist/browser/CdpCaptureEventState.js +1 -0
  80. package/dist/browser/CdpCaptureEventTypes.js +1 -0
  81. package/dist/browser/CdpCaptureEvents.js +29 -496
  82. package/dist/browser/CdpObservationSession.js +51 -8
  83. package/dist/browser/CdpPageCapture.js +12 -133
  84. package/dist/browser/CdpPageCaptureScripts.js +97 -0
  85. package/dist/browser/CdpPageCaptureWorkers.js +46 -0
  86. package/dist/browser/CdpWebMcpDiscovery.js +38 -14
  87. package/dist/browser/PngVisualDiff.js +9 -2
  88. package/dist/catalogIdentity.js +4 -0
  89. package/dist/cli/artifactCommands.js +82 -0
  90. package/dist/cli/coreAnalysisCommands.js +232 -0
  91. package/dist/cli/managedCommands.js +397 -0
  92. package/dist/cli/managedProjectGraphCommand.js +24 -0
  93. package/dist/cli/options.js +9 -0
  94. package/dist/cli/setupCommands.js +113 -0
  95. package/dist/cli/types.js +1 -0
  96. package/dist/cli/utilityCommands.js +122 -0
  97. package/dist/cli.js +10 -768
  98. package/dist/cliApplicationCommands.js +118 -4
  99. package/dist/cliBrowserAdvancedCommands.js +73 -16
  100. package/dist/cliBrowserCommands.js +39 -115
  101. package/dist/cliCommandNames.js +4 -0
  102. package/dist/cliElectronCommands.js +33 -62
  103. package/dist/cliEvidenceCommands.js +13 -2
  104. package/dist/cliInvestigationCommands.js +53 -10
  105. package/dist/cliObservationOptions.js +137 -0
  106. package/dist/cliPolicyCommands.js +80 -46
  107. package/dist/cliSetup.js +306 -0
  108. package/dist/config/environment.js +107 -0
  109. package/dist/config/parseConfig.js +228 -0
  110. package/dist/config/parsers.js +68 -0
  111. package/dist/config/permissions.js +30 -0
  112. package/dist/config/types.js +1 -0
  113. package/dist/config.js +1 -375
  114. package/dist/contracts/applicationToolContracts.js +134 -0
  115. package/dist/contracts/electronToolContracts.js +51 -3
  116. package/dist/contracts/managedToolContracts.js +8 -3
  117. package/dist/contracts/managedWorkflowToolContracts.js +3 -3
  118. package/dist/contracts/providerSelection.js +2 -0
  119. package/dist/contracts/sessionStatusContract.js +26 -0
  120. package/dist/contracts/toolContractTypes.js +12 -1
  121. package/dist/contracts/toolContracts.js +5 -12
  122. package/dist/contracts/toolEffects.js +14 -0
  123. package/dist/contracts/toolOutputSchemaGroups.js +274 -0
  124. package/dist/contracts/toolOutputSchemaPrimitives.js +328 -0
  125. package/dist/contracts/toolOutputSchemas.js +2 -550
  126. package/dist/domain/analysisErrorPresentation.js +234 -0
  127. package/dist/domain/analysisErrorProjection.js +284 -0
  128. package/dist/domain/androidApplication.js +206 -0
  129. package/dist/domain/appleApplication.js +221 -0
  130. package/dist/domain/artifactComparison.js +34 -15
  131. package/dist/domain/binaryTarget.js +87 -37
  132. package/dist/domain/boundedCartesianProjection.js +15 -0
  133. package/dist/domain/browserObservation.js +1 -285
  134. package/dist/domain/browserObservationSchemas.js +286 -0
  135. package/dist/domain/electronStaticAnalysisBrowser.js +14 -2
  136. package/dist/domain/errors.js +4 -486
  137. package/dist/domain/functionComparison.js +4 -165
  138. package/dist/domain/functionComparisonDimensions.js +164 -0
  139. package/dist/domain/javascriptApplicationVersionItems.js +18 -6
  140. package/dist/domain/javascriptApplicationVersionKeys.js +8 -8
  141. package/dist/domain/javascriptExportInstrumentation.js +97 -0
  142. package/dist/domain/javascriptFeatureTraversal.js +19 -7
  143. package/dist/domain/javascriptRuntimeStaticCandidates.js +3 -1
  144. package/dist/domain/javascriptSemanticAnalysis.js +386 -0
  145. package/dist/domain/javascriptSemanticIr.js +30 -0
  146. package/dist/domain/javascriptSemanticProjection.js +366 -0
  147. package/dist/domain/javascriptSemanticState.js +40 -0
  148. package/dist/domain/javascriptSemanticTraversal.js +22 -0
  149. package/dist/domain/javascriptSemanticValues.js +352 -0
  150. package/dist/domain/javascriptStaticAnalysis.js +5 -221
  151. package/dist/domain/javascriptStaticAnalysisBundler.js +209 -0
  152. package/dist/domain/javascriptStaticAnalysisCalls.js +180 -0
  153. package/dist/domain/javascriptStaticAnalysisHelpers.js +71 -2
  154. package/dist/domain/knownPageCoverage.js +21 -0
  155. package/dist/domain/managedApplicationGraph.js +14 -364
  156. package/dist/domain/managedApplicationGraphCoverage.js +170 -0
  157. package/dist/domain/managedApplicationGraphNodeCoverage.js +6 -0
  158. package/dist/domain/managedApplicationGraphNodes.js +336 -0
  159. package/dist/domain/managedArtifact.js +16 -8
  160. package/dist/domain/managedMemberComparison.js +37 -391
  161. package/dist/domain/managedMemberComparisonCoverage.js +72 -0
  162. package/dist/domain/managedMemberComparisonMatch.js +356 -0
  163. package/dist/domain/managedNativeVerification.js +27 -389
  164. package/dist/domain/managedNativeVerificationMatch.js +272 -0
  165. package/dist/domain/managedNativeVerificationSchemas.js +141 -0
  166. package/dist/domain/managedReconstruction.js +82 -69
  167. package/dist/domain/managedRuntimeCorrelation.js +12 -3
  168. package/dist/domain/nodeRuntimeCharacterization.js +66 -0
  169. package/dist/domain/permissionPolicy.js +2 -0
  170. package/dist/domain/processComparison.js +19 -0
  171. package/dist/domain/processPairedExperiment.js +128 -0
  172. package/dist/domain/reconstructionCoverage.js +387 -0
  173. package/dist/domain/reconstructionCoverageEvaluation.js +212 -0
  174. package/dist/domain/reconstructionVerificationSchemas.js +8 -0
  175. package/dist/domain/replayMachine.js +316 -0
  176. package/dist/domain/replayMachineRuntime.js +215 -0
  177. package/dist/domain/runtimeCharacterization.js +85 -0
  178. package/dist/domain/runtimeIdentification.js +210 -0
  179. package/dist/domain/webBundleAnalyzer.js +3 -409
  180. package/dist/domain/webBundleAnalyzerAst.js +77 -0
  181. package/dist/domain/webBundleAnalyzerInspection.js +307 -0
  182. package/dist/domain/webBundleAnalyzerResult.js +120 -0
  183. package/dist/dotnet/ManagedArtifactInspector.js +50 -29
  184. package/dist/dotnet/ManagedMemberInspector.js +51 -785
  185. package/dist/dotnet/ManagedMemberInspectorCore.js +297 -0
  186. package/dist/dotnet/ManagedMemberInstructionDecoder.js +427 -0
  187. package/dist/dotnet/ManagedMemberRows.js +120 -0
  188. package/dist/dotnet/ManagedMetadataInventory.js +42 -306
  189. package/dist/dotnet/ManagedMetadataInventoryRows.js +292 -0
  190. package/dist/dotnet/ManagedMetadataLayout.js +48 -111
  191. package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
  192. package/dist/dotnet/ManagedMethodBodyReader.js +143 -0
  193. package/dist/dotnet/ManagedNativeBoundaryHelpers.js +311 -0
  194. package/dist/dotnet/ManagedNativeBoundaryInspector.js +102 -350
  195. package/dist/dotnet/ManagedPeReader.js +59 -28
  196. package/dist/evaluation/CodexAgentEval.js +132 -0
  197. package/dist/generatedPackageMetadata.js +2 -2
  198. package/dist/ghidra/GhidraClient.js +76 -91
  199. package/dist/ghidra/GhidraClientStartup.js +29 -0
  200. package/dist/ghidra/GhidraClientWire.js +34 -0
  201. package/dist/ghidra/GhidraDefaults.js +1 -1
  202. package/dist/ghidra/GhidraDiagnostics.js +6 -1
  203. package/dist/ghidra/GhidraInstallation.js +20 -15
  204. package/dist/ghidra/GhidraLauncher.js +93 -29
  205. package/dist/ghidra/GhidraProvider.js +61 -161
  206. package/dist/ghidra/GhidraProviderCapabilities.js +173 -0
  207. package/dist/ghidra/GhidraSessionValues.js +2 -0
  208. package/dist/ghidra/GhidraSocketConnection.js +44 -7
  209. package/dist/ghidra/GhidraTargetSnapshot.js +30 -0
  210. package/dist/ghidra/GhidraTransport.js +71 -0
  211. package/dist/identity.js +4 -2
  212. package/dist/main/messages.js +5 -0
  213. package/dist/main/reload.js +49 -0
  214. package/dist/main/shutdown.js +25 -0
  215. package/dist/main/startup.js +14 -0
  216. package/dist/main/state.js +26 -0
  217. package/dist/main/transport.js +61 -0
  218. package/dist/main/types.js +1 -0
  219. package/dist/main.js +35 -146
  220. package/dist/process/PrivateRuntimeRoot.js +3 -2
  221. package/dist/process/ProcessOwnership.js +35 -0
  222. package/dist/process/ProviderProcess.js +2 -0
  223. package/dist/replay/JavaScriptReplayWorker.js +64 -50
  224. package/dist/replay/LinuxJavaScriptReplayRunner.js +173 -390
  225. package/dist/replay/LinuxJavaScriptReplaySandbox.js +140 -0
  226. package/dist/replay/ReplayOutcome.js +95 -0
  227. package/dist/replay/ReplayProcessLifecycle.js +71 -0
  228. package/dist/server/ProcessCaptureElicitation.js +157 -0
  229. package/dist/server/createServer.js +124 -56
  230. package/dist/server/javascriptApplicationResult.js +85 -0
  231. package/dist/server/registerApplicationTools/characterization.js +57 -0
  232. package/dist/server/registerApplicationTools/compareVersions.js +34 -0
  233. package/dist/server/registerApplicationTools/controlledReplay.js +38 -0
  234. package/dist/server/registerApplicationTools/coverage.js +84 -0
  235. package/dist/server/registerApplicationTools/helpers.js +42 -0
  236. package/dist/server/registerApplicationTools/traceFeature.js +26 -0
  237. package/dist/server/registerApplicationTools/types.js +1 -0
  238. package/dist/server/registerApplicationTools.js +10 -112
  239. package/dist/server/registerBrowserTools.js +59 -83
  240. package/dist/server/registerElectronTools.js +48 -49
  241. package/dist/server/registerEnhancedTools.js +34 -42
  242. package/dist/server/registerEvidenceResources.js +56 -0
  243. package/dist/server/registerInvestigationTools/helpers.js +74 -0
  244. package/dist/server/registerInvestigationTools/types.js +1 -0
  245. package/dist/server/registerInvestigationTools.js +83 -116
  246. package/dist/server/registerJavaScriptApplicationGraphResource.js +69 -0
  247. package/dist/server/registerManagedTools.js +18 -1
  248. package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +65 -0
  249. package/dist/server/registerManagedWorkflowTools/contract.js +8 -0
  250. package/dist/server/registerManagedWorkflowTools/evidence.js +43 -0
  251. package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +39 -0
  252. package/dist/server/registerManagedWorkflowTools/planManagedRuntimeCorrelation.js +39 -0
  253. package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +52 -0
  254. package/dist/server/registerManagedWorkflowTools/types.js +1 -0
  255. package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +75 -0
  256. package/dist/server/registerManagedWorkflowTools.js +10 -274
  257. package/dist/server/registerOfficialTools.js +73 -59
  258. package/dist/server/registerSessionRecordTools.js +137 -0
  259. package/dist/server/registerSessionStatusTool.js +97 -26
  260. package/dist/server/registerSessionTools.js +60 -164
  261. package/dist/server/sessionAvailabilityPolicy.js +10 -0
  262. package/dist/server/toolRegistrationOptions.js +101 -3
  263. package/dist/server/toolResult.js +15 -4
  264. package/package.json +11 -11
  265. package/skills/reverse-engineer-anything/SKILL.md +76 -0
  266. package/skills/reverse-engineer-anything/references/controlled-replay.md +12 -0
  267. package/skills/reverse-engineer-anything/references/evidence-workflows.md +33 -0
  268. package/skills/reverse-engineer-anything/references/javascript-applications.md +25 -0
  269. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +36 -0
  270. package/skills/reverse-engineer-anything/references/runtime-observation.md +24 -0
  271. package/scripts/prepare-node-pty.mjs +0 -35
  272. package/scripts/rebuild-native.mjs +0 -22
  273. package/skills/rea-analysis/SKILL.md +0 -222
@@ -1,222 +0,0 @@
1
- ---
2
- name: rea-analysis
3
- description: Reverse engineer native, Electron/JavaScript, and web applications with REA. Connect static artifacts to passive runtime evidence, explain how features work, and build a version tailored to the user's project.
4
- metadata:
5
- version: "20"
6
- tool_count: 91
7
- catalog_digest: "bdf382596e1a00ffc9d59de287b2ad647eeebe629c48a8f8cf158b300363ce53"
8
- ---
9
-
10
- # REA
11
-
12
- Use REA when the user wants to understand how an app or feature works, compare app versions, decompile code, or build a similar feature.
13
-
14
- For a website already open in a user-owned Chrome-family browser, start with
15
- `list_browser_targets` and `inspect_web_page` instead of opening a binary. Use
16
- `analyze_web_bundle`, `observe_web_session`, `discover_webmcp_tools`, capture
17
- comparison, or screenshot tools only for the corresponding investigation. Ask
18
- the user to approve the exact page origins and loopback CDP endpoint before the
19
- first call. Browser observation is disabled unless the operator configured
20
- `REA_BROWSER_OBSERVE_ENABLED`, `REA_BROWSER_CDP_ENDPOINTS_JSON`, and
21
- `REA_BROWSER_ALLOWED_ORIGINS_JSON` before starting REA.
22
-
23
- Browser inspection is passive. Never claim that it clicked, navigated,
24
- evaluated page JavaScript, captured prior activity, or contained the page's
25
- network. Query values, credentials, cookies, authorization headers, storage
26
- values, and raw WebSocket or JSON values are deliberately absent. Accessibility
27
- text, bounded redacted console primitives, value-free JSON/WebSocket shapes,
28
- script sources, storage key names, source-map fetches, and screenshot pixels
29
- each require their documented independent opt-in or approval. Treat truncation,
30
- policy filtering, and attach-window coverage as explicit limitations, and cite
31
- the returned Evidence v2 IDs. WebMCP declarations are page-declared untrusted;
32
- REA inventories them but never invokes them.
33
-
34
- Electron `file://` pages use `list_electron_targets` and
35
- `inspect_electron_page` with a separate loopback endpoint and canonical
36
- filesystem-root authority. Never claim that Electron inspection invoked IPC,
37
- evaluated renderer JavaScript, navigated, or escaped an approved root.
38
-
39
- For an operator-supplied ASAR or extracted JavaScript/Electron application, use
40
- `analyze_javascript_application` after the operator configures its canonical
41
- root in `REA_INVESTIGATION_INPUT_ROOTS_JSON`; every call still requires
42
- `approved: true`. Source-map contents require the independent
43
- `source_map_read_approved` flag. Treat BrowserWindow preferences, preload and
44
- contextBridge surfaces, IPC registrations, utility processes, and native
45
- binding requests as static syntax observations. Treat only a unique exact
46
- literal IPC channel match as an inferred pairing; keep dynamic and ambiguous
47
- channels unresolved. A requested `.node` member is not a verified binary export.
48
- Never claim that this workflow executed application code or observed runtime
49
- registration, reachability, defaults, or policy enforcement.
50
-
51
- When static application Evidence and passive `inspect_web_page` or
52
- `inspect_electron_page` Evidence already exist, use
53
- `reconcile_javascript_runtime` to map capture-scoped targets, frames, scripts,
54
- and workers onto the static graph. Supply exactly one `application` layer and
55
- add separately analyzed `cache` or `assets` layers only when relevant. Use
56
- explicit file-root or URL-prefix mappings for relocated runtime paths; mappings
57
- are inference inputs and never broaden CDP or filesystem authority. Prefer
58
- approved captured-source digest identity, report path/digest disagreement as a
59
- mismatch, preserve ambiguity, and never call a module executed merely because
60
- its containing bundle was observed. Keep source-map authority separate. This
61
- tool maps JavaScript graph entities; `correlate_static_and_runtime` remains the
62
- separate workflow for explicit cross-version comparison hypotheses.
63
-
64
- Use `trace_application_feature` on authenticated static or reconciled
65
- application Evidence to follow one literal node ID, route, string, API, IPC
66
- channel, module, or native export. Choose an explicit direction and bounds.
67
- Preserve every graph authority in the returned subgraph. A native handoff means
68
- only that the exact artifact digest and requested export frontier are known;
69
- link Ghidra or Hopper Evidence only on exact subject digest, and never claim the
70
- workflow opened a provider or verified a requested export by itself.
71
-
72
- Use `compare_application_versions` after analyzing both versions independently.
73
- Accept only its unique digest, source-map, structural-fingerprint, or non-module
74
- semantic matches. Never use module ordinals or minified names as persistent
75
- identity, and never promote an ambiguous candidate to a match. Report added or
76
- removed only when opposite-side coverage is complete; otherwise report unknown.
77
- Use `unknown_registry_approved: true` only after approval to retain unresolved
78
- version matches. For local operator-provided artifacts, the packaged
79
- `verify:application-workflows` command reports digests and coverage without
80
- printing source text.
81
-
82
- Use `run_controlled_replay` only for operator-selected extracted JavaScript
83
- modules when the separate `javascript_replay` policy is enabled. First call
84
- `mode: plan`; review the exact module, stub, runtime, sandbox, case, limit, and
85
- policy commitments. Execute only with `approved: true` and that exact
86
- `plan_digest`. Prefer explicit cases plus the parser, sanitizer, or clipboard
87
- boundary generator. A right manifest produces a derived differential result.
88
- Treat return values, exceptions, denials, limits, and crashes as observations
89
- of the isolated experiment with `controlled-replay` authority—not facts about
90
- the real application. Never substitute passive browser/Electron permission,
91
- Process Capture, or an in-process `vm` run. Reproducer export requires its own
92
- literal approval and `evidence_write` authority after sandbox cleanup.
93
-
94
- ## Understand the request
95
-
96
- Identify the app and what the user wants to understand or build. Do not ask for information they already provided.
97
-
98
- If the app is missing, ask which app they want to reverse engineer. If the app is known but the goal is unclear, ask what they want to understand or build, and offer to start with an overview. Never require the user to supply a program path, address, architecture, or reverse-engineering terminology.
99
-
100
- Notes is only a documentation example. Never select an app unless the user names it or confirms it.
101
-
102
- ## Ensure REA is ready
103
-
104
- 1. Run `npx -y rea-agents doctor`.
105
- 2. If setup is needed, tell the user REA needs to install its local binary-analysis tools. Do not lead with implementation details or assume the user knows reverse-engineering products.
106
- 3. Before installing external software, obtain approval and identify what will be installed. If deeper analysis needs Hopper, describe it as REA's local analysis engine and note that it is a separate Mac app with its own license. Then run `npx -y rea-agents setup --yes`.
107
- 4. If macOS or an installer requests human input, tell the user exactly what needs attention. After they finish, rerun setup and doctor.
108
- 5. If setup registers a new MCP server, tell the user to restart their agent to load all REA tools. Direct CLI commands remain available before restart.
109
-
110
- ## Locate the app
111
-
112
- Accept a human-readable app name. Search macOS application locations and system metadata. If one clear match is found, continue without asking for a path. If several apps match, show their names and locations and ask which one the user means. If none match, ask where the app is installed.
113
-
114
- REA accepts a `.app` bundle directly. Do not expose its internal `Contents/MacOS` path unless it helps explain an error.
115
-
116
- ## Investigate
117
-
118
- Briefly tell the user what you will investigate. Open the app with `open_binary`, begin with `binary_overview`, and narrow the investigation around the requested feature. Use decompilation, strings, names, callers, callees, and cross-references as needed.
119
-
120
- For applications, ZIP/APK/IPA packages, Electron ASAR archives, or DMGs, call
121
- `inventory_artifact` before extraction. Follow its deterministic occurrence
122
- pages and cite graph manifest IDs. `extract_artifact` requires explicit user
123
- approval, an absent absolute output root, and selected occurrence IDs; never
124
- extract every entry implicitly. Symlinks and encrypted entries are inventory
125
- facts, not extractable files. Inventory traverses discovered ASARs within the
126
- same graph and shared limits, including ASARs inside an approved mounted DMG.
127
-
128
- Native DMG traversal is macOS-only, read-only, and disabled by default. Use it
129
- only when the user approves that inventory call with
130
- `native_mount_approved: true` and the operator has separately enabled
131
- `REA_ARTIFACT_NATIVE_MOUNT_ENABLED=true`. Without both gates, retain the DMG
132
- root-hash-only result. Never imply that approval changes extraction authority.
133
-
134
- Explain conclusions in plain language. Point to the relevant decompiled code, strings, names, and connections so the user can see how the explanation was reached. Do not claim to recover original source code or automatically clone an application.
135
-
136
- Search uses bounded deterministic pages. Prefer literal mode; use regex mode only
137
- when regex semantics are needed, and continue from `next_offset` while
138
- `has_more` is true. Treat nullable permissions and explicit unavailable metadata
139
- as unknown, never as `false`.
140
-
141
- Every successful analysis result is Evidence v2. Cite evidence IDs and preserve
142
- limitations and residual unknowns. Process capture is disabled by default,
143
- requires per-call approval plus operator policy, and uses host networking only
144
- when the operator explicitly permits it. It is behavioral evidence, not a
145
- security sandbox.
146
-
147
- `capture_process_scenario` produces Process Capture v4 only. If a boundary
148
- reports Process Capture v3, tell the user or calling agent to rerun the original
149
- scenario; v3 cannot be upgraded because it lacks required manifest and
150
- settlement evidence. Treat the v4 manifest commitments as compatibility and
151
- provenance evidence, and distinguish root exit from descendant settlement.
152
- When comparing stored captures, set `max_capture_age_ms` when the task requires
153
- fresh behavioral evidence. Different scenario and executable digests are
154
- allowed, but schema and comparison-contract digests must be compatible.
155
-
156
- Do not let unanswered questions disappear. Use `record_unknown` only with
157
- explicit approval, attach supporting and contradicting evidence IDs, and record
158
- the authority/environment still required. Use `update_unknown` with the current
159
- `expected_revision`; stale updates must be re-read, not retried blindly. A
160
- verified resolution needs qualifying observed evidence. Inference, withdrawn,
161
- and out-of-scope dispositions are never substitutes for observed behavior.
162
- Set `unknown_registry_approved: true` on `trace_feature` or
163
- `capture_process_scenario` only when the user approves durable automatic
164
- recording of their bounded residuals. The same flag on a direct operation
165
- records typed provider unavailability, and on `compare_process_captures`
166
- records an observed disagreement as a contradiction.
167
-
168
- Use `compare_artifacts` with one record or bounded arrays of
169
- `inventory_artifact` Evidence pages per side. Pages must share one manifest;
170
- collect all node, occurrence, and edge pages for exhaustive comparison. It
171
- compares stable occurrence paths, content, metadata, and graph relations,
172
- cites both evidence sets on every delta, and paginates changes. Incomplete
173
- inventories are truncated or unknown, never equivalent. Set
174
- `unknown_registry_approved: true` only with approval to preserve the
175
- disagreement or missing evidence as a residual unknown.
176
-
177
- Use `compare_functions` with explicit `analyze_function` Evidence page sets;
178
- it does not perform fuzzy whole-binary matching. Collect every pseudocode,
179
- assembly, collection, and CFG page when exhaustive comparison matters.
180
- Absolute addresses are volatile only in CFG topology; pseudocode constants are
181
- never stripped. Omitted assembly, truncated scans, unavailable reference kinds,
182
- and cross-provider text remain unknown rather than equal.
183
-
184
- Use `compare_bundles` for canonical Evidence v2 bundle membership and
185
- residual-unknown history changes. Pair cross-version observations explicitly;
186
- the tool never guesses record identity. One-sided records prove only bundle
187
- inclusion or omission, not behavioral absence. Use the returned canonical
188
- bundle digests to anchor paginated reports.
189
-
190
- Use `find_changed_behavior` to combine existing comparison Evidence. Runtime
191
- process differences are observed changes; artifact and function differences
192
- remain static candidates, not causal proof. Supply complete comparison pages.
193
- For an automatic two-version artifact investigation, use its
194
- `investigation_run` mode with explicit write approval and a workspace beneath
195
- `REA_EVIDENCE_ROOTS_JSON`. It checkpoints inventory, comparison, and report
196
- Evidence in monotonic CAS-linked revisions. Repeating the same content and
197
- budgets resumes or reuses the run. This automatic mode does not execute either
198
- version or perform fuzzy function matching, so its behavior status remains
199
- unknown without separate controlled runtime Evidence.
200
-
201
- Use `build_call_path` with explicit `analyze_function` Evidence groups from one
202
- artifact and provider. Select endpoints by exact address. Missing dossiers,
203
- incomplete callee pages, or a depth frontier make absence unknown; found paths
204
- remain valid and cite each contributing dossier.
205
-
206
- Use `correlate_static_and_runtime` only with explicit mappings between exact
207
- static and runtime comparison findings. A matching pattern is a hypothesis,
208
- never proof of causality. Declare side alignment; unmapped similarities are not
209
- correlated.
210
-
211
- Use `verify_reconstruction` with a finite typed specification and canonical
212
- Evidence bundle. Pass means all declared claims passed with comparable
213
- authority, not global implementation equivalence. Missing, limited, active-
214
- unknown, or incompatible evidence stays unknown; observed differences fail.
215
-
216
- ## Build
217
-
218
- When requested, use normal coding tools to build a version suited to the user's project, stack, interface, and requirements. Keep the implementation tied to what the investigation established, and distinguish observed behavior from assumptions or design choices.
219
-
220
- ## Human input and cleanup
221
-
222
- Hopper or macOS may show a window that needs human input. Tell the user what appeared and ask them to handle it; do not guess or take over unrelated UI. Call `close_binary` when the investigation is complete.