hex/ios/TypingConfig/package/reference/state.md
Ryan Vogel 17407ee391 ios: the typing-config agent package (words and key positions), and the export's layout state
ios/TypingConfig/package/ is what an export carries besides the logs: SKILL.md, reference/ and
scripts/ (Python 3 standard library, no network). From it alone, a stranger's agent can build a
format-0 .mhexconfig and check it before handing it back.
- SKILL.md tells the agent:
  - what Hex already learns by itself;
  - rules: the text stays in the folder, single words only, every value from a script, tune on
    half A and check on half B, never write an unsimulated zone, less is better;
  - steps from overview to report.
- reference/:
  - typing-config.md, the frozen format;
  - state.md, the export's state/ (phone.json, including layout, and vocabulary.json);
  - log-format.md and typing-config.schema.json, both generated.
- scripts/, key positions:
  - taps.py lines every tap up with the letter or space it was meant for and maps it onto
    today's keys;
  - key_clouds.py shows per-key landing clouds by the letter meant, beside Hex's pressed-key
    average, with aim candidates;
  - zone_edges.py lists every movable edge with the taps that fell just across it;
  - simulate_zones.py says which key every tap would press under proposed zones (with --sweep).
    geometry.py ports KeyboardZoneMap line for line, so the scripts press what the phone would;
  - simulate_aim.py is the touch-model approximation for aim.
- scripts/, the checker: check_config.py re-runs both simulations on the halves the config names
  and rejects any aim or zone whose evidence doesn't match exactly. It also recounts words,
  checks ranges, context and envelope, and fills in the id.
- scripts/, the study's tools: word_outcomes.py (now with session counts and a
  never-correct-to list), words, hexlog, overview, split, space_edges, timings, dictation.
- TypingConfigExportState.layout(_:) gives the phone lane's state writer today's keyboard:
  context, keycap size, touch area, and every key's frame, hitFrame and gapHitFrame.
- build-typing-config.py also writes the package's copies of the schema and of
  docs/typing-logs.md, and --check covers them.

Verified: seven fresh agents (opencode/claude-opus-5-5, told only "Here is a folder. Follow
SKILL.md in it") each produced a config that check_config.py passes with 0 problems.
- Six worked on synthetic one-fault fixtures typed through the real engine with Record typing
  logs; the seventh on Ryan's day 1 (private).
- They found each planted fault: e aimed 0.4 keycap right (aim e +0.30 and e's right edge
  +0.20: 49 taps gained, 0 lost, on the tuning half), a right hand low, own words, a repeated
  real-word slip, and space taps high.
- Where the rules didn't hold, they left the part out: the space zone failed its check half,
  and the slip is one Learn how I type learns itself. The control got no key positions.
- The phone-side replay of these configs follows.
python3 -m py_compile passes for all scripts, and build-typing-config.py --check passes.
2026-11-23 12:47:08 -05:00

3.3 KiB

state/: the keyboard now, and what Hex had already learned

The logs show what happened. state/ says two things the logs can't: which keyboard the person uses now (so a config is built for it), and what Hex had already learned (so you tell a new finding from something the phone already does). Hex writes it when the person exports.

state/phone.json

Key Meaning
exportId This export's id. Put it in madeFrom.exportId.
formats typingConfig: the format version this Hex reads. Write exactly that version. hitModel: the version of Hex's default touch areas. logs: the log format.
device, system, hexVersion, hexBuild, locale The phone, iOS, Hex.
keyboardLanguages Keyboard layouts in use (en, es, …).
settings Hex's keyboard settings (as in session_start.settings in the logs).
experiments Experiment switches that change typing: adaptiveTouch, learnEachLanguageSeparately, typingConfigs.
layout The letters keyboard the person uses now (below). A config's keys block is for this one.
learnedWords Words Learn how I type keeps (autocorrect leaves them alone): count, known (the words), complete (false: partial).
learnedFixes Typo → word fixes it learned: pairs ([[typo, word]]), complete.
neverCorrect Words it learned never to correct (kept over a correction twice).
tapOffsets Learn how I type's per-key averages the decoder uses: keycaps by letter, [dx, dy] in keycaps. Averaged by the key each tap pressed.
adaptiveTouch Whether Adaptive touch's centres are in use, and its offsets by letter if so.
activeTypingConfig The typing config in use now ({"id": …}), or null. A new config says basedOn its id.

A value of null means Hex couldn't say. "complete": false means the list is partial: don't count a word as new just because it is missing.

layout

Written by TypingConfigExportState.layout, from the keyboard the person last used:

Key Meaning
context The keyboard, as a config's keys[].context names it. Copy it unchanged.
letterWidth, keyHeight The letter keycap's width and height in points: a zone's units.
gap, rowGap The gaps between keycaps across and between rows.
touchArea [x, y, w, h]: where touches go to the keys. Its edges are the keyboard's outer edges, which zones can't move.
keys Every key: id (as the logs name it), row (-1 the Hex key, -2 the number row), frame (the keycap), hitFrame (its touch target), gapHitFrame (the space bar's band of the gap above it). Together they tile touchArea.

scripts/taps.py maps every logged tap onto these keys: it keeps the tap's place on the keycap it landed on, scaled to that keycap now. scripts/geometry.py compiles zones against them as Hex does.

state/vocabulary.json

Every word-like token in the logs, lowercased.

  • model is the cost in Hex's language model for the keyboard's language: nats, -ln p; about 10 is a common word and 14 a rare one; null means the model doesn't have it.
  • dictionary is whether the system spell checker accepts it.

A word with model: null and dictionary: false is one Hex would try to correct, unless the person's own list has it.