Secure AI-to-PC Gateway

One gateway to connect AI to all your remote PCs.

Nefia is a secure gateway connecting AI agents to your fleet of macOS/Linux/Windows PCs. It provides command execution, file management, and workflow automation with policy guardrails, sandboxing, and a complete audit trail.

nefia — operator$ nefia exec --allconnecting 8 targets...✓ sessions readydispatching jobs...

Your department.Other teams.External partners.

One AI Operations Manager orchestrates AI agents across devices, enabling massive parallel execution at scale.

CONTROL PLANETRANSPORT PLANEEXECUTION PLANEAI Orchestrator + Nefia Coretarget selection · timeout · concurrencydeterministic execution planninghuman / json / jsonl outputPolicydeny / allow · RBACenforce · warn · JITAuditJSONL · SIEM exportHMAC-SHA256 chainMCP Server200+ tools: exec · fs · playbook · sys …policy · approval · rate limitingJSON-RPC 2.0 over stdioWireGuard VPN Tunneluserspace (gVisor netstack) · DERP relayno root required · NAT traversal · multipath>_SSH Command Channelpublic-key auth · TOFUlightweight ciphers (in VPN)parallel fan-out · sudostdout/stderr · progressSFTP File Channelread / write / patch / copy / streamfind · grep · du · chmod · chownsession root sandbox · resumablepath traversal preventionmac-devos: macOS role: devroot: projectswin-buildos: Windows role: buildgroup: productionall-staginggroup selectorparallel fan-out setSelect TargetValidate PolicyVPN TunnelSSH / SFTPExecute on HostsAudit + HMAC

Use Cases

Claude Code + Nefia MCP server enables powerful remote workflows. Here are real-world examples.

Organize a messy Downloads folder on a remote PC

Claude Code connects to the target PC via Nefia, scans the directory, and sorts files by type — all without touching the remote keyboard.

1. Start MCP server on your operator PC

$nefia mcp serve

2. Ask Claude Code

"Organize ~/Downloads on remote-mac. Move images to ~/Pictures, PDFs to ~/Documents/PDFs,

and everything else to ~/Downloads/Other."

3. Claude Code executes via Nefia

fs.list ~/Downloads on remote-mac
exec "mkdir -p ~/Pictures ~/Documents/PDFs ~/Downloads/Other"
exec "mv ~/Downloads/*.png ~/Downloads/*.jpg ~/Pictures/"
exec "mv ~/Downloads/*.pdf ~/Documents/PDFs/"
exec "mv ~/Downloads/*.zip ~/Downloads/*.dmg ~/Downloads/Other/"
✓ 42 files organized into 3 folders

Features Built Into the Gateway

Everything AI agents need to operate remote PCs safely and at scale.

AI Agent Integration

AI agents on the operator PC plan and execute remote operations end-to-end, governed by policy.

Massive Parallel Execution

Safely run commands and file operations in parallel across thousands of target PCs with controlled concurrency.

Session Sandbox

Confine each target to its session root, preventing out-of-scope file access and path traversal attacks including Windows backslash exploits.

Policy Guardrails

Apply deny/allow policies in off / warn / enforce modes to every action an AI performs.

Tamper-Proof Audit Trail

Log every operation as JSONL with job ID, host ID, request, command, and result. Each entry is HMAC-SHA256 signed for tamper detection. Enable audit required mode to block operations when the audit log is unavailable.

MCP Native Control

Expose 200+ MCP tools — command execution, file operations, service management, firewall control, container ops, system diagnostics, and more — so AI agents can manage remote PCs through a stable, secure interface. Progressive discovery keeps token usage low; errors include actionable hints so agents can self-diagnose and retry.

Unprivileged VPN

All connections use WireGuard VPN tunnels with relay-first architecture — DERP relay connects immediately, then auto-upgrades to a direct path. Userspace implementation via gVisor netstack requires no root privileges or kernel modules. Automatic NAT classification detects strict NAT and firewalls, with captive portal detection and network change monitoring. MagicDNS resolves pending hosts, peer staleness is detected automatically, and keepalive/dial timeouts are fully configurable.

Cross-Platform Support

Manage macOS, Linux, and Windows targets from a single operator PC. Operate with a unified command set regardless of OS.

Error Code Registry

Every error includes a structured code (E1001–E9002) with a title, description, and step-by-step resolution. Run `nefia explain <code>` to look up any error interactively, or use `--list` to see the full catalog.

Transfer Progress

File transfers display a real-time progress bar with percentage, speed, and ETA. Interrupted transfers resume automatically from where they left off. Multi-host batch operations show a live success/failure counter. Non-TTY environments receive periodic summary lines instead.

Desktop Notifications

