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.
84 lines
4.6 KiB
Python
84 lines
4.6 KiB
Python
"""Words: what Hex did with them and what the person did next. The per-person findings live
|
|
here: words Hex doesn't know that the person keeps typing, corrections they undo, typos they
|
|
fix the same way by hand, and slips that are themselves real words. Prints single words only.
|
|
|
|
python3 scripts/word_outcomes.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)
|
|
words, LAY, _ = W.load(ex, half)
|
|
n = W.norm
|
|
sc = [w for w in words if W.scorable(w)]
|
|
raw_wrong = [w for w in sc if not w.get("raw_right")]
|
|
hex_wrong = [w for w in sc if w.get("hex_saw") and not w.get("hex_right")]
|
|
changed = [w for w in sc if w.get("hex_saw") and w.get("raw_right") and not w.get("hex_right")]
|
|
print("scorable words: %d%s" % (len(sc), " (half %s)" % half if half else ""))
|
|
print(" at least one tap on the wrong key: %d (%.1f%%)" % (len(raw_wrong), 100 * len(raw_wrong) / max(1, len(sc))))
|
|
print(" wrong after Hex (as the phone did it): %d (%.1f%%)" % (len(hex_wrong), 100 * len(hex_wrong) / max(1, len(sc))))
|
|
print(" typed right, changed by Hex: %d" % len(changed))
|
|
odds_fix = sum(1 for w in sc if w.get("raw_right") is False and w.get("pressed_right") is True)
|
|
odds_hurt = sum(1 for w in sc if w.get("raw_right") is True and w.get("pressed_right") is False)
|
|
print(" next-letter odds (Hex moving a tap to a likelier neighbour): fixed %d words, broke %d" % (odds_fix, odds_hurt))
|
|
cls = collections.Counter(c for w in words for c in w["cls"])
|
|
ac = cls["ac_kept"] + cls["ac_undone_strip"] + cls["ac_retyped_literal"] + cls["ac_wrong_word"]
|
|
print("autocorrections: %d; kept %d, undone %d, retyped as typed %d, ended as a third word %d" % (
|
|
ac, cls["ac_kept"], cls["ac_undone_strip"], cls["ac_retyped_literal"], cls["ac_wrong_word"]))
|
|
|
|
|
|
sessions = collections.defaultdict(set)
|
|
|
|
|
|
def show(title, counter, extra=None):
|
|
print("\n" + title)
|
|
if not counter:
|
|
print(" (none)")
|
|
for k, c in counter.most_common(40):
|
|
print(" %-28s %d time(s) in %d session(s)%s" % (k, c, len(sessions[(title, k)]), extra(k) if extra else ""))
|
|
|
|
|
|
UNKNOWN = "words Hex doesn't know (state/vocabulary.json) that the person left in place (of which Hex corrected first):"
|
|
unknown = collections.Counter(); unk_changed = collections.Counter()
|
|
for w in words:
|
|
f = n(w["final"])
|
|
if f and f.replace("'", "").isalpha() and w.get("in_vocab") is False and not w["swiped"]:
|
|
unknown[f] += 1
|
|
sessions[(UNKNOWN, f)].add(w["session"])
|
|
if w.get("action") == "autocorrect":
|
|
unk_changed[f] += 1
|
|
show(UNKNOWN, unknown,
|
|
lambda k: " (Hex corrected %d)" % unk_changed[k] if unk_changed[k] else "")
|
|
UNDONE = "corrections the person took back (typed -> Hex's word):"
|
|
undone = collections.Counter()
|
|
for w in words:
|
|
if set(w["cls"]) & {"ac_undone_strip", "ac_retyped_literal"}:
|
|
k = n(w["ac_from"]) + " -> " + w["ac_to"]
|
|
undone[k] += 1; sessions[(UNDONE, k)].add(w["session"])
|
|
show(UNDONE, undone)
|
|
TO = "corrections taken back or retyped, by the word Hex put in (words.neverCorrectTo; exact spelling):"
|
|
to = collections.Counter()
|
|
for w in words:
|
|
if set(w["cls"]) & {"ac_undone_strip", "ac_retyped_literal", "ac_wrong_word"} and w.get("ac_to"):
|
|
to[w["ac_to"]] += 1; sessions[(TO, w["ac_to"])].add(w["session"])
|
|
show(TO, to)
|
|
wrongw = collections.Counter(n(w["ac_from"]) + " -> " + n(w["ac_to"]) + " (meant " + n(w["final"]) + ")" for w in words if "ac_wrong_word" in w["cls"])
|
|
show("corrected to the wrong word:", wrongw)
|
|
FIXES = "typos fixed by hand (after the space, or mid-word), typo -> word:"
|
|
REAL = "...of which the typo is itself a real word (autocorrect leaves those alone; a config fix must be suggest):"
|
|
fixes = collections.Counter(); realword = collections.Counter()
|
|
for w in words:
|
|
if "fixed_after_commit" in w["cls"] or ("inword_fix" in w["cls"] and w.get("raw_full")):
|
|
typo = n(w["committed"] if "fixed_after_commit" in w["cls"] else w["raw_full"])
|
|
f = n(w["final"])
|
|
if typo and f and typo != f:
|
|
fixes[typo + " -> " + f] += 1; sessions[(FIXES, typo + " -> " + f)].add(w["session"])
|
|
v = W.VOCAB.get(typo)
|
|
if v and (v.get("model") is not None or v.get("dictionary")):
|
|
realword[typo + " -> " + f] += 1; sessions[(REAL, typo + " -> " + f)].add(w["session"])
|
|
show(FIXES, fixes)
|
|
show(REAL, realword)
|
|
picks = collections.Counter(n(w["pick_text"]) for w in words if "pick_bar" in w["cls"] and w.get("pick_text"))
|
|
print("\nwords picked from the suggestion bar:", dict(picks.most_common(20)) or "(none)")
|