Skip to content

CLI Command Reference

anet is the Agent Network command-line management tool for Hub, account, Network, Agent Node, monitoring, and Demo operations.

Installation

bash
npm install -g @sleep2agi/agent-network

After installation, the anet command is available globally.

Command Overview

Quick Start

CommandDescriptionStatus
anet initConfigure hub addressverified
anet init projectConfigure Claude Code project (project is a literal subcommand, not a placeholder)verified
anet setupInteractive wizard to install runtime dependencies (pick claude CLI / agent-node / codex CLI / commhub-server as needed)verified

Server Management

CommandDescription
anet hub startStart CommHub Server
anet hub stopStop the local hub server (SIGTERM → 3s → SIGKILL)
anet hub statusShow hub PID + port + /health version
anet hub dashboardStart Dashboard UI
anet hub configView/change Hub config
anet hub admin reset-user --username <u>Locally reset a user's password

Account Management

CommandDescription
anet registerRegister an account
anet loginLog in
anet logoutLog out (clears the token from ~/.anet/config.json locally; the token still works server-side — use anet token revoke for full invalidation)
anet whoamiView current user
anet passwdChange password

Network Management

CommandDescription
anet network lsList networks
anet network create <name>Create a network
anet network use <name>Switch active network
anet network infoView current network details
anet network rename <old> <new>Rename a network
anet network delete <name> --forceDelete a network (owner-only; --force skips the confirm prompt)
anet network inviteCreate an invite code for the current network
anet network join <invite_code>Join a network with an invite code
anet network membersList members of the current network (role / joined_at)

Token Management

CommandDescription
anet token create <name>Create an API token (token is shown once; save it immediately)
anet token / anet token lsList all tokens (default subcommand = ls)
anet token revoke <id>Revoke a token (immediate server-side invalidation)

Agent Node Management

CommandDescription
anet node create <name>Create an agent node
anet node start <name>Start an agent
anet node stop <name>Stop an agent
anet node resume <name>Resume previous session
anet node lsList all nodes
anet info <name>View agent details
anet logs <name>View agent logs (add --follow to tail in real time)
anet node rename <old> <new>Rename an agent — ⚠ The node must have been anet node started at least once (so a sessions row exists on the commhub server). Purely-created nodes that have never started will fail at the prepareRename step with node not found in network, #110. Workaround: run anet node start <old> once so the server registers it, then stop and rename. Fail-safe (PHASE 1 rollback — the old node stays intact)
anet node migrate-token-to-envref <name>Migrate plain-secret env values in this node's config.json (detected by key suffix _TOKEN/_KEY/_SECRET/AUTH or value prefix sk-/utok_/ntok_/atok_/ak-/gsk_/key-/Bearer ) to the envRef shape { _envRef: "<KEY>_<NODE_SUFFIX>" }, so secrets no longer persist on disk. Writes a config.json.bak-<ts> backup and prints the export lines you need to set the env variables. See Security — Vendor Credential Storage envRef mode + Tokens — envRef (#125)
anet node delete <name>Delete an agent. Two-step pattern: the first run only prints a will-delete preview + the message "Run again with --force to confirm"; the second run, with --force, actually deletes. Does not auto-revoke the ntok_ — pair with anet token revoke <id> for full cleanup, see Token lifecycle.

Session binding (claude-code-cli runtime)