Add `--notify` to any command or enable automatic notifications for operations exceeding a configurable duration. Uses native mechanisms: osascript on macOS, notify-send on Linux, and PowerShell toasts on Windows.

Interactive Setup Wizard

Run `nefia setup` to launch a guided onboarding flow that creates config, generates VPN keys, and can prepare your first target PC invite. Supports `--non-interactive` for scripts and CI. `nefia init` remains available as an alias.

Team Collaboration

Create shared team workspaces where members manage hosts together. Invite colleagues with shareable codes, assign Owner, Admin, or Member roles, and enforce per-role policy guardrails. Every action is attributed to the team member who performed it in the audit trail.

DERP Relay

WebSocket-based relay server for peers behind strict NAT or firewalls. Relay-first architecture connects immediately via DERP, then auto-upgrades to a direct peer-to-peer path when possible. Per-IP rate limiting and authenticated health endpoints protect relay infrastructure. Deploy your own DERP server or use the managed relay.

NAT Traversal Intelligence

Automatic NAT type classification (Endpoint-Independent, Endpoint-Dependent, CGNAT) determines the optimal connection strategy. Captive portal detection prevents futile connection attempts. Network change monitoring triggers immediate tunnel rebuilds when interfaces change.

Agent Token Security

256-bit agent tokens stored in your OS keyring (macOS Keychain, Linux Secret Service, Windows Credential Manager). Automatic 90-day TTL with background rotation every 24 hours when expiry approaches. Encrypted file fallback for headless environments. HTTPS enforced for all cloud API communication.

Adaptive Connectivity

Active-backup multipath routing selects the best available path with quality monitoring and 20% hysteresis for stable failover. Adaptive watchdog detects failures in 2 consecutive checks, with network-aware tunnel rebuilds triggered by interface changes. SFTP client pooling with health checks eliminates stale connections. Enhanced diagnostics measure latency per host and detect VPN subnet route conflicts.

Directory Sync

Synchronise a local directory to remote hosts with `nefia sync`. Only changed files are transferred based on size+mtime or SHA-256 checksum. Use `--delete` to mirror exactly, `--exclude` to skip patterns, and `--dry-run` to preview changes before applying. Parallel file transfers per host with configurable concurrency.

Scheduled Automation

Define cron-based schedules that execute playbooks automatically. The `nefia daemon` runs as a background service (launchd, systemd, or Windows Task Scheduler) with config hot-reload, VPN monitoring, and host sync. View execution history, trigger schedules manually, and configure overlap and missed-run policies.

System Health Check

Run `nefia doctor` for a comprehensive diagnostic covering configuration, authentication, audit logs, VPN status, and per-host connectivity with latency measurement. Similar to `brew doctor` — identifies issues and suggests fixes. JSON output available for CI integration.

Self-Update

Run `nefia update` to check for and apply CLI updates in-place. Ed25519 signature verification ensures you always run authentic, untampered builds. Use `--check` for a non-destructive version check. Background version checks notify you when an update is available.

Device Lock

Ed25519 cryptographic device verification prevents rogue devices from joining the VPN mesh, even if enrollment tokens are compromised. Choose log or enforce mode to monitor or block non-verified devices.

Just-In-Time Access

Grant time-limited temporary access for policy-restricted operations with approval workflows. Access automatically expires, and every grant or denial is recorded in the audit trail.

SSH Certificate Authority

Built-in Ed25519 CA with OS keyring storage. Automatically issue short-lived user certificates on connect and sign host certificates. No more manual key distribution.

mTLS Gateway

Secure MCP server connections with ECDSA P-256 mutual TLS. Issue client certificates for AI agents with configurable TTLs. Only authenticated agents can interact with your fleet.

Device Posture

Evaluate target security signals — firewall status, disk encryption, OS version — against policies. Enforce or warn on non-compliant devices before allowing operations.

Compliance Reporting

Auto-generate SOC 2, ISO 27001, and HIPAA compliance reports from audit logs and configuration state. Produce HTML reports covering all required controls.

Secrets Management

Resolve secrets at execution time from environment variables, local files, HashiCorp Vault, AWS Secrets Manager, or 1Password. No plaintext secrets in config files.

SIEM Integration

Forward audit events to Splunk, Datadog, or custom webhooks in real time. Configurable batching, retries, and HMAC signing ensure no event is lost.

Event Automation

Agent-side beacons monitor disk usage, service health, and custom scripts. Operator-side reactor rules trigger automated responses — exec commands, file operations, or notifications — when events match.

HA Cluster

Raft-based active-passive clustering with automatic leader election and state replication. Ensure continuous management even if the primary operator node fails.

Session Recording

