Clean Room Reimplementation of a Mobile App: A Five-Step Method (7 Hours, $3)
This article explains a clean room approach to rebuilding a mobile application from scratch using only publicly visible UI and interaction behavior—no decompilation and no reverse engineering of private protocols. It covers compliance boundaries, a six-level fidelity framework (L0–L5, defaulting to L3), driving a real device over USB, converting the UI into structured data via control-tree dumps and screenshots, maintaining UI diff and behavior audit checklists, rebuilding the client and server with self-defined interfaces, and same-device acceptance testing. Readers will learn how disciplined constraints and structured cost control can compress a benchmarking effort from days to hours.
Introduction: Why a Low-Cost Rebuild Is Worth Studying
In mobile app development, “fully reconstructing the capabilities of an app that is already live” is a common but high-risk requirement. It might be competitive feature benchmarking, internal prototype validation, or porting a proven interaction pattern into your own product. The original practice produced a striking result: a mobile reimplementation of an AI product with image generation, video generation, and video editing and extension capabilities, completed in 7 hours at a cost of 21 RMB (roughly $3).
The value of this kind of work is not “copying a shell.” It is building a reusable, auditable, and compliant engineering process. Setting aside the specific product, this article discusses only the general technical problem: without decompilation and without capturing private protocols, how do you rebuild a mobile app from zero using only publicly visible UI and interaction results as the sole source of truth, and achieve output-level parity?
1. Start With the Compliance Boundary: What Clean Room Reimplementation Means
The core of a clean room rebuild is “information isolation”: observe only externally visible behavior and presentation, and never touch any non-public implementation. In engineering terms, that means three hard rules:
- No static decompilation and no parsing of the internal structure of the installation package;
- No capturing or reconstructing private network protocols or authentication details;
- All rebuild code written from scratch, with no reuse of any code or resource files from the original implementation.
These constraints may look like tying your own hands, but the payoff is significant: the output is clean, auditable, and maintainable code assets you own, rather than a mirror that can break at any time.
2. Define the Fidelity Level First: Decide “How Close Is Close Enough”
Most projects fail not because the technology is inadequate, but because “done” was never defined. Before starting, break the rebuild goal into six levels, L0–L5, and default to stopping at L3:
| Level | Goal | Acceptance Method |
|---|---|---|
| L0 | Information architecture parity | Page hierarchy and navigation relationships aligned |
| L1 | Static visual parity | Colors, font sizes, corner radii, spacing aligned |
| L2 | Interaction path parity | Key flows work end to end |
| L3 | Output parity (default) | Real model output; no static fake data |
| L4 | Edge and exception parity | Failure states, timeouts, retries, permission denials |
| L5 | Performance and experience parity | Startup time, scroll frame rate, memory usage |
Stopping at L3 by default is a pragmatic trade-off: validate output through the real inference pipeline, but do not fall into an endless chase of the original implementation’s performance details. Push toward L5 and costs rise exponentially, while the payoff often does not align with business goals.
3. Direct Device Connection: Turn the Phone Into a Programmable Execution Environment
The second step is establishing the control channel. Enable USB debugging on the phone and connect it to a computer, then have an AI coding tool drive the device directly through terminal commands. The key advantage: every action happens on a real device, avoiding the differences between an emulator and a physical device in rendering, GPU, sensors, and permission dialogs.
In practice, wrap a thin adapter layer that reduces device operations to a few atomic capabilities:
# Device operation adapter (illustrative)class Device:def tap(self, x, y): ... # Tap coordinatesdef swipe(self, x1, y1, x2, y2, ms): ...def dump_ui(self): ... # Export the control treedef screenshot(self, path): ... # Screenshotdef launch(self, pkg): ... # Launch the appdef back(self): ... # Go back
With this abstraction, the upper-layer “rebuild scripts” are decoupled from the specific device, so switching models or OS versions does not require rewriting the flow.
4. Semantic Tree + Screenshot Parsing: Turn the UI Into Structured Data
Precision requires more than “looking at a picture and describing it.” The practice uses dual-channel collection:
- Control tree export: obtain the full view hierarchy, control types, text content, clickable flags, and exact coordinates. It answers “what exists, where it is, and whether it can be tapped.”
- Screenshot: extract primary and secondary colors, corner radius, font size hierarchy, shadows, and dividers. It answers “what it looks like.”
Combined, the UI goes from “an image” to “a computable specification.” One often-overlooked detail here: coordinates must be normalized, otherwise everything breaks when the resolution changes.
{"screen": "home","nodes": [{"type": "Button", "text": "Generate", "clickable": true,"rect": [0.12, 0.81, 0.88, 0.87]}],"style": {"primary": "#1A1A1A", "radius": 12, "titleSize": 20}}
5. Specification Checklists: The Single Source of Truth for the Rebuild
The third step produces two tables that determine whether subsequent development stays controllable.
Per-screen UI diff table: organized by screen, recording differences in dimensions, colors, copy, icons, and animations item by item, with a severity level for each. Its role is to translate “it just doesn’t feel right” into actionable change items.
Behavior audit table: records the pre-state, action, post-state, and side effects of each operation. For example, “tap Generate → button enters loading state → request is sent → a new card is inserted on return → ownership of the original image stays unchanged.” This table is the key to output-level parity, because it constrains the state machine, not the appearance.
Keep both tables under version control, and write back to the checklists after every change, so you never end up “changing things without knowing what still differs.”
6. Rebuild and Same-Device Acceptance: Push Client and Server in Parallel
The final step is writing actual code. Rebuild the UI and interactions with a native mobile approach, and implement the orchestration of generation and editing capabilities on the server with a general-purpose scripting language; the two communicate over your own interface. The principle: you define the interface, you design the fields, and you never imitate the original communication format.
On the server side, split at least four layers:
- Access layer: authentication, rate limiting, request validation;
- Orchestration layer: task decomposition, state transitions, timeouts and retries;
- Capability layer: connect to model inference and hide differences between capabilities;
- Storage layer: object storage for assets, a database for metadata, and a cache layer for hot spots.
Acceptance must be completed on the same device, comparing item by item against the diff table and behavior table, in a repeatable way with “same device, same path, same input.” Only when the real model returns results, long videos play continuously in full, and version and original-asset ownership relationships are correct, has L3 been reached.
7. Cost and Pitfalls: The Real Ledger Behind 7 Hours and 21 RMB
The key to low cost is not cutting corners but not doing useless work: no L5, no decompilation, no chasing private protocols, with the entire budget spent on real inference calls. The 21 RMB is essentially the token and duration cost of model calls; the 7 hours went mainly into environment setup and checklist alignment.
There are five common pitfalls: coordinates not normalized, which breaks things on a different device; the control tree misaligning in scrolling lists; permission dialogs interrupting the automation flow; long tasks timing out with no resume-from-breakpoint support; and the most insidious one—“bluffing your way through with static fake data”—which makes L3 acceptance completely meaningless.
8. Engineering the Outcome: Turn Experience Into Reusable Capability
Getting it working once has no value; being able to reuse it does. Turn the whole process into a standardized skill package containing a level-definition template, collection scripts, a diff table template, a rebuild scaffold, and an acceptance test set; also check the rebuilt client and server into the repository for the team’s secondary development. If cloud resources are involved, use a container platform to host the services, object storage for assets, and a logging service with monitoring and alerting for observability, forming a complete path from experiment to production.
Conclusion
The essence of clean room reimplementation is trading strict constraints for clean output: observe only external behavior, rebuild the implementation from zero, and drive acceptance with checklists. When the process is standardized and the cost is structured, benchmarking work that used to take days can be compressed to hours—and that is the part of “7 hours and 21 RMB” truly worth reusing.
