# Computer-Use Automation System An LLM discovers how to complete a task in a legacy web app once, and the run is distilled into a reusable **capability artifact**. After that the task is executed by a deterministic interpreter with **zero LLM calls** — new inputs, same flow. Discovery is a compiler. Replay is a VM. The artifact is the bytecode. **▶ [3-minute demo](https://drive.google.com/file/d/1eIgNsWc4lbPqOccaTLGtm96-e7MSX5na/view?usp=sharing)** — a deterministic replay against a member it never saw, a business outcome, and a human taking over a live run to approve an irreversible step. See [DESIGN.md](DESIGN.md) for the full spec — it is the source of truth, and this README only tells you how to run things. --- ## Quick start Everything below runs offline against a local app. **No API key is needed** to see the system work — two capabilities are already recorded and committed, and replay makes no model calls. ```bash git clone https://github.com/ShahaDeven/Project_interface.git && cd Project_interface python -m venv .venv .venv\Scripts\activate # Windows source .venv/bin/activate # macOS / Linux pip install -r requirements.txt playwright install chromium # separate ~140MB download; nothing runs without it cp .env.example .env # Windows: copy .env.example .env ``` `.env.example` works **as it is** for replay — the operator credentials in it are fabricated and the target app accepts anything. Only discovery needs a real `ANTHROPIC_API_KEY`. Now two terminals. **Leave the first one running:** ```bash # terminal 1 — the fake credit union portal, on http://127.0.0.1:5000 python -m target_app ``` ```bash # terminal 2 — replay a committed capability against a member it never saw python -m cua replay lookup_member_balance --param member_number=23456 ``` ``` Status: SUCCESS (7/7 steps, llm_call_count=0) Outputs: savings_balance = 18240.55 (float) ``` That is the whole claim in one command: recorded against member `12345`, run against `23456`, zero model calls. Then the same artifact with an input that has no answer: ```bash python -m cua replay lookup_member_balance --param member_number=99999 # BUSINESS_OUTCOME MEMBER_NOT_FOUND — an answer the caller branches on, exit 0 ``` ### Recording one yourself This is the only step that calls a model and costs money. Put a real key in `.env` first; skip it entirely if you would rather not — the two committed capabilities were produced by exactly this command, and their full model transcripts are in [`evidence/`](evidence/README.md). ```bash python -m cua discover --goal "look up member 12345 and read their savings balance" --target http://127.0.0.1:5000 --save-as lookup_member_balance ``` **→ [`evidence/`](evidence/README.md) — thirteen recorded runs with an index.** Every claim in this README is a run you can open: discovery, deterministic replay, both business outcomes, three recovered runtime conditions, a hard failure, both risk gates, and three handoffs. Start there if you would rather read than run. --- 347 tests cover the system, and two capabilities were recorded from real LLM-driven runs. Gaps found while building — including the two that only surfaced when a human drove the handoff — are logged in [FOUND_GAPS.md](FOUND_GAPS.md). --- ## Setup, in more detail **Python 3.11+.** Everything else is in `requirements.txt`, except the browser. **Why `playwright install chromium` is a separate command.** `pip install playwright` fetches only the Python client. The Chromium binary is a ~140MB download that lands in a user cache outside `site-packages`, so it cannot go in `requirements.txt` — pip resolves packages, and a browser is not one. Skip it and nothing breaks confusingly: browser tests are *skipped* with that command in the message, the other 269 still run, and the CLI exits 2 saying the same thing rather than raising a Playwright stack trace. **What `.env` holds.** Copy `.env.example` to `.env` (gitignored); the values in it already work. ``` ANTHROPIC_API_KEY=sk-ant-... # discovery only — replay never reads it CUA_SECRET_OPERATOR_ID=e.okafor CUA_SECRET_OPERATOR_PASSWORD=not-a-real-password ``` The two `CUA_SECRET_*` values are the operator credentials a capability declares in `requires_secrets`, and replay does need them — a capability that lists a secret refuses to start without it, in milliseconds, before a browser opens. The model is never handed either one: it types the token `{secrets.operator_id}` and the executor substitutes the value at the keystroke. **What that protects, precisely.** The **password never enters a transcript, trace or artifact**, because a password field's value is never read during element distillation — it does not exist in our process to leak. The **operator ID is substituted the same way but is read back like any other text input**, so once typed it does appear in the discovery transcript's observations of the page. That is a non-secret identifier and the exposure is accepted, but the boundary is worth stating plainly: a value that must not appear on screen belongs in a password-typed control, which is the one thing the executor enforces structurally. Substitution protects a secret at the keystroke, not afterwards — see [FOUND_GAPS.md](FOUND_GAPS.md) G-22. The target app accepts anything; these exist so the mechanism is real rather than mocked. --- ## Run the target app ```bash python -m target_app # or: python -m cua target_app serve ``` Serves **http://127.0.0.1:5000**. Ctrl+C to stop. Every command below needs it running. It is a deliberately hostile 2003-era credit union operator portal: nested-table layout, no `id` attributes, no `data-*` hooks, no semantic HTML5, generic class names reused for unrelated things, form fields identified only by adjacent `` text, and loan details buried in an unnamed `