* iOS keyboard: touches at the screen's side edges reach the keys at once
What: KeyboardViewController.viewDidAppear turns off delaysTouchesBegan on
the keyboard window's gesture recognizers, iOS's system-gesture gate.
Why: a TestFlight tester (build 25) said they miss keys more on Hex's full
keyboard than on Apple's. Record typing logs from an iPhone show touches
within 20 pt of the side edges reaching the keys 104 ms (median, n=8) after
the finger went down, against 21 ms everywhere else (n=1,258): iOS holds
them back while it checks for an edge gesture. q, a, p, l, shift and delete
lagged and could land after the next key. Apple's keyboard has no such delay.
Verified: full HEXMobileTests suite on the iPhone 18 Pro simulator (iOS 27.2):
280 tests, 0 failures, 1 skipped (as before). The simulator never delays edge
touches (the key balloon shows at x = 1 pt while held), so whether this removes
the delay on an iPhone is unverified until the next typing log.
* iOS keyboard: a tap just above row 1 types its key, not a suggestion
What: row 1's touch targets also take the strip's bottom 4 pt, below its pills
and chips (KeyboardLayout.stripTouchBand; touchAreaFrame is the key area plus
that band and is what the key plane accepts). The Hex key's target in the strip
now stops where row 1's starts. Every other target is unchanged: gaps still
split down the middle and the outer keys still reach the screen's edges, in
every layout (Russian and Serbian included).
Why: in the live keyboard (AXe taps on the iPhone 18 Pro simulator) a tap 1 to
7 pt above a row-1 keycap accepted a suggestion. Apple's keyboard on the same
simulator types the key in the ~8 pt above its keycaps (at x = 110 it types e
from y = 590; its keycap starts at 598, the predictive bar ends at 589).
Verified: KeyboardLayoutTests now check that the hit frames tile the touch area
with no gaps or overlaps and that 2 pt above every row-1 keycap types it, in
every language, width and orientation; full suite 280 tests, 0 failures.
* iOS keyboard: the likely next letter claims up to 5 pt of its neighbour's target
What: FullKeyboardEngine.key(at:) picks the key a touch presses: the one under
it, or a neighbouring letter within letterReach (5 pt) of the touch whose odds
of coming next in the word beat the touched letter's by 0.8 nats for every point
it reaches past its own target. The odds are the word list's frequency mass
after what is typed (TypingDecoderModel.continuations; accented letters without
a key of their own count toward their base). It applies only on the letters page
of a text field, with autocorrect on and allowed by the field, outside caps lock,
for English and Spanish, whose Spatial autocorrect models FullKeyboardView now
maps whether or not that experiment is on (other layouts keep fixed targets). A
touch a letter claimed keeps it while a rolling finger stays within reach, so a
point of jitter doesn't slide it back. Record typing logs' began line names the
key pressed, with `under` when the odds moved it (docs/typing-logs.md). The
ios/README.md gains a Touch targets section for this and the two previous commits.
Why: Apple's keyboard does this (AXe on the iPhone 18 Pro simulator: after "th"
a tap 10 pt inside d types e; with nothing typed its row borders sit within about
2 pt of the gaps' middles), and Hex's targets were fixed. A fixed upward offset
was measured and left out: moving each of 643 labelled logged taps up by 2 to
8 pt landed no more of them on the meant key (586 at 0, 583 to 562 shifted).
Verified with a benchmark harness (kept outside the repo) that types taps
through FullKeyboardEngine; 5 pt and 0.8 nats/pt chosen on dev sets, checked on
held-out sets:
- held-out English (2,000 Tatoeba sentences typed with a touch model fitted to
real typing logs, 13,870 words): words mistyped before autocorrect 3,814 ->
2,504 (names aside); output word error rate with default autocorrect 13.2% ->
10.4%, with Spatial 8.5% -> 7.9%. Taps the odds moved broke 98 words that were
typed right and fixed 1,561 (8 pt: 112 and 1,921).
- held-out Spanish (13,301 words): default 22.9% -> 19.1%, Spatial 10.4% ->
10.2%; broke 46, fixed 1,451.
- fat-finger sentences (180, 1,614 words): default 15.3% -> 12.9%, Spatial
6.2% -> 5.3%. Real logged words (172): default 10.5% -> 9.3%, Spatial 4.1%
both.
- the tester's sentence, 30 tap draws: 51 of 360 slipped words now typed right
before autocorrect; Spatial 6.7% -> 6.3%.
New FullKeyboardEngineTests: the e/d border after "th" and "an", past the reach,
with autocorrect off or disallowed, a rolled finger; and the tester's sentence
from "but", tapped, through Spatial autocorrect. Full suite: 280 tests, 0
failures.
* iOS keyboard: Spatial autocorrect keeps names typed in lowercase, capitalised
What: when Spatial autocorrect reads a word typed all in lowercase that the
dictionary knows only capitalised (a name, day or place: "mary", "monday",
"boston"), it counts as a word (the 7-nat margin) and, unless a reading beats it
by that, is capitalised as the dictionary path does ("Mary").
Why: the models' word lists are lowercase only (SCOWL), so a lowercase name was
an unknown word with a 2-nat margin. On the held-out English benchmark Spatial
changed 287 of 1,488 correctly typed names, against 85 for the default engine:
"mary" -> "may" 98 times, "boston" -> "boson", "monday" -> "money". This is the
main thing that stood against turning Spatial autocorrect on by default.
Verified (benchmark harness, held-out sets, Spatial autocorrect without and with
the next-letter odds): English correctly typed names changed 287 -> 82 (default
engine 85), output word error rate 8.5% -> 7.1% (6.5% with the odds); Spanish
names 182 -> 5 of 732, 10.4% -> 9.2% (8.8% with the odds); fat-finger sentences
6.2% -> 6.0%; the tester's sentence unchanged (6.8%). New
AutocorrectEngineTests case: "see mary on monday in boston" typed at the keys'
centres comes out "see Mary on Monday in Boston". Full suite: 280 tests, 0
failures.
15 KiB
Typing logs (Record typing logs)
Settings › Privacy › Advanced › Record typing logs (off by default, asks for
consent in a dialog before it turns on, App Group key
experiments.typingLogs) makes Hex's keyboard write raw logs of everything it
sees: every touch with its position and timing, the key it pressed, what that
did to the text, the text around the cursor, and dictations. They are for
testing and training keyboard prediction and per-user touch models on a Mac.
Nothing is sent anywhere; Privacy › Advanced › Typing logs shares a day's file (or
all of them) through the share sheet, for example by AirDrop.
It is separate from Learn how I type, which keeps only word pairs and per-key averages and is unchanged.
Files
TypingLogs/yyyy-MM-dd.ndjsonin the App Group container (group.anomaly.hex.mobile), one per local day (Gregorian date in the iPhone's time zone). Each event goes to the file of the day itstfalls in.- NDJSON: one JSON object per line, UTF-8,
\nafter every line. - Kept 14 days (today and the 13 before). Older files are deleted when the keyboard starts a logger and when the Typing logs screen opens.
- At most 64 MB a day. The first event that would cross the cap is replaced by
one
cap_reachedline and nothing more is written that day. - The keyboard writes nothing without Full Access (it can't reach the App Group) and nothing while the experiment is off. The app's keyboard preview and simulator fixtures never write logs.
Writing: events are appended to an in-memory buffer on the main thread and
handed to one serial utility queue every 2 s (and when the keyboard goes away,
on a memory warning, and at 1,500 buffered events), which encodes them and
appends them with FileHandle. Lines from one session are in order; a session
ends with session_end unless the keyboard process was killed first.
Common fields
Every line starts with these, in this order:
| key | type | meaning |
|---|---|---|
v |
int | Schema version, 1. |
t |
int | Wall clock, ms since 1970 (UTC). |
mt |
number | Monotonic ms (CACurrentMediaTime, time since boot without sleep). Use it for intervals; UITouch.timestamp (ts) is on the same clock. |
type |
string | Event type, below. |
session |
string | 12 hex digits, new each time the keyboard appears or moves to another field. |
seq |
int | 1, 2, 3… within a session. A gap means lines were lost (only the cap does that). |
Units and spaces:
- Positions and sizes are points in the keyboard view's coordinates: origin at
the top-left of Hex's keyboard view (the suggestion strip's top edge), x to
the right, y down. The strip is
y0–44 in portrait, the keys below it. - A rect is
[x, y, width, height]. Insets are[top, left, bottom, right]. Points have 2 decimals, ms 3. - Character counts are Swift
Characters (grapheme clusters), what one backspace removes. - A key id is the character itself for character keys (always one character:
"a","7","@"; letters lowercase) and a word for the others:shift,delete,space,return,hex,globe,layer:numbers,layer:symbols,layer:letters.
Events
session_start
The keyboard appeared (trigger: appear), the field changed while it showed
(field), or the experiment was turned on while it showed (enabled).
surface:full(Hex's keys) orbar(the dictation bar; no touches).document:UITextDocumentProxy.documentIdentifier, which changes with the field. The host app is not knowable from a keyboard and is never guessed.traits:keyboardType,returnKeyType,autocapitalization,autocorrection,spellChecking,smartQuotes,smartDashes,smartInsertDelete,inlinePrediction,keyboardAppearance(UIKit case names, e.g."emailAddress","send","no"),textContentType(its raw value or null),secure,enablesReturnKeyAutomatically.bounds[w, h]andsafeAreaof the keyboard's root view when the session started (may be before layout;layoutlines carry the real size),orientation(portrait/landscape),appearance(light/dark).device(iPhone17,1;Simulator:…in the simulator),system(iOS 26.1),versionandbuildof Hex,locale,languages(first four preferred),keyboardLanguage(the keyboard'sprimaryLanguage),inputMode(the field's input mode language),fullAccess.settings:autocorrect(Hex's),spatialAutocorrect,key_popups,haptics,learnHowIType,cleanupTagger,hexKeyPlacement,dictationLanguage(BCP 47, orautomatic),keyboardLayout(en/nb/es/de, empty for the dictation bar),style(dictation style).
A context line follows at once with the text already in the field.
skipped
Instead of session_start in a field that must not be logged; nothing else is
written for that session, not even session_end. reason is
secureTextEntry or textContentType:<raw value> for password,
newPassword, oneTimeCode and every creditCard… content type. Also
trigger, surface, keyboardType, textContentType, secure. Every other
field is logged, including ones with autocorrection off.
session_end
reason: disappear, field_changed, disabled, or replaced.
durationMS, and counts of touches (began), edits, dictations. A
context line (when the text changed since the last one) and any unwritten
candidates come just before it.
layout
Written when the key layout or shift changes, and when a session starts.
-
hash: 16 hex digits over every key's id, frame and hit frame and the strip. Touches name it inlayout. -
cause:session,field,layout(width, orientation, globe),geometry(view size or safe area only),layer_key(123/#+=/ABC pressed),layer_auto(space or return went back to letters),layer_slide(hold 123, slide, let go),shift_key,typed(a one-shot shift turned off),auto(auto-capitalization),cancel,language(the keyboard layout changed). -
layer(letters/numbers/symbols),shift(off/on/locked),shiftHeld(only when true),field(text/url/email),orientation,width,height(the keys' layout),view[w, h],safeArea,horizontalInset(landscape),globe,hexPlacement,language(en/nb/es/de). -
The first time a hash appears in a day's file the line also has:
letterWidth(a 10-key row's; 11-key Norwegian and German letters are narrower, seekeys),metrics(side,gap,rowGap,keyHeight,stripHeight,keysBottom,cornerRadius),strip: the suggestion strip's rect, andslots: its three suggestion slots (left, centre, right),keys:[{id, label, row, frame, hitFrame}].frameis the drawn keycap,hitFramethe touch target; hit frames tile the key area (row 0 to 3) with no gaps. The Hex key in the strip has row-1.
Later lines with the same hash in that file say
"repeat": trueinstead, so look the keys up by hash. Every touch's hash appears in full earlier in the same file.
touch
One finger sample on the keys (not the strip, whose buttons log ui/edit).
phase:began,moved,ended,cancelled.id: the finger, stable from began to ended.x,y: the raw touch location.r:majorRadius,rt:majorRadiusTolerance(pt).forceandmaxForceonly on devices with force.ts:UITouch.timestampin ms (monotonic, same clock asmt).layout: the layout hash at the time.key: the key the engine resolves. Forbegan, the key the engine presses: the key under the point, or a neighbouring letter the next-letter odds gave it (FullKeyboardEngine.letterOdds). Formovedandended, the key the finger is held on: sliding across character keys moves it; any other key keeps the key it went down on.nullwhen the finger went down outside every key.under: the key under the raw point when it differs fromkey(null: outside every key, onended/cancelled). Onbeganit appears only when the next-letter odds moved the press to a neighbouring letter; otherwise the engine uses the hit frames as logged, sokeyonbeganis the key under the point.movedis throttled: a sample is written once the finger has moved at least 2 pt and 8 ms since the last line for it, or when it slides onto another key.
Order: began and ended lines come before the edits they cause (a character
types on release; delete and shift act on press; a press commits the
characters of fingers still down, which is rollover). A moved line comes
after what the move did (trackpad cursor steps, accent selection).
edit
What the keys did to the text, with op. To rebuild the text before the
cursor, for every edit (and dictation) line remove deleted (a string;
deletedCount characters when the text wasn't known) from the end, then append
inserted. cursor moves need the context lines to resync.
op |
fields |
|---|---|
insert |
inserted, src: key (a character or space), accent (long-press pick), slide (hold 123, slide, let go), bar (the dictation bar's space) |
delete |
deleted (the character), src: key (on press), repeat (held, 75 ms), repeat_fast (after 0.85 s, two at a time), bar |
delete_word |
deleted, src: repeat_word (held past 1.4 s) |
autocorrect |
from, to, deleted (= from), inserted (to + space). Applied on space. |
autocorrect_undo |
deleted (the correction and its space), inserted (what was typed): one backspace right after a correction undid it. |
suggestion |
slot (0 left, 1 centre, 2 right), text (as shown), deleted (the word being typed), inserted (the replacement + space), candidates (as in candidates) |
double_space_period |
deleted: " ", inserted: ". " |
return |
inserted: "\n", returnKeyType, send (the key said Send); ignored: true and no inserted when the key was disabled (empty field) |
paste |
inserted: the strip's Paste chip |
undo_dictation |
deleted (the dictation), or deletedCount when the host showed only its end |
cursor |
offset: characters the spacebar trackpad moved the cursor (negative is left) |
candidates
The suggestions the strip offers: items: [{slot, text, replacement?, kind, auto?}], kind literal (left, what you typed), primary (centre; auto:
space will apply it), secondary. Written only when they changed, lazily: just
before the next touch goes down and at session end, so each line is what was on
screen when a finger next went down. The strip hides them while it shows Undo
dictation, a status, or the clipboard chips.
context
The host's text around the cursor, as documentContextBeforeInput /
AfterInput give it. why: session_start, space, return,
suggestion, delete_word, autocorrect_undo, paste, trackpad,
undo_dictation, dictation, session_end, or text_did_change (the host
changed the text or moved the cursor: written once things settle for 0.3 s, at
once when the field emptied). before (the last 200 characters), after (the
first 200), beforeLength and afterLength (before capping; hosts often cut
the context short themselves), hasText. cleared: true when the field had
text and now has none (most apps clear it when they send). An unchanged context
is not written again.
ui
Taps that aren't text: action:
accent_open(id,key,options),accent_pick(id,index,chosen,rolloverwhen another key committed it),accent_cancel;trackpad_start(id),trackpad_end(id,offset: total characters);hex_key(dictation:warm,keyboard,open_hex),hex_menu,style(style,from:hex_menuorrecording_panel),dictation_language(language: BCP 47 orautomatic, from the Hex menu),dictation_stop(from: hex_key_releasewhen lifting a push-to-talk hold ends it),dictation_cancel;next_keyboard(strip chip),globe,undo_dictation(applied: falsewhen the text had changed),touches_cancelled(count).
dictation
Hex inserted a dictation (from the full keyboard or the dictation bar).
source:keyboard(in-keyboard dictation) orapp(a warm session or a handoff to Hex).resultID,style.- Each step, when it ran (a step that didn't run is missing):
engine,locale(in-keyboard) orlanguage(the app),recordedMS,transcribeMS,raw(as heard),fixed(after Learn how I type's fixes),spelled(after custom vocabulary, app),tagged(after Clean up what I say),cleaned(after Apple Intelligence, app),translated,formatted(after the style, app). text: the transcript Hex delivered;inserted: what went into the field (with the spacingTranscriptFormatter.insertionTextadded).
A context line follows.
dictation_outcome
What became of a dictation, from DictationEditTracker (the same inference
Learn how I type uses, run separately). dictationSession and dictation (its
seq) name the dictation line it is about. outcome: kept, edited,
rewritten, undone, deleted, redictated. words, changed, pairs:
[{kind, heard, inserted, meant, before, after}]. It settles within 60 s, when
the keyboard goes away or moves to another field, or on a Send return key, so it
can be in a later session than its dictation.
cap_reached
The day's file hit 64 MB. bytes (file size before this line), cap; seq and
session are those of the first event not written.
Size and cost
Measured in the simulator (Debug build, TypingLogTests.testLoggingOverheadAndSize,
3,000 taps of ordinary words): about 1 KB per tap, about 5.2 lines (a began,
one moved, an ended, an edit, a candidates, plus a context per
word and a layout when shift changes). Steady typing at 200 characters a
minute is about 12 MB an hour, so the 64 MB cap is about 5 hours of nonstop
typing in a day. On the main thread logging added about 12 µs per tap (35 µs
without it, 48 µs with); encoding and appending run on the utility queue.
Real fingers may produce more moved lines than the test's one per tap.
Reading a day on a Mac
import json
layouts, text = {}, ""
for line in open("2026-11-19.ndjson"):
e = json.loads(line)
if e["type"] == "layout" and "keys" in e:
layouts[e["hash"]] = e["keys"]
elif e["type"] in ("edit", "dictation"):
if "deleted" in e: text = text[: len(text) - len(e["deleted"])]
elif "deletedCount" in e: text = text[: len(text) - e["deletedCount"]]
text += e.get("inserted", "")
elif e["type"] == "touch" and e["phase"] == "ended":
keys = layouts[e["layout"]] # where the finger lifted, against every key's frame
(Python counts code points, not grapheme clusters; use a grapheme library for emoji and combining marks.)