Jump to content

MindAttic.Orchestrator/MESH

From MindAttic Docs

The Orchestrator mesh: user guide

The mesh lets several Windows 11 PCs work as one Orchestrator. Every PC runs its own daemon, dashboard and CLIs. All of them share one ticket database. This page says what you see, how to add a PC, how to remove one, and what happens when something breaks. The operator side (backups, restore, settings) is in Mesh operations. The design record is Mesh architecture.

The shared server is the machine named mindattic-01 on your tailnet. Nothing in the mesh is reached over the public internet: every connection goes through Tailscale.

What the mesh is

  • Every PC is a peer. Each runs its own CLIs and can work on its own. Joining the mesh adds abilities and removes none. No PC is the boss, so any one of them can be off.
  • One shared ticket database. Tickets live on the shared server, not on one PC. Every PC reads and writes them there. A PC that is not in a mesh keeps working exactly as before ("a mesh of one").
  • Exactly-once claims (M.ORCH-T2565). A ticket is claimed by one CLI on one PC at a time. The claim is a lease the claiming PC's daemon renews every ClaimLeaseMinutes / 3 (the lease is 10 minutes by default). If the PC goes quiet, the claim shows as orphaned and the ticket goes back in the queue only after a further ClaimOrphanGraceMinutes (30 by default). A stale holder can never close a ticket another PC has taken over.
  • Pull before work (M.ORCH-T2569). Before a CLI is handed a ticket, its checkout is brought up to date: fetch, then fast-forward, or a merge on a clean tree that has local commits (aborted on a conflict). Uncommitted work is never touched.
  • Cluster pacing (M.ORCH-T2570 to T2572). A Claude login can be signed in on several PCs. Each PC publishes its burn for each login; the pace is computed on the sum, and the subagent allowance is split by demand. The login stops at its 5-hour and weekly cutoffs once, not once per PC. The usage report shows each login's cluster total and every PC's share.
  • Type into any CLI from any PC (M.ORCH-T2556 to T2558). The Team Wall on each PC lists every PC's CLIs. A CLI that runs on another PC takes your keystrokes. See "One keyboard per CLI" below.
  • Lost and out-of-date PCs are shown. See "What the indicators mean".

What you see

Team Wall. The wall merges the tiles of every PC. A tile for a CLI on another PC works like a local one.

One keyboard per CLI. A CLI has one keyboard holder at a time. Your keystrokes are delivered when you hold the keyboard, or when the holder has been idle for InputHandoffSeconds (2 by default). The keyboard then passes to you. Keystrokes from a non-holder inside that window are dropped, so two half-typed lines never mix into one prompt. The frame shows who is typing, and "Take keyboard" takes it at once.

Logins grid (M.ORCH-T2593). The dashboard's accounts panel shows a grid of machine by login. Each cell says whether that login is signed in on that PC.

  • A login signed in on this PC shows "Signed in".
  • A login missing on this PC shows a Sign in button.
  • A login missing on another PC shows the command to run on that PC.

Only the login's email address and the signed-in flag leave a PC. The grid refreshes every MeshDashboardReadSeconds (30 by default).

What the indicators mean

Indicator Where Meaning
"LAPTOP unreachable since 14:02" Team Wall tiles, greyed That PC has stopped sending its heartbeat for more than MeshPeerStaleSeconds (600 s). Its tiles are paused, not deleted. They go live again by themselves.
Orphaned claim with a requeue time Team Wall header A ticket held by a lost PC. The time is the later of the lease expiry and the end of any outage, plus ClaimOrphanGraceMinutes.
"LAPTOP needs update" That PC's chip on every Team Wall The PC runs an older mesh protocol than the newest one seen. It can still watch and type, but it is refused claims, pacing and placement until it is updated (M.ORCH-T2568).
"Shared database unreachable since HH:MM - no new tickets" Dashboard menu bar This PC cannot reach the shared server. See the next section.

When the shared server is down

The shared server and the link to it are the one thing the mesh cannot do without. While it is unreachable:

  • No new claims are granted on any PC. A ticket is never handed out as if it had been claimed.
  • Running work continues. Every CLI keeps going, you can still type into CLIs on reachable PCs, and git commits and pushes still work, because git does not use the database.
  • Pacing carries on alone. Each PC paces each login with its allowance divided by the PCs last seen running it, and stops MeshOfflinePaceMarginPercent points (3 by default) below each cutoff.
  • The daemon logs the outage once. Each call waits at most MeshConnectTimeoutSeconds (5 s), so the daemon's tick never stalls.

When the server returns, each PC renews its own claims first, then sets a recovery time. No claim is put back in the queue until ClaimOrphanGraceMinutes after that, because silence during an outage does not mean the holder is dead.

Not built yet: the Tickets CLI serving reads from its local copy while the server is down. Until then, ticket reads fail during an outage unless the local copy is known to be current.

Add a machine with one click