Record remote sessions in asciinema v2 format with terminal replay. Metadata sidecars enrich recordings with host, user, and timing context for audit review.

Power Management

Wake sleeping hosts via Wake-on-LAN through proxy agents on the same subnet. Auto-select the closest proxy and wait for the target to come online.

Host Import

Bulk import hosts from SSH config, Ansible inventory, CSV files, or known_hosts. Quickly onboard an existing fleet without manual configuration.

Code Signing

All release binaries include Ed25519 signatures, macOS Developer ID notarization, and Windows Authenticode signing. The agent verifies signatures on startup and during auto-updates.

Agent Auto-Update

Upgrade agents across your fleet remotely with `nefia agent upgrade`. Automatic rollback on startup failure protects against bad updates. Pin specific versions when stability matters.

Dual Interface

CLI for Humans. MCP for AI Agents.

Both interfaces share the same policy engine, audit trail, and VPN transport. Use whichever fits the workflow — or both together.

CapabilityCLIMCP Server
Designed forHuman operators & interactive AIAutonomous AI agents
InterfaceShell commands with text outputJSON-RPC with typed schemas
Tool discovery--help / man pagestools/list with progressive discovery
Input validationFlag parsingJSON Schema + enum constraints
Error recoveryHuman-readable stderrRecoveryTool + SuggestedActions
Approval workflowHuman-in-the-loop for destructive ops
Rate limitingToken bucket per connection
IntegrationAny shell / CI pipelineClaude, Cursor, Windsurf, etc.

Both CLI and MCP route through the same gateway — policy, audit, and VPN are always enforced regardless of interface.

Execution Pipeline

Every operation follows a deterministic path: target selection, rule checks, execution, and full traceability.

1. Select Targetsall | host | group | tagsubset · rerun fail/ok2. Policy & Guarddeny / allow · RBAC rolesapproval workflow · JITsession root guard3. VPN ConnectWireGuard · DERP relaymultipath · conn poolingcircuit breaker4. ExecuteSSH / SFTP · playbooksbatch · env injectionconcurrency control5. Audit & ObserveHMAC hash chain JSONLSIEM · session recordinghuman / json / jsonl

Pricing

Every plan includes all features — VPN, MCP, CLI, policy guardrails, and audit logs. Pick the tier that matches your scale.

Free

$0

Perfect for personal use

  • Up to 2 hosts
  • Single-user workspace
  • All core features included
  • Community support
Join Waitlist
Most Popular

Team

$8

/member/mo

Per-seat pricing for teams of any size

  • Unlimited hosts
  • Unlimited members
  • Shared team collaboration
Join Waitlist

Enterprise

Custom

For organizations with advanced needs

  • Everything in Team
  • Invoice & annual billing
  • Dedicated support engineer
  • Priority support
Contact Sales

Get Started in 2 Steps

No complex configuration required. One command on each side and you're connected.

1Operator PC

Install Nefia & generate an invite

Install the CLI, then run a single command. Login, key generation, and config creation are all handled automatically. If you want a guided onboarding flow, nefia setup walks through config, VPN keys, and the first host invite.

Install the CLI

$curl -fsSL https://www.nefia.ai/install.sh | sh

After installation, restart your terminal or run source ~/.zshrc (or source ~/.bashrc) to add nefia to your PATH.

Invite a target PC

$nefia vpn invite --name my-pc --os macos --stun

--name is an identifier for the target PC (e.g. office-mac, living-room-pc). Names must start with an alphanumeric character, followed by alphanumerics, dots, hyphens, or underscores (max 63 chars). --os is the target's OS (macos, linux, or windows). --stun auto-discovers your public endpoint. Change --name and --os to match your environment.

An invite token and target-side instructions will be displayed. No prior manual initialization is required, and if login is needed Nefia can open the browser during invite creation.

2Target PC

Install the agent

Paste the command shown in Step 1 on the target PC. The agent is downloaded, enrolled, and registered as a system service automatically.

TOKEN is the invite token generated in Step 1. Replace with your actual token value.

Prerequisite: SSH must be enabled on the target. Go to System Settings > General > Sharing > Remote Login.

One-liner

$curl -fsSL https://www.nefia.ai/install-agent.sh | sh -s -- --token 'TOKEN'

Once the agent enrolls, verify the connection from your operator PC with nefia validate --target all. You're ready to go!

After You're Connected

Run commands, transfer files, or let AI agents manage your fleet — all through encrypted VPN tunnels.

CLI

Remote commands & file operations

Execute shell commands and manage files on target PCs directly from your terminal.

