Product Architecture Reverse Engineering
Purpose
Turn observable product behavior into a traceable product interpretation and architecture model. Start from evidence, separate AI from ordinary software, and only then infer implementation boundaries or propose a better design.
Non-negotiable rules
- Treat pages, buttons, loading labels, and feature names as evidence, not proof of an Agent or backend design.
- Classify every architectural object as one of:
明确Agent、智能能力模块、确定性系统组件、页面交互组件、外部服务、数据实体、基础设施、未知. - Grade every material conclusion as
【已确认】、【合理推断】、【建议设计】or【未知】. In early experience reports,【页面事实】may be used as an alias for【已确认】. - Never claim access to hidden chain-of-thought, internal prompts, private APIs, model names, frameworks, databases, storage mechanisms, or cloud services without direct evidence.
- Default to read-only inspection. Do not create, edit, delete, complete, purchase, subscribe, sync, export, or connect external accounts unless the user explicitly authorizes that exact mutation.
- Never inspect or expose cookies, tokens, passwords, request headers, browser storage, credentials, or unrelated private content.
- Keep
As-IsandTo-Beseparate. Never present a recommended component as part of the current product. - Preserve uncertainty. A useful
【未知】is better than a polished invention.
Read references/evidence-and-safety.md before collecting or interpreting product evidence.
Route the request
Choose the smallest mode that satisfies the request. Use full when the user asks for the complete workflow or architecture reverse engineering without narrowing the scope.
| Mode | Use when | Required result |
|---|---|---|
experience | 体验、竞品分析、用户旅程、功能拆解 | Evidence ledger, tested journey, quality findings, problems, transferable lessons |
contract | Agent/组件清单、I/O、工具、上下文、数据流 | Timeline, typed inventory, component contracts, context fields, producer-consumer map |
prompt | 提示词拆解、System Prompt、复刻某个智能能力 | One evidence-bounded functional-equivalent prompt, traceability, minimum tests |
architecture | 架构推导、逆向分析、数据实体、时序、As-Is/To-Be | Layered architecture, contexts, rules, entities, sequences, risks, traceability |
visual | HTML 架构图、可交互全景图 | Standalone HTML plus source JSON and validation result |
full | 一整套流程、完整产品解读 | Exactly three final standalone HTML deliverables: user journey, product panorama architecture, and one Agent deliverable selected by evidence |
If the request depends on prior work, inventory the supplied reports, screenshots, browser state, and operation history first. Reuse them; do not repeat a complete experience run merely to make the workflow look fresh.
Establish the analysis contract
Before acting, resolve or reasonably infer:
- Product name, official pages, and the user task or journey to inspect.
- Desired mode and depth.
- Existing evidence and whether it is current or historical.
- Mutation permissions, account boundaries, and sensitive-data boundaries.
- Comparison cases or control variables needed for a fair test.
- Output directory and requested formats.
For full, establish two directories: an internal working directory and a final-delivery directory. The working directory may contain Markdown, JSON, screenshots, notes, and validation artifacts. The final-delivery directory must contain exactly the three HTML files defined below.
Ask only when a missing answer would materially change safety or scope. Otherwise state the assumption and continue.
Execute the workflow
Read references/workflow.md and perform only the stages required by the selected mode.
1. Build the evidence ledger
- Record each source with an ID, location, visible fact, supported conclusion, grade, timestamp or run, and limitation.
- Distinguish direct observation, prior-operation residue, official description, user-provided fact, and inference.
- Capture before/after evidence for state transitions when mutation is authorized.
- Inspect accepted screenshots at full readable detail before citing them.
2. Reconstruct the product journey
- Follow one stable main case end to end.
- Vary one important control at a time when comparison is required.
- Record user action, visible response, inferred data change, executor type, evidence ID, and recovery behavior.
- Test success, correction, interruption/resume, and safe failure paths in proportion to scope.
3. Derive the component model
- Start with capabilities, not presumed Agents.
- Type every component and explicitly mark functional names that are not official product names.
- For each material component, document trigger, six input classes, observable decisions, tools, outputs, context reads/writes, upstream/downstream contracts, completion, retries, and boundary.
- Build a producer-consumer table to expose orphan fields, duplicated ownership, and hidden coupling.
4. Choose and model the Agent deliverable
For full, choose the third deliverable only from evidence:
- Produce a multi-Agent collaboration workflow when direct or strongly convergent evidence supports multiple Agents with distinct responsibilities and handoffs.
- Otherwise produce one single-Agent functional-equivalent System Prompt for the central intelligent capability.
- If evidence materially conflicts—for example, product language claims multiple Agents but observed behavior supports one undifferentiated capability—pause before final generation and ask the user to choose. Do not resolve the contradiction silently.
When producing a functional-equivalent prompt:
- Select exactly one evidence-supported intelligent module.
- Describe equivalent observable behavior, never the vendor's supposed original prompt.
- Include role, goal, boundaries, inputs, global context protocol, workflow, tool rules, user confirmation, result validation, fallback, state machine, handoff, completion, and output schema.
- Map each important prompt rule to evidence or label it as a proposed safeguard.
- Add a minimum test set covering happy path, control variation, already-small input, ambiguity, failure, interruption, and user correction.
5. Reverse-engineer the full architecture
- Build layers from channels and interaction through application, orchestration/intelligence, tools/services, model access, context/data, rules/knowledge, and infrastructure/governance.
- Model global contexts and ownership explicitly.
- Reconstruct data entities and evidence-qualified relationships.
- Draw end-to-end and failure/recovery sequences.
- Produce a conservative
As-Is, then a separateTo-Bethat addresses observed risks. - Trace every architecture component back to evidence, inference, or recommendation.
6. Produce the final standalone HTML set
For full, read references/final-html-ui.md and produce exactly:
text<product>-final/ ├── <product>-user-journey.html ├── <product>-product-architecture.html └── <product>-agent-collaboration.html
The third filename is instead <product>-agent-system-prompt.html for the single-Agent branch. Never include both Agent deliverables in the final directory.
Markdown, JSON, screenshots, raw evidence, and QA notes belong only in the working directory. They are not final deliverables.
For the architecture page, read references/architecture-html-spec.md. Its JSON renderer may be used as an internal starting point, but the delivered HTML must satisfy the final information hierarchy and UI-quality contract. If using the renderer, run:
bashpython3 scripts/render_architecture.py --input architecture.json --output product_architecture.html
All final HTML files must be self-contained, responsive, visually polished, readable without network access, and explicit about evidence grades. Reference interfaces guide layout density, hierarchy, and interaction quality; do not copy their branding or force a fixed visual template.
7. Validate before delivery
Read references/output-contracts.md and use its required structures. Then run the appropriate checks:
bashpython3 scripts/validate_deliverables.py --report analysis.md --mode full python3 scripts/validate_deliverables.py --architecture-json architecture.json --html product_architecture.html python3 scripts/validate_deliverables.py --final-dir <product>-final --product <product>
Fix missing sections, unlabeled claims, unresolved placeholders, broken Mermaid, unreadable tables, invalid edges, and unsupported certainty before delivery.
Delivery convention
Use a stable product slug. For non-full modes, create only the requested artifacts. For full, separate working files from exactly three final HTML files:
text<product>-analysis/ ├── working/ │ ├── evidence.md │ ├── architecture.json │ ├── qa-notes.md │ └── screenshots/ └── <product>-final/ ├── <product>-user-journey.html ├── <product>-product-architecture.html └── <product>-agent-collaboration.html OR <product>-agent-system-prompt.html
Do not generate empty placeholder files. In the final handoff, state:
- What was directly verified.
- What remains inferred or unknown.
- Which mutations, if any, were performed.
- Which validators ran and their results.
- Clickable paths to delivered artifacts.
Typical invocation
For “先真实体验产品,再完整拆解产品”, select full. Preserve one stable test case, reuse earlier evidence between stages, keep all mutations inside the authorized test space, and do not promote feature pages to Agents. Deliver only the three final HTML files; retain supporting artifacts internally.
Common failure modes
| Failure | Correction |
|---|---|
| Treating each page as an Agent | Start with observed capabilities, then type components from trigger/input/output/lifecycle evidence |
| Using a loading label as backend proof | Record the label as UI fact and keep component ownership inferred or unknown |
| Repeating the entire browser test for every stage | Reuse prior evidence; collect only gaps that block the current deliverable |
| Writing a plausible “original prompt” | Write one functional-equivalent prompt and trace its rules to evidence |
| Mixing current and recommended architecture | Separate As-Is and To-Be nodes, edges, diagrams, and language |
| Guessing model, framework, database, or storage | Mark the implementation unknown and propose a focused verification method |
Completion gate
Do not claim completion until all applicable statements are true:
- Evidence IDs support the central findings.
- Component types and evidence grades are explicit.
- No page or button was automatically promoted to an Agent.
- No sensitive implementation detail was fabricated or exposed.
- The main journey includes state changes and recovery behavior.
- Component contracts have upstream/downstream and completion/failure semantics.
- Prompt rules are traceable and described as functional equivalents.
- As-Is and To-Be are visibly separate.
- Unknowns and evidence gaps are listed.
- Requested files exist and automated validation passes.
- In
full, the final directory contains exactly three HTML files and no internal working artifacts. - In
full, the Agent deliverable follows the evidence-based branch; contradictory evidence was escalated to the user. - The three final interfaces meet the information-hierarchy, responsive-layout, accessibility, and visual-QA requirements.


