One 8 KB skill that replaces REA (Reverse Engineer Anything): plain CLI tools, no MCP. Benchmarked: 38% faster, 35% cheaper.
Python
feat: leanrea skill, README and REA benchmark harness
AICodeKinga07ed0ebf1c5
diff --git a/.gitignore b/.gitignorenew file mode 100644index 0000000..a8e27be--- /dev/null+++ b/.gitignore@@ -0,0 +1,4 @@+bench/work/+rea_tools.json+.DS_Store+__pycache__/diff --git a/LICENSE b/LICENSEnew file mode 100644index 0000000..434f5af--- /dev/null+++ b/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 AICodeKing++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/README.md b/README.mdnew file mode 100644index 0000000..841e176--- /dev/null+++ b/README.md@@ -0,0 +1,100 @@+# leanrea++**One 8 KB skill file that does what [REA](https://github.com/morluto/rea) does: no MCP server, no 207 tools, no setup.**++REA (Reverse Engineer Anything) puts an MCP layer between your agent and tools it can already use: asar, otool, nm, `go version -m`, jadx, apktool, Ghidra, tshark, binwalk, sqlite3. leanrea drops that layer. It tells the agent which command is fastest for each kind of target, gives it ready-to-paste recon commands, and lists the traps that REA's code handles for you. The agent then runs the real tools itself.++| | REA 6.5.0 | leanrea |+|---|---|---|+| What gets installed | 25 MB npm package + MCP server | one `SKILL.md` |+| Instructions | 23.5 KB skill + 48.8 KB references | 8 KB |+| Tools added to the agent | 207 (3.35 MB of definitions) | 0 (uses Bash) |+| Context for "Reply OK", all tools loaded | 400.7k tokens, $1.60 | 34.5k tokens, $0.09 |++## Benchmark++Claude Code headless (`claude -p`), Sonnet 5.5, macOS arm64. 4 reverse-engineering tasks × 3 reps × 3 arms, with the arms run side by side. Answers are graded against hand-made keys.++| arm | total wall time | cost | turns | tokens | score |+|---|---|---|---|---|---|+| **leanrea** | **388 s** | **$2.17** | **55** | **2.40 M** | 74/75 |+| no skill | 479 s | $2.21 | 81 | 3.11 M | 67/75 (one refusal) |+| REA (MCP + its skill) | 627 s | $3.36 | 124 | 5.93 M | 75/75 |++Against REA, leanrea had **38% less wall time, 35% lower cost, 56% fewer turns and 60% fewer tokens, at the same accuracy**. Its one partial miss named Notion's older change channel instead of the v2 one (both channels exist).++The tasks:+- **electron**: trace Notion's meeting/mic detection through its app.asar (native function → main-process class → IPC channels).+- **native**: inventory the exports, TCC permission check and single-instance lock of Notion's `mac_utils.node`.+- **go**: toolchain and dependency versions of a stripped `gh` binary.+- **deep**: from disassembly alone, the exact socket path format, wire protocol and peer authentication of that lock.++The same operation run through REA's CLI vs the raw command:++| operation | REA | raw |+|---|---|---|+| Go build info | 0.56 s | `go version -m`: 0.06 s |+| Mach-O overview | 3.32 s | otool + dyld_info + nm: 0.04 s |+| Electron app analysis (Notion) | fails on asar integrity until you pass a flag, then **47.9 s and 140 MB of JSON** | asar extract + `rg -uu`: 4.8 s, 24 KB |++Full tables, the context-overhead runs and caveats: [bench/BENCHMARK.md](bench/BENCHMARK.md). Raw per-run metrics: [bench/results/final.jsonl](bench/results/final.jsonl).++**Caveats:**+- Only 3 reps per cell, one model, one machine.+- REA was tested in its best case: Claude Code's deferred tool search loads MCP tools on demand. Agents that load every tool pay the 400k-token row.+- Ghidra, Hopper and jadx weren't installed, so the native tasks ran on Xcode tools for both arms.+- The plain model is already good at this. leanrea's gain over no skill (about 19% faster, 32% fewer turns) is smaller than its gain over REA.++## Install++Claude Code:+```sh+git clone https://github.com/aicodeking/leanrea+mkdir -p ~/.claude/skills && cp -R leanrea/leanrea ~/.claude/skills/+```++For Codex, Cursor, Gemini CLI or any other agent with skills, copy `leanrea/SKILL.md` into that agent's skills folder. If an agent has no skills support, paste the file into its rules or system prompt; it is plain text.++Use it:+```+/leanrea How does the search feature in /Applications/Foo.app work? Show the evidence.+```++## What's in the skill++- **Rules:**+ - Work on a copy.+ - Route by `file` and magic bytes first.+ - Slice minified files instead of reading them.+ - Batch probes into one shell call.+ - Search extracted trees with `rg -uu`, because bundlers hide code in dot-folders like `.webpack/`.+ - Mark each claim as seen, inferred or unknown.+- **Router:** the fastest command for each target type:+ - Electron/asar (IPC, preload, `contextBridge`, fuses)+ - minified web bundles and source maps+ - Hermes/bytenode+ - Mach-O (exports, imports, entitlements, ObjC/Swift)+ - native disassembly, ELF/PE+ - Go buildinfo, Rust cargo-auditable, .NET, Android APKs, the Flutter snapshot hash+ - WASM, SQLite, plists, pcap/HAR, firmware+ - websites and runtime tracing+- **First moves:** one paste-and-run command each for native binaries and Electron apps. Each gets the whole inventory in a single tool call.+- **Speed patterns:** start from strings and imports, find a string's function through the otool literal-pool comments, read call sequences rather than every instruction, and diff inventories before diffing code.++## Reproduce the benchmark++Needs macOS with Notion.app, `gh` from Homebrew, Node, and Claude Code logged in.+```sh+cd bench+./setup.sh # installs [email protected], copies the targets into bench/work (gitignored)+./run_all.sh # 36 runs, about $8 on Sonnet+./ctx.sh # context-overhead probe+python3 mcp_list.py node work/rea-install/node_modules/rea-agents/scripts/rea.mjs --mcp # REA tool count + size+```+The answer keys in `tasks.json` match Notion 7.35.1 and a `gh` built with go1.27.1. Other versions need new keys.++## Credit++REA is an impressive, well-documented project by the morluto team. Most of the gotchas in this skill came from reading their code and docs. leanrea isn't affiliated with REA. It is just a test of whether a model with plain tools and a short note can do the same work faster.++MIT licensed.diff --git a/bench/BENCHMARK.md b/bench/BENCHMARK.mdnew file mode 100644index 0000000..17fb55e--- /dev/null+++ b/bench/BENCHMARK.md@@ -0,0 +1,79 @@+# REA vs a lean skill: benchmark (2026-10-16)++Setup: Claude Code 2.1.301 headless (`claude -p`), Sonnet 5.5, macOS arm64. REA is [email protected] (207 MCP tools, run as `rea --mcp`) plus its own skill (`/reverse-engineer-anything`). Every run starts in a fresh copy of the targets. Answers were graded by regex against answer keys I made by hand.++Arms:+- **none**: no skill, no MCP.+- **leanrea** (shown as `lean` in `results/final.jsonl`): `/leanrea`, the 8 KB `leanrea/SKILL.md`, no MCP.+- **rea**: REA MCP plus the REA skill.++Tasks (3 reps per arm per task, 36 runs, arms run side by side):+- **electron**: Notion app.asar. Trace mic/meeting detection: native fn, class, IPC channels.+- **native**: mac_utils.node. Exports, the TCC check, the single-instance lock.+- **go**: `gh`. Toolchain version, main path, two dependency versions.+- **deep**: mac_utils.node, from the disassembly. Socket path format, wire protocol, peer authentication.++## Results (median wall time; means for turns, cost, tokens)++| task | arm | wall s | turns | cost $ | tokens k | score |+|---|---|---|---|---|---|---|+| electron | leanrea | **35.3** | **4.7** | **0.171** | **196** | 14/15 |+| electron | none | 52.8 | 9.7 | 0.173 | 342 | 15/15 |+| electron | rea | 82.9 | 13.3 | 0.341 | 725 | 15/15 |+| native | leanrea | 43.4 | **5.3** | 0.201 | **239** | 24/24 |+| native | none | **36.7** | 6.7 | **0.173** | 245 | 24/24 |+| native | rea | 46.0 | 11.3 | 0.268 | 511 | 24/24 |+| go | leanrea | **12.4** | 2.3 | 0.110 | 87 | 12/12 |+| go | none | 13.8 | **2.0** | **0.092** | **67** | 12/12* |+| go | rea | 25.9 | 6.0 | 0.171 | 233 | 12/12 |+| deep | leanrea | **38.6** | **6.0** | **0.241** | **278** | 24/24 |+| deep | none | 45.3 | 8.7 | 0.298 | 383 | 16/24 (1 refusal) |+| deep | rea | 45.7 | 10.7 | 0.339 | 509 | 24/24 |++Totals over 12 runs per arm:++| arm | wall | cost | turns | tokens | score |+|---|---|---|---|---|---|+| **leanrea** | **388 s** | **$2.17** | **55** | **2.40 M** | 74/75 |+| none | 479 s | $2.21 | 81 | 3.11 M | 67/75 |+| rea | 627 s | $3.36 | 124 | 5.93 M | 75/75 |++\* One "none/go" answer wrote "Go 1.27.1" and the regex wanted "go1.27.1". That is a grader false negative, corrected above.++The lean skill against REA:+- 38% less wall time.+- 35% lower cost.+- 56% fewer turns.+- 60% fewer tokens.+- Same accuracy. The lean skill's only miss: one run named the v1 change channel instead of the v2 one. Both channels exist.++The lean skill against no skill:+- 19% faster, with 32% fewer turns and 23% fewer tokens.+- Cost is the same.+- It avoided the one refusal the bare model gave on the deep task.++## Context overhead ("Reply with exactly OK")++| config | context tokens | cost |+|---|---|---|+| nothing | 31.4k | $0.08 |+| lean skill invoked | 34.5k (+3.1k) | $0.09 |+| REA MCP, deferred tool search (CC default) | 34.9k (+3.5k) | $0.09 |+| REA skill invoked + MCP | 42.7k (+11.3k) | $0.13 |+| **REA MCP, tool search off (all tools loaded)** | **400.7k (+369k)** | **$1.60** |++REA's raw `tools/list`: 207 tools, 3.35 MB JSON (745 KB input schemas, 2.46 MB output schemas, 90 KB descriptions).++## Tool-level microbenchmark (same operation, same file)++| operation | REA CLI | raw command |+|---|---|---|+| Go build info, `gh` | 0.56 s, 62.5 KB | `go version -m`: 0.06 s, 15.6 KB |+| Mach-O overview, mac_utils.node | 3.32 s, 52.8 KB | otool/dyld_info/nm: 0.04 s, 28.3 KB |+| Electron app analysis, Notion | fails `artifact_integrity_mismatch` unless you add `--integrity-policy record-and-continue`; then **47.9 s, 140 MB** | asar extract + `rg -uu` IPC sweep: 4.8 s, 24 KB |++## Caveats+- n=3 per cell, one model (Sonnet), one machine, three targets. The REA arm used Claude Code's deferred tool search, which is REA's best case. Agents that load every tool pay the 369k-token row above.+- Native providers (Ghidra, Hopper, IDA) are not installed, so REA used its built-in native path. The lean arm used otool.++Reproduce: `./setup.sh`, then `./run_all.sh` (or `python3 -I run.py <none|leanrea|rea> <task> <rep>`) and `./ctx.sh`.diff --git a/bench/ctx.sh b/bench/ctx.shnew file mode 100755index 0000000..cbb1ebd--- /dev/null+++ b/bench/ctx.sh@@ -0,0 +1,15 @@+#!/usr/bin/env bash+# Context overhead probe: one "Reply with exactly OK." per config; prints total context tokens and cost.+set -euo pipefail+cd "$(dirname "$0")"; W="${LEANREA_WORK:-$PWD/work}"; C="$W/ctx"; MODEL="${BENCH_MODEL:-sonnet}"+mkdir -p "$C/none" "$C/leanrea/.claude/skills" "$C/rea/.claude/skills"+cp -R ../leanrea "$C/leanrea/.claude/skills/"+cp -R "$W/rea-install/node_modules/rea-agents/skills/reverse-engineer-anything" "$C/rea/.claude/skills/"+probe() { local dir=$1 prompt=$2; shift 2+ (cd "$C/$dir" && echo "$prompt" | claude -p --model "$MODEL" --output-format json --strict-mcp-config --no-session-persistence "$@" \+ | jq -c '{cost: .total_cost_usd, ctx_tokens: (.usage.input_tokens + .usage.cache_creation_input_tokens + .usage.cache_read_input_tokens)}'); }+echo -n "nothing: "; probe none "Reply with exactly OK."+echo -n "leanrea skill invoked: "; probe leanrea "/leanrea Reply with exactly OK."+echo -n "REA skill + MCP: "; probe rea "/reverse-engineer-anything Reply with exactly OK." --mcp-config "$W/rea-mcp.json"+echo -n "REA MCP, tool search auto: "; probe rea "Reply with exactly OK." --mcp-config "$W/rea-mcp.json"+echo -n "REA MCP, tool search OFF: "; ENABLE_TOOL_SEARCH=false probe rea "Reply with exactly OK." --mcp-config "$W/rea-mcp.json"diff --git a/bench/mcp_list.py b/bench/mcp_list.pynew file mode 100644index 0000000..555ac60--- /dev/null+++ b/bench/mcp_list.py@@ -0,0 +1,25 @@+"""Dump an MCP server's tools/list and size it: python3 mcp_list.py node .../rea.mjs --mcp (writes rea_tools.json)"""+import json, subprocess, sys, time+cmd = sys.argv[1:]+t0 = time.time()+p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True)+def send(o): p.stdin.write(json.dumps(o)+"\n"); p.stdin.flush()+def recv(want):+ while True:+ l = p.stdout.readline()+ if not l: raise SystemExit("eof")+ m = json.loads(l)+ if m.get("id") == want: return m+send({"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"b","version":"1"}}})+init = recv(1); t1 = time.time()+send({"jsonrpc":"2.0","method":"notifications/initialized"})+tools, cur, i = [], None, 2+while True:+ send({"jsonrpc":"2.0","id":i,"method":"tools/list","params":({"cursor":cur} if cur else {})})+ r = recv(i)["result"]; tools += r["tools"]; cur = r.get("nextCursor"); i += 1+ if not cur: break+t2 = time.time(); p.kill()+instr = init["result"].get("instructions") or ""+blob = json.dumps(tools)+json.dump({"tools": tools, "instructions": instr}, open("rea_tools.json", "w"))+print(f"tools={len(tools)} defs_bytes={len(blob)} input_schema_bytes={len(json.dumps([t.get('inputSchema') for t in tools]))} output_schema_bytes={len(json.dumps([t.get('outputSchema') for t in tools if t.get('outputSchema')]))} desc_bytes={sum(len(t.get('description','')) for t in tools)} instructions_bytes={len(instr)} startup_s={t1-t0:.2f} list_s={t2-t1:.2f}")diff --git a/bench/results/final.jsonl b/bench/results/final.jsonlnew file mode 100644index 0000000..879fff0--- /dev/null+++ b/bench/results/final.jsonl@@ -0,0 +1,36 @@+{"arm": "lean", "task": "electron", "rep": "11", "wall_s": 35.3, "turns": 4, "cost": 0.17429050000000001, "in": 8, "cache_w": 34522, "cache_r": 132465, "out": 2294, "score": "5/5", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "electron", "rep": "11", "wall_s": 47.5, "turns": 12, "cost": 0.3422452, "in": 20, "cache_w": 62547, "cache_r": 621872, "out": 2983, "score": "5/5", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "mcp__rea__analyze_javascript_application", "Bash:cd", "Bash:cd", "Bash:ls", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "none", "task": "electron", "rep": "11", "wall_s": 97.6, "turns": 9, "cost": 0.1600189, "in": 18, "cache_w": 26580, "cache_r": 298229, "out": 2384, "score": "5/5", "miss": [], "err": false, "tools": ["Bash:ls", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "lean", "task": "native", "rep": "11", "wall_s": 44.1, "turns": 7, "cost": 0.2132568, "in": 14, "cache_w": 36080, "cache_r": 274788, "out": 4143, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:T=./mac_utils.node;", "Bash:T=./mac_utils.node;", "Bash:T=./mac_utils.node;", "Bash:D=$TMPDIR/re/mac_utils;", "Bash:D=$TMPDIR/re/mac_utils;", "Bash:D=$TMPDIR/re/mac_utils;"]}+{"arm": "none", "task": "native", "rep": "11", "wall_s": 44.5, "turns": 8, "cost": 0.1881618, "in": 14, "cache_w": 33452, "cache_r": 237658, "out": 3056, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:ls", "Bash:strings", "Bash:D=$(otool", "Bash:strings", "Bash:otool", "Bash:sed", "Bash:sed"]}+{"arm": "rea", "task": "native", "rep": "11", "wall_s": 46.0, "turns": 12, "cost": 0.2676244, "in": 20, "cache_w": 47355, "cache_r": 472244, "out": 3094, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:ls", "ToolSearch", "mcp__rea__open_binary", "Bash:strings", "Bash:strings", "Bash:strings", "mcp__rea__search_strings", "mcp__rea__search_strings", "Bash:which", "Bash:sed", "Bash:sed"]}+{"arm": "lean", "task": "go", "rep": "11", "wall_s": 10.4, "turns": 2, "cost": 0.1072636, "in": 4, "cache_w": 24806, "cache_r": 49716, "out": 306, "score": "4/4", "miss": [], "err": false, "tools": ["Bash:cd"]}+{"arm": "none", "task": "go", "rep": "11", "wall_s": 13.8, "turns": 2, "cost": 0.0924126, "in": 4, "cache_w": 21206, "cache_r": 45706, "out": 301, "score": "4/4", "miss": [], "err": false, "tools": ["Bash:ls"]}+{"arm": "rea", "task": "go", "rep": "11", "wall_s": 25.9, "turns": 6, "cost": 0.17320800000000003, "in": 10, "cache_w": 35383, "cache_r": 196360, "out": 1202, "score": "4/4", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "mcp__rea__inspect_go_binary", "Bash:jq", "Bash:jq"]}+{"arm": "lean", "task": "deep", "rep": "11", "wall_s": 38.0, "turns": 6, "cost": 0.23191330000000002, "in": 12, "cache_w": 43454, "cache_r": 238233, "out": 3425, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "deep", "rep": "11", "wall_s": 44.8, "turns": 11, "cost": 0.3438066, "in": 18, "cache_w": 66559, "cache_r": 463146, "out": 3122, "score": "8/8", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "mcp__rea__open_binary", "Bash:strings", "mcp__rea__search_procedures", "Bash:which", "Bash:otool", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "none", "task": "deep", "rep": "11", "wall_s": 45.3, "turns": 10, "cost": 0.26775269999999995, "in": 18, "cache_w": 49379, "cache_r": 368807, "out": 3332, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:sed", "Bash:sed", "Bash:sed", "Bash:sed"]}+{"arm": "lean", "task": "electron", "rep": "12", "wall_s": 30.1, "turns": 4, "cost": 0.1624606, "in": 8, "cache_w": 32018, "cache_r": 132526, "out": 2112, "score": "5/5", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:X=$TMPDIR/re/asar;", "Bash:X=$TMPDIR/re/asar;"]}+{"arm": "none", "task": "electron", "rep": "12", "wall_s": 48.1, "turns": 10, "cost": 0.1847057, "in": 20, "cache_w": 30214, "cache_r": 337497, "out": 3006, "score": "5/5", "miss": [], "err": false, "tools": ["Bash:ls", "Bash:cd", "Grep", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "electron", "rep": "12", "wall_s": 82.9, "turns": 15, "cost": 0.2847268, "in": 28, "cache_w": 45563, "cache_r": 680188, "out": 3440, "score": "5/5", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "Bash:find", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "none", "task": "native", "rep": "12", "wall_s": 36.7, "turns": 5, "cost": 0.1378211, "in": 10, "cache_w": 24496, "cache_r": 151771, "out": 2464, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:ls", "Bash:strings", "Bash:strings", "Bash:strings"]}+{"arm": "lean", "task": "native", "rep": "12", "wall_s": 43.4, "turns": 5, "cost": 0.20968940000000003, "in": 10, "cache_w": 38990, "cache_r": 188094, "out": 3490, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:T=$(ls", "Bash:T=<work>/runs/lean-native-12/mac_", "Bash:D=$TMPDIR/re/mac_utils;", "Bash:D=$TMPDIR/re/mac_utils;"]}+{"arm": "rea", "task": "native", "rep": "12", "wall_s": 67.3, "turns": 14, "cost": 0.2931939, "in": 24, "cache_w": 47502, "cache_r": 595779, "out": 4356, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:ls", "ToolSearch", "mcp__rea__open_binary", "Bash:strings", "mcp__rea__search_procedures", "Bash:which", "Bash:strings", "Bash:nm", "Bash:cd", "Bash:cd", "Bash:strings", "Bash:cd", "Bash:cd"]}+{"arm": "none", "task": "go", "rep": "12", "wall_s": 18.3, "turns": 2, "cost": 0.09197860000000001, "in": 4, "cache_w": 20900, "cache_r": 45706, "out": 380, "score": "3/4", "miss": ["go ver"], "err": false, "tools": ["Bash:ls"]}+{"arm": "lean", "task": "go", "rep": "12", "wall_s": 19.7, "turns": 2, "cost": 0.1073856, "in": 4, "cache_w": 24819, "cache_r": 49716, "out": 313, "score": "4/4", "miss": [], "err": false, "tools": ["Bash:cd"]}+{"arm": "rea", "task": "go", "rep": "12", "wall_s": 30.0, "turns": 6, "cost": 0.16971640000000002, "in": 10, "cache_w": 34922, "cache_r": 196284, "out": 1038, "score": "4/4", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "mcp__rea__inspect_go_binary", "Bash:jq", "Bash:f=~/.claude/projects/-private-tmp-claude-501-rea-b"]}+{"arm": "none", "task": "deep", "rep": "12", "wall_s": 26.9, "turns": 5, "cost": 0.2619723, "in": 8, "cache_w": 59919, "cache_r": 79534, "out": 961, "score": "0/8", "miss": ["prefix", "euid", "hash", "exe", "sock", "len", "peer", "json"], "err": false, "tools": ["Bash:ls", "Bash:which", "Bash:otool"]}+{"arm": "lean", "task": "deep", "rep": "12", "wall_s": 43.0, "turns": 6, "cost": 0.23992989999999997, "in": 12, "cache_w": 45380, "cache_r": 253059, "out": 3308, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "deep", "rep": "12", "wall_s": 45.7, "turns": 9, "cost": 0.35485500000000003, "in": 14, "cache_w": 71188, "cache_r": 348550, "out": 3522, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:ls", "ToolSearch", "mcp__rea__open_binary", "Bash:cd", "mcp__rea__search_procedures", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "lean", "task": "electron", "rep": "13", "wall_s": 41.1, "turns": 6, "cost": 0.17774530000000005, "in": 12, "cache_w": 32583, "cache_r": 216093, "out": 2578, "score": "4/5", "miss": ["event ch"], "err": false, "tools": ["Bash:A=./app.asar;", "Bash:X=$TMPDIR/re/asar;", "Bash:X=$TMPDIR/re/asar;", "Bash:X=$TMPDIR/re/asar;", "Bash:X=$TMPDIR/re/asar;"]}+{"arm": "none", "task": "electron", "rep": "13", "wall_s": 52.8, "turns": 10, "cost": 0.1738069, "in": 18, "cache_w": 29737, "cache_r": 296429, "out": 2518, "score": "5/5", "miss": [], "err": false, "tools": ["Bash:ls", "Bash:mkdir", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "electron", "rep": "13", "wall_s": 122.4, "turns": 13, "cost": 0.3970981, "in": 20, "cache_w": 72637, "cache_r": 681901, "out": 3832, "score": "5/5", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "mcp__rea__analyze_javascript_application", "Bash:find", "mcp__rea__analyze_javascript_application", "Bash:grep", "Bash:grep", "Bash:grep", "Bash:python3", "Bash:python3", "Bash:python3", "Bash:python3"]}+{"arm": "lean", "task": "native", "rep": "13", "wall_s": 31.6, "turns": 4, "cost": 0.17991970000000002, "in": 8, "cache_w": 34204, "cache_r": 134877, "out": 2960, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:T=./mac_utils.node;", "Bash:T=./mac_utils.node;", "Bash:T=./mac_utils.node;"]}+{"arm": "none", "task": "native", "rep": "13", "wall_s": 34.7, "turns": 7, "cost": 0.19220610000000002, "in": 14, "cache_w": 34340, "cache_r": 243481, "out": 3047, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "native", "rep": "13", "wall_s": 38.1, "turns": 8, "cost": 0.24213279999999998, "in": 14, "cache_w": 45215, "cache_r": 313348, "out": 2991, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "none", "task": "go", "rep": "13", "wall_s": 11.1, "turns": 2, "cost": 0.0923706, "in": 4, "cache_w": 21098, "cache_r": 45706, "out": 340, "score": "4/4", "miss": [], "err": false, "tools": ["Bash:ls"]}+{"arm": "lean", "task": "go", "rep": "13", "wall_s": 12.4, "turns": 3, "cost": 0.114097, "in": 6, "cache_w": 25135, "cache_r": 87150, "out": 483, "score": "4/4", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "go", "rep": "13", "wall_s": 22.7, "turns": 6, "cost": 0.1706506, "in": 10, "cache_w": 35153, "cache_r": 196386, "out": 1038, "score": "4/4", "miss": [], "err": false, "tools": ["ToolSearch", "Bash:ls", "mcp__rea__inspect_go_binary", "Bash:f=~/.claude/projects/-private-tmp-claude-501-rea-b", "Bash:f=~/.claude/projects/-private-tmp-claude-501-rea-b"]}+{"arm": "lean", "task": "deep", "rep": "13", "wall_s": 38.6, "turns": 6, "cost": 0.2502242, "in": 10, "cache_w": 49379, "cache_r": 194882, "out": 3320, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "none", "task": "deep", "rep": "13", "wall_s": 49.0, "turns": 11, "cost": 0.3640726, "in": 20, "cache_w": 68395, "cache_r": 514726, "out": 3898, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:cd", "Bash:cd", "Bash:cd", "Bash:cd", "Bash:sed", "Bash:sed", "Bash:sed", "Bash:cd", "Bash:cd", "Bash:cd"]}+{"arm": "rea", "task": "deep", "rep": "13", "wall_s": 54.1, "turns": 12, "cost": 0.317392, "in": 20, "cache_w": 57839, "cache_r": 508760, "out": 3512, "score": "8/8", "miss": [], "err": false, "tools": ["Bash:ls", "ToolSearch", "mcp__rea__open_binary", "mcp__rea__search_strings", "Bash:which", "Bash:otool", "Bash:sed", "Bash:sed", "Bash:sed", "Bash:sed", "Bash:sed"]}diff --git a/bench/run.py b/bench/run.pynew file mode 100644index 0000000..e5d1e0a--- /dev/null+++ b/bench/run.py@@ -0,0 +1,51 @@+"""Run one benchmark cell: python3 -I run.py <arm> <task_id> <rep>. Arms: rea | leanrea | none.+Needs ./setup.sh first. Work dir: $LEANREA_WORK (default ./work)."""+import json, os, re, shutil, subprocess, sys, time+HERE = os.path.dirname(os.path.abspath(__file__))+REPO = os.path.dirname(HERE)+B = os.path.abspath(os.environ.get("LEANREA_WORK", os.path.join(HERE, "work")))+ARM, TID, REP = sys.argv[1], sys.argv[2], sys.argv[3]+MODEL = os.environ.get("BENCH_MODEL", "sonnet")+task = next(t for t in json.load(open(f"{HERE}/tasks.json")) if t["id"] == TID)+ws = f"{B}/runs/{ARM}-{TID}-{REP}"+shutil.rmtree(ws, ignore_errors=True); os.makedirs(ws)+for f in ["app.asar", "mac_utils.node", "gh"]:+ subprocess.run(["cp", "-c", f"{B}/targets/{f}", ws], check=True)+subprocess.run(["cp", "-cR", f"{B}/targets/app.asar.unpacked", ws], check=True)+cmd = ["claude", "-p", "--model", MODEL, "--output-format", "stream-json", "--verbose", "--strict-mcp-config",+ "--no-session-persistence", "--max-budget-usd", "4",+ "--allowedTools", "Bash,Read,Grep,Glob,Write,Skill,mcp__rea"]+prompt = task["prompt"]+skills = os.path.join(ws, ".claude", "skills")+if ARM == "rea":+ shutil.copytree(f"{B}/rea-install/node_modules/rea-agents/skills/reverse-engineer-anything", f"{skills}/reverse-engineer-anything")+ cmd += ["--mcp-config", f"{B}/rea-mcp.json"]+ prompt = "/reverse-engineer-anything " + prompt+elif ARM == "leanrea":+ shutil.copytree(f"{REPO}/leanrea", f"{skills}/leanrea")+ prompt = "/leanrea " + prompt+t0 = time.time()+p = subprocess.run(cmd, input=prompt, cwd=ws, capture_output=True, text=True, timeout=1500)+wall = time.time() - t0+r, tools = {"result": p.stdout[-2000:] + p.stderr[-2000:], "is_error": True}, []+for line in p.stdout.splitlines():+ try:+ ev = json.loads(line)+ except Exception:+ continue+ if ev.get("type") == "result":+ r = ev+ if ev.get("type") == "assistant":+ for c in ev["message"].get("content", []):+ if c.get("type") == "tool_use":+ n = c["name"]+ tools.append(n if n != "Bash" else "Bash:" + c["input"].get("command", "")[:60].split()[0] if c["input"].get("command") else n)+ans = r.get("result") or ""+hits = {k: bool(re.search(v, ans, re.I)) for k, v in task["key"].items()}+u = r.get("usage", {})+row = {"arm": ARM, "task": TID, "rep": REP, "wall_s": round(wall, 1), "turns": r.get("num_turns"),+ "cost": r.get("total_cost_usd"), "in": u.get("input_tokens", 0), "cache_w": u.get("cache_creation_input_tokens", 0),+ "cache_r": u.get("cache_read_input_tokens", 0), "out": u.get("output_tokens", 0),+ "score": f"{sum(hits.values())}/{len(hits)}", "miss": [k for k, v in hits.items() if not v], "err": r.get("is_error"), "tools": tools}+json.dump({**row, "answer": ans}, open(f"{ws}.json", "w"), indent=1)+print(json.dumps(row))diff --git a/bench/run_all.sh b/bench/run_all.shnew file mode 100755index 0000000..0d5c664--- /dev/null+++ b/bench/run_all.sh@@ -0,0 +1,7 @@+#!/usr/bin/env bash+# Full benchmark: 3 arms x 4 tasks x REPS reps, arms run side by side. Appends to results/run.jsonl.+set -euo pipefail+cd "$(dirname "$0")"; REPS="${REPS:-3}"+for r in $(seq 1 "$REPS"); do for t in electron native go deep; do+ for a in none leanrea rea; do python3 -I run.py "$a" "$t" "$r" & done; wait+done; done | tee -a results/run.jsonldiff --git a/bench/setup.sh b/bench/setup.shnew file mode 100755index 0000000..3a90fb8--- /dev/null+++ b/bench/setup.sh@@ -0,0 +1,18 @@+#!/usr/bin/env bash+# Prepares bench/work: installs [email protected] and copies the three targets.+# Targets (macOS): Notion.app's app.asar + mac_utils.node, and Homebrew's gh.+set -euo pipefail+cd "$(dirname "$0")"+W="${LEANREA_WORK:-$PWD/work}"; mkdir -p "$W/targets" "$W/rea-install"+NOTION=/Applications/Notion.app/Contents/Resources+GH="$(command -v gh)"+[ -f "$NOTION/app.asar" ] || { echo "Notion.app not found"; exit 1; }+[ -n "$GH" ] || { echo "gh not found (brew install gh)"; exit 1; }+cp "$NOTION/app.asar" "$W/targets/"+cp -R "$NOTION/app.asar.unpacked" "$W/targets/"+cp "$(find "$NOTION/app.asar.unpacked" -name mac_utils.node | head -1)" "$W/targets/"+cp "$GH" "$W/targets/gh"+(cd "$W/rea-install" && npm init -y >/dev/null && npm install [email protected] --ignore-scripts >/dev/null)+node -e 'const [,p,o]=process.argv;require("fs").writeFileSync(o,JSON.stringify({mcpServers:{rea:{command:"node",args:[p,"--mcp"]}}}))' "$W/rea-install/node_modules/rea-agents/scripts/rea.mjs" "$W/rea-mcp.json"+echo "ready: $W"+echo "NOTE: answer keys in tasks.json match Notion 7.35.1 and gh built with go1.27.1; other versions need new keys."diff --git a/bench/tasks.json b/bench/tasks.jsonnew file mode 100644index 0000000..0407ed8--- /dev/null+++ b/bench/tasks.json@@ -0,0 +1,51 @@+[+ {+ "id": "electron",+ "prompt": "app.asar in this folder is the Notion desktop app (Electron). Find out how Notion detects that another app is using the microphone (meeting detection). Report: (1) the native module file and the native function(s) it calls, (2) the main-process class that drives detection and its two modes, (3) the IPC channel a renderer sends to START detection, (4) the IPC channel main broadcasts when the process list changes. Keep the answer short; cite file paths.",+ "key": {+ "native fn": "getRunningInputAudioProcesses",+ "module": "mac_utils",+ "class": "AudioController",+ "start ch": "notion:initialize-running-input-audio-process-detection",+ "event ch": "notion:running-input-audio-processes-changed-v2"+ }+ },+ {+ "id": "native",+ "prompt": "mac_utils.node in this folder is a macOS Node native addon from a desktop app. Report: (1) every JS-callable function name it exports, (2) exactly how checkAudioCaptureAccess decides the permission state (framework, function, service name), (3) how requestSingleInstanceLock works (mechanism and filesystem path). Keep the answer short.",+ "key": {+ "TCC fw": "TCC\\.framework|TCC framework",+ "preflight": "TCCAccessPreflight",+ "service": "kTCCServiceAudioCapture",+ "socket": "(unix|domain|AF_UNIX|local) ?(domain )?socket",+ "path": "/tmp/com\\.notion\\.singleinstance",+ "fn1": "isWindowOccluded",+ "fn2": "getProcessesAccessingSpeakersWithResult",+ "fn3": "isSchemeHandlerPresent"+ }+ },+ {+ "id": "go",+ "prompt": "gh in this folder is a compiled binary. Without running it, report: the language/toolchain version it was built with, its main package path, and the exact versions of the dependencies github.com/cli/go-gh/v2 and golang.org/x/crypto. Keep the answer short.",+ "key": {+ "go ver": "go1\\.27\\.1",+ "path": "github\\.com/cli/cli/v2/cmd/gh",+ "go-gh": "v2\\.16\\.1",+ "crypto": "v0\\.57\\.0"+ }+ },+ {+ "id": "deep",+ "prompt": "mac_utils.node in this folder is a macOS Node native addon. Reverse engineer its single-instance lock (requestSingleInstanceLock) precisely from the binary: (1) the exact socket path format and what each variable part is computed from, (2) the wire protocol a second instance uses to send its data, (3) how the first instance authenticates the connecting peer. Keep the answer short.",+ "key": {+ "prefix": "/tmp/com\\.notion\\.singleinstance\\.",+ "euid": "geteuid|effective (user|uid)|euid",+ "hash": "hash",+ "exe": "proc_pidpath|executable('s)? path|exe(cutable)? path|binary path",+ "sock": "\\.sock",+ "len": "length[- ]prefix|4[- ]byte|uint32|size prefix|length header",+ "peer": "getpeereid",+ "json": "JSON"+ }+ }+]\ No newline at end of filediff --git a/leanrea/SKILL.md b/leanrea/SKILL.mdnew file mode 100644index 0000000..2723c75--- /dev/null+++ b/leanrea/SKILL.md@@ -0,0 +1,66 @@+---+name: leanrea+description: Reverse engineer shipped software with plain local CLI tools, no MCP needed. Covers Electron/JS bundles, native Mach-O/ELF/PE, Go/Rust/.NET/Flutter/WASM binaries, APKs, SQLite, pcaps, firmware and websites. Use to explain how a feature works, extract versions/deps, compare builds, or rebuild a feature.+---++# leanrea: fast path++You already know these tools. This file only lists the fastest command for each target, and the traps.++## Rules+- Work on a copy (`cp -c` on APFS is instant). Put each extraction in a new dir under `$TMPDIR/re/<name>`. Reuse an extraction if one exists.+- Route by `file -b T` and the magic bytes first. Run the cheapest inventory next. Only then decompile or read code.+- `rg` skips hidden and ignored files, and bundlers hide code (Electron: `.webpack/`, `.vite/`). Always search extracted trees with `rg -uu`.+- Never `cat` a big or minified file. Slice it: `rg -o '.{0,200}NEEDLE.{0,200}' F | head`. Dump a disassembly once to a file, then grep that file.+- Batch independent probes into ONE shell call with `;` and `echo '--- name'` markers (quoted: zsh expands a bare `==x`). Cap every output with `head` or `-m`.+- Answer from evidence. In the answer, mark each claim as **seen** (cite file:offset, or a symbol/string) or **inferred**. A fact you did not find is **unknown**, not "absent". Static reading is not observed execution.+- A missing tool is not a blocker. Use the fallback in the same row, or `brew install <x>` if the user allows it.+- Turns cost more than bytes. Aim for 2–4 tool calls: one batched recon call, one or two targeted slices, then answer. Stop when every item you were asked has evidence. Do not re-verify what you already saw.++## First move: one call each, paste and run+Native (Mach-O):+```sh+T=./bin; D=$TMPDIR/re/$(basename $T); mkdir -p $D; file $T; lipo -info $T; otool -L $T; echo '--- EXPORTS'; nm -gU $T | head -150; echo '--- IMPORTS'; nm -u $T | rg -v '^__Z|napi_' | tr '\n' ' '; echo; echo '--- STRINGS'; strings -a -n 6 $T | rg -v '^[_$.]' | head -400; otool -tV $T > $D/dis.txt; echo '--- FUNCS'; rg '^[_a-zA-Z].*:$' $D/dis.txt | rg -v '^_?_?Z?N?St3' | head -150+```+Then read one function: `awk '/^FUNC_LABEL:$/{p=1;next} p&&/^[_a-zA-Z].*:$/{exit} p' $D/dis.txt | rg 'bl|b\.|cmp|literal|mov\s+w2'`.++Electron:+```sh+A=./app.asar; X=$TMPDIR/re/asar; rm -rf $X; npx -y @electron/asar extract $A $X && jq '{name,version,main}' $X/package.json; find $X -path '*/node_modules' -prune -o -type f \( -name '*.js' -o -name '*.node' \) -print | head -60; ls ${A}.unpacked/node_modules 2>/dev/null; rg -uu -l --glob '!node_modules' 'exposeInMainWorld' $X+```+Then slice the needle across the bundle: `rg -uu -o --glob '!node_modules' '.{0,250}NEEDLE.{0,250}' $X | head -20`.++Go: `go version -m T` alone usually answers the question.++## Router+| Target (detect) | Fastest path |+|---|---|+| Electron app (`*.app/Contents/Resources/app.asar`) | `npx -y @electron/asar extract app.asar X` (also see `app.asar.unpacked/` for `.node` addons). Entry point: `jq .main X/package.json`. Surface: `rg -n -o '.{0,120}(ipcMain\.(handle|handleOnce|on|once)|ipcRenderer\.(invoke|send|sendSync|on)|contextBridge\.exposeIn(Main|Isolated)World|webPreferences|preload:|nodeIntegration|contextIsolation|sandbox|\.node\b).{0,160}' -uu X --glob '!node_modules'`. App-specific IPC wrappers often hide the channels, so also run `rg -uu -o '"[a-z]+:[a-z0-9:-]+"' X/<main> \| sort -u`. Fuses: `npx -y @electron/fuses read --app A.app`. |+| Web bundle / minified JS | Find `sourceMappingURL`. If the map has `sourcesContent`, dump the sources: `jq -r '.sources[]'`. For webpack, grep the module ids, then slice around the hit. For pretty-print: `npx -y prettier --parser babel F > F.pretty.js`, then read with line ranges. |+| Hermes / bytenode / V8 snapshot | Hermes magic is `c6 1f bc 03` (`index.android.bundle`): use `hermes-dec` / `hbc-decompiler`. `.jsc` (bytenode) cannot be decompiled: use strings and runtime hooks. |+| Mach-O (`file`: Mach-O) | `lipo -info` (thin first: `lipo -thin arm64 -o T1 T`). Then: `otool -L` (libs); `xcrun dyld_info -exports -imports`; `nm -gU` (exports) / `nm -u` (imports = the capability map); `strings -a -n 6`; `otool -l \| rg -A3 'LC_(RPATH\|BUILD_VERSION)'`; `codesign -d --entitlements :- T`; `otool -ov` (ObjC classes/methods); `xcrun swift-demangle --compact`. |+| Native code logic | `otool -tV T > $D/dis.txt` (or `llvm-objdump -d --no-show-raw-insn -C`). Find the function: `rg -n '^_?.*Name.*:$'`. Read the call/string trail: `awk '/^FUNC:/{p=1} p&&/^[_a-zA-Z].*:$/&&!/FUNC/{exit} p' dis.txt \| rg 'bl\|call\|literal\|cmp'`. otool labels string literals and stubs inline, which is often enough. Only for real pseudocode: Ghidra `analyzeHeadless $D p -import T -postScript DecompileAll.java -deleteProject` or `r2 -qc 'aaa; pdc @ sym.X' T`. |+| ELF / PE | `readelf -hlSW`, `readelf -dW` (NEEDED), `nm -D --defined-only`, `objdump -d -M intel`. PE: `objdump -x`, `pefile`/`wrestool` for resources. checksec: `pwn checksec`. |+| Go (`__go_buildinfo`, `.go.buildinfo`) | `go version -m T` gives the toolchain, path, mod, deps and build flags in one call. Without Go: `strings -a T \| rg -m1 -A200 'Go buildinf' `. Symbols survive stripping: `go tool nm T \| rg main\.`. |+| Rust | Deps (cargo-auditable): `cargo audit bin T`, or extract `.dep-v0` / `__DATA,.dep-v0` and zlib-inflate it. Compiler: `strings -a T \| rg -o '/rustc/[0-9a-f]{40}' \| sort -u`. Crates from paths: `strings -a T \| rg -o '[a-z0-9_-]+-[0-9]+\.[0-9]+\.[0-9]+/src' \| sort -u`. |+| .NET (`file`: Mono/.Net) | `ilspycmd -p -o X T.dll` (install: `dotnet tool install -g ilspycmd`), then `rg`. P/Invoke: `rg DllImport X`. NativeAOT/IL2CPP are native: use the native rows. |+| Android APK | `jadx -d X --show-bad-code a.apk` then `rg`. Resources/manifest only: `apktool d --no-src -o X a.apk`. Quick look: `unzip -l a.apk`. `lib/*/libflutter.so` means Flutter (Dart AOT: `blutter`); `libhermes.so` means React Native (Hermes row). |+| Flutter snapshot hash | In `libapp.so`, find magic `f5 f5 dc dc`; the 32 hex chars at +20 are the snapshot hash. Map it to a Dart version. |+| WASM | `wasm-objdump -x`, `wasm2wat`, `wasm-decompile` (WABT). |+| SQLite | Copy the db, plus the `-wal` file if present. `sqlite3 'file:C?mode=ro' '.schema'`, then `SELECT * FROM t LIMIT 20`. |+| plist / nib / car | `plutil -p F`. Info.plist holds the bundle id, URL schemes and privacy strings. Asset catalogs: `assetutil --info Assets.car`. |+| pcap / HAR | `tshark -r C -q -z conv,tcp`; `tshark -r C -T fields -e dns.qry.name -e tls.handshake.extensions_server_name -e http.request.full_uri \| sort -u`. HAR: `jq -r '.log.entries[].request \| .method+" "+.url'`. |+| Firmware | `binwalk -e F` or `unblob -e X F`. Then route each extracted binary through this table. |+| Website | `curl -sL URL` for the HTML and script srcs, then fetch the JS and slice it. For runtime behavior, use a headless browser with a network log (Playwright `page.on('request')`) or Chrome `--remote-debugging-port`. |+| Running app / runtime | macOS: `lldb -p PID`, `dtrace`/`fs_usage`/`log stream --predicate 'process=="X"'`. Electron main: `--inspect` (only if the RunAsNode/inspect fuses allow it). Android: `adb logcat`, `frida -U -f pkg -l hook.js`. |++## Speed patterns+- Strings and imports first. On a small binary, `nm -u` + `strings` + the export list usually answer "what does it do" with no disassembly.+- To find who uses a string: get its address from `otool -tV` "literal pool for" comments, or `rg -n 'literal pool for: "X'`. Then find the enclosing function label above that line.+- A C++ name in a `bl` target already tells you the protocol (for example `getpeereid`, `write`, `std::hash`). Read the call sequence, not every instruction.+- For JS, go from the native/JS boundary inward: find the native call, then its caller class, then the IPC registration, then the renderer/preload.+- Comparing versions: diff the inventories (`nm`, the module list, `go version -m`) before you diff any code.+- Rebuilding: write the minimal reimplementation, then test it against the original (same inputs, same outputs).++## Install (only on request)+`brew install jadx apktool radare2 binwalk wabt wireshark ghidra` · `npm i -g @electron/asar` · `dotnet tool install -g ilspycmd` · `cargo install cargo-audit`.