Skip to content

iOS: typing configs on the phone (arrival, review, history) - #2529

Draft
R44VC0RP wants to merge 11 commits into
devfrom
ios-typing-config-phone
Draft

R44VC0RP wants to merge 11 commits into
devfrom
ios-typing-config-phone

Conversation

@R44VC0RP

@R44VC0RP R44VC0RP commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Draft, not to merge. Stacked on #2523 (ios-typing-config): this branch contains its commits until it lands.

This is the phone side of typing configs, behind Settings › Experiments › Typing › Typing configs (experiments.typingConfigs, off by default). See ios/docs/typing-configs.md.

Step 1: getting the file to Hex

  • The file type: a .mhexconfig file is anomaly.hex.typing-config. It conforms to public.data and Hex owns it. Files shows it with Hex's icon, and tapping it there opens Hex in one tap.
  • Over anything on screen: opening a file shows a sheet over whatever Hex has up. The sheet can't be swiped away.
  • Two files at once: a second file waits behind the first, shown as "1 more file waiting". Opening the same file twice counts once.
  • Size and bad files: a file over 64 KB is never read. An empty file says so. A file that isn't a config says so and keeps nothing.
  • Experiment off: the sheet says typing configs are off and where to turn them on. Open Experiments goes straight to the switch, and turning it on brings the waiting file back.

Step 2: the review sheet and Apply

  • One reader: the sheet only shows what TypingConfigReview decided. There is no second parser and no clamps of its own.
  • Each part has its own switch, grouped in plain words: Words to keep, Never correct to, Typo fixes, Dictation fixes, Where you aim, Touch areas.
  • Limited values show the value used and what the file asked for.
  • The file's evidence is shown as "The file says: …", as the agent's claim.
  • Other keyboards: key positions made for another keyboard are listed field by field, the file's value against this iPhone's.
  • Skipped parts are grouped by reason, one plain sentence each.
  • The note is shown as plain text.
  • Full Access: without it, the sheet says so before Apply, and Apply stays off.
  • Apply writes active.json through TypingConfigStore.writeActive. Not now keeps the file in the history.

History so far

  • The history is TypingConfigs/history in the App Group. Each config is kept unchanged, under the SHA-256 of its bytes.
  • One config is active, or none (Hex defaults).
  • Hex keeps 20. The oldest never applied goes first; an applied one goes only when the person deletes it.

Step 3: the Typing configs page and history

  • Where: Settings › Keyboard › Typing configs, beside Vocabulary, shown only while the experiment is on. The row says which config is in use, or "Hex defaults".
  • The list: Hex defaults first, then every kept config, newest first, each with In use / Best so far / when it was applied or opened. Use on a row switches to it in one tap and deletes nothing.
  • One config: Use this config or Use Hex defaults instead, Rename, Share (the kept file, unchanged), Delete, and its parts with their switches. While it's in use, a switch applies the next time the keyboard opens.
  • Full history: a new config is never refused. At 20 the oldest that is neither in use nor best so far is removed, and the review sheet names it before Apply.
  • Delete what Hex learned also deletes every typing config and goes back to Hex defaults; its confirmation says so.
  • Experiment off: the sheet's first action is now Turn on typing configs, which shows the review at once; Open Experiments is the quieter second.
  • Keyboards: the review reads the keyboards the Hex keyboard recorded. With none recorded yet, the sheet says "Hex hasn't seen your keyboard yet" above the key positions, and the active config is compiled again when Hex next comes to the foreground.
  • Hex's own dictation (handed to Hex, Action Button) applies the config's dictation fixes after Learn how I type's, never to a translated dictation.

Step 4: Export for your agent

  • Where: Settings › Privacy › Typing logs, while the experiment is on.
  • Every time: the warning sheet (design §5's wording; a variant when fewer than all days are chosen), the days to include, Continue, then the share sheet. The zip is deleted when the share sheet closes.
  • The zip: package (SKILL.md, reference, scripts), logs/, and state/phone.json and state/vocabulary.json as state.md defines them. The package's overview.py reads it.
  • Weight and time (simulator, real logs): 1 day (4.6 MB) → 561 KB in about 2.1 s; 2 days (6.6 MB) → 772 KB in about 2.5 s, from the Continue tap to the zip on disk.
  • Share sheet on the simulator: Copy, Save to Files and More. AirDrop and the AI apps' targets don't appear on a simulator; a phone has to show them.

An applied config changes the tap

Through the real app and keyboard on the Studio's iOS 27.2 simulator (iPhone 17 Pro, keyboard 402 × 253 pt, Full Access confirmed by the keyboard's typing log and its Full Access report), a tap 3.35 pt inside r's touch area (x 125.35) types R with Hex defaults and E with the key-off config applied through the review sheet (e's right edge +0.2), the keyboard closed and opened in between. The keyboard's layout line shows the zone: e takes x 122–128.7. The earlier "no change" was my script tapping Apple's keyboard, not Hex's.

