gcad-agents 0.1.0 → 0.1.1

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.
@@ -1,7 +1,7 @@
1
1
  /** Generated from package.json and package-lock.json; do not edit. */
2
2
  export const PACKAGE_METADATA = {
3
3
  name: "gcad-agents",
4
- version: "0.1.0", // x-release-please-version
4
+ version: "0.1.1", // x-release-please-version
5
5
  serverSdkVersion: "2.3.1",
6
6
  clientSdkVersion: "2.3.1",
7
7
  coreSdkVersion: "2.3.1",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gcad-agents",
3
3
  "mcpName": "io.github.gcad/gcad",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
5
  "description": "GCAD: REA-superset MCP for reverse engineering plus clean-room parity reconstruction loops.",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1,108 +0,0 @@
1
- ---
2
- name: gcad
3
- description: Reverse engineer artifacts with REA-class tools, then run GCAD clean-room parity reconstruction loops (observe||re → sanitize → implement → judge). Use for shipped binaries, runtime evidence, and parity-app shipping gates.
4
- metadata:
5
- version: "1"
6
- tool_count: "241"
7
- ---
8
-
9
- # GCAD
10
-
11
- Use GCAD when a claim depends on a shipped binary or package, decompilation,
12
- passive runtime evidence, comparison with behavior not established by available
13
- source, **or** a clean-room parity reconstruction (ledger, sanitize wall, Phase
14
- gates).
15
-
16
- For ordinary analysis of a complete source repository without RE or parity
17
- goals, use normal repository tools.
18
-
19
- ## Connect (skill ≠ MCP)
20
-
21
- Installing this skill supplies instructions only. It does not register the GCAD
22
- MCP server, install analysis engines, or add tools to a running agent.
23
-
24
- If REA/GCAD tools are available, go to the target. Do not run diagnostics before
25
- every task. Use the connected server's tool list and schemas. Keep complete
26
- inline Evidence when the server does not advertise retained references.
27
-
28
- If tools are absent, a call is blocked, or a required provider is unavailable,
29
- read [connection and recovery](references/connection-and-recovery.md). Diagnose
30
- the observed blocker. Continue useful supported work. Resume after repair.
31
-
32
- ## Route by input
33
-
34
- Choose the first tool from the **artifact** the user supplied. GCAD is dual-path:
35
- **PC** (modern apps) and **MCU/ECU** (ROM + calibration), one MCP.
36
- Use `open_binary` for active-target native or archive work. Target-free tools
37
- take their own path or endpoint.
38
-
39
- | Artifact / hint | First tool | Lane |
40
- |---|---|---|
41
- | `.a2l` (+ optional ROM) | `inspect_a2l` | ECU |
42
- | Raw dump + arch (TriCore/ARM/RH850/ppc-raw) | `open_binary` `format=raw-binary` | ECU |
43
- | Two ROM/tune dumps, same map | `compare_raw_images` | Shared → ECU |
44
- | Native PE/DLL (Windows) | `open_binary`; optional `inspect_pe_layout` | PC |
45
- | Managed PE | `inspect_managed_artifact` | PC |
46
- | JS/Electron tree | `analyze_javascript_application` | PC |
47
- | Linux firmware FS image | `inspect_firmware_regions` | Shared |
48
- | Parity workspace | `parity_workspace_bind` | Parity |
49
-
50
- **Fail closed:** raw / `.bin` / `.hex` / `.s19` without architecture — ask once
51
- for arch + base/map **or** A2L. Do not guess TriCore vs ARM. Offline
52
- caller-owned dumps only — no live XCP/UDS write, seed-key, or unauthorized flash.
53
-
54
- If the user says only "my app" without a name, path, or selected target, ask
55
- which app before searching. Do not pick an example app for the user.
56
-
57
- Full route map (PC, ECU, archives, captures, WASM, EVM, Go/Rust, SQLite, IDA):
58
- [dual-path RE](references/dual-path-re.md).
59
- ECU/A2L detail: [ecu-a2l](references/ecu-a2l.md).
60
-
61
- ## Parity reconstruction
62
-
63
- When reconstructing a vendor app, read [parity loop](references/parity-loop.md).
64
- Call `parity_workspace_bind` first. Prefer in-process REA tools for the RE lane,
65
- then `parity_re_ingest` and `parity_sanitize_slice`. Role `clean` must never
66
- read `dirty/**`. Guided prompts: `gcad_dirty_observe`, `gcad_dirty_re`,
67
- `gcad_sanitize`, `gcad_choose_rewrite_language`, `gcad_clean_impl`, `gcad_judge`.
68
-
69
- **Rewrite language:** After the first RE overview, call
70
- `recommend_rewrite_languages`, **ask the human**, then
71
- `parity_rewrite_language_set` (or `other` + label). Do not start clean impl
72
- until a choice is stored. Detail: [rewrite-language.md](references/rewrite-language.md).
73
-
74
- ## Work summary-first
75
-
76
- Start with the default result and its inline Evidence. For large JS or ELF
77
- layout work, use `"detail": "summary"`, then `inspect_analysis_view` on the
78
- retained `parent_evidence_id`. Do not repeat an identical analysis without a
79
- changed input or resolved blocker.
80
-
81
- Distinguish observations, inferences, and unknowns. Cite Evidence IDs. Preserve
82
- limitations. Static analysis does not observe execution.
83
-
84
- Staged multi-feature investigations:
85
- [investigation workflow](references/investigation-workflow.md).
86
- Evidence paging, comparisons, unknowns:
87
- [evidence workflows](references/evidence-workflows.md).
88
-
89
- ## Read the relevant guide
90
-
91
- - Dual-path routing (PC vs MCU/ECU): [dual-path-re.md](references/dual-path-re.md)
92
- - ECU / A2L / raw ROM: [ecu-a2l.md](references/ecu-a2l.md)
93
- - Parity loop: [parity-loop.md](references/parity-loop.md)
94
- - Rewrite language choice: [rewrite-language.md](references/rewrite-language.md)
95
- - Native, managed, archives: [native-and-artifacts.md](references/native-and-artifacts.md)
96
- - JavaScript / Electron / ASAR: [javascript-applications.md](references/javascript-applications.md)
97
- - Android APK: [android-applications.md](references/android-applications.md)
98
- - Browser / Electron runtime: [runtime-observation.md](references/runtime-observation.md)
99
- - Evidence / compare / verify: [evidence-workflows.md](references/evidence-workflows.md)
100
- - Connection / recovery: [connection-and-recovery.md](references/connection-and-recovery.md)
101
- - Investigation staging: [investigation-workflow.md](references/investigation-workflow.md)
102
-
103
- ## Finish
104
-
105
- Explain findings in plain language and tie them to returned evidence. When the
106
- user asks to build something, use normal coding tools and separate observed
107
- behavior from design choices. Close an opened native session with `close_binary`
108
- when the investigation is complete.
@@ -1,34 +0,0 @@
1
- # Android application artifacts
2
-
3
- Use the connected server's advertised Android tools. Repository main and npm
4
- 4.1.0 include this family. A skill installation alone cannot add it to an
5
- older server.
6
-
7
- Start with `inspect_android_package` on the caller's APK path for package
8
- identity, manifest declarations, coverage, and inline Evidence. Use
9
- `search_android_classes` to find candidates, `inspect_android_class` for one
10
- class's members, `inspect_android_method` for decompilation, and
11
- `trace_android_references` for incoming static references. Each call takes its
12
- own APK path and explicit selectors; do not open a native session first.
13
- Choose an `overload_index` from the class inventory when methods are ambiguous
14
- instead of guessing.
15
-
16
- The provider requires a separately supplied headless JADX MCP JAR 0.7.1 and
17
- Java 17 or newer. `REA_JADX_MCP_JAR` selects the absolute JAR path; `JAVA_HOME`
18
- can select Java. REA setup does not install or configure that JAR, and doctor
19
- provider scopes cover Hopper/Ghidra rather than JADX. Use existing tools and
20
- report missing prerequisites for the Android task specifically.
21
-
22
- Linux and macOS use the POSIX owned-process boundary. Windows x64 requires the
23
- matching bundled native controls and uses an owned Job Object with bidirectional
24
- stdio. A full JDK, including `jdk.compiler`, is required on every host; Windows
25
- `JAVA_HOME` selects `bin\java.exe`. Consult the Android guide for actual host
26
- verification coverage. Calls use one worker and provider deadlines; optional
27
- `REA_JADX_HEAP_MIB` selects the JVM heap. The APK is never launched,
28
- and no emulator is required.
29
-
30
- Manifest entries and decompiled text are static observations, not execution or
31
- policy enforcement. Incoming references are recovered static relationships;
32
- reflection, dynamic loading, and unresolved calls remain unknown. Preserve
33
- artifact digests, locations, diagnostics, and incomplete coverage. For archive
34
- members rather than code analysis, use `open_binary` and `inspect_artifact`.
@@ -1,127 +0,0 @@
1
- # Connection and task recovery
2
-
3
- Read this guide only for an observed connection, command, approval or provider
4
- blocker. Keep the user's target and question in view. Explain what prevented the
5
- operation and the next useful step; after repair, continue the investigation.
6
-
7
- Commands below use an installed `rea`. If none is available, use the package
8
- invocation in `SKILL.md` when acquiring REA is authorized. Follow the connected
9
- server's schemas and the installed CLI's help rather than assuming repository
10
- main and an older release expose the same arguments.
11
-
12
- ## Choose the remedy from the observed failure
13
-
14
- | Observation | Meaning and next step |
15
- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
16
- | No REA tools in the active session | Inspect registration with `rea doctor --client codex --json`. A skill installation alone does not register MCP. |
17
- | Missing, malformed or stale registration | Prepare a scoped setup plan; apply only authorized changes with backups. |
18
- | Aligned registration, but no connected tools | Restart/reconnect the client. Doctor checks registration; it cannot establish the current agent's connection. Inspect the client's launch error if reconnection fails. |
19
- | `MCP tool call requires approval, but approval policy is never` | Codex rejected the call before REA executed it. Do not install an engine or repeat setup to solve this client-policy decision. See the approval section below. |
20
- | REA returns `provider_unavailable` or an unavailable tool entry | Read that operation's provider diagnostics or `binary_session.result.tool_availability`. Expand each group's tool names and inherit the shared client requirements unless overridden. Use the operation's availability, reason, and remediation; a complete tool catalog does not imply every operation is available. |
21
- | `rea` is missing in a child shell, or Node is incompatible | Inspect the actual shell PATH and launcher/runtime. A prefix installation may be absent from a login shell's PATH; this does not establish a broken MCP registration. |
22
-
23
- If the client cannot launch its shell/sandbox helper or read the installed skill,
24
- inspect its launch diagnostic. For example, Codex can refuse helper aliases when
25
- CODEX_HOME is under `/tmp`; use an authorized profile outside the OS temporary
26
- directory. REA setup cannot repair the client's executor. Preserve the sandbox
27
- instead of silently disabling it to make an analysis command work.
28
-
29
- Static JavaScript and ordinary ZIP inventory need neither Hopper nor Ghidra.
30
- HAR inspection is offline and does not require a live browser. Native
31
- decompilation, Android analysis and firmware extraction have their own
32
- bring-your-own prerequisites. Use supported inventory/static evidence when it
33
- answers part of the question, and name the unavailable evidence separately.
34
- Do not substitute another target. Label observations from ordinary shell tools
35
- as such; only actual REA output supplies REA Evidence.
36
-
37
- ## Repair registration when needed
38
-
39
- For Codex:
40
-
41
- ```bash
42
- rea doctor --client codex --json
43
- rea setup --client codex --dry-run --json
44
- ```
45
-
46
- Use the current supported client's ID: `claude_code`, `claude_desktop`, `codex`,
47
- `cursor`, `gemini_cli`, `windsurf`, `devin`, `opencode`, `antigravity`,
48
- `copilot_cli`, `commandcode`, `qwen_code`, `vscode`, `trae`, `grok_build`, `omp`, `pi`,
49
- `hermes`, `qoder`, `droid`, `zcode`, `dsh`, or `grok_bot`. If unknown, inspect `doctor --json` before choosing a
50
- scope. `grok_bot` uses a chat registration step rather than local `mcp.json`.
51
- For unsupported clients, use version-pinned manual stdio registration or CLI.
52
-
53
- Show the plan's exact paths, backups, changes and bundled-skill replacement.
54
- Obtain approval for writes when that concrete scope is not already authorized,
55
- then apply the same scope with `rea setup --client codex --yes`. Add
56
- `--install-hopper` only when separately needed and explicitly approved. Do not
57
- install or upgrade unrelated prerequisites. Restart/reconnect, verify tools
58
- actually appear, and resume the original task. If they remain absent, inspect
59
- the launch failure rather than looping through setup.
60
-
61
- ## Codex tool approval is separate from REA readiness
62
-
63
- REA tools have no permission-grant handshake. Codex can still require approval
64
- because an operation creates owned resources, launches a helper or has cleanup
65
- effects. An advertised tool or successful doctor result does not override that
66
- client policy. `workspace-write` alone does not resolve an MCP approval
67
- rejection, and `approval_policy = "never"` does not mean every MCP tool is
68
- preapproved.
69
-
70
- When interactive approval is available, use the client's approval flow for the
71
- requested operation. In an unattended run, continue through an authorized CLI
72
- workflow if the execution environment permits it, or report the blocked
73
- operation and the approval needed to proceed. Do not retry the same rejected
74
- call, silently broaden approvals, or rewrite MCP effects as read-only.
75
-
76
- For an operator who explicitly wants to preapprove named operations in a
77
- disposable Codex profile, current Codex supports per-tool configuration. For
78
- example, opening and closing an analysis session can be scoped independently:
79
-
80
- ```toml
81
- [mcp_servers.rea.tools.open_binary]
82
- approval_mode = "approve"
83
-
84
- [mcp_servers.rea.tools.close_binary]
85
- approval_mode = "approve"
86
- ```
87
-
88
- Use the actual server ID and only the operations whose effects were approved;
89
- this example does not approve inspection, extraction or runtime execution.
90
- Show the proposed config edit and preserve unrelated entries and backups before
91
- writing. Managed policy can constrain client settings. Consult the
92
- [Codex configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference)
93
- for the installed client's supported settings. This is an optional recovery
94
- choice, not a prerequisite for every REA task.
95
-
96
- ## Continue through an installed CLI
97
-
98
- Check the command environment only if the launcher fails:
99
-
100
- ```bash
101
- command -v rea
102
- command -v node
103
- node --version
104
- rea --version
105
- ```
106
-
107
- Use the public launcher at its known installation path with a supported existing
108
- Node on PATH when the child shell loses a prefix installation. Avoid internal
109
- `dist/cli.js` entrypoints or global toolchain changes. MCP may have its own valid
110
- launcher even when a shell cannot resolve `rea`.
111
-
112
- For a user-supplied JavaScript tree or ASAR, select output files in the authorized
113
- workspace and save complete Evidence before reading a view:
114
-
115
- ```bash
116
- rea analyze-javascript-application /absolute/path/to/app --json > app-evidence.json
117
- jq -c '{source: {kind: "inline", evidence: .}, view: {kind: "summary"}}' app-evidence.json > app-view.json
118
- rea inspect-analysis-view app-view.json
119
- ```
120
-
121
- These commands do not register MCP or install an analysis engine. CLI JavaScript
122
- JSON is complete and can be very large; redirect it rather than loading it into
123
- context. Use an existing JSON processor if `jq` is absent, without installing
124
- one just for this recipe. Inspect a module page or item using the same inline
125
- source and the [JavaScript recipes](javascript-applications.md). Preserve graph
126
- coverage, limitations and unknowns. Native CLI analysis still requires its
127
- selected engine, and all CLI operations retain the host's execution permissions.
@@ -1,97 +0,0 @@
1
- # Dual-path RE routing
2
-
3
- Choose the first tool from the artifact. **PC** and **MCU/ECU** share one MCP.
4
- Use `open_binary` for active-target native or archive work. Target-free tools
5
- take their own explicit path or endpoint.
6
-
7
- ## Quick table
8
-
9
- | Artifact / hint | First tool | Lane |
10
- |---|---|---|
11
- | `.a2l` (+ optional ROM) | `inspect_a2l` | ECU |
12
- | Raw dump + `architecture=tricore` (+ map) | `open_binary` `format=raw-binary` | ECU |
13
- | Raw dump + ARM/Cortex-M / RH850 / ppc-raw | `open_binary` raw profile | ECU |
14
- | Two ROM/tune dumps, same map | `compare_raw_images` | Shared → ECU |
15
- | Native PE/DLL on Windows | `open_binary` (Ghidra); optional `inspect_pe_layout` | PC |
16
- | Managed PE | `inspect_managed_artifact` | PC |
17
- | JS/Electron tree | `analyze_javascript_application` | PC |
18
- | Linux firmware FS image | `inspect_firmware_regions` | Shared (Linux BYO) |
19
- | Parity workspace | `parity_workspace_bind` | Parity |
20
-
21
- **Fail closed:** raw/`.bin`/`.hex`/`.s19` without architecture — ask once for
22
- arch + base/map **or** A2L. Do not guess TriCore vs ARM. Do not use Binwalk as a
23
- substitute for an ECU load map. Offline caller-owned dumps only — no live
24
- XCP/UDS write, seed-key, or unauthorized flash.
25
-
26
- ECU detail: [ecu-a2l.md](ecu-a2l.md).
27
-
28
- ## PC and shared first tools
29
-
30
- - ASAP2/A2L: `inspect_a2l` first; then optional raw `open_binary` with
31
- `memory_map` / addresses from A2L. See [ecu-a2l.md](ecu-a2l.md).
32
- - MCU/ECU headerless dump (`format=raw-binary` or `.bin`/`.hex`/`.s19` with
33
- caller `architecture`, optional `memory_map`, optional `language_id`):
34
- `open_binary`. TriCore flash often maps near `0x80000000`.
35
- - Calibration heuristics (no A2L): `discover_calibration_candidates` —
36
- candidates only, never oracle truth.
37
- - ASAR or extracted JavaScript/Electron tree:
38
- `analyze_javascript_application`. See [javascript-applications.md](javascript-applications.md).
39
- - Archive/package member inventory (ZIP/APK/IPA/MSIX/AppX or DMG):
40
- `open_binary` with the local path; use `inspect_artifact` when its graph helps.
41
- - Android APK code/classes/methods: `inspect_android_package`, then focused
42
- Android tools. See [android-applications.md](android-applications.md).
43
- - Managed PE/CLI: `inspect_managed_artifact`.
44
- - Consumer firmware FS carve (not ECU cal): `inspect_firmware_regions` when
45
- advertised on Linux BYO. Use `extract_firmware` with a caller-selected new
46
- absolute output directory when extraction is requested.
47
- - .NET NativeAOT PE/ELF: native Ghidra via `open_binary`. Optional metadata
48
- recovery: [native-and-artifacts.md](native-and-artifacts.md).
49
- - User-owned browser page already open: `list_browser_targets`.
50
- - Browser actions the agent must perform: `capture_browser_scenario` with
51
- declared actions. See [runtime-observation.md](runtime-observation.md).
52
- - Fiddler Everywhere / SAZ: [runtime-observation.md](runtime-observation.md#fiddler-everywhere-traffic-debugging).
53
- Saved SAZ: `inspect_web_network_capture` with `format: "saz"`.
54
- - Retained HAR/SAZ/mitmproxy/aioquic qlog: `inspect_web_network_capture`.
55
- Prefer detail summary, then kind pages. Do not fetch recorded URLs.
56
- - User-owned Electron runtime: `list_electron_targets`. Check
57
- `inspect_electron_fuses` before electron-main Inspector; disabled
58
- `EnableNodeCliInspectArguments` means the app ignores `--inspect`.
59
- - Packet-field discovery: `inspect_packet_fields` before
60
- `inspect_packet_capture` (Linux + `REA_TSHARK_COMMAND`; recordings only).
61
- - Address/DNS/SNI summaries: `inspect_pcap_capture` (Wireshark 4.x tshark).
62
- - Signal decoder discovery: `inspect_signal_decoders`; recordings:
63
- `decode_signal_recording` (Linux + `REA_SIGROK_COMMAND`).
64
- - Local WebAssembly: `inspect_wasm_artifact` (`REA_WABT_BIN_DIRECTORY`).
65
- - Local EVM bytecode: `inspect_evm_interface` with `raw` or `hex` encoding.
66
- Prefer `detail: "summary"`; page via `parent_evidence_id`.
67
- - Go build metadata: `inspect_go_binary` (target-free; no Go install).
68
- - Rust cargo-auditable: `inspect_rust_binary` (target-free; no Rust install).
69
- - SQLite snapshot: `inspect_sqlite_database` (Node 24.15+/26+). Schema first.
70
- - Linux ELF offline layout: `inspect_binary_layout` (pwntools; no DB).
71
- - Linux x86-64 ELF core: `inspect_recorded_crash`.
72
- - PE resources: `inspect_pe_resources`. PE layout: `inspect_pe_layout`.
73
- - Native executable/library/DB: `open_binary`, then focused tools;
74
- `binary_overview` when inventory helps.
75
-
76
- Depth for native/managed/archives: [native-and-artifacts.md](native-and-artifacts.md).
77
-
78
- ## IDA
79
-
80
- For an existing IDA MCP configuration, use `open_binary` with the original
81
- input binary and `provider_id: "ida"`. Do not pass an `.idb` or `.i64`.
82
- Proceed to `analyze_function`, pseudocode, or searches after opening. IDA does
83
- not supply `binary_overview`.
84
-
85
- ## Target identity and session
86
-
87
- If the user says only "my app" without a name, path, or selected target, ask
88
- which app before searching. Paths in unrelated reports and nearby fixtures do
89
- not select the target. Resolve a human-readable name to one clear installed
90
- artifact when possible; ask when matches are ambiguous.
91
-
92
- In a target-free session, use `open_binary` to bind archive/package or native
93
- targets whose tools need an active target. Do not call an unadvertised tool.
94
- Inspect `binary_session` with `{}` and `result.tool_availability` for reasons
95
- and remediation. The grouped name union is the complete inventory; use
96
- `tools/list` for schemas. Provider candidates and top-level session
97
- capabilities are different scopes — do not treat them as interchangeable.
@@ -1,42 +0,0 @@
1
- # ECU / A2L / raw ROM
2
-
3
- Offline **caller-owned** dumps and description files only. No live XCP/UDS
4
- write, seed-key, or unauthorized flash.
5
-
6
- ## Fail closed
7
-
8
- Raw / `.bin` / `.hex` / `.s19` without architecture: ask once for arch +
9
- base/map **or** an A2L. Do not guess TriCore vs ARM. Do not use Binwalk as a
10
- substitute for an ECU load map.
11
-
12
- ## A2L first
13
-
14
- 1. `inspect_a2l` on the ASAP2/A2L description.
15
- 2. Optional: `open_binary` on the ROM/dump with `format=raw-binary`,
16
- `architecture`, and `memory_map` / addresses from the A2L when present.
17
-
18
- ## Raw dump without A2L
19
-
20
- Call `open_binary` with:
21
-
22
- - `format=raw-binary` (or path ending `.bin` / `.hex` / `.s19`)
23
- - caller `architecture` (e.g. `tricore`, ARM/Cortex-M, RH850, ppc-raw)
24
- - optional `memory_map`, optional `language_id`
25
-
26
- TriCore flash often maps near `0x80000000`.
27
-
28
- ## Calibration heuristics
29
-
30
- `discover_calibration_candidates` returns **candidates only**. Never treat
31
- them as oracle truth. Prefer A2L-backed addresses when available.
32
-
33
- ## Compare tunes
34
-
35
- Two ROM/tune dumps that share a map: `compare_raw_images`.
36
-
37
- ## Not ECU
38
-
39
- Linux firmware filesystem carve uses `inspect_firmware_regions` /
40
- `extract_firmware` (Linux BYO). That path is consumer firmware FS, not ECU
41
- calibration. See [dual-path-re.md](dual-path-re.md) and
42
- [native-and-artifacts.md](native-and-artifacts.md).
@@ -1,71 +0,0 @@
1
- # Evidence, comparison, and verification workflows
2
-
3
- Evidence-producing tools return the complete Evidence record directly in MCP
4
- `structuredContent` and CLI JSON. Read `normalized_result` for operation data,
5
- and cite `evidence_id` when another tool or your explanation needs a stable
6
- reference. Preserve authority, limitations, coverage, and residual unknowns. If a result
7
- is incomplete or paginated, continue only when the remaining data matters to
8
- the task; do not fetch a bundle or resource merely to read a result already
9
- returned inline. When complete `inspect_binary_layout` or
10
- `analyze_javascript_application` Evidence is already retained, call
11
- `inspect_analysis_view` for a summary, one section/symbol/module, or a stable
12
- page instead of repeating the producer.
13
-
14
- Completed `inspect_artifact` inventory also supports a summary and
15
- `view: {kind: "inventory", collection: "occurrences", logical_paths: ["package.json", "main.js"]}`.
16
- Omit `logical_paths` to page all available occurrences; `[]` selects none.
17
- Other inventory collections are `nodes`, `edges` and
18
- `integrity_contradictions`. Keep `source_complete` separate from page exhaustion:
19
- a missing match in partial source Evidence does not establish absence. Use the
20
- returned parent Evidence ID for subsequent views and export before closing the
21
- session when the source must survive it.
22
- When `tools/list` advertises `inspect_artifact.detail`, request `"summary"` to
23
- retain its complete source and receive that view immediately. Without that
24
- advertised choice, keep the existing complete call. CLI inspection returns
25
- portable complete Evidence; save it before projecting a selected inline view.
26
-
27
- Use `record_unknown` to track unresolved questions in the user's investigation
28
- and name the authority or environment still required. Supply supporting and
29
- contradicting evidence IDs. It updates the session registry directly.
30
- Use `update_unknown` with the current revision; reread after a stale revision
31
- instead of retrying blindly. Only qualifying observed evidence can verify a
32
- resolution.
33
-
34
- Use comparisons with complete, compatible page sets when claiming equivalence
35
- or absence:
36
-
37
- - `compare_artifacts` compares inventory pages by occurrence path, content,
38
- metadata, and graph relations.
39
- - `compare_functions` compares explicit function Evidence, not fuzzy
40
- whole-binary matches.
41
- - `compare_bundles` compares canonical bundle membership and unknown history.
42
- - `find_changed_behavior` combines existing comparisons; static differences
43
- remain candidates, not causal proof.
44
- - `build_call_path` needs explicit function dossiers from one artifact/provider;
45
- an incomplete frontier makes absence unknown.
46
- - `correlate_static_and_runtime` uses explicit mappings; matching patterns are
47
- hypotheses, not causality.
48
- - `verify_reconstruction` evaluates a finite typed specification. A pass covers
49
- only declared comparable claims, not global equivalence.
50
-
51
- Process captures are opt-in behavioral evidence, not a security sandbox. V3
52
- captures cannot be upgraded to V4; rerun the original scenario. Distinguish root
53
- exit from descendant settlement and require freshness when the task needs it.
54
- A timed-out target that must write a final report needs `finalization_ms`: REA
55
- sends SIGTERM to the captured root, keeps observing, and sends SIGKILL once
56
- only if the target has not exited by the end of the interval.
57
- `exit.finalization.signals` lists each attempt with its delivery result; the
58
- observed exit signal stays in `exit.signal`, `exit.code` is null for every
59
- deadline exit, and the code of a finalizer that exited on its own is in
60
- `exit.finalization.exit_code` (null on a signal exit or when no exit was
61
- observed).
62
-
63
- Use `inspect_analysis_view` with `view: {kind: "api-surface"}` on retained
64
- `inspect_web_network_capture` HAR Evidence to group observed request lines by
65
- method, origin and path template. Format matches are inferences, not handler
66
- identity or schemas. Group pages cite parent record ordinals; consult record
67
- coverage and exclusions before claiming completeness. No requests are replayed.
68
- When the connected schema advertises `include_query_parameter_names`, select
69
- it in the view for distinct observed names with original record ordinals. Query
70
- values are omitted; the names establish neither required parameters nor a
71
- complete server schema. Keep the original parent Evidence for exact URLs.
@@ -1,79 +0,0 @@
1
- # Investigation workflow
2
-
3
- ## Work summary-first
4
-
5
- Start with the default result and its inline Evidence and graph context.
6
-
7
- For a JavaScript application or ELF layout whose size is unknown or large,
8
- call `analyze_javascript_application` or `inspect_binary_layout` with
9
- `"detail": "summary"`, then inspect the retained `parent_evidence_id` with
10
- `inspect_analysis_view`. Page module identities and select the returned
11
- `node_id` before requesting an item. A single file path can represent several
12
- graph roles.
13
-
14
- Do not repeat an identical analysis or rejected call without a changed input
15
- or resolved blocker. Recheck session state when a lifecycle change makes that
16
- status useful. Make a focused follow-up only when the returned result leaves a
17
- specific question unanswered.
18
-
19
- If MCP reports `resource_constraint` with `details.resource: "transport"`,
20
- call `inspect_analysis_view` with the same-session Evidence reference for a
21
- summary, one section/module, or a stable page. Use `trace_application_feature`
22
- once a seed is known, or `export_evidence_bundle` to write the complete
23
- session to a selected path. Avoid repeating analysis only to request the same
24
- oversized response.
25
-
26
- When the retained parent ID is unknown, use `get_evidence_bundle` with
27
- `detail: "summary"` and exact filters (operation, target SHA-256,
28
- analysis-profile digest, or canonical procedure address). Select its returned
29
- Evidence ID for the next view.
30
-
31
- A client can truncate a successful tool result without a REA transport error.
32
- Treat that preview as incomplete. Use the retained parent ID for smaller views
33
- or export. Do not parse the preview as canonical JSON or repeat the producer.
34
- For JavaScript, read [javascript-applications.md](javascript-applications.md)
35
- before drilling into a large graph.
36
-
37
- Every conclusion must distinguish observations, inferences, and unknowns. Cite
38
- Evidence IDs. Preserve limitations and incomplete coverage. Never imply that
39
- static analysis observed execution. Runtime requests execute only the declared
40
- target and lifecycle.
41
-
42
- Within the user's requested investigation, call available analysis tools
43
- directly. REA does not require permission grants or per-call approval flags.
44
- The agent client can still require approval. Use
45
- [connection-and-recovery.md](connection-and-recovery.md) for an observed
46
- client-policy rejection.
47
-
48
- Evidence paging, comparisons, unknowns:
49
- [evidence-workflows.md](evidence-workflows.md).
50
-
51
- ## Plan broader investigations
52
-
53
- For requests that span multiple features or subsystems:
54
-
55
- 1. Turn the request into a checklist of questions and the evidence each answer
56
- needs. Resolve target identity from the conversation and workspace before
57
- asking again.
58
- 2. Inspect the current session, artifact identity, saved analysis database,
59
- bookmarks, and prior evidence. Reuse matching state; do not open duplicate
60
- sessions or repeat identical analysis.
61
- 3. Start with the smallest useful overview or inventory. Follow each question
62
- from its entry point through relevant data and state changes. Batch related
63
- operations around a specific hypothesis. Expand only when evidence leaves a
64
- concrete gap.
65
- 4. Inspect packaged resources and configuration alongside code when they affect
66
- the question. Use format-aware inventory and parsers. Do not infer behavior
67
- from filenames, strings, or layout alone.
68
- 5. Corroborate with the evidence type the conclusion requires. Use runtime
69
- observation only when static evidence cannot answer and the required host
70
- runtime is available.
71
- 6. Decompose into independent questions. When parallel workers are available
72
- and questions do not depend on one another, assign distinct scopes and ask
73
- for sources, conclusions, and unresolved gaps. Otherwise work sequentially.
74
- 7. Keep a concise finding ledger linking each conclusion to Evidence IDs,
75
- confidence/evidence type, search boundary, and remaining unknowns.
76
-
77
- Before finishing, revisit the checklist. Mark each question answered, partially
78
- answered, or unresolved. Keep bounded negative searches bounded. Do not
79
- describe a broad investigation as complete while required questions remain open.
@@ -1,175 +0,0 @@
1
- # JavaScript and Electron application artifacts
2
-
3
- For captured or bundled JavaScript that needs readable source recovery, use
4
- `recover_javascript_sources` with an absolute `path` and absent
5
- `output_directory`. Supply related runtime/shared/lazy files in
6
- `additional_paths` when advertised, then analyze the returned `analysis_input`
7
- directory together. Each input retains its own snapshot, digest and byte-range
8
- provenance; inputs and recovered code are never executed. Recovery requires a
9
- caller-supplied Wakaru on Linux x64; see [the recovery guide](https://github.com/morluto/rea/blob/main/docs/javascript-recovery.md).
10
-
11
- Use `analyze_javascript_application` directly on the operator-supplied ASAR or
12
- extracted tree. When the question concerns known source paths and the connected
13
- schema advertises `source_paths`, select exact inventoried paths such as
14
- `["package.json", "main.js", "preload.js"]`. Include supporting manifests or
15
- source maps explicitly; dependencies are not implicitly analyzed. REA retains
16
- the complete artifact inventory and identity but reads source text and analyzes
17
- only selected files. The result and summary record `source_selection`; files
18
- outside scope and their relationships remain unknown, so partial application
19
- coverage does not mean the selected source failed. Use repeated `--source-path`
20
- on either static application CLI route. Omit the selection when the question
21
- requires complete application analysis. `detail: "summary"` reduces delivery
22
- and does not by itself reduce analysis work.
23
-
24
- Exact `#alias` specifiers resolve through the importer's
25
- enclosing package `imports` map to package-local files; nested `node_modules`
26
- packages use their own map. Wildcard, recursive, and external-package import
27
- targets stay unresolved with that limitation. When size is unknown or large and the connected schema advertises
28
- `detail`, request `detail: "summary"`. This returns an `inspect_analysis_view`
29
- Evidence record with a distinct ID and a `normalized_result.parent_evidence_id`
30
- for the complete retained application analysis. Source-map contents are part of
31
- that static analysis. Read findings, coverage, limitations and unknowns, then
32
- follow a specific unanswered question. Older servers without `detail` return
33
- the complete application Evidence inline when it fits.
34
-
35
- When the connected schema advertises `max_heap_mb` and `analysis_timeout_ms`,
36
- these select the isolated source analyzer's old-space heap and per-source
37
- deadline. Defaults are 1024 MiB and 300000 ms. They do not change the MCP
38
- process heap. A Bun-hosted REA does not enforce the heap choice; on Windows it
39
- instead limits the analyzer's committed memory to that choice plus a 512 MiB
40
- runtime reserve.
41
- Resource-limited analyses preserve completed static facts and
42
- report partial semantic coverage with specific unknown scopes; this does not
43
- mean the source is malformed. Inspect those limits before retrying a source.
44
- When expanded relationships exceed the parent's available memory, inspect the
45
- file's modules item view for retained `static_analysis` and
46
- `semantic_module_analysis`. Their facts remain available even when graph links
47
- are unknown. Cumulative result exhaustion can stop analysis before every file
48
- is examined; the inventory and remaining unknown scopes distinguish that case.
49
- Timeout or cancellation after source analysis begins retains partial Evidence
50
- in the same session. A returned `error.details.partial_observation` reference
51
- can be supplied directly to `inspect_analysis_view`. If the SDK cancels locally, retrieve its recorded ID from
52
- the Evidence bundle before inspecting the partial analysis.
53
-
54
- ## Read a module without repeating analysis
55
-
56
- Use the actual returned parent ID, on the same connection, as `source.evidence_id`.
57
- The following IDs are placeholders to replace with returned values. When the
58
- module's node ID is not already known, page identities before selecting an item.
59
- Pages return only node IDs, paths and roles; choose a useful page size and follow
60
- `coverage.next_offset` when another page matters:
61
-
62
- ```json
63
- {
64
- "source": {
65
- "kind": "retained-evidence",
66
- "evidence_id": "ev_ACTUAL_PARENT_ID"
67
- },
68
- "view": { "kind": "page", "collection": "modules", "offset": 0, "limit": 16 }
69
- }
70
- ```
71
-
72
- Select the relevant page entry by its exact `node_id` and recorded role:
73
-
74
- ```json
75
- {
76
- "source": {
77
- "kind": "retained-evidence",
78
- "evidence_id": "ev_ACTUAL_PARENT_ID"
79
- },
80
- "view": {
81
- "kind": "item",
82
- "collection": "modules",
83
- "selector": { "node_id": "jag_node_ACTUAL_NODE_ID" }
84
- }
85
- }
86
- ```
87
-
88
- Module pages include asset, bundled and source module roles, so one path can
89
- identify several entries. Use `selector.path` only when uniqueness is established;
90
- the returned node ID avoids needing a complete inventory to prove uniqueness. On ambiguity,
91
- select the matching node ID from the page or the error's candidates. Follow
92
- `next_offset` when another page matters. An item exposes that module node's
93
- recorded observations, identity, hashes, exports and source ranges; it does not
94
- include every child syntax observation, related edge or original source file.
95
- An absent item fact is not evidence of absence from the whole application.
96
-
97
- ## Trace only the remaining question
98
-
99
- Use `trace_application_feature` on the parent application Evidence for one
100
- literal node ID, route, string, API, IPC channel, module, or native export.
101
- Select `incoming` for relationships leading to the seed, `outgoing` for those
102
- leaving it, and `both` when the question needs both. Trace traversal includes
103
- containment relationships, so even a narrow seed can expand many nodes; a
104
- bidirectional trace can reach unrelated sibling modules. A module item or page
105
- is preferable when its observations already answer the question. Do not treat
106
- all reached nodes as participants in the feature.
107
-
108
- Reuse retained parent Evidence when the server advertises it, or supply complete
109
- Evidence inline. Include Hopper or Ghidra Evidence only when its artifact digest
110
- matches exactly.
111
-
112
- ## Recover an oversized display
113
-
114
- An oversized response reports `resource_constraint` and
115
- `details.resource: "transport"`. Reuse
116
- `details.reported_limits.evidence_reference` with `inspect_analysis_view` for a
117
- summary, one module, or a stable page of module identities.
118
- `export_evidence_bundle` writes the complete canonical session to a
119
- caller-selected file. These workflows keep the original Evidence and coverage;
120
- a broad follow-up can also exceed framing.
121
-
122
- A client can truncate a successful result inside its text envelope without a
123
- REA `resource_constraint`. Treat a truncation notice or incomplete JSON as a
124
- display limitation; do not claim the full record was examined. Reuse the known
125
- parent ID for smaller views, or export complete Evidence to a selected file
126
- while the session remains open. If the parent ID was lost from the preview,
127
- use the prior analysis summary or explicit ledger entries to recover it; do
128
- not invent an ID or rerun analysis just to reproduce the same display.
129
-
130
- BrowserWindow preferences, preload and contextBridge surfaces, IPC
131
- registrations, utility processes, and native binding requests are static syntax
132
- observations. Only a unique exact literal IPC channel match supports an inferred
133
- pairing. Dynamic or ambiguous channels remain unresolved. A requested `.node`
134
- member is not a verified native export. Never claim runtime reachability,
135
- registration, defaults, or policy enforcement from static analysis.
136
-
137
- For version comparison, analyze each version once, then call
138
- `compare_application_versions`. Accept only its digest, source-map, structural
139
- fingerprint, or non-module semantic matches. Module ordinals and minified names
140
- are not persistent identity. Report added or removed only with complete
141
- opposite-side coverage; otherwise report unknown.
142
-
143
- When the question asks how one exact exported callable's returned object shape
144
- changed, analyze each version once and then call
145
- `compare_javascript_export_shapes` with explicit module paths and export names.
146
- Use the returned IDs on the same connection, or complete inline Evidence
147
- records, from both analysis calls. Accept variant
148
- pairing only through the tool's unique exact literal discriminant. Read
149
- `property_inventories` and each change's `presence` before treating `unknown` as
150
- "the name was not observed": inventories list observed property names even when
151
- values stay unknown, with a `source_range` for each paired or unpaired variant.
152
- Array holes and mutation-invalidated slots are not observed properties.
153
- Complete parent coverage reports presence-only
154
- `added`/`removed` independently of unresolved values. Cite the
155
- comparison Evidence and report JSON Pointer changes; dynamic values, ambiguous
156
- variants, and incomplete parent-property coverage stay unknown. This is static
157
- inference, not runtime behavior. When runtime semantics are needed, run
158
- behavioral probes against the relevant application versions and capture them
159
- through the available browser, Electron, or process workflows.
160
-
161
- ## Reusing application Evidence
162
-
163
- When advertised by the connected server, application trace and compare tools
164
- accept complete inline Evidence or
165
- `{"kind":"retained-evidence","evidence_id":"ev_<64 lowercase hex characters>"}`
166
- for their application input (`application`, or `left`/`right`). `inspect_analysis_view`
167
- uses the same retained-reference form in `source`, or portable inline Evidence,
168
- to project a summary, module page, or one module with its recorded observations. This notation is
169
- a template: replace it with the actual returned ID. Versions before 4.1.0 accept only full
170
- inline Evidence. Use the exact ID
171
- returned by the producer on the same MCP connection. Resolution does not run
172
- analysis or select a provider; findings remain inline. Native observation
173
- arrays still take full Evidence. `close_binary` clears retained references;
174
- export a bundle before closing, or supply portable inline Evidence in another
175
- connection. A missing reference includes its ID and recovery guidance.
@@ -1,269 +0,0 @@
1
- # Native, managed, and packaged artifacts
2
-
3
- ## Go build metadata
4
-
5
- Use `inspect_go_binary` for an explicit local ELF, PE or thin Mach-O when the
6
- question concerns the embedded compiler version, module/dependency versions,
7
- local replacements or build settings. No `open_binary`, Go installation or
8
- target execution is required. The CLI equivalent is `inspect-go-binary PATH`.
9
- Preserve artifact SHA-256, original file ranges, framed module bytes and every
10
- unparsed module-text line. A missing record is an unknown, not proof of a
11
- non-Go binary; observed metadata does not authenticate its claims. Function,
12
- source and type recovery remain a separate native-analysis question.
13
-
14
- ## Rust dependency metadata
15
-
16
- Use `inspect_rust_binary` for an explicit local ELF, PE, or thin Mach-O when
17
- the question concerns the cargo-auditable crate list embedded in `.dep-v0`
18
- (Mach-O: `__DATA,.dep-v0`). No `open_binary`, Rust installation, or target
19
- execution is required. The CLI equivalent is `inspect-rust-binary PATH`.
20
- Preserve artifact SHA-256, package order, dependency indices, and the section
21
- file range. A missing section is null metadata, not proof the binary has no
22
- dependencies. An omitted package kind stays null. A rustc commit hash is
23
- inferred from a read-only `/rustc/<40-hex>/` path and does not by itself
24
- identify the compiler. See [Rust binaries](https://github.com/morluto/rea/blob/main/docs/rust-binaries.md).
25
-
26
- ## SQLite snapshots
27
-
28
- Use `inspect_sqlite_database` with an explicit local database snapshot for its
29
- schema and optional rows from one exact ordinary table. It requires Node.js
30
- 24.x >=24.15 or 26+ with the native `DatabaseSync.limits` API. It also consumes the
31
- existing sibling `-wal`; retain both original digests when citing its result.
32
- Default output is a compact inventory; a selected table expands only its own
33
- schema and samples 20 rows. Select `columns` to avoid irrelevant or large cells,
34
- and request `schema_scope: "database"` only for complete schema details.
35
- Choose `row_limit` when a finite sample is useful and keep truncation and
36
- unspecified row order explicit. Virtual tables, shadow tables and views are
37
- schema facts, not row-read targets. REA inspects private copies and leaves
38
- the source files untouched; obtain a coherent quiescent database/WAL snapshot
39
- before inspection. See [SQLite snapshots](https://github.com/morluto/rea/blob/main/docs/sqlite-databases.md).
40
-
41
- ## Recorded Linux crashes
42
-
43
- Use `inspect_recorded_crash` with an explicit Linux x86-64 ELF core path to
44
- inspect historical thread registers, signals, raw notes and original file
45
- ranges. It is independent of the active disassembler target. Source-bound
46
- register values and note bytes are observations; missing notes, signal-thread
47
- association and current executable/library identity remain unknown. PIDs are
48
- historical metadata and never authorize live attach or control.
49
-
50
- The optional `include_debugger_context` facet adds mapping candidates through
51
- caller-supplied GDB/pwndbg in an owned core-only session. Display names do not
52
- establish current file identity; zero reported flags leave permissions unknown.
53
- Requested unavailable context fails with setup guidance. See
54
- [recorded crashes](https://github.com/morluto/rea/blob/main/docs/recorded-crashes.md)
55
- for exact upstream profiles, bounds and verification coverage.
56
-
57
- ## Offline ELF layout
58
-
59
- Use `inspect_binary_layout` with an explicit local ELF path for file-backed
60
- sections, symbols, relocations, linkage names, and static mitigation inferences
61
- without opening a disassembler target. When that complete record is already
62
- retained, call `inspect_analysis_view` for a summary, mitigations or linkage
63
- facet, one section or symbol, or a stable page. Do not re-run the decoder to
64
- read a single object.
65
-
66
- ## Offline WASM
67
-
68
- Use `inspect_wasm_artifact` with caller-supplied WABT for selected local bytes.
69
- For counts, validation and WAT identity, select `detail: "summary"` on the first
70
- MCP call. The complete original Evidence stays retained; use
71
- `normalized_result.parent_evidence_id` for exact exports or text pages. Omitted
72
- or complete detail keeps the existing complete result.
73
- For a completed result, use `inspect_analysis_view` with its reported retained
74
- reference for a summary or `view: {kind: "wasm", facet: "exports", offset: 0, limit: 32}`.
75
- Facets also include sections, imports, candidates, glue, WAT, headers, details
76
- and tool profile. Text offsets count UTF-16 code units; follow `next_offset`.
77
- The complete source remains retained after an oversized MCP reply. No target
78
- execution or network acquisition is implied, and WAT is decoded representation.
79
-
80
- ## Native targets
81
-
82
- After `open_binary`, use focused search, procedure, or function tools directly.
83
- Use `binary_overview` when target metadata or inventory context helps answer the
84
- question. Prefer literal search, names, decompilation, callers, callees, and
85
- cross-references. Addresses and recovered pseudocode are analysis observations,
86
- not original source. Provider unavailability and unsupported metadata remain
87
- unknown rather than false.
88
-
89
- For a completed `analyze_function` dossier, use `inspect_analysis_view` with
90
- `view: {kind: "native", facet: "value_flow_operations", offset: 0, limit: 32}`
91
- and the exact retained Evidence ID to read selected facts without reanalysis.
92
- Native facets also include procedure, pseudocode, assembly, basic blocks,
93
- comments, callers/callees, references, unresolved calls, referenced strings and
94
- names, the native API record, and value-flow summaries. Pseudocode offsets and limits count UTF-16
95
- code units; use the returned `next_offset` for continuation. Provider limitations
96
- and unavailable facts remain explicit; the complete parent Evidence is retained.
97
-
98
- `inspect_macho` on a large framework returns megabytes of imports and exports.
99
- Select `detail: "summary"` for slice identity, UUID and per-collection counts,
100
- then page rows with `view: {kind: "macho", facet: "exports", offset: 0, limit: 64}`
101
- and `normalized_result.parent_evidence_id`. Facets are entrypoints,
102
- architectures, build_metadata, load_commands, dependencies, imports, exports,
103
- segments and provenance. `source_exhaustive: false` means unreturned symbols
104
- may exist.
105
-
106
- To see which functions or Objective-C methods a Mach-O actually calls in one
107
- run, use `observe_native_calls` with explicit breakpoints and a bounded
108
- `duration_ms`/`max_events`. It launches a new process under LLDB, so the target
109
- runs and may change files or use the network. Hardened-runtime targets need the
110
- `get-task-allow` entitlement.
111
-
112
- Use `binary_session` with no arguments to check the open target, selected
113
- provider, and alignment. Its default `result.tool_availability` carries a
114
- complete inventory grouped by shared facts. Expand each group's `names` and
115
- inherit the inventory-level client requirements unless a group overrides them;
116
- availability, reasons, remediation, modes, and flags remain inline. The
117
- `effects` and `annotations` arrays name true flags from fixed vocabularies, so an
118
- omitted known flag is false. `tools/list` remains the canonical source for full
119
- tool schemas when target or provider state changes.
120
-
121
- Provider capability groups carry provider identity and ordered limitations.
122
- Prepend each set's `shared_limitations` to a group's `limitations` to recover the
123
- operation's full ordered list. Candidate capabilities describe possible
124
- providers. Top-level session capabilities describe the current route, and
125
- `analysis_provider_binding` identifies the selected provider.
126
-
127
- ## DOS MZ with Ghidra
128
-
129
- For an admitted DOS MZ target, use `inspect_native_load_image` to check measured
130
- loaded bytes, file mappings, relocations and the entry against the immutable
131
- snapshot. Keep `mismatch` and `unsupported` explicit. Verified import covers the
132
- reported static image, not runtime DOS or PC-98 hardware behavior.
133
-
134
- For Ghidra decompilation, `procedure_pseudo_code` also accepts `procedure: "file-offset:0x..."`; CLI `rea decompile <path> --file-offset=0x... --provider ghidra` resolves the source byte offset internally. An unresolved 0x-prefixed numeric procedure selector also falls back to a unique file mapping. Existing symbols and analysis addresses win; multiple mappings fail as ambiguous. Preserve the returned file-offset and address locations and raw selection observations. ELF virtual addresses are distinct from file offsets; never assume an arbitrary offset plus image base is an analysis address.
135
-
136
- Use `read_bytes` for initialized analysis memory and `address_to_file_offset` to
137
- anchor one observed address to original file bytes. Loader fixups can change a
138
- word; a source offset does not imply byte equality. Complete function body ranges
139
- use inclusive ends and can contain gaps. Do not treat the enclosing span as code.
140
- For packed targets, retain the original and separately derived artifact identities;
141
- decompiling an unpacking stub does not recover the unpacked program.
142
-
143
- When reading Objective-C dispatch metadata, distinguish class implementation
144
- methods from protocol requirements: class methods report null requirement
145
- flags, while decoded protocol declarations retain required and optional facts.
146
- Property attributes remain raw name/value tokens; use the property's
147
- `atomicity` field for the decoded `N` marker or the default atomic behavior.
148
- Null class/meta flags, ivar counts, atomicity, or read-only values mean the
149
- selected provider did not establish that fact. Symbol names alone do not prove
150
- that a class is a root class or has no ivars.
151
-
152
- ## Managed PE/CLI
153
-
154
- Start with `inspect_managed_artifact`. REA's canonical managed inspection is
155
- execution-free: do not claim it loaded, reflected, executed, or resolved the
156
- assembly. Keep managed/native boundaries and unavailable reconstruction facts
157
- explicit. A bring-your-own reconstruction oracle is separate from the canonical
158
- parser and must not become an implicit setup dependency.
159
-
160
- For identity/classification questions, `inspect_managed_artifact` can explicitly
161
- select `detail: "summary"` on the first MCP call. It retains complete metadata
162
- and returns a linked overview with full classification/evidence, nullable
163
- module/MVID, frameworks, metadata coverage/issues/limitations and returned-row
164
- counts. Default complete requests remain unchanged. Read original rows with
165
- `inspect_analysis_view`, source `normalized_result.parent_evidence_id`, and
166
- `view: {kind: "managed", collection: "attributes", offset: 0, limit: 16}`.
167
- Collections are `references`, `resources` and `attributes`. Paging does not
168
- repeat parsing. Returned-row exhaustion
169
- does not prove complete metadata or absence under partial/unavailable coverage;
170
- preserve build-local tokens and their artifact/MVID scope.
171
-
172
- ### .NET NativeAOT
173
-
174
- NativeAOT binaries contain native machine code, so ordinary CIL decompilers
175
- cannot recover the original method bodies. When managed metadata/CIL is absent,
176
- classify that as a native-analysis route rather than claiming source recovery.
177
- Open the native image with the selected deep provider and inspect functions,
178
- strings, calls, and references; describe decompiler output as pseudocode and
179
- inference.
180
-
181
- NativeAOT images can be PE/COFF, ELF, or Mach-O executables and shared
182
- libraries. Use file bytes and loader metadata rather than suffixes to identify
183
- them. For packaged apps, inventory/extract with REA's artifact tools and retain
184
- the exact contained image identity. PDB, ELF debug, or dSYM sidecars are
185
- additional evidence only when the provider accepts and matches them.
186
-
187
- REA has a built-in read-only snapshot parser for x64 PE targets with .NET 8 RTR
188
- 9.1 metadata. An optional headless Ghidra adapter adds database annotations and
189
- broader metadata recovery on Linux; it requires an explicitly configured
190
- NativeAOT JAR. These are separate routes. The built-in parser also runs on
191
- Windows Ghidra P0; read frozen literals from its report, because
192
- `search_strings` does not include them. See the
193
- [NativeAOT guide](https://github.com/morluto/rea/blob/main/docs/ghidra-nativeaot.md)
194
- for setup, supported layouts, and host restrictions. Preserve binary identity
195
- and distinguish derived metadata from Ghidra database observations. Recovered
196
- types and native pseudocode are not original C# source. Windows Ghidra P0 has
197
- no database mutation authority.
198
-
199
- ## Packages and extraction
200
-
201
- Use `inspect_artifact` for application bundles, archives, ZIP/APK/IPA/MSIX/AppX,
202
- ASAR, or DMG inputs when the artifact graph and findings help answer the
203
- question. It returns the complete artifact graph inline. Cite graph manifest
204
- IDs when using them.
205
-
206
- For an IPA or a macOS `.app`, ZIP, or DMG, pass the inventory Evidence to
207
- `project_apple_application_graph`. It reports application roots and nested
208
- bundles by path convention: app extensions, XPC services, frameworks, login
209
- items, system and driver extensions, and plug-ins. It also lists privileged
210
- helpers, launchd plists, symlinks, and each bundle's `info_plist_path` and
211
- executable candidates. Roles are path conventions, not parsed plists; read the
212
- listed plists with `inspect_plist`.
213
-
214
- After `open_binary` on a `.app` or Mach-O, use `trace_dylib_resolution` to see
215
- which file each `@rpath`, `@loader_path` and `@executable_path` load reaches for
216
- every executable in the bundle. It also lists missing or weak loads and earlier
217
- `@rpath` candidates that are absent. Narrow large bundles with `roots` or
218
- `architecture`. System paths stay undetermined because the dyld shared cache
219
- provides them.
220
-
221
- Use `extract_artifact` when materialized files are needed. It extracts the active
222
- target and accepts optional `integrity_policy`; see the [MCP contracts](https://github.com/morluto/rea/blob/main/docs/mcp-contracts.md).
223
- It materializes all regular files into a fresh temporary directory chosen by
224
- REA. Symlinks and encrypted entries are inventory facts, not extractable files.
225
- The result reports the materialized directory; callers do not choose the
226
- destination. No separate permission grant is needed.
227
-
228
- Native DMG traversal automatically uses a read-only mount on supported macOS
229
- hosts, with an owned temporary mount directory and cleanup. It needs no approval
230
- flag. Unsupported hosts or mount failures remain explicit limitations; do not
231
- claim child inventory when only root identity is available. Extraction is a
232
- separate filesystem-writing operation.
233
-
234
- For headerless DOS COM, explicitly open with `format: "dos-com"` (CLI
235
- `--target-format dos-com`). Inspect the load image before trusting function
236
- analysis: the entry is `0x10100`, file offset zero, with imposed real-mode segment
237
- context. PSP/stack/device state remains unmodeled. See [DOS guide](https://github.com/morluto/rea/blob/main/docs/ghidra-dos.md).
238
-
239
- For other headerless images (embedded firmware without ELF/Mach-O/PE/MZ
240
- headers), open with `format: "raw-binary"`, `architecture` (`x86`, `x86_64`,
241
- `arm`, `arm64`, or `6502`), and `entry_point` (`0x` hex). File offset 0 is mapped at
242
- that address. Hopper and IDA refuse this interpretation; Ghidra uses
243
- `BinaryLoader` with a little-endian generic language. Big-endian, Thumb-only,
244
- and Cortex-M variants are unsupported. `6502` selects NMOS 6502; the entry and
245
- complete file mapping must fit within `0x0000..0xffff`. 65C02, 65816, cartridge
246
- containers, bank switching, and mapper semantics are unsupported. Windows
247
- Ghidra P0 admits raw images only for `6502`. See [raw binary guide](https://github.com/morluto/rea/blob/main/docs/raw-binary.md).
248
-
249
- ### Function annotations in Ghidra
250
-
251
- Use `annotate_native_function` for one function name and/or entry comments, with at least one explicit change. Review its annotation readback and refreshed dossier inline. Changes are atomic and session-scoped; empty comments clear them, omitted fields preserve them. Later MCP calls observe edits until close. CLI `annotate-native-function` returns the updated analysis before discarding the session. Original executable bytes are unchanged; edits invalidate immutable snapshots. Windows P0 does not admit database mutations. For naming only, `set_address_name` / `set_addresses_names` also work with Ghidra: they name function entries or data addresses (primary labels) and return compact per-address success booleans instead of a dossier.
252
-
253
- ## Offline PE resource inventory
254
-
255
- Use `inspect_pe_resources` with an absolute `path`, or
256
- `rea inspect-pe-resources ./selected.exe --json`, for portable PE32/PE32+
257
- resource inspection without opening a native target. Preserve returned Evidence:
258
- type/name/language IDs and UTF-16 names, original directory/data/payload ranges,
259
- code pages, payload hashes and static icon-group references. Same-language icon
260
- resolution is explicit; missing references and size mismatch remain visible.
261
- Other payloads are opaque, and this operation does not decode images or simulate
262
- Windows resource loading. Consult the budgets and supported tree profile in
263
- [offline binary diagnostics](https://github.com/morluto/rea/blob/main/docs/binary-diagnostics.md).
264
-
265
- For exact core-module import/export differences, use `compare_wasm_interfaces`
266
- with two complete inspection Evidence records (or current-session retained
267
- references) and explicit scope. Preserve unknown types/duplicate names; static
268
- interface equality is not runtime compatibility. CLI accepts complete inline
269
- Evidence in `rea compare-wasm-interfaces input.json --json`.
@@ -1,42 +0,0 @@
1
- # GCAD parity loop
2
-
3
- GCAD extends REA with a clean-room **observe ∥ re → sanitize → implement → judge** loop.
4
-
5
- ## Bind first
6
-
7
- Call `parity_workspace_bind` with the absolute workspace root before other `parity_*` / `animal_*` tools.
8
-
9
- Set `parity_role_set`:
10
-
11
- | Role | May touch |
12
- |---|---|
13
- | `observe` | `dirty/drafts/*/observe/` |
14
- | `re` | `dirty/drafts/*/re/` + REA binary tools |
15
- | `sanitize` | dirty drafts → `handoff/` |
16
- | `clean` | `handoff/`, `public-refs/`, `impl/` only — **never** `dirty/**` |
17
- | `judge` | oracles + ledger |
18
-
19
- ## RE lane (prefer in-process REA)
20
-
21
- 1. `open_binary` / `analyze_function` / focused REA tools.
22
- 2. Summarize **behaviour** (menus, formats, constraints) — not asm dumps.
23
- 3. `parity_re_ingest` writes `dirty/drafts/<slice>/re/` for sanitize.
24
- 4. Offline fallback: `parity_stage_run` with `stage=re` (Ghidra headless).
25
-
26
- ## Shipping ledger ≠ REA obligation ledger
27
-
28
- - `parity_ledger_*` = slice shipping progress (`missing|partial|complete|escalated`).
29
- - `build_reconstruction_obligation_ledger` = REA Evidence obligations.
30
-
31
- ## Honesty gates
32
-
33
- Use `parity_status` for Phase 1 / Phase 2 %, replacement gates, feature-verify, human-parity, usable-shipping. Do not claim 100% Phase 2 without those greens.
34
-
35
- ## Rewrite language
36
-
37
- 1. `recommend_rewrite_languages` after first RE overview.
38
- 2. Ask the human (recommended id, or another language).
39
- 3. `parity_rewrite_language_set` → `.gcad/project.json`.
40
- 4. Do not start clean impl until `parity_rewrite_language_get` shows a choice.
41
-
42
- See [rewrite-language.md](rewrite-language.md).
@@ -1,27 +0,0 @@
1
- # Rewrite language (human choice)
2
-
3
- After the first RE overview, choose the rewrite language before clean implement.
4
-
5
- ## Steps
6
-
7
- 1. Gather hints from RE (format, UI stack, deps). Examples: `win32`, `mfc`,
8
- `qt5`, `asar`, `wpf`, `a2l`.
9
- 2. Call `recommend_rewrite_languages` with `target_kind` and/or `signals`.
10
- 3. Show the ranked list to the human. Ask which language to use.
11
- 4. The human may pick a recommended id **or** say another language.
12
- 5. Call `parity_rewrite_language_set`:
13
- - Recommended: `language_id` from the list (optional `language_label`).
14
- - Other: `language_id: "other"` and required `language_label`.
15
- 6. Confirm with `parity_rewrite_language_get`.
16
-
17
- ## Rules
18
-
19
- - Recommendations are **inferred**. They are not observations.
20
- - Do not start clean impl / `parity_new_pack` scaffold until a choice is stored.
21
- - ECU ROM analysis does not force an ECU firmware language. Prefer tooling
22
- stacks (`rust`, `python`) when the product is offline cal/tools only.
23
-
24
- ## Ask text (STE100)
25
-
26
- Recommended stacks are listed. Which language should we use for the rewrite?
27
- Or say another language.
@@ -1,78 +0,0 @@
1
- # Browser and Electron runtime observation
2
-
3
- Supply the existing browser or Electron instance's literal-port loopback CDP
4
- endpoint in the request. No separate permission configuration or per-call
5
- approval flag is needed. Browser discovery lists eligible HTTP(S) pages;
6
- `allowed_origins` optionally filters them. An individual capture defaults to the
7
- selected page's current origin. Electron discovery lists eligible local
8
- `file://` targets without a configured file-root allowlist.
9
-
10
- Start passive browser work with `list_browser_targets`; start Electron runtime work with
11
- `list_electron_targets`. Before an electron-main Inspector attempt, check
12
- packaged fuses with `inspect_electron_fuses`. Inspect the target selected for
13
- the user's task. Observation with these tools is passive: never claim REA
14
- clicked, navigated, evaluated page JavaScript, invoked IPC, or captured prior
15
- activity. REA does not contain the page's network.
16
-
17
- Passive captures omit raw header collections, credential header values, storage
18
- values, and raw WebSocket/JSON bodies. Selected response metadata, including
19
- content encoding, policy values, and Link URLs, is retained. Local URLs retain ordinary query
20
- values and fragments; userinfo credentials are removed. Browser accessibility
21
- text, console primitives, value-free shapes, script sources, source maps, and
22
- storage key names have request-specific capture options. Electron script
23
- sources are also optional. Use `capture_web_screenshot` when pixels are needed.
24
- Treat scope filtering, truncation, and attach-window coverage as limitations.
25
- Page-declared WebMCP tools are untrusted inventory and are never invoked by REA.
26
-
27
- ## Who performs the action
28
-
29
- - The user performs it: `list_browser_targets`, then `inspect_web_page` or
30
- `observe_web_session` on the selected target.
31
- - The agent must perform it: one `capture_browser_scenario` with declared
32
- actions. Use connect mode with the loopback CDP endpoint and `target_id` for
33
- an existing browser, or launch mode with a caller-selected executable for a
34
- temporary profile. Connect mode first navigates the selected page to
35
- `start_url`, which can clear unsaved form values and other temporary state.
36
- Recreate the state needed for the investigation in the declared actions.
37
- Connect mode leaves the external browser open; launch mode owns a temporary
38
- browser and profile. Check `browser.cleanup` for the outcome.
39
- Request only the DOM, accessibility, or network details needed for the question.
40
- The default final capture contains the URL; step outcomes are reported separately.
41
- Add a wait action for the expected page state before capturing it. Report that
42
- REA performed the declared actions.
43
-
44
- Scenario network records have no request initiator stacks. For that evidence,
45
- use passive capture while the user performs the action. Listener source locations
46
- identify candidate handlers; they do not establish which script sent a particular
47
- request. Avoid overlapping passive capture and scenario actions on the same target.
48
-
49
- Focused follow-up tools:
50
-
51
- - `observe_web_execution`: execution coverage during a window; it resets
52
- counters and temporarily disables optimization.
53
- - `inspect_web_event_listeners`: source locations for listeners registered
54
- directly on the first CSS match, without dispatching an event.
55
- - `compare_web_captures`: two normalized passive captures or recorded scenarios.
56
- - `discover_webmcp_tools`: inspect page-declared WebMCP inventory; never invoke
57
- the discovered tools.
58
-
59
- Use `reconcile_javascript_runtime` only after static application Evidence and
60
- passive browser/Electron Evidence exist. Prefer captured-source digest identity;
61
- report path/digest disagreement as a mismatch and preserve ambiguity. Explicit
62
- path mappings are inference inputs and never broaden filesystem or CDP authority.
63
- A bundle observed at runtime does not prove every contained module executed.
64
-
65
- ## Fiddler Everywhere traffic debugging
66
-
67
- For large saved captures, request `detail: "summary"`, then page retained Evidence
68
- with `inspect_analysis_view` and `view: {kind: "capture", detail: "preview", offset: 0, limit: 20}`.
69
- Select complete record pages only for needed headers, metadata or payloads; views
70
- read the historical parent without repeating capture decoding.
71
-
72
- Inspect native `.saz` snapshots with `inspect_web_network_capture` and
73
- `format: "saz"`; encrypted archives are unsupported. For live
74
- traffic analysis, connect Everywhere's separate MCP server and use its
75
- advertised session tools with an explicit `sessionsSource` (`LiveTraffic` or
76
- `AgentCalls`). Preserve existing sessions and filters when inspecting a
77
- recorded run. See the [capture and MCP guide](https://github.com/morluto/rea/blob/main/docs/web-network-captures.md)
78
- for the workflow and Telerik's public setup and traffic-debugging skills.