app
AI Flow
Public Made by Adomby adom
Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board.
← Commit history
Reject medium molecule spans that cannot seat on the actual 8 mm scaffold grid
2 files changed
+31−6
crates/adom-aiflow/src/checks.rs+21−2@@ -220,8 +220,12 @@ pub fn molecule_check(b: &Board, spec: &Value, before: Option<&Board>) -> Findin f.error(format!("pin span {w:.2} x {h:.2} mm is not a multiple of the {grid} mm grid"), &hint_grid); } else { f.ok(format!("pin span {w:.2} x {h:.2} mm on the {grid} mm grid"));- if !near_multiple(w, 4.0) || !near_multiple(h, 4.0) {- f.warn(format!("pin span {w:.2} x {h:.2} mm is not a multiple of 4 mm: a medium-pin molecule on a LrgMed scaffold needs 4 mm multiples to land every pin on a scaffold hole"), "Round the span up to 4 mm multiples unless this molecule never mounts on a LrgMed scaffold.");+ let medium_pins = (1..=4).all(|k| {+ let name = b.footprints[&format!("MP{k}")].lib.to_ascii_lowercase();+ matches!(name.rsplit(':').next(), Some("machinepinmediumshort" | "machinepinmediumstandard"))+ });+ if medium_pins && (!near_multiple(w, 8.0) || !near_multiple(h, 8.0)) {+ f.error(format!("pin span {w:.2} x {h:.2} mm cannot seat on the LrgMed 8 mm medium-contact grid"), "Use 8 mm corner-pin spans; the LrgMed contacts are at FL + 4 + 8 k mm. The 2 mm signal/wiring grid is separate. Verify all four pins against the selected scaffold circuit.json and check Z seating with adom-aiflow-probing stack before claiming fit."); } } }@@ -555,6 +559,21 @@ mod tests { assert!(f.errors.iter().any(|e| e.contains("front-left")), "{:?}", f.lines); } + #[test]+ fn medium_scaffold_rejects_four_mm_spans_even_on_signal_grid() {+ let spec = json!({"molecule": {"gridMm": 2, "edgeMarginMm": 2}});+ let bad = BOARD.replace("124", "160").replace("84", "32")+ .replace("126 102", "162 102").replace("98 82", "98 30");+ let f = molecule_check(&board(&bad), &spec, None);+ assert!(f.errors.iter().any(|e| e.contains("LrgMed 8 mm")), "{:?}", f.lines);+ let fixed = bad.replace("160", "164").replace("32", "28")+ .replace("162 102", "166 102").replace("98 30", "98 26");+ let f = molecule_check(&board(&fixed), &spec, None);+ assert!(f.errors.is_empty(), "{:?}", f.lines);+ // Contact J1 remains on the separate 2 mm grid, not the scaffold grid.+ assert!(fixed.contains("(at 100 88)"));+ }+ #[test] fn molecule_moved_fixed_ref_against_start_board() { let spec = json!({"molecule": {}, "fixedRefs": ["J1"]});
skills/aiflow-molecule/SKILL.md+10−4@@ -1,7 +1,7 @@ --- name: aiflow-molecule description: >-- Make an adom-aiflow board an Adom molecule that fits the scaffold: the 2 mm grid, the origin at the MP1 (front-left) machine pin, MachinePinMediumShort (1.6 mm pad, 1.2 mm drill) at the corners as MP1 to MP4, MachineContactMedium (1.3 mm pad, 0.78 mm drill) for the signal contacts, footprints from the Adom KiCad Library 1.2.3, the fab-rules profile (3rd party fab default, jlcpcb optional), then STEP export, `step2glb convert --molecule` with its stats gates, real copper pads (`adom-aiflow board-glb copper`: pads and test points are copper, the mask opens and paste shows only where the footprint layers say, with a gate), and molecule-publish. Medium-pin molecules mount on a LrgMed user scaffold (4 mm medium contact grid, large pins on a 32 mm base grid). Trigger words: aiflow molecule, make it a molecule, fits our scaffold, machine pins, MachinePinMediumShort, MachineContactMedium, MP1, molecule grid, molecule outline, fab rules profile, kicad_dru, molecule conformance, molecule export, step2glb molecule, publish molecule, LrgMed scaffold, copper pads, grey pads, test points, solder mask openings, paste layer, board GLB, board-glb.+ Make an adom-aiflow board an Adom molecule that fits the scaffold: the 2 mm grid, the origin at the MP1 (front-left) machine pin, MachinePinMediumShort (1.6 mm pad, 1.2 mm drill) at the corners as MP1 to MP4, MachineContactMedium (1.3 mm pad, 0.78 mm drill) for the signal contacts, footprints from the Adom KiCad Library 1.2.3, the fab-rules profile (3rd party fab default, jlcpcb optional), then STEP export, `step2glb convert --molecule` with its stats gates, real copper pads (`adom-aiflow board-glb copper`: pads and test points are copper, the mask opens and paste shows only where the footprint layers say, with a gate), and molecule-publish. Medium-pin molecules mount on a LrgMed user scaffold (8 mm medium contact grid, offset 4 mm from its front-left large pin, large pins on a 32 mm base grid). Trigger words: aiflow molecule, make it a molecule, fits our scaffold, machine pins, MachinePinMediumShort, MachineContactMedium, MP1, molecule grid, molecule outline, fab rules profile, kicad_dru, molecule conformance, molecule export, step2glb molecule, publish molecule, LrgMed scaffold, copper pads, grey pads, test points, solder mask openings, paste layer, board GLB, board-glb. --- # aiflow-molecule: a board that drops into the scaffold@@ -19,13 +19,13 @@ A molecule is a small board whose machine pins seat it on a scaffold and whose c | Library | the Adom KiCad Library 1.2.3 (KiCad plugin manager); copy the footprints and their STEP models into the project (`lib/Molecule.pretty`, `3d/`) so the project travels | | Markers | MP1 to MP4 are the anchoring markers the step2glb molecule conversion reads; keep those exact references and the library's 3D models on them | | Outline | pin span plus an edge margin all round (24 x 16 mm span + 2 mm = 28 x 20 mm here), with **rounded corners**: an arc of radius = the edge margin, centred on each corner pin, so the edge stays the same distance from the pin all the way round (2 mm here; the 1.6 mm pin pad then clears the edge by 1.2 mm). Suggest this by default; never 45 degree chamfers, which read as unfinished. |-| Scaffold fit | medium-pin molecules mount on a LrgMed user scaffold: a 4 mm medium contact grid, with its large pins on a 32 mm base grid. Keep the pin span on 4 mm multiples so every corner pin lands on a scaffold hole |+| Scaffold fit | medium-pin molecules mount on a LrgMed user scaffold: an 8 mm medium contact grid, offset 4 mm from its front-left large pin, with its large pins on a 32 mm base grid. Keep the pin span on 8 mm multiples so every corner pin lands on a scaffold hole | Put the interface in netlist.json as `fixed` positions (aiflow-schematic-to-board) and in the aiflow spec as `fixedRefs` with a `fixedRefsNote`, so placement never moves them. ## 2. Designing the interface -- Size the pin span to the circuit, then round up to 4 mm multiples. Place contacts on the two short edges or wherever wiring is cleanest, on the grid, in an order that reads left to right on the silkscreen.+- Size the pin span to the circuit, then round up to 8 mm multiples. Place contacts on the two short edges or wherever wiring is cleanest, on the grid, in an order that reads left to right on the silkscreen. - Group power contacts together (input and its return side by side, output and its return side by side). Give each rail its own ground contact near it; corner pins are GND too, but they are mechanical first. - A monitor contact that feeds a Control Panel ADC must be scaled to the ADC's range (VMON = VOUT/2 through 10k/10k here for a 3.3 V ADC). - Test pads for probing sit on the top face, clear of the pins, with room for a probe tip (aiflow-scaffold-probe plans them).@@ -48,7 +48,7 @@ The DRC gate uses the board's own `.kicad_dru`, so the fab's limits must be in i - MP1 to MP4 present, references exact, `MachinePinMediumShort`, at the four corners of the span, all on GND. - Every contact is `MachineContactMedium`, on the 2 mm grid from MP1.-- Pin span on 4 mm multiples; outline = span + margin with rounded corners (radius = margin, centred on the corner pins); board origin on MP1.+- Pin span on 8 mm multiples; outline = span + margin with rounded corners (radius = margin, centred on the corner pins); board origin on MP1. - All interface parts locked and in `fixedRefs`. - Every pin and contact has its STEP model bound (`adom-aiflow models`). @@ -115,3 +115,9 @@ Whenever a component page is created or its model changes (here, or through mole 3. **The outline's name is the same mark.** `adom-aiflow-etch outline part.step --etched part-etched.step --footprint part.kicad_mod` (adom-chip-thumbnailer does the same): same face, same direction, same place. 4. **Run the gate and look before you report.** `adom-aiflow-etch check part-etched.step --outline <named.svg>` must say PASS (it runs after every etch too). Open `<etched>.check.png` (top view in the standard pose, band in green, reading arrow) and the outline at 320 px. A FAIL's `Hint:` lines say exactly what to rerun. 5. **Overrides are exceptions.** `--along x|y` only keeps a polarity stripe or printed band clear; the tool warns when it puts text across the short side and the gate still judges against the planner. A vendor model that already prints its marking stays as it is (the tool refuses unless `--over-vendor-mark`). Everything runs on the shared STEP service with plain python3: nothing to install (`--legacy` is the old OpenCascade path).++## Verify the actual scaffold before claiming fit++The LrgMed medium-contact centers follow FL + 4 + 8 k mm on each axis, not a 4 mm lattice. Read the selected scaffold page circuit.json (medium plated-hole drill 0.78 mm) and match every molecule corner pin to an actual contact. A 60 x 68 mm pin rectangle fails; 64 x 72 mm is grid-compatible but still needs contact-range and assembly checks. The molecule signal-contact/wiring grid remains 2 mm and is independent of the supporting scaffold pin grid.++Read base-scaffold-system and run adom-aiflow-probing stack for the real fixture. The medium-short pin shoulder seats on the contact lip: molecule top is scaffold top + 0.083 + 2.8 = 2.883 mm. Read GLB board surfaces and preserve explicit coordinate transforms when combining assets; never seat boards flush or align by pin tips. XY conformance alone is not Z seating or manufacturing qualification. If fit requires moving pins or changing the outline, isolate the candidate, revalidate copper and native DRC, and recheck attached carriers and probe access before adoption.