> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monolex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Cross-Machine AI Teams

> Run AI workers on different machines, controlled from anywhere, through gateway relay or P2P.

# Cross-Machine AI Teams

PTY-for-AI sessions extend across machines.
Workers on Machine A and Machine B form a single team.

## How It Works

Every machine runs a daemon + headless server.
The gateway (or P2P) connects them.

```
Machine A (laptop):                    Machine B (server):
  niia daemon ─── headless ───┐    ┌─── headless ─── niia daemon
                               │    │
                           Gateway (WSS)
                          session.monolex.ai
```

Commands work transparently across machines:

```bash theme={null}
# Local session
niia write --session local-123 $'hello\r'

# Remote session (same interface)
niia remote write MACHINE-B $'hello\r'
niia remote read MACHINE-B
```

## Use Cases

### Distributed Research Team

```
Machine A (laptop):
  Worker 1: Claude Opus — strategy and synthesis
  Worker 2: Claude Haiku — fast code search

Machine B (GPU server):
  Worker 3: Local LLM — sensitive data processing
  Worker 4: Codex — independent code review

All coordinated by connector.json pipeline on Machine A.
```

### Follow-the-Sun Development

```
Morning (office desktop):
  Start pipeline → workers begin research

Evening (leave office):
  Workers continue on desktop (daemon persists)

Night (laptop at home):
  niia remote read OFFICE-DESKTOP → check progress
  niia remote write OFFICE-DESKTOP → adjust priorities

Next morning:
  Results ready. Workers have been working all night.
```

### Failover Across Machines

```
Machine A has Claude → Machine A goes offline
  ↓
Gateway detects absence
  ↓
connector.json fallback: route to Machine B
  ↓
Machine B has Gemini → work continues
```

## Remote Lifecycle

```bash theme={null}
# See online machines
niia remote status list

# Start headless on remote machine
niia remote start MACHINE-B

# Upgrade remote NIIA binary
niia remote upgrade MACHINE-B

# Execute command on remote
niia remote ask MACHINE-B "git status"
```

Remote upgrade is unique to this architecture.
No other AI tool can upgrade itself on a remote machine.

## No Central Dependency

Two connectivity paths, both encrypted:

```
Path A: Gateway relay
  Works through NAT, firewalls, corporate networks.
  Requires session.monolex.ai to be reachable.

Path B: P2P (WebRTC DataChannel)
  Direct machine-to-machine. No central server.
  Works when gateway is unreachable.
  DTLS encrypted.
```

If the gateway goes down, P2P takes over.
If P2P isn't available, gateway handles it.
Both paths: the local daemon keeps running regardless.

## Related

For how machine assignments work in connector.json specs, see [Machine-Level Expansion](/openclis/specs/connector-json/machine-expansion). For the full scaling model across all dimensions, see [Dimensional Growth](/openclis/specs/connector-json/dimensional-growth).
