mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
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.
75 lines
3.9 KiB
Python
75 lines
3.9 KiB
Python
"""How long things take: letter taps (down to up), the gap between taps, long presses that
|
|
opened accents (and whether one was picked), space-bar holds that started the trackpad (and
|
|
whether the cursor moved), shift double-taps, delete held to repeat, and suggestion-strip
|
|
taps that came soon after a key. Compare these with Hex's constants (reference/profile-schema.md).
|
|
|
|
python3 scripts/timings.py [EXPORT_DIR] [--half A|B]
|
|
"""
|
|
import json, os, sys, collections
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
import hexlog, words as W
|
|
|
|
ex = hexlog.export_dir(sys.argv[1:])
|
|
half = W.half_arg(sys.argv)
|
|
dur = []; gaps = []; accents = collections.Counter(); track = collections.Counter(); shift_gaps = []
|
|
held = collections.Counter(); strip_after = []; acc_hold = []
|
|
for f in hexlog.files_in(ex):
|
|
down = {}; last_up = {}; last_shift = {}; last_key_down = {}; open_acc = {}; tp = {}
|
|
for line in open(f, encoding="utf-8"):
|
|
e = json.loads(line); s = e["session"]
|
|
if half and W.half_of(s) != half:
|
|
continue
|
|
if e["type"] == "touch":
|
|
k = e.get("key")
|
|
if e["phase"] == "began":
|
|
down[(s, e["id"])] = (e["ts"], k)
|
|
if k and len(k) == 1 and k.isalpha():
|
|
if s in last_up and 0 < e["ts"] - last_up[s] < 2000:
|
|
gaps.append(e["ts"] - last_up[s])
|
|
last_key_down[s] = e["mt"]
|
|
if k == "shift":
|
|
if s in last_shift and e["ts"] - last_shift[s] < 1000:
|
|
shift_gaps.append(e["ts"] - last_shift[s])
|
|
last_shift[s] = e["ts"]
|
|
elif e["phase"] in ("ended", "cancelled") and (s, e["id"]) in down:
|
|
t0, k0 = down.pop((s, e["id"]))
|
|
if k0 and len(k0) == 1 and k0.isalpha():
|
|
dur.append(e["ts"] - t0); last_up[s] = e["ts"]
|
|
if (s, e["id"]) in open_acc:
|
|
acc_hold.append(e["ts"] - t0)
|
|
elif e["type"] == "ui":
|
|
a = e.get("action")
|
|
if a == "accent_open": open_acc[(s, e.get("id"))] = True; accents["opened"] += 1
|
|
elif a == "accent_pick": accents["picked"] += 1
|
|
elif a == "accent_cancel": accents["cancelled"] += 1
|
|
elif a == "trackpad_start": track["started"] += 1
|
|
elif a == "trackpad_end": track["moved the cursor" if e.get("offset") else "moved nothing"] += 1
|
|
elif e["type"] == "edit":
|
|
if e.get("op") == "delete":
|
|
held[e.get("src")] += 1
|
|
if e.get("op") == "suggestion" and s in last_key_down:
|
|
strip_after.append(e["mt"] - last_key_down[s])
|
|
|
|
|
|
def hist(v, edges):
|
|
c = collections.Counter()
|
|
for x in v:
|
|
b = next((f"<{e}" for e in edges if x < e), f">={edges[-1]}")
|
|
c[b] += 1
|
|
return {k: c[k] for k in [f"<{e}" for e in edges] + [f">={edges[-1]}"] if c[k]}
|
|
|
|
|
|
def pct(v, ps=(0.5, 0.9, 0.95, 0.99)):
|
|
if not v: return "-"
|
|
q = sorted(v); return " ".join("p%d %.0f" % (p * 100, q[int(p * (len(q) - 1))]) for p in ps)
|
|
|
|
|
|
print("letter taps, finger down to up (ms): n %d, %s" % (len(dur), pct(dur)))
|
|
print(" histogram:", hist(dur, [50, 100, 150, 200, 250, 300, 360, 500]))
|
|
print(" (accent popups open at 360 ms held: accentHoldDelay)")
|
|
print("gap between a letter's lift and the next letter (ms): n %d, %s" % (len(gaps), pct(gaps)))
|
|
print("accent popups:", dict(accents), "; held for (ms):", sorted(int(x) for x in acc_hold)[:30])
|
|
print("space-bar trackpad (starts after 350 ms held: trackpadHoldDelay):", dict(track))
|
|
print("shift taps less than 1 s apart (ms; caps lock is two within 300 ms: doubleTapWindow):", sorted(int(x) for x in shift_gaps))
|
|
print("deletes by source (key, repeat = held 360 ms then every 75 ms, repeat_fast after 0.85 s):", dict(held))
|
|
print("suggestion taps, ms after the last letter went down (the strip ignores touches within 250 ms of typing: stripTouchGuard):", hist(strip_after, [250, 400, 600, 1000]))
|