The right frame for AI-drafted G-code is an unknown programmer’s first submission: it looks competent, nothing about it is proven, and it gets reviewed in a fixed order rather than by vibes. Fixed order matters because AI failures are plausible by construction, hallucinated code reads smoothly, and a structured review catches what smooth reading slides past. Six passes, cheapest first, each catching a class the previous one cannot.

Why ad-hoc review fails on AI code

Reading a file top to bottom and nodding is review theater, and AI output defeats it for a structural reason: a human programmer’s mistakes cluster where the human was uncertain, so experienced reviewers know where to look. A model is never uncertain. Its errors distribute evenly across confident, fluent code, a wrong cycle parameter sitting in a perfectly formatted block, a dialect-foreign word wearing the house style. The fix is to stop reviewing by suspicion and start reviewing by category: six passes, each interrogating the file for one failure class, in an order that puts the cheap checks before the expensive ones.

The six passes

PassThe questionThe tool
1. DialectDoes every word exist on my control?Your control’s manual; a reference like LinuxCNC’s
2. StateAre units, distance mode, offset, and safety line declared?Your eyes, on the header
3. GeometryDoes the path match the intent?A plotter or simulator
4. PhysicsAre feeds, speeds, and depths plausible?The two formulas and the tool data
5. ClearanceWhat is actually in the way of every rapid and retract?The setup, pictured honestly
6. MachineDoes it behave, slowly, with nothing at stake?Dry run, then single block

Pass 1: dialect

Models train on every dialect at once and mix them freely: a Fanuc-format cycle here, a LinuxCNC-only word there, an M code your machine never wired. Read every G and M word against your control’s documentation, with a strict public reference like the LinuxCNC G-code list as the comparison baseline. Anything your control does not document is wrong by definition, however standard it looks. Tooling helps at this layer, the syntax-checker stack industrializes it, and canned cycles deserve double attention either way: the deepest dialect divergence and the model’s favorite place to improvise, with the lathe version dissected in ChatGPT’s G71 errors.

Pass 2: state

AI code chronically under-declares: no units word, no distance mode, no offset selection, no safety line, because training examples omit them too. The header should establish units, G90 or G91, the work offset, plane, and comp-off state explicitly. Whatever is undeclared, the machine inherits from its previous program, which is a coin flip you do not control.

Pass 3: geometry

Plot the file. A backplot or a free simulator like CAMotics turns the code into a shape, and your eyes do the comparison against intent: right profile, right depth layering, arcs bowing the right way. This is the pass where reversed G02/G03 and wrong arc centers surface. A simulator is excellent here and only here; it models the program’s world, not your shop, which is why this pass is one of six rather than the review, the boundary simulating without a machine draws precisely.

Pass 4: physics

Models guess numbers with total confidence: feeds that parse and snap cutters, spindle speeds from a different material’s table, full-diameter depths for a finishing tool. Check S against the speed formula, F against chip load, depths against the tool maker’s data. Thirty seconds with the feed-rate arithmetic is the whole pass, and it regularly catches the error that would have been loudest.

Pass 5: clearance

Trace every rapid, retract, and reference move while picturing the actual setup: vise jaws, clamps, the chuck. AI does not know your workholding exists. G28 deserves special suspicion, it moves through an intermediate point in a way models reproduce wrongly across dialects, and a Z-positive retract written for a machine zeroed differently is a plunge on yours. The general skill of this pass, scanning a file specifically for its dangerous lines, is error-hunting, and it transfers to every file you will ever review, AI-born or not.

Pass 6: machine

Dry run above the work or in air, then first real run in single block with feed and rapid overrides pulled down, distance-to-go on the screen, hand near hold. Nothing new here; this is what a careful shop gives any unproven program. The point of passes one through five is that by the time the AI’s code earns the machine, it has stopped being the AI’s code: every line has been read, checked, and owned by you.

Make the review fast enough to survive

A six-pass review that takes an hour gets abbreviated by Friday; one that takes minutes becomes habit. Speed comes from recognition, knowing the core codes and your dialect’s edges at recall rather than lookup, and that trains in minutes a day: the free 60-second rounds on the G-code practice page repeat your misses until the vocabulary answers instantly. Whether you need the fluency despite using AI has a short answer, yes, more than before, and the six passes are where that fluency pays its rent.

Sources

Frequently asked questions

How do you manually verify AI-generated G-code?

In six ordered passes: dialect (every word exists on your control), state (units, distance mode, offset, safety line declared), geometry (plot it), physics (feeds, speeds, depths against the formulas), clearance (trace every rapid and retract for obstacles), and machine (dry run, then single block with low overrides).

Which pass catches the most AI G-code problems?

The dialect pass catches the most, because models mix controls freely. The clearance pass catches the worst: plausible code that rapids through a vise or returns through G28’s waypoint.

Can I just run AI G-code in a simulator instead of checking manually?

A simulator covers the geometry pass well and parts of dialect, and that is all. It will not flag a feed four times too high, a missing G43, or a retract through your actual workholding. Use one inside the six passes, not instead of them.

What knowledge do the six passes assume I have?

Instant recognition of the core codes plus your control’s dialect edges. The free G-Code Sprint app builds that recognition in 60-second daily rounds, the difference between a review taking minutes and getting skipped.