Files
frameledger/docs/02_SPEC.md
poli0981andClaude Fable 5.2 3a4765ef55 docs(advanced): train B planned - three releases, the struct-version table from the upstream tags, the Agent's cost measured in a real session and NFR-2 amended to 2.5 % (Advanced B PR-1, D110-D117) (#395)
Train B (what only a hooked game can say) is three releases: beta.40 more fields of calls already hooked and no new
patch site; beta.41 slSetConstants + ffxConfigure; beta.42 slGetFeatureVersion + slGetFeatureRequirements. Inside the
game too, off means nothing more is read. docs/17_HOOK_ENGINE.md gains which struct version carries which field,
compared across sixteen Streamline and ten FidelityFX tags. tools/agent-cost.ps1 measures the shipped Agent in a
session: 1.93 % of one core off, 2.04 % on; the owner amended NFR-2 to 2.5 %. HANDOFF records beta.39's release facts.
ShmDrainIntegrationTests waits Init out and prints the guard's verdict.

Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 16:58:01 +00:00

21 KiB
Raw Permalink Blame History

02 — Specification

Requirement IDs (FR-x, NFR-x) are referenced by other docs, commits, and tests.

Functional requirements

FR-1 Game library

  • FR-1.1 Add game by picking an .exe, or drag-dropping an exe/shortcut.
  • FR-1.2 Auto-import from Steam, GOG Galaxy, Epic, itch.io with a review checklist — and, since beta.33 (D79), the Xbox app and the Microsoft Store (GDK titles: each drive's .GamingRoot folders and each game's package files, 05_DETECTION §Platform signatures & metadata). Import never enables hooking for anything.
  • FR-1.3 Editable metadata (name, cover, publisher, version, notes); auto-detected fields badged and overridable. (The cover is built since beta.23, D60: the user's own image, else the Steam or GOG GALAXY app's artwork on this PC — 08_UI §Games; since beta.33 also the square logo and splash image an Xbox game ships in its own package folder.)
  • FR-1.4 Remove game (asks whether to keep or delete its sessions).
  • FR-1.5 "Supports" row shows shipped-capability hints (DLSS/FSR/XeSS/FG) — visually distinct from measured per-session values (05_DETECTION §Capability hints).
  • FR-1.7 Delete all sessions (beta.11, owner decision D40): of one game from its page, or of every game from Settings ▸ Data, after a confirmation that says how many — with their frame and sensor series and notes; the library, the settings and every consent stay. The Agent deletes them (the rows are its, 06_DATA_MODEL §Writer ownership) and refuses while a session it would delete under is being recorded.
  • FR-1.8 Uninstalled games leave the library by themselves (beta.19, owner decision D55, amending D41): an entry whose executable has been gone for ten minutes — its drive connected and the folder it was installed in still there, so an unplugged or re-lettered drive never counts, and neither does a folder Windows will not list (ExecutablePresenceProbeTests) — and that has no session (stored, being recorded or waiting to be recovered) is removed by the Agent, behind Settings ▸ Data ▸ Remove uninstalled games (on by default). Never an entry carrying an anti-cheat block, an exception or a failed-trial mark (FR-2.2, rule 2). The App is told (GameRemoved).
  • FR-1.9 Play (beta.21, owner decision D59): a game's page and each library entry start the game — through the app of the store whose own records name its folder (Steam, the Epic Games Launcher, GOG GALAXY, itch), or by the agent's launch mode (FR-3.2), as Settings ▸ Games says; never as administrator, and never in a viewer (08_UI §Games). (beta.33, D80: a game the Xbox app or the Microsoft Store installed starts through Windows in either mode — its package activated as its Start-menu tile does — and never by the agent's launch mode, which cannot start it in its package.)
  • FR-1.6 Recording switch per entry (2026-09-23, HANDOFF D29): off, the program is not watched at all — no session, no measurement, no injection — and a session of it that is running stops. On by default; entries an old import made for Steam's own tools start with it off. The library card says "Not recorded".
  • FR-2.1 Hooking is off by default for every game. Enabling requires a per-game consent dialog stating what is injected, why, and the anti-cheat/ban risk.
  • FR-2.2 The static anti-cheat pre-scan disables the toggle outright for titles shipping anti-cheat; the reason is shown and the control is not clickable. Since 2026-09-25 (beta.8, owner decision) the Agent runs that pre-scan over every library entry itself — once per rules version and executable, whether or not hooking was ever asked for — and by default the game's page shows only the finding in place of the Hooking card (Settings: Hide hooking on anti-cheat games, ui.hide_anticheat_hooking); the library card says "Anti-cheat". The reason is always on the page (19_SAFETY §What a finding does to the game).
  • FR-2.3 The runtime guard refuses injection and refuses to continue a session when anti-cheat is detected. No override exists anywhere in the UI, config, or CLI. (Since 2026-09-26 one narrow, evidence-bound exception exists — FR-2.8. It is not an override: the guard still runs every check and decides itself which anti-cheat family it may let through.)
  • FR-2.4 Global "disable all hooking" kill switch in Settings; also honored by the Vulkan layer.
  • FR-2.7 (owner decision 2026-09-22; it was a per-game override for one day, withdrawn) A finding about a game — anti-cheat named in its process, on its title lists or in its folder — turns hooking off for that game wherever the guard makes it: at the pre-scan, at a session's start, at the 30 s re-scan, or (since 2026-09-25) at the Agent's pre-scan of the library. The row carries the reason, the game's page and the notice say so, and nothing overrides it (19_SAFETY §What a finding does to the game).
  • FR-2.8 (owner decision D33, 2026-09-26) The user-mode anti-cheat exception. A Settings option, off by default, lets the user grant a per-game exception to a game whose only anti-cheat findings are ONE family that is user-mode throughout (no driver, service or .sys in the floor or the rules), whose install tree holds no .sys, which is on no title list, and which FrameLedger has measured hooked at least twice (successful Tier-1 sessions) and no exception of which ever ended during its trial (D38, 2026-10-03: a grant needs no session; its first two hooked sessions are a trial, and an end during the trial — any end below, or a stored hooked session with no frames or an abnormal exit — ends it for good, games.ac_exception_trial_failed_at). The Agent computes that eligibility itself; the user grants each game through a versioned disclosure that states the ban risk; hooking is then turned on through FR-2.1's dialog as ever. Machine-wide drivers and services, title lists, kernel drivers in the game folder, the fuzzy tier, a scan that could not finish, an unreadable process, a 32-bit game, the kill switch and Vulkan are never excepted. A new finding, a crash / safety unhook / Overlay stop under it, or a changed executable ends it; the option off suspends it; the block itself is never cleared and stays shown (FR-2.2). Sessions under it are marked with the family (19_SAFETY §The user-mode exception).
  • FR-2.5 Repeated crashes shortly after injection auto-disable hooking for that game, with an explanation and a manual re-enable path.
  • FR-2.6 Users can always see, per session, which tier produced the data.

FR-3 Session capture

  • FR-3.1 Watcher detects tracked exe launches (1 Hz) and captures automatically at the highest permitted tier.
  • FR-3.2 Launch mode: start the game from FrameLedger for suspended-launch injection (catches startup-time upscaler init). (The App reaches it since beta.21: Play set to Start directly sends LaunchGame — FR-1.9.)
  • FR-3.3 Attach mode for games launched externally; sessions flagged late_attach.
  • FR-3.4 Track the process tree; capture the descendant that actually presents.
  • FR-3.5 Per-frame records for the whole session; telemetry at 1 Hz (configurable 0.5–2 s).
  • FR-3.6 Session ends on process-tree exit, safety unhook, or user stop. Sessions under the minimum length (default 30 s) are discarded.
  • FR-3.7 Crash detection: nonzero exit code an exception's exit code (corrected 2026-10-04: since beta.8, ExitStatusMapper.IsExceptionCode — End task's exit code 1 is normal, the code kept in capture_notes; 04_CAPTURE §Crash & exit classification) or matching Application Error 1000 / WER 1001 events → exit_status = crashed.
  • FR-3.8 Post-session toast with summary + "View".
  • FR-3.9 Pause/resume capture globally from tray.

