The zone rule counted taps: a zone was kept when, on the check half, it gained at least 3 taps net
and lost at most a third of what it gained. Taps overstate a zone's cost and understate its gain:
Hex's next-letter odds and autocorrect repair most letter taps that press a neighbour, while a
space read as a letter runs two words together. Replaced by a rule on words.
- simulate_zones.py also scores each zone on the logged words, using what the log says Hex did
with each: an untouched word keeps its outcome; a wrong word whose taps all become right is made
right; a right word with a new slip stays right as often as Hex repaired a word with one slip of
that kind (letter, space as letter, which also joins the next word, letter as space, other key)
in that half, leaning toward Hex's own rate on 106 people of two public recordings when the
person's log has few examples. Prints wordsRight and wordsWrong, --sweep by net words, --repair
the rates. It can't see context or words deleted and retyped differently (reference, "How a zone
is scored").
- The rule (limits.json, generated into TypingConfigLimits.swift, limits.py and the schema):
tuned >= 15 taps in the strip and more words right than wrong; checked >= 10 taps, words right -
wrong >= 2, wrong <= 34% of right. Removed: zoneMinNetCheckedTaps, zoneMaxLostShare (and
minNetCheckedTaps, maxLostShare). Added: zoneMinCheckedTaps, zoneMinNetCheckedWords,
zoneMaxWrongShare, repair, repairPrior.
- Zone evidence gains wordsRight and wordsWrong (TypingConfigFile.Tally, optional; required by the
schema). check_config.py demands them exactly as simulate_zones.py prints them. The phone's review
applies the same rule, so a zone with tap-only evidence is now skipped as notEnoughEvidence. No
config with zones has shipped (the experiment is off by default).
- words.py recognises a run-in deleted and typed again as two words (retyped_as_two), so the word
rule sees the words a missed space broke.
- SKILL.md, the reference's zone section and worked examples, and docs/typing-configs.md follow.
Verified, on 2b5f2ae8:
- HEXMobileTests: 981 tests, 0 failures (4 skipped), Studio, iPhone 17 Pro sim, iOS 27.2.
- Fresh agents on the six planted-fault fixtures and Ryan's day 1 built configs that pass
check_config.py with 0 problems.
- 106 public-recording people, tuned on half A by the package's rules, scored by replaying half B
through the real keys: under the word rule 27 have a config, 4 a zone (all the space bar);
8 better, 15 unchanged, 4 worse, each worse one by 1-2 words and from aim only; errors 2752 ->
2576, 185 words made right, 19 wrong. Under the tap rule: 5 zones, 7 / 15 / 5, 2574, 189 / 23.
- The estimate against the engine on 33 zone-only replays: 211 words right and 66 wrong
estimated, 323 and 111 replayed; every zone the rule would keep improved the replay, and each of
the three that cost words (13, 16 and 2) is rejected.
5.9 KiB
Typing configs (Settings › Experiments › Typing configs)
Part of Hex for iPhone.
A typing config (.mhexconfig) is one file a person's own agent writes from their typing
export, using the skill in TypingConfig/package/. It holds:
- words: words to keep, words never to correct to, typo fixes and dictation fixes;
- key positions: where a tap counts. Keys never move on screen.
- Aim moves the centre the decoder reads a letter's taps against.
- Zones move the edges of what a tap presses.
The format, every field and its limits, and how the parts compose with the next-letter odds,
Learn how I type and Adaptive touch are in
TypingConfig/package/reference/typing-config.md.
The experiment is off by default (App Group key experiments.typingConfigs). Off, or with no
config, every code path below is a no-op, and typing is byte-identical to Hex without it on the
iOS typing gate (scripts/typing-gate.py, en es de fr pl, deterministic hashing).
Limits: one table
TypingConfig/limits.json holds every range, clamp and evidence minimum.
scripts/build-typing-config.py generates three things from it:
HEXShared/FullKeyboard/TypingConfig/TypingConfigLimits.swift, which the phone reads;- the package's
scripts/limits.py, whichcheck_config.pyreads; typing-config.schema.json, with the same file in the package. The generator also copiestyping-logs.mdinto the package asreference/log-format.md.
--check fails when any of these is out of date.
Reading a file: TypingConfigReview
TypingConfigReview(data:keyboards:checksEvidence:) is the only parser, for the app and the
keyboard alike.
- The app passes the keyboards Hex's keys have run on, which the keyboard records in
typingConfig.keyboards(TypingConfigKeyboard: context andKeyboardZoneGeometry). - The keyboard passes its live layout.
- Each key block applies on the first keyboard it matches; a second block for the same keyboard is a duplicate.
It returns:
- for every part, an
Itemwith itsOutcome(applied,clamped(from:to:),shortenedorskipped(Reason)), its path, list, position and block, the file's evidence for it, and its cleaned text (TypingConfigText, the same string the keyboard loads); - for each key block, a
ContextCheck: what it was made for, the keyboard, the fields that differ, and whether the hit model matches; Applied: what the keyboard uses.
Reason lists why a part is skipped, in the order a review shows them: notAConfig,
tooLarge, newerFormat, unknownField, invalidValue, hiddenCharacters, tooMany, duplicate,
notEnoughEvidence, forAnotherKeyboard, needsCheckingAgain, keyNotOnKeyboard,
edgeNotAllowed, twoZonesClaimPoint, keyTooSmall.
compiled(switchedOn:) makes the file the keyboard reads, keeping every key block that applies on
one of the keyboards. TypingConfigStore.writeActive writes
it to TypingConfigs/active.json in the App Group atomically and bumps
typingConfig.generation. removeActive goes back to Hex defaults.
The keyboard
- Loading:
FullKeyboardView.syncSettingssetsengine.typingConfigfromTypingConfigActive.current(fullAccess:). It returns nothing when the experiment is off, without Full Access, or when the file is missing or unreadable. The file is read and compiled once per generation and kept for the life of the process: the words, and each key block's context, aim and zones as plain values. A layout rebuild only picks the block for its keyboard and reuses the compiled zone map while the keys' geometry is the same. - Words (
TypingLearning.adding) go to autocorrect on top of Learn how I type's learning, in memory only, so removing the config removes exactly them. What the person taught Hex themselves wins: a typo they fixed another way, a word they kept.- Kept words count as their own and are offered.
neverCorrectToblocks corrections on space, next-word revisions and merges.- Fixes are applied or offered according to their mode.
- Dictation fixes are added to the keyboard's dictation.
- Zones (
TypingConfigActive.zoneMap, applied inrebuildLayout) give the keys of the letters pagezoneRects: disjoint rectangles thathitTestand the next-letter odds' distances use.- A zone that would leave any keycap less than its centre ±0.3 keycap is skipped, and so are two zones claiming one point.
- Typing logs record
zoneRects(and the space bar'sgapHitFrame) inlayoutlines.
- Aim replaces the decoder's centre for the letters it names, over Learn how I type's average and Adaptive touch's centre. The baseline no correction may go past stays Learn how I type's.
- Adaptive touch records no taps while a config has zones.
The agent package
TypingConfig/package/ is what an export carries besides the logs. The skill and its reference
are the product: a stranger's agent must be able to build a good config from them alone.
taps.pymaps every logged tap, with the key it was meant for, onto today's keys (state/phone.jsonlayout, whichTypingConfigExportState.layoutwrites).key_clouds.pyandzone_edges.pyfind aim and edges worth moving.simulate_zones.pysays exactly which key every logged tap would press under proposed edges, using the phone's zone compiler ported togeometry.py, and scores the zones on words: the words their changed taps are expected to make right and wrong, from what the log says Hex did with each word and how often Hex repaired each kind of slip (the package reference, "How a zone is scored"). A zone is kept on words, not taps.simulate_aim.pyis the touch-model approximation for aim.check_config.pyre-runs both on the halves the config says it was tuned and checked on, and rejects any claim that doesn't match.