From 58b71898c4eb307125bd5c45a402931634de0b4f Mon Sep 17 00:00:00 2001 From: fotedev Date: Fri, 30 Oct 2026 04:50:15 +0200 Subject: [PATCH] feat(menu): renumber submenus 1..N, AutoClaw2 submenu, v1.20 sunset + doc sync --- .bat-harness-test.ps1 | 58 ++++--- AGENTS.md | 144 +++++++++++++--- CHANGELOG.md | 170 +++++++++++++++++++ GHOST.bat | 245 +++++++++++++-------------- README.md | 8 +- docs/APP_CLONING_EDGE_CASES.md | 8 +- docs/AUTOCLAW_CLONES_SPEC.md | 6 +- docs/ZCODE_CHAT_SYNC_WATCHER_PLAN.md | 12 +- docs/ZCODE_RESET_EDGE_CASES_PLAN.md | 8 + docs/cli.md | 59 ++++--- docs/getting-started.md | 24 +-- docs/troubleshooting.md | 18 +- tools/sync_zcode_assets.ps1 | 4 +- tools/watch_zcode_mcp_sync.ps1 | 6 +- 14 files changed, 542 insertions(+), 228 deletions(-) diff --git a/.bat-harness-test.ps1 b/.bat-harness-test.ps1 index ee44801..6b2ce90 100644 --- a/.bat-harness-test.ps1 +++ b/.bat-harness-test.ps1 @@ -69,6 +69,21 @@ function Invoke-Scenario([string]$Name, [string[]]$Lines) { $failures = @() +# S0) static guard: every submenu renders its ids strictly ascending 1..N with +# a trailing [0] Back row (renumber discipline 2026-10-29 - future rows are +# added in display order, never a higher id out of sequence). +$menuBlocks = [regex]::Matches($src, '(?ms)^:(RESETS|ZCODE|MAINT|AUTOCLAW|CLINE|OPENCODE)\r?$.*?(?=^:(?:RESETS|ZCODE|MAINT|AUTOCLAW|CLINE|OPENCODE|UnknownTask)\r?$)') +if ($menuBlocks.Count -ne 6) { $failures += "S0: expected 6 submenu blocks in GHOST.bat, found $($menuBlocks.Count)" } +foreach ($block in $menuBlocks) { + $name = $block.Groups[1].Value + $ids = @([regex]::Matches($block.Value, 'call :Opt (\d+)') | ForEach-Object { [int]$_.Groups[1].Value }) + $rows = @($ids | Where-Object { $_ -ne 0 }) + $bad = $false + for ($i = 0; $i -lt $rows.Count; $i++) { if ($rows[$i] -ne ($i + 1)) { $bad = $true } } + if ($ids.Count -eq 0 -or $ids[-1] -ne 0) { $bad = $true } + if ($bad) { $failures += "S0: $name submenu ids not ascending 1..N with trailing 0 - got $($ids -join ',')" } +} + # A) plain exit at main menu -> Done, zero Unknown task, zero literal junk $out = Invoke-Scenario 'A_plain_exit' @('0') if ($out -match 'Unknown task') { $failures += 'A: Unknown task on plain exit' } @@ -99,20 +114,20 @@ if ($hits -ne 1) { $failures += "E: expected 1 Unknown if ($out -match '%PENDING_CHAIN%') { $failures += 'E: literal %PENDING_CHAIN% leaked' } if ($out -notmatch 'ZCode Multi-Instance') { $failures += 'E: ZCode submenu not reached via sub-path' } -# F) new ZCode submenu entry renders: [17] Freeze diagnostic is listed +# F) ZCode submenu entry renders: [26] Freeze diagnostic is listed $out = Invoke-Scenario 'F_new_entry_render' @('2', '0', '0') -if ($out -notmatch '\[17\].*Freeze diagnostic') { $failures += 'F: ZCode submenu [17] Freeze diagnostic not rendered' } +if ($out -notmatch '\[26\].*Freeze diagnostic') { $failures += 'F: ZCode submenu [26] Freeze diagnostic not rendered' } # G) invalid ZCode submenu id -> exactly one legit Unknown task "42" $out = Invoke-Scenario 'G_invalid_zcode' @('2', '42', '0', '0') $hits = ([regex]::Matches($out, 'Unknown task "42"')).Count if ($hits -ne 1) { $failures += "G: expected 1 Unknown task from ZCode submenu, got $hits" } -# H) open AutoClaw submenu (PENDING_CHAIN undefined), back, exit -> clean render +# H) open AutoClaw2 submenu (PENDING_CHAIN undefined), back, exit -> clean render $out = Invoke-Scenario 'H_autoclaw_render' @('4', '0', '0') -if ($out -match 'Unknown task') { $failures += 'H: Unknown task on AutoClaw submenu render' } -if ($out -match '%PENDING_CHAIN%') { $failures += 'H: literal %PENDING_CHAIN% leaked' } -if ($out -notmatch 'AutoClaw Multi-Instance') { $failures += 'H: AutoClaw submenu not shown' } +if ($out -match 'Unknown task') { $failures += 'H: Unknown task on AutoClaw2 submenu render' } +if ($out -match '%PENDING_CHAIN%') { $failures += 'H: literal %PENDING_CHAIN% leaked' } +if ($out -notmatch 'AutoClaw2 Multi-Instance') { $failures += 'H: AutoClaw2 submenu not shown' } # I) invalid AutoClaw chain id "4 42" -> exactly one legit Unknown task "42" $out = Invoke-Scenario 'I_invalid_autoclaw' @('4 42', '0', '0') @@ -135,14 +150,14 @@ $out = Invoke-Scenario 'L_hostile_zcode' @('2', '1 & calc', '0', '0') if ($out -match 'calc') { $failures += 'L: injection attempt leaked through ZCode prompt' } if ($out -notmatch 'Invalid input') { $failures += 'L: rejection hint missing' } -# M) ZCode reset block renders the three high-risk entries incl. the appended -# Fifth reset, the all-six reset and the Primary reset copy; [6] pluralized +# M) ZCode reset block renders the reset entries incl. the Fifth reset, the +# all-six reset, the Primary reset and the Sixth reset (2026-10-29 numbering) $out = Invoke-Scenario 'M_zcode_reset_render' @('2', '0', '0') -if ($out -notmatch '\[19\].*Reset Fifth instance - Red') { $failures += 'M: ZCode [19] Fifth reset not rendered' } -if ($out -notmatch '\[10\].*Reset ALL SIX instances') { $failures += 'M: ZCode [10] all-six reset not rendered' } -if ($out -notmatch '\[21\].*Reset ZCode Primary instance') { $failures += 'M: ZCode [21] Primary reset not rendered' } -if ($out -notmatch '\[23\].*Reset Sixth instance - Orange') { $failures += 'M: ZCode [23] Sixth reset not rendered' } -if ($out -notmatch '\[ 6\].*survivors kept running') { $failures += 'M: ZCode [6] label not pluralized' } +if ($out -notmatch '\[12\].*Reset Fifth instance - Red') { $failures += 'M: ZCode [12] Fifth reset not rendered' } +if ($out -notmatch '\[16\].*Reset ALL SIX instances') { $failures += 'M: ZCode [16] all-six reset not rendered' } +if ($out -notmatch '\[14\].*Reset ZCode Primary instance') { $failures += 'M: ZCode [14] Primary reset not rendered' } +if ($out -notmatch '\[13\].*Reset Sixth instance - Orange') { $failures += 'M: ZCode [13] Sixth reset not rendered' } +if ($out -notmatch '\[ 9\].*survivors kept running') { $failures += 'M: ZCode [9] reset tail not rendered' } # N) Cline submenu (main [5]): renders clean, entries listed, no chain leak; # invalid Cline chain id -> exactly one legit Unknown task @@ -151,7 +166,7 @@ if ($out -match 'Unknown task') { $failures += 'N: Unknown task on if ($out -match '%PENDING_CHAIN%') { $failures += 'N: literal %PENDING_CHAIN% leaked' } if ($out -notmatch 'Cline Multi-Instance') { $failures += 'N: Cline submenu not shown' } if ($out -notmatch '\[ 1\].*Launch c1') { $failures += 'N: Cline [1] Launch c1 not rendered' } -if ($out -notmatch '\[ 5\].*Launch ALL clones') { $failures += 'N: Cline [5] Launch ALL not rendered' } +if ($out -notmatch '\[ 6\].*Launch ALL clones') { $failures += 'N: Cline [6] Launch ALL not rendered' } if ($out -notmatch '\[ 8\].*Clone status') { $failures += 'N: Cline [8] Clone status not rendered' } $out = Invoke-Scenario 'N_cline_invalid' @('5 77', '0', '0') $hits = ([regex]::Matches($out, 'Unknown task "77"')).Count @@ -180,18 +195,23 @@ if ($out -match 'calc') { $failures += 'Q: injection at if ($out -notmatch 'Invalid input') { $failures += 'Q: rejection hint missing' } # R) MCP sync block renders in the ZCode submenu: the live sync, the watcher -# and the one-shot live-apply entries (2026-10-27) +# and the one-shot live-apply entries (2026-10-27; 2026-10-29 numbering) $out = Invoke-Scenario 'R_mcp_sync_render' @('2', '0', '0') -if ($out -notmatch '\[24\].*Sync MCPs to all clones') { $failures += 'R: ZCode [24] Sync MCPs not rendered' } -if ($out -notmatch '\[25\].*MCP sync watcher') { $failures += 'R: ZCode [25] MCP sync watcher not rendered' } -if ($out -notmatch '\[26\].*Sync MCPs \+ apply live now') { $failures += 'R: ZCode [26] Sync + apply live not rendered' } +if ($out -notmatch '\[18\].*Sync MCPs to all clones') { $failures += 'R: ZCode [18] Sync MCPs not rendered' } +if ($out -notmatch '\[19\].*MCP sync watcher') { $failures += 'R: ZCode [19] MCP sync watcher not rendered' } +if ($out -notmatch '\[20\].*Sync MCPs \+ apply live now') { $failures += 'R: ZCode [20] Sync + apply live not rendered' } + +# S) light headless worker entry renders in the ZCode submenu (2026-10-28) +$out = Invoke-Scenario 'S_light_worker_render' @('2', '0', '0') +if ($out -notmatch '\[ 7\].*Launch light headless worker') { $failures += 'S: ZCode [7] light worker not rendered' } +if ($out -notmatch '\[28\].*Login clone account') { $failures += 'S: ZCode [28] login helper not rendered' } if ($failures.Count -gt 0) { Write-Output 'HARNESS FAIL:' $failures | ForEach-Object { Write-Output " - $_" } exit 1 } -Write-Output 'HARNESS PASS: all 18 scenarios clean' +Write-Output 'HARNESS PASS: all 19 scenarios clean' # Explicit exit: pwsh -File propagates the last native \$LASTEXITCODE, and the # scenarios' cmd exit code inherits GHOST.bat's `timeout` calls, which fail on # CI consoles (no interactive stdin) AFTER the PASS line was already printed. diff --git a/AGENTS.md b/AGENTS.md index 4a3b222..39a0417 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -10,10 +10,10 @@ Fresh-start toolkit for local AI-IDE identity stores — **Cursor**, **Windsurf/ README.md AGENTS.md GHOST.bat/ghost.sh # root launchers (scripts live under src/; # CLI cheat sheet: docs/cli.md); GHOST.bat = # 6 submenus with CONTINUOUS LOCAL numbering - # (IDE resets [1]-[9] / ZCode Multi-Instance & - # Clones [1]-[26] / System & GHOST Maintenance - # [1]-[3] / AutoClaw Multi-Instance & Clones - # [1]-[13] / Cline Multi-Instance & Clones + # (IDE resets [1]-[8] / ZCode Multi-Instance & + # Clones [1]-[28] / System & GHOST Maintenance + # [1]-[3] / AutoClaw2 Multi-Instance & Clones + # [1]-[9] / Cline Multi-Instance & Clones # [1]-[9] / OpenCode Multi-Instance & Clones # [1]-[10]) + ANSI colors + local chained input # per submenu (e.g. "1 3 4"), main-menu sub-paths @@ -33,7 +33,10 @@ src/python/ # stdlib-only Python core (ghost/ package) + ghos docs/ # IMPLEMENTATION_GUIDE/PLAN, WALKTHROUGH, research notes (local-only); # ZCODE_CHAT_SYNC_WATCHER_PLAN.md (tracked — chat-sync root cause); # PYTHON_HYBRID_ROADMAP.md (tracked — Phase 2 cancellation decision + - # Phase 3 thin-manifest pilot design + acceptance criteria) + # Phase 3 thin-manifest pilot design + acceptance criteria); + # T3_LOCAL_SUPPORT.md + T3_ZCODE_BRIDGE_SPEC.md (tracked — T3 Code + # local-support matrix + the ACP<->ZCode Protocol bridge spec; + # T3 monorepo study clone at ..\t3code, never committed here) archive/ # superseded versions (local-only fallbacks — do not run, never committed) assets/ # ghost.ico + ghost-source.png (launcher icon; regenerate via # tools/make_ghost_icon.ps1 — never hand-edit) @@ -41,7 +44,7 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # watch_zcode_captcha.ps1 — captcha-stall watchdog # (Telegram creds via params or .envlocal at repo root); # watch_zcode_taskbar.ps1 — resident taskbar-identity - # watcher (ZCode submenu [16]; every 5s re-stamps + # watcher (ZCode submenu [25]; every 5s re-stamps # System.AppUserModel.ID on each ZCode main window # incl. Primary when missing/wrong; every ~5m self-heals # hijacked Primary shortcuts + restores wiped icons; @@ -52,7 +55,7 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # console "ZCode Taskbar Watcher (pid N)", log at # %LOCALAPPDATA%\watch-zcode-taskbar\taskbar.log); # diagnose_zcode_freeze.ps1 — read-only freeze diagnostic - # (ZCode submenu [17]; -Days N): scans each instance's + # (ZCode submenu [26]; -Days N): scans each instance's # \.zcode\v2\logs for render-process-gone / # child-process-gone / perf_freeze events (collapses # same-second bursts), reads .zcode\v2\crash\archive dump @@ -82,7 +85,7 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # bidi auto-direction into the chat (per-paragraph Arabic RTL / # English LTR via unicode-bidi:plaintext + dir="auto" stamping, # code blocks stay LTR; ZCODE_BIDI_OFF=1 opts out); marker carries - # patchVersion so ZCode submenu [12] auto-upgrades after engine changes; + # patchVersion so ZCode submenu [27] auto-upgrades after engine changes; # re-run after app updates; after an app update the stale marker is # auto-detected (asar byte-probe of the engine's signature strings) and # the patch re-applies itself with a FRESH backup of the new pristine @@ -113,17 +116,17 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # install_zcode_second_shortcuts.ps1 — per-user Desktop + # Start-menu shortcuts for all five clones (AppUserModel.ID = # base + ".2"/".3"/".4"/".5"/".6" for pin grouping; -Instance to scope; - # -Remove to uninstall; ZCode submenu [2]); + # -Remove to uninstall; ZCode submenu [8]); # refresh_zcode_second_chats.ps1 — cross-instance chat # refresh (name is historical; -Target Primary|Second|Third| - # Fourth|Fifth|Sixth|All covers every instance now). One-shot (ZCode submenu [13] - # Second-only, ZCode submenu [15] -Target All): finds shared-store + # Fourth|Fifth|Sixth|All covers every instance now). One-shot (ZCode submenu [21] + # Second-only, ZCode submenu [22] -Target All): finds shared-store # chats missing from the # target's tasks-index, recycles its app-server(s) (auto-respawn # re-seeds the sidebar index), verify-after; hot-activity guard # waits out an in-flight turn (multi-signal guard: db commit recency + # uncompleted assistant steps + running tools + app-server CPU sample, - # up to ~90s, -Force bypasses). -Watch mode (ZCode submenu [14], -Target + # up to ~90s, -Force bypasses). -Watch mode (ZCode submenu [23], -Target # All): tails the agent JSONL logs for terminal failures (captcha # stall / quota / rate-limit, same signatures as # watch_zcode_captcha.ps1) and refreshes every RUNNING instance @@ -131,7 +134,7 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # cooldown); supersedes test_live_inject.py (obsolete spike, # now deleted — its row-copying approach was a dead end)); # sync_zcode_assets.ps1 — Primary→clone asset sync - # (ZCode submenu [20]; also auto-runs per-launch as launcher + # (ZCode submenu [17]; also auto-runs per-launch as launcher # step 2d, pre-launch): every clone resolves its OWN # user-scope config at \.zcode\cli\config.json # (the HOME override DOES reach the app's config resolution, @@ -167,7 +170,7 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # survives, clone-only servers kept, new servers inherit # Primary enabled, Primary definitions win); # watch_zcode_mcp_sync.ps1 — resident MCP sync watcher - # (ZCode submenu [25] resident / [26] one-shot + live + # (ZCode submenu [19] resident / [20] one-shot + live # apply; -RunOnce, -DryRun, -IntervalSeconds, -ApplyLive, # -Target Second|Third|Fourth|Fifth|Sixth|All, # -InstallAutostart/-RemoveAutostart): stat-guards the @@ -247,7 +250,8 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # backup + marker (autoclaw-ports-patch.marker.json) + -Restore # + node --check gate; AutoClaw must be # closed; an app update reverts it (all instances run with - # system.autoUpdate=false as the guard); AutoClaw submenu [11]; + # system.autoUpdate=false as the guard); run directly - the + # v1.20 menu entry was retired 2026-10-29 with the v1.20 app; # install_autoclaw_clone_shortcuts.ps1 — per-user Desktop + # Start-menu shortcuts for inst1..inst4 (AppUserModel.ID = # com.zhipuai.autoclaw.inst1..4; base read from the Primary .lnk @@ -257,7 +261,8 @@ tools/ # reviewed utilities (block_qoder_domains.ps1 # ExtendedProperty); per-clone IconLocation = # tools\autoclaw--branding\tray_icon.ico,0 (blue/yellow/ # green/red ← inst1..4; missing dir warns + falls back to the - # exe icon); AutoClaw submenu [2] + # exe icon); run directly - the v1.20 menu entry was retired + # 2026-10-29 with the v1.20 app # patch_opencode_clone_home.ps1 (+ .mjs engine v2) — one-time # OpenCode desktop app.asar patch (OpenCode submenu [7]): # clone-home (packaged bootstrap hardcodes userData = @@ -369,7 +374,31 @@ launch_zcode_second_instance.ps1 # ZCode multi-instance launcher -Instance Sec # step 2e ensures the MCP sync + taskbar identity watchers # are running hidden and installs their Startup .lnks once — # mutex probe, best-effort, never blocks the launch; + # step 0 RAM guard: at -MaxConcurrent (default 3) running + # instances it prints live commit numbers and asks before + # starting another (renderer-OOM 2026-09-25 + Start Plan + # throttling); non-interactive callers warn+continue, an + # already-running clone never prompts; -LowRam passes + # --disable-gpu (experimental); # Launch-ZCode-Second/Third/Fourth/Fifth/Sixth.bat wrappers) +launch_zcode_cli_light.ps1 # ZCode LIGHT headless worker -Instance Second..Sixth (GHOST.bat ZCode + # [7], gid 70; verified 2026-10-28 — docs/ZCODE_LIGHT_MODE.md): + # runs resources\glm\zcode.cjs under system node with the four + # env levers (HOME+USERPROFILE -> CloneHome redirect + # cli/config.json + cli/db/db.sqlite; ZCODE_DATA_BASE_DIR -> + # v2 credentials/provider_config; ZCODE_STORAGE_DIR -> cli caches) + # — ~0.9 GB commit vs ~1.6 GB+ per desktop instance; modes: + # interactive REPL (default), -Prompt one-shot (--mode, --cwd), + # -Server = foreground app-server stdio for orchestrators. + # Verified limits: the interactive TUI CANNOT run standalone + # (@zcode/tui only resolves inside the app's own Electron + # runtime — ELECTRON_RUN_AS_NODE disables asar), and a home + # without a standalone `zcode login zai` runs tasks on the FREE + # opencode-zen model, not the Start Plan (the app injects + # account:zai-start-plan adapters only into its own children; + # hand-written defaultModelSelection in provider_config.json is + # normalized away) — the launcher detects it and prints the + # one-time login recipe reset_qoderwork.ps1 # QoderWork: 26 steps (agents.db oauth/app_settings scrub, # chats preserved; auth.dat, MachineGuid, MAC, hostname; # -SkipMac/-SkipHostname/-DryRun) @@ -488,6 +517,26 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin hijack the launching console with log floods. Launch them detached (`cmd /c start "" `, new window via `start` in the .bat) — never inline. (Bit us in `GHOST.bat` option [10]: the menu drowned in `[pid:*]` logs.) +- **Submenu ids are display-ordered (renumbered 2026-10-29).** Every submenu's + local ids run strictly ascending 1..N in visual order, grouped by `:Div` + sections — ZCode: Launch Clones [1]-[8] (Second/Third/Fourth/Fifth/Sixth, + ALL, light worker, shortcuts) / Reset Clones [9]-[16] (Second..Sixth, + Primary, Both, ALL SIX) / Sync & Chat Refresh [17]-[23] / Watchers & + Diagnostics [24]-[26] / Maintenance [27]-[28] (login helper); AutoClaw2: Launch Clones [1]-[7] + (c1..c5, ALL, shortcuts) / Maintenance [8]-[9] (rewired to the AutoClaw2 + suite the same day — born display-ordered); Cline: Launch Clones [1]-[7] + (c1..c5, ALL, shortcuts) / Maintenance [8]-[9]. **Gids NEVER renumber** — + specs, wiring history and repo-integrity cite them; a renumber touches only + the submenu echo block + its resolver ladder. Add future rows in display + order inside their section — never a higher id out of sequence (the .bat + harness asserts ascending ids per submenu). Old→new for citations written + before 2026-10-29: ZCode launches [1,3,4,18,22]→[1,2,3,4,5], ALL [5]→[6], + light [27]→[7], shortcuts [2]→[8], resets [6,8,9,19,23,21,7,10]→ + [9,10,11,12,13,14,15,16], sync [20,24]→[17,18], MCP watcher [25,26]→[19,20], + chats [13,15,14]→[21,22,23], watchers [11,16,17]→[24,25,26], patch [12]→[27]; + Cline [3,4,6,7,5,2]→[2,3,4,5,6,7]. (The AutoClaw v1.20 rows were not + renumbered — they were retired outright the same day; see the AutoClaw2 + rewiring entry.) ## Multi-instance conventions (ZCode: Primary + 5 clones) @@ -511,14 +560,14 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin 2026-09-23). Only `.zcode\v2\tasks-index.sqlite` (sidebar index) is per-instance. The app-server seeds its index baseline at spawn with no snapshot backfill, so cross-instance chat visibility = recycle the target - instance's app-server (ZCode submenu [13]; Second-only today). Never copy session rows + instance's app-server (ZCode submenu [21]; Second-only today). Never copy session rows between homes — a clone's own `db.sqlite` copy is dead storage nothing reads. See `docs/ZCODE_CHAT_SYNC_WATCHER_PLAN.md`. - User-scope config is the OPPOSITE: each clone reads its OWN `\.zcode\cli\config.json` (the HOME override reaches the app's config resolution — verified 2026-10-17), so MCP/plugin/skill edits made in the Primary never reach the clones and the one-time seed copies drift. - `tools/sync_zcode_assets.ps1` (ZCode submenu [20]; launcher step 2d) syncs + `tools/sync_zcode_assets.ps1` (ZCode submenu [17]; launcher step 2d) syncs MCP server DEFINITIONS from the Primary (per-clone on/off toggles stay local), replaces stale `.zcode\skills` copies with a shared `.agents` junction, and mirrors the plugin cache — definitions only; never session @@ -528,14 +577,14 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin citation-loop myth, never an observed event — and reads mcp.servers at every app-server spawn, one per new session): `sync -McpOnly` is safe against RUNNING instances and `tools/watch_zcode_mcp_sync.ps1` (ZCode - [25]/[26], gids 68/69; [24] gid 67 = one-shot `-McpOnly`) keeps every + [19]/[20], gids 68/69; [18] gid 67 = one-shot `-McpOnly`) keeps every clone converged on every Primary change; a synced definition lands on each instance's next chat with no restart. `tools/zcode_mcp_merge.ps1` is the single (unit-tested) copy of the merge logic. Install-and-forget: launcher step 2e (2026-10-27) ensures the MCP sync + taskbar identity watchers are RUNNING (hidden) and installs their Startup .lnks once on every clone launch — mutex-probe guard, best-effort, never blocks the - launch; the captcha watchdog stays manual ([13]). + launch; the captcha watchdog stays manual ([24]). - Classify mains by **bare-exe CommandLine** (quoted or unquoted full path only); `--type` filtering alone misclassifies helpers as helpers. Empty CommandLine is a WMI race — keep as candidate, subtree walk still classifies correctly. @@ -554,7 +603,7 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin separate taskbar button + accent recolor + "ZCode " window title). These only work because `tools/patch_zcode_icon_override.ps1` (engine v8) patched the installed `app.asar` — an app update silently reverts them; re-run - the patch (ZCode submenu [12]) whenever a clone loses its look. Primary never sets any + the patch (ZCode submenu [27]) whenever a clone loses its look. Primary never sets any of the four vars. The patched main derives a `--zcode-blue` flag (additionalArguments → contextBridge `__ZCODE_BLUE__`) that switches the in-app recolor on, with the color taken from `__ZCODE_ACCENT__` (fallback @@ -571,13 +620,13 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin - Do NOT run ZCode instances elevated (verified 2026-09-24: Primary launched from explorer.exe still ran elevated — its shortcut had "Run as administrator" set; clones inherit elevation when launched from an elevated - GHOST menu via [18]). Windows UIPI silently strips drop data from a + GHOST menu via [4]). Windows UIPI silently strips drop data from a non-elevated Explorer into a high-IL window: the "Drop to add attachments" overlay still lights (window-level dragover) but `dataTransfer.files` arrives empty and the drop handler no-ops — while the "+" picker works (native dialog inside the process). Fix: clear the shortcut's Compatibility-tab admin flag and launch instances non-elevated; launch-only - menu entries ([10]/[16]/[17]/[18]) do not need the menu itself elevated. + menu entries (launch-only gids [10]/[16]/[17]/[18]) do not need the menu itself elevated. - Taskbar identity is stamped at the WINDOW level by the launcher (launch_zcode_second_instance.ps1 step [4]): after launch it resolves the clone's main window by its v6 title and writes System.AppUserModel.ID = @@ -600,7 +649,7 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin - Launcher stamping alone was NOT enough (verified 2026-09-24 later the same day): the merge MOVED to Primary+Yellow — any window relying on the app's process-explicit identity can merge with any other at any time. Final fix = - `tools/watch_zcode_taskbar.ps1` (ZCode submenu [16], resident + autostart): polls all + `tools/watch_zcode_taskbar.ps1` (ZCode submenu [25], resident + autostart): polls all four instances every 5s and re-stamps Primary (`dev.zcode.app`) AND clones whenever a window is missing/wrong — heals new/splash-swapped windows automatically (live-proven: stamped a freshly launched Primary within its @@ -651,7 +700,7 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin (msedge/git WER dumps the same minute corroborate; JS heap was only ~478MB, so it is OS commit starvation, not an app leak). After the tray-click quit, launching the instance again is safe and works. Diagnosis: - ZCode submenu [17] (`tools/diagnose_zcode_freeze.ps1`). Mitigation: larger + ZCode submenu [26] (`tools/diagnose_zcode_freeze.ps1`). Mitigation: larger pagefile / fewer concurrent instances. Ruled out that day: GPU caches, the icon asar patch, the captcha watchdog (idle since 09-17), db.sqlite locks. - Reset-menu hardening shipped 2026-10-23 (PARTIAL: the reset_zcode.ps1 v1.5 @@ -684,6 +733,47 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin 67-69 sit after gid 65 (before the Cline block); dispatch header range widened to 1-69 (63 still unused); repo-integrity asserts the range and the .bat harness scenario R asserts the three rows render. +- Light mode + RAM guard (2026-10-28, spike-verified — docs/ZCODE_LIGHT_MODE.md): + the commit limit (16 GB RAM + pagefile) is the hard ceiling that produced the + 2026-09-25 renderer-OOM freeze, and the Start Plan provider throttles above + ~3 concurrent instances anyway, so `launch_zcode_second_instance.ps1` now + carries a soft `-MaxConcurrent 3` guard (live commit numbers + confirm; + non-interactive callers warn+continue; focus-relaunches never prompt; an + experimental `-LowRam` passes `--disable-gpu`) and ZCode [7] launches + `launch_zcode_cli_light.ps1` — a per-account HEADLESS worker (~0.9 GB vs + ~1.6 GB+). Verified limits recorded in the launcher header: standalone TUI + impossible (@zcode/tui is asar-locked) and headless runs default to the free + opencode-zen model until a one-time `zcode login zai` per clone home (the + working plan provider namespace is `account:zai-start-plan`, discovered from + the Primary db's model_usage). T3 Code (pingdotgg) — the local support path + is SPECCED AND PHASES A-B IMPLEMENTED 2026-10-28/29 (docs/T3_LOCAL_SUPPORT.md + + docs/T3_ZCODE_BRIDGE_SPEC.md §8 addendum; monorepo study clone at ..\t3code, + 1016 MB, never committed here): `tools/t3_zcode_bridge.mjs` is the ACP v1 ⇄ + ZCode Protocol NDJSON translator run as a T3 "Local ACP command" (both sides + are NDJSON; T3's v1/v2 negotiation is response-SHAPE based per effect-acp + client.ts so the v1-shaped initialize pins generation 1; fs/terminal + capabilities stay unadvertised — ZCode executes its own tools), no T3 fork + needed. `tools/t3_bridge_probe.mjs` + `tools/t3_bridge_fake_client.mjs` + (fake ACP client, phase-B acceptance) + tests/t3_bridge.Tests.ps1 (Pester + 56/56 incl. the live-gated run). Wire truths in the spec §8: workspace = + `{workspacePath, workspaceKey}` object, session/send ASYNC, + session/subscribe REQUIRED, state.updated carries the authoritative + revision, requestRuntimePreferences mandatory (decline aborts create), + permission answers = the chosen option's own MF decision object, and the + plan provider materializes ONLY via standalone `zcode login zai` + (refreshRegistry does not); every free zen model rejected upstream on + 2026-10-29 so text-delta paths are bundle-schema-derived. Upstream PRs + (ACP Registry entry first, a full driver only if forced — replay-fixture + bar in docs/internals/adding-a-provider.md) are gated on the spec's + Phase-E live acceptance. **Phases D-E LANDED 2026-10-29 evening**: models + ride the session/new TOP-LEVEL `models` field (generic acpRegistry path; + initialize `_meta.modelState` is Grok-only), `session/set_model` unpacks + `"providerId/modelId[/level]"`, `launch_zcode_cli_light.ps1 -Login` + (GHOST.bat ZCode [28], gid 71) does the per-home `zcode login zai` with + verify-after, T3 Code v0.1.4 is INSTALLED (winget T3Tools.T3Code, + `~/.t3/userdata/settings.json` holds the five pre-seeded acpRegistry + instances — edit only with the app closed), and the user-supervised + live-acceptance runbook lives in spec §9.2. ## Multi-instance conventions (AutoClaw: Primary + 4 clone slots) @@ -706,7 +796,9 @@ Each IDE script is a **thin target manifest**: dot-source utils -> Assert-Admin widens it to 8; inst4 has NO MCP port without that patch. An AutoClaw update reverts it — therefore EVERY instance's settings.json carries `system.autoUpdate: false` (set by reset + seed-scrub) and the patch is - re-applied after any manual update (AutoClaw submenu [11]). + re-applied after any manual update (AutoClaw submenu [11] — row retired + 2026-10-29 with the v1.20 app; run the patch script directly on hosts that + still run v1.20). - The gateway port silently shifts up to +9 when the preferred port is busy (`PORT_PROBE_RANGE`) — never record the REQUESTED port as the actual one: the launcher discovers the clone's real listening ports by scanning diff --git a/CHANGELOG.md b/CHANGELOG.md index c2d5862..8d3a87a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,176 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +### Added +- **T3 bridge first live incident + hardening (2026-10-29 ~23:30)**: T3 + threads on unlogged clone homes hung ~4 minutes ("Failed to open provider + session") — diagnosed from T3's own provider event logs + (`~/.t3/userdata/logs/provider/events..log`): initialize + + session/new succeeded, the PROMPT hung in the free-model 11-attempt retry + loop. The bridge now (1) passes the home's known default model to + `session/create`, so an unmaterialized provider fails FAST with + `login_required` guidance pointing at GHOST.bat ZCode [28] (non-registry + failures fall back to the server default with a loud warning), and (2) + carries a 180 s turn watchdog (`session/stop` + `turn_watchdog` error + instead of an endless hang). Fake client gains the fast-fail branch + (unlogged home passes in seconds); Pester 56/56. +- **T3 bridge phases D-E + login helper (2026-10-29 evening)**: the bridge now + advertises models on the `session/new` response (T3's generic acpRegistry + provider reads the TOP-LEVEL `models` field — the initialize + `_meta.modelState` path is Grok-only, per `compat.ts`/`runtimeModel.ts` in + the study clone), sourced from the home's `v2\config.json` enabled + providers (plan families also registered under their `account:` + runtime namespace) + live `state.updated` patches; `session/set_model` + (v1 name verified) unpacks `"providerId/modelId[/level]"` into ZCode's + `session/setModel`; usage-limit classification keys on the structured + `errorCode`. `launch_zcode_cli_light.ps1 -Login` (GHOST.bat ZCode **[28]**, + gid 71) runs the one-time `zcode login zai` per clone home with + defaultModelSelection verify-after. **T3 Code v0.1.4 installed** + (`winget install T3Tools.T3Code`) and the five accounts pre-seeded into + `~/.t3/userdata/settings.json` (`providerInstances`, driver `acpRegistry`, + `source: "local"`, node.exe + bridge + `--Instance `, displayName + "ZCode " + accent) — backup + verify-after, confirmed loaded in the + server trace. Spec §9 carries the user-supervised live-acceptance runbook + (its step 2 needs the [28] login or an upstream model recovery). Pester + 56/56; harness 19/19. +- **T3 ZCode bridge implemented (phases A-B, 2026-10-29)**: `tools/t3_bridge_lib.mjs` + (shared: instance map, four env levers, wire-version gate following the + minified export chain, NDJSON connection), `tools/t3_bridge_probe.mjs` + (phase-A live protocol probe with transcript + event-catalogue artifacts), + `tools/t3_zcode_bridge.mjs` (the ACP v1 ⇄ ZCode Protocol bridge: v1-shaped + initialize that pins T3's generation detection, session/new with the five + permission modes advertised, async session/send + event streaming + (part.delta text/reasoning chunks, tool_call updates, permission forwarding + via the per-option MF decision objects), cancel-before-terminal forced to + `cancelled`, -32009 revision self-healing via session/read, mandatory + `session/requestRuntimePreferences` answered minimally, default-decline + elsewhere, optional `--model provider/modelId[/level]`), and + `tools/t3_bridge_fake_client.mjs` (the phase-B acceptance harness). Live + findings recorded as spec §8 addendum: workspace is an object + (`{workspacePath, workspaceKey}`), session/send is async (terminal arrives + via `v4/telemetry/event turn.terminal` + `turn.completed/failed` events), + `session/subscribe` is REQUIRED before events flow, `state.updated` patches + carry the authoritative revision, the plan provider only materializes via + standalone `zcode login zai` (`provider/refreshRegistry` does not), and + every free zen model rejected upstream that day (one retried 11× for + >150 s) so text-delta paths are bundle-schema-derived. Hard gates verified + live: v1-shape initialize, five modes, prompt round-trip, cancel→stop, + clean exit, stdout purity. `tests/t3_bridge.Tests.ps1` (Pester 56/56 incl. + the live-gated fake-client run; CI skips it — no clone home there). +- **T3 Code local support: study clone + two specs** (2026-10-28): cloned + pingdotgg/t3code (MIT, 1016 MB on disk at `C:\programming\github\t3code`, + HEAD 9826dbb990, read-only reference — no pnpm install, never committed + here) so GHOST can support its own apps in T3 Code locally without waiting + for upstream PR merges. `docs/T3_LOCAL_SUPPORT.md` = support matrix (ZCode → + bridge; OpenCode → T3-native provider; AutoClaw/Cline/desktop IDEs → not + agent CLIs, documented rationale) + local-vs-upstream split. + `docs/T3_ZCODE_BRIDGE_SPEC.md` = the ACP v1 ⇄ ZCode Protocol NDJSON bridge + spec with provenance tables on both sides (ACP transports/negotiation from + the official docs AND the clone's own source: `AcpSessionRuntime.ts` + initialize `{protocolVersion:2, clientCapabilities, clientInfo}`, + `effect-acp/client.ts` response-SHAPE-based v1/v2 generation detection, + `AcpRegistrySupport.ts` local-command spawn `{command, args, cwd, env, + shell:false}`; ZCode Protocol from bundle probes: NDJSON envelope without a + jsonrpc member, `startup/*` + `runtime/capabilities` handshake, + session method map, server→client requests incl. + `interaction/requestPermission`, error codes, `session/setModel`/`setMode`) + — architecture (one bridge process per clone account, four env levers, + no fs/terminal capabilities since ZCode runs its own tools), full mapping + tables, seven edge cases (stdout purity, same-home db contention, wire- + version signature gate, standalone-login prerequisite, revision + discipline), a phased A-E implementation plan with acceptance criteria, and + the upstream strategy (ACP Registry entry first; a full + `packages/provider-zcode` driver only if the generic ACP surface loses + features — replay-fixture bar per the clone's adding-a-provider.md; + CONTRIBUTING.md policy noted). Bridge implementation = next task. +- **ZCode light mode: headless per-account workers + desktop RAM guard** + (2026-10-28; spike-verified — docs/ZCODE_LIGHT_MODE.md): the 16 GB box + cannot hold all six desktop instances (the 2026-09-25 renderer-OOM freeze + was commit-limit exhaustion), so the fleet now has a light path and a guard. + `src/windows/launch_zcode_cli_light.ps1` (GHOST.bat ZCode [27], gid 70) + runs a clone's account headless via `resources\glm\zcode.cjs` under the + system node — interactive REPL, `-Prompt` one-shot or `-Server` stdio worker + — with full per-home isolation (HOME+USERPROFILE+ZCODE_DATA_BASE_DIR+ + ZCODE_STORAGE_DIR), ~0.9 GB commit vs ~1.6 GB+ per desktop instance, and + sessions shared with that clone's desktop app. Verified limits are recorded + in the launcher header and the doc: the interactive TUI cannot run + standalone (@zcode/tui is asar-locked; ELECTRON_RUN_AS_NODE disables asar), + and a home without a one-time standalone `zcode login zai` runs tasks on the + free opencode-zen model instead of the Start Plan (the launcher detects this + and prints the login recipe; the working plan provider namespace + `account:zai-start-plan` was discovered from the Primary db's model_usage). + `launch_zcode_second_instance.ps1` gains a soft `-MaxConcurrent 3` RAM guard + (live commit numbers + confirm; non-interactive callers warn+continue so + watchdog/harness callers never hang; focus-relaunches never prompt) and an + experimental `-LowRam` (`--disable-gpu`). T3 Code (pingdotgg) was evaluated + as a "merge all accounts into one window" target and DEFERRED: no ZCode/Z.ai + provider, single-provider multi-account is still an open feature request + there, and an ACP ↔ app-server bridge would be permanent maintenance against + an early-stage third-party app (its one zero-effort win: the OpenCode fleet + is natively supported). Docs: ZCODE_LIGHT_MODE.md, cli.md ZCode [27], + README table + layout, AGENTS.md conventions. Harness scenario S covers the + new menu row (19 scenarios); repo-integrity auto-derives the 1-70 range. + +### Changed +- **GHOST.bat AutoClaw submenu rewired to the AutoClaw2 (zwork) suite** + (2026-10-29): the v1.20 app was uninstalled from the dev host and its + ~2.2 GB of remnants (gateway state, clone homes, a 769 MB staged updater, + dead shortcuts, Temp diagnostics) cleaned, so main menu [4] is now + "AutoClaw2 Multi-Instance & Clones" - items [1]-[9] = launch c1..c5 / + launch all-five / install clone shortcuts / clone status / remove clone + shortcuts, mapping to the reused gids 28-36. The v1.20 items (launch/reset + inst1..4 + Primary, ports-patch v12 re-apply, status) left the menu and + dispatch cases 37-40 + 71 were retired; the underlying v1.20 scripts stay + in the repo for hosts that still run v1.20 (run them directly). IDE Resets + [9] "Reset AutoClaw" was removed with it (Resets is [1]-[8]; no + renumbering). AutoClaw2 needs no reset script (stop the instance + delete + its clone home) and no ports patch (in-process engine). Docs: cli.md, + APP_CLONING_EDGE_CASES EC-A01, AGENTS.md. Harness: scenario H retargeted + to the AutoClaw2 render (19 scenarios). +- **GHOST.bat submenu ids renumbered to display order** (2026-10-29): every + submenu's local ids now run strictly ascending 1..N in visual order, + grouped by `:Div` sections — the old ZCode submenu carried out-of-sequence + rows (19/21 inside the reset block, launchers 18/22 inside the sync block) + and Cline appended c4/c5 after Launch ALL. ZCode: Launch Clones [1]-[8] + (Second/Third/Fourth/Fifth/Sixth, ALL [6], light worker [7], shortcuts + [8]) / Reset Clones [9]-[16] (Second..Sixth, Primary [14], Both [15], + ALL SIX [16]) / Sync & Chat Refresh [17]-[23] / Watchers & Diagnostics + [24]-[26] / Maintenance [27] (icon patch [27]); Cline: Launch [1]-[7] + (c1..c5, ALL [6], shortcuts [7]) / Maintenance [8]-[9]; the two + hand-inlined separator lines became `call :Div`. **Gids are unchanged** — + a renumber touches only the echo blocks + resolver ladders, so every gid + citation in specs, wiring history and repo-integrity stays valid (the + AutoClaw2 rewiring above reused 28-36 on its own). Docs synced: cli.md, + getting-started, troubleshooting, README, AGENTS.md (+ a display-order + rule bullet in the .bat rules), ZCODE_CHAT_SYNC_WATCHER_PLAN, + ZCODE_LIGHT_MODE, ZCODE_RESET_EDGE_CASES (renumber translation note), + APP_CLONING_EDGE_CASES, AUTOCLAW_CLONES_SPEC; script headers + (launch_zcode_second_instance, launch_zcode_cli_light, sync_zcode_assets, + watch_zcode_mcp_sync). Harness: rows F/M/N/R/S retargeted to the new + numbers + a static ascending-ids guard per submenu (scenario count + unchanged at 19). + +### Fixed +- **Blank clone shortcut icons on Desktop/Start Menu/taskbar (AutoClaw2 + + Cline suites) - two stacked root causes** (2026-10-29): (1) the installed + .lnk files carried a RELATIVE IconLocation (`tools\-branding\ + tray_icon.ico`) that Windows can never resolve - a bare-filename + `$MyInvocation` fallback could yield a relative repo root at install time; + both shortcut installers now resolve `$RepoRoot` through `Resolve-Path`, + refuse non-absolute roots, and their verify-after additionally re-reads the + IconLocation (must be absolute + exist) alongside target/AUMID; all 20 + shortcuts reinstalled with absolute icon paths. (2) `tools/make_clone_icon.ps1` + wrote PNG-compressed frames for EVERY ICO size, but PNG frames are + shell-legal at 256 only - small PNG frames decode as noise/blank in + Explorer and System.Drawing (every suite the generator produced was + affected: autoclaw v1, autoclaw2, cline, opencode; the zcode ICOs were + always correct DIBs). The generator now writes 32-bit BGRA DIB frames below + 256 + a PNG frame at 256 with a frame-magic verify gate, and all 19 + branding ICOs were regenerated from their existing masters. Verified + through the real shell pipeline (SHGetFileInfo on the .lnk): colored logos + render. Housekeeping: removed the dead v1.20 AutoClaw implicit taskbar pin + left behind by the app uninstall. + ## [1.2.0] — 2026-10-28 ### Added diff --git a/GHOST.bat b/GHOST.bat index 666d59f..13aef01 100644 --- a/GHOST.bat +++ b/GHOST.bat @@ -16,7 +16,7 @@ echo. call :Opt 1 "IDE Resets" "- device ID + 8 IDE suites" if defined ESC (echo %ESC%[92m[ 2] %ESC%[97mZCode Multi-Instance ^& Clones %ESC%[90m- launchers, resets, sync%ESC%[0m) else echo [ 2] ZCode Multi-Instance ^& Clones - launchers, resets, sync if defined ESC (echo %ESC%[92m[ 3] %ESC%[97mSystem ^& GHOST Maintenance %ESC%[90m- shortcuts, watchers, updates%ESC%[0m) else echo [ 3] System ^& GHOST Maintenance - shortcuts, watchers, updates -if defined ESC (echo %ESC%[92m[ 4] %ESC%[97mAutoClaw Multi-Instance ^& Clones %ESC%[90m- launchers, resets, port patch%ESC%[0m) else echo [ 4] AutoClaw Multi-Instance ^& Clones - launchers, resets, port patch +if defined ESC (echo %ESC%[92m[ 4] %ESC%[97mAutoClaw2 Multi-Instance ^& Clones %ESC%[90m- launchers, shortcuts%ESC%[0m) else echo [ 4] AutoClaw2 Multi-Instance ^& Clones - launchers, shortcuts if defined ESC (echo %ESC%[92m[ 5] %ESC%[97mCline Multi-Instance ^& Clones %ESC%[90m- launchers, clone status%ESC%[0m) else echo [ 5] Cline Multi-Instance ^& Clones - launchers, clone status if defined ESC (echo %ESC%[92m[ 6] %ESC%[97mOpenCode Multi-Instance ^& Clones %ESC%[90m- launchers, clone-home patch%ESC%[0m) else echo [ 6] OpenCode Multi-Instance ^& Clones - launchers, clone-home patch echo. @@ -88,7 +88,6 @@ call :Opt 5 "Reset Qoder" "" call :Opt 6 "Reset QoderWork" "" call :Opt 7 "Reset ZCode Primary instance" "" call :Opt 8 "Reset MiniMax/OpenCode" "" -call :Opt 9 "Reset AutoClaw" "" echo. call :Opt 0 "Back to Main Menu" "" echo. @@ -114,35 +113,41 @@ if defined ESC (echo %ESC%[96mGHOST / ZCode Multi-Instance ^& Clones%ESC%[0m) el echo. call :Div "Launch Clones" call :Opt 1 "Launch Second instance" "- Blue branding (independent window)" -call :Opt 2 "Install clone shortcuts" "- all 5 - Desktop + Start menu" -call :Opt 3 "Launch Third instance" "- Yellow branding (independent window)" -call :Opt 4 "Launch Fourth instance" "- Green branding (independent window)" -call :Opt 5 "Launch ALL clones" "- Second + Third + Fourth + Fifth + Sixth" +call :Opt 2 "Launch Third instance" "- Yellow branding (independent window)" +call :Opt 3 "Launch Fourth instance" "- Green branding (independent window)" +call :Opt 4 "Launch Fifth instance" "- Red branding (independent window)" +call :Opt 5 "Launch Sixth instance" "- Orange branding (independent window)" +call :Opt 6 "Launch ALL clones" "- Second + Third + Fourth + Fifth + Sixth" +call :Opt 7 "Launch light headless worker" "- run a clone account with no desktop window - low RAM" +call :Opt 8 "Install clone shortcuts" "- all 5 - Desktop + Start menu" echo. call :Div "Reset Clones" -call :Opt 6 "Reset Second instance" "(survivors kept running)" -call :Opt 7 "Reset Second + Primary" "(independent IDs)" -call :Opt 8 "Reset Third instance - Yellow" "(survivors kept running)" -call :Opt 9 "Reset Fourth instance - Green" "(survivors kept running)" -call :Opt 10 "Reset ALL SIX instances" "(independent IDs)" -call :Opt 19 "Reset Fifth instance - Red" "(survivors kept running)" -call :Opt 21 "Reset ZCode Primary instance" "" -echo. -if defined ESC (echo %ESC%[90m -- Sync ^& Watchers --%ESC%[0m) else echo -- Sync ^& Watchers -- -call :Opt 11 "Captcha watchdog" "(unattended, separate window)" -call :Opt 12 "Re-apply app patch - v8, icons + bidi auto" "(after app update)" -call :Opt 13 "Refresh Second chats" "- show Primary chats without app restart" -call :Opt 14 "Watch errors" "- auto-refresh chats on quota or captcha failure" -call :Opt 15 "Refresh chats - ALL instances" "- re-index every running sidebar" -call :Opt 16 "Taskbar identity watcher" "- auto-fix taskbar merges (separate window)" -call :Opt 17 "Freeze diagnostic" "- dead windows, renderer OOM, commit pressure" -call :Opt 18 "Launch Fifth instance" "- Red branding (independent window)" -call :Opt 20 "Sync clone assets" "- MCPs + skills + plugins from Primary" -call :Opt 22 "Launch Sixth instance" "- Orange branding (independent window)" -call :Opt 23 "Reset Sixth instance - Orange" "(survivors kept running)" -call :Opt 24 "Sync MCPs to all clones" "- live - running instances included" -call :Opt 25 "MCP sync watcher" "- auto-sync on Primary change (separate window)" -call :Opt 26 "Sync MCPs + apply live now" "- recycles running instances - idle-guarded" +call :Opt 9 "Reset Second instance" "(survivors kept running)" +call :Opt 10 "Reset Third instance - Yellow" "(survivors kept running)" +call :Opt 11 "Reset Fourth instance - Green" "(survivors kept running)" +call :Opt 12 "Reset Fifth instance - Red" "(survivors kept running)" +call :Opt 13 "Reset Sixth instance - Orange" "(survivors kept running)" +call :Opt 14 "Reset ZCode Primary instance" "" +call :Opt 15 "Reset Second + Primary" "(independent IDs)" +call :Opt 16 "Reset ALL SIX instances" "(independent IDs)" +echo. +call :Div "Sync & Chat Refresh" +call :Opt 17 "Sync clone assets" "- MCPs + skills + plugins from Primary" +call :Opt 18 "Sync MCPs to all clones" "- live - running instances included" +call :Opt 19 "MCP sync watcher" "- auto-sync on Primary change (separate window)" +call :Opt 20 "Sync MCPs + apply live now" "- recycles running instances - idle-guarded" +call :Opt 21 "Refresh Second chats" "- show Primary chats without app restart" +call :Opt 22 "Refresh chats - ALL instances" "- re-index every running sidebar" +call :Opt 23 "Watch errors" "- auto-refresh chats on quota or captcha failure" +echo. +call :Div "Watchers & Diagnostics" +call :Opt 24 "Captcha watchdog" "(unattended, separate window)" +call :Opt 25 "Taskbar identity watcher" "- auto-fix taskbar merges (separate window)" +call :Opt 26 "Freeze diagnostic" "- dead windows, renderer OOM, commit pressure" +echo. +call :Div "Maintenance" +call :Opt 27 "Re-apply app patch - v8, icons + bidi auto" "(after app update)" +call :Opt 28 "Login clone account - one-time plan setup" "- enables the Start Plan for light workers + T3 bridge" echo. call :Opt 0 "Back to Main Menu" "" echo. @@ -190,26 +195,20 @@ goto MAINT :AUTOCLAW cls -if defined ESC (echo %ESC%[96mGHOST / AutoClaw Multi-Instance ^& Clones%ESC%[0m) else echo GHOST / AutoClaw Multi-Instance ^& Clones +if defined ESC (echo %ESC%[96mGHOST / AutoClaw2 Multi-Instance ^& Clones%ESC%[0m) else echo GHOST / AutoClaw2 Multi-Instance ^& Clones echo. call :Div "Launch Clones" -call :Opt 1 "Launch inst1" "- first clone (own profile, identity, ports)" -call :Opt 2 "Install clone shortcuts" "- all 4 - Desktop + Start menu" -call :Opt 3 "Launch inst2" "" -call :Opt 4 "Launch inst3" "" -call :Opt 5 "Launch ALL clones" "- inst1..inst4, one after another" -echo. -call :Div "Reset Clones" -call :Opt 6 "Reset inst1" "(auto closes AutoClaw)" -call :Opt 7 "Reset inst2" "" -call :Opt 8 "Reset inst3" "" -call :Opt 9 "Reset inst4" "" -call :Opt 10 "Reset ALL instances" "- clones + Primary, independent IDs" -call :Opt 13 "Reset AutoClaw Primary instance" "" +call :Opt 1 "Launch c1" "- Blue - own profile, identity, sign-in" +call :Opt 2 "Launch c2" "- Yellow" +call :Opt 3 "Launch c3" "- Green" +call :Opt 4 "Launch c4" "- Red" +call :Opt 5 "Launch c5" "- Orange" +call :Opt 6 "Launch ALL clones" "- c1..c5, one after another" +call :Opt 7 "Install clone shortcuts" "- all 5 - Desktop + Start menu" echo. -if defined ESC (echo %ESC%[90m -- Maintenance --%ESC%[0m) else echo -- Maintenance -- -call :Opt 11 "Re-apply app patch - v12, ports + taskbar identity" "(after app update; AutoClaw must be closed)" -call :Opt 12 "Clone status" "- processes, actual ports, health" +call :Div "Maintenance" +call :Opt 8 "Clone status" "- all 5 - locks, device-id, sign-in state" +call :Opt 9 "Remove clone shortcuts" "- Desktop + Start menu" echo. call :Opt 0 "Back to Main Menu" "" echo. @@ -235,12 +234,12 @@ if defined ESC (echo %ESC%[96mGHOST / Cline Multi-Instance ^& Clones%ESC%[0m) el echo. call :Div "Launch Clones" call :Opt 1 "Launch c1" "- Blue - own state, web login, ports" -call :Opt 2 "Install clone shortcuts" "- all 5 - Desktop + Start menu" -call :Opt 3 "Launch c2" "- Yellow" -call :Opt 4 "Launch c3" "- Green" -call :Opt 5 "Launch ALL clones" "- c1..c5, one after another" -call :Opt 6 "Launch c4" "- Red" -call :Opt 7 "Launch c5" "- Orange" +call :Opt 2 "Launch c2" "- Yellow" +call :Opt 3 "Launch c3" "- Green" +call :Opt 4 "Launch c4" "- Red" +call :Opt 5 "Launch c5" "- Orange" +call :Opt 6 "Launch ALL clones" "- c1..c5, one after another" +call :Opt 7 "Install clone shortcuts" "- all 5 - Desktop + Start menu" echo. call :Div "Maintenance" call :Opt 8 "Clone status" "- all 5 - locks, ports, sign-in state" @@ -329,7 +328,8 @@ endlocal & exit /b 0 :ResetsOne rem Resolves an IDE Resets submenu-local id to its global task id and runs it. -rem Local ids 1-8 equal the global ids; [9] maps to gid 28 - gid 9 is the ZCode captcha watchdog. +rem Local ids 1-8 equal the global ids. The old [9] Reset AutoClaw - gid 28 - +rem was retired 2026-10-29 with the v1.20 app; gid 28 is the AutoClaw2 c1 launch. set "RESOLVED=" if "%~1"=="1" set "RESOLVED=1" if "%~1"=="2" set "RESOLVED=2" @@ -339,7 +339,6 @@ if "%~1"=="5" set "RESOLVED=5" if "%~1"=="6" set "RESOLVED=6" if "%~1"=="7" set "RESOLVED=7" if "%~1"=="8" set "RESOLVED=8" -if "%~1"=="9" set "RESOLVED=28" if not defined RESOLVED call :UnknownTask "%~1" if not defined RESOLVED exit /b call :DispatchOne %RESOLVED% @@ -347,33 +346,38 @@ exit /b :ZCodeOne rem Resolves a ZCode submenu-local id to its global task id and runs it. +rem Renumbered 2026-10-29: local ids follow display order (1-27 ascending, +rem grouped Launch / Reset / Sync & Chat / Watchers & Diagnostics / Maintenance). +rem Gids are unchanged - old local -> gid map preserved in CHANGELOG 2026-10-29. set "RESOLVED=" if "%~1"=="1" set "RESOLVED=10" -if "%~1"=="2" set "RESOLVED=14" -if "%~1"=="3" set "RESOLVED=16" -if "%~1"=="4" set "RESOLVED=17" -if "%~1"=="5" set "RESOLVED=18" -if "%~1"=="6" set "RESOLVED=11" -if "%~1"=="7" set "RESOLVED=12" -if "%~1"=="8" set "RESOLVED=19" -if "%~1"=="9" set "RESOLVED=20" -if "%~1"=="10" set "RESOLVED=21" -if "%~1"=="11" set "RESOLVED=9" -if "%~1"=="12" set "RESOLVED=13" -if "%~1"=="13" set "RESOLVED=15" -if "%~1"=="14" set "RESOLVED=22" -if "%~1"=="15" set "RESOLVED=23" -if "%~1"=="16" set "RESOLVED=25" -if "%~1"=="17" set "RESOLVED=27" -if "%~1"=="18" set "RESOLVED=41" -if "%~1"=="19" set "RESOLVED=42" -if "%~1"=="20" set "RESOLVED=43" -if "%~1"=="21" set "RESOLVED=7" -if "%~1"=="22" set "RESOLVED=64" -if "%~1"=="23" set "RESOLVED=65" -if "%~1"=="24" set "RESOLVED=67" -if "%~1"=="25" set "RESOLVED=68" -if "%~1"=="26" set "RESOLVED=69" +if "%~1"=="2" set "RESOLVED=16" +if "%~1"=="3" set "RESOLVED=17" +if "%~1"=="4" set "RESOLVED=41" +if "%~1"=="5" set "RESOLVED=64" +if "%~1"=="6" set "RESOLVED=18" +if "%~1"=="7" set "RESOLVED=70" +if "%~1"=="8" set "RESOLVED=14" +if "%~1"=="9" set "RESOLVED=11" +if "%~1"=="10" set "RESOLVED=19" +if "%~1"=="11" set "RESOLVED=20" +if "%~1"=="12" set "RESOLVED=42" +if "%~1"=="13" set "RESOLVED=65" +if "%~1"=="14" set "RESOLVED=7" +if "%~1"=="15" set "RESOLVED=12" +if "%~1"=="16" set "RESOLVED=21" +if "%~1"=="17" set "RESOLVED=43" +if "%~1"=="18" set "RESOLVED=67" +if "%~1"=="19" set "RESOLVED=68" +if "%~1"=="20" set "RESOLVED=69" +if "%~1"=="21" set "RESOLVED=15" +if "%~1"=="22" set "RESOLVED=23" +if "%~1"=="23" set "RESOLVED=22" +if "%~1"=="24" set "RESOLVED=9" +if "%~1"=="25" set "RESOLVED=25" +if "%~1"=="26" set "RESOLVED=27" +if "%~1"=="27" set "RESOLVED=13" +if "%~1"=="28" set "RESOLVED=71" if not defined RESOLVED call :UnknownTask "%~1" if not defined RESOLVED exit /b call :DispatchOne %RESOLVED% @@ -391,21 +395,21 @@ call :DispatchOne %RESOLVED% exit /b :AutoClawOne -rem Resolves an AutoClaw submenu-local id to its global task id and runs it. +rem Resolves an AutoClaw2 submenu-local id to its global task id and runs it. +rem Rewired 2026-10-29 to the AutoClaw2 (zwork) suite: the v1.20 app was +rem uninstalled from the host, so its launch/reset/patch/status items left the +rem menu and dispatch cases 37-40 + 71 were retired; local ids 1-9 map to the +rem reused gids 28-36. Old v1.20 map: CHANGELOG 2026-10-29. set "RESOLVED=" -if "%~1"=="1" set "RESOLVED=29" -if "%~1"=="2" set "RESOLVED=30" -if "%~1"=="3" set "RESOLVED=31" -if "%~1"=="4" set "RESOLVED=32" -if "%~1"=="5" set "RESOLVED=33" -if "%~1"=="6" set "RESOLVED=34" -if "%~1"=="7" set "RESOLVED=35" -if "%~1"=="8" set "RESOLVED=36" -if "%~1"=="9" set "RESOLVED=37" -if "%~1"=="10" set "RESOLVED=38" -if "%~1"=="11" set "RESOLVED=39" -if "%~1"=="12" set "RESOLVED=40" -if "%~1"=="13" set "RESOLVED=28" +if "%~1"=="1" set "RESOLVED=28" +if "%~1"=="2" set "RESOLVED=29" +if "%~1"=="3" set "RESOLVED=30" +if "%~1"=="4" set "RESOLVED=31" +if "%~1"=="5" set "RESOLVED=32" +if "%~1"=="6" set "RESOLVED=33" +if "%~1"=="7" set "RESOLVED=34" +if "%~1"=="8" set "RESOLVED=35" +if "%~1"=="9" set "RESOLVED=36" if not defined RESOLVED call :UnknownTask "%~1" if not defined RESOLVED exit /b call :DispatchOne %RESOLVED% @@ -413,14 +417,16 @@ exit /b :ClineOne rem Resolves a Cline submenu-local id to its global task id and runs it. +rem Renumbered 2026-10-29: display order (1-9 ascending, c4/c5 before ALL + +rem shortcuts). Gids unchanged - old local -> gid map in CHANGELOG 2026-10-29. set "RESOLVED=" if "%~1"=="1" set "RESOLVED=44" -if "%~1"=="2" set "RESOLVED=45" -if "%~1"=="3" set "RESOLVED=46" -if "%~1"=="4" set "RESOLVED=47" -if "%~1"=="5" set "RESOLVED=48" -if "%~1"=="6" set "RESOLVED=49" -if "%~1"=="7" set "RESOLVED=50" +if "%~1"=="2" set "RESOLVED=46" +if "%~1"=="3" set "RESOLVED=47" +if "%~1"=="4" set "RESOLVED=49" +if "%~1"=="5" set "RESOLVED=50" +if "%~1"=="6" set "RESOLVED=48" +if "%~1"=="7" set "RESOLVED=45" if "%~1"=="8" set "RESOLVED=51" if "%~1"=="9" set "RESOLVED=52" if not defined RESOLVED call :UnknownTask "%~1" @@ -447,7 +453,7 @@ call :DispatchOne %RESOLVED% exit /b :DispatchOne -rem Runs one task by global id (1-69; 63 unused). Unknown ids print an error. Returns to caller. +rem Runs one task by global id (1-71; 63 unused). Unknown ids print an error. Returns to caller. if "%~1"=="1" (call :Run "src\windows\change_device_id.ps1" & exit /b) if "%~1"=="2" (call :Run "src\windows\reset_cursor.ps1" & exit /b) if "%~1"=="3" (call :Run "src\windows\reset_devin.ps1" & exit /b) @@ -489,32 +495,23 @@ if "%~1"=="24" (call :RunWith "tools\install_ghost_shortcut.ps1" "Check your Des if "%~1"=="25" (call :Detached "ZCode taskbar identity" "-NoProfile" "tools\watch_zcode_taskbar.ps1" "" "Taskbar identity watcher launched in a separate window - leave it open." "It re-stamps any ZCode window that loses its taskbar identity within seconds." & exit /b) if "%~1"=="26" (call :Run "tools\update_ghost.ps1" & exit /b) if "%~1"=="27" (call :Run "tools\diagnose_zcode_freeze.ps1" & exit /b) -if "%~1"=="28" (call :Run "src\windows\reset_autoclaw.ps1" -Target Primary & exit /b) -if "%~1"=="29" (call :Detached "AutoClaw inst1" "-NoProfile" "src\windows\launch_autoclaw_clone.ps1" "" "Launcher opened in a separate window - it closes automatically when done." & exit /b) -if "%~1"=="30" (call :RunWith "tools\install_autoclaw_clone_shortcuts.ps1" "Look for the new AutoClaw inst1 - inst4 shortcuts on your Desktop and in the Start menu." & exit /b) -if "%~1"=="31" (call :Detached "AutoClaw inst2" "-NoProfile" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst2" "Launcher opened in a separate window - it closes automatically when done." & exit /b) -if "%~1"=="32" (call :Detached "AutoClaw inst3" "-NoProfile" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst3" "Launcher opened in a separate window - it closes automatically when done." & exit /b) -if "%~1"=="33" ( - call :StartClone "AutoClaw inst1" "src\windows\launch_autoclaw_clone.ps1" - timeout /t 3 /nobreak >nul - call :StartClone "AutoClaw inst2" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst2" - timeout /t 3 /nobreak >nul - call :StartClone "AutoClaw inst3" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst3" - timeout /t 3 /nobreak >nul - call :StartClone "AutoClaw inst4" "src\windows\launch_autoclaw_clone.ps1" "-Instance inst4" - echo Four launcher windows opened - each closes automatically when done. - echo First runs clone the Primary profile, so expect a short delay per clone. - echo Launch them one at a time the first time to log in once per clone. +if "%~1"=="28" (call :Detached "AutoClaw2 c1" "-NoProfile" "src\windows\launch_autoclaw2_clone.ps1" "" "Launcher opened in a separate window - it closes automatically when done." & exit /b) +if "%~1"=="29" (call :Detached "AutoClaw2 c2" "-NoProfile" "src\windows\launch_autoclaw2_clone.ps1" "-Instance c2" "Launcher opened in a separate window - it closes automatically when done." & exit /b) +if "%~1"=="30" (call :Detached "AutoClaw2 c3" "-NoProfile" "src\windows\launch_autoclaw2_clone.ps1" "-Instance c3" "Launcher opened in a separate window - it closes automatically when done." & exit /b) +if "%~1"=="31" (call :Detached "AutoClaw2 c4" "-NoProfile" "src\windows\launch_autoclaw2_clone.ps1" "-Instance c4" "Launcher opened in a separate window - it closes automatically when done." & exit /b) +if "%~1"=="32" (call :Detached "AutoClaw2 c5" "-NoProfile" "src\windows\launch_autoclaw2_clone.ps1" "-Instance c5" "Launcher opened in a separate window - it closes automatically when done." & exit /b) +if "%~1"=="33" (call :Detached "AutoClaw2 all clones" "-NoProfile" "src\windows\launch_autoclaw2_clones_all.ps1" "" "Sequential all-five launcher opened in a separate window - it closes when done." "Clones launch one at a time with a pause between each - do not launch them in parallel." & exit /b) +if "%~1"=="34" (call :RunWith "tools\install_autoclaw2_clone_shortcuts.ps1" "Look for the new AutoClaw2 c1 - c5 shortcuts on your Desktop and in the Start menu." & exit /b) +if "%~1"=="35" ( + powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_autoclaw2_clone.ps1" -Instance c1 -Status + powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_autoclaw2_clone.ps1" -Instance c2 -Status + powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_autoclaw2_clone.ps1" -Instance c3 -Status + powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_autoclaw2_clone.ps1" -Instance c4 -Status + powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_autoclaw2_clone.ps1" -Instance c5 -Status pause exit /b ) -if "%~1"=="34" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst1 & exit /b) -if "%~1"=="35" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst2 & exit /b) -if "%~1"=="36" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst3 & exit /b) -if "%~1"=="37" (call :Run "src\windows\reset_autoclaw.ps1" -Target inst4 & exit /b) -if "%~1"=="38" (call :Run "src\windows\reset_autoclaw.ps1" -Target All & exit /b) -if "%~1"=="39" (call :RunWith "tools\patch_autoclaw_ports.ps1" "Patch finished - if it reported AutoClaw.exe running, close ALL AutoClaw windows and run this option again." & exit /b) -if "%~1"=="40" (call :Run "src\windows\launch_autoclaw_clone.ps1" -Status & exit /b) +if "%~1"=="36" (call :Run "tools\install_autoclaw2_clone_shortcuts.ps1" -Remove & exit /b) if "%~1"=="41" (call :Detached "ZCode Fifth Instance" "-NoProfile" "src\windows\launch_zcode_second_instance.ps1" "-Instance Fifth" "Launcher opened in a separate window - it closes automatically when done." & exit /b) if "%~1"=="42" (call :RunZcodeReset "src\windows\reset_zcode.ps1" -Target Fifth & exit /b) if "%~1"=="43" (call :Run "tools\sync_zcode_assets.ps1" & exit /b) @@ -523,6 +520,8 @@ if "%~1"=="65" (call :RunZcodeReset "src\windows\reset_zcode.ps1" -Target Sixth if "%~1"=="67" (call :Run "tools\sync_zcode_assets.ps1" -McpOnly -Target All & exit /b) if "%~1"=="68" (call :Detached "ZCode MCP Sync Watcher" "-NoProfile" "tools\watch_zcode_mcp_sync.ps1" "" "Watcher launched in a separate window - leave it open. It syncs MCPs from the Primary on every change - running instances included; a synced definition lands on each instance's next chat." "Log: %LOCALAPPDATA%\watch-zcode-mcp-sync\mcp-sync.log" & exit /b) if "%~1"=="69" (call :Run "tools\watch_zcode_mcp_sync.ps1" -RunOnce -ApplyLive -Target All & exit /b) +if "%~1"=="70" (call :Detached "ZCode Light Worker" "-NoProfile" "src\windows\launch_zcode_cli_light.ps1" "" "Light worker opened in a separate window - type tasks there, empty input exits." "Headless: about a quarter of the RAM of a full instance. Read the model note it prints on first run." & exit /b) +if "%~1"=="71" (call :Detached "ZCode Clone Login" "-NoProfile" "src\windows\launch_zcode_cli_light.ps1" "-Login" "Login window opened - a browser will ask you to sign in with THIS clone's account." "One-time per clone home: it routes light workers and the T3 bridge to the Start Plan instead of the free model." & exit /b) if "%~1"=="44" (call :Detached "Cline c1" "-NoProfile" "src\windows\launch_cline_clone.ps1" "" "Launcher opened in a separate window - it closes automatically when done." & exit /b) if "%~1"=="45" (call :RunWith "tools\install_cline_clone_shortcuts.ps1" "Look for the new Cline c1 - c5 shortcuts on your Desktop and in the Start menu." & exit /b) if "%~1"=="46" (call :Detached "Cline c2" "-NoProfile" "src\windows\launch_cline_clone.ps1" "-Instance c2" "Launcher opened in a separate window - it closes automatically when done." & exit /b) diff --git a/README.md b/README.md index d295941..784e3a2 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ touches, and emits an audit log plus a self-contained restore script. | Reset Qoder | `reset_qoder.ps1` | — | | Reset ZCode (+Qoder stores) | `reset_zcode.ps1` (`-Target Primary\|Secondary\|Third\|Fourth\|Fifth\|Sixth\|Both\|All`) | — | | ZCode clones (Primary + 5 branded instances) | `launch_zcode_second_instance.ps1 -Instance Second\|Third\|Fourth\|Fifth\|Sixth` + `Launch-ZCode-*.bat` | — | +| ZCode light headless worker (no desktop window) | `launch_zcode_cli_light.ps1 -Instance Second\|...\|Sixth` (`-Prompt` / `-Server`) | — | | Reset QoderWork | `reset_qoderwork.ps1` | — | | Reset MiniMax Agent / OpenCode | `reset_minimax_opencode.ps1` | — | | Device fingerprint | `change_device_id.ps1` | `change_device_id.sh Fingerprint` | @@ -86,6 +87,7 @@ Or run a script directly — full examples in .\src\windows\reset_devin.ps1 # Windsurf + Devin Desktop roots, one pass .\src\windows\reset_zcode.ps1 -Target Secondary # survivor instances keep running .\src\windows\launch_zcode_second_instance.ps1 -Instance Third # yellow-branded clone +.\src\windows\launch_zcode_cli_light.ps1 -Instance Second # headless account worker - low RAM ``` ```bash @@ -176,14 +178,14 @@ libraries; the per-app scripts are thin target manifests on top. Details: (per-clone toggles stay local), replaces stale `.zcode\skills` copies with a junction on the shared `~\.agents` store, mirrors the plugin cache; runs automatically before every clone launch. `-McpOnly` syncs the MCP - definitions only and is safe against RUNNING instances — ZCode [24] for a - one-shot run (ZCode [20] for the full sync) + definitions only and is safe against RUNNING instances — ZCode [18] for a + one-shot run (ZCode [17] for the full sync) - `tools/watch_zcode_mcp_sync.ps1` — resident MCP sync watcher: stat-guards the Primary's `~\.zcode\cli\config.json` and re-invokes `sync_zcode_assets.ps1 -McpOnly -Target All` on every change, so all five clones converge within seconds (`-RunOnce`, `-ApplyLive` recycles running clones' app-servers idle-guarded so the open session picks the change up - immediately, `-InstallAutostart`). ZCode [25] (resident) / [26] (one-shot + + immediately, `-InstallAutostart`). ZCode [19] (resident) / [20] (one-shot + apply live). The merge invariant lives in `tools/zcode_mcp_merge.ps1` (unit-tested by `tests/zcode_mcp_merge.Tests.ps1`) - `tools/diagnose_zcode_throttle.ps1` — read-only diagnostic for diff --git a/docs/APP_CLONING_EDGE_CASES.md b/docs/APP_CLONING_EDGE_CASES.md index a0e2192..2ceac11 100644 --- a/docs/APP_CLONING_EDGE_CASES.md +++ b/docs/APP_CLONING_EDGE_CASES.md @@ -20,7 +20,9 @@ theory. AUMID / accent hooks, port-array widening) is silently reverted; clones lose their look, inst4 loses its MCP port. **Handling:** the patch marker carries `patchVersion`; the launcher/shortcuts warn when it is missing; - re-apply via the patch menu entry (ZCode [12] / AutoClaw [11]) after + re-apply via the patch menu entry (ZCode [27]; the AutoClaw v1.20 entry was + retired 2026-10-29 with the v1.20 app - run `tools\patch_autoclaw_ports.ps1` + directly) after EVERY app update. **A + R.** ZCode marker design; AutoClaw risk A2. - **EC-A02 · P0 — An in-clone built-in updater runs `quitAndInstall`** → it wipes the SHARED patched asar mid-session for all instances. **Handling:** @@ -185,7 +187,7 @@ theory. `v8-oom-last-os-error 1455` = ERROR_COMMITMENT_LIMIT); the window "freezes" (drags dead) and the splash-then-close relaunch loop is the post-crash quit path — NOT a hang or a lock. **Handling:** diagnose via - the freeze diagnostic (ZCode [17]); mitigation = larger pagefile / fewer + the freeze diagnostic (ZCode [26]); mitigation = larger pagefile / fewer concurrent instances; relaunching after the quit is safe. **R + D.** Verified 2026-09-25 (Primary+Second died the same second; JS heap only ~478MB → OS commit starvation, not an app leak). @@ -307,7 +309,7 @@ theory. docs) → **Handling:** scripts live unversioned under `src/`; README must not match `reset_[a-z_]+_windows-v\d`. **A.** - **EC-L04 · P2 — Menu-reference drift after renumbering** → **Handling:** - cite menu positions as ` [n]` everywhere (e.g. `ZCode [12]`); + cite menu positions as ` [n]` everywhere (e.g. `ZCode [27]`); a renumber sweep stays mechanical only if the style is followed. **A.** - **EC-L05 · P1 — Secrets committed** (Telegram creds, tokens) → **Handling:** gitignored `.envlocal` at the repo root; watchdogs read diff --git a/docs/AUTOCLAW_CLONES_SPEC.md b/docs/AUTOCLAW_CLONES_SPEC.md index fd8eaa1..c628cf6 100644 --- a/docs/AUTOCLAW_CLONES_SPEC.md +++ b/docs/AUTOCLAW_CLONES_SPEC.md @@ -389,7 +389,9 @@ per-clone AUMID + icon identity — shortcut and window share one identity strin > v12 fixed the three findings of the first live relaunch (§12). The v1 > shortcut-only degradation is superseded: running windows now carry per-clone AUMIDs, > icons and titles. An AutoClaw app update reverts the patch — re-apply via AutoClaw -> menu [11] (the marker auto-upgrades, same rule as the ports patch). +> menu [11] (row retired 2026-10-29 with the v1.20 app — run +> tools\patch_autoclaw_ports.ps1 directly; the marker auto-upgrades, same rule +> as the ports patch). **Contract (v2, unchanged):** every clone (inst1..inst4) presents its own taskbar identity — a separate taskbar button/window group per clone, the clone's color icon @@ -504,7 +506,7 @@ changes operator effort: three logins for inst1–inst3, once each. | A3 | Patching a shipped Electron `app.asar` is outside GHOST's normal per-IDE scope | high | Justified here; called out explicitly — without it the max is 3 clones, not 4 | | A4 | One manual login per clone on first run | medium | Expected and documented; one time, then independent | | A5 | Gateway silently shifts up to +9 ports | medium | Read the bound port back; log drift; never record requested as actual | -| A6 | All instances share one taskbar button (§5.8) | low (was medium) | RESOLVED 2026-10-17, live-verified 2026-10-18 (§7.3c): engine v11 (now v12) wraps both AUMID call sites + stamps the window-level AUMID from the marker-file identity; an app update reverts it — re-apply via AutoClaw menu [11] | +| A6 | All instances share one taskbar button (§5.8) | low (was medium) | RESOLVED 2026-10-17, live-verified 2026-10-18 (§7.3c): engine v11 (now v12) wraps both AUMID call sites + stamps the window-level AUMID from the marker-file identity; an app update reverts it — re-apply via AutoClaw menu [11] (row retired 2026-10-29; run the patch script directly) | | A7 | 4 Electron instances + 4 gateways is RAM/commit heavy | medium | `AGENTS.md` already records a ZCode commit-limit OOM at 4 instances (`v8-oom-last-os-error 1455`); same exposure. Monitor, and drop instance count if it recurs | ## 10. Decisions — RESOLVED 2026-10-08 diff --git a/docs/ZCODE_CHAT_SYNC_WATCHER_PLAN.md b/docs/ZCODE_CHAT_SYNC_WATCHER_PLAN.md index 65c8f16..cbde9a9 100644 --- a/docs/ZCODE_CHAT_SYNC_WATCHER_PLAN.md +++ b/docs/ZCODE_CHAT_SYNC_WATCHER_PLAN.md @@ -2,8 +2,8 @@ Date: 2026-09-23. Status: **mechanism proven end-to-end; one-shot refresh AND error-triggered watcher IMPLEMENTED** as -`tools/refresh_zcode_second_chats.ps1` (one-shot = ZCode submenu [13], watcher = -`-Watch -Target All` = ZCode submenu [14]). The signature-poll watcher draft in §4 is +`tools/refresh_zcode_second_chats.ps1` (one-shot = ZCode submenu [21], watcher = +`-Watch -Target All` = ZCode submenu [23]). The signature-poll watcher draft in §4 is kept for reference; the shipped watcher triggers on failure events instead (see §4 note). @@ -69,7 +69,7 @@ kill Secondary's workspace app-server process(es) ## 4. Watcher design — `tools/watch_zcode_chat_sync.ps1` (new) > **Shipped differently (2026-09-23):** the continuous watcher is the -> `-Watch` mode of `tools/refresh_zcode_second_chats.ps1` (ZCode submenu [14], +> `-Watch` mode of `tools/refresh_zcode_second_chats.ps1` (ZCode submenu [23], > `-Target All`; no separate file). It does NOT poll the store signature > below — per request it tails the agent runtime JSONL logs > (`~/.zcode/cli/log/zcode-*.jsonl`, offset-based incremental reader) and @@ -136,7 +136,7 @@ Monotonic signature; any new/edited chat in EITHER instance bumps it. ### Launcher integration (IMPLEMENTED) -- ZCode submenu `[13]` runs the one-shot variant `tools/refresh_zcode_second_chats.ps1` +- ZCode submenu `[21]` runs the one-shot variant `tools/refresh_zcode_second_chats.ps1` (detect missing chats → recycle Secondary app-server(s) → verify-after). The hot-activity guard does **wait-and-retry** (up to ~90 s, two consecutive idle passes required) instead of hard-failing when a turn is @@ -151,7 +151,7 @@ Monotonic signature; any new/edited chat in EITHER instance bumps it. (D) CPU delta > 0.25 s over a 3 s sample on the exact app-server PID(s) about to be killed (SSE token streaming burns CPU with zero db writes). The continuous watcher is ALSO shipped: same script with `-Watch -Target - All` (ZCode submenu `[14]`, launched detached via `start` per the .bat + All` (ZCode submenu `[23]`, launched detached via `start` per the .bat console-hijack rule) — error-triggered, see the note at the top of §4. - Not auto-started with the Secondary launcher: the app-server recycle is a deliberate, slightly disruptive action; user opts in per run. @@ -167,7 +167,7 @@ Monotonic signature; any new/edited chat in EITHER instance bumps it. - If the branding patch is missing/reverted (app update), the Secondary window title falls back to `ZCode` and the watcher **cannot** distinguish instances → must abort with a loud error rather than guess (never recycle the wrong - instance). Re-run menu `[13]` patch to restore. + instance). Re-run menu `[27]` patch to restore. - Windows-only, PowerShell 5.1-compatible (no `?.`/ternary/`$Input`, `Get-Command python` for sqlite access exactly like `identity_utils.ps1`). diff --git a/docs/ZCODE_RESET_EDGE_CASES_PLAN.md b/docs/ZCODE_RESET_EDGE_CASES_PLAN.md index ba022bb..6fa1613 100644 --- a/docs/ZCODE_RESET_EDGE_CASES_PLAN.md +++ b/docs/ZCODE_RESET_EDGE_CASES_PLAN.md @@ -21,6 +21,14 @@ untouched). Analysis source: five parallel read-only reviews `.zwork/runs/e711490b/`). Line numbers are from the current checkout and are evidence anchors, not contracts. +> **RENUMBERED 2026-10-29** — GHOST.bat renumbered every submenu to display +> order (gids unchanged). Menu numbers below are the PRE-renumber ZCode rows; +> translate on read: [6] Second→[9] · [7] Both→[15] · [8] Third→[10] · +> [9] Fourth→[11] · [10] ALL SIX→[16] · [19] Fifth→[12] · [21] Primary→[14] · +> [23] Sixth→[13] · icon patch [12]→[27]. The W2-2 relaunch list +> "[1]/[3]/[4]/[18]/[41]" mixes old locals and a gid; the current equivalents +> are the five launch rows ZCode [1]-[5]. + --- ## 1. Verified baseline (works today — do not regress) diff --git a/docs/cli.md b/docs/cli.md index 09e1990..1351024 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -3,14 +3,14 @@ Prefer the interactive launchers — **`GHOST.bat`** (Windows, double-click) or **`./ghost.sh`** (Linux). This page is the direct-command cheat sheet for scripts and CI. `GHOST.bat` groups its tasks into six submenus with -continuous local numbering (IDE resets [1]-[9] / ZCode Multi-Instance & -Clones [1]-[26] / System & GHOST Maintenance [1]-[3] / AutoClaw -Multi-Instance & Clones [1]-[13] / Cline Multi-Instance & Clones +continuous local numbering (IDE resets [1]-[8] / ZCode Multi-Instance & +Clones [1]-[27] / System & GHOST Maintenance [1]-[3] / AutoClaw2 +Multi-Instance & Clones [1]-[9] / Cline Multi-Instance & Clones [1]-[9] / OpenCode Multi-Instance & Clones [1]-[10]); chain several tasks in one prompt using the numbers shown in that submenu (e.g. `1 3 4` inside ZCode), or from the main menu type a sub-path like `2 1 3 4` (open ZCode, run its [1] [3] [4]) or a bare global id — this page cites menu positions as -` [n]`, e.g. `ZCode [12]` for the icon patch. `[U]` on the main menu +` [n]`, e.g. `ZCode [27]` for the icon patch. `[U]` on the main menu (and Maintenance [2]) runs the self-updater. ## Windows resets (PowerShell as Administrator, from the repo root) @@ -40,11 +40,13 @@ powershell -ExecutionPolicy Bypass -File "src\windows\spoof_wmi_serials.ps1" -Dr ``` Menu equivalents for the reset targets: `reset_zcode.ps1 -Target Primary` = -IDE Resets [7] **and** ZCode [21] (the same task from both menus); +IDE Resets [7] **and** ZCode [14] (the same task from both menus); `-Target Secondary` / `Both` / `Third` / `Fourth` / `Fifth` / `Sixth` / `All` = ZCode -[6] / [7] / [8] / [9] / [19] / [23] / [10]. `reset_autoclaw.ps1 -Target Primary` = -IDE Resets [9] **and** AutoClaw [13]; `-Target inst1..inst4` = AutoClaw -[6]–[9]; `-Target All` = AutoClaw [10]. +[9] / [15] / [10] / [11] / [12] / [13] / [16]. `reset_autoclaw.ps1` (the v1.20 +app) has no menu entries since 2026-10-29 - the v1.20 app was uninstalled from +the dev host and the GHOST.bat AutoClaw2 submenu replaced its items; run the +script directly on hosts that still run v1.20. AutoClaw2 has no reset script +by design: stop the instance and delete its `AutoClaw2ClonesHome\` folder. ## ZCode captcha watchdog (unattended; no admin needed) @@ -80,10 +82,26 @@ resident watchers an install needs are alive and set to autostart (launcher step 2e, mutex-guarded, best-effort): the MCP sync watcher and the taskbar identity watcher — you never have to start them from GHOST manually. All instances share one install, so one update covers all — but re-run the -icon patch (`tools\patch_zcode_icon_override.ps1`, ZCode [12]) after every app +icon patch (`tools\patch_zcode_icon_override.ps1`, ZCode [27]) after every app update; it is what makes the `ZCODE_ICON_DIR` / `ZCODE_AUMID_SUFFIX` / `ZCODE_ACCENT_HEX` / `ZCODE_INSTANCE_NAME` branding overrides work. +### ZCode light headless worker (no desktop window; ZCode [7]) + +```powershell +powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_zcode_cli_light.ps1" -Instance Second # interactive REPL +powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_zcode_cli_light.ps1" -Instance Fifth -Prompt "task" # one-shot +powershell -NoProfile -ExecutionPolicy Bypass -File "src\windows\launch_zcode_cli_light.ps1" -Instance Third -Server # stdio worker +``` + +Runs a clone's account headless (`resources\glm\zcode.cjs -p` / `app-server` +under the system node): about a quarter of the RAM of a full desktop instance, +sessions isolated to that clone's home and shareable with its desktop app. The +interactive TUI cannot run standalone (`@zcode/tui` lives inside app.asar) and +a home without a standalone `zcode login zai` runs tasks on the free +opencode-zen model, not the Start Plan — the launcher prints the one-time +login recipe when it detects that. Full findings: [ZCODE_LIGHT_MODE.md](ZCODE_LIGHT_MODE.md). + ## ZCode clone shortcuts (Desktop + Start menu; per-user, no admin needed) ```powershell @@ -106,8 +124,8 @@ powershell -NoProfile -ExecutionPolicy Bypass -File "tools\refresh_zcode_second_ Shows chats created in another instance inside a running sidebar by recycling the target's app-server (auto-respawn reseeds its index; verify-after). ZCode -[13] = Second only, ZCode [15] = all instances. A hot-activity guard waits out -in-flight turns (`-Force` bypasses). Watcher mode (`-Watch`, ZCode [14]) tails +[21] = Second only, ZCode [22] = all instances. A hot-activity guard waits out +in-flight turns (`-Force` bypasses). Watcher mode (`-Watch`, ZCode [23]) tails the CLI JSONL logs for terminal failures (captcha stall / quota / rate-limit) and refreshes every RUNNING instance on a 300 s cooldown. @@ -128,13 +146,13 @@ mirrors the plugin cache + marketplaces. A running instance is skipped with a warning (skills/plugin mirroring must not race a live app — close it first, or add `-McpOnly`); an unseeded home is skipped (the launcher seeds it on first launch). Every write is backed up and verified by re-read; audit -trail at `\.zcode\asset-sync-audit.jsonl`. ZCode [20]. The +trail at `\.zcode\asset-sync-audit.jsonl`. ZCode [17]. The launcher also runs it automatically before every clone launch (step 2d). With `-McpOnly` only the MCP definitions sync, and that is verified safe against RUNNING instances (2026-10-27: the app holds no handle on config.json, never rewrites it on exit, and reads `mcp.servers` at every -app-server spawn — one per new session): ZCode [24]. +app-server spawn — one per new session): ZCode [18]. ## ZCode MCP sync watcher (per-user, no admin needed) @@ -151,12 +169,12 @@ seconds, running instances included. A synced definition is picked up by each instance's next chat automatically (every new session re-reads the config at app-server spawn — no restart). The first pass on start converges existing drift; a deep re-verify runs every ~5 min. `-ApplyLive` (ZCode -[26]) additionally recycles running instances' app-servers after a real +[20]) additionally recycles running instances' app-servers after a real change — idle-guarded, never mid-turn — so the currently open session gets the new MCP immediately. `-InstallAutostart` writes a hidden Startup-folder shortcut (like the taskbar watcher); single-instance via a named mutex plus a startup process scan. Log: `%LOCALAPPDATA%\watch-zcode-mcp-sync\mcp-sync.log`. -ZCode [25] (resident) / [26] (one-shot + live apply). You normally never +ZCode [19] (resident) / [20] (one-shot + live apply). You normally never start it yourself: every clone launch (launcher step 2e) starts it hidden and installs its autostart shortcut if missing — install-and-forget. @@ -169,7 +187,7 @@ powershell -NoProfile -ExecutionPolicy Bypass -File "tools\diagnose_zcode_freeze Explains the "window drags but content is dead" freeze from the app's own telemetry: scans every instance's `\.zcode\v2\logs` for renderer / child-process deaths and freeze events, reads the crash archive's dump -annotations, and prints live RAM / commit / pagefile pressure. ZCode [17]. +annotations, and prints live RAM / commit / pagefile pressure. ZCode [26]. Read-only. Verified root cause (2026-09-25): renderer OOM from OS commit-limit exhaustion with 4 instances; the splash-then-close relaunch is the app's post-crash quit path, not corruption — just launch again. See @@ -257,8 +275,8 @@ Each clone gets its own state tree, web login profile and hub/sidecar ports; the launcher neutralizes the app's single-instance hidden window and aborts a second copy on the same data. First run per clone: ONE manual sign-in. Menu equivalents: launch c1/c2/c3/c4/c5 = Cline -[1]/[3]/[4]/[6]/[7]; all five = Cline [5]; status = Cline [8]; -shortcuts = Cline [2] (`-Remove` = [9]). +[1]/[2]/[3]/[4]/[5]; all five = Cline [6]; status = Cline [8]; +shortcuts = Cline [7] (`-Remove` = [9]). ## OpenCode multi-instance (5 clones + Primary; per-user, no admin needed) @@ -302,8 +320,9 @@ single-instance lock (N copies coexist natively), and `AUTOCLAW_PROFILE_ROOT` relocates the legacy v1.x migration source so no clone ever reads a live Primary's state. The app generates a fresh `device\device-id.json` per profile (no identity seeding, no credential -copying). NOTE: AutoClaw2 is the one suite NOT wired into `GHOST.bat` — -run these commands directly. First run per clone: ONE manual sign-in. +copying). First run per clone: ONE manual sign-in. Menu equivalents: launch +c1/c2/c3/c4/c5 = AutoClaw2 [1]-[5]; all five = [6]; shortcuts = [7] +(`-Remove` = [9]); status = [8]. ## Linux diff --git a/docs/getting-started.md b/docs/getting-started.md index 4fd8889..13eb6f5 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -54,7 +54,7 @@ repo root, or use `GHOST.bat` (interactive menu). - 27 steps + `[6b/27]`: everything Qoder-side above (for the Qoder stores ZCode shares) plus `.updaterId`, `telemetry-state.json` (`deviceMid`), credentials OAuth clear, **config.json provider `apiKey` strip (fixes the Unlink → Checking loop)**, coding-plan-cache invalidation, RUM store, `setting.json` (`deviceSid`), session/embedded-browser Chromium data - Chat stores (`tasks-index.sqlite`, checkpoints, IndexedDB webview data, Local Storage leveldb) are never touched - Timestamped backups + audit log under `%APPDATA%\ZCode\ID_Backups\` (per-target: Secondary uses `%APPDATA%\ZCode-Second\ID_Backups\`, Third `%APPDATA%\ZCode-Third`, Fourth `%APPDATA%\ZCode-Fourth`, Fifth `%APPDATA%\ZCode-Fifth`, Sixth `%APPDATA%\ZCode-Sixth`) -- `-Target Primary` (default reset scope + Qoder steps; menu: ZCode [21] or IDE Resets [7] — both run the same reset), `-Target Secondary|Third|Fourth|Fifth|Sixth` (selective tree-kill, survivors keep running, Qoder untouched), `-Target Both` (Secondary then Primary, back-compat), `-Target All` (Third + Fourth + Fifth + Sixth + Secondary, then Primary incl. Qoder; each child generates its OWN fresh ID set — IDs are never duplicated across instances) +- `-Target Primary` (default reset scope + Qoder steps; menu: ZCode [14] or IDE Resets [7] — both run the same reset), `-Target Secondary|Third|Fourth|Fifth|Sixth` (selective tree-kill, survivors keep running, Qoder untouched), `-Target Both` (Secondary then Primary, back-compat), `-Target All` (Third + Fourth + Fifth + Sixth + Secondary, then Primary incl. Qoder; each child generates its OWN fresh ID set — IDs are never duplicated across instances) **Before running:** close only the TARGET instance (the script kills it; survivors keep running in Single mode). Run PowerShell as Administrator. After the reset, ZCode prompts for a fresh login. `change_device_id.ps1` is machine-wide and affects ALL instances + Qoder. @@ -63,26 +63,26 @@ repo root, or use `GHOST.bat` (interactive menu). Run up to six fully independent ZCode windows side by side (separate Electron locks, separate SQLite stores, separate accounts): ```powershell -# Option A — menu: GHOST.bat → ZCode [1] Second / [3] Third / [4] Fourth / [18] Fifth / [22] Sixth / [5] all clones +# Option A — menu: GHOST.bat → ZCode [1] Second / [2] Third / [3] Fourth / [4] Fifth / [5] Sixth / [6] all clones # Option B — double-click: src\windows\Launch-ZCode-Second.bat / -Third.bat / -Fourth.bat / -Fifth.bat / -Sixth.bat powershell -File src\windows\launch_zcode_second_instance.ps1 -Instance Third # example ``` -First launch of each clone copies history (`~\.zcode` → `~\ZCodeSecondHome\.zcode` / `ZCodeThirdHome` / `ZCodeFourthHome` / `ZCodeFifthHome` / `ZCodeSixthHome`, journals excluded), then scrubs the clone to fresh independent IDs (deviceMid, deviceSid, OAuth tokens, provider apiKeys) and reconciles Telegram bots via sha8 credential comparison across both `bot-config.json` and `bot-config.v3.json` (duplicates of Primary disabled, unique clone bots preserved with a v2 marker — a deliberate unique bot is never reverted; see [docs/ZCODE_TELEGRAM_BOTS.md](ZCODE_TELEGRAM_BOTS.md)). Later launches reuse the independent profile. Isolation is driven by five process-scoped env vars (`ZCODE_DATA_BASE_DIR`, `ZCODE_DESKTOP_USER_DATA_DIR`, `ZCODE_DESKTOP_SESSION_DATA_DIR`, `ZCODE_DESKTOP_HOME_DIR`, `HOME`) — the app overwrites `--user-data-dir`, so env vars are the only working lever. All instances share one install: a single update covers all, but re-run the icon patch (ZCode [12]) after updates. Clone branding: Second = blue, Third = yellow, Fourth = green, Fifth = red, Sixth = orange (separate taskbar buttons + window titles "ZCode Blue"/"ZCode Yellow"/"ZCode Green"/"ZCode Red"/"ZCode Orange"). One Telegram token = one polling instance (two pollers on one token cause HTTP 409 conflicts and random cross-account billing); `tools\set_zcode_bot.ps1 -VerifyOnly` audits all 6 homes (sha8 only, never values). +First launch of each clone copies history (`~\.zcode` → `~\ZCodeSecondHome\.zcode` / `ZCodeThirdHome` / `ZCodeFourthHome` / `ZCodeFifthHome` / `ZCodeSixthHome`, journals excluded), then scrubs the clone to fresh independent IDs (deviceMid, deviceSid, OAuth tokens, provider apiKeys) and reconciles Telegram bots via sha8 credential comparison across both `bot-config.json` and `bot-config.v3.json` (duplicates of Primary disabled, unique clone bots preserved with a v2 marker — a deliberate unique bot is never reverted; see [docs/ZCODE_TELEGRAM_BOTS.md](ZCODE_TELEGRAM_BOTS.md)). Later launches reuse the independent profile. Isolation is driven by five process-scoped env vars (`ZCODE_DATA_BASE_DIR`, `ZCODE_DESKTOP_USER_DATA_DIR`, `ZCODE_DESKTOP_SESSION_DATA_DIR`, `ZCODE_DESKTOP_HOME_DIR`, `HOME`) — the app overwrites `--user-data-dir`, so env vars are the only working lever. All instances share one install: a single update covers all, but re-run the icon patch (ZCode [27]) after updates. Clone branding: Second = blue, Third = yellow, Fourth = green, Fifth = red, Sixth = orange (separate taskbar buttons + window titles "ZCode Blue"/"ZCode Yellow"/"ZCode Green"/"ZCode Red"/"ZCode Orange"). One Telegram token = one polling instance (two pollers on one token cause HTTP 409 conflicts and random cross-account billing); `tools\set_zcode_bot.ps1 -VerifyOnly` audits all 6 homes (sha8 only, never values). ### 5c. ZCode clone utilities (`tools/`) | Menu | Script | What it does | |---|---|---| -| ZCode [12] | `tools\patch_zcode_icon_override.ps1` | One-time `app.asar` patch (engine v8) enabling the `ZCODE_ICON_DIR` / `ZCODE_AUMID_SUFFIX` / `ZCODE_ACCENT_HEX` / `ZCODE_INSTANCE_NAME` overrides — per-clone icon, separate taskbar button + pins, accent color, "ZCode " window title — plus **bidi auto-direction** in the chat: every paragraph/line auto-detects Arabic RTL vs English LTR, code blocks stay LTR, and `ZCODE_BIDI_OFF=1` disables it per launch. Auto-detects the install dir; re-run after **every ZCode app update**. `-Restore` rolls back, `-Force` re-patches, `-InstallDir` overrides detection; the marker file auto-upgrades patches made by older engines. | -| ZCode [2] | `tools\install_zcode_second_shortcuts.ps1` | Desktop + Start-menu shortcuts for all five clones (`ZCode Second/Third/Fourth/Fifth/Sixth.lnk`), each stamped with its own AppUserModel ID so taskbar pins never collide with the Primary. `-Instance Second\|Third\|Fourth\|Fifth\|Sixth` scopes, `-Remove` uninstalls, `-RepairPrimaryAumid` strips a stray clone AUMID from the Primary's `ZCode.lnk`. | -| ZCode [13] / [15] | `tools\refresh_zcode_second_chats.ps1` | Shows chats created in another instance inside a running sidebar, no app restart: finds shared-store chats missing from the target's tasks-index, recycles its app-server(s) (auto-respawn reseeds the index), then verifies. `-Target Primary\|Second\|Third\|Fourth\|Fifth\|Sixth\|All`; a hot-activity guard waits out in-flight turns (up to ~90 s, `-Force` bypasses). ZCode [13] = Second only, [15] = all instances. | -| ZCode [14] | same script, `-Watch -Target All` | Detached watcher: tails the CLI JSONL logs for terminal failures (captcha stall / quota / rate-limit — same signatures as `watch_zcode_captcha.ps1`) and refreshes every RUNNING instance on a 300 s cooldown. | -| ZCode [16] | `tools\watch_zcode_taskbar.ps1` | Resident taskbar-identity watcher: re-stamps `System.AppUserModel.ID` on every ZCode main window every 5 s (heals merges + fresh/splash-swapped windows), self-heals a hijacked Primary `ZCode.lnk` every ~5 m. `-RunOnce`, `-CheckPrimaryHijack`, `-InstallAutostart`/`-RemoveAutostart`. | -| ZCode [17] | `tools\diagnose_zcode_freeze.ps1` | Read-only freeze diagnostic: scans each instance's logs for renderer/child-process deaths + freeze events, reads crash-dump annotations, prints live RAM/commit pressure. `-Days N` widens the window. | -| ZCode [20] | `tools\sync_zcode_assets.ps1` | Primary→clone asset sync: MCP server definitions (per-clone toggles stay local), `.agents` skills junction, plugin-cache mirror; backup + verify-after + JSONL audit. `-Target Second\|Third\|Fourth\|Fifth\|Sixth\|All`, `-DryRun`; runs automatically before every clone launch. | -| ZCode [24] | same script, `-McpOnly -Target All` | One-shot MCP-definitions-only sync, safe against RUNNING instances (2026-10-27: the app holds no handle on `config.json`, never rewrites it on exit, and re-reads `mcp.servers` at every app-server spawn) — a synced definition lands on each clone's next chat with no restart. | -| ZCode [25] / [26] | `tools\watch_zcode_mcp_sync.ps1` | Resident MCP sync watcher: stat-guards the Primary's `~\.zcode\cli\config.json` and re-invokes the `-McpOnly` sync on every change (first pass converges drift, deep re-verify every ~5 min). [26] = one-shot with `-ApplyLive`, which additionally recycles running clones' app-servers idle-guarded (never mid-turn) so the currently open session gets the new MCP immediately. `-InstallAutostart` writes a hidden Startup shortcut. Log: `%LOCALAPPDATA%\watch-zcode-mcp-sync\mcp-sync.log`. | +| ZCode [27] | `tools\patch_zcode_icon_override.ps1` | One-time `app.asar` patch (engine v8) enabling the `ZCODE_ICON_DIR` / `ZCODE_AUMID_SUFFIX` / `ZCODE_ACCENT_HEX` / `ZCODE_INSTANCE_NAME` overrides — per-clone icon, separate taskbar button + pins, accent color, "ZCode " window title — plus **bidi auto-direction** in the chat: every paragraph/line auto-detects Arabic RTL vs English LTR, code blocks stay LTR, and `ZCODE_BIDI_OFF=1` disables it per launch. Auto-detects the install dir; re-run after **every ZCode app update**. `-Restore` rolls back, `-Force` re-patches, `-InstallDir` overrides detection; the marker file auto-upgrades patches made by older engines. | +| ZCode [8] | `tools\install_zcode_second_shortcuts.ps1` | Desktop + Start-menu shortcuts for all five clones (`ZCode Second/Third/Fourth/Fifth/Sixth.lnk`), each stamped with its own AppUserModel ID so taskbar pins never collide with the Primary. `-Instance Second\|Third\|Fourth\|Fifth\|Sixth` scopes, `-Remove` uninstalls, `-RepairPrimaryAumid` strips a stray clone AUMID from the Primary's `ZCode.lnk`. | +| ZCode [21] / [22] | `tools\refresh_zcode_second_chats.ps1` | Shows chats created in another instance inside a running sidebar, no app restart: finds shared-store chats missing from the target's tasks-index, recycles its app-server(s) (auto-respawn reseeds the index), then verifies. `-Target Primary\|Second\|Third\|Fourth\|Fifth\|Sixth\|All`; a hot-activity guard waits out in-flight turns (up to ~90 s, `-Force` bypasses). ZCode [21] = Second only, [22] = all instances. | +| ZCode [23] | same script, `-Watch -Target All` | Detached watcher: tails the CLI JSONL logs for terminal failures (captcha stall / quota / rate-limit — same signatures as `watch_zcode_captcha.ps1`) and refreshes every RUNNING instance on a 300 s cooldown. | +| ZCode [25] | `tools\watch_zcode_taskbar.ps1` | Resident taskbar-identity watcher: re-stamps `System.AppUserModel.ID` on every ZCode main window every 5 s (heals merges + fresh/splash-swapped windows), self-heals a hijacked Primary `ZCode.lnk` every ~5 m. `-RunOnce`, `-CheckPrimaryHijack`, `-InstallAutostart`/`-RemoveAutostart`. | +| ZCode [26] | `tools\diagnose_zcode_freeze.ps1` | Read-only freeze diagnostic: scans each instance's logs for renderer/child-process deaths + freeze events, reads crash-dump annotations, prints live RAM/commit pressure. `-Days N` widens the window. | +| ZCode [17] | `tools\sync_zcode_assets.ps1` | Primary→clone asset sync: MCP server definitions (per-clone toggles stay local), `.agents` skills junction, plugin-cache mirror; backup + verify-after + JSONL audit. `-Target Second\|Third\|Fourth\|Fifth\|Sixth\|All`, `-DryRun`; runs automatically before every clone launch. | +| ZCode [18] | same script, `-McpOnly -Target All` | One-shot MCP-definitions-only sync, safe against RUNNING instances (2026-10-27: the app holds no handle on `config.json`, never rewrites it on exit, and re-reads `mcp.servers` at every app-server spawn) — a synced definition lands on each clone's next chat with no restart. | +| ZCode [19] / [20] | `tools\watch_zcode_mcp_sync.ps1` | Resident MCP sync watcher: stat-guards the Primary's `~\.zcode\cli\config.json` and re-invokes the `-McpOnly` sync on every change (first pass converges drift, deep re-verify every ~5 min). [20] = one-shot with `-ApplyLive`, which additionally recycles running clones' app-servers idle-guarded (never mid-turn) so the currently open session gets the new MCP immediately. `-InstallAutostart` writes a hidden Startup shortcut. Log: `%LOCALAPPDATA%\watch-zcode-mcp-sync\mcp-sync.log`. | | — (CLI only) | `tools\diagnose_zcode_throttle.ps1` | Read-only throttle diagnostic for "Reconnecting... x/10" / "The system is busy..." turn failures: lists Start-Plan admission-busy retries + failed turns with their cause chain (`providerCode 3009` model concurrency), an hourly histogram and a per-session rollup. Verified root cause (2026-10-27): server-side admission control, NOT a device/IP ban. No menu entry. | ### 6. Reset QoderWork ID (`reset_qoderwork.ps1`) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 7d92986..5d10f07 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -109,7 +109,7 @@ see [docs/ZCODE_TELEGRAM_BOTS.md](ZCODE_TELEGRAM_BOTS.md). The per-clone branding rides on an `app.asar` patch (`ZCODE_ICON_DIR`, `ZCODE_AUMID_SUFFIX`, `ZCODE_ACCENT_HEX`, `ZCODE_INSTANCE_NAME`) that a ZCode -app update silently reverts. Re-apply it once — `GHOST.bat` → ZCode [12], or +app update silently reverts. Re-apply it once — `GHOST.bat` → ZCode [27], or `tools\patch_zcode_icon_override.ps1` — and every clone restores its icon, accent color, taskbar button and "ZCode " window title. @@ -128,7 +128,7 @@ exhaustion, not an app leak, a GPU problem, or a GHOST-side fault. What to do: -- Run the diagnostic: `GHOST.bat` → ZCode [17] +- Run the diagnostic: `GHOST.bat` → ZCode [26] (`tools\diagnose_zcode_freeze.ps1`) — prints the per-instance crash timeline, dump annotations and live commit pressure. - After the splash-then-close, just launch the instance again. The quit path @@ -172,7 +172,7 @@ The sync chain is: Primary `~\.zcode\cli\config.json` → `tools\sync_zcode_assets.ps1 -McpOnly -Target All` → each clone's OWN `\.zcode\cli\config.json`. Debug order: -- One-shot convergence: `GHOST.bat` → ZCode [26] (sync + apply live) or [24] +- One-shot convergence: `GHOST.bat` → ZCode [20] (sync + apply live) or [18] (sync only). Both are safe against RUNNING instances — verified 2026-10-27: the app holds no handle on `config.json`, never rewrites it on exit, and re-reads `mcp.servers` at every app-server spawn, so a synced definition @@ -181,21 +181,21 @@ The sync chain is: Primary `~\.zcode\cli\config.json` → second copy. A silent log is normal while stores are correct. Log: `%LOCALAPPDATA%\watch-zcode-mcp-sync\mcp-sync.log`. - The FULL asset sync (skills junction + plugin cache mirror) still requires - the target clones closed first (ZCode [20]) — only `-McpOnly` is live-safe. + the target clones closed first (ZCode [17]) — only `-McpOnly` is live-safe. ## Chats from one ZCode instance don't appear in another instance's sidebar All instances share one session store, but each sidebar index is seeded at app-server spawn with no snapshot backfill — the data is there, the index is -stale. Refresh without restarting the app: `GHOST.bat` → ZCode [13] (Second -only) or [15] (all instances), or keep the detached watcher running (ZCode [14], +stale. Refresh without restarting the app: `GHOST.bat` → ZCode [21] (Second +only) or [22] (all instances), or keep the detached watcher running (ZCode [23], `-Watch -Target All`) to auto-refresh every running instance on quota/captcha failures. The hot-activity guard may defer the refresh while a turn streams; `-Force` bypasses it. ## ZCode windows stay merged in one taskbar button even though identities are stamped -The watcher (ZCode [16]) stamps every window's `System.AppUserModel.ID`, but a +The watcher (ZCode [25]) stamps every window's `System.AppUserModel.ID`, but a taskbar group that was formed while identities were still missing can PERSIST after the stamps land — the shell does not always re-evaluate an existing group, and a stale group can even keep the WRONG ICON (verified 2026-09-26: @@ -221,7 +221,7 @@ If the watcher is running it re-stamps the final value within one interval even if the kick script dies mid-toggle, so this is safe. A silent watcher log does NOT mean the watcher is dead — check the mutex first (a second instance logs "watcher already running"). A watcher process started BEFORE -a script edit keeps the old code — close its window and relaunch ZCode [16]. +a script edit keeps the old code — close its window and relaunch ZCode [25]. ## A clone launched with the Primary's profile or taskbar icon @@ -235,7 +235,7 @@ A pin rewrite can also empty that shortcut icon field (verified 2026-09-28: the hijacked Start-menu ZCode.lnk carried dev.zcode.app.4 with an empty icon, so a green clone running alone showed the Primary icon even though its window identity was correct). -RepairPrimaryAumid now restores the Primary shortcut -icon to ,0 too. The resident watcher (ZCode [16]) self-heals a hijack +icon to ,0 too. The resident watcher (ZCode [25]) self-heals a hijack every ~5 min (REPAIR/FAIL logged to taskbar.log); -RunOnce -CheckPrimaryHijack repairs once without starting the resident loop. Restart the resident watcher after any watcher-script edit: an old copy keeps the old code. diff --git a/tools/sync_zcode_assets.ps1 b/tools/sync_zcode_assets.ps1 index 48b054a..b59f5eb 100644 --- a/tools/sync_zcode_assets.ps1 +++ b/tools/sync_zcode_assets.ps1 @@ -1,4 +1,4 @@ -#Requires -Version 5.1 +#Requires -Version 5.1 <# .SYNOPSIS Sync user-scope assets (MCP server definitions, skills, plugin cache) from @@ -65,7 +65,7 @@ instances (see Guards). It is also invoked on every Primary config change by tools\watch_zcode_mcp_sync.ps1. - GHOST.bat ZCode submenu [20] (all areas, stopped instances) and [24] + GHOST.bat ZCode submenu [17] (all areas, stopped instances) and [18] (MCP-only, live); also invoked per-launch by src\windows\launch_zcode_second_instance.ps1 (step 2d, pre-launch). #> diff --git a/tools/watch_zcode_mcp_sync.ps1 b/tools/watch_zcode_mcp_sync.ps1 index d3f9f57..770e357 100644 --- a/tools/watch_zcode_mcp_sync.ps1 +++ b/tools/watch_zcode_mcp_sync.ps1 @@ -1,4 +1,4 @@ -#Requires -Version 5.1 +#Requires -Version 5.1 <# .SYNOPSIS Resident watcher: whenever the Primary ZCode MCP config changes @@ -26,7 +26,7 @@ - Sync pass: first pass on start converges the drift; afterwards only on Primary signature change (mtime+size, debounced ~1s); a deep re-verify runs every 60 passes (~5 min at the default interval). - - -ApplyLive (opt-in; GHOST.bat ZCode [26] uses it one-shot): after a + - -ApplyLive (opt-in; GHOST.bat ZCode [20] uses it one-shot): after a sync, recycle the app-server(s) of every RUNNING target instance so the new definitions load immediately. Same mechanics as refresh_zcode_second_chats.ps1: idle-guarded (never mid-turn, never @@ -39,7 +39,7 @@ [-Target Second|Third|Fourth|Fifth|Sixth|All] [-InstallAutostart | -RemoveAutostart] - GHOST.bat ZCode submenu [25] (resident) and [26] (one-shot sync + live + GHOST.bat ZCode submenu [19] (resident) and [20] (one-shot sync + live apply). Log: %LOCALAPPDATA%\watch-zcode-mcp-sync\mcp-sync.log .Notes