FR-4 Metrics (definitions in 03_METRICS, which is authoritative)

  • FR-4.1 Per session: Avg, Median, Min, Max FPS; 1% Low; 0.1% Low; frametime σ; stutter count and time %; frame counts; duration.
  • FR-4.2 Native vs Displayed FPS + FG factor, always shown together (62 → 118 FPS (×1.9 FG)).
  • FR-4.3 (Tier 1) Measured upscaler identity, quality preset, render resolution, output resolution, upscale ratio; mid-session changes captured as segments.
  • FR-4.4 (Tier 1) Measured RT activity (rt_frame_pct, rays_per_pixel, RT PSO count); RR from the NGX feature; PT as a confidence-scored suggestion only.
  • FR-4.5 (Tier 1) Per-process VRAM usage/budget and budget-exceeded percentage. (beta.12, owner decision D43: the usage half is met for both tiers from outside the game — the game process's dedicated and shared GPU memory, Task Manager's columns — with its private working set, working set and commit beside it, mean / median / peak (03_METRICS §Game process memory). The budget and its exceeded percentage stay unmeasured, 20_OPEN_QUESTIONS §M11.)
  • FR-4.6 (Tier 1) PSO-compilation stutter attribution; (Tier 1 + Reflex) PC latency avg/p95.
  • FR-4.7 Telemetry aggregates: CPU/GPU temp, hotspot, loads, power, throttle %, RAM. (beta.12: every stored series also has its median and minimum, in sensor_stats_json.)
  • FR-4.8 Sufficiency guards: 0.1% Low needs ≥ 10,000 app frames, 1% Low ≥ 1,000; else N/A.
  • FR-4.9 Any metric unavailable at the session's tier renders N/A — never an estimate presented as measurement.

