Machine Identity
A machine in CMDOP has one stable identifier (a server-issued UUID) and several human-friendly
ones. Every cross-machine call funnels through one resolver so the rules below apply
uniformly to connect exec, ask_machine, ask_machines, and remote file access.
The four identifiers
| Field | Source | Stability | Use |
|---|---|---|---|
ID | Server-issued UUID | Permanent — survives renames | Scripts, CI, unattended automation |
Hostname | OS-reported | Changes if the OS changes | Default human-facing label |
Name | User-set friendly label | Changes when you edit it | Renaming a machine without losing its identity |
| Unique prefix | Computed at resolve time | Same as the longer ID it disambiguates | Convenience — prod matches prod-db-1 only if it is the unique prefix |
Resolution priority
The order is:
- UUID short-circuit.
- Exact hostname match.
- Exact friendly name match.
- Unique fuzzy prefix (
prod-1resolvesprodonly if no other machine starts withprod). - Ambiguous — return the candidate list as an error.
Single-character prefixes are rejected to avoid surprises. Hostnames ending in .local
(common on macOS) are matched permissively.
What a machine record carries
Each machine record exposes:
| Field | Meaning |
|---|---|
| Server UUID | The permanent identifier |
| Hostname | The OS-reported hostname |
| Friendly name | The user-set label |
| Online flag | A cached liveness boolean |
| Heartbeat age | Seconds since the last heartbeat — the authoritative liveness signal |
| Fleet ID | The fleet the machine belongs to |
| Agent version | The running agent version |
| Active session | The machine’s current active session, if any |
Heartbeat age is the source of truth for liveness — the cached online flag may lag the relay TTL by up to a heartbeat interval.
The whoami operation
cmdop connect exposes a whoami operation that the agent uses when it needs to confirm
which machine it is on:
{
"operation": "whoami"
}Returns:
{
"hostname": "laptop-a.local",
"matched": true,
"machine_id": "01HX9F7E8Z..."
}If the relay is unreachable, the call degrades gracefully — matched=false with no
machine_id.
Fuzzy match pitfalls
- Ambiguous prefix. Querying
prodwhen bothprod-1andprod-2exist returns a machine list, not a single match. Use the longer prefix or the UUID. - Single-character prefix. Rejected.
pwill never match anything. .localsuffix. macOS hostnames often end in.local; the resolver strips it for hostname comparison.
Renaming a machine
Hostname and friendly name can change. The server UUID cannot. On the next heartbeat the agent re-registers under the new name; the relay keeps the old hostname as an alias for a short reconciliation window so existing references keep working.
Best practice for scripts
Prefer the UUID in CI and unattended scripts — it is immune to renames and ambiguity. Use hostname or fuzzy prefix in interactive flows where typing a UUID is impractical.
# good — unambiguous
cmdop connect exec --id 01HX9F7E8Z... -- uptime
# fine for humans — fuzzy prefix
cmdop connect exec prod-1 -- uptimeAll consumers — connect exec, ask_machine, ask_machines, and remote file access —
funnel through the same resolver. Behaviour is identical across surfaces.