You need a Windows 11 PC, an internet connection, and the owner's Tailscale and GitHub accounts.

  1. Install Tailscale on the new PC and sign it in with the same account as your other machines. Setup stops with instructions if Tailscale is missing or signed out.
  2. Run setup, either way:
    • double-click Setup-Node.cmd in a copy of this repo; or
    • paste this into PowerShell:
      irm https://raw.githubusercontent.com/mindattic/MindAttic.Orchestrator/main/setup-node.ps1 | iex
  3. Answer the three owner prompts:
    • UAC. One prompt, for the administrator part: the D: and R: drives (folders mapped at every boot, or a blank disk with -FormatBlankDisk), long paths, git, GitHub CLI, the .NET 10 SDK, Python 3, Node.js LTS, and a firewall rule that opens the gateway's port (7443) on the Tailscale interface only.
    • GitHub sign-in. A browser page opens. Use the account that can push to the mindattic repos.
    • Tailscale SSH browser check. Setup makes this PC's own SQL login on the shared server through tailscale ssh. Tailscale asks you in a browser to approve it. Your approval is what authorises the login.
  4. Wait. Setup then clones the workspace, deploys MindAttic.Tickets, MindAttic.Orchestrator and MindAttic.Launcher, installs the agent hooks, starts the dashboard, turns the gateway on bound to the Tailscale address, and joins the mesh. The log is R:\MindAttic\Setup\setup-node.log.
  5. Sign in each Claude login by hand. In the dashboard use a login's Sign in tab, or run orchestrator login <email> (orchestrator login alone lists them). Credentials stay in that PC's own Vault and ~/.claude-accounts folders and are never copied between PCs. Copying them could sign the other PC out.

Setup is safe to run again. Every step checks first and does only what is missing, so it repairs a half-finished node and changes nothing on a finished one. It never stops the daemon, the CLIs or the dashboard.

Options (pass them after the script or Setup-Node.cmd):

Option Effect
-CoreOnly Clone only the four core repos (Vault, Tickets, Launcher, Orchestrator), not every repo tagged wip.
-Redeploy Run the three apps' run.ps1 again even when they are installed. Use it to update a node.
-Server <name> The shared server's Tailscale name. Default mindattic-01.
-Workspace <path> The workspace root. Leave it: D:\Projects\MindAttic is built into the apps.
-FormatBlankDisk Format a spare disk with no partitions as D: (and a second as R:). Without it D: and R: are folders mapped at every boot, because a disk holding a filesystem Windows can't read also looks blank.

What setup leaves on the PC:

  • %APPDATA%\MindAttic\Mesh\database.json and %APPDATA%\MindAttic\MindAttic.Tickets\database.json: this PC's name and its connection to the shared server. The SQL password is random, is made on this PC, and stays only in these two files, in plain text: they are not encrypted, your Windows account is what protects them, and the login reaches only the two shared databases over the tailnet. Setup never overwrites either file once it holds a connection, and stops if the Tickets one points at another SQL Server (see the operator runbook). The environment variable MINDATTIC_MESH_SQLSERVER overrides the mesh connection.
  • A SQL login mesh_<machine> on the shared server, with rights on the two shared databases only.

New PCs pair with the rest by themselves. After setup, each existing PC's daemon looks at the member list every MeshPairCheckSeconds (300 s) and pairs with any new live member.

Remove a machine

Run this on any other PC of the mesh, not on the one being removed:

orchestrator mesh remove <machine>

It deletes the PC's row from the member list, asks every reachable peer to revoke its key and drop its remote, does the same locally, and drops the PC's mesh_<machine> SQL login on the shared server through tailscale ssh (it prints the T-SQL to run there if it cannot). A removed PC is cut off on its next request. The machine name is 1 to 40 letters, digits, dots, dashes or underscores. If a step cannot finish, the command says which and exits 2; run it again.

For a lost or stolen laptop see "Revoke a lost laptop" in Mesh operations.

Commands

Command What it does
orchestrator mesh serve Turns this PC's gateway on, bound to its Tailscale address, and records its URL and certificate pin on its member row. Waits up to MeshServeWaitSeconds for the daemon to start the gateway.
orchestrator mesh join [--again] Pairs this PC with every other member. --again pairs anew with members already paired (each gets a new key).
orchestrator mesh remove <machine> Removes a machine, as above.
orchestrator login [email] Signs a Claude login in on this PC.
orchestrator may-close <ID> --session <sid> Used by the commit gate. Exit 2 refuses a close while another PC, or another CLI here, holds the ticket.

mesh admit also exists but is run by the gateway, not by you.

FAQ

Do I need the mesh to use the Orchestrator? No. A PC with no mesh config is a mesh of one and behaves as it always did.

Can a PC work while the others are off? Yes. Any PC can claim and work as long as the shared server is reachable.

Does a closed laptop lose its ticket? Its claim lapses after the lease. The ticket returns to the queue ClaimOrphanGraceMinutes later, not at once, because a sleeping laptop often still holds uncommitted work. If it wakes first and nobody took the ticket, it renews and carries on. If somebody did, the laptop's CLI is told "this ticket moved to <machine>; commit or drop your work", its close is refused, and it can still push commits.

Why must I sign each login in on each PC? Credentials are never copied. Claude's refresh tokens rotate, so a copy on one PC can sign the other out.

Why is a PC greyed out? It has not sent a heartbeat for MeshPeerStaleSeconds. It is asleep, offline or off.

Why does a PC say "needs update"? It is on an older mesh protocol. Re-run setup there with -Redeploy.

Where is the log? R:\MindAttic\Setup\setup-node.log for setup. The daemon logs mesh events with the rest of its log.

Is it safe to put secrets in this repo? No. The repo is public. Setup writes no secret into any file in the repo.

From MindAttic.Orchestrator/docs/MESH.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.