#Run a command on all hosts
$nefia exec --target all -- hostname
#Read a remote file
$nefia fs read --host my-pc --path /etc/hostname
#Write a file to a remote host
$nefia fs write --host my-pc--path ~/hello.txt --text "Hello"
#List a remote directory
$nefia fs list --host my-pc --path ~/Documents
#Show file metadata
$nefia fs stat --host my-pc --path ~/report.csv
#Push a local file to all hosts
$nefia push ./config.json /etc/app/config.json --target all
#Check status
$nefia status

Use the name from Step 1's --name flag as the --host value. When targeting 2+ hosts, a preview and confirmation is shown. Pass --yes to skip in scripts.

MCP Server

AI agent integration

Start an MCP server so AI agents (Claude, etc.) can manage your PCs via JSON-RPC over stdio.

$nefia mcp serve

200+ tools across 18 categories:

  • core — sessions, exec, hosts, facts, status, doctor
  • fs — 24 file operations including streaming (up to 3 GB)
  • ops — packages, users, cron, power, backup
  • audit — audit search/export, compliance, recordings
  • automation — playbooks, schedules, queue, reactor, webhooks, push/sync
  • composite — run, investigate, deploy, health check, baseline
  • network — ping, traceroute, DNS, connections, firewall
  • container — list, logs, start, stop, restart, inspect
  • system-query — processes, services, ports, logs, disk, env
  • system-mutation — hostname, sysctl, time, service control
  • vpn — invite, enroll, diagnose, key rotation
  • cluster — init, status, members, add/remove peer
  • agent — version, upgrade, pin
  • pki — SSH CA, mTLS certificates
  • policy — test, capabilities, approval
  • security — JIT, device lock, posture
  • infra — mounts
  • management — teams, profiles, host groups

TUI Dashboard

Interactive terminal UI

Monitor hosts, VPN connections, and configuration at a glance in an interactive terminal dashboard.

$nefia dashboard

Or simply run nefia with no arguments — the TUI launches automatically when a terminal is detected.

Agent Management

Version check, health & upgrade

Check agent versions across your fleet and upgrade them remotely in one command.

#Check agent health
$nefia-agent status
#Check agent versions
$nefia agent version --target all
#Upgrade agents
$nefia agent upgrade --target all
#Custom log file location
$nefia-agent --log-file ~/logs/agent.log

Plan & Apply

Review before you execute

Create an execution plan, review what will run on which hosts, then apply it with confidence.

#Create a plan
$nefia plan exec --target all -- apt update
#Review & apply
$nefia apply plan.json

Audit Log

Full operation history

Every command is recorded in an append-only JSONL audit log with hash-chain verification.

#View recent records
$nefia audit tail
#Show records for a specific job
$nefia audit show --job abc123
#Verify integrity
$nefia audit verify 2026-02-21

Scheduled Automation

Cron-based playbook execution

Define schedules that run playbooks automatically. The daemon runs as a system service with VPN monitoring and config hot-reload.

#Create a daily backup schedule
$nefia schedule create --name daily-backup --cron "0 2 * * *" --playbook backup --target all
#List schedules
$nefia schedule list
#View execution history
$nefia schedule history --limit 10
#Trigger a schedule immediately
$nefia schedule trigger daily-backup
#Start the background daemon
$nefia daemon
#Install as a system service
$nefia daemon install

Backup & Restore

Configuration safety net

Back up your entire config, state, sessions, and audit logs to a single archive. Restore anytime.

$nefia backup
#Restore from archive
$nefia restore backup-2026-02-21.tar.gz

VPN Management

Monitor, diagnose & maintain

Check peer status with staleness indicators, troubleshoot connections, inspect tokens, rotate keys, and manage enrollment.

$nefia vpn status
#Run diagnostics
$nefia vpn diagnose
#Generate a new WireGuard keypair (confirms before overwriting)
$nefia vpn keygen
#Show current VPN config
$nefia vpn show-config
#Start enrollment listener
$nefia vpn listen
#Inspect an invite token
$nefia vpn token-info --token TOKEN
#Check enrollment status
$nefia vpn enroll-status --name my-pc
#Rotate operator key
$nefia vpn rotate-key
#Push new key to all hosts
$nefia vpn push-key
#Generate invite & copy token to clipboard
$nefia vpn invite --name my-pc --os macos --stun --copy

Health Check

Comprehensive diagnostics

Run a full health check covering config, auth, audit logs, VPN, and per-host connectivity with latency measurement. Identifies issues and suggests fixes.

#Run all health checks
$nefia doctor
#Check a specific host
$nefia doctor --host my-pc
#JSON output for CI
$nefia doctor --output json

Similar to brew doctor — checks config validity, auth status, audit directory writability, VPN peer setup, and TCP connectivity to each host.

Host & Groups

Inventory management

List and inspect your managed hosts and groups. Filter by tags or status.