FR-5 Visualization

  • FR-5.1 Session summary: stat cards + frametime timeline + FPS histogram + sensor overlay + segment ribbon.
  • FR-5.2 Game detail: frametime, distribution, percentile curve, trend over sessions with hardware-change markers, sensors, and (Tier 1) a latency tab.
  • FR-5.3 Charts handle ≥ 500k points via min/max decimation; zoom/pan; PNG export.
  • FR-5.4 Native/Displayed toggle wherever FG data exists.
  • FR-5.5 Stutter markers annotated with cause when known (PSO compile, VRAM budget exceeded).
  • FR-5.6 (owner decision D101, 2026-11-11) Advanced metrics: an option, off by default, and a page of its own that shows what the vendor interfaces make available — NVAPI, LibreHardwareMonitor through PawnIO, and in later releases Streamline and FidelityFX inside the game — each value under what it belongs to, the PC or one session, and each value that is not read listed with the reason. Off means nothing more is read or stored. 18_GPU_VENDOR_APIS §Advanced metrics is the design and the inventory. (Not built: the catalog exists, nothing reads it yet.)

FR-6 History & comparison

  • FR-6.1 Sessions table per game: date, duration, tier badge, Native, Displayed, FG×, lows, resolution + upscaler, RT/PT/RR chips, crash badge, tags.
  • FR-6.2 Compare 2–5 sessions; mixed-tier comparisons require explicit acknowledgement and are marked on the chart.
  • FR-6.3 Hardware snapshot per session; trend charts mark changes ("GPU driver 572.16 → 576.02") — since beta.30 a numbered badge per day that changed, its changes listed under the chart (owner decision D70).
  • FR-6.6 Charts across a game's sessions (beta.11, owner decision D39): the Sessions tab opens with an overview of every hooked session's rate and lows (Presented FPS, or Native and Displayed where frame generation was measured; 1% and 0.1% lows), a click selecting the session; and the Trend draws more metrics beside the selected one, two units at most (the second against the right axis).
  • FR-6.4 Sessions with mid-session settings changes are excluded from trends by default, with a toggle.
  • FR-6.5 Session tags and notes.

FR-7 Detection

  • FR-7.1 Static: engine, engine version, store platform, store id, publisher, game version (05_DETECTION; the Unreal Engine version since 2026-09-27, §Engine version).
  • FR-7.2 Runtime: API, present mode, swap effect, HDR, upscaler, FG, RT — all Tier 1, all measured. (Present mode and HDR have no writer yet, 05_DETECTION §Runtime facts; swap effect is written since beta.10 from the display-mode sample.)
  • FR-7.4 Display mode (beta.10, owner request 2026-09-27): how each session's game was shown — exclusive fullscreen, borderless, windowed, minimised, or fullscreen or borderless where nothing could tell the two apart — as a share of the session's time, with the window, back buffer and monitor sizes; both tiers (Tier 2 from the window alone); shown on the session summary, the game page, the Trend (three share metrics) and Compare, and exported (03_METRICS §Display mode).
  • FR-7.3 Rules ship as detection-rules.json, updatable independently of releases; anticheat-block updates apply regardless of the user's rules auto-update preference. (Unmet — corrected 2026-10-04: there is no rules feed and no auto-update preference. Rules change only with a release: RulesSeeder installs them, Tools ▸ Update detection rules re-seeds them — 20_OPEN_QUESTIONS §S20 feed half.)