The regression notice (step 5) comes next on this branch.

Verified

  • Tests: TypingLogTests (15 tests, 3 with the new cases) passed on the Studio's iOS 27.2 simulator on head 428e5671.
  • Simulator: every state, opened from Files on the iPhone 17 Pro and iPhone SE (3rd gen), in English and Simplified Chinese.
  • Code shape: code-shape.py --check passes.

Not checked on a real iPhone: AirDrop, Messages, Mail, another app's Open in Hex, and Full Access off.

@R44VC0RP
R44VC0RP force-pushed the ios-typing-config-phone branch from a334f0b to e98f303 Compare November 23, 2026 14:32
R44VC0RP added a commit that referenced this pull request Nov 23, 2026
…ce and place, cleaned text

The phone lane's three requests for TypingConfigReview (#2529 renders it):
- Keyboards, not one guessed context:
  - The keyboard records each letters keyboard it runs on, with the experiment on and Full
    Access, in typingConfig.keyboards (TypingConfigKeyboard: context plus KeyboardZoneGeometry),
    most recent first, at most 8, written only when the list changes.
  - TypingConfigReview(data:keyboards:) checks each key block against all of them: a block
    applies on the first keyboard it matches, a second block for that keyboard is a duplicate,
    and one that matches none is forAnotherKeyboard, with its differences from the nearest.
  - ContextCheck gains keyboardIndex, and keyboard is the matched or nearest one. Applied.blocks
    holds every applying block; Applied.aim and .zones are keyboard 0's.
  - compiled(switchedOn:) keeps every applying block, and the keyboard picks the one for its
    layout.
  - The zone compiler moved onto KeyboardZoneGeometry so recorded keyboards can be checked.
    KeyboardLayout.zoneMap wraps it, with the same results.
- Evidence and place on every Item: list (file, keep, neverCorrectTo, fixes, dictation,
  keyBlocks, aim, zones), position in it, block, the file's evidence, and the cleaned text, so
  "Words to keep, number 6" comes from the result alone.
- Cleaned text (TypingConfigText) for the note and every word, fix and dictation fix, so the
  sheet and the keyboard use the same strings.
  - Removed: controls (Cc), bidi embeddings, overrides, isolates and marks (U+202A-202E,
    U+2066-2069, U+200E, U+200F, U+061C), and invisible format characters (Cf: U+200B, U+2060,
    U+FEFF, U+00AD, ...).
  - ZWNJ and ZWJ are kept only between letters or marks of Arabic and Persian, Syriac, the Indic
    scripts, Sinhala, Myanmar and Khmer, and ZWJ between emoji. Tag characters are kept after a
    black flag.
  - Words are NFC-normalised and trimmed. A word that loses anything from inside it is skipped
    with the new Reason hiddenCharacters (after invalidValue in the order); one empty after
    cleaning is invalidValue. The note is cleaned, then cut at 280.
- The reference's "Reading" and "On the phone" sections and docs/typing-configs.md say so.

Verified on the Studio (iPhone 17 Pro, iOS 27.2):
- FullKeyboardEngineTests: 163 of 163 pass, including two new cases in
  FullKeyboardEngineTests+AdaptiveTouch.swift.
  - Four blocks on upright and sideways keyboards: English upright and sideways apply, French is
    forAnotherKeyboard with differences [language, letters], a second upright block is a
    duplicate, compiled keeps both applying blocks, the keyboard picks each on its own layout,
    and recording dedupes most-recent-first.
  - Cleaning: an override, a zero-width space, a Latin ZWJ and a fix with an isolate are
    hiddenCharacters. A Persian word keeps its ZWNJ, a Devanagari conjunct its ZWJ, and a
    decomposed café becomes NFC. The note loses its newline and override and is cut at 280.
  - The first review case also checks list, position and evidence.