$nefia hosts list
#Show host details
$nefia hosts show my-pc
#List groups
$nefia groups list

Session Management

Persistent file sessions

Open sandboxed sessions with a fixed root directory. All file operations are scoped to the session.

#Open a session
$nefia session open --host my-pc --root ~/projects
#List active sessions
$nefia session list
#Close a session
$nefia session close abc12345

Auth & Setup

Initialize & authenticate

Set up your Nefia configuration and authenticate via browser-based login.

#Guided setup
$nefia setup
#Log in via browser
$nefia login
#Log out
$nefia logout

Account

Subscription info

View your current plan, host limits, and subscription status at a glance.

$nefia account

Shows plan name, billing status, host limit, and usage.

Large File Streaming

Transfer files up to 3 GB

Stream large files between local and remote hosts without buffering in memory. Ideal for database dumps, archives, and disk images.

#Download a large file from remote
$nefia fs read --host my-pc --path ~/backup.tar.gz --out ./backup.tar.gz
#Upload a large file to remote
$nefia fs write --host my-pc --path ~/image.iso --in ./image.iso

Uses ~32 KB of memory regardless of file size. Also available as MCP tools (fs.stream_read / fs.stream_write).

Directory Sync

Smart file synchronisation

Sync a local directory to remote hosts. Only changed files are transferred with configurable comparison (size+mtime or SHA-256).

#Sync configs to all webservers
$nefia sync ./configs /etc/app/ --target group:webservers
#Preview changes without transferring
$nefia sync ./deploy /opt/app/ --target all --dry-run
#Mirror exactly (delete extra remote files)
$nefia sync ./src /opt/app/ --host my-pc --delete --checksum
#Exclude patterns
$nefia sync ./project /opt/app/ --target all --exclude "*.log" --exclude ".git"

System Facts

Gather host information

Collect OS, disk, memory, CPU, uptime, and network details from all hosts in a single call.

#Via MCP (AI agent)
$nefia.facts --target all
#Only OS and memory info
$nefia.facts --target all --categories os,memory

Available as an MCP tool — all categories are collected in a single SSH round-trip per host.

Utilities

Update, completion & version

Keep your CLI up to date, generate shell completions, and check the installed version.

#Update CLI to latest version
$nefia update
#Check for updates without applying
$nefia update --check
#Generate shell completions
$nefia completion zsh
#Show version & build info
$nefia version

Updates are verified with Ed25519 signatures. Background version checks notify you when a new release is available.

Compliance

Compliance reporting

Auto-generate compliance reports from audit logs and configuration state.

#Generate SOC 2 report
$nefia compliance report --framework soc2
#ISO 27001
$nefia compliance report --framework iso27001 --out report.html

Device Posture

Security posture checks

Evaluate target security signals and enforce compliance before allowing operations.

#Check all hosts
$nefia posture check --target all
#View posture policy
$nefia posture policy

Secrets

Multi-provider secrets

Resolve secrets from env vars, files, Vault, AWS Secrets Manager, or 1Password at execution time.

#List configured secrets
$nefia secrets list
#Test resolving a secret
$nefia secrets test db-password

Event Automation

Beacon & Reactor

Monitor host conditions with beacons and trigger automated responses with reactor rules.

#View configured reactor rules
$nefia reactor status
#Show recent reactor events
$nefia reactor events

Recording

Session recording & replay

Record terminal sessions in asciinema v2 format for audit review and replay.

#List recordings
$nefia recording list
#Replay a recording
$nefia recording replay abc12345

SSH CA

Certificate authority

Issue and manage short-lived SSH certificates. No more manual key distribution across hosts.

#Initialize CA
$nefia ssh-ca init
#Sign operator SSH key
$nefia ssh-ca sign-user --principals deploy
#Sign a host key
$nefia ssh-ca sign-host --host my-pc

Power Control

Wake-on-LAN

Wake sleeping hosts via WoL through proxy agents on the same subnet with auto-proxy selection.

#Wake a host
$nefia power wake my-pc

Cluster

High availability

Raft-based clustering with automatic leader election for continuous management.

#Initialize a cluster
$nefia cluster init
#Check cluster status
$nefia cluster status
#Add a peer to the cluster
$nefia cluster add-peer --id node-2 --addr 10.99.0.2:9700

mTLS

Mutual TLS gateway

Secure MCP connections with ECDSA P-256 mutual TLS. Issue client certificates for AI agents.

#Initialize CA
$nefia mtls init
#Issue a client certificate
$nefia mtls issue-client --name claude-agent --duration 720h
#Show certificate status
$nefia mtls status

JIT Access

Just-In-Time access grants

Grant time-limited temporary access for policy-restricted operations with approval workflows.