FR-8 Tri-state flags

  • FR-8.1 Yes / No / N/A for Ray Tracing, Path Tracing, Ray Reconstruction, per session, with source (measured | manual | inherited).
  • FR-8.2 Auto values require positive evidence; PT never auto-promotes to Yes.
  • FR-8.3 Manual override per session and per game (game default inherited by future sessions), visually distinct from measured values.

FR-9 Export

  • FR-9.1 Per-frame CSV including tier, resolutions, upscaler, RT and latency columns.
  • FR-9.2 Session JSON (metadata + aggregates + segments).
  • FR-9.3 Chart PNG.

FR-10 Settings

beta.10 (D34): "Agent elevation (optional — explains what it unlocks)" is the admin mode — Run the agent as administrator, off by default, a disclosure before it turns on, Windows' prompt at every Agent start (01_ARCHITECTURE ADR-9, 08_UI §Settings). Language (en/vi/ja), theme, start with Windows, minimize to tray, background capture, global hooking kill switch, min session length, telemetry interval, retention, Agent elevation (optional — explains what it unlocks), Vulkan layer registration state, update channel, online metadata opt-in, reopen legal documents (corrected 2026-10-04: the opt-in has had no row since 2026-09-16 because no store request exists, and the background-capture switch — read by nothing — is gone since beta.12; 06_DATA_MODEL §Settings registry). beta.11 (owner request 2026-10-03: no row without a control): Delete all sessions (FR-1.7, a Data section); the elevation state is a line of the admin mode's own row, not a row of its own; the hook-enabled list shows only while a game has hooking on; the language row carries no separate note.

First run blocks until the user accepts EULA, GPLv3 notice, Disclaimer, Privacy Policy the EULA, the Disclaimer and the Privacy Policy; the GPLv3 is shown beside them for information and needs no acceptance (GPLv3 §9 — "You are not required to accept this License in order to receive or run a copy of the Program"; changed beta.12, owner decision D45, 08_UI §First-run flow). Re-shown when a document version increments. The injection risk is stated in the Disclaimer and repeated at per-game consent (FR-2.1) — once is not enough for something that can cost an account.

FR-12 Updates

Velopack against GitHub Releases; silent startup check, manual check in Help; error dialogs mapped per 11_UPDATER. Updates never apply while a game is hooked — deferred to session end (the DLL on disk must not change under a running game).

FR-13 Logging & bug reports

Rolling Serilog logs per process plus native overlay logs; in-app viewer; bug bundle zip + prefilled GitHub issue (10_LOGGING). Bundles include the overlay log and hook fault details, which are what make injection bugs diagnosable.

FR-14 Tray & notifications

Tray icon states (idle / capturing T1 / capturing T2 / paused); menu; toasts for session saved and update available. Safety events (CaptureRefused, SafetyUnhook, hook auto-disable) are never toasts — they get a dedicated dialog or a persistent ui:InfoBar that cannot be dismissed by timeout (08_UI §Notifications policy, 07_IPC §Client behavior).

FR-15 In-game overlay (v1.1, opt-in, off by default)

Draw live FPS/frametime/upscaler info inside the game. Only for games already hooked; a separate toggle; never on by default. Deferred until the data path is stable (15_ROADMAP P5).