- TypingLogTests: 12 of 12 pass.
@R44VC0RP
R44VC0RP force-pushed the ios-typing-config-phone branch from e98f303 to 428e567 Compare November 23, 2026 17:00
…and one limits table

A typing config is the file a person's own agent writes from their Hex typing export: words
(keep, never correct to, typo fixes with apply or suggest, dictation fixes) and key positions,
meaning where a tap counts. Keycaps never move on screen.
- Aim: per-letter offsets [dx, dy] in keycaps from the keycap centre to the mean landing point
  of taps meant for the letter (±0.3). They replace Learn how I type's average and Adaptive
  touch's centre for the letters a config names; they never add to them.
- Zones: moves of one edge of a key's touch area, in letter keycaps (±0.25). Every key keeps
  its keycap centre ±0.3 keycap, every point belongs to one key, and zones are measured against
  Hex's hit model 1.
Both are tied to a context: width, orientation, posture, language, letters, split, Hex key
side and number row; keycap height, row pitch and letter width within 15%.

- ios/TypingConfig/limits.json is the one table. ios/scripts/build-typing-config.py generates
  TypingConfigLimits.swift (the phone's clamps), the package's scripts/limits.py and
  typing-config.schema.json from it, and --check fails on drift.
- ios/TypingConfig/package/reference/typing-config.md is the frozen definition: every field's
  meaning, unit, range, evidence and context, the order in which zones, next-letter odds and
  aim apply, how a reader treats unknown or newer fields, the App Group contract (switch
  experiments.typingConfigs, TypingConfigs/active.json, typingConfig.generation) and three
  worked examples.
- KeyboardZone.swift holds the zone model and hitModel only; nothing reads configs yet.

No behaviour change: nothing references the new types. Verified: build-typing-config.py
--check passes; the two Swift files type-check for the iOS simulator SDK.
…son and its settings

What the phone lane builds on, so there is one parser (HEXShared/FullKeyboard/TypingConfig/):
- TypingConfigFile: the Codable model of a format-0 file (envelope, words, aim, zones, evidence,
  note). Lists decode leniently: an entry that doesn't parse is kept as nil and named, and the
  rest is read.
- TypingConfigReview(data:keyboard:checksEvidence:): what Hex would do with a raw file on one
  keyboard.
  - Every part gets an Item: applied, clamped(from:to:), shortened, or skipped(Reason).
  - Reason is an ordered enum: notAConfig, tooLarge, newerFormat, unknownField, invalidValue,
    tooMany, duplicate, notEnoughEvidence, forAnotherKeyboard, needsCheckingAgain,
    keyNotOnKeyboard, edgeNotAllowed, twoZonesClaimPoint, keyTooSmall.
  - It also returns each key block's ContextCheck (made for, keyboard, differences, hit model),
    the SHA-256 of the bytes, and Applied (what the keyboard will use).
  - compiled(switchedOn:) produces active.json's content.
- KeyboardZoneMap / KeyboardLayout.zoneMap: zones compiled to disjoint per-key rectangles.
  Overlapping zones and zones that leave a keycap's centre region uncovered are skipped.
- TypingConfigFile.Context(layout:) and differences(from:): the context rules of the reference.
- TypingConfigSettings (experiments.typingConfigs, typingConfig.generation) and
  TypingConfigStore: writeActive (atomic, bumps the generation), removeActive, and activeData
  (nil when off or without Full Access).
- The generator also emits each part's evidence minimums.

The reference now says the phone doesn't recompute a file's id (number printing differs
between languages); history keys on the bytes' hash. Nothing in the keyboard reads a config
yet: no behaviour change.

Verified on the Studio (iPhone 17 Pro, iOS 27.2) with three new cases in
FullKeyboardEngineTests+AdaptiveTouch.swift: every reason above except tooMany, each with the
path it names; that a zone moves where a tap counts while every point keeps exactly one key
(1.5 pt grid); and compile, write, read back without evidence, then remove.
build-typing-config.py --check passes.
…ing configs)

