hex/docs/features/experiments.md
Kit Langton d489820243 Add an experiments flag for unfinished features
HEX_EXPERIMENTS and ~/.config/hex/experiments (hex-test for the test build)
are unioned into one launch snapshot behind experiments::enabled. hex
experiments list/enable/disable reads and edits only the file, before
logging, the lock, or the GUI, on every OS. The launch logs the snapshot;
hex status reports it (macOS text and JSON, Linux JSON). No feature is
gated yet.
2026-10-23 19:48:39 -07:00

3.9 KiB

Experiments

Experiments are unfinished features whose code sits on main but stays dormant until someone turns one on for their own Hex. They are unsupported: an experiment may misbehave, change, or disappear without notice, and nothing in the window shows or offers them. There is a flag, not a setting.

Turn an experiment on                    // experiments.sources
├── HEX_EXPERIMENTS=live-chapters,vocabulary  // commas or spaces; this process and its children
├── ~/.config/hex/experiments            // one name per line, # comments; every launch
│   ├── Hex Test.app -> ~/.config/hex-test/experiments
│   └── Windows / Linux -> %USERPROFILE%\.config\hex, ~/.config/hex
├── On = named in either source (union)
├── Unknown name -> Warning in process.log, ignored    // never fatal
└── Missing file -> Nothing on

Launch                                   // experiments.snapshot
├── Read both sources once -> Fixed for the life of the process
├── process.log -> "experiments enabled" or "no experiments enabled"
└── Edit a source -> Applies at the next launch

hex experiments                          // experiments.cli; macOS, Windows, Linux
├── list [--json] -> Each experiment, on/off, source (env, file, env+file)
├── enable <name> -> Add it to the file atomically; print the restart hint
├── disable <name> -> Remove every line naming it; keep comments and others
└── Unknown name -> Error listing the known experiments

The known experiments are compiled into experiments.rs:

  • live-chapters: chapter a meeting's transcript live while it records.
  • vocabulary: a shared vocabulary list that guides transcription.

Neither feature exists yet, so turning them on changes nothing today.

hex experiments reads and edits only the sources; it runs before process logging, the instance lock, the GUI, or permissions, and never talks to a running Hex. list shows what the next launch would read from this shell's environment and the file. What the running Hex actually read is in process.log and in hex status: on macOS an Experiments line (only when one is on) and experiments in --json (always, possibly empty); on Linux experiments in its JSON. Windows hex status prints the sources' current names first.

HEX_EXPERIMENTS reaches Hex              // experiments.env
├── Hex started from that shell (hex app, cargo run) -> Yes
├── macOS hex start / hex restart with Hex not running -> Yes // caller's HEX_* via open --env
├── macOS hex restart / setup relaunch -> The running Hex's own HEX_* // not the caller's
├── Windows update restart -> Inherited
└── Login Items, Finder, Dock, the Linux systemd unit -> No; only the file

Use the file for a lasting change; the environment suits a one-off launch. Debug builds read the same sources: DEVELOPER_FEATURES_ENABLED turns no experiment on.

Gate an experiment where its work starts (the worker, thread, or capture), with experiments::enabled(Experiment::X), not only where its UI appears.

Checks: the tests in experiments.rs cover parsing both sources (comments, unknown names, duplicates, the union), file edits (creation, idempotence, removal, a symlinked file, no leftover temporary file), and the list output; experiments_live_beside_hex_config_ts_in_each_builds_own_folder in app_paths.rs covers the test build's folder; experiments_parse_as_a_read_command in main.rs covers the macOS CLI; status_reads_for_a_person and status_reports_experiments_and_reads_older_replies_without_them in control/cli.rs cover the macOS status text and JSON. Passed on macOS on 2026-10-23. The Linux and Windows dispatch and status additions are not built or run by these checks, and no running Hex was asked for its status.