100x is a skill by a former Cursor engineer that turns prompts into formally verified, production-ready code
Close the control code hole in the message, drop blank steps, and keep both in the ledger
Dead Internet7ab1eaa0a3bb
diff --git a/lib/report.mjs b/lib/report.mjsindex fe3dca0..3da51c1 100644--- a/lib/report.mjs+++ b/lib/report.mjs@@ -186,7 +186,7 @@ export function chatSummary(entry) {[`The moment: ${bare(entry.moment)}`,`Run: ${entry.runCmd}${entry.url ? `, then open ${entry.url}` : ''}`,- ...list('Try first', (entry.tryFirst ?? []).map((step, i) => `${i + 1}) ${bare(step)}`)),+ ...list('Try first', (entry.tryFirst ?? []).map(bare).filter(Boolean).map((step, i) => `${i + 1}) ${step}`)),],[...mustNotBreakList(entry).map(checkLine),@@ -204,7 +204,7 @@ export function chatSummary(entry) {...(entry.nextAsks?.length ? [`Next likely asks: ${entry.nextAsks.slice(0, 3).join('; ')}${entry.nextAsks.length > 3 ? `; and ${entry.nextAsks.length - 3} more in the report` : ''}`] : []),],];- // A value with a line break in it must not add a line: every piece is one line, whatever the owner or a judge typed into it.- const oneLine = (line) => String(line).replace(/\s+/g, ' ').trim();+ // A value with a line break in it must not add a line, and one with a control code in it must not reach the terminal: every piece is one line of plain characters, whatever the owner, a judge or a copied page put into it.+ const oneLine = (line) => String(line).replace(/[\u0000-\u001f\u007f-\u009f\s]+/g, ' ').trim();return blocks.filter((block) => block.length).map((block) => block.map(oneLine).join('\n')).join('\n\n');}diff --git a/test/voice.test.mjs b/test/voice.test.mjsindex 0b7348e..37ad6b3 100644--- a/test/voice.test.mjs+++ b/test/voice.test.mjs@@ -73,3 +73,23 @@ test('the property checker for the final message holds in every mix of optionalassert.equal(run.status, 0, run.stdout.split('\n').filter((line) => line.startsWith('FAIL')).join('\n'));assert.match(run.stdout, /Exhaustive\. Every reachable state was visited/);});++test('the final message reads the same in another language and another time zone', () => {+ const program = `import { chatSummary } from ${JSON.stringify(path.join(ROOT, 'lib', 'report.mjs'))}; import { SAMPLE } from ${JSON.stringify(path.join(ROOT, 'scripts', 'readme-sample.mjs'))}; process.stdout.write(chatSummary(SAMPLE));`;+ const built = (extra) => {+ const run = spawnSync(process.execPath, ['--input-type=module', '-e', program], { encoding: 'utf8', env: { ...process.env, ...extra } });+ assert.equal(run.status, 0, run.stderr);+ return run.stdout;+ };+ const here = chatSummary(SAMPLE);+ for (const env of [{ TZ: 'UTC', LANG: 'C', LC_ALL: 'C' }, { TZ: 'Pacific/Kiritimati', LANG: 'tr_TR.UTF-8', LC_ALL: 'tr_TR.UTF-8' }, { TZ: 'America/St_Johns', LANG: 'ja_JP.UTF-8', LC_ALL: 'ja_JP.UTF-8' }]) {+ assert.equal(built(env), here, `the message changed under ${JSON.stringify(env)}`);+ }+});++test('a control code in a value never reaches the message, and a blank step takes no number', () => {+ const text = chatSummary({ ...SAMPLE, title: 'Glow\u001b[2J', moment: 'Tap\u0007 now\u0000done\u009b', tryFirst: ['Open it', ' ', 'Tap Go'] });+ assert.ok(!/[\u0000-\u0009\u000b-\u001f\u007f-\u009f]/.test(text), 'no control character is left');+ assert.ok(text.includes('The moment: Tap now done'), 'the words stay');+ assert.deepEqual(text.split('\n').filter((line) => /^\d\) /.test(line)), ['1) Open it', '2) Tap Go']);+});diff --git a/verify/final-message.check.mjs b/verify/final-message.check.mjsindex 7bc5d7c..a042f33 100644--- a/verify/final-message.check.mjs+++ b/verify/final-message.check.mjs@@ -39,8 +39,9 @@ const REASONS = [const NEXT = ['Save a list of friends', 'Round up to the dollar', 'Share the split as a picture', 'Add a tip jar', 'Dark mode'];const LAST_READY = { ready: true, notready: false, silent: null };-// A value with a line break in the middle of it, the way a judge or a hurried owner types one. It reads as the same words once the whitespace is one space.-const broken = (s, text) => (s.text === 'multi' ? text.replace(' ', ' \n\n ') : text);+// A value with a line break in the middle of it, the way a judge or a hurried owner types one, or with control codes in it, the way a copied page can carry them. Both read as the same words once the whitespace is one space and the codes are gone.+const CONTROL = ' \u001b\u0007\u0000\u009b ';+const broken = (s, text) => (s.text === 'multi' ? text.replace(' ', ' \n\n ') : s.text === 'control' ? text.replace(' ', CONTROL) : text);function entryOf(s) {const reviewed = s.review === 'reviewed';@@ -53,7 +54,7 @@ function entryOf(s) {moment: b(MOMENT),runCmd: b('npm start'),url: s.url ? 'http://localhost:5173' : undefined,- tryFirst: STEPS.slice(0, s.steps).map(b),+ tryFirst: STEPS.slice(0, s.steps).flatMap((step, index) => (index === 0 && s.blank ? [step, ' '] : [step])).map(b),mustNotBreak: CHECKS.slice(0, s.checks).map((check) => ({ ...check, summary: b(check.summary) })),review: reviewed? {@@ -146,13 +147,14 @@ const VALUES = {asks: [0, 1],work: [0, 1],nextAsks: [0, 2, 3, 4],- text: ['plain', 'multi'],+ text: ['plain', 'multi', 'control'],+ blank: [0, 1],steps: [1, 3],url: [0, 1],};const valid = (s) => (s.review === 'reviewed' || s.rounds === 'none') && (s.rounds === 'notready' || s.reasons === 0);-// The verdict fills the first line, the judge adds one line, and a line break in a value is the same for every line. Each is tried with every other piece at its start value, which keeps the model at a few thousand states.-const ISOLATED = ['verdict', 'judge', 'text'];+// The verdict fills the first line, the judge adds one line, a line break or a control code in a value is the same for every line, and a blank step is the same whichever other piece changes. Each is tried with every other piece at its start value, which keeps the model at a few thousand states.+const ISOLATED = ['verdict', 'judge', 'text', 'blank'];const START = { review: 'reviewed', rounds: 'ready', reasons: 0, checks: 1, matrix: 'ok', asks: 1, work: 0, nextAsks: 2, steps: 3, url: 1 };const atStart = (s) => Object.entries(START).every(([field, value]) => s[field] === value);const allowed = (s, field) => (ISOLATED.includes(field) ? atStart(s) && ISOLATED.filter((other) => other !== field).every((other) => s[other] === VALUES[other][0]) : ISOLATED.every((other) => s[other] === VALUES[other][0]));@@ -167,6 +169,7 @@ const FAMILY = {verdict: ['headline'],judge: ['Judged by'],text: [],+ blank: [],review: ['Review', 'Judged by', 'Look first', 'Judge rounds', 'Looked at', 'Why not ready to ship'],rounds: ['Look first', 'Judge rounds', 'Looked at', 'Why not ready to ship'],reasons: ['Why not ready to ship'],@@ -182,12 +185,12 @@ const FAMILY = {const model = {name: 'the final message, every mix of optional data',assumptions: [- 'one run at a time, the values listed for each field and the data below stand for every run (3 verdicts, 3 judges, review or none, 4 round outcomes, 0, 1, 3 or 4 reasons, 0 to 2 checks, 4 screen size outcomes, asks, work, 0, 2, 3 or 4 next asks, 1 or 3 steps, a url or none, plain text or text with a line break in it)',+ 'one run at a time, the values listed for each field and the data below stand for every run (3 verdicts, 3 judges, review or none, 4 round outcomes, 0, 1, 3 or 4 reasons, 0 to 2 checks, 4 screen size outcomes, asks, work, 0, 2, 3 or 4 next asks, 1 or 3 steps, a url or none, plain text, text with a line break in it or text with control codes in it, and a blank step beside the real ones or none)','the verdict and the judge are each tried with every other piece at its start value, because only line 1 reads the verdict and only one line reads the judge',- 'the text of each value is one fixed sentence, written plain or with a line break in the middle of it. A longer title, reason or step is not tried here, because finish refuses them above a length before the message is built',+ 'the text of each value is one fixed sentence, written plain, with a line break in the middle of it or with control codes in the middle of it. A longer title, reason or step is not tried here, because finish refuses them above a length before the message is built','only the layout of the message is checked here. The words of each line are the words the report and the tests already pin',],- init: () => ({ verdict: 'ship', judge: 'other', text: 'plain', review: 'reviewed', rounds: 'ready', reasons: 0, checks: 1, matrix: 'ok', asks: 1, work: 0, nextAsks: 2, steps: 3, url: 1 }),+ init: () => ({ verdict: 'ship', judge: 'other', text: 'plain', blank: 0, review: 'reviewed', rounds: 'ready', reasons: 0, checks: 1, matrix: 'ok', asks: 1, work: 0, nextAsks: 2, steps: 3, url: 1 }),terminal: () => true,actions: [{@@ -196,7 +199,7 @@ const model = {pre: (s, [field, value]) => valid({ ...s, [field]: value }) && s[field] !== value && allowed(s, field),apply: setField,post: (before, after, [field, value]) => {- if (field !== 'text' && summaryOf(before) === summaryOf(after)) return `changing ${field} to ${value} changed nothing in the message`;+ if (field !== 'text' && field !== 'blank' && summaryOf(before) === summaryOf(after)) return `changing ${field} to ${value} changed nothing in the message`;const a = parse(summaryOf(before));const b = parse(summaryOf(after));for (const label of ORDER) {@@ -310,7 +313,11 @@ const model = {},{name: 'a-line-break-in-a-value-adds-no-line',- holds: (s) => s.text === 'plain' || summaryOf(s) === summaryOf({ ...s, text: 'plain' }) || 'a value with a line break in it changed the message',+ holds: (s) => s.text !== 'multi' || summaryOf(s) === summaryOf({ ...s, text: 'plain' }) || 'a value with a line break in it changed the message',+ },+ {+ name: 'no-control-characters',+ holds: (s) => !/[\u0000-\u0009\u000b-\u001f\u007f-\u009f]/.test(summaryOf(s)) || 'a control character reached the message',},{name: 'the-run-is-left-as-it-was',diff --git a/verify/history.tsv b/verify/history.tsvindex e964a7c..e7cd577 100644--- a/verify/history.tsv+++ b/verify/history.tsv@@ -26,3 +26,6 @@ ts id event commit hash note result2026-11-26T23:54:20Z msg-postcondition sync 4f7bdec 0356e778bfdb56c4 Read the change since the last sync: the checker gained line-break values, key order, calls in a row and lists of three, and chatSummary now flattens line breaks inside a value. Ran the check on that code and it passed, exhaustive, exit 0 (verify run, this pass). holds2026-11-26T23:54:21Z msg-invariants sync 4f7bdec 0356e778bfdb56c4 Read the change since the last sync: the checker gained line-break values, key order, calls in a row and lists of three, and chatSummary now flattens line breaks inside a value. Ran the check on that code and it passed, exhaustive, exit 0 (verify run, this pass). holds2026-11-26T23:54:23Z msg-liveness sync 4f7bdec 0356e778bfdb56c4 Read the change since the last sync: the checker gained line-break values, key order, calls in a row and lists of three, and chatSummary now flattens line breaks inside a value. Ran the check on that code and it passed, exhaustive, exit 0 (verify run, this pass). holds+2026-11-27T00:06:32Z msg-control-chars add 287ad40 7657e84ee71266ac A control code in a value (a clear screen code, a bell, a null byte) never reaches the message, and the words around it stay unchecked+2026-11-27T00:06:35Z msg-numbered-steps add 287ad40 7657e84ee71266ac A blank step beside real ones takes no number, and the steps count up one by one with no gap unchecked+2026-11-27T00:06:38Z msg-locale add 287ad40 80998830411c9e31 The message is byte for byte the same under another language and another time zone uncheckeddiff --git a/verify/ledger.tsv b/verify/ledger.tsvindex cd3e004..4de463f 100644--- a/verify/ledger.tsv+++ b/verify/ledger.tsv@@ -10,3 +10,6 @@ msg-no-mutation invariant Building the message leaves the run it was given exactmsg-key-order invariant The same run with its keys in another order gives the same message lib/report.mjs,verify/final-message.check.mjs 0356e778bfdb56c4 node verify/final-message.check.mjs exhaustive verify/red/msg-key-order.txt holds 2026-11-26T23:51:08Z 4f7bdec 0356e778bfdb56c4msg-no-memory invariant A message built after another run's message shows only its own run: nothing is left behind between calls lib/report.mjs,verify/final-message.check.mjs 0356e778bfdb56c4 node verify/final-message.check.mjs exhaustive verify/red/msg-no-memory.txt holds 2026-11-26T23:51:24Z 4f7bdec 0356e778bfdb56c4msg-bounds invariant A list of next asks or of reasons longer than three shows three and says how many more are in the report, and a list of three or fewer says nothing about more lib/report.mjs,verify/final-message.check.mjs 0356e778bfdb56c4 node verify/final-message.check.mjs exhaustive verify/red/msg-bounds.txt holds 2026-11-26T23:51:43Z 4f7bdec 0356e778bfdb56c4+msg-control-chars invariant A control code in a value (a clear screen code, a bell, a null byte) never reaches the message, and the words around it stay lib/report.mjs,verify/final-message.check.mjs 7657e84ee71266ac node verify/final-message.check.mjs exhaustive verify/red/msg-control-chars.txt unchecked+msg-numbered-steps invariant A blank step beside real ones takes no number, and the steps count up one by one with no gap lib/report.mjs,verify/final-message.check.mjs 7657e84ee71266ac node verify/final-message.check.mjs exhaustive verify/red/msg-numbered-steps.txt unchecked+msg-locale invariant The message is byte for byte the same under another language and another time zone lib/report.mjs,test/voice.test.mjs 80998830411c9e31 X100_FAST=1 node --test --test-name-pattern="another language" test/voice.test.mjs sampled verify/red/msg-locale.txt unchecked