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
0.1.41: flat MPN mark; local OpenCascade only with the user's OK
13 files changed
+54−25
Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -24,7 +24,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.1.40"+version = "0.1.41" dependencies = [ "serde", "serde_json",@@ -33,7 +33,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.1.40"+version = "0.1.41" dependencies = [ "serde", "serde_json",@@ -41,7 +41,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-board", "serde",@@ -50,7 +50,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-board", "aiflow-grid",@@ -60,7 +60,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-board", "serde",@@ -69,7 +69,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-board", "serde",@@ -78,7 +78,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-board", "aiflow-copper",@@ -88,7 +88,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.1.40"+version = "0.1.41" dependencies = [ "aiflow-board", "aiflow-grid",@@ -98,7 +98,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.1.40"+version = "0.1.41" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.1.40"+version = "0.1.41" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
SKILL.md+1−1@@ -142,7 +142,7 @@ Before placement, declare `step components` and run `components` with your `--ru Use manufacturer drawings and permitted CAD as reference checks. Third-party downloads may be private reference-only; never redistribute them without permission, or call extracted/recolored/etched geometry independently authored. Compare independently generated geometry with dimensional and visual evidence. Publish only reusable assets on global pages; board-only definitions stay in the project. -MPN marking is on by default for ICs: every IC's model carries its laser-etched MPN and `finish` checks it (`components --etch off` declines for a run). Mark with `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>`: it uses adom/adom-chip-laser but keeps the model's own colours (the service alone repaints the part black and grey) and lays the text along the part's longest top-face direction, standing Y-up vendor models upright first (`--up y`). Use `--mark dark` on light bodies. Component-page heroes add the footprint art per eda-component-hero (see aiflow-sourcing). Keep the plain model; cache a separate MPN-marked STEP, GLB and reviewed thumbnails when enabled, with input hash, generator version/parameters, text/mode and native-render evidence. Protect pin-1, polarity and functional features. Marking is an identification aid, not a claim of real factory markings. Do not regenerate a valid shared cache, and do not claim KiCad/Fusion/Altium parity until each named viewer was checked.+MPN marking is on by default for ICs: every IC's model carries its laser-etched MPN and `finish` checks it (`components --etch off` declines for a run). Mark with `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>`: it uses adom/adom-chip-laser but keeps the model's own colours (the service alone repaints the part black and grey), lays the text along the part's longest top-face direction, stands Y-up vendor models upright first (`--up y`), and writes a FLAT mark (each glyph's top face only, about a fifth of the triangles of the service's extruded glyphs). Until the service does these itself (adom/adom-chip-laser#2) the tool needs OpenCascade locally, about 1.3 GB: ask the user, then run it with `AIFLOW_ALLOW_LOCAL_OCC=1`; STEP geometry otherwise belongs on the shared services. Use `--mark dark` on light bodies. Component-page heroes add the footprint art per eda-component-hero (see aiflow-sourcing). Keep the plain model; cache a separate MPN-marked STEP, GLB and reviewed thumbnails when enabled, with input hash, generator version/parameters, text/mode and native-render evidence. Protect pin-1, polarity and functional features. Marking is an identification aid, not a claim of real factory markings. Do not regenerate a valid shared cache, and do not claim KiCad/Fusion/Altium parity until each named viewer was checked. ## Provenance is required for shared component assets
bin/adom-aiflow⋯ 1 unchanged line ⋯
docs/component-sourcing.md+1−1@@ -14,7 +14,7 @@ Before placement, declare `step components` and run `components` with your `--ru Use manufacturer drawings and permitted CAD as reference checks. Third-party downloads may be private reference-only; never redistribute them without permission, or call extracted/recolored/etched geometry independently authored. Compare independently generated geometry with dimensional and visual evidence. Publish only reusable assets on global pages; board-only definitions stay in the project. -MPN marking is on by default for ICs: every IC's model carries its laser-etched MPN and `finish` checks it (`components --etch off` declines for a run). Mark with `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>`: it uses adom/adom-chip-laser but keeps the model's own colours (the service alone repaints the part black and grey) and lays the text along the part's longest top-face direction, standing Y-up vendor models upright first (`--up y`). Use `--mark dark` on light bodies. Component-page heroes add the footprint art per eda-component-hero (see aiflow-sourcing). Keep the plain model; cache a separate MPN-marked STEP, GLB and reviewed thumbnails when enabled, with input hash, generator version/parameters, text/mode and native-render evidence. Protect pin-1, polarity and functional features. Marking is an identification aid, not a claim of real factory markings. Do not regenerate a valid shared cache, and do not claim KiCad/Fusion/Altium parity until each named viewer was checked.+MPN marking is on by default for ICs: every IC's model carries its laser-etched MPN and `finish` checks it (`components --etch off` declines for a run). Mark with `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>`: it uses adom/adom-chip-laser but keeps the model's own colours (the service alone repaints the part black and grey), lays the text along the part's longest top-face direction, stands Y-up vendor models upright first (`--up y`), and writes a FLAT mark (each glyph's top face only, about a fifth of the triangles of the service's extruded glyphs). Until the service does these itself (adom/adom-chip-laser#2) the tool needs OpenCascade locally, about 1.3 GB: ask the user, then run it with `AIFLOW_ALLOW_LOCAL_OCC=1`; STEP geometry otherwise belongs on the shared services. Use `--mark dark` on light bodies. Component-page heroes add the footprint art per eda-component-hero (see aiflow-sourcing). Keep the plain model; cache a separate MPN-marked STEP, GLB and reviewed thumbnails when enabled, with input hash, generator version/parameters, text/mode and native-render evidence. Protect pin-1, polarity and functional features. Marking is an identification aid, not a claim of real factory markings. Do not regenerate a valid shared cache, and do not claim KiCad/Fusion/Altium parity until each named viewer was checked. ## Provenance is required for shared component assets
docs/release-0.1.41.mdadded+4@@ -0,0 +1,4 @@+# AI Flow 0.1.41++- **The MPN mark is flat.** The laser-etch service returns an extruded solid for every glyph (side walls and underside); on a SOT-23-6 that added 1,760 triangles to a 920-triangle part. `adom-aiflow-etch` now keeps only each glyph's top face as a zero-thickness sheet, lifted 0.01 mm: the same look in KiCad 10 and step2glb renders for 359 triangles. `ETCH_SOLID=1` keeps the solids.+- **No silent OpenCascade install.** Turning the part and merging the mark need OpenCascade locally (about 1.3 GB) until the service keeps colours, turns the part and writes flat marks itself (adom/adom-chip-laser#2). Adom's rule is that STEP geometry work happens on the shared services, so the tool now refuses unless the user has agreed (`AIFLOW_ALLOW_LOCAL_OCC=1`), and says so.
flows/board.json+1−1@@ -28,7 +28,7 @@ "Use portable project/library model paths, preserve placement and routing, rerun kicad_model_check and inspect the saved board in native KiCad 3D. Report reference coverage, reused/created page URLs, unresolved identities and missing CAD separately. A successful download or wiki publication alone does not close a missing-model finding.", "Judge quality per component, not per board screenshot: publish a linked visual register with top, bottom and oblique views. Check dimensions, units, terminal count and pitch, pin-1/polarity, body/pad alignment, standoff, materials and visible details. File resolution alone is not quality. Record pass, needs-work, reference-only or unknown with evidence and limits.", "Prefer manufacturer CAD when the source permits the intended redistribution. Keep third-party/Ultra Librarian downloads as private reference-only inputs unless redistribution is explicitly permitted. Compare independently generated models against manufacturer drawings and permitted reference views; retain dimensional deviations and source hashes. Converting, extracting, recoloring, or etching a restricted model does not make it independently authored or license-cleared.",- "MPN marking is ON by default for ICs (John, 2026-09-30): every IC's 3D model carries its MPN laser-etched on the top face, and finish checks it; passives are optional. Run `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>` (adom/adom-chip-laser service plus a colour-preserving merge). Do not post a STEP to the service and use its output directly: the service repaints the whole part black and grey (adom/adom-chip-laser#2). Keep the plain model beside the marked one; `components --etch off` declines for a run. Marking is an identification aid, not the part's factory top mark.",+ "MPN marking is ON by default for ICs (John, 2026-09-30): every IC's 3D model carries its MPN laser-etched on the top face, and finish checks it; passives are optional. Run `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>` (adom/adom-chip-laser service plus a colour-preserving merge; the mark is flat, top faces only). It needs OpenCascade locally (about 1.3 GB) until the service keeps colours, turns the part and writes flat marks itself: ask the user before `AIFLOW_ALLOW_LOCAL_OCC=1`. Do not post a STEP to the service and use its output directly: the service repaints the whole part black and grey (adom/adom-chip-laser#2). Keep the plain model beside the marked one; `components --etch off` declines for a run. Marking is an identification aid, not the part's factory top mark.", "Cache reviewed artifacts on the existing global component page: source/plain STEP, optional MPN STEP, GLB, thumbnails and machine-readable provenance. Record input hash, generator/tool version, parameters, units, transforms, marking text/mode, reference evidence and review results. Cache keys must change when geometry, text or generator parameters change. Keep board-only transforms and mappings in the board project. Never claim cross-EDA parity without rendering the variant in the named native viewers.", "When publishing or improving a component page, make per-file provenance mandatory even though creating a new page is optional. Record original source URL/file and revision, retrieval date, source and output SHA-256, authoring classification (manufacturer-supplied, source-derived, AI-created, or unknown), generator/version and parameters, units/transforms, redistribution evidence and limitations. For AI-created geometry cite the actual datasheet page/figure/table and dimensions used, list simplifications and reference comparisons, and never present copied/extracted CAD as independent work. State which checks ran and which remain unverified; retain plain and marked variant lineage. Put a readable provenance section on the page plus a machine-readable asset record and a link to that component's issue tracker. Unknown provenance stays unknown, not a fabricated source. Reuse/improve existing pages first; offer new global-page publication only for reusable components, keeping board-specific records in the project.", "Fit the mark along the LONGEST usable top-face direction at the largest legible size (a SOT-23-6 gets 0.22 mm along its long axis against 0.14 mm across it); the service only writes across X, so turn the part first (adom-aiflow-etch does). Stand Y-up vendor models upright first (`--up y`), or the mark lands on a side face. Use a light mark on dark epoxy and a dark mark on light bodies (`--mark dark`). Look at the result: colours intact, text inside the top face, clear of pin-1 and polarity features; a mark across a polarity stripe or off the face is worse than none, so leave that part unmarked and say why.",
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.1.40",+ "version": "0.1.41", "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 today; Altium, Fusion and 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.1.40",+ "version": "0.1.41", "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 today; Altium, Fusion and 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@@ -142,7 +142,7 @@ Before placement, declare `step components` and run `components` with your `--ru Use manufacturer drawings and permitted CAD as reference checks. Third-party downloads may be private reference-only; never redistribute them without permission, or call extracted/recolored/etched geometry independently authored. Compare independently generated geometry with dimensional and visual evidence. Publish only reusable assets on global pages; board-only definitions stay in the project. -MPN marking is on by default for ICs: every IC's model carries its laser-etched MPN and `finish` checks it (`components --etch off` declines for a run). Mark with `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>`: it uses adom/adom-chip-laser but keeps the model's own colours (the service alone repaints the part black and grey) and lays the text along the part's longest top-face direction, standing Y-up vendor models upright first (`--up y`). Use `--mark dark` on light bodies. Component-page heroes add the footprint art per eda-component-hero (see aiflow-sourcing). Keep the plain model; cache a separate MPN-marked STEP, GLB and reviewed thumbnails when enabled, with input hash, generator version/parameters, text/mode and native-render evidence. Protect pin-1, polarity and functional features. Marking is an identification aid, not a claim of real factory markings. Do not regenerate a valid shared cache, and do not claim KiCad/Fusion/Altium parity until each named viewer was checked.+MPN marking is on by default for ICs: every IC's model carries its laser-etched MPN and `finish` checks it (`components --etch off` declines for a run). Mark with `adom-aiflow-etch --in <model.step> --mpn <MPN> --out <model.step>`: it uses adom/adom-chip-laser but keeps the model's own colours (the service alone repaints the part black and grey), lays the text along the part's longest top-face direction, stands Y-up vendor models upright first (`--up y`), and writes a FLAT mark (each glyph's top face only, about a fifth of the triangles of the service's extruded glyphs). Until the service does these itself (adom/adom-chip-laser#2) the tool needs OpenCascade locally, about 1.3 GB: ask the user, then run it with `AIFLOW_ALLOW_LOCAL_OCC=1`; STEP geometry otherwise belongs on the shared services. Use `--mark dark` on light bodies. Component-page heroes add the footprint art per eda-component-hero (see aiflow-sourcing). Keep the plain model; cache a separate MPN-marked STEP, GLB and reviewed thumbnails when enabled, with input hash, generator version/parameters, text/mode and native-render evidence. Protect pin-1, polarity and functional features. Marking is an identification aid, not a claim of real factory markings. Do not regenerate a valid shared cache, and do not claim KiCad/Fusion/Altium parity until each named viewer was checked. ## Provenance is required for shared component assets
tools/laser-etch/adom-aiflow-etch+12−3@@ -1,11 +1,20 @@ #!/usr/bin/env bash-# adom-aiflow-etch: colour-preserving, long-axis MPN laser etch of a part STEP (see etch_part.py).-# OCP (OpenCascade's Python bindings) lives in its own venv, made on first use.+# adom-aiflow-etch: colour-preserving, long-axis, FLAT MPN laser etch of a part STEP (see etch_part.py).+# The etch itself runs on the adom-chip-laser service; turning the part and merging the mark need+# OpenCascade (OCP). Adom's rule: STEP geometry work happens on the shared services, and OpenCascade+# is installed locally only when the service cannot do the job. The service does not yet keep colours,+# turn the part or write a flat mark (adom/adom-chip-laser#2), so this local path is opt-in:+# AIFLOW_ALLOW_LOCAL_OCC=1 adom-aiflow-etch ... (makes a ~1.3 GB venv once, removable) set -euo pipefail HERE="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)" VENV="${AIFLOW_OCC_VENV:-$HOME/.local/share/adom-aiflow/occ}" if [ ! -x "$VENV/bin/python" ] || ! "$VENV/bin/python" -c "import OCP" 2>/dev/null; then- echo "adom-aiflow-etch: setting up OCP in $VENV (once)" >&2+ if [ "${AIFLOW_ALLOW_LOCAL_OCC:-}" != "1" ]; then+ echo "ERROR: adom-aiflow-etch needs OpenCascade (OCP) locally, about 1.3 GB, because the adom-chip-laser service does not yet keep a model's colours, turn it to its long axis or write a flat mark (adom/adom-chip-laser#2)." >&2+ echo "Hint: ask the user first. With their OK: AIFLOW_ALLOW_LOCAL_OCC=1 adom-aiflow-etch ... (venv at $VENV; delete it when done). Or leave the part unmarked with components --etch off." >&2+ exit 2+ fi+ echo "adom-aiflow-etch: setting up OCP in $VENV (about 1.3 GB, once; delete the folder to remove it)" >&2 python3 -m venv "$VENV" && "$VENV/bin/pip" -q install cadquery-ocp >&2 fi exec "$VENV/bin/python" "$HERE/etch_part.py" "$@"
tools/laser-etch/etch_part.py+3−1@@ -1,5 +1,7 @@ #!/usr/bin/env python3-"""Laser-etch a part's MPN onto the top face of its STEP, keeping the model's own colours.+"""Laser-etch a part's MPN onto the top face of its STEP, keeping the model's own colours. The mark is+FLAT by default (each glyph's top face only, a zero-thickness sheet: about a fifth of the triangles of+the service's extruded glyphs; ETCH_SOLID=1 keeps the solids). The adom-chip-laser service etches across X on a Z-up part and repaints the whole model black and grey. This stands the part up (--up y for Y-up vendor models), turns it so its LONGEST top-face
tools/laser-etch/merge_etch.py+18−4@@ -4,14 +4,16 @@ drops the model's own colours. Keep the ORIGINAL coloured model untouched and ad inlay solids (the thin solids at the top of the etched part) as one light-grey 'laser_etch' part, lifted a hair so it never z-fights with the top face. Usage: merge_etch.py <original.step> <etched.step> <out.step> [lift_mm=0.01] [r,g,b of the mark, default light grey]"""-import sys+import os, sys from OCP.STEPControl import STEPControl_Reader, STEPControl_AsIs from OCP.STEPCAFControl import STEPCAFControl_Reader, STEPCAFControl_Writer from OCP.TDocStd import TDocStd_Document from OCP.TCollection import TCollection_ExtendedString from OCP.XCAFDoc import XCAFDoc_DocumentTool, XCAFDoc_ColorType from OCP.TopExp import TopExp_Explorer-from OCP.TopAbs import TopAbs_SOLID+from OCP.TopAbs import TopAbs_SOLID, TopAbs_FACE+from OCP.BRepAdaptor import BRepAdaptor_Surface+from OCP.GeomAbs import GeomAbs_Plane from OCP.TopoDS import TopoDS, TopoDS_Compound from OCP.BRep import BRep_Builder from OCP.Bnd import Bnd_Box@@ -31,8 +33,20 @@ while ex.More(): s = TopoDS.Solid(ex.Current()); ex.Next() x0, y0, z0, x1, y1, z1 = box(s) if z1 - z0 < 0.2 and top - z1 < 0.05: inlay.append(s) # thin, at the very top: the etch+# FLAT by default: keep only each glyph's top face (a zero-thickness sheet), not the extruded solid+# with its side walls and underside: the same mark for about a third of the triangles+flat = os.environ.get("ETCH_SOLID", "") != "1" comp = TopoDS_Compound(); bb = BRep_Builder(); bb.MakeCompound(comp)-for s in inlay: bb.Add(comp, s)+nfaces = 0+for s in inlay:+ if not flat: bb.Add(comp, s); continue+ fx = TopExp_Explorer(s, TopAbs_FACE); z1s = box(s)[5]+ while fx.More():+ f = TopoDS.Face(fx.Current()); fx.Next()+ ad = BRepAdaptor_Surface(f)+ if ad.GetType() != GeomAbs_Plane: continue+ n = ad.Plane().Axis().Direction()+ if abs(n.Z()) > 0.99 and abs(box(f)[5] - z1s) < 1e-4: bb.Add(comp, f); nfaces += 1 t = gp_Trsf(); t.SetTranslation(gp_Vec(0, 0, lift)); comp2 = comp.Moved(TopLoc_Location(t)) doc = TDocStd_Document(TCollection_ExtendedString("d")) cr = STEPCAFControl_Reader(); cr.SetColorMode(True); cr.SetNameMode(True); cr.SetLayerMode(True); cr.ReadFile(orig); cr.Transfer(doc)@@ -42,4 +56,4 @@ TDataStd_Name.Set_s(lab, TCollection_ExtendedString("laser_etch")) ct.SetColor(lab, Quantity_Color(rgb[0], rgb[1], rgb[2], Quantity_TOC_RGB), XCAFDoc_ColorType.XCAFDoc_ColorSurf) w = STEPCAFControl_Writer(); w.SetColorMode(True); w.SetNameMode(True); w.SetLayerMode(True) w.Transfer(doc, STEPControl_AsIs); w.Write(out)-print(f"inlay solids {len(inlay)}; etched top z {top:.3f}")+print(f"inlay solids {len(inlay)}; {'flat top faces ' + str(nfaces) if flat else 'solid glyphs'}; etched top z {top:.3f}")