With experiments.typingConfigs on and Full Access, FullKeyboardView.syncSettings loads
TypingConfigs/active.json through TypingConfigActive.current. It reads the file again only
when typingConfig.generation changes, through the same TypingConfigReview the app uses. A
missing or unreadable file is no config.
- Words: TypingLearning.adding layers the config's words on top of Learn how I type's learning
  in memory, so nothing is written into what Hex learned and removing the config removes
  exactly its words. What the person taught Hex themselves wins.
  - Kept words count as their own and are offered.
  - neverCorrectTo blocks space corrections, next-word revisions and merges into the word.
  - Fixes are applied (learned-typo rules) or only offered.
  - Dictation fixes join the keyboard's dictation corrections.
- Zones: rebuildLayout compiles the matching key block's zones (KeyboardLayout.zoneMap) into
  per-key zoneRects. KeyboardKey.takes, hitTest and the next-letter odds' distances use them.
- Aim: syncDecoderKeys replaces the decoder's centre for the letters the config names, over
  Learn how I type's average or Adaptive touch's centre; the baseline keys stay Learn how I
  type's.
- Adaptive touch records no taps while a config has zones.
- Typing logs: layout lines record each key's gapHitFrame (the space bar's band of the gap,
  which the logs lacked) and zoneRects. The hash includes zoneRects, and a typing_config
  layout cause is added.
- Edits to the files at their size limit (FullKeyboardEngine, AutocorrectEngine,
  KeyboardViewController) are line-for-line, apart from one stored property in
  FullKeyboardEngine. Three private methods became internal for the new extension.
- docs/typing-configs.md is new; typing-logs.md documents the new layout fields.

Verified on the Studio (iPhone 17 Pro, iOS 27.2):
- With no config, the iOS typing gate (scripts/typing-gate.py run, en es de fr pl,
  TEST_RUNNER_SWIFT_DETERMINISTIC_HASHING=1) gives byte-identical output-<lang>.json to the
  merge base 73ee886 in all five languages.
- FullKeyboardEngineTests: 161 of 161 pass, including two new cases in
  FullKeyboardEngineTests+AdaptiveTouch.swift. The first: a zone gives the space bar b's lowest
  3 pt, aim moves o's decoder centre by 0.2 keycap with the baseline kept, and removing the
  config restores the layout. The second: a kept word is left alone, neverCorrectTo blocks
  "hte" -> "the", and removing the config leaves TypingLearning() as it was.
- TypingLogTests, KeyboardLayoutTests, AutocorrectEngineTests, DictationLearningTests and
  LanguageLearningTests: 196 of 196 pass.
- code-shape.py --check passes; the largest file is 1,498 lines.
…he 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.
…ce and place, cleaned text

The phone lane's three requests for TypingConfigReview (#2529 renders it):
- Keyboards, not one guessed context:
  - The keyboard records each letters keyboard it runs on, with the experiment on and Full
    Access, in typingConfig.keyboards (TypingConfigKeyboard: context plus KeyboardZoneGeometry),
    most recent first, at most 8, written only when the list changes.
  - TypingConfigReview(data:keyboards:) checks each key block against all of them: a block
    applies on the first keyboard it matches, a second block for that keyboard is a duplicate,
    and one that matches none is forAnotherKeyboard, with its differences from the nearest.
  - ContextCheck gains keyboardIndex, and keyboard is the matched or nearest one. Applied.blocks
    holds every applying block; Applied.aim and .zones are keyboard 0's.
  - compiled(switchedOn:) keeps every applying block, and the keyboard picks the one for its
    layout.
  - The zone compiler moved onto KeyboardZoneGeometry so recorded keyboards can be checked.
    KeyboardLayout.zoneMap wraps it, with the same results.
- Evidence and place on every Item: list (file, keep, neverCorrectTo, fixes, dictation,
  keyBlocks, aim, zones), position in it, block, the file's evidence, and the cleaned text, so
  "Words to keep, number 6" comes from the result alone.
- Cleaned text (TypingConfigText) for the note and every word, fix and dictation fix, so the
  sheet and the keyboard use the same strings.
  - Removed: controls (Cc), bidi embeddings, overrides, isolates and marks (U+202A-202E,
    U+2066-2069, U+200E, U+200F, U+061C), and invisible format characters (Cf: U+200B, U+2060,
    U+FEFF, U+00AD, ...).
  - ZWNJ and ZWJ are kept only between letters or marks of Arabic and Persian, Syriac, the Indic
    scripts, Sinhala, Myanmar and Khmer, and ZWJ between emoji. Tag characters are kept after a
    black flag.
  - Words are NFC-normalised and trimmed. A word that loses anything from inside it is skipped
    with the new Reason hiddenCharacters (after invalidValue in the order); one empty after
    cleaning is invalidValue. The note is cleaned, then cut at 280.
