Clean-­Room Reimplementation of a Mobile App: Full Workflow in 7 Hours for $21

    This article walks through a clean-room reimplementation of an AI image and video generation app, completed in about 7 hours at a cost of $21. It explains how to grade replication difficulty from L0 to L5, connect a physical device for scripted debugging, parse the UI through a control semantic tree plus screenshots, turn observations into a per-screen UI diff table and a behavior audit table, rebuild the native client and backend, and run side-by-side acceptance checks on the same device. The focus stays on publicly visible interfaces only: no decompiling, no packet capture, and no private implementation.

    1. Background and Problem Definition

    Mobile apps ship new versions constantly, and developers often face a practical question: when you can only see the public interface and its interaction results, how do you fully reproduce an app’s functionality and experience without decompiling, without packet capture, and without touching any private implementation? This need shows up in competitive benchmarking, internal prototype validation, teaching demos, and further development of your own product. The original practice answered it by using an AI coding tool together with a physical-device debugging channel, completing a clone of an AI image and video generation app in roughly 7 hours at a cost of $21.

    One point deserves emphasis: this article is about clean-room reimplementation. You observe only publicly visible screens, control structure, and interaction feedback, then write native code and server-side logic from scratch, without obtaining or copying any non-public code or assets. That is both the compliance baseline and the more reliable engineering path, because what decides whether a clone succeeds is not “getting the source code” but “breaking the requirements down properly.”

    2. Grading Replication Difficulty: Reject Static Fake Data First

    The easiest trap in replication is treating “looks similar” as “done.” So the first step is difficulty grading: split the target into six levels, L0 through L5, and set the acceptance bar at L3, “output parity,” by default.

    • L0 static shell: page skeleton only, with hardcoded data;
    • L1 clickable: buttons respond, but the logic is fake;
    • L2 flow works: the main flow runs end to end, while exception branches are missing;
    • L3 output parity: real model capability is invoked, and output quality plus interaction results line up;
    • L4 edge cases complete: weak network, timeouts, retries, denied permissions, and similar cases are all covered;
    • L5 experience equivalence: animations, state preservation, multi-version management, and other details match fully.

    Grading turns “close enough” into a checklist you can actually verify against. The original practice states plainly that static fake data is rejected, and that is the core of L3: a generation app must connect to a real model proxy and produce real images and videos, otherwise every later acceptance check loses its meaning.

    3. Direct Physical-Device Connection: Let the Tool Take Over the Debugging Channel

    The second step is to establish the debugging link between the computer and the phone. Once system USB debugging is enabled, the AI coding tool can take over the device through terminal commands and perform install, launch, tap, text input, log capture, and similar operations. A schematic flow (illustrative only, no specific tool names involved):

    1. # Illustrative only: confirm the device is connected
    2. adb devices
    3. # Install the app under replication and the debug package
    4. adb install app.apk
    5. # Launch the target screen
    6. adb shell am start -n com.example.app/.MainActivity

    The value here is turning manual tapping into scriptable batch observation, which lays the groundwork for the semantic parsing and regression acceptance that follow.

    4. UI Semantic Parsing: A Dual Channel of Semantic Tree and Screenshots

    The third step is to “see through” the interface, using two channels:

    1. Control semantic tree: use the system’s built-in UI dump capability to obtain control hierarchy, type, text, and coordinates, forming structured data you can parse;
    2. Screenshot pixel analysis: capture key screens and extract color scheme, corner radius, font size, spacing, and z-order occlusion relationships.

    The two complement each other: the semantic tree answers “what controls exist and where,” while screenshots answer “what it looks like and what style it uses.” For a generation app, layout differences in the parameter panel, version cards, and result preview area often hide in the pixels, and relying on the semantic tree alone misses a large amount of visual detail.

    5. Specification Checklists: Turning Observation into Executable Requirements

    The fourth step is to solidify observations into two lists:

    • Per-screen UI diff table: records each screen’s control inventory, hierarchy, dimensions, colors, copy, and states;
    • Behavior audit table: records each action’s preconditions, state changes, output results, and exception branches.

    Example (excerpt):

    Screen Action Precondition Result Exception
    Home Tap Generate Model and aspect ratio selected Enters the task queue Quota-exhausted prompt
    Editor Extend video A 16-second clip exists Adds duration and keeps the original version Retry available if generation fails

    Once everything is in list form, replication shifts from “writing by feel” to “building to the table,” and the lists naturally double as acceptance test cases.

    6. Rebuilding the Native Client and the Backend

    The fifth step is writing actual code. The native client handles interface and interaction; the backend handles task orchestration, model proxying, storage, and version management. The backend of a generation app typically needs a task queue, asynchronous callbacks, object storage, metadata records, and failure retries. Illustrative pseudocode:

    1. # Illustrative only: task orchestration skeleton
    2. def submit_task(user_id, params):
    3. task = create_task(user_id, params)
    4. enqueue(task.id)
    5. return task.id
    6. def on_result(task_id, artifact):
    7. save_to_object_storage(artifact)
    8. update_task(task_id, status="done")

    The native client must align strictly with the checklists: the same corner radius, the same state preservation, the same multi-version ownership logic. The original practice specifically mentions “playing the full 16 seconds continuously, retaining multiple versions, and keeping original-image ownership,” and details like these are exactly the dividing line between L3 and L4.

    7. Same-Device Acceptance and Lessons from the Pitfalls

    The last step is same-device acceptance: on one physical device, run the clone and the original side by side and check every item against the lists. Common pitfalls include control coordinate drift causing mis-taps, screenshot colors affected by the theme, asynchronous task state not being persisted, and duplicate submissions under weak network conditions. The fix is to script the acceptance process and turn the diff table into assertions.

    8. Closing

    The essence of clean-room reimplementation is using an engineering approach to convert “publicly visible” into “executable requirements,” then using real capability to align the output. The 7 hours and $21 are not a show of skill; they show that once the workflow is fully broken down, the checklists are clearly written, and acceptance is scripted, replication stops being guesswork and becomes a reproducible pipeline.