# Medlar Medlar is a download manager for Linux in Rust and egui: all of Free Download Manager's features and more, downloads split into dynamic parts, limits, priorities, queues, video sites, a local port that takes downloads from browsers, and a Material You (M3 Expressive) interface with spring motion and wavy progress bars. What it must do: [docs/FEATURES.md](docs/FEATURES.md). Final deliverable: a tested AppImage and tar.gz, for the user and for release on Astar Hub. Vision: [PLAN.md](PLAN.md). ## 0. Session rules — read first 0. If `docs/HANDOFF.md` exists, read it and `docs/STATUS.md` 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` if it is set; (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, short (the user is on a tight budget). Code, comments and user-facing text in English. Internal docs (`CLAUDE.md`, `Plans/`, `PROGRESS.md`) in English. ## Tracker Live checklist of every plan: https://claude.ai/artifact/XouimfVJS6FYVKskGJ8s7H (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: the folder holding this file ``` Keep this list true (tools/, assets/ and docs/CONNECTOR come with their plans): crates/core/ engine, limits, queues, store, connector server; no UI code crates/app/ egui app: theme, motion, widgets, views, dialogs, tray crates/cli/ command line and headless mode, a library used by the `medlar` binary crates/testserver/ local server with faults for tests (ranges, throttle, cuts, expiry, logins) tools/ screenshot, hidden-run, icon and packaging scripts assets/ icon, fonts, Material Symbols docs/ FEATURES, PROGRESS, DECISIONS, STATUS, CONNECTOR; tracker.html is the tracker page's source Plans/ one plan per session ``` Never modify: everything outside this folder. `~/Projects/*` is read-only reference (copy code in, never edit there). `~/.abdm` and the running AB Download Manager are the user's: never stop, read or reconfigure them. ## 2. Facts - Reuse (the user's own code, read-only): Damson `src/motion.rs` (spring presets), `src/theme.rs` (OKLCH roles from a seed); Mulberry `src/ui/shape.rs` (morphing shapes), `src/ui/widgets.rs` (`wavy_slider`, buttons, menus), `src/tray.rs`; Nacre `tools/nested-session.sh`, `tools/hidden.sh` (hidden nested niri runs) and `src/net/dlm.rs` (`custom_body`: the JSON Nacre posts). - Seen on crates.io 2026-11-24: eframe/egui_kittest 0.37.0, tokio 1.54.1, hyper 1.13.0, reqwest 0.13.5, axum 0.8.9, suppaftp 13.0.0, russh 0.65.4, rusqlite 0.43.0, ksni 0.3.7. Check the docs of the pinned version before using an API. - This PC: Arch Linux, niri (Wayland), 4 cores, 16 GB, Rust 1.99.1. - Download nothing but Rust crates (D-011). Here already: /usr/bin/yt-dlp, /usr/bin/ffmpeg, 7z, bsdtar, unzip, `~/Projects/Mulberry/dist/appimagetool`. Not here: clamscan, node, docker. - The browser side is Nacre's `POST /` JSON (D-003, D-010). A built Nacre is at `~/Projects/Nacre/target/release/nacre`; run it only hidden with a throwaway home. - The line is slow: never download large files for tests. All engine tests use `crates/testserver` on 127.0.0.1. - Ports: Medlar 17616 (D-006). 15151 and 38151 belong to the user's AB Download Manager. ## 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. - UI work loads the `app-taste` skill first and follows it; motion work also loads `animate`. Interface colours, radii, spacing, type and motion come from tokens only. - Wavy bars and other motion run only while something really changes; idle draws no frames. - `core` never depends on egui. Every engine behaviour has a test against `testserver`, including the failure paths. - Errors reach the user as plain words: what failed, then why. Every user string goes through the string catalogue (FEATURES 8.5). - Follow the pattern of real products only for mechanics; the look, name, icon and copy are Medlar's own. ## 4. Domain pitfalls (all agents) - Never connect to Tor or public proxies in tests. Proxies are tested against a local stub. - Any web page can reach 127.0.0.1: refuse any request with a web `Origin` or a foreign `Host`, send no CORS headers, and show the Add dialog unless the user turned that off. Remote control and REST need a token. - File names come from servers and pages: strip path parts, control characters and leading dots, cap the length, never overwrite silently. - Child processes (yt-dlp, ffmpeg) get user links: use `--`, never a shell. Cookies and logins never appear in logs or process arguments. - HTTP/2 puts all parts on one connection: force HTTP/1.1 for segments. A 200 answer to a range request means no resume; never write it at an offset. - Content-Encoding breaks ranges: ask for `identity` and check. - Run apps hidden (kittest or nested niri) with a throwaway `XDG_*` home unless the user asks to watch. Power actions are tested against a fake logind only. - DRM, captchas and paywalls are never worked around. ## 5. Verification tools | Tool | Role | Available after | |---|---|---| | `nice cargo test -j 2` | unit and engine tests | 01 Foundation | | `MEDLAR_SHOTS=dir nice cargo test -j 2 -p medlar --test shots`, then `tools/contact.sh dir` | screenshots light and dark (`SCENE`, `SIZES=WxH,…`, `HOVER=x,y`, `PRESS=1`); add the view to `SCENES` | S003 | | `tools/hidden.sh [driver.sh] [WxH]` | the release build in a hidden nested niri with a throwaway home: click, type, grab, cpu | S003 | | `MEDLAR_SEQUENCE=dir nice cargo test -j 2 -p medlar --test visuals sequence`; `cargo run -p medlar --example visuals` | progress widgets frame by frame; live with a scrubber | S014 | | `python3 tools/gen_assets.py icons` | adds icons: put the name in `tools/icons.txt` first | S003 | | `nice cargo build --release -j 2` | release build (never at the same time as the tests) | 01 Foundation | | `nice cargo test -j 2 -p medlar-testserver` / `cargo run -p medlar-testserver -- [--port N] [--tls] [--media] [--proxies]` | local server with faults and proxy stubs; API in the `crates/testserver/src/lib.rs` header | S002 | | `ssh root@192.168.1.71 hub-release` | release notes on Astar Hub (release only, after the user's yes) | now | Don't assume a tool exists: check first. When your plan creates a tool, add its row here. ## 6. Git Remote: Astar Hub only (`forgejo:astar76/Medlar.git`, see the user's global CLAUDE.md). Commit locally always; push only if `origin` is set. Never GitHub. Releases only through `releases/v/` after the user says yes. One commit per logical step, message `SNNN: …` in English. No `reset --hard` / force push without an explicit request. ## 7. Definition of done A plan is done when: all end criteria are **verified by command or test**; planned builds/tests are green; nothing regressed; `PROGRESS` / `DECISIONS` are up to date; the INDEX line and tracker are ticked; the work is committed. Say explicitly what was **not** done or verified.