- The reference's "Reading" and "On the phone" sections and docs/typing-configs.md say so.

Verified on the Studio (iPhone 17 Pro, iOS 27.2):
- FullKeyboardEngineTests: 163 of 163 pass, including two new cases in
  FullKeyboardEngineTests+AdaptiveTouch.swift.
  - Four blocks on upright and sideways keyboards: English upright and sideways apply, French is
    forAnotherKeyboard with differences [language, letters], a second upright block is a
    duplicate, compiled keeps both applying blocks, the keyboard picks each on its own layout,
    and recording dedupes most-recent-first.
  - Cleaning: an override, a zero-width space, a Latin ZWJ and a fix with an isolate are
    hiddenCharacters. A Persian word keeps its ZWNJ, a Devanagari conjunct its ZWJ, and a
    decomposed café becomes NFC. The note loses its newline and override and is cut at 280.
  - The first review case also checks list, position and evidence.
- TypingLogTests: 12 of 12 pass.
The keyboard recorded every letters layout it built, including the two it passes through while
sizing itself: the engine's 375 pt default, and a first pass at another key height (35.5 pt on
an iPhone 17 Pro). Both landed in typingConfig.keyboards beside the real one. A layout is now
recorded once it has been the live one for a second, so a pass replaced within that time never
counts.

Verified on the Studio (iPhone 17 Pro, iOS 27.2, the app built from this tree, Full Access on,
the experiment on, the key-off fixture's config active):
- After three keyboard launches, typingConfig.keyboards holds exactly one keyboard (402 pt,
  portrait, en, qwerty, 42 pt keys, 33 keys). Before this change it held three.
- A tap 3.35 pt inside r's area types "E" with the config and "R" without, so the keyboard
  reads and applies it.
- FullKeyboardEngineTests: 163 of 163 pass.
The keyboard re-read active.json through a full TypingConfigReview (JSON parse, decode, every
check) whenever it built a letters layout it hadn't just built, to find that layout's aim and
zones, and compiled the zone map again each time. TypingConfigActive now compiles the file once
per typingConfig.generation into what the keys use and keeps it for the life of the process: the
words, and each key block's context, aim and zones as plain values, read and clamped by the same
two helpers the review uses (TypingConfigReview.aim / .zone). A layout only picks the first block
whose context matches (zones dropped when the hit model differs, as the review's
needsCheckingAgain), and the compiled zone map is reused while the keys' geometry is the same.

Changed behaviour: hasZones (which stops Adaptive touch recording) now counts only zones that
parse, in the blocks a reader looks at; a file whose only zones are unreadable no longer pauses
it. keys(on:) returns the block or nil instead of a TypingConfigReview.Applied.

Verified (Studio, iPhone 17 Pro sim, iOS 27.2, Full Access on): a tap 3.35 pt inside r's area
types "E" with the key-off fixture's zones and "R" with no config or a words/aim-only config, on
the app built from this tree; memory and suite results are in the PR thread.
…g, not its taps

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 2b5f2ae:
- 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.
…d as that letter

taps.py labelled the space that ended a word as meant for a space. When a tap meant for n lands on
the space bar, "on" goes in as "o" and a space, and the person finishes it as "on"; that tap was
meant for n. It is now labelled as the next letter of the finished word when the word was finished
longer from where the space went in. Before, a zone giving n's bottom edge more room looked as if
it only took taps from the space bar (right-low fixture, day 1: 7 taps lost, 0 gained); with the
right labels it gains 7 and loses none on half A (+5 words).

Verified: on the seven agent exports, only right-low (19 taps, 18 for n) and Ryan's day 1 (5 taps)
change. A fresh agent on each with this package: right-low now names the n-on-space slip and leaves
the zone out on the 15-tap floor (9 taps on half A); its config replays day 2 as before (114 -> 112
word errors, 1 made right, 0 wrong). Ryan's config applies exactly the same parts as before.
…experiment)