Non-functional requirements

  • NFR-1 Game-side overhead: ≤ 1 µs per present, ≤ 8 MB resident, measured game FPS impact ≤ 0.5% vs uninstrumented.

  • NFR-2 Agent overhead: ≤ 1% of one core during capture ≤ 2.5 % of one core during capture (owner decision D117, 2026-11-11: the 1 % had never been measured; measured in a real Agent it is 1.93 % with Advanced metrics off and 2.04 % with it on — 20_OPEN_QUESTIONS §M16, tools/agent-cost.ps1 — nearly all of it the once-a-second read of the graphics card's sensors, which stays), ≤ 150 MB working set (measured: 113 MiB off, 119 MiB on), ~0% idle. (D101, 2026-11-11: the limits hold with Advanced metrics on — FR-5.6. Its reads run on a thread of their own, the slow ones seldom, and with no game running only while its page is open (D107), so "~0% idle" is not spent on it. Measured on the development PC in a session that is not hooked; a hooked session, an elevated Agent with PawnIO's groups and a real game are the owner's run, HANDOFF §Owner-only.)

  • NFR-3 Stability: faults originating in our own hook bodies are contained by FL_HOOK_GUARD, counted, and self-disable the Overlay after 3 occurrences; the safety-unhook path completes within one frame. The Overlay adds no allocation, lock, syscall or logging to the present path.

    This deliberately does not say "must never crash a game" (20_OPEN_QUESTIONS §H8). SEH containment cannot reliably catch stack overflow, cannot intercept __fastfail — and -D_HAS_EXCEPTIONS=0 converts a would-be STL throw into exactly that (spike-notes.md §H3) — and does not help when the game installs a vectored exception handler that runs first. An absolute promise the mechanism cannot support does not belong in a requirement, and must stay out of user-facing text: the Disclaimer already says injection carries risk, and that wording is the honest one.

  • NFR-4 UI performance: cold start ≤ 2 s; opening a game with 100 sessions ≤ 500 ms; charts interactive at 60 fps post-decimation.

  • NFR-5 Storage: raw series ≤ 3 MB per hour compressed; 50 games × 50 sessions ≤ 500 MB at default retention.

  • NFR-6 Accuracy: per 03_METRICS §Accuracy budget, stated per tier.

  • NFR-7 Resilience: power loss loses at most the last 60 s of raw data; DB never corrupts (WAL + transactions); Agent restart recovers .partial sessions as interrupted.

  • NFR-8 OS support: Windows 10 22H2+ and Windows 11, x64. Windows 11, x64 — the Windows that Microsoft supports .NET 11 on, which FrameLedger is built on since 0.1.0-beta.37. Windows 10 22H2 is not blocked (the code is still held to it: SupportedOSPlatformVersion 10.0.19045.0, CA1416) and is neither tested nor supported there; a processor needs SSE4.2 and POPCNT (x86-64-v2), without which .NET 11 does not start. No ARM64 in v1. (Amended 2026-11-11, owner decisions D94 and D95 — 12_BUILD §The main line's .NET. Windows 10 was never tested on any version: ACCESSIBILITY.md, 08_UI §Accessibility.)

  • NFR-9 Accessibility: full keyboard navigation, adequate contrast in both Fluent themes, Per-Monitor V2 DPI awareness. (What each clause means for this app, and the check that holds it: 08_UI §Accessibility, P4 PR-8.) (Widened 2026-11-09, beta.35, owner decisions D88–D91: and a screen reader reads every control and value and is told what changes; Windows contrast themes are followed; nothing is shown by colour alone. The goal behind all of it is WCAG 2.2 AA as W3C's WCAG2ICT applies it to desktop software — a goal, not a conformance claim — stated to users in ACCESSIBILITY.md.)

  • NFR-10 Offline-first: everything except updates and opt-in metadata works with zero connectivity.

  • NFR-11 Auditability: the entire set of hooks is enumerable in 17_HOOK_ENGINE §Hook inventory and matches the code; a reviewer must be able to verify in minutes that nothing reads game memory.

Out of scope

Permanently: any evasion technique (19_SAFETY); reading/writing game memory; kernel drivers; hardware control (overclocking, fan curves, power limits — 18_GPU_VENDOR_APIS is read-only); online/competitive titles.

v1: Microsoft Store/UWP/Game Pass titles (packaged-app injection constraints) (narrowed 2026-11-03, beta.33, owner decisions D78–D80: Microsoft Store, Xbox app and PC Game Pass titles built on the GDK — full-trust packages — are in scope; what "the constraints" are was measured in spike-notes §25. UWP apps, which run in an app container, stay out: refused with a reason of their own); macOS/Linux; cloud sync; benchmark automation; ARM64. Tier-1 capture of 32-bit games, including most Direct3D 9 titles — the Overlay is x64-only and an x64 DLL cannot be loaded into a 32-bit process; those titles are Tier 2, which since 2026-08-28 means not measured at all — duration, sensors and the reason (17_HOOK_ENGINE §Build profile, 20_OPEN_QUESTIONS §Scope).