← Commit history
Merge PR #606: 0.2.113: molecule drills follow the fab (#251) (release-0.2.113 -> main) merge
Showing changes introduced by the merge (against its first parent).
10 files changed
+107−60
Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "serde",@@ -35,7 +35,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.112"+version = "0.2.113" dependencies = [ "roxmltree", "serde",@@ -44,7 +44,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "serde",@@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "aiflow-grid",@@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "serde",@@ -72,7 +72,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "serde",@@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "aiflow-copper",@@ -91,7 +91,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.112"+version = "0.2.113" dependencies = [ "aiflow-board", "aiflow-grid",@@ -102,7 +102,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.112"+version = "0.2.113" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.112"+version = "0.2.113" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
bin/adom-aiflow⋯ 1 unchanged line ⋯
crates/adom-aiflow/src/checks.rs+62−37@@ -130,9 +130,10 @@ pub fn compare_netlists(sch: &SchNetlist, b: &Board) -> Value { // ----------------------------------------------------------------------------- molecule (#9) -/// Pad and drill of each Adom molecule footprint, by footprint name. The drills are the current machine+/// Pad and drill of each Adom molecule footprint, by footprint name. The drill is the new machine /// hardware's (issue #251, Noah 2026-11-25: medium contact 0.87, large contact 2.75, large pin 3.6 mm;-/// the medium pin stays 1.2 mm); `legacy_drill` names the drill the earlier hardware had.+/// the medium pin stays 1.2 mm); `legacy_drill` names the earlier hardware's. Which one a board needs+/// follows its fab (`MoleculeFab`). pub fn molecule_part(lib: &str) -> Option<(&'static str, f64, f64)> { // case-insensitive: Fusion writes package names upper-cased (MACHINEPINMEDIUMSHORT) let name = lib.rsplit(':').next().unwrap_or(lib).to_ascii_lowercase();@@ -145,23 +146,41 @@ pub fn molecule_part(lib: &str) -> Option<(&'static str, f64, f64)> { } } -/// Issue #251: the earlier hardware's drill for a current one (Adom KiCad Library 1.2.3 / 1.2.4 footprints-/// still carry it), accepted during the changeover.+/// Issue #251: the earlier hardware's drill for a new one (the Adom KiCad Library 1.2.3 / 1.2.4 footprints+/// carry it). pub fn legacy_drill(drill: f64) -> Option<f64> { [(0.87, 0.78), (2.75, 2.62), (3.6, 3.45)].into_iter().find(|(now, _)| (now - drill).abs() < 1e-9).map(|(_, was)| was) } -/// Whether a drilled hole is the expected one: the current drill, or its legacy drill unless the spec-/// overrides the size (an override is exact).-fn drill_ok(d: f64, drill: f64, overridden: bool) -> bool {- (d - drill).abs() <= 0.01 || (!overridden && legacy_drill(drill).is_some_and(|was| (d - was).abs() <= 0.01))+/// Which machine-hole drills a molecule's fab takes (Colby 2026-11-25): the new hardware's drills are for+/// boards the 3rd party fab makes (the earlier ones still pass there during the changeover); any other fab+/// (JLCPCB, ...) keeps the earlier drills; with no fab named, either passes.+#[derive(Debug, Clone, PartialEq)]+pub enum MoleculeFab { ThirdParty, Other(String), Unnamed }++/// The molecule's fab from the spec's `fab.rules` (the run's `rules use` profile is filled in by the caller).+pub fn molecule_fab(spec: &Value) -> MoleculeFab {+ match rules_profile(spec) {+ Some(p) => { let (base, _) = split_profile(&p); if is_fab(&base) { MoleculeFab::ThirdParty } else { MoleculeFab::Other(base) } }+ None => MoleculeFab::Unnamed,+ } } -/// "0.87 mm drill (0.78 mm, the earlier hardware's, also accepted)"-fn drill_words(drill: f64, overridden: bool) -> String {- match legacy_drill(drill).filter(|_| !overridden) {- Some(was) => format!("{drill} mm drill ({was} mm, the earlier hardware's, also accepted)"),- None => format!("{drill} mm drill"),+/// Whether a drilled hole is right for the fab: `drill` is the new hardware's (or the spec's exact override).+fn drill_ok(d: f64, drill: f64, overridden: bool, fab: &MoleculeFab) -> bool {+ let near = |x: f64| (d - x).abs() <= 0.01;+ if overridden { return near(drill); }+ let old = legacy_drill(drill).unwrap_or(drill);+ match fab { MoleculeFab::Other(_) => near(old), _ => near(drill) || near(old) }+}++/// What the check expected, in words.+fn drill_words(drill: f64, overridden: bool, fab: &MoleculeFab) -> String {+ let Some(old) = legacy_drill(drill).filter(|_| !overridden) else { return format!("{drill} mm drill") };+ match fab {+ MoleculeFab::ThirdParty => format!("{drill} mm drill for the 3rd party fab's machine hardware ({old} mm, the earlier hardware's, also accepted)"),+ MoleculeFab::Other(f) => format!("{old} mm drill for {f} ({drill} mm is the 3rd party fab's machine hardware only)"),+ MoleculeFab::Unnamed => format!("{drill} mm drill for the 3rd party fab or {old} mm for any other fab (spec fab.rules names the fab)"), } } @@ -211,7 +230,8 @@ pub fn molecule_check_bom(b: &Board, spec: &Value, before: Option<&Board>, bom: let grid = m["gridMm"].as_f64().unwrap_or(2.0); let margin = m["edgeMarginMm"].as_f64().unwrap_or(2.0); let pin_net = m["cornerPinsNet"].as_str().unwrap_or("GND").to_string();- let hint_fp = "Use the Adom molecule footprints (MachinePin*, MachineContact*) drilled for the current machine hardware: MachinePinMediumShort 1.6 mm pad / 1.2 mm drill (or MachinePinLargeShort / LargeStandard 5.2 mm pad / 3.6 mm drill when the corner-pin class rule needs large pins) for MP1 to MP4, MachineContactMedium 1.3 mm pad / 0.87 mm drill for contacts (MachineContactLarge 4.4 mm pad / 2.75 mm drill for a power net over 3.5 A, which takes large corner pins). The earlier hardware's drills (0.78 / 2.62 / 3.45 mm, in the Adom KiCad Library 1.2.3 / 1.2.4 footprints) are still accepted during the changeover. spec.molecule.pinPadMm / pinDrillMm / contactPadMm / contactDrillMm override the expected sizes (skill aiflow-molecule).";+ let fab = molecule_fab(spec);+ let hint_fp = "Use the Adom molecule footprints: MachinePinMediumShort 1.6 mm pad / 1.2 mm drill (or MachinePinLargeShort / LargeStandard 5.2 mm pad when the corner-pin class rule needs large pins) for MP1 to MP4, MachineContactMedium 1.3 mm pad for contacts (MachineContactLarge 4.4 mm pad for a power net over 3.5 A, which takes large corner pins). The drills follow the fab: a board the 3rd party fab makes takes its machine hardware's 0.87 / 2.75 / 3.6 mm (contact / large contact / large pin; the earlier 0.78 / 2.62 / 3.45 mm still pass); any other fab, JLCPCB included, keeps 0.78 / 2.62 / 3.45 mm, as the Adom KiCad Library 1.2.3 / 1.2.4 footprints are drilled. spec fab.rules names the fab; spec.molecule.pinPadMm / pinDrillMm / contactPadMm / contactDrillMm override the expected sizes (skill aiflow-molecule)."; let pad_of = |r: &str| b.pads_of(r).into_iter().next().cloned(); let mut pins: BTreeMap<String, (f64, f64)> = BTreeMap::new(); for k in 1..=4 {@@ -223,8 +243,8 @@ pub fn molecule_check_bom(b: &Board, spec: &Value, before: Option<&Board>, bom: match pad_of(&r) { Some(p) => { let d = p.drill.unwrap_or(0.0);- if (p.size.0 - pad).abs() > 0.01 || (p.size.1 - pad).abs() > 0.01 || !drill_ok(d, drill, over) {- f.error(format!("{r} ({}) pad {:.2} x {:.2} mm, drill {d:.2} mm; expected {pad} mm pad, {}", fp.lib, p.size.0, p.size.1, drill_words(drill, over)), hint_fp);+ if (p.size.0 - pad).abs() > 0.01 || (p.size.1 - pad).abs() > 0.01 || !drill_ok(d, drill, over, &fab) {+ f.error(format!("{r} ({}) pad {:.2} x {:.2} mm, drill {d:.2} mm; expected {pad} mm pad, {}", fp.lib, p.size.0, p.size.1, drill_words(drill, over, &fab)), hint_fp); } else { f.ok(format!("{r} {} at ({:.2}, {:.2}): {pad} mm pad, {} mm drill", fp.lib, fp.x, fp.y, (d * 1000.0).round() / 1000.0)); } if !p.net.is_empty() && norm_net(&p.net) != norm_net(&pin_net) { f.warn(format!("{r} is on net {}; corner pins are {pin_net}", p.net), "Corner machine pins are mechanical first and tie to GND (spec.molecule.cornerPinsNet names another net)."); } }@@ -295,9 +315,9 @@ pub fn molecule_check_bom(b: &Board, spec: &Value, before: Option<&Board>, bom: let mut good = true; if let Some(p) = pad_of(r) { let d = p.drill.unwrap_or(0.0);- if (p.size.0 - pad).abs() > 0.01 || (p.size.1 - pad).abs() > 0.01 || !drill_ok(d, drill, over) {+ if (p.size.0 - pad).abs() > 0.01 || (p.size.1 - pad).abs() > 0.01 || !drill_ok(d, drill, over, &fab) { good = false;- f.error(format!("{r} ({}) pad {:.2} x {:.2} mm, drill {d:.2} mm; expected {pad} mm pad, {}", fp.lib, p.size.0, p.size.1, drill_words(drill, over)), hint_fp);+ f.error(format!("{r} ({}) pad {:.2} x {:.2} mm, drill {d:.2} mm; expected {pad} mm pad, {}", fp.lib, p.size.0, p.size.1, drill_words(drill, over, &fab)), hint_fp); } } if let Some(o) = origin {@@ -1096,26 +1116,31 @@ mod tests { fn board(text: &str) -> Board { Board::from_text("t.kicad_pcb", text.to_string()).unwrap() } #[test]- fn the_current_and_the_earlier_hardware_drills_both_pass() {- // issue #251 (Noah): medium contact 0.87 mm now, 0.78 mm on the earlier hardware; large pin 3.6 / 3.45- let drill_err = |f: &Findings| f.errors.iter().any(|e| e.contains("drill") && e.contains("expected"));- for d in ["0.87", "0.78"] {- let f = molecule_check(&board(&BOARD.replace("(drill 0.78)", &format!("(drill {d})"))), &json!({}), None);- assert!(!drill_err(&f), "MC1 drilled {d} mm: {:?}", f.errors);- }- let f = molecule_check(&board(&BOARD.replace("(drill 0.78)", "(drill 0.81)")), &json!({}), None);- let e = f.errors.iter().find(|e| e.contains("MC1")).expect("0.81 mm is neither hardware's");- assert!(e.contains("0.87 mm drill (0.78 mm, the earlier hardware's, also accepted)"), "{e}");- // a spec override is exact: the earlier drill no longer passes- let f = molecule_check(&board(BOARD), &json!({"molecule": {"contactDrillMm": 0.87}}), None);- assert!(f.errors.iter().any(|e| e.contains("MC1") && e.contains("expected 1.3 mm pad, 0.87 mm drill")), "{:?}", f.errors);+ fn the_drills_follow_the_fab() {+ // issue #251 (Noah) and Colby 2026-11-25: the new machine hardware (0.87 mm medium contact) is the 3rd+ // party fab's; JLCPCB and any other fab keep 0.78 mm; with no fab named either passes+ let drill_err = |f: &Findings| f.errors.iter().find(|e| e.contains("MC1") && e.contains("expected")).cloned();+ let check = |d: &str, spec: Value| drill_err(&molecule_check(&board(&BOARD.replace("(drill 0.78)", &format!("(drill {d})"))), &spec, None));+ let third = json!({"fab": {"rules": "3rdPartyFab"}});+ let jlc = json!({"fab": {"rules": "jlcpcb"}});+ assert_eq!(check("0.87", third.clone()), None);+ assert_eq!(check("0.78", third.clone()), None, "the earlier drill still passes at the 3rd party fab");+ assert_eq!(check("0.78", jlc.clone()), None);+ let e = check("0.87", jlc.clone()).expect("the new drill is the 3rd party fab's only");+ assert!(e.contains("0.78 mm drill for jlcpcb (0.87 mm is the 3rd party fab's machine hardware only)"), "{e}");+ for d in ["0.87", "0.78"] { assert_eq!(check(d, json!({})), None, "no fab named: {d}"); }+ let e = check("0.81", third).expect("0.81 mm is neither");+ assert!(e.contains("0.87 mm drill for the 3rd party fab's machine hardware (0.78 mm"), "{e}");+ // a spec override is exact+ assert!(check("0.78", json!({"molecule": {"contactDrillMm": 0.87}})).is_some_and(|e| e.contains("expected 1.3 mm pad, 0.87 mm drill"))); let large = |d: &str| BOARD.replace("size 1.6 1.6", "size 5.2 5.2").replace("drill 1.2", d).replace("MachinePinMediumShort", "MachinePinLargeShort");- for d in ["drill 3.6", "drill 3.45"] {- let f = molecule_check(&board(&large(d)), &json!({}), None);- assert!(!f.errors.iter().any(|e| e.starts_with("MP") && e.contains("drill")), "large pins {d}: {:?}", f.errors);- }- assert_eq!(legacy_drill(2.75), Some(2.62));- assert_eq!(legacy_drill(1.2), None);+ let pin_err = |t: &str, spec: Value| molecule_check(&board(t), &spec, None).errors.iter().any(|e| e.starts_with("MP") && e.contains("drill"));+ assert!(!pin_err(&large("drill 3.6"), json!({"fab": {"rules": "3rdPartyFab"}})));+ assert!(!pin_err(&large("drill 3.45"), json!({"fab": {"rules": "jlcpcb-2L"}})));+ assert!(pin_err(&large("drill 3.6"), json!({"fab": {"rules": "jlcpcb-2L"}})));+ // the medium pin is 1.2 mm on both+ assert!(!pin_err(BOARD, jlc) && !pin_err(BOARD, json!({"fab": {"rules": "3rdPartyFab"}})));+ assert_eq!(molecule_fab(&json!({"fab": {"rules": "fab-4L"}})), MoleculeFab::ThirdParty); } #[test]
crates/adom-aiflow/src/main.rs+13−2@@ -3652,7 +3652,18 @@ fn molecule_findings(spec: &Value, board: &Board, r: Option<&Run>) -> Option<che if spec.get("molecule").is_none() { return None; } let before = r.and_then(first_board); let bom = r.and_then(run_bom).and_then(|p| std::fs::read_to_string(p).ok());- Some(checks::molecule_check_bom(board, spec, before.as_ref(), bom.as_deref()))+ Some(checks::molecule_check_bom(board, &with_run_fab(spec, r), before.as_ref(), bom.as_deref()))+}++/// Issue #251: the molecule drills follow the fab; a spec with no fab.rules takes the run's `rules use` profile.+fn with_run_fab(spec: &Value, r: Option<&Run>) -> Value {+ let mut s = spec.clone();+ if checks::rules_profile(spec).is_none() {+ if let Some(p) = r.and_then(|r| r.data["fabRules"]["slug"].as_str().or(r.data["fabRules"]["profile"].as_str())) {+ if s["fab"].is_object() { s["fab"]["rules"] = json!(p); } else if s.is_object() { s["fab"] = json!({"rules": p}); }+ }+ }+ s } /// The run's BOM: the one `sourcing check` passed on, else the one `parts` used (issue #87 reads its@@ -7588,7 +7599,7 @@ fn main() { let before = if board.is_none() { run.as_ref().and_then(first_board) } else { None }; let bom_path = bom.clone().or_else(|| run.as_ref().and_then(run_bom)); let bom_text = bom_path.as_ref().map(|p| std::fs::read_to_string(p).unwrap_or_else(|e| err(&format!("{p}: {e}"), &[])));- let f = checks::molecule_check_bom(&b, &spec_v, before.as_ref(), bom_text.as_deref());+ let f = checks::molecule_check_bom(&b, &with_run_fab(&spec_v, run.as_ref()), before.as_ref(), bom_text.as_deref()); if let (Some(r), None) = (run.as_mut(), board) { r.outcome("molecule", json!({"ok": f.errors.is_empty(), "board": board_path, "errors": f.errors, "warnings": f.warnings, "pinClass": f.pin_class, "bom": bom_path})); r.save().unwrap_or_else(|e| err(&e, &[]));
docs/release-0.2.113.mdadded+11@@ -0,0 +1,11 @@+# adom-aiflow 0.2.113++## Molecule drills follow the fab (issue #251)++0.2.112 made the new machine hardware's drills the expected ones for every board. The new hardware is the 3rd party fab's only:++- A board the 3rd party fab makes (`fab.rules` 3rdPartyFab / fab) expects 0.87 mm medium contacts, 2.75 mm large contacts and 3.6 mm large pins. The earlier 0.78 / 2.62 / 3.45 mm still pass there during the changeover.+- Any other fab, JLCPCB included, keeps 0.78 / 2.62 / 3.45 mm, and the new sizes are refused there with the reason: `expected 1.3 mm pad, 0.78 mm drill for jlcpcb (0.87 mm is the 3rd party fab's machine hardware only)`.+- With no fab named, either size passes. The medium pin is 1.2 mm at every fab; pads are unchanged.+- The fab is the spec's `fab.rules`, or the run's `rules use` profile when the spec names none.+- A `spec.molecule` drill override stays exact. The hints and the aiflow-molecule skill say which drill goes with which fab.
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.112",+ "version": "0.2.113", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
page.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.112",+ "version": "0.2.113", "title": "AI Flow", "description": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. One Rust binary with a crate per step (placement helpers, a grid router with Kelvin taps, pours with keepouts, KiCad's DRC gate, live landing through the KiCad Bridge, copper measurement, current and thermal analysis) and a finish line that refuses an unfinished board. Every command answers with hints for the AI; every turn, its thinking time and every rework loop go into run.jsonl, so Claude, Codex and any other engine are compared on the same flow. KiCad, Fusion 360 and Altium Designer today (the same steps and gates through each tool's bridge); Adom's own web apps next.", "summary": "Adom's AI Flow: a tool to help the AI follow all of the steps it takes to build a board. The AI thinks its way from placement through routing, pours, current and thermal analysis to a delivered video; the binary does the fast, deterministic parts of every step, hands back hints, and keeps a ledger of every turn, every return to an earlier step, and the clock from the prompt to done.",
skills/adom-aiflow/SKILL.md+1−1@@ -407,7 +407,7 @@ The first `step` (or `capture start`) asks the test box once which recorder its Deterministic checks that report, each an OK or FINDINGS with suggestions (never a refusal): - **`netlist check [--sch design.kicad_sch] [--board B] [--net exported.net]`**: exports the schematic's netlist with kicad-cli (`sch export netlist --format kicadsexpr`, through `ADOM_AIFLOW_KICAD_CLI`; `adom-aiflow-kicad-cli-remote` does it on a desktop's KiCad 10 and carries the sub-sheets, lib tables and `${KIPRJMOD}` symbol libraries) and compares it pin by pin with the board's pads: missing and extra references, and every pin whose net differs (`/VIN` equals `VIN`; unlabelled `Net-(...)` nets compare by their pins). In a run it is recorded; `finish` re-checks the stored netlist against the board it finishes on and asks again when the schematic changed.-- **`molecule check [--board B --spec S]`**, and inside `place check`, `gate` and `finish` whenever the spec has `"molecule": {...}`: MP1 to MP4 are MachinePin footprints (MediumShort 1.6 mm pad / 1.2 mm drill, or large 5.2 / 3.6; the earlier hardware's 3.45 also passes), MP1 is the front-left pin and MP2 to MP4 follow counterclockwise seen from above (back left, back right, front right), the four sit on a rectangle whose sides are whole grid steps (a warning when not 4 mm multiples, which a LrgMed scaffold needs), every MachineContact (medium 1.3 / 0.87, the earlier 0.78 also passing) sits on the grid from MP1, pins and contacts keep the edge margin, `molecule.fixed` positions hold, and `fixedRefs` are where the start board had them. Corner-pin class (0.2.17, issue #87): an error when the pins are medium but the board needs large ones (seats in the base scaffold, over 100 g with its parts, a motor, actuator, heatsink over 20 g, cabled connector or hard-pressed button, longest side over 100 mm, or a pin net over 3.5 A in `spec.loads`); a warning when the mass is unknown or a part looks like an undeclared mechanical load; large pins with no reason are fine. The rule, its data and the spec fields are in skill aiflow-molecule. Spec: `"molecule": {"gridMm": 2, "edgeMarginMm": 2, "cornerPinsNet": "GND", "contacts": [...], "fixed": {"J1": [0, 12]}, "seat": "base|lrgmed|board", "massG": 42, "mechanicalLoads": [{"ref": "M1", "kind": "motor"}], "pinCurrentA": 1.2}` (mm from MP1, y up; all optional); `--bom <csv>` (default: the run's BOM) gives a `mass_g` column.+- **`molecule check [--board B --spec S]`**, and inside `place check`, `gate` and `finish` whenever the spec has `"molecule": {...}`: MP1 to MP4 are MachinePin footprints (MediumShort 1.6 mm pad / 1.2 mm drill, or large 5.2 / 3.6 at the 3rd party fab, 3.45 at any other fab), MP1 is the front-left pin and MP2 to MP4 follow counterclockwise seen from above (back left, back right, front right), the four sit on a rectangle whose sides are whole grid steps (a warning when not 4 mm multiples, which a LrgMed scaffold needs), every MachineContact (medium 1.3 / 0.87 at the 3rd party fab, 0.78 at any other fab) sits on the grid from MP1, pins and contacts keep the edge margin, `molecule.fixed` positions hold, and `fixedRefs` are where the start board had them. Corner-pin class (0.2.17, issue #87): an error when the pins are medium but the board needs large ones (seats in the base scaffold, over 100 g with its parts, a motor, actuator, heatsink over 20 g, cabled connector or hard-pressed button, longest side over 100 mm, or a pin net over 3.5 A in `spec.loads`); a warning when the mass is unknown or a part looks like an undeclared mechanical load; large pins with no reason are fine. The rule, its data and the spec fields are in skill aiflow-molecule. Spec: `"molecule": {"gridMm": 2, "edgeMarginMm": 2, "cornerPinsNet": "GND", "contacts": [...], "fixed": {"J1": [0, 12]}, "seat": "base|lrgmed|board", "massG": 42, "mechanicalLoads": [{"ref": "M1", "kind": "motor"}], "pinCurrentA": 1.2}` (mm from MP1, y up; all optional); `--bom <csv>` (default: the run's BOM) gives a `mass_g` column. - **Fab rules**: `"fab": {"rules": "fab" | "jlcpcb"}` in the spec. `fab` (the 3rd party fab) requires the project's own `.kicad_dru` beside the board; those rules are private and never shipped or restated. `jlcpcb` requires the JLCPCB pack for the board's copper layer count: on 2 layers the shipped profile, installed with `rules install --profile jlcpcb --layers 2` (JLCPCB's published 2-layer capabilities, cited in the file; `--force` replaces another rules file, keeps it as `.kicad_dru.bak` and says what it replaced); on 4, 6 or more layers `rules use --profile jlcpcb --layers <n>` loads the pack from adom/pcb-design-rules (`rules install` refuses a layer count it does not ship). A layer suffix pins the count: `"rules": "jlcpcb-6L"`. When the spec has no `fab.rules`, the gate, finish and `rules check` use what `rules use` recorded in run.json `fabRules` (an intake run has no spec yet), and warn when the spec and `fabRules` disagree. `rules check` says whether the board matches; the gate and finish refuse when it does not. - **3D models right way up**: `models` (and `models --offline`, no bridge) takes every bound model's bbox from `step2glb features` on the shared service (paced, cached per file in the run; the STEP file's own points when the service gives nothing), applies the footprint's rotate/offset as KiCad does, and warns when a flat SMD chip's thinnest axis is not Z or an SMD body's bottom is off the board. Fix the binding and look in the native 3D viewer; when a model is right as it is, `models --ack R1,C2 --why "<what you saw>"`. `finish` refuses while any warning is open. Never adom-chipsmith. `models` also compares each top-side model with its footprint's body outline (F.Fab, else the courtyard) and, when its centre is off or it lies across the body, notes the offset or quarter turn that would centre it (issue #240): advisory, look in the native 3D viewer and fix the footprint's model or leave it. - **Pads are real copper in every board GLB**: after `step2glb convert`, `board-glb copper --glb <kicad.glb> --board <design>.kicad_pcb --out <board>.glb [--finish copper|enig|hasl] [--paste none|solder]` makes them so by construction from the footprints' layers (pad/via/track meshes by KiCad layer name get a copper material with explicit metal and roughness; the mask is rebuilt as the outline minus every F.Mask/B.Mask aperture; solder only on F.Paste/B.Paste apertures of fitted parts; test points stay bare copper), then runs the gate. `board-glb check` alone refuses grey or default-metal pads, a mask over any exposed pad centre, solder on a pad without paste, or a board file whose pads do not line up with the GLB. A board file with no pads and no F.Mask/B.Mask apertures has no exposed copper: the GLB is still written (substrate and silkscreen opaque, mask whole) and the gate passes with the note "no exposed copper on this board". In a run the result is recorded (`boardGlb`). Rule and details: aiflow-molecule. Never hand-recolour a material index or lift pads through the mask. Publish only the `board-glb copper` output, never the raw step2glb GLB.
skills/aiflow-molecule/SKILL.md+7−7@@ -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, the corner-pin class rule (large MachinePinLargeShort when the board seats in the base scaffold, weighs over 100 g, carries a motor, actuator, heatsink over 20 g, cabled connector or hard-pressed button, is over 100 mm long, a pin carries over 3.5 A, or it has a large contact unless spec.molecule.largeContactMediumPins says why medium is right; otherwise MachinePinMediumShort, 1.6 mm pad, 1.2 mm drill) at the corners as MP1 to MP4, MachineContactMedium (1.3 mm pad, 0.87 mm drill) for the signal contacts (named MC<n>, as the wiki registry counts them), MachineContactLarge (4.4 mm pad, 2.75 mm drill, 14 AWG solid wire) for a power net over 3.5 A (the earlier hardware's 0.78 / 2.62 / 3.45 mm drills still pass), 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, large or medium pins, MachinePinLargeShort, MachinePinMediumShort, MachineContactMedium, MachineContactLarge, large contact, 14 AWG, high-current contact, 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, the corner-pin class rule (large MachinePinLargeShort when the board seats in the base scaffold, weighs over 100 g, carries a motor, actuator, heatsink over 20 g, cabled connector or hard-pressed button, is over 100 mm long, a pin carries over 3.5 A, or it has a large contact unless spec.molecule.largeContactMediumPins says why medium is right; otherwise MachinePinMediumShort, 1.6 mm pad, 1.2 mm drill) at the corners as MP1 to MP4, MachineContactMedium (1.3 mm pad; 0.87 mm drill at the 3rd party fab, 0.78 mm at any other fab) for the signal contacts (named MC<n>, as the wiki registry counts them), MachineContactLarge (4.4 mm pad; 2.75 mm drill at the 3rd party fab, 2.62 mm elsewhere; 14 AWG solid wire) for a power net over 3.5 A, 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, large or medium pins, MachinePinLargeShort, MachinePinMediumShort, MachineContactMedium, MachineContactLarge, large contact, 14 AWG, high-current contact, 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@@ -21,7 +21,7 @@ Choose the corner pins at intake, before placement, with this rule (issue #87, a Otherwise use MEDIUM pins (`MachinePinMediumShort`): small boards that sit in another board or a LrgMed user scaffold. Do not invent other thresholds. -**Large contacts.** A power net over 3.5 A comes onto the board through `MachineContactLarge` (4.4 mm pad, 2.75 mm drill), wired with 14 AWG solid wire, which carries well above the medium contact's rating (the large class is rated 20.8 A). A board that needs a large contact is a heavy-current board, so as a rule of thumb its corner pins go large too (rule 6). When medium corners are right anyway (a light board in a LrgMed user scaffold whose one large contact is a motor feed, say), keep them on purpose: set `spec.molecule.largeContactMediumPins` to a sentence saying why. The override covers rule 6 only; any other reason still needs large pins. A net carried only by large contacts and large pins is judged against the large class's 20.8 A, not the medium 3.5 A, so a 12 A rail on a large contact does not count against medium corners; a medium contact on the same net still does.+**Large contacts.** A power net over 3.5 A comes onto the board through `MachineContactLarge` (4.4 mm pad; 2.75 mm drill at the 3rd party fab, 2.62 mm at any other fab), wired with 14 AWG solid wire, which carries well above the medium contact's rating (the large class is rated 20.8 A). A board that needs a large contact is a heavy-current board, so as a rule of thumb its corner pins go large too (rule 6). When medium corners are right anyway (a light board in a LrgMed user scaffold whose one large contact is a motor feed, say), keep them on purpose: set `spec.molecule.largeContactMediumPins` to a sentence saying why. The override covers rule 6 only; any other reason still needs large pins. A net carried only by large contacts and large pins is judged against the large class's 20.8 A, not the medium 3.5 A, so a 12 A rail on a large contact does not count against medium corners; a medium contact on the same net still does. | | Medium | Large | |---|---|---|@@ -55,7 +55,7 @@ Declare the inputs in the spec so `molecule check` can apply the rule: Large pins mate directly to the base scaffold on a 32 mm grid. Medium pins require the chosen LrgMed scaffold's actual 8 mm contact grid and available span. Check all four sockets, seating height, pin model, drill/pad dimensions and outline clearance. A large-pin replacement is not a footprint-name substitution: update schematic/library/BOM, layout, models, fixture and electrical checks. Use the component page's engineering assets, not its animated inspection hero. Keep a compatible free medium GND contact for the probe tether when large corner heads are not verified compatible. -The medium-pin dimensions and example below apply only when medium pins were selected. Large pins are 5.2 mm pad / 3.6 mm drill for the current hardware (the check's expected sizes; the earlier hardware's 3.45 mm, still in the Adom KiCad Library 1.2.3 / 1.2.4 footprints, also passes); confirm them against the selected component assets and record unresolved conflicts between documentation and model geometry before claiming mechanical fit.+The medium-pin dimensions and example below apply only when medium pins were selected. Large pins are 5.2 mm pad with a 3.6 mm drill at the 3rd party fab or 3.45 mm at any other fab (the check's expected sizes; the Adom KiCad Library 1.2.3 / 1.2.4 footprints carry 3.45 mm); confirm them against the selected component assets and record unresolved conflicts between documentation and model geometry before claiming mechanical fit. ## 1. The rules @@ -63,10 +63,10 @@ The medium-pin dimensions and example below apply only when medium pins were sel |---|---| | Grid | 2 mm for every pin and contact, measured from MP1 | | Origin | the centre of MP1, the front-left (FL) corner pin; aux and grid origin on it; y up in the design frame, y down in KiCad |-| Corner pins | counterclockwise seen from above: MP1 (FL), MP2 (BL), MP3 (BR), MP4 (FR), the board-to-molecule tool's order (Colby, 2026-11-17), net GND; the class from the rule above: `MachinePinMediumShort` (1.6 mm pad, 1.2 mm drill) or `MachinePinLargeShort` (5.2 mm pad, 3.6 mm drill; `MachinePinLargeStandard` on LrgMed user-scaffold corners) |-| Contacts | footprint `MachineContactMedium`: 1.3 mm pad, 0.87 mm drill, one per signal the Control Panel wires to; `MachineContactLarge` (4.4 mm pad, 2.75 mm drill, 14 AWG solid wire) for a power net over 3.5 A, which takes large corner pins (rule 6). Name every contact `MC1`, `MC2`, ... in the schematic and the board: the wiki's model registry (rule `adom.molecule-pins/2`, molecule-publish) counts only one-pad parts named `MC<n>` as machine contacts, so a contact named `J3` gets no wire attach point in Hydrogen |-| Drills | the current machine hardware (Noah, 2026-11-25): medium pin 1.2 mm, medium contact 0.87 mm, large contact 2.75 mm, large pin 3.6 mm; pads unchanged. The earlier hardware's 0.78 / 2.62 / 3.45 mm still pass during the changeover; a `spec.molecule` drill override is exact (issue #251) |-| 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. Its 1.2.3 / 1.2.4 footprints carry the earlier drills: for the new hardware set the drills above in the project copy |+| Corner pins | counterclockwise seen from above: MP1 (FL), MP2 (BL), MP3 (BR), MP4 (FR), the board-to-molecule tool's order (Colby, 2026-11-17), net GND; the class from the rule above: `MachinePinMediumShort` (1.6 mm pad, 1.2 mm drill) or `MachinePinLargeShort` (5.2 mm pad; 3.6 mm drill at the 3rd party fab, 3.45 mm elsewhere; `MachinePinLargeStandard` on LrgMed user-scaffold corners) |+| Contacts | footprint `MachineContactMedium`: 1.3 mm pad, 0.87 mm drill at the 3rd party fab or 0.78 mm at any other fab, one per signal the Control Panel wires to; `MachineContactLarge` (4.4 mm pad, 2.75 / 2.62 mm drill by fab, 14 AWG solid wire) for a power net over 3.5 A, which takes large corner pins (rule 6). Name every contact `MC1`, `MC2`, ... in the schematic and the board: the wiki's model registry (rule `adom.molecule-pins/2`, molecule-publish) counts only one-pad parts named `MC<n>` as machine contacts, so a contact named `J3` gets no wire attach point in Hydrogen |+| Drills | follow the fab (issue #251; Colby 2026-11-25). A board the 3rd party fab makes takes its machine hardware: medium contact 0.87 mm, large contact 2.75 mm, large pin 3.6 mm (the earlier 0.78 / 2.62 / 3.45 mm still pass there during the changeover). Any other fab, JLCPCB included, keeps 0.78 / 2.62 / 3.45 mm, and the new sizes are refused there. The medium pin is 1.2 mm at every fab; pads are unchanged. `fab.rules` in the spec (or the run's `rules use` profile) names the fab; with none named either size passes. A `spec.molecule` drill override is exact |+| 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. Its 1.2.3 / 1.2.4 footprints carry the 0.78 / 2.62 / 3.45 mm drills: for a 3rd party fab board set the drills above in the project copy | | 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: 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 |