The phone side of typing configs (draft PR #2523's format and shared reader), all behind
Settings › Experiments › Typing › Typing configs (experiments.typingConfigs, off by default).

- Document type: anomaly.hex.typing-config (.mhexconfig), exported by Hex, conforming to
  public.data rather than public.json (an outside report has AirDrop previewing JSON-typed
  files as text that never reach the app), Owner rank, opened in place. Info.plist
  regenerated by xcodegen.
- Arrival (TypingConfigInbox): .onOpenURL sends every .mhexconfig to an inbox that reads it
  off the main thread through NSFileCoordinator, never past TypingConfigLimits.maxBytes
  (size checked first, then one byte past the limit), deletes Documents/Inbox copies once
  read, and queues files: a second one waits behind the sheet ("1 more file waiting"), the
  same bytes twice are one. The sheet is presented over whatever is on screen and can't be
  swiped away. With the experiment off it explains where the switch is; Open Experiments
  opens Settings › Experiments at it and turning it on brings the sheet back.
- Review (TypingConfigReviewView, TypingConfigWording): a rendering of TypingConfigReview
  with no parser or clamps of its own: each switchable part with its own switch, grouped in
  plain words, clamped values with what the file asked, the file's evidence labelled as its
  claim, key blocks for another keyboard field by field, skipped parts by reason (one
  sentence per Reason, English and Simplified Chinese), the note as plain text, Needs Full
  Access before Apply (Apply stays off), then Apply or Not now.
- History (TypingConfigHistory, TypingConfigActivation): every config kept unchanged in the
  App Group under TypingConfigs/history, keyed on the SHA-256 of its bytes, with the parts
  switched off; one active or Hex defaults; 20 kept, the oldest never applied going first.
  Apply compiles the parts left on and writes active.json through TypingConfigStore.
- Experiments' Typing group gains the Typing configs switch.
- Docs: ios/docs/typing-configs.md (new), settings-and-home.md, ios/README.md,
  docs/features/README.md.

Verified: TypingLogTests (15 tests, 3 new: arrival limits and Inbox cleanup, history keyed
on the bytes and its limit, apply/defaults/go back writing active.json) on the Studio's
iOS 27.2 simulator; every state opened from Files on iPhone 17 Pro and iPhone SE (3rd gen),
in English and Simplified Chinese; code-shape.py --check. Not verified: AirDrop, Messages,
Mail, other apps' Open in Hex, and Full Access off on a real iPhone.
Steps 3 and 4 of the phone side, on the shared reader's latest (21cdab2).

- Settings › Keyboard › Typing configs (beside Vocabulary, only while the experiment is on):
  Hex defaults first, then every kept config newest first with its status (In use, Best so
  far, applied or opened when), Use on each row (one tap, deletes nothing), and Delete all.
  A config's page shows its facts (based on, made from another iPhone's typing), Use or
  Use Hex defaults instead, Rename, Share (the kept file, unchanged) and Delete, and its
  parts with their switches (TypingConfigParts, shared with the review sheet), applied at
  once while it is the one in use.
- History: never refuses a new config. At 20 the oldest that is neither active nor best so
  far goes, and the review names it before Apply (replaces the old refusal). Not now keeps
  the parts switched off. Records this phone's export ids.
- Experiment off: the sheet's first action is Turn on typing configs, which shows the
  review at once; Open Experiments stays as the quieter second.
- The review now reads the keyboards the Hex keyboard recorded (TypingConfigSettings
  .keyboards) instead of a keyboard the app built (TypingConfigKeyboard.swift removed), and
  each item's own list, position, evidence and cleaned text instead of indexing by path;
  the note is the review's cleaned one. With no keyboard recorded yet the sheet says so
  under For another keyboard. hiddenCharacters has its sentence. The active config is
  compiled again when Hex comes to the foreground and a keyboard was recorded since.
- Delete what Hex learned also deletes every typing config and goes back to Hex defaults;
  its confirmation says so.