#Request access
$nefia access request --role admin --hosts my-pc --duration 1h
#Approve a pending request
$nefia access approve req-abc123
#List active grants
$nefia access list

Device Lock

Cryptographic device verification

Ed25519 device verification prevents rogue devices from joining the VPN mesh.

#Initialize device lock
$nefia device-lock init
#Check device status
$nefia device-lock status
#Verify all device signatures
$nefia device-lock verify

Host Import

Bulk import from existing inventory

Import hosts from SSH config, Ansible inventory, CSV, or known_hosts for quick onboarding.

#Import from SSH config
$nefia hosts import --from ssh-config
#Import from Ansible inventory
$nefia hosts import --from ansible-inventory --file inventory.yml
#Import from CSV
$nefia hosts import --from csv --file hosts.csv

FAQ

Practical answers about security, operations, and integrations.

Do I need to install an agent on each target PC?+

Yes, every target PC requires the lightweight nefia-agent. All connections go through WireGuard VPN tunnels with no direct SSH access. Register agents by running `nefia vpn invite` on the operator side and `nefia-agent enroll` on the target side.

Which operating systems are supported?+

macOS (15+), Windows (11+), and Linux (Ubuntu 22.04+, Debian 12+, Fedora 38+) are supported for both operator and target PCs. ARM64 and AMD64 architectures are both supported.

Does it require root or admin privileges?+

No. The WireGuard VPN runs entirely in userspace via gVisor netstack — no kernel modules or root privileges needed on the operator side. Target PCs only need SSH enabled.

Does it work behind NAT or firewalls?+

Yes. Nefia automatically classifies NAT type (EIM/EDM/CGNAT) and selects the optimal connection strategy. STUN discovers your public endpoint, and for strict NAT or firewalls, the DERP relay provides an immediate WebSocket-based fallback that auto-upgrades to a direct path when possible. Hairpin NAT is handled via automatic local endpoint discovery. Captive portal detection prevents futile connection attempts in restricted networks.

Where does my data go?+

All data stays on your machines. VPN tunnels are end-to-end encrypted with WireGuard (Curve25519 + ChaCha20-Poly1305), and audit logs are stored locally in append-only format. The DERP relay is used at connection start for immediate connectivity and during enrollment, but auto-upgrades to a direct peer-to-peer path when possible. Even while traffic passes through the DERP relay, it remains end-to-end encrypted with WireGuard — the relay cannot inspect or modify your data.

What happens if the connection drops?+

The agent automatically reconnects with an adaptive watchdog that detects failures in 2 consecutive checks and triggers immediate tunnel rebuilds when network interfaces change. It runs as a system service (launchd on macOS, systemd on Linux, Windows Scheduled Task) with exponential backoff. After consecutive rebuild failures, the watchdog enters a cooldown before retrying — it never gives up permanently. Network monitoring detects IP address changes and triggers proactive reconnection before the tunnel times out. Multipath active-backup keeps a secondary path ready for instant failover. On the operator side, a circuit breaker distinguishes transient errors from persistent failures and connection health checks run with configurable timeouts. Send SIGHUP for live config reload (macOS/Linux) without restarting the service, and run `nefia-agent status` to check agent health at any time.

How does Nefia keep operations safe?+

It combines Trust On First Use (TOFU) host key verification over VPN, session root sandboxing, policy rules (per-role command/path/host restrictions), device posture checks, mTLS gateway for MCP connections, and append-only audit logs with hash-chain integrity. For sensitive operations, the MCP approval workflow pauses AI agent actions until a human approves via the TUI dashboard. Just-In-Time (JIT) access grants temporary elevated privileges with automatic expiry. Multi-host exec commands show a preview and require confirmation before running, and `--dry-run` lets you preview target resolution without executing.

How is VPN traffic encrypted?+

Nefia uses WireGuard with Curve25519 key exchange and ChaCha20-Poly1305 encryption — the same algorithms as kernel WireGuard. SSH inside the tunnel uses hardened key exchange (curve25519-sha256, ECDH only — no legacy DH groups) and authenticated MACs (hmac-sha2-256-etm) with lightweight ciphers (ChaCha20-Poly1305, AES-256-GCM) to minimize double-encryption overhead.

How are credentials stored?+

Private keys and auth tokens are stored in your OS keyring (macOS Keychain, Linux Secret Service, Windows Credential Manager). When the keyring is unavailable (headless servers, CI), a local file encrypted with AES-256-GCM is used as fallback. Plaintext credentials are never written to disk. Agent tokens are 256-bit cryptographically random values, also stored in the OS keyring, with a 90-day TTL and automatic background rotation every 24 hours as expiry approaches. The agent checks config file permissions at startup and warns if the file is world-readable when it contains a plaintext key.

