← Commit history
0.2.128: heatsink vias respect other nets' zone priority (#272); spec fieldsPitch for AI Flow's Fields solves (#273)
9 files changed
+245−15
Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -27,7 +27,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "serde",@@ -37,7 +37,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.127"+version = "0.2.128" dependencies = [ "roxmltree", "serde",@@ -46,7 +46,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "serde",@@ -55,7 +55,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "aiflow-grid",@@ -65,7 +65,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "serde",@@ -74,7 +74,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "serde",@@ -83,7 +83,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "aiflow-copper",@@ -93,7 +93,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.127"+version = "0.2.128" dependencies = [ "aiflow-board", "aiflow-grid",@@ -104,7 +104,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.127"+version = "0.2.128" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.127"+version = "0.2.128" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
crates/adom-aiflow/src/fields_pitch.rsadded+96@@ -0,0 +1,96 @@+//! Issue #273 (monrad): the cell size of the Fields solves AI Flow starts itself. adom-fields solves at+//! 0.2 mm unless told otherwise, which on a 190 x 240 mm board needs more memory than an 11 GB+//! container has. `spec.fieldsPitch` (mm) goes to every solve AI Flow starts (`analyze` when it solves+//! again, `fields fix`), and a large board is named before a long solve starts, not after.++use aiflow_board::Board;+use serde_json::Value;++/// adom-fields' own default cell, mm.+pub const DEFAULT_MM: f64 = 0.2;+/// Cells per layer above which a solve at the chosen cell is called large (about 125 x 125 mm at 0.2).+const LARGE_CELLS: f64 = 400_000.0;+/// Cells per layer the suggested pitch aims at (a 65 x 75 mm board at 0.2 mm is 122 000 and takes a minute).+const AIM_CELLS: f64 = 300_000.0;++/// `spec.fieldsPitch`: None when unset, an error when it is not a cell size adom-fields can use.+pub fn pitch(spec: &Value) -> Result<Option<f64>, String> {+ match &spec["fieldsPitch"] {+ Value::Null => Ok(None),+ v => match v.as_f64() {+ Some(p) if (0.02..=2.0).contains(&p) => Ok(Some(p)),+ _ => Err(format!("spec fieldsPitch {v} is not a cell size: give mm between 0.02 and 2 (0.2 is adom-fields' default; 0.4 suits a board over about 150 mm a side)")),+ },+ }+}++/// The `--pitch` arguments for a solve: the spec's cell, else `before` (the cell of the solve being+/// compared against, fields.json board.cellMm), else none (adom-fields' default).+pub fn args(spec: &Value, before: Option<f64>) -> Vec<String> {+ match pitch(spec).ok().flatten().or(before) {+ Some(p) => vec!["--pitch".into(), format!("{p}")],+ None => Vec::new(),+ }+}++/// The board's outline size (w, h) in mm.+fn size(b: &Board) -> Option<(f64, f64)> {+ if b.outline.len() < 3 { return None; }+ let (mut x0, mut y0, mut x1, mut y1) = (f64::MAX, f64::MAX, f64::MIN, f64::MIN);+ for &(x, y) in &b.outline { x0 = x0.min(x); y0 = y0.min(y); x1 = x1.max(x); y1 = y1.max(y); }+ Some((x1 - x0, y1 - y0))+}++/// A cell that keeps a board near AIM_CELLS per layer, rounded up to 0.05 mm.+fn suggested(w: f64, h: f64) -> f64 {+ ((w * h / AIM_CELLS).sqrt() / 0.05).ceil() * 0.05+}++/// When the board is large for the cell the solve will use, one line saying so and what to set.+pub fn large_board_note(b: &Board, spec: &Value) -> Option<String> {+ let (w, h) = size(b)?;+ let p = pitch(spec).ok().flatten().unwrap_or(DEFAULT_MM);+ let cells = w * h / (p * p);+ if cells <= LARGE_CELLS { return None; }+ let s = suggested(w, h);+ Some(if spec["fieldsPitch"].is_null() {+ format!("this board is {w:.0} x {h:.0} mm: at adom-fields' default {DEFAULT_MM} mm cell that is {:.1} million cells a layer, which can take a long time and more memory than a container has. Set the cell in the spec first: \"fieldsPitch\": {s:.2} (AI Flow passes it to every Fields solve it starts)", cells / 1e6)+ } else {+ format!("this board is {w:.0} x {h:.0} mm and spec fieldsPitch {p} mm makes {:.1} million cells a layer: a long solve with a lot of memory; {s:.2} keeps it near {:.1} million", cells / 1e6, AIM_CELLS / 1e6)+ })+}++/// The hints of the current and thermal steps: how a solve counts, and the cell on a large board.+pub fn step_hints(b: &Board, spec: &Value) -> Vec<String> {+ let mut out = vec!["A Fields solve counts as evidence only when this run started or watched it: let `analyze` start it, or run it yourself as `adom-aiflow exec -- adom-fields analyze ...`. A fields.json made any other way is solved again by `analyze`, with spec fieldsPitch as the cell.".to_string()];+ out.extend(large_board_note(b, spec));+ out+}++#[cfg(test)]+mod tests {+ use serde_json::json;+ fn board(w: f64, h: f64) -> aiflow_board::Board {+ aiflow_board::Board::from_text("fixture", format!(r#"(kicad_pcb (net 0 "") (layers (0 "F.Cu" signal)(31 "B.Cu" signal)) (gr_rect (start 0 0)(end {w} {h})(layer "Edge.Cuts")))"#)).unwrap()+ }+ #[test]+ fn the_spec_cell_goes_to_every_solve_and_bad_ones_are_refused() {+ assert_eq!(super::args(&json!({}), None), Vec::<String>::new());+ assert_eq!(super::args(&json!({"fieldsPitch": 0.45}), Some(0.2)), vec!["--pitch", "0.45"]);+ // fields fix: the earlier solve's cell when the spec names none, so before and after compare+ assert_eq!(super::args(&json!({}), Some(0.3)), vec!["--pitch", "0.3"]);+ assert!(super::pitch(&json!({"fieldsPitch": 0})).is_err());+ assert!(super::pitch(&json!({"fieldsPitch": "0.4"})).is_err());+ }+ #[test]+ fn a_large_board_is_named_before_the_solve_with_a_cell_to_set() {+ // monrad's board: 190 x 240 mm+ let big = board(190.0, 240.0);+ let n = super::large_board_note(&big, &json!({})).unwrap();+ assert!(n.contains("190 x 240 mm") && n.contains("\"fieldsPitch\": 0.40"), "{n}");+ assert!(super::large_board_note(&big, &json!({"fieldsPitch": 0.45})).is_none());+ // a molecule-sized board says nothing+ assert!(super::large_board_note(&board(28.0, 20.0), &json!({})).is_none());+ assert!(super::step_hints(&big, &json!({}))[0].contains("adom-aiflow exec -- adom-fields"));+ }+}
crates/adom-aiflow/src/main.rs+12−1@@ -34,6 +34,7 @@ mod altium_placement; mod embedded_models; mod fields_suggest; mod fields_fix;+mod fields_pitch; mod assembly_contacts; mod provenance; mod spec_freeze;@@ -547,11 +548,13 @@ fn err(msg: &str, hints: &[String]) -> ! { /// labels at silkscreen, LED on/off states at schematic, silkscreen and finish, and the programming /// interface of a programmable board at schematic and placement. fn board_step_hints(r: &Run, step: &str) -> Vec<String> {- if !matches!(step, "schematic" | "placement" | "silkscreen" | "finish") { return Vec::new(); }+ if !matches!(step, "schematic" | "placement" | "silkscreen" | "finish" | "current" | "thermal") { return Vec::new(); } let path = r.current_board(); let Ok(b) = Board::load(&path) else { return Vec::new() }; let spec = spec_soft(r); let mut out = Vec::new();+ // issue #273: how a Fields solve counts, and the cell on a large board, before the long solve+ if matches!(step, "current" | "thermal") { out.extend(fields_pitch::step_hints(&b, &spec)); } if step == "silkscreen" { out.extend(silk_polarity::power_input_hint(&b)); let profile = checks::rules_target(&spec, &r.data["fabRules"]).map(|t| t.0);@@ -6549,7 +6552,11 @@ fn main() { args.push("--with".into()); args.push(csv); }+ // issue #273: the spec's cell, refused before a long solve when it is not one+ if let Err(e) = fields_pitch::pitch(&spec) { err(&e, &[]); }+ args.extend(fields_pitch::args(&spec, None)); eprintln!("{} was not produced by an Adom Fields solve this run watched; solving it now ({}): adom-fields {}", fields_file.display(), fields_mod_plan.describe(), args.join(" "));+ if let Some(n) = fields_pitch::large_board_note(&board_now, &spec) { eprintln!("WARNING: {n}. Stop it (Ctrl-C), set the cell and analyze {what} again; or solve it yourself through `adom-aiflow exec -- adom-fields {}`.", args.join(" ")); } match std::process::Command::new("adom-fields").args(&args).status() { Ok(st) if st.success() => { fields_file = out_dir.join("fields.json"); let mut full=vec!["adom-fields".to_string()]; full.extend(args.clone()); record_fields_solve(&mut r, &fields_file, "analyze", &full); r.save().unwrap(); } Ok(st) => { unobserved = Some(format!("the field solve aiflow started failed ({st}); fix what adom-fields printed, then `adom-aiflow exec -- adom-fields {}` and analyze {what} again", args.join(" "))); }@@ -8762,6 +8769,10 @@ fn main() { let mut args: Vec<String> = vec!["verify".into(), "--board".into(), cb.clone(), "--spec".into(), sp.clone(), "--fields".into(), dir.join("fields").display().to_string(), "--refill".into(), "--out".into(), out.display().to_string()]; let want: Vec<String> = match steps { Some(st) => st.split(',').map(|x| x.trim().to_string()).filter(|x| !x.is_empty()).collect(), None => copper.iter().filter_map(|s| s["step"].as_i64().map(|n| n.to_string())).collect() }; args.push("--step".into()); args.push(want.join(","));+ // issue #273: the spec's cell, else the cell of the solve being fixed, so before and after compare+ let spec_v = read_json(&sp);+ if let Err(e) = fields_pitch::pitch(&spec_v) { err(&e, &[]); }+ args.extend(fields_pitch::args(&spec_v, fd["board"]["cellMm"].as_f64())); eprintln!("adom-fields {}", args.join(" ")); let st = std::process::Command::new("adom-fields").args(&args).status().unwrap_or_else(|e| err(&format!("adom-fields could not start: {e}"), &["Install adom-fields (adom-wiki pkg install adom/adom-fields).".into()])); if !st.success() { err(&format!("adom-fields verify failed ({st})"), &["Read what adom-fields printed above: KiCad's refill and DRC run through kicad-cli (service-kicad, or KiCad on the desktop through Adom Bridge).".into()]); }
crates/adom-aiflow/src/thermalvias.rs+95−1@@ -53,6 +53,68 @@ fn local_pours(pours: &[Value], net: &str, c: (f64, f64), radius: f64, outline: })) } +/// Issue #272 (monrad): a zone that claims copper where it is drawn, by priority: spec.pours (an+/// outline pour fills the board outline) and the saved board's zones by their drawn outline (not their+/// fill, so a zone of another net claims its area before any refill).+struct Claim { net: String, layers: Vec<String>, poly: Vec<(f64, f64)>, priority: i64, label: String }++fn claims(spec: &Value, b: &Board) -> Vec<Claim> {+ let mut out = Vec::new();+ for p in spec["pours"].as_array().into_iter().flatten() {+ let Some(net) = p["net"].as_str() else { continue };+ let layers: Vec<String> = p["layers"].as_array().into_iter().flatten().filter_map(|l| l.as_str().map(str::to_string)).collect();+ let poly = match p["polygon"].as_array() {+ Some(a) => a.iter().filter_map(|v| Some((v.get(0)?.as_f64()?, v.get(1)?.as_f64()?))).collect(),+ None => b.outline.clone(),+ };+ let name = p["name"].as_str().map(str::to_string).unwrap_or_else(|| format!("{net} pour"));+ out.push(Claim { net: net.into(), layers, poly, priority: p["priority"].as_i64().unwrap_or(0), label: format!("{name} (spec.pours)") });+ }+ for z in b.root.find_all("zone") {+ if z.find("keepout").is_some() { continue; }+ let net = b.item_net(z);+ if net.is_empty() { continue; }+ let mut layers: Vec<String> = Vec::new();+ for key in ["layer", "layers"] {+ if let Some(n) = z.find(key) { layers.extend((1..).map_while(|i| n.atom(i)).map(str::to_string)); }+ }+ let poly = z.find("polygon").and_then(|p| p.find("pts")).map(crate::pourverify::pts_points).unwrap_or_default();+ let priority = z.find("priority").and_then(|p| p.number(1)).unwrap_or(0.0) as i64;+ let name = z.find("name").and_then(|n| n.value()).filter(|n| !n.is_empty()).map(|n| format!("zone \"{n}\"")).unwrap_or_else(|| "unnamed zone".into());+ out.push(Claim { net, layers, poly, priority, label: format!("{name} ({}, priority {priority})", b.item_net(z)) });+ }+ out+}++fn claim_on(c: &Claim, layer: &str) -> bool {+ c.layers.iter().any(|x| x == layer || x == "*.Cu" || (x == "F&B.Cu" && (layer == "F.Cu" || layer == "B.Cu")))+}++/// Issue #272: the zone of another net that owns the copper at `c` on a layer where `net` has copper+/// there: a higher priority than every zone of `net` covering `c` on that layer, and the via inside it+/// or within its clearance of its edge (KiCad's refill would carve that zone around the via, splitting it+/// into islands or taking its copper). Equal priorities are left alone (KiCad gives neither precedence).+fn claimed_by_other<'a>(claims: &'a [Claim], net: &str, c: (f64, f64), reach: f64) -> Option<&'a Claim> {+ let inside = |poly: &[(f64, f64)]| poly.len() >= 3 && point_in(poly, c);+ let near = |poly: &[(f64, f64)]| poly.len() >= 3 && (point_in(poly, c) || (0..poly.len()).any(|i| seg_dist(c, poly[i], poly[(i + 1) % poly.len()]) < reach));+ let mut layers: Vec<&str> = Vec::new();+ for cl in claims.iter().filter(|cl| cl.net == net) {+ for l in &cl.layers {+ for l in if l == "F&B.Cu" { vec!["F.Cu", "B.Cu"] } else if l == "*.Cu" { vec!["F.Cu", "B.Cu"] } else { vec![l.as_str()] } {+ if !layers.contains(&l) { layers.push(l); }+ }+ }+ }+ for layer in layers {+ let own = claims.iter().filter(|cl| cl.net == net && claim_on(cl, layer) && inside(&cl.poly)).map(|cl| cl.priority).max();+ let Some(own) = own else { continue };+ if let Some(other) = claims.iter().find(|cl| cl.net != net && claim_on(cl, layer) && cl.priority > own && near(&cl.poly)) {+ return Some(other);+ }+ }+ None+}+ pub struct Part { pub reference: String, pub net: String, pub target: usize, pub existing: usize, pub planned: Vec<(f64, f64)>, pub note: Option<String>, pub copper: Vec<String> } /// Issue #136: the saved board's filled zones as copper regions, the same shape as spec.pours (one@@ -130,6 +192,7 @@ pub fn plan_with_acknowledgements(spec: &Value, b: &Board, sw_nets: &[String], a let max_rise = spec["hotMaxRiseC"].as_f64().unwrap_or(10.0); // issue #136: the board's filled zones count too, so a human's zones are seen before the pours step let pours = copper_regions(spec, b);+ let zone_claims = claims(spec, b); let poured_both = |net: &str| -> bool { let mut f = false; let mut bk = false; for p in pours.iter().filter(|p| p["net"].as_str() == Some(net)) {@@ -192,11 +255,14 @@ pub fn plan_with_acknowledgements(spec: &Value, b: &Board, sw_nets: &[String], a cands.sort_by(|a, b| a.0.partial_cmp(&b.0).unwrap()); let rr = size / 2.0; let mut under_silk = 0;+ let mut taken: Vec<String> = Vec::new(); for (_, c) in cands { if part.planned.len() >= need { break; } // Use the same neighbourhood as the post-landing count. A remote // same-net pour, or a farther ring, cannot satisfy this heat pad. if !near(c.0, c.1) || !local_pours(&pours, &net, c, rr, &b.outline) { continue; }+ // issue #272: a higher-priority zone of another net (a switch node) owns the copper there+ if let Some(z) = claimed_by_other(&zone_claims, &net, c, rr + clearance) { if !taken.contains(&z.label) { taken.push(z.label.clone()); } continue; } // every edge of the outline, the closing one too (a rounded corner is many short ones) let on = b.outline.len(); if on > 0 && (!point_in(&b.outline, c) || (0..on).any(|k| seg_dist(c, b.outline[k], b.outline[(k + 1) % on]) < rr + edge)) { continue; }@@ -217,7 +283,8 @@ pub fn plan_with_acknowledgements(spec: &Value, b: &Board, sw_nets: &[String], a } if part.existing + part.planned.len() < tgt { let silk_note = if under_silk > 0 { format!("; {under_silk} spot(s) left out under silkscreen text or graphics (silkClearance {silk_gap} mm): move the label to free them") } else { String::new() };- part.note = Some(format!("room for {} of {} vias within 3 mm of {reference} and inside {net} copper on both layers (spec.pours or the board's filled zones): review local copper and cooling; native refill/connectivity still required{silk_note}", part.existing + part.planned.len(), tgt));+ let zone_note = if taken.is_empty() { String::new() } else { format!("; spots inside higher-priority zones of other nets left out: {}", taken.join(", ")) };+ part.note = Some(format!("room for {} of {} vias within 3 mm of {reference} and inside {net} copper on both layers (spec.pours or the board's filled zones): review local copper and cooling; native refill/connectivity still required{silk_note}{zone_note}", part.existing + part.planned.len(), tgt)); } parts.push(part); }@@ -597,6 +664,33 @@ mod tests { assert!(one[0].planned.is_empty()); } #[test]+ fn heatsink_vias_stay_out_of_higher_priority_zones_of_other_nets() {+ // issue #272 (monrad): a GND outline pour at priority 0 on both layers, and a switch-node zone at+ // priority 1 on F.Cu beside the hot part. KiCad fills the switch node first, so a GND via there+ // would carve it into islands: the plan must leave that area out.+ let arc = "(xy 11 6) (xy 16 6) (arc (start 16 6) (mid 17 10) (end 16 14)) (xy 11 14)";+ let board_with = |prio: u32, pts: &str| aiflow_board::Board::from_text("fixture", format!(r#"(kicad_pcb (net 0 "") (net 1 "GND") (net 2 "SW") (layers (0 "F.Cu" signal)(31 "B.Cu" signal)) (gr_rect (start 0 0)(end 30 30)(layer "Edge.Cuts"))+ (footprint "x" (layer "F.Cu") (at 10 10) (property "Reference" "U1") (pad "1" smd rect (at 0 0) (size 1 1) (layers "F.Cu") (net 1 "GND")))+ (zone (net 2) (net_name "SW") (layer "F.Cu") (name "SW node") (priority {prio}) (polygon (pts {pts})))+)"#)).unwrap();+ let board = |prio: u32| board_with(prio, arc);+ let spec = serde_json::json!({"hot": {"U1": {"watts": 2.0, "tabNet": "GND"}},+ "pours": [{"net": "GND", "layers": ["F.Cu", "B.Cu"], "name": "GND outline", "priority": 0}]});+ let (parts, _) = super::plan(&spec, &board(1), &[]);+ let p = &parts[0];+ assert!(!p.planned.is_empty(), "{:?}", p.note);+ // inside the zone, or within the via's radius plus clearance of its edge (x 11 minus about 0.5)+ assert!(p.planned.iter().all(|&(x, _)| x < 10.6), "{:?}", p.planned);+ // short of its target, the part names the zone that took the spots+ let mut hot = spec.clone();+ hot["hot"]["U1"]["watts"] = serde_json::json!(20.0);+ let (short, _) = super::plan(&hot, &board_with(1, "(xy 8.2 0) (xy 30 0) (xy 30 30) (xy 8.2 30)"), &[]);+ assert!(short[0].note.as_deref().unwrap_or("").contains("zone \"SW node\" (SW, priority 1)"), "{:?}", short[0].note);+ // the same zone at the GND pour's own priority claims nothing over it (KiCad gives neither precedence)+ let (even, _) = super::plan(&spec, &board(0), &[]);+ assert!(even[0].planned.iter().any(|&(x, _)| x > 10.6), "{:?}", even[0].planned);+ }+ #[test] fn targets_scale_with_power() { assert_eq!(super::target(0.25, 10.0), 6); assert_eq!(super::target(0.05, 10.0), 6);
docs/release-0.2.128.mdadded+27@@ -0,0 +1,27 @@+# adom-aiflow 0.2.128++Three fixes from one large-board run (monrad): two issues and a pull request.++## Heatsink vias stay out of other nets' higher-priority zones (#272)++`thermal-vias plan` checked a planned via only against its own net's copper, so on a board with a GND outline pour at priority 0 and a switch-node zone at priority 1, it put GND vias inside the switch node. KiCad's refill then carved the switch-node zone around each via, splitting it into islands or taking its copper.++- A spot is now left out when a zone of another net with a higher priority than the via's own net's zone covers it, on any layer where the via's net has copper there, or reaches within the via's clearance of it.+- Both spec.pours and the board's own zones count, by their drawn outline (arcs included), so a zone claims its area before any refill.+- Zones of equal priority are left alone: KiCad gives neither precedence.+- A part that falls short of its via target names the zones that took its spots.++## The Fields solve's cell size: spec `fieldsPitch` (#273)++adom-fields solves at a 0.2 mm cell by default; on a 190 x 240 mm board that needs more memory than an 11 GB container has, and the solve AI Flow started itself was killed after half an hour.++- New spec key `fieldsPitch` (mm, 0.02 to 2): passed as `--pitch` to every Fields solve AI Flow starts (`analyze current|thermal` when it solves again, `fields fix`). A value that is not a cell size is refused before any solve starts.+- `fields fix` reuses the cell of the solve it fixes when the spec names none, so before and after compare.+- `step current` and `step thermal` say how a solve counts (run it through `adom-aiflow exec`, or let `analyze` start it) and, on a large board, the cell to set (about 300 000 cells a layer: 0.40 mm for 190 x 240 mm).+- When `analyze` starts its own solve on a large board with no cell set, it warns before the solve runs, with the value to set.++## Large boards reach macOS and Linux desktops (PR #179, monrad)++`tools/kicad-cli-remote` sent a 20 MB poured board in one transfer, which the relay drops above about 8 MB, so every desktop kicad-cli check failed with "no report came back". On macOS and Linux desktops, files over 3 MB now travel gzip-compressed and are unpacked in the job folder, at most 4 MB per transfer. Windows desktops are unchanged.++Tested: the planner and cell-size rules by unit tests (a switch-node zone with an arc edge; monrad's board size); the PR's transfer locally with stand-ins for the bridge (a 12 MB board compressed, sent and unpacked byte for byte), and a DRC through the patched script on a Windows desktop (KiCad 10.0.8), unchanged.
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.127",+ "version": "0.2.128", "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.127",+ "version": "0.2.128", "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+2@@ -360,6 +360,8 @@ A KiCad run that starts with no board (`intake` with no `start --board`) follows After the pours and the analyses: `adom-fields analyze --board <the current board> --spec <spec> --out fields` (about two minutes; `adom-wiki pkg install adom/adom-fields` if it is missing), `adom-fields serve --fields fields --port 8874 &`, then `step fields` and `tour fields`: the binary opens the app in a pup window on the test box, films that window while `adom-fields tour` walks the board gently (the app paces itself: slow eased moves about nine seconds long, the board drifting a few degrees through every held beat, one copper pour isolated at a time, a quick turn-over to the bottom layer, because the flow plays this clip back at ten times speed, where a snap reads as frenetic) (each net lit, the hot parts, the issues flown to; the app's toasts are the captions), and records the issues in the run. When the Fields URL is a localhost proxy (an Adom Hydrogen desktop container's `VSCODE_PROXY_URI` is `http://{{port}}.localhost:<port>/`, reachable only on the machine hosting the container), the window opens on the user's primary machine (`adom-bridge targets` names it) instead of the test box, and the answer says so; `--on <box>` overrides. The issues (a current neck, a tab over its rise budget, a chip missing its thermal vias) are yours to answer before delivery; the app's screenshots are drawings you can register with `artifact`. +**Run the solve through aiflow, and size its cell to the board (issue #273).** A Fields solve counts only when this run started or watched it: run it as `adom-aiflow exec -- adom-fields analyze ...`, or let `analyze current|thermal` start it (a fields.json made any other way is solved again there). adom-fields solves at a 0.2 mm cell by default, a minute on a 65 x 75 mm board but more memory than a container has on a 190 x 240 mm one. Put the cell in the spec, `"fieldsPitch": 0.4` (mm), and aiflow passes it to every solve it starts (`analyze`, `fields fix`; `fields fix` otherwise reuses the cell of the solve it fixes). `step current` and `step thermal` name a large board and the cell to set before the long solve starts; pass the same `--pitch` when you run the solve yourself.+ adom-fields 0.10 and later write a lean `fields.json` and put each net's plated connections, the flow nets, parts and vias in `detail.json` beside it. aiflow reads both, merged the way adom-fields does, everywhere it reads a Fields report (`analyze`, `finish`, the converter check, the current acknowledgements, the board sink); keep the two files together. A lean report whose `detail.json` is missing is an ERROR naming the file, and the watched-solve record binds the hash of `detail.json` as well as `fields.json`. Older inline reports read as before. `analyze current` and `analyze thermal` read more of the same-input solve and print it under `fields:`: where each hot part's heat goes (its copper, its vias, through the board, the air), capacitors within 20 C of their rating (and how many ratings were assumed), spec net names Fields read in the board's form (`GND` as `/GND`), the board's outline and area, and a module Fields suggests that AI Flow did not pick. They also print `fields suggestion:` lines, spec keys for Fields with the value and why, recorded in the outcome (`fieldsSuggestions`) and never written for you: `hStillWM2k` for a board in a sealed enclosure (about 5 to 8 W/m2K, Fields' default 10; `hMovingWM2k` for a known airflow, default 25), `fanLevels: [0, 0.25, 0.5, 0.75, 1]` for a board with a fan (Fields solves each speed; `fanExponent` 0.5), `decouplingSkip` for a U-numbered part that is not a chip (a resistor network, LED, connector), and `electroThermal: true` when the solve reports copper heating over 10 %. Write the ones that apply into the spec and solve again. Fields also lists the inputs it assumed for want of a datasheet value (a hot part's RthJC and TJ max, a rail's load step, the ambient), printed by `analyze` most important first with each part's component page: `adom-aiflow fields inputs` writes the fragment to fill (`fields/inputs-to-fill.json`, each value a placeholder naming its datasheet field); read the datasheets, put the numbers in, keep only the keys you filled, then `adom-aiflow fields fill --patch <file> --why "<datasheet, revision, page for each>"` merges them into the spec (refused while a placeholder or empty value is left) and `analyze` solves again, so the assumption becomes the datasheet's number. A same-input solve also carries a fix plan (`fixPlan`): `adom-aiflow fields fix [--steps 2,3]` (KiCad runs) has `adom-fields verify --refill` carry out its copper edits (add-vias, widen) on a copy of the run's board, with KiCad refilling the zones and running DRC on both boards (kicad-cli through service-kicad or the desktop: `KICAD_CLI_TARGET=<the test box>`) and Fields solving both, then prints per step what was applied or why not, the metrics that moved (better or worse), the issues cleared and new, and any DRC error the fix added; the layout steps (move, reroute, add-copper, add-part, review) are listed for you. `fields fix --adopt` takes the fixed board as the run's next board only when KiCad refilled and checked it, at least one step applied, no DRC error and no new issue came of it and nothing got worse; then put it over the desktop board, `capture reload`, `bind-remote-board`, and analyze, gate and measure again. Keys for boards that have them, written by you from the design: `transient: {durationS, steps, powerScale, fromSteady}` for pulsed loads (motor start, hot-plug), `emcFmaxHz` (the stitching-fence frequency), `victimBudgetsMv` (crosstalk budgets per net), `tdr` (TDR runs per net). The rf module is recommended for a board with an antenna footprint or a spec `rf` section.