100x is a skill by a former Cursor engineer that turns prompts into formally verified, production-ready code
Put formal verification at the center of the README
Dead Internet9f48a70b6390
diff --git a/README.md b/README.mdindex a203ca9..d2824b4 100644--- a/README.md+++ b/README.md@@ -34,6 +34,8 @@ Your agent says it's done. You open it and it *kinda* works. It always looks fin**100x makes your coding agent solve the last 10% of development.**+**It splits the work into small blocks, formally verifies each one, then checks that the blocks work together.**+<p align="center"><img src="docs/img/proof/tokens-30-days.jpg" width="420" alt="Daily token use from 23 Oct to 20 Nov: 136B tokens in 30 days, 1.6K local agents, 0 cloud agents"></p>@@ -48,6 +50,57 @@ It is an open-source skill for Claude Code, Cursor and Codex. Give it one job, l<!-- Benchmark headline goes here: one line and one picture, the same agent with and without 100x, with a link to the method. -->+## Formal verification, one small block at a time++Nobody formally verifies a whole app in one piece. But almost any well-designed software is made of small blocks, and a small block has things you can state exactly and check completely. 100x writes those down, checks every one, then checks that the blocks work together. It does this by default.++### Six questions for every block++| Ask | What you write down |+|---|---|+| State | what can exist |+| Transitions | how it can change |+| Preconditions | when a step is allowed |+| Postconditions | what is true after a step |+| Invariants | what always holds |+| Liveness | what must eventually happen, and what that assumes |++The prompt answers all six in plain sentences. Then 100x builds a small model that runs your real functions, and a checker visits every state the model can reach. When something breaks, it prints the shortest list of steps that gets there.++### Small blocks add up to a big system++<p align="center">+ <img src="docs/img/diagrams/verified-blocks.svg" width="520" alt="Small verified blocks. Each block states six properties and is checked on its own: split a bill, order, refund. The seams between blocks are checked. The real blocks then run together in one system model. The ledger marks a proof stale when the code under it changes.">+</p>++Each block is checked on its own, so a failure points at one small thing. The seams are checked too: what one block hands over has to meet the next block's rules. Then the real blocks run together in one model, and the checker visits every state of the whole. Checked blocks plus checked seams add up to software you can trust. The blocks do not prove the seams for free, so 100x checks both.++### It stays true++The ledger is `verify/ledger.tsv`, in your repo, so it travels with every branch. Each row keeps a hash of the code it covers. Change that code and the row goes stale until someone reads the change, runs the check and syncs it. Every property has to fail once on a planted bug before it counts. `100x finish` refuses a property that is stale, broken or never failed. When an agent is about to touch code that no rule covers, `100x verify cover` answers `NO RULE`, and that starts the procedure.++```text+$ 100x verify run+pass split-keeps-every-cent. invariant, exhaustive, exit 0++# someone swaps Math.floor for Math.round in the split+$ 100x verify status+stale split-keeps-every-cent the covered code changed after the last sync++$ 100x verify run+FAIL inv:shares-keep-every-cent. a cent was lost or made. Steps: set-bill(1), set-people(2), compute+```++<sub>From a small tip splitter, run by hand in a scratch repo</sub>++### What verified means here++- **Exhaustive**: every state of the model was visited, so the property holds for that model and its bounds+- **Bounded**: the search hit a limit and found nothing in what it saw, which is not a proof, and liveness is never decided on it+- **Sampled**: chosen or random cases, good at finding bugs and silent about the rest++A pass covers the model and the real functions the checks run. Layout and copy have nothing to state, so they get a recorded waiver with a reason, and `100x finish` names the code each waiver excuses. To skip all of it, say `no verification` in the brief or run `100x config set verify.enabled false`. The report then says nothing was verified. [The details](docs/verification.md).+## Why agents stop at "almost works"Three things go wrong, and 100x has an answer for each. Every example below uses the same request:@@ -157,6 +210,7 @@ If you're away, the agent writes down each decision it makes and keeps working.- **The feature or app**, and how to try it yourself- **Screenshots at many screen sizes**, checked for spilled text, tiny buttons, blurry images and browser errors- **A report page** (`.100x/REPORT.html`) and a gallery of every finished run in `~/.100x`+- **A verification ledger** in your repo: the properties of each block, whether each one holds, and the code it covers- **A decision log**: every choice 100x made while you were away, and why- **The final message** shown above@@ -364,6 +418,7 @@ Give it a clock and it keeps working in rounds until the time is up. Each round|---|---|| [Install, in full](docs/install.md) | every install option, and every file the installer touches || [Using 100x](docs/using.md) | a night away, the report page, the helper skill |+| [Formal verification](docs/verification.md) | the six properties, the ledger, what verified means, and how blocks add up to a system || [Pipeline and final message](docs/pipeline.md) | every step in full, and what `100x finish` checks || [Setup and plans](docs/plans-and-setup.md) | recommended Claude Code setup, the lite preset, setups for each plan || [Settings](docs/settings.md) | every config key |diff --git a/docs/img/diagrams/verified-blocks.svg b/docs/img/diagrams/verified-blocks.svgnew file mode 100644index 0000000..2818486--- /dev/null+++ b/docs/img/diagrams/verified-blocks.svg@@ -0,0 +1,5 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 720 882" width="720" height="882" role="img" aria-labelledby="t d" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif">+<title id="t">Small verified blocks</title><desc id="d">Each small block states six properties: state, steps, rules, results, what always holds and what must eventually happen. Each block is checked on its own. The seams between blocks are checked. The real blocks then run together in one system model. The ledger marks a proof stale when the code under it changes.</desc>+<rect width="720" height="882" fill="#0b0e14"/><rect x=".75" y=".75" width="718.5" height="880.5" fill="none" stroke="#262e3d" stroke-width="1.5"/>+<text x="28" y="46" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">SIX PROPERTIES PER BLOCK</text><text x="28" y="84" font-size="25" fill="#eef1f6" >state, steps, rules, results, always, eventually</text><path d="M28 110H692" stroke="#262e3d" stroke-width="1.5"/><rect x="28" y="134" width="664" height="76" fill="#1c2330"/><text x="48" y="163" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">BLOCK · SPLIT A BILL</text><text x="48" y="195" font-size="26" fill="#eef1f6" >Every cent lands in exactly one share</text><path d="M62 216V242" stroke="#6b7589" stroke-width="3"/><path d="M54 234L62 244L70 234" fill="none" stroke="#6b7589" stroke-width="3" stroke-linejoin="miter"/><rect x="28" y="248" width="664" height="76" fill="#1c2330"/><text x="48" y="277" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">BLOCK · ORDER</text><text x="48" y="309" font-size="26" fill="#eef1f6" >Only a paid order ships</text><path d="M62 330V356" stroke="#6b7589" stroke-width="3"/><path d="M54 348L62 358L70 348" fill="none" stroke="#6b7589" stroke-width="3" stroke-linejoin="miter"/><rect x="28" y="362" width="664" height="76" fill="#1c2330"/><text x="48" y="391" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">BLOCK · REFUND</text><text x="48" y="423" font-size="26" fill="#eef1f6" >Never more than was paid</text><path d="M62 444V470" stroke="#6b7589" stroke-width="3"/><path d="M54 462L62 472L70 462" fill="none" stroke="#6b7589" stroke-width="3" stroke-linejoin="miter"/><rect x="28" y="476" width="664" height="76" fill="#1c2330"/><text x="48" y="505" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">SEAMS</text><text x="48" y="537" font-size="26" fill="#eef1f6" >What one block gives, the next accepts</text><path d="M62 558V584" stroke="#6b7589" stroke-width="3"/><path d="M54 576L62 586L70 576" fill="none" stroke="#6b7589" stroke-width="3" stroke-linejoin="miter"/><rect x="28" y="590" width="664" height="76" fill="#1c2330"/><text x="48" y="619" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">SYSTEM MODEL</text><text x="48" y="651" font-size="26" fill="#eef1f6" >The real blocks run together</text><path d="M62 672V698" stroke="#6b7589" stroke-width="3"/><path d="M54 690L62 700L70 690" fill="none" stroke="#6b7589" stroke-width="3" stroke-linejoin="miter"/><rect x="28" y="704" width="664" height="76" fill="#1c2330"/><text x="48" y="733" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace" font-size="20" fill="#a3acbb" font-weight="700" letter-spacing=".06em">LEDGER</text><text x="48" y="765" font-size="26" fill="#eef1f6" >Change the code, the proof goes stale</text><text x="28" y="820" font-size="23" fill="#eef1f6" >Each block is checked on its own</text><text x="28" y="854" font-size="23" fill="#eef1f6" >Then all of them are checked together</text>+</svg>diff --git a/docs/verification.md b/docs/verification.mdnew file mode 100644index 0000000..54eb944--- /dev/null+++ b/docs/verification.md@@ -0,0 +1,82 @@+# Formal verification++How 100x pulls checkable properties out of software, checks them, and keeps them true. Back to the [README](../README.md).++## The idea++You cannot formally verify an arbitrary program as a whole. You can pull formally checkable properties out of almost any software that is well defined enough to describe. So 100x does not try to prove the whole app. It cuts the work into small blocks, states six kinds of property for each block, checks them, then checks the blocks together.++## The six properties++For a tip splitter, one block:++| Ask | Example |+|---|---|+| State | a bill in cents, a number of people, a tip percent, and either no result yet or one share per person |+| Transitions | set the bill, set the people, set the tip, compute |+| Preconditions | compute needs a bill of at least one cent and at least one person |+| Postconditions | after compute, the shares add up to the bill plus the tip, one share per person |+| Invariants | no share is negative, and two shares never differ by more than one cent |+| Liveness | from any state with a valid bill and people, a result is eventually computed, if the caller keeps asking |++Each one has to be something that can be false. "Money is handled correctly" is not a property. "Shares add up to the bill plus the tip, to the cent" is.++## The checker++`skills/100x/assets/property-checker.mjs` is a small explicit-state checker with no dependencies. You give it a model: the start state, the steps with their preconditions and postconditions, the invariants and the liveness lines. Each step calls your project's own function. The checker then:++- visits every reachable state and checks the invariants on each+- runs the real function on every allowed case and every refused case, and fails when the code and the spec disagree about when a step may run (the `guard` lines)+- checks each postcondition on every step it finds+- reports a deadlock, and any step that was never possible+- decides each liveness line under a named fairness: every step that stays possible is eventually taken+- prints the shortest steps to a failure++If the search stops at a limit, it says BOUNDED and decides no liveness line.++## Blocks and the system++A block is a small piece of software with a clear contract: what it needs, and what it guarantees. 100x gives each block its own ledger row and its own failing run on a planted bug. Then it checks the whole:++1. **The seams.** Where block A hands a value to block B, A's guarantee has to meet B's precondition. In the system model this is B's `pre` and a guard line, so a disagreement fails as a named property.+2. **The system model.** One model whose steps call the real functions of several blocks in the order the product uses them. The checker visits every state of that model, so a bad interaction between blocks shows up as a short list of steps.+3. **A row for the system.** The system model is one more ledger row that covers every block it calls, so a change to any of them makes it stale.++What this does not do: it does not prove properties you never wrote down, and a system model leaves out what it does not model, such as concurrent callers, the clock or the network. The assumptions are printed with every result.++## The ledger++`verify/ledger.tsv` and `verify/history.tsv` live in the project, tracked by git, so they travel with every branch.++| Column | What it holds |+|---|---|+| id, kind, property | the name, which of the six, and one plain sentence |+| covers, covers_hash | the files or folders the property is about, and a hash of their contents |+| command, level | how to check it, and what the check really does: exhaustive, bounded or sampled |+| red | the failing run on a planted bug, which must hold a FAIL line |+| status, checked_at, commit | the last result, when, and at which commit |++A row is **holds** (green, current, and it has failed once on a planted bug), **stale** (the covered code changed after the last sync), **broken** (the last run failed), **unproven** (green but never seen failing) or **unchecked** (never run). A green run does not move the sync. Only `100x verify sync` does, and only after a green run on the code as it is now and a written note.++| Command | What it does |+|---|---|+| `100x verify status` | state of every row, exit 1 unless all hold |+| `100x verify cover <path>` | which rule covers this code, or NO RULE |+| `100x verify gaps` | every code file with no rule and no waiver |+| `100x verify add`, `run`, `sync` | record a property, run it, move its sync forward |+| `100x verify amend`, `retire` | change a promise on purpose, or drop it, with the reason in the log |+| `100x verify waive` | record that some code has nothing to state, with the reason |++`run` executes the command of each row, like `npm test` runs a script of package.json. Read the ledger of a project you did not write before you run it. `status`, `cover` and `gaps` run nothing.++## When there is no rule++Before an agent builds or changes code that carries logic, it runs `100x verify cover`. NO RULE starts the procedure: write the six properties, check them with the checker or a tool that fits, show each one fail on a planted bug, and record it. Code with nothing to state, such as layout or copy, gets a waiver and a reason. `100x finish` refuses an empty, stale, broken or never-failed ledger, and names the code each waiver excuses.++## Turning it off++It is on by default. Say `no verification` in the brief for one run, run `100x config set verify.enabled false --local` for one project, or `--global` for all of them. The `100x-mockup` mode skips it. When it is off, the report says nothing was verified.++## Other tools++The checker is the cheapest tool that can fail. When events can happen in a bad order across several actors, a model checker such as TLA+ fits better, and when a property must hold at every size, a prover does. The ledger takes any command, so those checks are recorded the same way. The procedure and the choice between them are in [the skill's guide](../skills/100x/references/properties.md).diff --git a/scripts/readme-diagrams.mjs b/scripts/readme-diagrams.mjsindex 94c7d69..baba31b 100644--- a/scripts/readme-diagrams.mjs+++ b/scripts/readme-diagrams.mjs@@ -288,6 +288,26 @@ function overnight() {return frame(s.y + 92, 'An overnight run', 'You type: /100x-overnight a farming game, for 8 hours. After the first full run, 100x works in rounds until the clock ends: fresh eyes, break it, hard test, then more. Each round ends with a fresh second model checking it, keeps the change if it helped and rolls it back if not. Finish refuses until the clock is over, then the report.', b);}+// 7. Small verified blocks that add up to a system. Each block states six properties and is checked alone, the seams between blocks are checked,+// the real blocks then run together in one model, and the ledger marks a proof stale when the code under it changes.+function verifiedBlocks() {+ const bold = 'font-weight="700"';+ const ROWS = [+ { name: 'BLOCK · SPLIT A BILL', text: 'Every cent lands in exactly one share' },+ { name: 'BLOCK · ORDER', text: 'Only a paid order ships' },+ { name: 'BLOCK · REFUND', text: 'Never more than was paid' },+ { name: 'SEAMS', text: 'What one block gives, the next accepts' },+ { name: 'SYSTEM MODEL', text: 'The real blocks run together' },+ { name: 'LEDGER', text: 'Change the code, the proof goes stale' },+ ];+ let b = mono(PAD, 46, 'SIX PROPERTIES PER BLOCK', 20, C.muted, bold + ' letter-spacing=".06em"') + sans(PAD, 84, 'state, steps, rules, results, always, eventually', 25, C.text);+ b += `<path d="M${PAD} 110H${W - PAD}" stroke="${C.edge}" stroke-width="1.5"/>`;+ const s = stacked(ROWS, 134, { flow: true });+ b += s.b;+ b += sans(PAD, s.y + 30, 'Each block is checked on its own', 23, C.text) + sans(PAD, s.y + 64, 'Then all of them are checked together', 23, C.text);+ return frame(s.y + 92, 'Small verified blocks', 'Each small block states six properties: state, steps, rules, results, what always holds and what must eventually happen. Each block is checked on its own. The seams between blocks are checked. The real blocks then run together in one system model. The ledger marks a proof stale when the code under it changes.', b);+}+// 6. The final message of the made-up stock run, wrapped so it reads on a phone. It is narrower than the others, 560 wide, so its// type stays large when a phone shrinks it. The text comes from chatSummary, word for word.function finalMessage() {@@ -313,5 +333,5 @@ function finalMessage() {fs.mkdirSync(OUT, { recursive: true });for (const f of fs.readdirSync(OUT)) if (f.endsWith('.svg')) fs.rmSync(path.join(OUT, f));-for (const [name, fn] of Object.entries({ 'by-hand-app': () => journey(APP), 'by-hand-feature': () => journey(FEATURE), pipeline, 'review-catch': reviewCatch, 'final-message': finalMessage, 'prompt-step': promptStep, overnight })) fs.writeFileSync(path.join(OUT, `${name}.svg`), fn());+for (const [name, fn] of Object.entries({ 'by-hand-app': () => journey(APP), 'by-hand-feature': () => journey(FEATURE), pipeline, 'review-catch': reviewCatch, 'final-message': finalMessage, 'prompt-step': promptStep, overnight, 'verified-blocks': verifiedBlocks })) fs.writeFileSync(path.join(OUT, `${name}.svg`), fn());console.log('drew the diagrams in ' + path.relative(process.cwd(), OUT));diff --git a/skills/100x/SKILL.md b/skills/100x/SKILL.mdindex 277cf29..ec69c7a 100644--- a/skills/100x/SKILL.md+++ b/skills/100x/SKILL.md@@ -125,7 +125,7 @@ At the end of every stage, update `.100x/STATE.md` (`Stage:`, `Next:`, `Open ris- **Context.** Long runs fill the window. Keep `STATE.md` true, send long output to files under `.100x/`, open `contact-sheet.png` before single screenshots.- **Deploy.** Preview when configured. Production only when the brief says so in words.- **Money and secrets.** No paid service the project does not already have keys for. No secrets in the repo.-- **No rule, no guess.** On by default, and the planner always does it. The prompt has a `Properties` section, and before you build or change code that carries logic you run `100x verify cover <file>`. Only the owner's words `no verification`, `100x config set verify.enabled false` (`--local` or `--global`) and `100x-mockup` turn it off. A `NO RULE` answer starts the verification procedure in `references/properties.md`: extract the six properties (state, transitions, preconditions, postconditions, invariants, liveness), check them, show each one fail, record them with `100x verify add`. Code with nothing to state gets `100x verify waive` and a reason. The ledger is `verify/ledger.tsv`, kept in git with the code, and `100x finish` refuses a property that is stale, broken or never failed.+- **No rule, no guess.** On by default, and the planner always does it. The prompt has a `Properties` section, and before you build or change code that carries logic you run `100x verify cover <file>`. Only the owner's words `no verification`, `100x config set verify.enabled false` (`--local` or `--global`) and `100x-mockup` turn it off. A `NO RULE` answer starts the verification procedure in `references/properties.md`: extract the six properties (state, transitions, preconditions, postconditions, invariants, liveness), check them, show each one fail, record them with `100x verify add`. Code with nothing to state gets `100x verify waive` and a reason. With two or more blocks, add a system model that calls their real functions and record it as one more row. The ledger is `verify/ledger.tsv`, kept in git with the code, and `100x finish` refuses a property that is stale, broken or never failed.- **Claims.** Mark each as measured, inferred or guess in the evidence column of the log. The report states measured things as facts.- **A judge in every loop.** Every polish pass and every fill round ends by asking a fresh judge, a different model, the brutal question. Write `.100x/loops/<name>/ask.md`, start it with `100x review-call --loop <name>`, answer every finding in `answers.md` before the next loop. One model grading its own loop loses direction. `100x finish` refuses a loop with no judge.- **In Cursor every helper starts through the SDK, at a 300k window and never in MAX mode.** A judge, a bake-off arm and a child start with `100x helper run` (or `100x review-run`), always with `--context 300k`. Never the Task tool, never `cursor-agent`. `references/apps.md` says why and how.- **The judge always runs.** Stage 6 starts it with `100x review-call`, by your app's subagent tool or by a command. No setting about helpers or counts limits it. Outside `100x-mockup`, only `review.enabled false` turns it off. Never finish UNREVIEWED because you expect to be limited. Try to start it. UNREVIEWED is for a start that failed, with the failure in the note, and `100x finish` refuses it when no attempt is logged.diff --git a/skills/100x/references/properties.md b/skills/100x/references/properties.mdindex 37b946a..3c510f7 100644--- a/skills/100x/references/properties.md+++ b/skills/100x/references/properties.md@@ -40,6 +40,15 @@ Code with nothing to state, such as layout, copy and glue, gets `100x verify wai6. **Record it.** `100x verify add <id> --kind <kind> --property "<sentence>" --covers <paths> --command "<cmd>" --level <level>`, then `100x verify run <id>`. One row per property. Copy the checker into the project (for example `verify/check.mjs`) so the command is cheap and the ledger lives with the code. Add `| tee .100x/must-not-break/properties.txt` to the run when this is the must-not-break check.7. **Read findings as findings.** When the current code breaks a property, say it as the shortest list of steps in the code's own words and the harm in one sentence. Do not weaken the property, the model or the bound to get green, and do not change product code to hide it. A fix is a separate change.+## Blocks and the system++A big program is not verified in one piece. Cut it into small blocks, each with a contract: what it needs and what it guarantees. Each block gets its own properties, its own ledger row and its own failing run. With two or more blocks, also do these:++1. **Check the seams.** Where block A hands a value to block B, A's guarantee has to meet B's precondition. In the system model that is B's `pre`, and the `guard` lines fail when the real code disagrees.+2. **Write a system model.** One checker model whose steps call the real functions of several blocks, in the order the product uses them. Add the properties that only exist across blocks, such as "money in equals money out". The checker visits every state of the whole.+3. **Give the system its own row.** One more ledger row, kind by what it states, `covers` every block the model calls, so a change to any block makes it stale.+4. **State the assumptions.** What the system model leaves out, such as concurrent callers, the clock or the network, goes in its `assumptions`. Checked blocks plus checked seams are not proof of behavior the model never contained.+## What a pass means- `exhaustive`. Every reachable state of the model was visited. The property holds for this model, these parameter values and this size. The model is a claim about the software, so a pass covers the model, plus the real functions the guard and post checks ran.