Beyond G-code, an interface between AI and machines
The problem. CNC (computer numerical control) machines are driven by G-code, a one-way list of positions and feed rates designed in the 1950s for punched tape. For an AI system trying to manufacture something, G-code is a poor interface:
- Actions only, no observations. The machine never reports force, spindle load, or where it actually slowed down.
- The wrong level of action. It specifies positions and feed numbers, not intent such as "clear this pocket without exceeding this force."
- Hidden constraints. The machine's real limits are never exposed, so they must be guessed.
- No way to ask "what if." A plan cannot be checked against the real machine before it runs.
- No feedback signal. Success is only known once the part is finished.
Much current work asks AI to write G-code. This project goes the other way: it replaces G-code with an interface designed for an intelligent operator.
The idea. I am building a small, low-cost milling machine that measures and models its own physics, and exposes those models through an interface an AI agent can use to:
- Observe time-synchronized sensor data and fitted model states.
- Query the machine's fitted limits: motor force, acceleration, spindle power, cutting force.
- Simulate a plan against the real machine's models before running it: predicted feed, chip load, and force along the path.
- Act at the level of intent, giving goals and constraints while the machine's own controller handles fast, real-time motion.
- Verify outcomes by comparing measurements against predictions.
The agent plans and supervises; a model-based controller enforces the physics underneath. The agent sits on top of inspectable physical models rather than replacing them.
Why it matters. If an agent can get a new part right on the first attempt through this interface, two things follow: cheap, light machines can run near their true limits instead of behind worst-case margins, and good results stop depending on scarce machinist experience.
Prior work
This project builds on Jake Read's PhD thesis, The End of GCode: Intelligent Modular Machines with Model Based Control (MIT Center for Bits and Atoms, 2026). Jake built an open controller stack (OSAP for networking, PIPES for programming, MAXL for motion control) that runs machines from fitted physical models instead of G-code. He demonstrated a full feedback-based workflow on a 3D printer, and on a milling machine used fitted models to choose motors and motion limits and to estimate cutting forces after a job.
Questions this project answers
- What does a machine interface designed for an AI operator need to expose, and can a low-cost mill provide it from its own fitted models?
- Given a new part, does an agent using this interface succeed in fewer attempts than the same agent writing G-code?
- How close to its real force and power limits can the machine run when the agent plans against fitted constraints?
System design
| Layer | Plan | HTMAA skills |
|---|---|---|
| Frame and axes | Small three-axis gantry for small parts. Designed for low cost rather than maximum rigidity, since the planner works around the machine's measured limits. | CAD, machining, 3D printing, cutting |
| Motors and drivers | Closed-loop steppers using Jake's field-oriented-control stepper boards, which fit their own motor models. | Electronics production, embedded programming |
| Sensing | Spindle current sensor for spindle power and torque; optional accelerometer for vibration. Sensors are chosen by what the agent needs to observe. | Input devices, electronics design |
| Network and real-time control | Jake's OSAP / PIPES / MAXL stack, with time-synchronized data from every device. | Networking and communications |
| Machine models | Fitted motor, axis, spindle power, and cutting force models, built from the machine's own data. | Interface and application programming |
| Agent interface | A structured API exposing observe, query, simulate, act, and verify. Plans are checked against model constraints before execution. | Interface and application programming |
| Agent | An AI planning agent that receives a part and goal, uses the interface to plan and run the job, and adapts from feedback between operations. | Interface and application programming |
Evaluation
The same agent is given new test parts (small islands, sharp and rounded corners, dogbones, similar to Jake's test part) under two conditions:
- G-code baseline: the agent writes G-code, runs it, and only sees the finished result.
- Feedback interface: the agent can query limits, simulate plans, observe live data, and verify outcomes.
Metrics:
- Attempts needed to produce an acceptable part
- Failed cuts and spindle stalls
- Cycle time
- Peak and average cutting force, as a fraction of the machine's fitted limit
- Predicted vs. measured feed and force
Jake's documented heuristic process (six runs, three failures) is a further reference point for a human-tuned workflow.