File size: 19,306 Bytes
0614e14 b0ffedc 0614e14 458b1d7 0614e14 b0ffedc 458b1d7 0614e14 b0ffedc 458b1d7 0614e14 458b1d7 0614e14 b0ffedc 0614e14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | # Arx — project history and handover
This file tells the story of Arx from the first line of code to today: what was built, which problems came up, how each
was solved, and how to carry on. Give it to a new Claude session (or a new developer) first.
Last updated: **2026-10-14** (app 0.5.5, catalog 0.4).
---
## 1. What Arx is
**Arx** (by Devseis) is a free, open-source security audit for **Mac, Windows and Linux computers**.
- A desktop app runs **read-only collectors** (bash on macOS/Linux, PowerShell on Windows) that check **70 settings and
controls**, mapped to **ISO 27001:2022**, **GDPR** and the **EU AI Act**.
- A small **fine-tuned AI model** (Qwen2.5-0.5B + LoRA) runs **on the computer** (WebLLM, WebGPU) and writes the report:
findings, risk, fix steps, summary, AI-tool classification. Every AI answer is checked against the evidence; if it
fails, a fixed template is used instead.
- **Fix problems:** on Mac, Linux and Windows, Arx can change unsafe settings for you (one click, password/UAC prompt,
re-check, **Undo**). The AI never writes or runs commands; fixes are tested scripts.
- **Nothing is uploaded.** Reports stay on the computer.
The design rule from day one: **code decides pass/fail; the model only explains, prioritises and writes.**
## 2. Where everything is
| What | Where |
|---|---|
| Website + full source (this repo) | Space **[Devseis/Arx](https://huggingface.co/spaces/Devseis/Arx)** — page: https://devseis-arx.static.hf.space |
| Local working copy | `/Users/umer/Documents/6 - mix/endpoint-audit/` (untracked inside the "6 - mix" git repo; the Space is the real repo) |
| App installers | dataset **[Devseis/endpoint-auditor-releases](https://huggingface.co/datasets/Devseis/endpoint-auditor-releases)** (`latest.json`, `SHA256SUMS`) |
| AI model | **[Devseis/endpoint-auditor-0.5b](https://huggingface.co/Devseis/endpoint-auditor-0.5b)** + WebLLM builds `-q0f16-MLC`, `-q4f16_1-MLC`, `-q4f32_1-MLC`; tags **v0.3** and **v0.6** |
| Training data | dataset **[Devseis/endpoint-auditor-synthetic](https://huggingface.co/datasets/Devseis/endpoint-auditor-synthetic)**; tags v0.3, v0.5 |
| Vulnerability data | dataset **[Devseis/endpoint-auditor-vulndb](https://huggingface.co/datasets/Devseis/endpoint-auditor-vulndb)** (signed bundle) |
Licences: code **Apache-2.0** (+ `NOTICE`), data **CC BY 4.0**, `CITATION.cff`.
### Repo map
| Folder / file | Purpose |
|---|---|
| `collectors/{macos,linux}/audit.sh`, `collectors/windows/audit.ps1` | Read-only audit, writes evidence JSON + software inventory |
| `collectors/{macos,linux}/fix.sh` | One-click fixes with undo (Mac since 0.5.0, Linux since 0.5.3) |
| `catalog/checks.json` | All checks (76; 70 on computers), references, catalog version **0.4.0** |
| `library/` | `check_guidance.json` (why/risk/fix/verify per check), `controls.json` (ISO/GDPR/AI Act), `ai_tools.json`, `fixes.json` (fix catalog) |
| `schema/evidence.schema.json` | Evidence format shared by collectors, generator, app |
| `baseline.conf`, `organisational.conf` | Settings companies can edit (copied to the app's settings folder) |
| `synthetic/generate_evidence.py` | Synthetic audits with the exact collector wording (training data source) |
| `training/` | `build_dataset.py`, `train_lora.py` (`--qat4`), `evaluate.py` (`--round4`), `merge_lora.py`, `mlc_quantize.py`, `publish_model.py`, `pipeline-v0.*.sh`, `eval/*.json` |
| `vulndb/` | Builds and signs the offline vulnerability bundle (OSV, NVD, CISA KEV, EPSS) |
| `app/` | Electron desktop app (`main.cjs`, `preload.cjs`, `renderer/`), build config in `package.json` |
| `index.html`, `site/` | The website (computers only, no AI in the browser) |
| `install.sh`, `install.ps1` | One-command installers (macOS/Linux, Windows) |
| `mobile/` | Phone evidence code, still used by the synthetic generator (the phone web page was retired) |
| `tools/` | Validators, renderers, `hf_cleanup_old_releases.py`, `check_4bit.py` |
| `docs/MODEL_LLM.md`, `docs/CONTROLS.md` | Model versions and roles; generated control table |
| `archive/` | Local only, **never upload** (old web chat copy) |
## 3. Current state (2026-10-14)
| Part | State |
|---|---|
| **Website** | Computers only. Detects the OS and shows **one install command** with Copy; lists all 70 checks; shows a report from the app ("Open report with fixes") or an opened `…-evidence.json`. Hero label "Arx - Fine-tuned AI Model". |
| **Install** | `curl -fsSL https://devseis-arx.static.hf.space/install.sh \| bash` (macOS, Linux) · `irm https://devseis-arx.static.hf.space/install.ps1 \| iex` (Windows). Checks SHA-256 against `SHA256SUMS`; no "Open Anyway", no SmartScreen. |
| **App** | **0.5.5**. macOS: tested on a real Intel Mac. Linux: tested in Ubuntu containers (app headless + fixes). Windows: **built, never run on a real PC**. |
| **Fix problems** | Mac: 17 one-click fixes + Settings pages. Linux: 17 one-click fixes. Windows: 29 one-click fixes + Settings pages (`fix.ps1`; logic tested with mocked OS calls, **never run on a real PC**). Password/lockout values come from `baseline.conf`. |
| **AI** | `app/model-version.json`: `version` **v0.3** (full-precision `q0f16`, chips with 16-bit maths), `version_4bit` **v0.6** (4-bit builds). Both 24/24 on the catalog-0.4 checks without retraining. |
| **Vulnerability data** | Built **2026-10-08**; reports flag it as old after 14 days → **refresh before 2026-10-22**. |
## 4. Timeline: how we got here
### Phase 1 — Foundations (2026-10-07)
- **Built:** read-only collectors for Windows (PowerShell 5.1), Linux and macOS (bash 3.2), following the user's own
report samples; evidence schema; check catalog; `baseline.conf` / `organisational.conf`; synthetic evidence generator;
validator and report renderer.
- **Library + training data:** control library, per-check guidance, AI tool list; `build_dataset.py` turns evidence into
chat-format examples for 3 tasks (finding, summary, AI classification), with the reference material in every prompt so
the model learns to stay grounded. First set: 29,000 template-built examples.
- **Decisions:** train **offline on this Mac** (Intel i7 4-core, 32 GB, no usable GPU) with **Qwen2.5-0.5B-Instruct +
LoRA**; client = **Electron + WebLLM** (approval screen, live progress, PDF, auto-save after 60 s).
- **App built and tested end to end** the same day. The base model failed every grounding check (0/30), so a
fine-tuned model was required.
### Phase 2 — First model and vulnerabilities (2026-10-08 → 10-09)
- **Hurdle: training went NaN.** Cause: PyTorch 2.2 `sdpa` attention gives wrong gradients with several threads on this
Intel Mac. **Fix:** `attn_implementation="eager"`, a non-finite-gradient guard, numbered checkpoints.
- **Catalog 0.2** (68 checks); collectors 0.2 tested on a real Mac and in Ubuntu/Fedora containers (Colima).
- **Offline vulnerability matching:** collectors save a software inventory; `vulndb/build_bundle.py` builds a **signed**
bundle (OSV for Linux distros, NVD for 33 apps, CISA KEV, EPSS); the app matches versions exactly — never the model.
*Hurdle:* python.org's `python3` lacks CA certificates → use `/usr/bin/python3` or the training venv.
- **Everything made open source and public** (user's choice).
- **Model v0.1 published.** *Hurdle:* MLC's own converter could not run on this Mac → wrote `training/mlc_quantize.py`
(verified bit-for-bit against mlc-ai builds). *Hurdle:* WebLLM `json_object` without a schema crashed → constrained
decoding with per-task schemas (`ANSWER_SCHEMAS`). *Hurdle:* summaries got arithmetic wrong → the prompt now carries the
computed score and top gaps.
- **Catalog 0.3** added phones (iOS, Android) with a browser "phone check"; **model v0.3** (3,000 examples, 375 steps):
**100% valid, grounded and exact fields** on 60 held-out examples; on a real Mac audit it wrote 36/36 report parts.
- **Desktop apps 0.3.0 released** (Mac universal, Windows beta, Linux AppImage/.deb).
### Phase 3 — The web chat experiment (2026-10-10 → 10-13)
- User chose a Nox-style **chat assistant** as the website front page: WebLLM in the browser, grounded in a 321-passage
knowledge base (`library/knowledge.json`), audit hand-over from the app.
- **Renamed to Arx** (fortress icon); Space moved to `Devseis/Arx`.
- **Model v0.4 = Qwen2.5-1.5B** for chat + reports (~2.5 days of CPU training). *Hurdle:* on this Intel Mac the 1.5B
WebLLM build wrote junk and the GPU faults **logged the user out twice**. On the CPU the same weights scored 10/10, so
the fault was the Mac's GPU path. Rule since: no large WebLLM GPU tests on this Mac without asking.
- **v0.5 = 0.5B for chat + reports** (smaller, phone-friendly), including device-aware examples.
*Hurdle:* **v0.5 broke when rounded to 4 bits** (the browser build), although it was perfect in full precision.
Found by simulating the exact q4f16_1 rounding on the CPU.
- **v0.6 = v0.5 retrained 4-bit-aware** (`train_lora.py --qat4`: every forward pass through the exact rounding).
Test-set scores were perfect, **but** on naturally worded questions the 4-bit chat invented links and refused
answerable questions. Lesson: the held-out test set is templated like the training data and overstates real quality.
- Other chat hurdles: iPhone Safari/Chrome killed the tab (the 950 MB 16-bit model was too big for iOS) and lost the
chat; the model copied earlier answers when given chat history; Intel Iris graphics froze the Mac during generation.
### Phase 4 — Back to the core: an audit tool for computers (2026-10-14)
- **Decision: remove the web chat.** The AI runs **only inside the desktop app**, on structured report tasks, where the
small model is excellent. The website was **rebuilt** (style inspired by trustmrr.com): computers only, check list,
report viewer, no AI in the browser. Chat code archived locally.
- *Hurdle:* **v0.3 also fails in 4-bit** (21–33% valid), affecting computers whose graphics chip lacks 16-bit maths.
**Fix:** the app picks the model per build — v0.3 full precision, **v0.6 in 4-bit** (findings 43/43, classification 9/9,
summaries 7/8; a failed summary falls back to the template).
- **App 0.4.3:** renamed to **Arx** everywhere (files, app, shortcut); settings folder kept at
"Devseis Endpoint Auditor" so nothing is lost; installer window with first-open steps.
- **App 0.5.0 — Fix problems (macOS):** `library/fixes.json` + `collectors/macos/fix.sh`. The app passes only catalog fix
IDs; old values are saved (root-only state file) for **Undo**; MDM-managed settings are skipped; fixes and the re-audit
run under **one** password prompt. Tested by the user on their Mac (stealth mode, analytics). *Hurdle:* in development
mode macOS privacy protection (TCC) hid `~/Documents` from the admin process → scripts are copied to a temp folder.
- **App 0.5.1 — catalog 0.4 (70 checks):** unique user login, prohibited software (`PROHIBITED_SOFTWARE`), tamper
protection on Mac (SIP) and Linux (SELinux/AppArmor), encryption product named. Both models handled the new checks
**without retraining** (24/24). *Hurdle:* "µTorrent" broke Windows PowerShell 5.1 (UTF-8 without BOM) → match "Torrent".
- *Hurdle:* **macOS 26 "Open Anyway" did nothing** for the unnotarised app → workaround `xattr -dr com.apple.quarantine`.
- **App 0.5.2:** closing the window left a hidden process; the next launch **froze** (second copy waiting on the settings
lock). **Fix:** closing the window quits Arx; single-instance lock hands a second launch to the running copy.
- **App 0.5.3 — Fix problems (Linux):** `collectors/linux/fix.sh` (firewall with SSH kept open, automatic updates,
network time, guest login, usage reporting, automatic login, ClamAV only where ClamAV runs). Tested fix → re-audit →
undo in Ubuntu containers; files restored byte-for-byte. Also fixed a false "firewall on" (empty nftables ruleset).
- **One-command install (user's decision):** website shows only `install.sh` / `install.ps1`. Files fetched by
curl/PowerShell are not quarantined, so **no Gatekeeper/SmartScreen block** — no notarisation needed for this path.
- **App 0.5.4:** clearer "Ready to audit" screen (two rows of check groups with descriptions and counts).
- **App 0.5.5:** **All results** after the audit: every check with its status and filters; a click shows why (found vs
required, finding, why it matters, risk, how to fix, how to check, references, detected or self-reported).
- **Fix problems: passwords, lockout and Windows (2026-10-15, not released yet):** the password-length check reads the
*policy* (shortest password the system accepts), not your password, so a long password does not change it — the macOS
default policy is 4. New one-click fixes on all systems for password length, complexity, history, expiry (and minimum
age on Linux/Windows) and account lockout, with values from `baseline.conf` (`--baseline` / `-Baseline`).
macOS: Arx's own `pwpolicy` entries (`com.devseis.arx.*`) at the top of the global policy; undo removes only those
(original kept in `<state>.pwpolicy`); automatic login off (no undo: the saved password is deleted). Linux:
pwquality.conf (libpam-pwquality installed if missing), pam-auth-update profiles `arx-pwhistory`/`arx-faillock*` on
Ubuntu/Debian, authselect features on Red Hat-type; login.defs + chage; tested apply → re-audit → login/lockout/
password-change → undo in Ubuntu 24.04 and Fedora 40 containers. Windows: `collectors/windows/fix.ps1` (secedit,
firewall profiles, Defender real-time + signatures, screen lock, telemetry, updates, time, guest, auto sign-in,
audit policy, USB write, Recall) wired into the app. Shared fixes (lockout ×3, screen lock ×3) show as one item.
Linux audit fix: `pwquality.conf` is read after `pwquality.conf.d/`, so its values win.
- **Hugging Face clean-up:** only what is used remains (model tags v0.3 + v0.6, data tags v0.3 + v0.5, latest release).
## 5. Hurdles and lessons (quick reference)
| Problem | Cause | Fix / rule |
|---|---|---|
| Training loss NaN | torch 2.2 sdpa on multi-thread Intel CPU | `eager` attention, NaN guard |
| Model fine in tests, junk in browser | 4-bit rounding (q4) destroys some fine-tunes | Test with `evaluate.py --round4` + `tools/check_4bit.py`; train with `--qat4` |
| Perfect test scores, bad real answers | Test set is templated like training data | Always add hand-written natural prompts before publishing |
| Mac logged out during GPU tests | Intel Iris GPU faults with large WebLLM models | No big WebLLM GPU tests on this Mac without asking |
| iPhone tab reloads | iOS per-tab memory limit vs 950 MB model | No in-browser AI on phones (now no in-browser AI at all) |
| "Open Anyway" does nothing / app blocked | Unnotarised app + macOS 26 | One-command install (no quarantine); real fix = Apple notarisation |
| Arx frozen at launch | Hidden first copy holding the settings lock | Quit on close + single-instance lock (0.5.2) |
| "Operation not permitted" in dev mode | TCC protects ~/Documents from admin process | Dev mode copies collectors to a temp folder |
| µ character broke PS 5.1 | UTF-8 without BOM | Keep `.ps1` files ASCII |
| HF deletes/tag removal blocked for Claude | Claude Code permission check | Claude writes dry-run scripts; **the user runs them** with `--apply` |
| python3 TLS errors | python.org build lacks CA certs | Use `training/.venv/bin/python` or `/usr/bin/python3` |
## 6. How to work on it
**Build and test the app** (in `app/`):
```bash
npm test # prompt parity + vulnerability matcher (55 checks)
npm run dist; npm run dist:win; npm run dist:linux # Mac universal (+ zip with help file), Windows, Linux
DEVSEIS_SMOKE=/tmp/s "dist/mac-universal/Arx.app/Contents/MacOS/Arx" # automated audit + report
DEVSEIS_SMOKE=/tmp/s DEVSEIS_FIX_DRY=1 node_modules/.bin/electron . # also the Fix flow, changing nothing
CFFIXED_USER_HOME=/tmp/home … # run a test copy beside the user's running Arx (separate settings/lock)
```
Linux app headless in Docker: install the `.deb`, then `xvfb-run -a /opt/Arx/arx --no-sandbox` (sandbox flag only for
Docker). Windows scripts: parse/logic-test in `mcr.microsoft.com/powershell`.
**Release** (done by hand so far):
1. Bump `app/package.json` version; update the version text in `index.html`.
2. Build all three; smoke-test the Mac app (and the Linux `.deb` in Docker).
3. Stage `Arx-<v>-*` files; `shasum -a 256` → `SHA256SUMS`; write `latest.json` (version, notes, file/size/sha per OS);
update the releases `README.md` table and notes.
4. `hf upload Devseis/endpoint-auditor-releases <stage> . --repo-type dataset`.
5. Upload changed source to the Space with explicit `--include` paths (never `archive/`, `training/models`, `*/out*`).
6. Later, the user runs `tools/hf_cleanup_old_releases.py --apply` to keep only the current release.
**Model work:** `train_lora.py` (add `--qat4` for 4-bit safety) → `evaluate.py` (full and `--round4`) →
`tools/check_4bit.py` on natural prompts → `merge_lora.py` → `mlc_quantize.py` (q0f16, q4f16_1, q4f32_1) →
`publish_model.py`. The `pipeline-v0.*.sh` scripts chain these unattended. Then set `app/model-version.json`.
**Vulnerability data refresh:** `/usr/bin/python3 vulndb/build_bundle.py` (≈1 GB of downloads) →
`node vulndb/sign-bundle.mjs` (private key `~/.devseis/vulndb-ed25519-private.pem`, never in the repo) → upload to
`Devseis/endpoint-auditor-vulndb`. Installed apps fetch it automatically.
## 7. Rules agreed with the user
- Code decides compliance; the AI only explains. **The AI never writes or runs commands.**
- **Never upload real audit evidence** (personal data). Training data is synthetic only.
- Read-only by default; a change happens only after the user ticks a fix, sees what changes and enters a password;
every fix can be undone. No permanent admin rights or background helper (least privilege).
- Hugging Face deletions are run by the user (scripts with dry run first).
- Ask before heavy GPU tests on the Intel Mac.
- Keep only what is in use on Hugging Face.
## 8. Open items / next steps
1. **Refresh the vulnerability data before 2026-10-22**, then automate a weekly refresh.
2. **Windows:** first real test on a Windows 10/11 PC or VM (app, audit, `install.ps1` silent install, and every
fix in `fix.ps1`: apply → re-audit → undo).
**macOS:** run the password/lockout fixes once for real (`pwpolicy -setaccountpolicies` was only tested with a stand-in).
3. **Linux:** test on a real desktop (pkexec prompt) and on Red Hat/Fedora (firewalld, dnf-automatic).
4. **Apple notarisation** ($99/yr Developer ID) and a **Windows code-signing certificate**, so direct file downloads
also open without warnings.
5. Expert review of `library/` wording and fix steps.
6. Releases repo currently holds 0.5.3, 0.5.4 and 0.5.5 → run `tools/hf_cleanup_old_releases.py --apply` when ready.
## 9. Starting a new session
Give Claude this file and say what you want next, for example:
> Read `HANDOVER.md` in the Arx repo (Space Devseis/Arx; local copy in `/Users/umer/Documents/6 - mix/endpoint-audit/`).
> Continue with: refresh the vulnerability data.
|