Are audit logs tamper-proof?+

Audit logs are append-only JSONL with SHA-256 hash-chain integrity — each record links to the previous one. Records are also signed with HMAC-SHA256, so any modification or deletion is detectable. Logs can be forwarded in real time to Splunk, Datadog, or a custom webhook endpoint via the built-in SIEM integration for external retention and alerting.

How does the invite token work?+

Invite tokens are signed with HMAC-SHA256 (key derived via HKDF from the operator's WireGuard private key) and include a single-use nonce for replay protection. Nonce lookups use an optimized index for fast validation at scale. Tokens expire after a configurable TTL (default 24 hours) with proportional grace periods based on token lifetime. Enrollment uses TLS 1.3 for the handshake with a progress countdown displayed during the process. Use `nefia vpn token-info` to inspect a token's expiry, target host, and remaining validity.

Can I restrict what commands or paths are accessible?+

Yes. The built-in policy engine supports regex-based allow/deny rules for commands, file paths, and host access. You can define RBAC roles with different permissions and switch between warn and enforce modes. Policy changes take effect immediately via hot-reload. For temporary elevated access, Just-In-Time (JIT) grants let operators request time-limited privileges that auto-expire. Use `nefia policy test` or the batch variant to pre-check whether an operation would be allowed before executing.

Are binaries signed?+

Yes. macOS binaries are code-signed with a Developer ID certificate and notarized by Apple. Windows binaries are Authenticode-signed with a SHA-256 code signing certificate. All binaries include an Ed25519 signature that the agent verifies on startup and during auto-updates, ensuring you're running authentic, untampered builds.

Can I automate Nefia from AI tools?+

Yes. Running `nefia mcp serve` exposes 200+ MCP tools, allowing AI agents like Claude to execute commands, transfer files (including large files up to 3 GB via streaming), run multi-step playbooks, gather system facts, manage queues, diagnose connectivity, and orchestrate targets safely at scale. The MCP server performs early parameter validation and returns domain-specific errors (e.g., FILE_NOT_FOUND, PERMISSION_DENIED) as structured isError content with actionable troubleshooting hints, so AI agents can self-diagnose failures and retry intelligently.

Does Nefia work with OpenClaw?+

Yes. Register Nefia as an MCP server in your `openclaw.json` and OpenClaw gains access to all 200+ Nefia tools. Because OpenClaw runs autonomously 24/7, we recommend enabling approval workflows (`mcp.approval.enabled: true`) and strict policy rules (`policy.mode: enforce`) to keep operations safe. See the OpenClaw Integration guide in our docs for detailed security hardening steps.

Can I review actions before execution?+

Yes. Use `nefia plan exec` to generate a plan JSON, review it, then run `nefia apply` to execute. For interactive use, `nefia exec` targeting 2+ hosts shows a preview and requires confirmation. The `--dry-run` flag resolves targets and checks policy without executing. For AI agents, the MCP approval workflow pauses destructive operations until a human approves via the TUI dashboard. In non-TTY environments (scripts, CI), pass `--yes` to skip the interactive prompt.

What are the differences between plans?+

The Free plan is built for personal use: up to 2 hosts in a single-user workspace. The Team plan ($8/member/month) unlocks unlimited hosts, unlimited members, and shared team collaboration. The Enterprise plan adds invoice and annual billing, a dedicated support engineer, and priority support — contact sales for details.

What ports do I need to open?+

Nefia uses UDP port 51820 for WireGuard by default (configurable). If you use `--stun`, no manual port forwarding is needed in most cases. When using the DERP relay, only outbound WSS (port 443 or 8443) is required — no UDP port forwarding is needed at all. SSH traffic flows inside the VPN tunnel, so port 22 is only used on the local VPN subnet.

How do I troubleshoot errors?+

Nefia includes a built-in error code registry. When an operation fails, the error message includes a structured code like E2001. Run `nefia explain E2001` to see a detailed description and step-by-step resolution instructions. Use `nefia explain --list` to browse all registered error codes. For VPN connectivity issues, run `nefia vpn diagnose` to measure per-host latency (warns above 500 ms, errors above 2 s) and detect VPN subnet route collisions. Run `nefia doctor` for a comprehensive health check covering configuration, VPN, and audit subsystems. The documentation site also has a complete Error Codes reference page.

What is the DERP relay?+

DERP (Designated Encrypted Relay for Packets) is a WebSocket-based relay server that provides immediate connectivity for peers behind strict NAT or firewalls. Nefia uses a relay-first architecture — connections are established through the DERP relay instantly, then automatically upgrade to a direct peer-to-peer path when possible. All traffic through the relay remains end-to-end encrypted with WireGuard. You can use the managed relay or deploy your own with the `nefia-derp` binary for full control over relay infrastructure.

How does agent log rotation work?+

The nefia-agent supports automatic log rotation via the `--log-file` flag. Default log paths are platform-specific: `~/Library/Logs/nefia/agent.log` on macOS, `$XDG_STATE_HOME/nefia/agent.log` on Linux, and `%LOCALAPPDATA%\nefia\logs\agent.log` on Windows. Use `--log-max-size` (default 50 MB), `--log-max-backups` (default 5), and `--log-max-age` (default 30 days) to control rotation behavior. Old log files are automatically cleaned up.

How does device posture checking work?+

Run `nefia posture check` to evaluate target security signals — firewall status, disk encryption, OS version — against policies. In enforce mode, non-compliant devices are blocked from operations. In warn mode, issues are logged but operations proceed. Results feed into compliance reports.

How are secrets managed?+

Nefia resolves secrets at execution time from five providers: environment variables, local files, HashiCorp Vault, AWS Secrets Manager, and 1Password (via op CLI). Secrets are injected into commands and playbooks without storing plaintext in config files. Use `nefia secrets list` to see configured providers and `nefia secrets test` to verify provider connectivity.

Can I generate compliance reports?+

Yes. Run `nefia compliance report` to auto-generate compliance reports covering SOC 2 (14 controls), ISO 27001 (12 controls), or HIPAA (11 controls). Reports are built from your audit logs and configuration state, with HTML output ready for auditors. The MCP tool `nefia.compliance.report` lets AI agents generate reports programmatically.

How do agents get updated?+

Run `nefia agent upgrade --target all` to upgrade agents across your fleet remotely. Updates are verified with Ed25519 signatures. If a new agent version fails to start, automatic rollback restores the previous version. Use `nefia agent pin` to lock a host to a specific version.

What is event-driven automation?+

Nefia provides two complementary systems. Beacons run on agents and monitor conditions like disk usage thresholds, service health, or custom scripts. When a beacon fires, the operator-side reactor matches the event against rules and executes automated responses — commands, file operations, or notifications. Use `nefia.reactor.status` and `nefia.reactor.events` to monitor rule hits and recent events.

Can I schedule recurring operations?+

Yes. Use `nefia schedule create` to define cron-based recurring playbook executions. Schedules support IANA timezones, overlap policies (skip, queue, or allow concurrent runs), missed-run handling, and configurable retry counts. Manage schedules with `nefia schedule list`, `show`, `enable`, `disable`, and `history`. All 8 schedule tools are also available via MCP for AI agent orchestration.

What happens when a target host is offline?+

Commands targeting offline hosts are automatically queued for later execution when the host reconnects. Use `nefia queue list` to see pending entries, `nefia queue show` for details, and `nefia queue cancel` or `nefia queue retry` to manage them. Queued entries have a configurable TTL (default 1 hour) and expire automatically if the host does not come back online in time.

How do I deploy files to multiple hosts?+

Use `nefia push` to distribute a file to all hosts matching a target selector, or `nefia sync` to synchronize an entire directory — only changed files are transferred. Both support `--batch-size` and `--batch-wait` for rolling deployments, `--subset` for canary testing on a random subset, and `--dry-run` to preview which hosts would be affected without writing any files.

Can I record and replay sessions?+

Yes. Session recordings capture all commands and file operations in asciicast format for audit and replay. Use `nefia recording list` to browse recordings and `nefia recording show` to inspect metadata. Recordings can be deleted with `nefia recording delete` when retention policies allow.

How does batch execution work?+

The `--batch-size` and `--batch-wait` flags enable rolling execution across large fleets. For example, `nefia exec --target group:prod --batch-size 5 --batch-wait 30s` restarts a service on 5 hosts at a time with a 30-second pause between batches. Use `--subset N` to test on a random subset first, and `--rerun failure --last-job-id <id>` to retry only the hosts that failed in a previous run.

What is SSH CA certificate management?+

Nefia includes a built-in SSH Certificate Authority. Use `nefia sshca` to issue short-lived SSH certificates for hosts and users, eliminating the need to distribute and manage individual SSH keys. Certificates include principal restrictions, validity periods, and critical options. This is especially useful for large fleets where key rotation at scale is impractical.

Does Nefia support high availability?+

Yes. The operator CLI supports Raft-based clustering via `nefia cluster` for high availability. Multiple operator nodes form a consensus group with automatic leader election, log replication, and a Unix socket admin API. This ensures that if the primary operator goes down, another node takes over without manual intervention.

Documentation

From setup to automation, get started quickly.

Follow the command guide through guided setup, host validation, session workflows, and MCP setup. Step-by-step instructions from first run to safe production operations.