Only the claude-code-cli runtime touches Claude Code sessions (~/.claude/projects/<cwd>/*.jsonl); the claude-agent-sdk / codex-sdk runtimes have no Claude Code session semantics.

CommandDescription
anet node create <name> --resume <id>Create a node bound to a specific session (errors out and exits if the id is unknown, cli.ts)
anet node create <name> --resume-latestCreate a node bound to the most recent session (listClaudeSessions()[0], cli.ts)
anet node create <name>Interactive picker on TTY (age / size / 60-char first-line preview, cli.ts); non-TTY falls back to a random session id
anet node start <name> --new-sessionForce a fresh session (overrides profile.session)
anet node resume <name> [--session <id>]Resume a session (see anet node resume)
anet session lsList Claude Code sessions in the current cwd (the picker and ls share listClaudeSessions() cli.ts)

Zero-keystroke recovery: since #115, anet node start injects CLAUDE_CODE_RESUME_THRESHOLD_MINUTES=999999999 (cli.ts) into the claude spawn env, skipping Claude Code's default 70-minute session-age threshold for the "Resume from summary / full / Don't ask again" interactive prompt — so restarting a batch of nodes needs no per-node keypress. The injection is per-spawn, does not touch ~/.claude/settings.json, and respects an explicit user override. Resume restores the full session as-is (no per-invocation flag forces a compact summary; per the #115 commit message, restart-recovery is safer without unexpected compaction).

Project-wide (cwd)

Scans every node under the current cwd's .anet/nodes/ and starts / restarts / stops them as a batch. See issue #117 and verify cli.ts projectCommand.

CommandDescription
anet project upStart every node (skip already-running, idempotent; ▶ started / ⏭ already-running)
anet project restartKill existing tmux + start fresh per node (↻ restarted / ▶ started)
anet project downStop every node (kill tmux + notify hub offline; ⏹ stopped)

Shared options:

OptionDefaultDescription
--stagger <seconds>3Delay between nodes; 0 disables
--only a,b,cOperate only on these aliases or node IDs
--exclude x,ySkip these aliases or node IDs

down caps the hub-offline notify at a 2-second timeout (cli.ts) — this command is commonly used in the "hub itself crashed" scenario, where serially fetching offline notifications for 22 nodes would hang on 44 timeouts and deadlock the teardown; the 2 s race guarantees a fast worst-case teardown.

Monitoring

CommandDescription
anet statusNetwork overview (online agents + task stats)
anet tasks [status]View task list
anet doctorSystem diagnostics (add --fix to auto-probe and re-issue expired ntok_ back to the node config)

Demo (multi-agent showcase)

CommandDescription
anet demo lsList available demos
anet demo debate [opts]Debate: 6-role (host / pro × 2 / con × 2 / judge) one-command 9-step debate
anet demo socialmedia [opts]Social media content factory: 4 roles (topic / copy / image / reviewer), ~3 min
anet demo pr-review [opts]Code PR review room: 4 roles (3 reviewers — security / perf / style — running in parallel + judge), ~2 min
anet demo sci-team [opts]Research squad: 1 leader + N-1 workers (default 10, tunable 5-50). Phase 1 scaffold — the leader is currently a placeholder echo; real intelligent fan-out is queued for RFC-008 Phase 2 (RFC status: Proposed; tracked in #51)

Channel Management

CommandDescription
anet channel add <type>Add a channel (telegram/wechat/feishu)
anet channel lsList channels

Goal Management (#191 / #184)

/goal / /loop scheduled in-agent periodic tasks are persisted to .anet/nodes/<node>/goals.json; this group handles local-side CRUD (details under anet goal).

CommandDescription
anet goal list [node]List local goals (omit node to scan all nodes)
anet goal show <node> <id>Show one goal in detail + last 10 progress_log entries
anet goal edit <node> <id> [--interval ...] [--text "..."] [--status ...]Edit interval/text/status (at least one flag)
anet goal cancel <node> <id>Mark a goal as cancelled

A running agent-node keeps its goal state in memory — after editing goals.json you must restart the node for changes to take effect (live goal control via commhub MCP tools is planned in issue #191 Phase 1 Pillar C, design under review).

Other

CommandDescription
anet configRead-only view of ~/.anet/config.json (anet config path prints the path, anet config json prints raw JSON). To modify config, use anet login / anet init / anet network use — there is no anet config --set. Verified at cli.ts configShowCommand.
anet upgradePrints an upgrade plan (self-upgrade is disabled by default to avoid replacing the running CLI process mid-run; gives manual steps). Full guide: Upgrade Guide
anet create --batch / anet batch <verb>Spin up N agents in bulk (auto-numbered prefix + separate workdir/config/tmux), then manage their lifecycle with anet batch list/start/stop/restart/cleanup. See Batch Agents
anet license / anet activate <key>v0.6 legacy commands. OSS users don't need to touch these. anet license now prints License: Apache-2.0 (open source) plus a couple of related lines. anet activate only matters as a fallback when you hit license_expired. Full detail: troubleshooting — license_expired.
anet session lsList Claude Code sessions in the current project (for the claude-code-cli runtime)
anet import [alias]Import claude-code agent sessions from CommHub into local .anet/nodes/<alias>/config.json (imports all if no alias is given)
anet runStarts a minimal standalone SSE agent via the Client SDK: connects to the hub, listens for tasks, and auto-echoes a "received" reply — no LLM. Requires --alias, --hub optional. Unlike anet node start (which runs a real AI runtime), anet run is just a minimal connectivity demo. Verify cli.ts runCommand

Detailed Usage

anet hub start

Source ↗

Start the CommHub communication server.

bash
anet hub start [options]

What it does:

  1. Starts CommHub without requiring COMMHUB_AUTH_TOKEN in v0.8+
  2. Starts CommHub on 127.0.0.1:9200 by default
  3. Creates the SQLite database at ~/.commhub/commhub.db
  4. First run only: bootstraps admin with default credentials admin / anethub (quick-start), saves the admin utok_ to ~/.anet/server/admin-utok.json (chmod 600). Change this password immediately via anet passwd.
  5. Saves the local Hub URL to ~/.anet/config.json
  6. Reuses a valid saved utok_ if one exists; otherwise anet login --username admin --password anethub

Expected output

anet hub start
Starting CommHub Server on port 9200 (bind 127.0.0.1)...
✅ Server running on http://127.0.0.1:9200 (commhub-server v0.8.4)
🔒 secured
✅ Admin account created
   username: admin
   password: anethub
   Store this password now; it will not be shown again.
   Admin token saved to ~/.anet/server/admin-utok.json

Custom credentials (recommended for public deployment)

Default admin / anethub is fine only for local quick-start. For public deployment, set a strong password at bootstrap:

bash
anet hub start --username alice --password 'your-strong-pass!'

Custom passwords must be ≥ 8 chars and not in the top-1000 weak-password dictionary. The default credentials bypass this strength check — change via anet passwd ASAP.

Subsequent starts

Once admin is bootstrapped (~/.anet/server/admin-utok.json exists), anet hub start is idempotent:

✅ Admin already exists (admin-utok.json found, user=admin)
ParameterDefaultDescription
--port9200Listen port
--host / --ip127.0.0.1Bind address; use 0.0.0.0 for LAN access
--usernameadminCustom admin username
--passwordanethub (quick-start default)Custom admin password (≥8 chars + not in weak-password dict; default bypasses check)
--dev-openfalseDangerous: runs with no auth, only for offline tutorials

Environment variables:

VariableDescription
PORTListen port
COMMHUB_AUTH_TOKENLegacy master token env; deprecated in v0.8
DATABASE_URLPostgreSQL connection (v0.8+ product direction has pivoted to SQLite only — see v3-postgresql-design.md banner; adapter kept only as a community extension point / no E2E coverage, not recommended for mainline production; default SQLite)
COMMHUB_CORS_ORIGINSCORS whitelist

anet hub stop

Source ↗ (serverCommand "stop" branch)

Added in v0.10.11 (#200)

This command shipped in v0.10.11 and is now in npm @latest. If you're still on v0.10.10 or earlier, just anet upgrade.

Stop the local CommHub Server. Uses lsof -t -i :<port> -sTCP:LISTEN to find the process, sends SIGTERM for a graceful exit, and falls back to SIGKILL after a 3-second grace window if anything is still listening.

bash
anet hub stop                # default port 9200
anet hub stop --port 8080    # custom port

Works even when no foreground process is available (before v0.10.11 you had to fall back to lsof -ti:9200 | xargs kill by hand; #200 removed that gap).

anet hub status

Source ↗ (serverCommand "status" branch)

Added in v0.10.11 (#199)

This command shipped in v0.10.11 and is now in npm @latest. If you're still on v0.10.10 or earlier, just anet upgrade.

Show the hub's running state — listener PID, port, and the server version reported by /health.

bash
anet hub status              # default port 9200
anet hub status --port 8080  # custom port

Sample output:

[anet] hub: ✅ running on http://127.0.0.1:9200
[anet]   pid(s):         123456
[anet]   server version: 0.8.4-preview.0

If nothing is listening on the port the command prints Hub not running on port <port> and a hint to run anet hub start.

anet passwd

Source ↗

Change the current logged-in user's password. By default it prompts for old password, new password, and confirmation. Scripts may pass --old / --new.

bash
anet passwd
anet passwd --old old-password --new new-password

On success the hub returns a fresh utok_; CLI saves it back to ~/.anet/config.json. Other devices' utok_ are revoked. Agent ntok_ credentials are not affected.

anet hub admin reset-user

Source ↗

Local hub-host recovery command. It bypasses HTTP and reads SQLite directly.

bash
anet hub admin reset-user --username alice

It generates a random password, revokes all user utok_, issues a fresh utok_, and writes password_reset_by_admin to audit_log. The password is printed once.

anet node create

Source ↗ (createCommand)

Create a new agent node.

bash
anet node create <name> [options]
ParameterDefaultDescription
--runtimeomit it to enter the interactive runtime-first wizard (#133 since v0.9.2): a 4-way picker chooses claude-agent-sdk / claude-code-cli / codex-sdk / grok-build-acp. Only claude-agent-sdk continues into the vendor picker + model selection + API-key prompt; the other three runtimes print the matching auth login hint and skip the vendor step (claude-code-cli prints claude auth login; codex-sdk prints codex auth login; grok-build-acp prints grok auth login (this runtime also needs the XAI_API_KEY env — see runtimes)). For the full wizard order, see Getting Started §5.claude-agent-sdk / codex-sdk / claude-code-cli / grok-build-acp
--model(per runtime default)Model name

Examples:

bash
# Interactive creation
anet node create my-agent

# Direct specification
anet node create code-assistant --runtime codex-sdk --model <codex-model-id>

# MiniMax Agent
anet node create translator --runtime claude-agent-sdk --model <minimax-model-id>

After creation, a config file is generated at .anet/nodes/<node-name>/config.json (directory name is the alias, not the internal node_id). Below is the actual output of the codex-sdk example command above (no extra flags):

json
{
  "anet_version": "0.1.0",
  "node_id": "n_a1b2c3d4",
  "node_name": "code-assistant",
  "alias": "code-assistant",
  "runtime": "codex-sdk",
  "model": "<codex-model-id>",
  "channels": ["server:commhub"],
  "env": {},
  "flags": {
    "dangerouslySkipPermissions": true
  }
}

The following fields are generated conditionally — not every node has them: teammateMode (only for the claude-code-cli runtime, default in-process), session (only for claude-code-cli or when --session is passed), maxTurns (only when --max-turns is passed), tools (only when --tools is passed).

v0.10.10+ envRef wizard auto-source (#193)

When you choose the claude-agent-sdk runtime + a third-party vendor (Xiaomi MiMo / MiniMax / Shusheng / GLM, etc.) and paste your API key, the wizard automatically writes the key to .anet/nodes/<alias>/.env (mode 0600, auto-added to .anet/.gitignore); config.json.env.ANTHROPIC_AUTH_TOKEN only stores the envRef reference { "_envRef": "ANTHROPIC_AUTH_TOKEN_N_<id>" }secrets are no longer persisted on disk in plaintext.

When you then run anet node start <alias> from the same shell, the .env is sourced automatically before launch — no manual export ANTHROPIC_AUTH_TOKEN_N_<id>=... needed. Debug logs only print loaded N key(s) from .anet/nodes/<alias>/.env; key values are never echoed.

Cross-machine deploy is still supported: the wizard still prints the export command once so you can copy it to another machine before running start.

anet node start

Source ↗

Start an agent node. Default is foreground (stdio inherits the current terminal); pass --tmux to launch the node inside a new tmux session and attach.

v0.9.0 briefly introduced an "auto-wrap into detached tmux" default (#122). v0.9.2 reverts it via #136 — detached tmux triggered setRawMode errno 5 on macOS bun (the detached child's stdio isn't a real PTY, claude-code-cli's setRawMode call failed). The new --tmux path is attached (tmux new -As), keeping the PTY chain intact so setRawMode works everywhere.

Want to re-attach to a running tmux node?

There is no top-level anet attach <alias> subcommand today (#121 is planned, not yet implemented). To re-attach:

  • tmux a -t <alias> — direct tmux command
  • or anet node start <alias> --tmux — the --tmux flag uses tmux new -As, which attaches if the session already exists
bash
anet node start <name> [options]
ParameterDefaultDescription
--tmuxfalseStart in a new tmux session and attach (session name = alias; -A attaches if it already exists). Detach with Ctrl-B D.
--new-sessionfalseIgnore previous Claude session, create a new one (the "start over" path on the --resume chain)

Default (no flag):

bash
anet node start <name>
# Foreground in this terminal, stdio inherited. Ctrl-C to exit.
# Want a background tmux session? Either roll your own —
#   tmux new -s <name>
#   anet node start <name>
# — or pass --tmux for the one-liner:
anet node start <name> --tmux

--tmux semantics: internally runs tmux new -As <alias> -c <cwd> "anet node start <alias>":

  • -A — if a same-name session already exists, attach to it instead of erroring (rerun-friendly)
  • -s — session name = alias (discoverability)
  • -c — start in the current cwd
  • the inner command does not carry --tmux, so the inner anet node start runs foreground — no recursion
  • the parent terminal becomes a tmux client, keeping the PTY chain intact: claude-code-cli setRawMode, Ctrl-C, raw input all work normally

--tmux fallback: if tmux isn't installed, the command errors out and suggests installing tmux or dropping the flag to run foreground.

anet node stop behavior: when a same-name tmux session exists, tmux kill-session runs first, then SIGTERM the recorded PID + notify the hub. This applies both to sessions created by --tmux and to the detached sessions anet project up (#117) spawns; output reports either "tmux + process killed" or just "process killed".

anet status

Source ↗

View network status overview.

bash
anet status

Example output:

Agent Network Status
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Network: default (net_a1b2c3d4)
Server:  http://localhost:9200

Nodes (5 online, 2 offline):
  🟢 commander    idle     Claude      3s ago
  🟢 coder-1     working  Codex (codex-sdk)     Writing sorting algorithm
  🟢 coder-2     idle     Codex (codex-sdk)     15s ago
  🟢 writer-1    idle     MiniMax     1m ago
  🟢 writer-2    idle     MiniMax     2m ago
  ⚪ tester-1    offline              2h ago
  ⚪ tester-2    offline              3h ago

Tasks: 42 replied, 3 running, 0 failed

anet tasks

Source ↗

View task list.

bash
anet tasks [status] [--limit <n>]
ParameterDescription
statusFilter by status; any state from the Task lifecycle state machine is accepted (delivered / acked / running / replied / failed / cancelled / expired)
--limitNumber of items (default 20)

Examples:

bash
# View all tasks
anet tasks

# Show only failed tasks
anet tasks failed

# Limit item count
anet tasks --limit 5

anet doctor

Source ↗

System diagnostics.

bash
anet doctor              # Diagnose only; prints ✅ / ❌ per check with fix hints
anet doctor --fix        # Auto-repair: (a) migrateNode converts V2 legacy fields (alias/resume/legacy_runtime_name) to v0.8 schema (b) probes expired ntok_ and re-issues them via the hub, writing back to .anet/nodes/<name>/config.json

Checks (in actual order per cli.ts doctorCommand):

  1. Global config (~/.anet/config.json — has hub / token?)
  2. Auth token presence
  3. Hub reachability (GET /health — shows sessions / SSE / license / multi-network info)
  4. Local node configs + per-node process status + legacy-field diagnosis (diagnoseNode cli.ts detects 8 issue kinds: legacy_alias_field / legacy_resume_field / legacy_runtime_name / stale_dev_hub / missing_token / user_token / untyped_token / missing_node_id)
  5. Dependencies: claude --version / codex --version / bun --version
  6. Current project .mcp.json commhub config
  7. Telegram channel env (~/.claude/channels/telegram/.env silently empty? — known token-loss foot-gun for /telegram:configure)

--fix is new in v0.8

Pre-v0.7, an expired ntok_ required a manual anet node delete + recreate. Since v0.8, --fix probes + re-issues in place, and agent-node SSE 401 auto-reloads the token instead of going offline (RFC-001 Phase 2 implementation detail).

anet upgrade

Source ↗

Print / execute the upgrade plan — covers 4 packages (anet self / agent-node / commhub-server / agent-network-dashboard) across two channels (preview / latest, auto-detected or overridden via --channel). Rewritten in #88 for v0.9.0+; the old behavior covered only 2/3 packages and silently downgraded preview-channel users to @latest.

bash
anet upgrade [--channel preview|latest] [--self] [--dry-run]
ParameterDefaultDescription
`--channel previewlatest`auto-detect
--selffalseTrigger a detached self-spawn upgrade of anet itself (sh -c 'npm install -g ... && anet -v', stderr → /tmp/anet-self-upgrade.err); without this flag the default just prints the manual command, avoiding replacing the running CLI process mid-upgrade
--dry-runfalsePrint the plan only — do not actually run
--fork-scriptDeprecated, retained for back-compat

Plan output (one line per package):

  anet (self)         2.2.0                →  2.2.10               → upgrade
                      (since v0.10.6 #154 anet upgrade auto-detached-spawns by default — no --self flag needed when self is < target;
                       chicken-and-egg note for users on 2.2.4 or older: one-time manual `npm install -g @sleep2agi/agent-network@latest`
                       to reach 2.2.5+, then subsequent `anet upgrade` will auto-detached-spawn)
  agent-node          2.4.0                →  2.4.9                → upgrade
  commhub-server      not installed        →  0.8.4                (lazy via npx, skipped)
                      (not installed globally — lazy-fetched via npx by `anet hub start`)
  dashboard           0.5.0                →  0.5.6                → upgrade
BadgeMeaning
→ upgradecurrent < target, install the new version
✓ up to dateAlready at target, skipped
(lazy via npx, skipped)Not installed globally — anet auto-fetches via bunx/npx, no global upgrade required
(self — see below)anet does not self-upgrade by default (pass --self)
⚠ npm registry lookup failedBad package name or network issue

commhub-server row always carries the note: (anet hub start uses pinned <PINNED_SERVER_VERSION>)anet hub start runs that pinned version regardless of what's globally installed (to avoid server-breaking churn). A global install is only useful for bunx @sleep2agi/commhub-server direct runs.

Node version check: below engines.node (22.13.0) only warns — does not block (preview.9+ really does fail, but users who explicitly know what they're doing get to proceed). The warning suggests nvm install 22 && nvm use 22.

After upgrade, recommend anet project restart (#117) so already-started nodes under cwd pick up the new agent-node version.

Full upgrade walkthrough: Upgrade Guide.

anet project

Source ↗

Cwd-wide node orchestration, introduced in #117 (v0.9.0+, on npm latest since v0.10.0, verify agent-network/bin/cli.ts case "project").

bash
anet project <up|restart|down> [--stagger <seconds>] [--only a,b] [--exclude x,y]
SubcommandBehavior
anet project upStart every node under cwd's .anet/nodes/; same-name tmux already running is skipped (▶ started / ⏭ already-running)
anet project restartKill each node's existing tmux session, then start fresh (↻ restarted / ▶ started)
anet project downStop every node + notify hub offline (⏹ stopped)

down's 2 s offline-notify timeout (cli.ts): this command is commonly used when the hub itself has crashed; serially fetching offline notifications for 22 nodes would hang on 44 timeouts and deadlock the teardown. Promise.race + setTimeout(2000) guarantees a fast worst-case teardown.

Node selection: --only / --exclude take aliases or node IDs (comma-separated, parsed via splitCsv).

Pairs with #115: every inner anet node start is spawned by startNodeTmuxSession; CLAUDE_CODE_RESUME_THRESHOLD_MINUTES=999999999 is auto-injected to skip Claude Code's resume prompt — recovering 22 nodes after reboot via anet project up is genuine zero-keystroke recovery.

⚠ Since v0.9.2 anet node start defaults to foreground (#136). anet project up still spawns each node into a detached tmux session as before, which can re-trigger setRawMode errno 5 on macOS bun (same root cause as #136) — affected users should pre-create a tmux new -s mybox then sequentially run anet node start <alias> --tmux per node. Tracking issue for the bulk-detached path: #136 follow-up.

anet network invite

Source ↗

Create a network invite code.

bash
anet network invite [options]
ParameterDefaultDescription
--rolememberInvited role: admin / member / viewer
--uses1Maximum uses, -1 for unlimited
--expires(none)Expiration in days

Examples:

bash
# Switch to the target network first
anet network use dev

# Create a single-use invite code
anet network invite

# Create a 10-use member invite code
anet network invite --role member --uses 10

# Create a 7-day expiring viewer invite code
anet network invite --role viewer --expires 7

anet token create

Source ↗

Create an API token.

bash
anet token create <name>

Examples:

bash
# Create an API token
anet token create my-agent-token

Security Note

The created token is displayed only once. Store it securely. If lost, you'll need to create a new one.

anet node resume

Source ↗

Resume a previously interrupted agent session. When an agent crashes, is manually stopped, or exits unexpectedly, use this command to restore context without losing conversation history.

bash
anet node resume <name> [--session <id>]
ParameterDescription
<name>Agent name (alias)
--sessionSpecify a session ID to resume (optional)

If --session is not specified, the last session saved in config.json is used.

Automatic session saving:

  • After each task completion, Agent Node automatically saves the session_id (Claude) or thread_id (Codex) to the session field in config.json
  • On the next anet node resume, this is read automatically -- no manual tracking needed

Use cases:

  • Agent process crashed or was killed, need to restore context and continue working
  • After a manual anet node stop, want to continue where the previous conversation left off
  • Network disconnect caused the agent to go offline, resume after reconnecting
bash
# Resume last session
anet node resume commander

# Resume a specific session
anet node resume worker --session abc123

Difference from anet node start

anet node start creates a new session by default. If you want to restore an old session, use anet node resume. If you want to force a new session, use anet node start <name> --new-session.

anet init project

Source ↗

Initialize a Claude Code project with automatic MCP and CLAUDE.md configuration.

Here, project is a literal subcommand keyword, not a replaceable project-name placeholder. Type anet init project exactly. It initializes configuration in the current directory; it does not create a new directory named project.

bash
anet init project

Auto-created files:

{project}/
├── .mcp.json            # MCP Server config
├── CLAUDE.md            # Agent behavior rules
└── .anet/
    ├── node-server.js   # Channel plugin (auto-copied from the npm package's dist/src/node-server.js)
    └── package.json     # Dependencies

.mcp.json contents:

json
{
  "mcpServers": {
    "commhub": {
      "type": "stdio",
      "command": "bun",
      "args": [".anet/node-server.js"]
    }
  }
}

anet goal

Source ↗

Local management of agent-node scheduled goals (the /goal / /loop periodic tasks spawned in-agent — issue #184 Phase 1 persists them to .anet/nodes/<node>/goals.json; issue #191 Phase 1 Pillar A completes the CLI CRUD surface).

bash
anet goal <subcommand> [args] [flags]

Subcommands:

SubcommandPurpose
list [node]Omit node to scan all nodes; pass a node to list only that one. Empty nodes are skipped; when nothing matches, prints No goals found.
show <node> <id>Detailed view + last 10 progress_log entries + runtime / parent_task_id / report_to
edit <node> <id> ...Edit interval / text / status (at least one flag), atomic write (tmp + rename)
cancel <node> <id>Set the goal to cancelled and append a progress_log entry

<id> accepts prefix matching (8 chars is usually enough; ambiguous prefixes are rejected with a hint to use a longer id).

edit flags:

FlagAccepted valuesNotes
--interval5min / 10min / 1h / 1d / 每5分钟 / 每小时 / hourly / daily / ...Same rule set as the agent-node's in-process /goal parser; sub-minute values are rejected (MIN_INTERVAL_MS = 60s, prevents wake-storms). After the change next_wake_at = now + new interval, so the new cadence kicks in on the next tick instead of waiting out the old window.
--textAny non-empty stringReplaces the goal text wholesale
--statusactive / paused / completed / cancelledAllow-listed; other values are rejected

At least one flag is required, otherwise the command prints No edit flags supplied. Each successful edit automatically appends a progress_log entry summarising the changed fields, preserving the audit trail.

Examples:

bash
# List local goals across all nodes
anet goal list

# Filter by node
anet goal list my-coder

# Inspect one goal in detail
anet goal show my-coder abcd1234

# Change interval to 10 minutes
anet goal edit my-coder abcd1234 --interval 10min

# Update text and status in one call
anet goal edit my-coder abcd1234 \
  --text "Check the deploy every 10 minutes and report anomalies to the room" \
  --status active

# Pause a goal
anet goal edit my-coder abcd1234 --status paused

# Cancel a goal
anet goal cancel my-coder abcd1234

A running node does not pick up local goals.json edits automatically: agent-node currently keeps goal state in memory. After anet goal edit/cancel, the CLI checks .pid / tmux for the node and prints node appears to be running; restart it for local goals.json changes to take effect. Live goal control (agents themselves CRUD-ing goals via commhub MCP tools) is planned as issue #191 Phase 1 Pillar C, awaiting design review.

Common Options

Common commands read these options or their saved config equivalents:

OptionDescription
--hub <url>CommHub Server address
--helpShow help
--versionShow version

Since v0.8, authentication goes through anet login --hub <URL> --username --password (one-step) or anet login to obtain utok_; the legacy --token master-token flag is no longer the recommended path. See Tokens + RFC-001.

Environment Variables

VariableDescriptionPriority
COMMHUB_URLCommHub Server addressenv > config file (CLI --hub is highest)
COMMHUB_ALIASAgent aliasenv > config file (CLI --alias is highest)
COMMHUB_TOKENAuth tokenagent-node: lowest — node config (ntok_) > global config > this env, and if the env conflicts with the node config it is ignored + a warning is logged (agent-node/src/cli.ts, to stop a leftover export from routing replies to the wrong network). In the anet CLI it's env > global config instead.
COMMHUB_AUTH_TOKENServer-side legacy master token (v0.8 soft-deprecated, removed in v1.0) — read by the hub process, not an agent-connection priority variableserver-side
ANTHROPIC_BASE_URLModel API URL (MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter and other third-party Anthropic-compatible endpoints; full provider list in multi-model)-
ANTHROPIC_AUTH_TOKENModel API key — for third-party Anthropic-compatible endpoints-
ANTHROPIC_API_KEYModel API key — only for direct api.anthropic.com (see runtimes pitfalls)-

Next steps

Hands-on starter:

Behind the commands:

v0.8 new tools:

  • anet passwd — change password (see Security)
  • anet hub admin reset-user <username> — local owner force-reset
  • anet doctor --fix — auto-probe + reissue expired ntok_
  • anet hub start — first run auto-bootstraps admin (default admin / anethub)

Full upgrade guide: v0.7 → v0.8 upgrade notes

Powered by Sleep2AGI