- Export for your agent (Typing logs, experiment on): the warning sheet every time (design
  §5's wording, a variant for fewer days), the days to include, then one zip: the bundled
  package (ios/TypingConfig/package as a folder resource), the chosen logs and state/
  (phone.json as state.md defines it, the recorded keyboards' layout; vocabulary.json with
  each word's model cost and spell-checker answer). Deleted once the share sheet closes.
- Hex's own dictation (handed to Hex, Action Button) applies the active config's dictation
  fixes after Learn how I type's, never to a translated dictation (TypingConfigDictation).
- Strings in English and Simplified Chinese.

Verified on the Studio (iOS 27.2): TypingLogTests 15 of 15 (history at the limit, apply and go
back, dictation fixes off for translation); every screen on iPhone 17 Pro and iPhone SE (3rd
gen) in English and 简体中文; the export of two real days (6.6 MB of logs) is a 772 KB zip,
built in about 2.5 s from Continue; its state/ read by the package's overview.py; the share
sheet offers Copy, Save to Files and More (AirDrop and other apps don't show on the
simulator). Through the real
keyboard (Full Access granted in the simulator's TCC database, the keyboard's typing log and
Full Access report confirming it), a tap 3.35 pt inside r types R with Hex defaults and E with
a key-off config applied through the review sheet (e's right edge +0.2, word-rule evidence),
the keyboard closed and opened in between.
@R44VC0RP
R44VC0RP force-pushed the ios-typing-config-phone branch from 428e567 to 6a7fdb6 Compare November 23, 2026 17:39
R44VC0RP added a commit that referenced this pull request Nov 23, 2026
…ce and place, cleaned text

The phone lane's three requests for TypingConfigReview (#2529 renders it):
- Keyboards, not one guessed context:
  - The keyboard records each letters keyboard it runs on, with the experiment on and Full
    Access, in typingConfig.keyboards (TypingConfigKeyboard: context plus KeyboardZoneGeometry),
    most recent first, at most 8, written only when the list changes.
  - TypingConfigReview(data:keyboards:) checks each key block against all of them: a block
    applies on the first keyboard it matches, a second block for that keyboard is a duplicate,
    and one that matches none is forAnotherKeyboard, with its differences from the nearest.
  - ContextCheck gains keyboardIndex, and keyboard is the matched or nearest one. Applied.blocks
    holds every applying block; Applied.aim and .zones are keyboard 0's.
  - compiled(switchedOn:) keeps every applying block, and the keyboard picks the one for its
    layout.
  - The zone compiler moved onto KeyboardZoneGeometry so recorded keyboards can be checked.
    KeyboardLayout.zoneMap wraps it, with the same results.
- Evidence and place on every Item: list (file, keep, neverCorrectTo, fixes, dictation,
  keyBlocks, aim, zones), position in it, block, the file's evidence, and the cleaned text, so
  "Words to keep, number 6" comes from the result alone.
- Cleaned text (TypingConfigText) for the note and every word, fix and dictation fix, so the
  sheet and the keyboard use the same strings.
  - Removed: controls (Cc), bidi embeddings, overrides, isolates and marks (U+202A-202E,
    U+2066-2069, U+200E, U+200F, U+061C), and invisible format characters (Cf: U+200B, U+2060,
    U+FEFF, U+00AD, ...).
  - ZWNJ and ZWJ are kept only between letters or marks of Arabic and Persian, Syriac, the Indic
    scripts, Sinhala, Myanmar and Khmer, and ZWJ between emoji. Tag characters are kept after a
    black flag.
  - Words are NFC-normalised and trimmed. A word that loses anything from inside it is skipped
    with the new Reason hiddenCharacters (after invalidValue in the order); one empty after
    cleaning is invalidValue. The note is cleaned, then cut at 280.
- The reference's "Reading" and "On the phone" sections and docs/typing-configs.md say so.

Verified on the Studio (iPhone 17 Pro, iOS 27.2):
- FullKeyboardEngineTests: 163 of 163 pass, including two new cases in
  FullKeyboardEngineTests+AdaptiveTouch.swift.
  - Four blocks on upright and sideways keyboards: English upright and sideways apply, French is
    forAnotherKeyboard with differences [language, letters], a second upright block is a
    duplicate, compiled keeps both applying blocks, the keyboard picks each on its own layout,
    and recording dedupes most-recent-first.
  - Cleaning: an override, a zero-width space, a Latin ZWJ and a fix with an isolate are
    hiddenCharacters. A Persian word keeps its ZWNJ, a Devanagari conjunct its ZWJ, and a
    decomposed café becomes NFC. The note loses its newline and override and is cut at 280.
  - The first review case also checks list, position and evidence.
- TypingLogTests: 12 of 12 pass.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant