llm-3d-print-monitor
Skill16 starsChanged 16 days agoMITView on GitHub
Monitor and correct an FDM 3D print layer by layer through Klipper/Moonraker — pause after each layer, look at top and front camera images, diagnose defects (under-extrusion, stringing, blobs, poor adhesion), query the printer, and apply small safety-bounded G-code changes (flow, speed, temperature, retraction, pressure advance, Z offset) before resuming. Based on LLM-3D Print (Barati Farimani Lab). Use when a user wants an agent to watch a print, fix a print in progress, or set up camera-based print monitoring; includes a mock printer for rehearsal.
In this repository34 other files it gives its agents.
- skills/cadsmith-text-to-cad/references/agents.mdAGENTS.md
- agentscad-fdm-dfamSkill
- am-alloy-screeningSkill
- am-literature-ragSkill
- cadsmith-text-to-cadSkill
- cfd-simulation-setupSkill
- design-review-packageSkill
- dfm-reviewSkill
- drawing-gdt-reviewSkill
- engineering-calc-reportSkill
- equation-discoverySkill
- image2gcodeSkill
- lattice-inverse-designSkill
- linkage-synthesisSkill
- llm-mechanical-designerSkill
- lpbf-defect-predictionSkill
- lpbf-superresSkill
- machine-element-sizingSkill
- material-selectionSkill
- mechanical-teardownSkill
- mechanics-visualsSkill
- meltpool-geometrySkill
- parametric-part-cadSkill
- query2cad-freecadSkill
- quick-feaSkill
- rocketsmithSkill
- sketch-to-cadSkill
- sls-process-optimizationSkill
- stress-field-surrogateSkill
- thermal-fluids-calcSkill
- thermal-porositySkill
- tolerance-stackupSkill
- worked-problem-generatorSkill
- my-new-skillSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Ask the user for the printer URL, the material, and a one-line description of the part.
- Very specific: line 40
Use one session folder per job, set MOONRAKER_URL, and let P = python scripts/printer.py --session runs/<job>.
- Very specific: line 64
Change little, then look: Use one or two levers per layer, within the step sizes in the playbook.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LLM-3D Print monitor
Runs the closed loop from LLM-3D Print: Large language models to monitor and control 3D printing (Jadhav, Pak & Barati Farimani, Additive Manufacturing 114 (2025) 105027; code at github.com/BaratiLab/LLM-3D-Print-Large-Language-Models-To-Monitor-and-Control-3D-Printing). Each layer:
- The printer pauses and parks.
- You inspect the images.
- You gather information from the printer.
- You plan a fix.
- The fix is checked and sent.
- The print resumes.
In the paper, a team of agents did this with GPT-4o. Here you are the vision model and
the planner. scripts/printer.py is the executor and the supervisor. It enforces stage order,
blocks unsafe G-code, and logs everything.
Set up (once per printer)
- Follow
references/klipper_setup.md:- two webcams named
topandfront; [pause_resume]and[firmware_retraction];- the
LAYER_INSPECTmacro.
- two webcams named
- Insert the pauses into the sliced file:
python scripts/add_layer_pauses.py part.gcode part_mon.gcode [--every N]. - Ask the user for the printer URL, the material, and a one-line description of the part. Knowing the part stops you from flagging intended features.
- Rehearse first on the mock printer:
python scripts/mock_moonraker.py --port 7125 --fault underextrusion(orstringingornone), withMOONRAKER_URL=http://127.0.0.1:7125.
The loop
Use one session folder per job, set MOONRAKER_URL, and let P = python scripts/printer.py --session runs/<job>.
P wait # blocks until paused at the next layer (or reports the print done)
P snapshot # saves layer_N/top.jpg, front.jpg and occupancy
-> Read both images. Write detect.json. (format and guidance: references/stages.md)
P record detect detect.json
if problems:
P query extruder gcode_move firmware_retraction # pick objects that separate the causes
-> Write plan.json: 1-2 levers from references/playbook.md, each with a why.
P record plan plan.json
P apply # dry-run: shows the safety verdict for every line
P apply --live # all-or-nothing; refused plans send nothing
P resume --liveRepeat until wait reports complete, then run P report for the markdown log. Every
detect, query, plan, verdict and resume for each layer is kept in runs/<job>/session.json.
Rules
- Dry-run first. Without
--live, nothing that changes the printer is sent. On a new printer, do the first few layers in dry-run, show the userreport, and go live only once they agree. - Change little, then look. Use one or two levers per layer, within the step sizes in
the playbook. The next layer's image and its occupancy change tell you whether the fix
worked. Say so in
previous_solution. If the same lever has failed twice, stop pushing it. Name the probable hardware or material cause (clog, wet filament, worn nozzle) and tell the user. - Stop and tell the user about layer shift, spaghetti, a detached part, anything mechanical, or a fault that keeps coming back. Do not resume a print you think is lost. Ask.
safety.pyis the authority on what is sendable (references/safety.md). Never work around a refusal by sending raw requests to Moonraker. If a bound is wrong for this material, ask the user to pass--limits.- Occupancy (occupied pixels / total) is a number that supports your judgement. Your visual judgement decides.
- Respect the user's time. With
--every 1, each layer waits for you. For long prints, suggest--every 3to5after the first layers look good.
What the paper reported
- The VLM detected failures with accuracy comparable to 14 engineers, evaluated with a confusion matrix over common failure modes.
- Closed-loop corrections improved prints of the "CMU" letters and other parts across layers.
- Typical changes: speed to about 75% (
M220), flow slightly above 100% (M221), pressure advance up to 0.1, retraction about +25%, a 220 °C nozzle for TPU, and small Z offsets. - Unsafe classes (shutdown, restart, firmware) were excluded.
- Its logs also show what to avoid. Several changes per layer let speed ratchet down to 30% and retraction up to 7 mm. That is why this skill caps steps and cumulative drift.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

