Repository navigation
[RFC] Evidence-backed UI state/transition observation primitives for agent-driven behavioral reconstruction #4069
Description
Problem / motivation
REA already provides valuable evidence-backed static and runtime analysis. For an external agent attempting large-scale behavioral reconstruction of an application it owns or is authorized to examine, the missing piece is often not another decompiler: it is a composable, evidence-backed application interaction and observation contract that can enumerate UI states and transitions, connect observations to REA evidence, and support repeatable comparisons.
This is not a request for REA to implement a one-click commercial software clone, generate replacement applications, bypass protections, or own an autonomous orchestration loop. The external agent remains responsible for exploration strategy, implementation, and iterative repair.
Requested capability / desired outcome
Please consider defining an opt-in CLI/MCP contract (or documenting existing composable equivalents) for:
- UI state and action inventory: observable windows/pages, accessible controls, actions, navigation, modal dialogs, and state identifiers, with platform/provider and visibility limitations explicitly recorded.
- Evidence-linked transitions: given a caller-selected action and state, return before/after observations and references to relevant process, filesystem, IPC, network, and static-analysis evidence where available; unresolved associations must remain unknown rather than guessed.
- Repeatable scenario primitives: caller-controlled initial conditions, action sequences, bounded execution, cancellation, cleanup, and replay/comparison metadata. Do not silently promise deterministic reset of external state.
- Coverage export: machine-readable observed states/transitions, unvisited or unreachable candidates, source evidence, and gaps, so an external agent can prioritize follow-up experiments.
- Incremental use: stable artifact/session references and import/export suitable for long-running investigations without requiring a monolithic in-memory analysis.
A minimal first milestone could be a read-only UI state/transition evidence schema plus an adapter for one supported target class, using existing browser/process observations, rather than a universal UI automation engine.
Example workflow (proposed, not tested)
For a self-owned sample Electron app:
- An agent asks REA for an observed UI state inventory.
- It chooses a search action and supplies a bounded interaction scenario.
- REA returns before/after UI observations, available IPC/network/process evidence, and explicit unknowns.
- The agent uses those observations to implement its own equivalent feature, then compares recorded outcomes using existing comparison primitives.
- Subsequent runs reuse prior evidence and expose unexplored states without claiming exhaustive coverage.
Relationship to existing issues
I searched for related issues and do not want to duplicate them:
- [RFC/Epic] Universal Static-to-Runtime Semantic Correlation: cross-layer mapping between code, traces, packets and UI events #3718: universal static-to-runtime semantic correlation (this request would consume/extend its evidence links).
- Emit reconstruction obligation ledgers and verify coverage closure #405 and Build an evidence-backed reconstruction workspace and coverage closure workflow #268: reconstruction obligation/coverage workspace (this request focuses on collecting and exporting UI interaction state/transition evidence rather than owning closure policy).
- Add differential analysis and reconstruction verification workflows #37 and Epic: Evidence v2 and deterministic process fidelity #48: comparison and process observation foundations.
- Create a resettable macOS clean-room environment #69: resettable macOS environment (possible optional provider, not a requirement for every target).
- [Feature] Windows XAML UI reconstruction: WPF BAML, UWP/WinUI XBF, bindings, and event-handler correlation #3636: Windows XAML structural reconstruction (format-specific, complementary).
If maintainers believe existing primitives already suffice, a documented end-to-end composition example and explicit gap inventory would also address much of this request.
Scope / safety / verification
- Authorized, self-owned or suitably licensed sample applications only.
- No anti-debugging/DRM/license bypass, stealth instrumentation, credential extraction, or attack automation.
- Any execution, input injection, filesystem/network mutation, or state reset must declare its authority, side effects, time/resource limits, and cleanup; request explicit maintainer scope review before adding a provider with new execution powers.
- Validate against a small self-owned sample with known UI transitions and intentionally missing/ambiguous observations. Check that unknowns remain unknown, that cancellation/cleanup work, and that output is stable enough for external agents.
- No runtime implementation or validation has been performed for this proposal.
Questions for maintainers
- Is a provider-neutral UI interaction/observation evidence contract within REA's intended infrastructure scope?
- Should this be tracked under [RFC/Epic] Universal Static-to-Runtime Semantic Correlation: cross-layer mapping between code, traces, packets and UI events #3718 / Emit reconstruction obligation ledgers and verify coverage closure #405 instead of as a separate feature?
- Which initial platform would best fit existing providers (browser, Electron, or macOS native)?
Activity
kangyishuai commentedon Oct 15, 2026
A follow-up from the RFC author: here is a gap inventory against current
mainand a first increment that stays inside existing authority. Each row is labelled source-derived or measured.What already exists (source-derived).
capture_browser_scenariodeclares actions and records post-action artifacts per step.compare_web_capturesaligns two runs bystep_id.observe_native_uiandcapture_native_ui_scenariorecord the AX tree with action names, and before/after snapshots for each step.decode_interface_builderandtrace_native_ui_actioncover static UI and the paths from controls to handlers.capture_electron_scenariorecords action results and a main-process timeline.capture_process_scenarioandcompare_process_captures.Gaps (source-derived).
inspect_analysis_viewrejected it, and the only comparison is run against run.authority: shipped-artifactwithenvironment: null, while the other scenario producers recordcontrolled-replay.First increment: draft #4163 (derived only; no new tool, provider or execution authority).
inspect_analysis_viewnow reads retained or inlinecapture_browser_scenarioEvidence:compare_web_capturesdigests;nullrather than0when network was not observed;On a 20-action capture with screenshot, DOM, accessibility and URL after every step (about 2.2 MB, measured), the summary plus the step page is about 39 KB. That capture is still delivered inline. A separate
detail: "summary"delivery forcapture_browser_scenariowould address it.Relationship to #4107. #4107 derives one transition from two passive
inspect_web_pagerecords plus a caller-declared external action. The draft above projects one REA-controlled run. Neither introduces state keys or a shared "UI state" owner. If you want a provider-neutral state/transition vocabulary, I'd propose one owner that both surfaces consume, rather than two.Proposed next steps, each as a separate PR:
detail: "summary"delivery forcapture_browser_scenario.Electron renderer UI reads, and any new launch, attach or input, would wait for your scope decision.
Questions:
controlled-replaycaptures inherit that authority (the current view rule), given that bundlescenariosmanifests list everycontrolled-replayrecord?