hex/docs/README.md
Ryan Vogel 976ad01655
docs: the Hex words file (.hexwords), version 1, with shared cases (#2776)
* docs: define the Hex words file (.hexwords), version 1, with shared cases

Ryan approved sharing vocabulary and word replacements between the desktop,
iPhone and Android apps through a file the person moves themselves. Three
builders start from this in parallel, so the format is written down and frozen
first, with cases all three apps must pass.

- docs/specs/hex-words.md: every field and limit, how text is cleaned and
  compared, the reading order with its refusal and skip reasons, versions,
  what each app writes, the merge rules (desktop and phone) and Undo, the
  file's name and type on each platform, and what a reader must never do.
- tests/fixtures/hex-words: read.json (54 cases over files/, from small to
  hostile: not UTF-8, 10,000 levels deep, duplicate keys, lone surrogates,
  8 MiB + 1 byte generated), merge.json (24 desktop and phone cases),
  write.json (6 cases) and hex-words.schema.json (JSON Schema 2020-12 for
  writer output). files/ is byte-exact (-text -whitespace).
- docs/README.md links the spec.

No app code changes. The typing config (.mhexconfig) stays separate: its
parts need evidence and Full Access, and it describes one phone's keyboard.

Verified: the expected results were produced by a throwaway Python reference
reader, merger and writer (not committed) and read through by hand; every
write.json output and the valid read results re-written validate against the
schema with jsonschema 4.26, and five malformed writer outputs are rejected;
a file with every list at its limits in 4-byte characters is 6.5 MiB, under
the 8 MiB cap; markdownlint-cli2 is clean on the new docs.

* docs(hex-words): Android parses with its own strict parser

org.json is lenient and neither it nor android.util.JsonReader runs in the
app's JVM unit tests, which is where the shared cases run. Verified:
markdownlint-cli2 clean.

* docs(hex-words): pin refusal order and out-of-range numbers; clarify writer order and phone scope

The Android builder found three places where implementations could
disagree:
- Two problems in one file: the spec said 'the first met' but no case
  pinned it. It now says where each problem is met, and three cases pin it
  (duplicate key first, too deep first, syntax error first).
- A number a 64-bit float can't hold (1e400, a 400-digit integer):
  serde_json refuses it, while other parsers read it as infinity. It is now
  notJSON wherever it appears, with two cases.
- A writer checks a full list's limit first, in the reader's order.
Also written down: on a phone, Word replacements apply to the app's and the
keyboard's dictations (never translated ones), and on Android learned fixes
are 'in use' only while Learn from my fixes is on.

Verified: the reference reader (now a single sequential check pass)
regenerates read.json with only the five new cases changed; merge.json and
write.json are unchanged; markdownlint-cli2 is clean.

* docs(hex-words): a phone's spelling-replacement that repeats an earlier one is a duplicate

The iPhone builder asked what happens when two terms in one file share a
spelling: on a phone both would become replacements with the same heard
words. The spec only covered a spelling against the file's own
replacements. Now: the earlier one wins (the file's own replacements come
first), and a later one is notApplied as duplicate. One new phone merge case.

Verified: the reference merger regenerates merge.json with only the new case
added (25 cases); read.json and write.json unchanged; markdownlint clean.
2026-11-24 18:47:38 -05:00

77 lines
4.3 KiB
Markdown

# Project Documentation
Start with the document for your task. Plans and archived prototypes do not
override shipped behavior.
## User Guides
- [`../README.md`](../README.md): install and use Hex on macOS, Windows, and Linux.
- [`windows.md`](windows.md): Windows x64 and ARM64 beta requirements, installation, and source builds.
- [`linux.md`](linux.md): Linux X11 and native Wayland beta requirements and installation.
- [`nix.md`](nix.md): Nix packaging for Linux, development, and per-user autostart.
- [`../ios/README.md`](../ios/README.md): build and test the iOS prototype.
- [`../sdk/typescript/README.md`](../sdk/typescript/README.md): use the public
TypeScript transcription SDK with an explicitly supplied native helper.
## Engineering Reference
- [`../AGENTS.md`](../AGENTS.md): architecture, invariants, development
commands, and diagnostics. This is the implementation authority.
- [`../ROADMAP.md`](../ROADMAP.md): prioritized product and engineering work.
- [`design-system.md`](design-system.md): Rune + `rune-kit` + OpenCode theme
components, Hex pieces, copy rules, and `--snap` scene verification.
- [`features/README.md`](features/README.md): existing user-facing capabilities,
entry points, available verification, and gaps; detailed dictation and recovery maps.
- [`perf.md`](perf.md): strobe benchmarks, the cases that drive the window
through its accessibility tree, and how a benchmarked copy of Hex stays
isolated.
- [`downloads.md`](downloads.md): public download paths, R2 custom domains,
GitHub release mirrors, and network recovery.
- [`opencode-compatibility.md`](opencode-compatibility.md): audited OpenCode V2
source and CLI baseline, integration contract, and validation limits.
- [`plans/personal-commands.md`](plans/personal-commands.md): shipped personal
command contract and remaining lifecycle work.
- [`plans/quickjs.md`](plans/quickjs.md): why and how configs run in embedded
QuickJS instead of Bun, with size and latency measurements.
- [`specs/local-transcription-service.md`](specs/local-transcription-service.md):
implemented macOS local-service protocol and lifecycle guarantees.
- [`specs/hex-words.md`](specs/hex-words.md): the Hex words file (`.hexwords`)
that carries vocabulary and word replacements between the desktop, iPhone and
Android apps, with shared cases in `tests/fixtures/hex-words`.
## Architecture Decisions And Active Plans
- [`plans/rune-ui.md`](plans/rune-ui.md): implemented; Rune desktop UI port,
surfaces, goldens, and remaining real-window checklist.
- [`plans/single-process.md`](plans/single-process.md): implemented; one Hex
process per user on macOS, Windows, and Linux hosting Rune windows and overlays.
- [`plans/rune-dependency.md`](plans/rune-dependency.md): decision record for
Rune as a public MIT Git dependency and Nix output-hash updates.
- [`plans/shared-desktop-ui.md`](plans/shared-desktop-ui.md): implemented; how
macOS, Windows, and Linux share one window and one settings file.
- [`plans/swift-app-handoff.md`](plans/swift-app-handoff.md): manual download
handoff from Swift, without data import or automatic replacement.
- [`plans/typescript-sdk.md`](plans/typescript-sdk.md): published SDK status,
remaining signed-helper packaging, and first-consumer validation.
- [`plans/linux.md`](plans/linux.md): Linux X11/Wayland validation and later capability
slices.
- [`plans/meeting-live-transcription.md`](plans/meeting-live-transcription.md):
evaluation of Apple SpeechTranscriber vs Moonshine for live meeting drafts.
- [`plans/granola-import.md`](plans/granola-import.md): research on importing
historical Granola meetings into `hex mcp`.
When a plan disagrees with `AGENTS.md` about shipped behavior, update the plan.
## Research And Archives
- [`research/transcription-benchmark.md`](research/transcription-benchmark.md):
historical benchmark method and measurements.
- [`../prototypes/app-shell/README.md`](../prototypes/app-shell/README.md):
archived app-shell comparison prototype.
## Releases
`releases/` contains version-specific release notes and drafts. `../release-notes/` contains legacy inputs from versions
2.0.0 through 2.0.9. Published notes and the SDK changelog describe their release,
not current behavior; preserve them as historical records. A draft note is not
evidence that its release has been published.