Engineering Practice for Conversational Web UI Replication

    A practical guide to rebuilding conversational web products from public pages and API contracts: scoping observable behavior versus hidden internals, splitting product spec from live integration, high-fidelity structure over pixel matching, constrained improvements, evaluation weights, and a security-focused delivery checklist.

    Conversational products on the web look like an input box and a message stream. Behind that sit session state, context management, model calls, error feedback, and account policy. “Replication” is not assembling screenshots into a static page. It means reconstructing a runnable, explainable, regression-testable user path from public UI and interface documentation, without internal source. Treat it as controlled reverse productization: define what the system does, then how the UI looks, and only then optimize experience.

    Set boundaries before fidelity

    Before work starts, classify three kinds of information. Observable behavior includes new sessions, history switching, streaming output, stop generation, copy, regenerate, clear context, error messages, and length or quota limits. Citable API contracts include auth, message roles, context assembly, streaming versus non-streaming responses, and error-code meaning. Invisible implementation includes ranking, risk controls, quota math, and internal routing. The first two belong in requirements. The third is an external constraint; do not invent parameters or performance numbers.

    A product report should have four sections. The feature list is organized by user tasks, not widgets—for example, “continue asking in an existing session and keep prior context.” Information architecture describes regions: sidebar, main thread, input, settings and account entry. A state machine covers empty, generating, failed, rate-limited, and signed-out. Non-functional notes capture expected feedback timing, accessibility, and narrow-screen fit without fabricated SLAs. A structure diagram can be a hierarchy: entry, session, message, model call, settings. Each node should list inputs, outputs, and failure branches so the diagram is testable.

    Split prompting from execution

    Round one supplies only goals and materials: public pages, API notes, and three deliverables—product report, high-fidelity replica, and an improved variant. The model should state functional hypotheses and unknowns before coding. Do not inject secrets in this round so draft code never writes credentials into a repo or logs.

    Round two provides call credentials with least privilege, a short lifetime, and a ban on committing them. The task is not to rebuild the page but to wire real calls and regress. A complete run checks first message, multi-turn context, stop generation, overlong input, bad keys, network drop, and double-send. Weak runs send a single “hello” and declare done. Differences often come from agent policy—some ship a runnable sample fast, others widen tests. Score policy separately from model skill, using the same prompts and checklist.

    Acceptance scripts need not bind a framework. Encode the conversation path as repeatable steps:

    • Create a session, send a short message, confirm user and assistant messages both enqueue.
    • Ask a follow-up that depends on prior turns; confirm role order is preserved.
    • Trigger stop or timeout; the UI returns to editable input and does not insert a half message twice.
    • Use invalid credentials; show an understandable error and never echo the full secret.
    • On a narrow screen, confirm the input can still focus and send and is not covered by the safe area.

    High fidelity is structure, not pixels

    “Matches the original” should be a checklist: information architecture (regions, hierarchy, default focus); interaction (send, newline, stop, retry, copy); visual spec (type scale, spacing, bubble alignment, input size and position on desktop and mobile); copy tone for empty, loading, and failure. If those align, a shared link in another browser should not be mistaken for a missing feature.

    Keep UI state separate from call state. The UI uses explicit phases: idle, streaming, error, limited. The call layer only assembles messages, issues requests, and parses incremental content. Stream by concatenating deltas; persist the session record once on completion or failure so refresh does not drop a half sentence. History can live in a local structure with role, content, time, and status so storage can be swapped later. If deployed to the cloud, static assets may sit on object storage or a container platform. Logs and alerts should record request IDs and error classes, not conversation bodies or keys.

    Improvements must protect the main path

    An improved build is not a new product. Extra capabilities need a user benefit: clearer citation display, one-click retry after failure, sectional summaries for long threads, input length estimate, keyboard reachability. Each item must state what it does not break: default send path, visible stop control, rate limits not disguised as model failure.

    Keep replica and improved builds side by side. The replica is the baseline for fidelity; the improved build is a proposal for merge review. Review questions: Does the feature depend on unpublished data? Does it widen secret exposure? Can mobile users still send with one hand? Does empty state tell the user the next step? When borrowing industry patterns, take interaction patterns only—not another brand’s visual identity.

    Who is better at replication

    Score with four weights. Product report 30%: coverage, labeled unknowns, diagrams that guide build. Fidelity 40%: core path, state feedback, key desktop and mobile dimensions. Post-integration test depth 20%: boundary defects found and fixed. Improvement judgment 10%: restraint and reversibility. Pretty pages hide “no multi-turn.” A live API hides an input covered on mobile.

    Record failure types: missed tests, over-redesign, turning limits into fake capabilities, printing secrets in logs. Those predict maintenance cost better than a one-time demo. Teams can rerun the same checklist across models and agent setups, keep reports, pages, and test records, and treat that as an internal baseline rather than a single demo.

    Security and delivery checklist

    Read keys only from environment variables; do not persist them in the frontend; use placeholders in sample code. Re-verify share links in a signed-out or clean browser so local cache cannot fake a pass. If rate or length limits come from server policy, the UI must report them honestly; replica notes must not claim they were bypassed. Treat conversation content as sensitive; use fictional prompts in demos.

    Deliverables should include the product report and structure diagram, a replica note (done vs. not done), an improvement note (trade-offs), regression records, and a known-differences list. Replication then becomes a handoff asset: later engineers can see the boundary, re-run acceptance, and improve on a constrained baseline.