# Nacre Nacre is a web browser written from scratch in Rust with an egui UI, **switching from the Servo 0.7 engine to a tuned WebKit (D-032; Linux only)**, meant to replace the Python/QtWebEngine Nacre as the user's daily browser. Final deliverable: Linux (AppImage, tar.gz) builds of the browser, published through the `releases/` folder to the user's Forgejo (astar76/Nacre). Vision: [PLAN.md](PLAN.md). ## 0. Session rules — read first 1. You are started with **one plan**: `Plans//SNNN-*.md`. Read only: this file, **your plan**, the **last 3 entries** of `docs/PROGRESS.md`, and the files/sections your plan names. 2. **Do not open other files in `Plans/`** (nor `ORCHESTRATOR.md`, nor all of `PLAN.md`). 3. **Tick each checkbox in your plan file the moment it is done**, one by one, never in batches. Right after each tick, sync the tracker (§Tracker). An interrupted plan resumes at its first unchecked box. 4. **Stay in scope.** Out-of-scope ideas go to `docs/PROGRESS.md` ("Later"), not into the code. 5. **Invent nothing**: check the code/docs; if a fact is still missing, ask — the **orchestrator** if you were started by one (never the user directly), otherwise the user. 6. **End of session**: (a) end criteria verified **by commands**, not memory; (b) `docs/PROGRESS.md` entry (≤ 15 lines: done, not done, later); (c) `docs/DECISIONS.md` if a decision binds later plans; (d) tick your line in `Plans/INDEX.md` (no commentary); (e) commit `SNNN: …` and push to `origin`; (f) short report: done, not done, what the user/orchestrator must do, and any instruction that cost more than it gave. 7. **Languages**: answer in English. Code, comments and docs in English. Internal docs (`CLAUDE.md`, `Plans/`, `PROGRESS.md`) in English. 8. Also at session start (user rule): read `docs/HANDOFF.md` and `docs/STATUS.md` if they exist. `docs/DESIGN.md` is the architecture and Servo API cheat sheet; read the parts your plan names. ## Tracker Live checklist of every plan: https://claude.ai/artifact/9AD7fPfwJ4ASFzVTJGKU4h (collection `plans`, one doc per plan id). After ticking a box: `ArtifactData` `update` with `url` = the tracker, `collection: "plans"`, `doc_id: "SNNN"`, `data: {"status": "running" or "done" (all boxes ticked), "items": [{"text": "", "done": true/false}, … every checkbox of the plan in order], "updated": ""}` and `if_version` = the version returned by your previous write (first time: `get` the doc once to read it; a doc that doesn't exist yet takes no `if_version`). Load the tool with ToolSearch `select:ArtifactData` once. If the tracker call fails, keep working and say so in the report: the plan file is the source of truth. ## 1. Repository layout Root: `/home/astar76/Projects/Nacre` ``` src/ main, app (winit), window, hub (Servo delegates), tabs, actions, keys, inject, adblock, discord, media, ... src/store/ settings, history, bookmarks, downloads, vault, permissions, session, apps, scripts src/net/ bridge (local CONNECT proxy), fetch, tor, dns, download, dlm src/ui/ egui chrome, menus, dialogs, widgets, pages/* (every nacre:// page) assets/ bundled resources docs/ DESIGN, FEATURES, REVIEW, HANDOFF, UI-BRIEF, ui-reference/, PROGRESS, DECISIONS Plans/ INDEX.md, _TEMPLATE.md, one folder per category releases/ release files (git-ignored; hub-release-sync uploads them) ``` Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference only) and `~/Projects/Nacre-rust` (older repo, not a source). `target/` is build output. ## 2. Facts - **Engine switch in progress (D-032)**: the Servo facts below describe today's code until the `08 WebKit engine` plans replace it. Engine test and WebKit tuning data: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. Everything Servo-only and what WebKit must replace: `docs/engine/servo-removal.md`. - Cargo package `nacre` 0.4.0, edition 2024, Rust ≥ 1.88. Servo is `=0.7.0` from crates.io, trimmed (no WebXR, WebGPU, multiprocess). Gamepad and Web Bluetooth stay in. - Status: ~19k lines written, **never compiled**. Review passes were done by reading only. Expect a round of compile errors at the first build; fix them in place, don't restructure. - User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (Servo limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests. - Known gaps and things to check at the first build: `docs/REVIEW.md`. Feature list with file and review state: `docs/FEATURES.md`. - The original Python Nacre (`~/Documents/Apps/Nacre/nacre`, `config.py` DEFAULTS) is the feature spec. ## 3. Code rules - Write like the neighbouring code. KISS, DRY, YAGNI; no abstraction without ≥ 2 uses. - New pure logic gets a test; a bug fix gets a regression test when feasible. - Fix compile errors in place; don't restructure working modules. - Servo callbacks run on the main thread; `load_web_resource` must answer synchronously (see REVIEW.md). ## 4. Domain pitfalls (all agents) - **Builds**: `nice cargo build --release -j 2` only. The first build takes hours (Servo, SpiderMonkey, WebRender). Never run `cargo test` at the same time as a release build, and never run two cargo commands on the same `target/`. - Servo needs clang. Start from Servo's own lock versions to avoid pre-release drift (rsa/pkcs1). - Run apps in the hidden nested session (`tools/nested-session.sh`: Xvfb → nested niri, software GL; `kwin_wayland` isn't installed) unless the user asked to watch. Xvfb has no DRI3, so clients there use `LIBGL_ALWAYS_SOFTWARE=1 WEBKIT_DMABUF_RENDERER_FORCE_SHM=1 GSK_RENDERER=gl` (the session's `env` file sets them). VMs have no real GPU: use software rendering there. - Never connect to Tor or proxies in tests; `NACRE_NO_BRIDGE=1` disables the bridge for debugging. - Servo 0.7 can't add request headers, block third-party cookies, do per-WebView private mode, EME/DRM, printing: don't try, see DESIGN.md. - Several painters on one GL context (one per tab) is unproven; the fallback is in DESIGN.md. - Use throwaway `XDG_*` dirs for test runs so the user's profile is untouched. ## 5. Verification tools | Tool | Role | Available after | |---|---|---| | `nice cargo build --release -j 2` | compile check, produces `target/release/nacre` | now | | `nice cargo test --release -j 2` | unit tests (44, ~16 s test-profile build then <1 s run; shares the S001 build) (util, settings, history, bookmarks, permissions, vault, dns, bridge loopback, download, adblock, keys, scripts, updates, inject, hub, theme, ui::widgets input, ui::paint, ui::pages::newtab) | first successful build; not alongside a build | | `src/selftest.rs` | in-app self test: `NACRE_SCRIPT=` runs script commands (listed at its top) | now | | `tools/smoke.sh