← Commit history
Merge PR #571: AI Flow 0.2.95: hands-off runs never launch KiCad behind the bridge (#223) (aiflow-0.2.95 -> main) merge
Showing changes introduced by the merge (against its first parent).
9 files changed
+33−16
Cargo.lock+10−10@@ -4,7 +4,7 @@ version = 4 [[package]] name = "adom-aiflow"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-analyze", "aiflow-board",@@ -25,7 +25,7 @@ dependencies = [ [[package]] name = "aiflow-analyze"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "serde",@@ -35,7 +35,7 @@ dependencies = [ [[package]] name = "aiflow-board"-version = "0.2.94"+version = "0.2.95" dependencies = [ "roxmltree", "serde",@@ -44,7 +44,7 @@ dependencies = [ [[package]] name = "aiflow-bridge"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "serde",@@ -53,7 +53,7 @@ dependencies = [ [[package]] name = "aiflow-copper"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "aiflow-grid",@@ -63,7 +63,7 @@ dependencies = [ [[package]] name = "aiflow-grid"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "serde",@@ -72,7 +72,7 @@ dependencies = [ [[package]] name = "aiflow-place"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "serde",@@ -81,7 +81,7 @@ dependencies = [ [[package]] name = "aiflow-pours"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "aiflow-copper",@@ -91,7 +91,7 @@ dependencies = [ [[package]] name = "aiflow-router"-version = "0.2.94"+version = "0.2.95" dependencies = [ "aiflow-board", "aiflow-grid",@@ -101,7 +101,7 @@ dependencies = [ [[package]] name = "aiflow-run"-version = "0.2.94"+version = "0.2.95" dependencies = [ "serde", "serde_json",
Cargo.toml+1−1@@ -14,7 +14,7 @@ members = [ ] [workspace.package]-version = "0.2.94"+version = "0.2.95" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
SKILL.md+1−1@@ -310,7 +310,7 @@ The first `step` (or `capture start`) asks the test box once which recorder its `capture open` puts the board on screen the same way for every engine (foreground OpenGL on a test box we own, maximised, zoom to fit). `capture start` records the PCB editor window itself through Adom Bridge's window recorder (Windows Graphics Capture, background-capturable: whatever another thread or an updater puts in front of KiCad on a shared box does not reach the take, and nobody at the box is disturbed; the monitor is recorded only when no editor is open), every stage command writes a marker with its timestamp into the manifest, `capture mark <label>` adds yours, `capture stop` pulls the MP4 into the run. The split-screen comparison (gang-takes split mode) aligns the two engines on those markers. -**Screen: hands-off on the human's own machine (issues #132, #135).** `screen: hands-off | ask | allowed` says whether AI Flow may bring windows to the front on the run's desktop. When the target is the machine the human is using (a Hydrogen local workspace's own PC, or the primary machine `adom-bridge targets` names) it is `hands-off` by default; a test box is `allowed`. The run records it in run.json (`screenMode`, with where it came from) and prints it once. In hands-off (and `ask`), `step` raises nothing, `capture open` opens the board without focus or maximise, and if Windows still puts a newly launched KiCad in front it sends it to the bottom and gives the human their window back (the answer says what it did); `tour 3d` does not run, because the viewer only paints in front: suggest the human runs it, or takes the screen off hands-off for it. Clips keep recording by window capture, which needs no foreground; only a minimised window films nothing. The human changes it any time: `capture screen allowed` ("you can take my screen now"), `capture screen hands-off`, `capture screen` to read it; a declared test box can say `"capture": {"screen": "allowed"}` in the spec; `AIFLOW_SCREEN=allowed|ask|hands-off` wins over both.+**Screen: hands-off on the human's own machine (issues #132, #135).** `screen: hands-off | ask | allowed` says whether AI Flow may bring windows to the front on the run's desktop. When the target is the machine the human is using (a Hydrogen local workspace's own PC, or the primary machine `adom-bridge targets` names) it is `hands-off` by default; a test box is `allowed`. The run records it in run.json (`screenMode`, with where it came from) and prints it once. In hands-off (and `ask`), `step` raises nothing, `capture open` opens the board without focus or maximise, and if Windows still puts a newly launched KiCad in front it sends it to the bottom and gives the human their window back (the answer says what it did); `tour 3d` does not run, because the viewer only paints in front: suggest the human runs it, or takes the screen off hands-off for it. Clips keep recording by window capture, which needs no foreground; only a minimised window films nothing. On a hands-off machine never launch KiCad (or any window) yourself with `Start-Process`, `run_script` or a shell: only the KiCad bridge launches without taking focus. Once the board is open, edit it live (`kicad_silk_text_batch`, `kicad_silk_fields_batch`, `kicad_apply_zone_plan`, `land ...`) instead of editing the file offline and relaunching the editor; save before closing so no prompt appears, and never click a prompt on the human's screen (issue #223, docs/isolated-kicad-read-socket.md). The human changes it any time: `capture screen allowed` ("you can take my screen now"), `capture screen hands-off`, `capture screen` to read it; a declared test box can say `"capture": {"screen": "allowed"}` in the spec; `AIFLOW_SCREEN=allowed|ask|hands-off` wins over both. ## The spec
bin/adom-aiflow⋯ 1 unchanged line ⋯
docs/isolated-kicad-read-socket.md+8−1@@ -8,10 +8,17 @@ Verify the returned board path, revision, `source: live-editor`, native validati A task-owned instance can be launched with a process-local TEMP/TMP directory to give its API pipe a separate name. This workaround requires native verification on the selected desktop; it is not a promise for every KiCad build. Do not change global environment/configuration or replace a shared runtime. +**Never launch KiCad yourself on the human's machine (issue #223).** A `pcbnew.exe` started with PowerShell `Start-Process` (even `-WindowStyle Minimized`, which activates the window), `run_script` or any shell takes the human's foreground, and KiCad raises its frame again when the board finishes loading. Only the KiCad bridge launches without activation and keeps its focus guardian on the windows it owns. Until the bridge can open a board in a private-TEMP editor itself (requested on the KiCad bridge page), on a `screen: hands-off` run do not start a second editor: work in the editor the bridge opened, use `kicad-cli` file checks for what needs no live editor, and ask the human, without waiting, to close the other session's KiCad or to allow the screen (`capture screen allowed`). A test box (`screen: allowed`) may use a task-owned editor as below.+ ## Live edits on a task-owned editor: ADOM_AIFLOW_KICAD_SOCKET (issue #159) -When another session's KiCad owns the default pipe (`capture open` answers `board_mismatch` with `openBoards` naming a board that is not yours), never close that editor. Launch your own `pcbnew.exe` with a private `TEMP`/`TMP`, open your board in it, and set `ADOM_AIFLOW_KICAD_SOCKET=ipc://<that instance's kicad\api.sock>`. AI Flow then adds that `socketPath` to every live IPC verb it calls, reads and edits alike: `kicad_routing_state`, `kicad_routing_validate`, `kicad_placement_state`, `kicad_placement_validate`, `kicad_zone_state`, `kicad_move_footprint`, `kicad_route_net`, `kicad_remove_route`, `kicad_apply_tracks`, `kicad_apply_zone_plan`, `kicad_add_zone`, `kicad_select_net`, `kicad_select_clear` and `kicad_zoom_to`. Window, capture, screenshot and file verbs are never redirected. An explicit `socketPath` in a call wins, and `ADOM_AIFLOW_KICAD_READ_SOCKET` keeps its read-only meaning. KiCad Bridge 1.0.104 accepts `socketPath` on the edit verbs (verified with `kicad_routing_state` and a `kicad_move_footprint` dry run answering `source: live-editor` for the exact board); an older bridge may ignore it, so check that the first live read names your board.+When another session's KiCad owns the default pipe (`capture open` answers `board_mismatch` with `openBoards` naming a board that is not yours), never close that editor. On a test box (`screen: allowed`; never on a hands-off machine, see above), launch your own `pcbnew.exe` with a private `TEMP`/`TMP`, open your board in it, and set `ADOM_AIFLOW_KICAD_SOCKET=ipc://<that instance's kicad\api.sock>`. AI Flow then adds that `socketPath` to every live IPC verb it calls, reads and edits alike: `kicad_routing_state`, `kicad_routing_validate`, `kicad_placement_state`, `kicad_placement_validate`, `kicad_zone_state`, `kicad_move_footprint`, `kicad_route_net`, `kicad_remove_route`, `kicad_apply_tracks`, `kicad_apply_zone_plan`, `kicad_add_zone`, `kicad_select_net`, `kicad_select_clear` and `kicad_zoom_to`. Window, capture, screenshot and file verbs are never redirected. An explicit `socketPath` in a call wins, and `ADOM_AIFLOW_KICAD_READ_SOCKET` keeps its read-only meaning. KiCad Bridge 1.0.104 accepts `socketPath` on the edit verbs (verified with `kicad_routing_state` and a `kicad_move_footprint` dry run answering `source: live-editor` for the exact board); an older bridge may ignore it, so check that the first live read names your board. When preparing renamed PCB checkpoints, copy matching `.kicad_pro` and `.kicad_dru` sidecars to the output basename before opening it. Copying only the input basename can cause KiCad to create a default project for the output file, changing the DRC rules. Close only the saved task-owned editor before replacing its sidecars, then reopen and verify the actual rules. Never adjust acceptance thresholds to match an accidental default project. Zone endpoint selection was verified with KiCad Bridge 1.0.55, including native board identity and filled-area readback. Its catalog did not list the accepted socketPath parameter; verify your bridge behavior before relying on this opt-in. A board mismatch must remain an error, not a saved-file fallback.++## Edits after the board is open: live, not offline plus relaunch (issue #223)++Once the editor holds the board, make every change live through the bridge (`kicad_silk_text_batch`, `kicad_silk_fields_batch`, `kicad_apply_zone_plan`, `kicad_move_footprint`, the `land` commands), then save in the editor. Editing the `.kicad_pcb` offline and reloading means closing and relaunching the editor, and every relaunch is a window on the human's screen: one hands-off run made about seven in an hour. If a change has no live verb, batch the offline edits and reopen once, through `capture open`. Save before closing an editor, so KiCad never shows its "Save changes?" prompt, and never click a prompt on the human's screen.+
docs/release-0.2.95.mdadded+10@@ -0,0 +1,10 @@+# AI Flow 0.2.95++- **Hands-off runs: no KiCad launched behind the bridge's back** (#223, Noah). `docs/isolated-kicad-read-socket.md`+ told an AI to launch its own pcbnew with a private TEMP, with no word on how; on the human's own machine the AI used+ PowerShell `Start-Process`, which takes the foreground, and relaunched after every offline edit (about seven times+ in an hour). The doc and the skill's hands-off section now say: never launch KiCad yourself on a hands-off machine+ (only the KiCad bridge launches without focus); until the bridge can open a private-TEMP editor, do not start a second+ editor there; once the board is open, edit it live instead of editing the file and relaunching; save before closing+ so no prompt appears; never click a prompt on the human's screen. A bridge-launched isolated editor and an in-place+ reload are requested from the KiCad bridge; `capture open --isolated` follows once it has them.
package.json+1−1@@ -1,7 +1,7 @@ { "slug": "adom-aiflow", "type": "app",- "version": "0.2.94",+ "version": "0.2.95", "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.94",+ "version": "0.2.95", "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@@ -396,7 +396,7 @@ The first `step` (or `capture start`) asks the test box once which recorder its `capture open` puts the board on screen the same way for every engine (foreground OpenGL on a test box we own, maximised, zoom to fit). `capture start` records the PCB editor window itself through Adom Bridge's window recorder (Windows Graphics Capture, background-capturable: whatever another thread or an updater puts in front of KiCad on a shared box does not reach the take, and nobody at the box is disturbed; the monitor is recorded only when no editor is open), every stage command writes a marker with its timestamp into the manifest, `capture mark <label>` adds yours, `capture stop` pulls the MP4 into the run. The split-screen comparison (gang-takes split mode) aligns the two engines on those markers. -**Screen: hands-off on the human's own machine (issues #132, #135).** `screen: hands-off | ask | allowed` says whether AI Flow may bring windows to the front on the run's desktop. When the target is the machine the human is using (a Hydrogen local workspace's own PC, or the primary machine `adom-bridge targets` names) it is `hands-off` by default; a test box is `allowed`. The run records it in run.json (`screenMode`, with where it came from) and prints it once. In hands-off (and `ask`), `step` raises nothing, `capture open` opens the board without focus or maximise, and if Windows still puts a newly launched KiCad in front it sends it to the bottom and gives the human their window back (the answer says what it did); `tour 3d` does not run, because the viewer only paints in front: suggest the human runs it, or takes the screen off hands-off for it. Clips keep recording by window capture, which needs no foreground; only a minimised window films nothing. The human changes it any time: `capture screen allowed` ("you can take my screen now"), `capture screen hands-off`, `capture screen` to read it; a declared test box can say `"capture": {"screen": "allowed"}` in the spec; `AIFLOW_SCREEN=allowed|ask|hands-off` wins over both.+**Screen: hands-off on the human's own machine (issues #132, #135).** `screen: hands-off | ask | allowed` says whether AI Flow may bring windows to the front on the run's desktop. When the target is the machine the human is using (a Hydrogen local workspace's own PC, or the primary machine `adom-bridge targets` names) it is `hands-off` by default; a test box is `allowed`. The run records it in run.json (`screenMode`, with where it came from) and prints it once. In hands-off (and `ask`), `step` raises nothing, `capture open` opens the board without focus or maximise, and if Windows still puts a newly launched KiCad in front it sends it to the bottom and gives the human their window back (the answer says what it did); `tour 3d` does not run, because the viewer only paints in front: suggest the human runs it, or takes the screen off hands-off for it. Clips keep recording by window capture, which needs no foreground; only a minimised window films nothing. On a hands-off machine never launch KiCad (or any window) yourself with `Start-Process`, `run_script` or a shell: only the KiCad bridge launches without taking focus. Once the board is open, edit it live (`kicad_silk_text_batch`, `kicad_silk_fields_batch`, `kicad_apply_zone_plan`, `land ...`) instead of editing the file offline and relaunching the editor; save before closing so no prompt appears, and never click a prompt on the human's screen (issue #223, docs/isolated-kicad-read-socket.md). The human changes it any time: `capture screen allowed` ("you can take my screen now"), `capture screen hands-off`, `capture screen` to read it; a declared test box can say `"capture": {"screen": "allowed"}` in the spec; `AIFLOW_SCREEN=allowed|ask|hands-off` wins over both. ## The spec