Clean-Room Reimplementation of Mobile Apps: A Low-Cost, Verifiable Guide

    This article explains how to reimplement a mobile app using a clean-room approach, relying only on publicly visible UI, interactions, and outputs. It introduces a six-level fidelity model (L0–L5), a five-step workflow from scope definition and device connection to dual-channel UI parsing, specification checklists, and same-device acceptance, plus validation scenarios and common pitfalls. Readers will learn how to turn vague requirements into explicit specs and subjective similarity into assertion-based acceptance within a small compute budget.

    1. Background: Why Rebuilding an App Is Cheaper Than Expected, Yet Harder Than Expected

    As intelligent coding tools and LLM agents mature, a common question is whether a mature app’s interface and interactions can be rebuilt at very low cost. The source material answers yes: an end-to-end reimplementation attempt took seven hours and cost 21 RMB in compute. That number is easy to misread—it excludes design, requirements clarification, and acceptance costs, and reflects only the agent execution stage.

    What really determines success is not the price of compute but the methodology: whether you rebuild only from publicly visible information, whether you upgrade “looks similar” to “behaves identically,” and whether every state change is recorded in a verifiable way. This article strips out the specific products and tools from the source material and frames the topic as a general engineering problem: how to reimplement a mobile app in a clean-room manner and deliver it against verifiable standards.

    2. Core Principle: Clean-Room Reimplementation and Fidelity Levels

    Clean-room reimplementation means observing only the externally visible interface, interactions, and outputs—without decompilation or extraction of internal implementation—and writing code from scratch. Its value is avoiding intellectual property risk while forcing the team to write requirements as explicit specifications instead of guessing at an existing implementation.

    Split reimplementation goals into six levels, and stop at level 3 by default:

    • L0 Static similarity: layout is only approximate, data is hardcoded.
    • L1 Usable interactions: the main click paths work end to end.
    • L2 State consistency: loading, empty, error, and permission states are all present.
    • L3 Output consistency: the same input produces the same level of output quality; no fake data.
    • L4 Performance consistency: latency, memory, and traffic on key paths stay in a reasonable range.
    • L5 Ecosystem consistency: account, payment, push notification, and compliance paths are complete.

    The point of leveling is to turn the subjective argument about “does it look alike” into an objective acceptance question: which level has been reached.

    3. Five-Step Workflow: From Leveling to Same-Device Acceptance

    3.1 Define the Level and Cut Scope

    First, state the target level and the not-doing list—for example, no account system, no real billing. The clearer the scope cut, the less likely the agent burns budget on unrelated modules.

    3.2 Device Connection and Operation Channel

    Enable system-level USB debugging and take over the device through terminal debugging bridge commands. This stage does only three things: install the debug build, capture the UI structure, and collect screenshots. Every operation should be replayable and turned into scripted steps, avoiding an unreproducible “click through it manually once.”

    3.3 Dual-Channel Parsing of the Control Tree and Screenshots

    One channel takes structure: export the control hierarchy to get text, clickable regions, and coordinates. The other takes visuals: after a screenshot, extract the primary colors, corner radius, font size hierarchy, and spacing rhythm. Structure determines “can it be clicked”; visuals determine “does it look alike.” The two must be merged with screen alignment into a per-screen archive.

    A schematic collection and parsing skeleton (pseudocode, expressing the flow only):

    1. for screen in screens:
    2. tree = dump_ui_hierarchy(device) # structure channel
    3. shot = capture(device) # visual channel
    4. spec = merge(tree, shot) # merge with coordinate alignment
    5. specs.append(spec)

    3.4 Specification Checklists: Difference Table and Behavior Audit Table

    Produce two documents. The per-screen UI difference table records element position, color values, font size, corner radius, and animation duration; the behavior audit table records trigger conditions, state transitions, and output results—for example, “after submission the button enters a disabled state for two seconds, then a progress layer appears.” These two tables are the sole basis for the rebuild and the source of regression test cases.

    3.5 Rebuild and Same-Device Acceptance

    Rebuild the client with declarative UI and a native development language, and implement the server APIs in a general-purpose scripting language, with the two communicating through a clearly defined contract. Acceptance must run side by side on the same device: same input, same network conditions, same account state, comparing screen by screen and recording the results.

    4. Output-Level Validation: Turning “It Works” into “It’s Trustworthy”

    A common failure point in reimplementation is a highly complete interface with hollowed-out output capability. To avoid it, validation must cover four kinds of scenarios:

    • Real model agents: generative features must connect to a real inference service rather than return preset assets.
    • Long-sequence consistency: for example, after a video is extended, the whole clip still plays continuously with no jump at the start or end.
    • Multiple versions and provenance: keep historical versions and make clear which source image each version came from.
    • Parameter sensitivity: changing the aspect ratio, duration, or style strength produces observable differences in the output.

    Acceptance can be written as an assertion-style checklist:

    1. assert output.duration == requested_duration
    2. assert output.source_id == input.image_id
    3. assert versions.count() >= 2
    4. assert diff(style_a, style_b) > threshold

    5. Common Pitfalls and How to Avoid Them

    • Missing control tree: some self-drawn interfaces export as empty, so fall back to screenshot coordinates.
    • Coordinate drift: convert proportionally across resolutions and keep a baseline device model.
    • Async timing: taking a screenshot before the API returns leads to a false “unresponsive” judgment; wait for the state explicitly.
    • Budget overrun: split tasks into small batches, get one main path working first, then expand horizontally.
    • Compliance boundary: collect only publicly visible information; do not touch transport encryption or internal storage.

    6. Reusability and Engineering Consolidation

    Solidify the workflow into a deliverable skill package containing collection scripts, difference table templates, acceptance assertions, and a directory skeleton; a new project only needs to swap in the target list to start. To productize on top of that, add four general capabilities: object storage for assets, a message queue for peak shaving, a container platform for stateless services, and logging plus monitoring alerts covering failure rate and latency. Baidu AI Cloud offers corresponding capabilities in these general categories, which can be combined as needed without binding to specific implementation details.

    7. Conclusion

    The key to low-cost reimplementation is not some expensive tool, but turning vague requirements into explicit specifications and subjective impressions into assertable acceptance. Follow the five steps—leveling, device connection, dual-channel parsing, specification checklists, and rebuild with acceptance—and prioritize output consistency, and you can get a maintainable, extensible, regression-testable engineering artifact within a budget of a few hours.