Installation
Requires Node.js 18 or later. Choose either method below — first-time setup takes about 2 minutes.
Run without installing (quick trial)
Install globally, then run directly (recommended for auto-start)
$ npm install -g shennian
$ shennian
Pairing Devices
Pairing is a one-time step. Once paired, the connection persists automatically. The whole process takes under 30 seconds.
Run the CLI on the target machine
Prefer npm install -g shennian, then run shennian. The CLI registers with the relay server and prints a QR code and pairing token; use npx shennian for one-off trials.
Open the Shennian app
On your phone, open Shennian, go to "Settings" and tap "Scan", or go to "My Machines" and tap "Add Machine".
Scan or paste the token
Scan the QR code shown in the terminal, or choose "Paste Token" and enter the sn-... code.
Done
The machine appears in your app as "Online". Next time the CLI starts, it reconnects automatically — no re-pairing needed.
Tip: If the token expires or the machine is reset, tap "Re-pair" in the machine detail screen to generate a new one.
Send Your First Message
Once a machine is paired and online, select it in the app, launch an Agent, and start chatting.
Select a machine
Switch to the Machines tab at the bottom of the app, then tap any machine marked as "Online".
Choose an Agent
Pick an Agent from the list (Claude, Codex, Gemini, Cursor, OpenClaw, or Nian) and set the working directory for the session.
Launch the Agent
Tap "Launch" and wait for the Agent to become ready (usually 3–5 seconds).
Send a message
Type your message and tap Send. The Agent's response streams back to the conversation in real time.
Tap the 📎 icon in the input bar to attach local files as context.
CLI Reference
All options can be set via CLI flags or environment variables. CLI flags take precedence.
Flags
--name <n>
Machine display name (default: hostname)
--relay <url>
Relay server URL (default: wss://relay.shennian.ai)
--token <t>
Use an existing pairing token, skip QR flow
--port <p>
Local port for the agent bridge (default: random)
--version
Print version and exit
Environment Variables
SHENNIAN_NAME
Same as --name
SHENNIAN_RELAY
Same as --relay
SHENNIAN_TOKEN
Same as --token
Custom Agent Integration
Shennian communicates with Agent processes via a lightweight Wire protocol. Any process that speaks stdio or WebSocket can be integrated with zero changes to existing Agent code.
Integration Modes
stdio mode (recommended): The CLI spawns the Agent as a child process and exchanges messages over stdin/stdout. Compatible with all existing Agent CLIs.
WebSocket mode: The Agent connects to a local WebSocket exposed by the CLI. Ideal for long-running daemon processes.
Full protocol spec, message format, and example integrations on GitHub:
FAQ
Do I need to open any firewall ports?
+
Does my code and conversation pass through your servers?
+
Can I self-host the relay server?
+
Which Agents are supported?
+
Changelog
初始发布 · 支持 Claude / Codex / Nian,内置文件系统,HTTPS 全程加密。