
The problem. Most teams with a mature JavaScript codebase have tried to move it to TypeScript and failed the same way. Convert one file and TypeScript demands types for everything it imports; those imports demand types for theirs; two weeks later there is a 60-file pull request nobody wants to review, and it dies. AI agents fail faster: asked to "migrate this repo", an agent starts anywhere, invents types for modules it has not read, and "improves" code along the way. The problem was never the types. It is the order — a migration is a graph-traversal problem wearing a typing costume. The solution. Ratchet turns a migration into a sequence of small, verifiable, rollback-able steps, run by IBM Bob. It reads the internal import graph and sorts files into topological layers, so every batch the agent converts already has typed imports — Bob reads real types instead of inventing them. Cycles go to humans. Bob converts one batch (≤ 15 files) at a time under a hard contract: types only, no behavior changes, nothing outside the list, every `any` counted. Ratchet then runs the type checker and the batch's related tests. The human makes exactly two decisions per batch: approve the file list before conversion, and approve the list of semantic type claims after it — every new `?`, `| null`, interface, cast and `any`, with file and symbol. Mechanical changes are never read. Two counters enforced in CI, `.js` files and `any`, can only go down; a batch that raises either fails the build. A rejected batch is rolled back in one step. Target users. Teams with a 5–8-year-old React or Node codebase and a migration stuck in the backlog; agencies inheriting client code; tech leads who would hand this to an agent if they could trust the result. They install the MCP server and skill, open the repo in Bob, say "migrate this project to TypeScript with Ratchet", and answer two questions per batch. A dashboard and an HTML report show progress, counters and every reviewed claim to whoever was not in the session. Why it is new. Codemods handle the mechanical part, agents the contextual part; nobody has packaged order, contract, gates and a non-decreasing ratchet into one workflow the agent cannot escape. IBM ships this shape of process for Java, COBOL and RPG modernization; the front end of every one of those customers is JavaScript. Ratchet is the same idea for the web stack. Proof. We ran it on a fork of Mirador, an open-source IIIF viewer: 329 files, 42 layers, 1,038 internal imports. Five batches, 48 files migrated, `.js` 329 → 281, 29 `any` — all counted and reviewed — 105 type claims approved, 1,255 tests green throughout. One batch was run deliberately without the Migrator mode: it passed every test and was still rejected, because it refactored while converting. When asked to skip the contract, the Migrator mode refused. Every step is in `run.json`; every Bob session is in the repo.
27 Sep 2026