← Commit history

Merge PR #574: AI Flow 0.2.96: the run's own KiCad editor (#223) (release-0.2.96 -> main) merge

Colby Knox ·0869ba2a7e · ·parents 55fe837, 18d61e5

Showing changes introduced by the merge (against its first parent).

12 files changed +302−25
Cargo.lock+10−10
@@ -4,7 +4,7 @@ version = 4  [[package]] name = "adom-aiflow"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-analyze",  "aiflow-board",@@ -25,7 +25,7 @@ dependencies = [  [[package]] name = "aiflow-analyze"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "serde",@@ -35,7 +35,7 @@ dependencies = [  [[package]] name = "aiflow-board"-version = "0.2.95"+version = "0.2.96" dependencies = [  "roxmltree",  "serde",@@ -44,7 +44,7 @@ dependencies = [  [[package]] name = "aiflow-bridge"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "serde",@@ -53,7 +53,7 @@ dependencies = [  [[package]] name = "aiflow-copper"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "aiflow-grid",@@ -63,7 +63,7 @@ dependencies = [  [[package]] name = "aiflow-grid"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "serde",@@ -72,7 +72,7 @@ dependencies = [  [[package]] name = "aiflow-place"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "serde",@@ -81,7 +81,7 @@ dependencies = [  [[package]] name = "aiflow-pours"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "aiflow-copper",@@ -91,7 +91,7 @@ dependencies = [  [[package]] name = "aiflow-router"-version = "0.2.95"+version = "0.2.96" dependencies = [  "aiflow-board",  "aiflow-grid",@@ -101,7 +101,7 @@ dependencies = [  [[package]] name = "aiflow-run"-version = "0.2.95"+version = "0.2.96" dependencies = [  "serde",  "serde_json",
Cargo.toml+1−1
@@ -14,7 +14,7 @@ members = [ ]  [workspace.package]-version = "0.2.95"+version = "0.2.96" edition = "2021" license = "MIT" repository = "https://wiki.adom.inc/adom/adom-aiflow"
SKILL.md+2−2
@@ -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. 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.+**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. When another session's KiCad holds the shared pipe (`board_mismatch`), `capture open --isolated` (KiCad Bridge 1.1.5+) has the bridge open the board in the run's own editor in the background, and every later live call of the run goes to it; a board another KiCad has open is refused (`board_locked`): work on a copy. Once the board is open, edit it live (`kicad_silk_text_batch`, `kicad_silk_fields_batch`, `kicad_apply_zone_plan`, `land ...`); for a change with no live verb, save, edit the file, then `capture reload` (KiCad's own Revert, no prompt, no relaunch). `capture close` saves and closes only the run's own editor. 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 @@ -510,7 +510,7 @@ Component library footage: keep the full `library-tour` separate. A reviewed fiv  ## Native editor readiness -`capture open` must confirm native IPC for the exact board, not only a visible window. KiCad may give its single IPC server to the first editor. On `board_mismatch`, read `capture-open-ipc.json` or `place-land-log.json`, save and gracefully close only your task-owned conflicting editors, and reopen the intended board first. Never close another user's work or restart a shared bridge. Permanent identity refusals are not retryable. Reject a static failed take and record the reason before re-taking it.+`capture open` must confirm native IPC for the exact board, not only a visible window. KiCad may give its single IPC server to the first editor. On `board_mismatch`, read `capture-open-ipc.json` or `place-land-log.json`, save and gracefully close only your task-owned conflicting editors, and reopen the intended board first. Never close another user's work or restart a shared bridge. When the pipe's owner is another session, `capture open --isolated` (KiCad Bridge 1.1.5+) has the bridge open your board in the run's own editor with a private pipe, and every live read and edit of the run then reaches it (docs/isolated-kicad-read-socket.md); never launch pcbnew yourself. Permanent identity refusals are not retryable. Reject a static failed take and record the reason before re-taking it.  Tours use the complete pinned canonical viewer release, served locally with the tour. On a viewer load error, rebuild with `tools/library-tour.py build --manifest <selection.json> --out <tour-dir>` and inspect the explicit error before recording. Native variants and tour selection must agree, including pin-one markers and the chosen LED/MPN state. 
bin/adom-aiflow
⋯ 1 unchanged line ⋯
crates/adom-aiflow/src/main.rs+77−4
@@ -383,8 +383,12 @@ enum Cmd {     #[arg(long)] on: Option<String> },     /// Print the append-only ledger (run.jsonl): every turn with its thinking and tool seconds, every step visit and return, every stage and outcome, in order.     Ledger { #[arg(long)] json: bool },-    /// open, start, mark <label>, stop, reject <step>-<visit>, screen [hands-off|ask|allowed] (may AI Flow bring windows to the front on the run's desktop; no mode prints the current one)+    /// open, start, mark <label>, stop, reject <step>-<visit>, reload, close, screen [hands-off|ask|allowed] (may AI Flow bring windows to the front on the run's desktop; no mode prints the current one)     Capture { action: String, label: Option<String>, #[arg(long)] reason: Option<String>,+    /// open only: the run's own KiCad editor, launched by the KiCad bridge (1.1.5+) in the background with a private API pipe; every later live call of this run goes to it+    #[arg(long)] isolated: bool,+    /// reload: revert even when the editor shows unsaved edits; close: close without saving+    #[arg(long)] discard: bool,     /// reject only: take the clip off the run page and out of the run (privacy: another project or a person was filmed), not kept as evidence     #[arg(long)] off_page: bool },     /// The comparison page: a sub-README for this run and another (`compose --with` first), the side-by-side video first, then the numbers from both ledgers, the AIs' drawings side by side and the links to both run pages; --push puts it on the page under docs/comparisons/<a>-vs-<b>/@@ -478,7 +482,7 @@ fn ok(msg: &str, hints: &[String]) { static INPUT_HINT: std::sync::OnceLock<String> = std::sync::OnceLock::new();  /// Issue #159: when another session's KiCad owns the default IPC pipe (board_mismatch, openBoards not ours).-const KICAD_SOCKET_HINT: &str = "When the editor holding the default IPC pipe belongs to another session, never close it: launch a task-owned pcbnew with a private TEMP/TMP (docs/isolated-kicad-read-socket.md), open this board in it, and set ADOM_AIFLOW_KICAD_SOCKET=ipc://<its api.sock> so every live read and edit (place land, land route, land pours, tour nets) reaches it.";+const KICAD_SOCKET_HINT: &str = "When the editor holding the default IPC pipe belongs to another session, never close it: `capture open --isolated` (KiCad Bridge 1.1.5+) has the bridge open this board in the run's own editor, in the background with a private API pipe, and every later live read and edit of this run (place land, land route, land pours, tour nets) goes to it. Never launch pcbnew yourself (docs/isolated-kicad-read-socket.md).";  /// Every refusal says how to change AI Flow itself when the check, not the board, is what is wrong. const CONTRIBUTE: &str = "If this check is wrong for your board (AI Flow has not seen a design like it), improve AI Flow rather than stopping or working around it: `adom-wiki repo clone adom/adom-aiflow`, fix it, `cargo build --release`, finish this board with your build (that tests the change), then `adom-aiflow giveback-check --body <pr.md> --files <changed files>` (nothing of the user's design leaves with it) and send it back with `adom-wiki pr create adom/adom-aiflow --title \"...\" --files <changed files> --body-file <pr.md: why, base hash, how you tested>`. Every Adom user gets the fix.";@@ -734,6 +738,14 @@ fn thread(cli: &Cli) -> String {     cli.ai_thread.clone().unwrap_or_else(|| err("this command changes state and needs --ai-thread <name> (the name of the AI conversation calling)", &["Re-run with --ai-thread \"<your thread name>\".".into()])) } +/// Issue #223: the isolated editor's pipe that run.json keeps (`kicadIsolated.socketPath`), unless+/// ADOM_AIFLOW_KICAD_SOCKET is set already (it wins).+fn run_kicad_socket(dir: &Path) -> Option<String> {+    if std::env::var("ADOM_AIFLOW_KICAD_SOCKET").is_ok_and(|v| !v.trim().is_empty()) { return None; }+    let v: Value = serde_json::from_str(&std::fs::read_to_string(dir.join("run.json")).ok()?).ok()?;+    v["kicadIsolated"]["socketPath"].as_str().filter(|s| !s.trim().is_empty()).map(str::to_string)+}+ fn run_dir(cli: &Cli) -> PathBuf {     cli.run.clone().unwrap_or_else(|| std::env::var("AIFLOW_RUN").map(PathBuf::from).unwrap_or_else(|_| PathBuf::from("./aiflow-run"))) }@@ -4008,6 +4020,8 @@ fn main() {         }     };     if let Some(h) = input_hint { let _ = INPUT_HINT.set(h); }+    // issue #223: the run's own editor (`capture open --isolated`) answers every live call of the run+    if let Some(sock) = run_kicad_socket(&run_dir(&cli)) { std::env::set_var("ADOM_AIFLOW_KICAD_SOCKET", sock); }     // issue #170: the media worker writes nothing to the run's ledger or run.json itself (no turn either)     if let Cmd::MediaWorker = &cli.cmd { media_worker_run(&run_dir(&cli)); return; }     // A host stop hook must not open windows, start captures or append timing events.@@ -6640,7 +6654,7 @@ fn main() {             r.save().unwrap();             ok(&(format!("finished: {} from the prompt to a board {}, {:.1} min\npours: {}\n{}{}", r.data["engine"], match (open_items.len(), deviated.len()) { (0, 0) => "passing the configured screens".to_string(), (0, d) => format!("passing the configured screens except {d} recorded deviation(s), listed below"), (o, d) => format!("with {o} open item(s) still worth a look{} (listed above; finish again after any change)", if d > 0 { format!(" and {d} recorded deviation(s)") } else { String::new() }) }, r.elapsed_minutes(), pourverify::mode_label(r.outcomes().get("land-pours").unwrap_or(&Value::Null)), step_table(&r), if lib_parts.is_empty() { String::new() } else { format!("\nparts from a project library (no public component page): {}", lib_parts.join("; ")) }) + &na_text(&r.data["summary"]["notApplicable"]) + &flow_gaps::text(&gaps) + &if reviewed.is_empty() { String::new() } else { format!("\nreviewed exceptions and assumptions:\n  {}", reviewed.join("\n  ")) } + &if deviated.is_empty() { String::new() } else { format!("\nfinished with {} recorded deviation(s) (checks this board did not meet, accepted on purpose):\n  {}", deviated.len(), deviated.iter().map(|d| format!("{}: {} (why: {})", d["item"].as_str().unwrap_or(""), d["line"].as_str().unwrap_or(""), d["why"].as_str().unwrap_or(""))).collect::<Vec<_>>().join("\n  ")) } + &if quality_lines.is_empty() { String::new() } else { format!("\n{}", quality_lines.join("\n")) } + "\n" + &verified::message(&checked)), &[flow_gaps::hint(&gaps).unwrap_or_default(), "Tell the human exactly the verified list above; never call the board ready to fabricate unless every item says yes, and even then advise a human review.".into(), "The run is not delivered yet: cut the video, then `adom-aiflow deliver --video <mp4> --message \"<what you tell the human>\"`; the clock stops there, not here.".into(), "Add your token and dollar accounting to run.json under tokens and usd; the manifest is the row on the chart.".into(), results_hint(&r), page_build_hint(&r), molecule_publish_hint(&r).unwrap_or_default(), give_back_hint()]);         }-        Cmd::Capture { action, label, reason, off_page } => {+        Cmd::Capture { action, label, reason, off_page, isolated, discard } => {             let mut r = load_run(&cli);             if action == "screen" {                 // the human's word, mid-run: "you can take my screen now" -> allowed, until they say otherwise@@ -6662,6 +6676,28 @@ fn main() {             let rb = r.data["remoteBoard"].as_str().unwrap_or("").to_string();             let engine = r.data["engine"].as_str().unwrap_or("").to_string();             match action.as_str() {+                "open" if *isolated => {+                    let raise = screen_mode(&mut r).may_raise();+                    let why = reason.clone().unwrap_or_else(|| format!("aiflow run {engine}: the run's own editor"));+                    let iso = br.open_isolated(&rb, &why, raise).unwrap_or_else(|f| { use aiflow_bridge::isolated::Refusal; match f {+                        Refusal::BoardLocked(m) => err(&format!("another KiCad has {rb} open, so the bridge refused a second editor: {m}"), &["Work on a copy: copy the board (with its .kicad_pro and .kicad_dru) to a new name, `adom-aiflow start` on the copy, then `capture open --isolated`. Never close the other editor.".into()]),+                        Refusal::Unsupported(m) => err(&format!("the KiCad bridge did not open an isolated editor: {m}"), &["Update the KiCad bridge to 1.1.5 or newer (`adom-bridge bridge_update '{\"name\":\"kicad\"}'`), or use `capture open` (the shared editor).".into()]),+                        Refusal::UnsavedChanges(m) | Refusal::Other(m) => err(&format!("could not open the board in an isolated editor: {m}"), &[]),+                    }});+                    std::env::set_var("ADOM_AIFLOW_KICAD_SOCKET", &iso.socket);+                    r.data["kicadIsolated"] = iso.record(&rb, &now());+                    r.data["captures"].as_array_mut().unwrap().push(json!({"opened": now(), "hwnd": iso.hwnd, "window": iso.title, "isolated": true}));+                    r.save().unwrap();+                    let (revision, reply) = br.revision_with_reply(&rb);+                    write_json(&dir.join("capture-open-ipc.json"), &reply);+                    if revision.is_none() {+                        err(&format!("the isolated editor opened (hwnd {}) but its pipe does not answer for {rb} yet: {} {}", iso.hwnd.map(|h| h.to_string()).unwrap_or("?".into()), reply["errorCode"], reply["error"]), &["Read capture-open-ipc.json; run `capture open --isolated` again in a minute (the same board answers the same editor).".into()]);+                    }+                    ok(&format!("board open in the run's own KiCad editor (hwnd {}, pid {}), pipe {}; every live call of this run goes to it", iso.hwnd.map(|h| h.to_string()).unwrap_or("?".into()), iso.pid.map(|p| p.to_string()).unwrap_or("?".into()), iso.socket),+                        &["Next: declare your first step (`step intake`, `step placement`); its clip starts by itself.".into(),+                          "Edit live; after an offline edit to the file use `capture reload`, never a relaunch. Before closing: `capture close` (saves, then closes only this editor).".into(),+                          if raise { String::new() } else { "If KiCad comes in front on the human's screen, `adom-bridge kicad_set_settings '{\"backgroundGuard\":true}'` has the bridge push it behind once (off by default).".into() }]);+                }                 "open" => {                     let raise = screen_mode(&mut r).may_raise();                     let (hwnd, shown) = br.open_board(&rb, reason.as_deref().unwrap_or(&format!("aiflow run {engine} on the test box")), raise).unwrap_or_else(|rep| err(&format!("could not open the board: {}", rep.to_string().chars().take(300).collect::<String>()), &[]));@@ -6746,7 +6782,44 @@ fn main() {                     r.save().unwrap();                     ok(&format!("clip {tag} rejected: it stays on the page as evidence and out of the video"), &["Re-take the step if the walkthrough matters: `step <name> --back --why ...`.".into()]);                 }-                other => err(&format!("capture {other}: use open, start, mark, stop, reject or screen"), &[]),+                "reload" => {+                    // issue #223: KiCad's own Revert over IPC after an offline edit, no prompt and no relaunch+                    let sock = r.data["kicadIsolated"]["socketPath"].as_str().map(str::to_string);+                    let reply = br.call("kicad_reload_board", &aiflow_bridge::isolated::reload_args(&rb, sock.as_deref(), *discard));+                    write_json(&dir.join("capture-reload.json"), &reply);+                    use aiflow_bridge::isolated::Refusal;+                    match aiflow_bridge::isolated::reload_of(&reply) {+                        Ok(rl) => {+                            r.log("board-reload", json!({"revision": rl.revision, "modelChanged": rl.model_changed, "editorMatchesFile": rl.matches_file, "discard": *discard}));+                            r.save().unwrap();+                            let changed = match rl.model_changed { Some(true) => "copper, parts or outline changed", Some(false) => "no copper, part or outline change (silkscreen and text reload but are not counted)", None => "change not reported" };+                            let warn = if rl.matches_file == Some(false) { "The editor still does not match the file: read capture-reload.json.".to_string() } else { String::new() };+                            ok(&format!("board reloaded from the file, revision {}; {changed}", rl.revision.unwrap_or("?".into())), &[warn, "Re-run the check that wanted the edit (`gate`, `measure`) so it reads the new revision.".into()]);+                        }+                        Err(Refusal::UnsavedChanges(m)) => err(&format!("the editor has unsaved edits, so it was not reloaded: {m}"), &["Save them first (`adom-bridge kicad_save_board` with the board's filePath and, for an isolated editor, its socketPath), or `capture reload --discard` to drop them.".into()]),+                        Err(Refusal::BoardLocked(m) | Refusal::Unsupported(m) | Refusal::Other(m)) => err(&format!("could not reload the board: {m}"), &["`kicad_reload_board` needs KiCad Bridge 1.1.5 or newer.".into()]),+                    }+                }+                "close" => {+                    // issue #223: save, then close only the run's own editor; the shared editor is never closed here+                    if r.data["kicadIsolated"].is_null() { ok("no isolated editor in this run: nothing closed (the shared editor stays as it is)", &[]); return; }+                    let sock = r.data["kicadIsolated"]["socketPath"].as_str().unwrap_or("").to_string();+                    if !*discard {+                        let saved = br.call("kicad_save_board", &json!({"filePath": rb, "socketPath": sock}));+                        if let Err(f) = aiflow_bridge::isolated::done(&saved) {+                            err(&format!("the board was not saved, so its editor stays open: {f:?}"), &["Fix what the save answered and `capture close` again, or `capture close --discard` to close without saving.".into()]);+                        }+                    }+                    let closed = br.call("kicad_close_document", &json!({"path": rb}));+                    if let Err(f) = aiflow_bridge::isolated::done(&closed) {+                        err(&format!("the isolated editor did not close: {f:?}"), &["Its pipe is still in run.json, so live calls keep going to it.".into()]);+                    }+                    let gone = r.data["kicadIsolated"].take();+                    r.log("isolated-editor-closed", json!({"editor": gone, "saved": !*discard}));+                    r.save().unwrap();+                    ok(&format!("the run's own editor closed{}", if *discard { " without saving" } else { " after saving" }), &["Live calls go to the shared editor again; `capture open --isolated` opens the run's own one again.".into()]);+                }+                other => err(&format!("capture {other}: use open, start, mark, stop, reject, reload, close or screen"), &[]),             }         }         Cmd::Status => {
crates/aiflow-bridge/src/isolated.rsadded+158
@@ -0,0 +1,158 @@+//! Issue #223: the run's own KiCad editor, launched by the KiCad bridge (1.1.5+) with a private API pipe.+//! `kicad_open_board {isolated: true}` answers the editor's socketPath, window and temp dir; the same board+//! again answers the same editor, and a board another KiCad has locked is refused (`board_locked`).+//! `kicad_reload_board` is KiCad's own Revert over IPC (no prompt), refused with `unsaved_changes`.+use serde_json::{json, Value};++/// What an isolated open answered: the editor's own API pipe, its window and process, its temp dir.+#[derive(Debug, Clone, PartialEq)]+pub struct Isolated {+    pub socket: String,+    pub hwnd: Option<i64>,+    pub title: String,+    pub pid: Option<i64>,+    pub temp_dir: String,+}++impl Isolated {+    /// The record kept in run.json (`kicadIsolated`), so later commands find the same editor.+    pub fn record(&self, board: &str, at: &str) -> Value {+        json!({"socketPath": self.socket, "hwnd": self.hwnd, "title": self.title, "pid": self.pid, "tempDir": self.temp_dir, "board": board, "opened": at})+    }+}++/// Why an isolated open or a reload did not happen, sorted so the hint can say what to do.+#[derive(Debug, Clone, PartialEq)]+pub enum Refusal {+    /// Another KiCad holds the board's lock: work on a copy.+    BoardLocked(String),+    /// The editor shows unsaved edits: save first, or reload with discardUnsaved.+    UnsavedChanges(String),+    /// The bridge does not know `isolated` (older than 1.1.5) or answered no socket.+    Unsupported(String),+    Other(String),+}++fn body(reply: &Value) -> &Value {+    reply.get("data").filter(|d| d.is_object()).unwrap_or(reply)+}++fn message(reply: &Value) -> String {+    let d = body(reply);+    let code = reply["errorCode"].as_str().or(d["errorCode"].as_str()).unwrap_or("");+    let text = reply["error"].as_str().or(d["error"].as_str()).or(reply["message"].as_str()).unwrap_or("");+    format!("{code} {text}").trim().chars().take(300).collect()+}++fn refusal(reply: &Value) -> Refusal {+    let d = body(reply);+    let code = reply["errorCode"].as_str().or(d["errorCode"].as_str()).unwrap_or("").to_ascii_lowercase();+    let m = message(reply);+    match code.as_str() {+        "board_locked" => Refusal::BoardLocked(m),+        "unsaved_changes" => Refusal::UnsavedChanges(m),+        "unknown_verb" | "unknown_parameter" | "invalid_args" | "not_supported" => Refusal::Unsupported(m),+        _ => Refusal::Other(if m.is_empty() { reply.to_string().chars().take(300).collect() } else { m }),+    }+}++fn failed(reply: &Value) -> bool {+    reply["success"] == false || reply["status"].as_str().is_some_and(|s| s == "error" || s == "parse_error")+        || reply.get("errorCode").is_some_and(|c| !c.is_null()) || body(reply).get("errorCode").is_some_and(|c| !c.is_null())+}++/// Read a `kicad_open_board {isolated: true}` reply.+pub fn isolated_of(reply: &Value) -> Result<Isolated, Refusal> {+    if failed(reply) { return Err(refusal(reply)); }+    let d = body(reply);+    let Some(socket) = d["socketPath"].as_str().or(reply["socketPath"].as_str()).filter(|s| !s.trim().is_empty()) else {+        // a bridge before 1.1.5 ignores `isolated` and opens in the shared editor: no socket in the reply+        return Err(Refusal::Unsupported(format!("the KiCad bridge answered no socketPath (KiCad Bridge 1.1.5 or newer opens an isolated editor): {}", message(reply))));+    };+    let pick = |k: &str| d.get(k).or(reply.get(k)).cloned().unwrap_or(Value::Null);+    Ok(Isolated {+        socket: socket.to_string(),+        hwnd: pick("hwnd").as_i64().filter(|h| *h > 0),+        title: pick("title").as_str().unwrap_or("").to_string(),+        pid: pick("pid").as_i64(),+        temp_dir: pick("tempDir").as_str().unwrap_or("").to_string(),+    })+}++/// What a reload answered: the editor's revision, whether copper, parts or the outline changed, and+/// whether the editor now matches the file.+#[derive(Debug, Clone, PartialEq)]+pub struct Reload {+    pub revision: Option<String>,+    pub model_changed: Option<bool>,+    pub matches_file: Option<bool>,+}++/// Read a `kicad_reload_board` reply.+pub fn reload_of(reply: &Value) -> Result<Reload, Refusal> {+    if failed(reply) { return Err(refusal(reply)); }+    let d = body(reply);+    let pick = |k: &str| d.get(k).or(reply.get(k)).cloned().unwrap_or(Value::Null);+    Ok(Reload {+        revision: pick("revision").as_str().map(str::to_string),+        model_changed: pick("modelChanged").as_bool(),+        matches_file: pick("editorMatchesFile").as_bool(),+    })+}++/// The args of a reload: the run's isolated socket when it has one, else the shared editor.+pub fn reload_args(board: &str, socket: Option<&str>, discard: bool) -> Value {+    let mut a = json!({"filePath": board});+    if let Some(s) = socket.filter(|s| !s.trim().is_empty()) { a["socketPath"] = json!(s); }+    if discard { a["discardUnsaved"] = json!(true); }+    a+}++/// A reply that did what was asked (save, close).+pub fn done(reply: &Value) -> Result<(), Refusal> {+    if failed(reply) { Err(refusal(reply)) } else { Ok(()) }+}++#[cfg(test)]+mod tests {+    use super::*;++    #[test]+    fn isolated_open_reads_socket_window_and_temp_dir() {+        let r = json!({"success": true, "data": {"socketPath": "ipc://C:\\T\\adom-kiso\\a1\\kicad\\api.sock", "hwnd": 4242, "title": "b — PCB Editor", "pid": 77, "tempDir": "C:\\T\\adom-kiso\\a1", "loaded": true}});+        let i = isolated_of(&r).unwrap();+        assert_eq!(i.socket, "ipc://C:\\T\\adom-kiso\\a1\\kicad\\api.sock");+        assert_eq!((i.hwnd, i.pid), (Some(4242), Some(77)));+        assert_eq!(i.temp_dir, "C:\\T\\adom-kiso\\a1");+        assert_eq!(i.record("C:/b.kicad_pcb", "t")["socketPath"], i.socket.as_str());+        // flat replies too+        let flat = json!({"success": true, "socketPath": "ipc://x", "hwnd": 5});+        assert_eq!(isolated_of(&flat).unwrap().hwnd, Some(5));+    }++    #[test]+    fn locked_board_and_old_bridge_are_told_apart() {+        let locked = json!({"success": false, "errorCode": "board_locked", "error": "another KiCad has it open"});+        assert!(matches!(isolated_of(&locked), Err(Refusal::BoardLocked(m)) if m.contains("another KiCad")));+        // an older bridge opens the board in the shared editor and answers no socket+        let old = json!({"success": true, "hwnd": 9, "title": "b — PCB Editor"});+        assert!(matches!(isolated_of(&old), Err(Refusal::Unsupported(_))));+        let other = json!({"status": "error", "error": "bridge offline"});+        assert!(matches!(isolated_of(&other), Err(Refusal::Other(m)) if m.contains("offline")));+    }++    #[test]+    fn reload_reads_revision_and_refuses_unsaved() {+        let r = json!({"success": true, "data": {"revision": "r12", "modelChanged": true, "editorMatchesFile": true}});+        assert_eq!(reload_of(&r).unwrap(), Reload { revision: Some("r12".into()), model_changed: Some(true), matches_file: Some(true) });+        let unsaved = json!({"success": false, "errorCode": "unsaved_changes", "error": "title shows unsaved edits"});+        assert!(matches!(reload_of(&unsaved), Err(Refusal::UnsavedChanges(_))));+    }++    #[test]+    fn reload_args_carry_the_socket_and_discard_only_when_asked() {+        assert_eq!(reload_args("C:/b.kicad_pcb", None, false), json!({"filePath": "C:/b.kicad_pcb"}));+        assert_eq!(reload_args("C:/b.kicad_pcb", Some("ipc://s"), true), json!({"filePath": "C:/b.kicad_pcb", "socketPath": "ipc://s", "discardUnsaved": true}));+        assert_eq!(reload_args("C:/b.kicad_pcb", Some(" "), false), json!({"filePath": "C:/b.kicad_pcb"}));+    }+}
crates/aiflow-bridge/src/lib.rs+18−1
@@ -10,6 +10,7 @@ use serde_json::{json, Value}; pub mod altium; pub mod eda; pub mod fusion;+pub mod isolated; pub mod landing; pub mod recorder; pub use landing::Landing;@@ -340,7 +341,9 @@ fn read_socket_args(verb: &str, args: &Value, socket: Option<&str>) -> Value { /// The live (IPC) verbs a task-owned, isolated KiCad instance answers, reads and edits alike. const LIVE_IPC_VERBS: &[&str] = &["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", "kicad_zoom_to"];+    "kicad_apply_tracks", "kicad_apply_zone_plan", "kicad_add_zone", "kicad_select_net", "kicad_select_clear", "kicad_zoom_to",+    // issue #223 (KiCad Bridge 1.1.5): save and reload answer on the isolated editor's pipe too+    "kicad_save_board", "kicad_reload_board"];  /// Issue #159: opt-in endpoint for EVERY live IPC verb, reads and edits (`ADOM_AIFLOW_KICAD_SOCKET`). For a /// task-owned KiCad launched with its own API pipe (a private TEMP/TMP) while another session's KiCad owns@@ -552,6 +555,20 @@ impl Bridge {         Ok((hwnd, "maximised, zoomed to fit".into()))     } +    /// Issue #223: open the board in the run's own editor (KiCad Bridge 1.1.5+), launched by the bridge in the+    /// background with a private API pipe. The same board again answers the same editor. `raise` (a test box)+    /// maximises it and brings it in front; otherwise it stays where the bridge put it.+    pub fn open_isolated(&self, remote_board: &str, reason: &str, raise: bool) -> Result<isolated::Isolated, isolated::Refusal> {+        let r = self.call("kicad_open_board", &json!({"filePath": remote_board, "isolated": true, "foreground": false, "reason": reason}));+        let mut iso = isolated::isolated_of(&r)?;+        if iso.hwnd.is_none() { iso.hwnd = self.wait_board_window(remote_board, &json!({"success": true})); }+        if let (true, Some(h)) = (raise, iso.hwnd) {+            self.call("desktop_ui_window", &json!({"hwnd": h, "action": "maximize", "reason": "aiflow capture: fill the monitor"}));+            self.call("desktop_bring_to_front", &json!({"hwnd": h, "reason": "aiflow capture: keep the PCB editor on screen on the test box"}));+        }+        Ok(iso)+    }+     /// The OS foreground window: {hwnd, pid, title}, None when there is none or it cannot be read.     pub fn foreground(&self) -> Option<Value> {         let r = self.raw_call("desktop_get_foreground", &json!({}));
docs/isolated-kicad-read-socket.md+15−3
@@ -8,11 +8,23 @@ 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.+**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.++## The run's own editor: `capture open --isolated` (KiCad Bridge 1.1.5+, issue #223)++`adom-aiflow capture open --isolated` has the KiCad bridge open the run's board in its own editor: the bridge launches it in the background with a private TEMP, so its API pipe (`ipc://<temp>\adom-kiso\<id>\kicad\api.sock`) is not the shared one. AI Flow keeps the pipe in run.json (`kicadIsolated`, with the window, pid and temp dir) and every later command of the run sends every live IPC verb to it, reads and edits alike (the list below), so it is allowed on a `screen: hands-off` machine too. `ADOM_AIFLOW_KICAD_SOCKET`, when set, still wins.++- The same board again answers the same editor, so a second `capture open --isolated` is safe.+- A board another KiCad has open is refused with `board_locked`: work on a copy (with its `.kicad_pro` and `.kicad_dru`), never close the other editor.+- After an offline edit to the file, `capture reload` runs KiCad's own Revert over IPC: no prompt, no relaunch. It answers the revision, whether copper, parts or the outline changed (silkscreen and text reload but are not counted) and whether the editor matches the file. With unsaved edits in the editor it refuses (`unsaved_changes`): save first, or `capture reload --discard`.+- `capture close` saves the board (`kicad_save_board {filePath, socketPath}`) and then closes only that editor (`kicad_close_document {path}`); `--discard` closes without saving. Closing discards whatever was not saved, so never close an editor with `kicad_close_document` yourself before saving.+- Focus: the bridge opens it behind the human's window. If KiCad still comes in front, `kicad_set_settings {"backgroundGuard": true}` has the bridge push it behind once (off by default).++An older KiCad bridge ignores `isolated` and answers no pipe; AI Flow then says so and changes nothing. Until the bridge is updated, on a `screen: hands-off` run 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`).  ## 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. 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 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: use `capture open --isolated` above. `ADOM_AIFLOW_KICAD_SOCKET=ipc://<api.sock>` is the manual form of the same thing (an editor you did not open through AI Flow, on a test box). 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`, `kicad_zoom_to`, `kicad_save_board` and `kicad_reload_board`. 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. @@ -20,5 +32,5 @@ Zone endpoint selection was verified with KiCad Bridge 1.0.55, including native  ## 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.+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, save the editor first (so the file holds its live edits), batch the offline edits to the file, and `capture reload` once; never relaunch the editor for it. 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.96.mdadded+17
@@ -0,0 +1,17 @@+# AI Flow 0.2.96++- **The run's own KiCad editor, opened by the bridge** (#223, Noah). Needs KiCad Bridge 1.1.5 or newer.+  - `capture open --isolated` has the KiCad bridge open the run's board in its own editor, launched in the background+    with a private API pipe. AI Flow keeps the pipe in run.json (`kicadIsolated`) and every later command of the run+    sends its live reads and edits there, so a run on the human's machine no longer needs a second KiCad started by+    hand. The same board again answers the same editor; a board another KiCad has open is refused with a hint to work+    on a copy; an older bridge is named, with the update command.+  - `capture reload` runs KiCad's own Revert over IPC after an offline edit to the file: no prompt, no relaunch. It+    answers the revision and whether copper, parts or the outline changed; with unsaved edits it says to save first or+    pass `--discard`.+  - `capture close` saves the board and closes only the run's own editor (`--discard` closes without saving).+  - `kicad_save_board` and `kicad_reload_board` join the live verbs that follow `ADOM_AIFLOW_KICAD_SOCKET`.+  - docs/isolated-kicad-read-socket.md, both skills and the `board_mismatch` hint now point to `capture open --isolated`+    instead of launching pcbnew by hand.+  - Checked live on a test laptop (KiCad 10.0.8, KiCad Bridge 1.1.5): open, reopen to the same editor, reload with and+    without a change, a later command's live read through the stored pipe, close after saving.
package.json+1−1
@@ -1,7 +1,7 @@ {   "slug": "adom-aiflow",   "type": "app",-  "version": "0.2.95",+  "version": "0.2.96",   "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.95",+  "version": "0.2.96",   "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−2
@@ -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. 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.+**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. When another session's KiCad holds the shared pipe (`board_mismatch`), `capture open --isolated` (KiCad Bridge 1.1.5+) has the bridge open the board in the run's own editor in the background, and every later live call of the run goes to it; a board another KiCad has open is refused (`board_locked`): work on a copy. Once the board is open, edit it live (`kicad_silk_text_batch`, `kicad_silk_fields_batch`, `kicad_apply_zone_plan`, `land ...`); for a change with no live verb, save, edit the file, then `capture reload` (KiCad's own Revert, no prompt, no relaunch). `capture close` saves and closes only the run's own editor. 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 @@ -602,7 +602,7 @@ Component library footage: keep the full `library-tour` separate. A reviewed fiv  ## Native editor readiness -`capture open` must confirm native IPC for the exact board, not only a visible window. KiCad may give its single IPC server to the first editor. On `board_mismatch`, read `capture-open-ipc.json` or `place-land-log.json`, save and gracefully close only your task-owned conflicting editors, and reopen the intended board first. Never close another user's work or restart a shared bridge. When the pipe's owner is another session, launch your own pcbnew with a private TEMP/TMP and set `ADOM_AIFLOW_KICAD_SOCKET=ipc://<its pipe>`: every live read and edit then reaches your editor (docs/isolated-kicad-read-socket.md). Permanent identity refusals are not retryable. Reject a static failed take and record the reason before re-taking it.+`capture open` must confirm native IPC for the exact board, not only a visible window. KiCad may give its single IPC server to the first editor. On `board_mismatch`, read `capture-open-ipc.json` or `place-land-log.json`, save and gracefully close only your task-owned conflicting editors, and reopen the intended board first. Never close another user's work or restart a shared bridge. When the pipe's owner is another session, `capture open --isolated` (KiCad Bridge 1.1.5+) has the bridge open your board in the run's own editor with a private pipe, and every live read and edit of the run then reaches it (docs/isolated-kicad-read-socket.md); never launch pcbnew yourself. Permanent identity refusals are not retryable. Reject a static failed take and record the reason before re-taking it.  Tours use the complete pinned canonical viewer release, served locally with the tour. On a viewer load error, rebuild with `tools/library-tour.py build --manifest <selection.json> --out <tour-dir>` and inspect the explicit error before recording. Native variants and tour selection must agree, including pin-one markers and the chosen LED/MPN state.