Skip to main content

Documentation Index

Fetch the complete documentation index at: https://xerg.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Examples use npx @xerg/cli. If you installed the CLI globally, substitute xerg.
Remote SSH, Railway, and --remote-config flows are OpenClaw-only in this phase. Hermes support is local-only.
Use this page in order:
  • start with the init-first path
  • pick the source type you actually want to inspect
  • copy the exact command block for that workflow
  • come back to the later sections for push, CI, and troubleshooting

1. Init-first path

If you only remember four commands, remember these:
npx @xerg/cli init
npx @xerg/cli audit --compare
npx @xerg/cli connect
npx @xerg/cli mcp-setup
What they mean:
  • init: detects local OpenClaw or Hermes data and runs the first audit
  • audit --compare: compares against the newest compatible saved snapshot
  • connect: handles hosted auth and offers to push the latest audit
  • mcp-setup: prints or writes hosted MCP config for a supported client
Quick utility commands:
npx @xerg/cli --help
npx @xerg/cli --version
npx @xerg/cli -v
Use these when you want the top-level command list or just the installed CLI version.

2. Command map

GoalCommandUse when
Guided first auditinitYou want the fastest local-first onboarding path
Check local readinessdoctorYou want to confirm paths and detection before auditing
Run an auditauditYou want spend, waste, opportunities, workflows, and models
Compare before and afteraudit --compareYou already have a prior compatible cached snapshot
Connect to hosted XergconnectYou want guided auth and an optional push prompt
Push a new result immediatelyaudit --pushYou want to compute and push in one step
Push a cached result laterpushYou already ran an audit and want to send the latest saved snapshot
Configure hosted MCPmcp-setupYou want Cursor, Claude Code, Codex, or another client to use hosted MCP
Authenticate in browserloginYou want hosted push or other API-backed features
Remove saved credentialslogoutYou want to clear local auth state

3. Choose the right starting command

Use this quick decision guide:
  • Brand-new first run: npx @xerg/cli init
  • Not sure whether Xerg can see your data: npx @xerg/cli doctor
  • Ready to run the first local audit: npx @xerg/cli audit
  • Want machine-readable output: npx @xerg/cli audit --json
  • Want a shareable report: npx @xerg/cli audit --markdown
  • Want before/after deltas: npx @xerg/cli audit --compare
  • Want to analyze Cursor export data: npx @xerg/cli audit --cursor-usage-csv [file]
  • Want to inspect a remote OpenClaw target first: npx @xerg/cli doctor --remote [user@host] or npx @xerg/cli doctor --railway

4. Direct local audits

Default local detection:
npx @xerg/cli doctor
npx @xerg/cli audit
Force a specific runtime:
npx @xerg/cli doctor --runtime openclaw
npx @xerg/cli doctor --runtime hermes
npx @xerg/cli audit --runtime openclaw
npx @xerg/cli audit --runtime hermes
Use --runtime when:
  • both OpenClaw and Hermes are present locally
  • you want deterministic behavior in automation
  • you are passing explicit local paths and already know the runtime

5. Point Xerg at explicit local paths

OpenClaw:
npx @xerg/cli doctor --runtime openclaw --log-file /path/to/openclaw.log
npx @xerg/cli doctor --runtime openclaw --sessions-dir /path/to/sessions
npx @xerg/cli audit --runtime openclaw --log-file /path/to/openclaw.log
npx @xerg/cli audit --runtime openclaw --sessions-dir /path/to/sessions
Hermes:
npx @xerg/cli doctor --runtime hermes --log-file ~/.hermes/logs/agent.log
npx @xerg/cli doctor --runtime hermes --sessions-dir ~/.hermes/sessions
npx @xerg/cli audit --runtime hermes --log-file ~/.hermes/logs/agent.log
npx @xerg/cli audit --runtime hermes --sessions-dir ~/.hermes/sessions
Useful rule of thumb:
  • use doctor first when you are not sure the paths are correct
  • use audit once doctor shows the files you expect

6. Analyze a Cursor usage CSV

Inspect the CSV first:
npx @xerg/cli doctor --cursor-usage-csv ~/Downloads/usage-events.csv
Run the audit:
npx @xerg/cli audit --cursor-usage-csv ~/Downloads/usage-events.csv
npx @xerg/cli audit --cursor-usage-csv ~/Downloads/usage-events.csv --json
Use this path when you want to analyze Cursor export rows instead of agent logs and session transcripts.

7. Output modes and compare

Human-readable terminal report:
npx @xerg/cli audit
JSON for automation:
npx @xerg/cli audit --json
Markdown for sharing:
npx @xerg/cli audit --markdown > xerg-audit.md
Remember:
  • --json and --markdown are mutually exclusive
  • plain audit is best for manual inspection
  • --json is best for agents and scripts
Compare against the newest compatible saved audit:
npx @xerg/cli audit --compare
npx @xerg/cli audit --compare --json
Limit the comparison window:
npx @xerg/cli audit --since 24h --compare
npx @xerg/cli audit --since 7d --compare
Important:
  • --compare needs saved local snapshots
  • --compare and --no-db cannot be used together

8. Remote OpenClaw audits

SSH

Inspect first:
npx @xerg/cli doctor --remote [email protected]
Audit:
npx @xerg/cli audit --remote [email protected]
npx @xerg/cli audit --remote [email protected] --since 24h
Custom remote paths:
npx @xerg/cli doctor \
  --remote [email protected] \
  --remote-log-file /var/log/openclaw \
  --remote-sessions-dir /srv/openclaw/sessions

npx @xerg/cli audit \
  --remote [email protected] \
  --remote-log-file /var/log/openclaw \
  --remote-sessions-dir /srv/openclaw/sessions

Railway

Inspect the linked service:
npx @xerg/cli doctor --railway
Audit the linked service:
npx @xerg/cli audit --railway
Use explicit Railway IDs:
npx @xerg/cli doctor \
  --railway \
  --project <project-id> \
  --environment <environment-id> \
  --service <service-id>

npx @xerg/cli audit \
  --railway \
  --project <project-id> \
  --environment <environment-id> \
  --service <service-id>

Multi-source config

Run a multi-source OpenClaw audit:
npx @xerg/cli audit --remote-config ~/.xerg/remotes.json
Use this when one command needs to inspect several SSH and Railway sources.

9. Hosted follow-up, push, and authentication

Guided hosted path:
npx @xerg/cli connect
npx @xerg/cli mcp-setup
Push as part of the audit:
npx @xerg/cli audit --push
Preview the exact push payload:
npx @xerg/cli audit --push --dry-run
Push the newest cached snapshot later:
npx @xerg/cli push
npx @xerg/cli push --dry-run
Push a saved payload file:
npx @xerg/cli push --file ./audit-payload.json
Browser auth:
npx @xerg/cli login
npx @xerg/cli logout
Non-interactive auth:
XERG_API_KEY=sk_live_or_test_key npx @xerg/cli audit --push
Useful distinction:
  • use connect when you want guided auth and an optional push prompt
  • use audit --push when you are computing a fresh audit right now
  • use push when you already have a saved audit snapshot and only want to send it

10. CI and automation

Threshold gates:
npx @xerg/cli audit --fail-above-waste-rate 0.25
npx @xerg/cli audit --fail-above-waste-usd 100
Machine-readable output:
npx @xerg/cli audit --json
npx @xerg/cli audit --compare --json
Use XERG_API_KEY for non-interactive hosted automation.

11. More CI gates and automation

Fail on confirmed waste rate:
npx @xerg/cli audit --fail-above-waste-rate 0.30
Fail on confirmed waste dollars:
npx @xerg/cli audit --fail-above-waste-usd 50
Push and gate in one command:
npx @xerg/cli audit --push --fail-above-waste-rate 0.25
Remote CI gate for OpenClaw:
npx @xerg/cli audit --remote [email protected] --fail-above-waste-rate 0.20
Exit codes:
CodeMeaning
0success
1general failure
2no supported local runtime data found
3waste threshold exceeded

12. Troubleshooting shortcuts

Verbose local discovery:
npx @xerg/cli doctor --verbose
Force a runtime when local auto-detection is ambiguous:
npx @xerg/cli doctor --runtime openclaw
npx @xerg/cli doctor --runtime hermes
Check a remote target directly:
npx @xerg/cli doctor --remote [email protected]
npx @xerg/cli doctor --railway
Check the CLI help:
npx @xerg/cli --help
npx @xerg/cli audit --help
npx @xerg/cli doctor --help

13. Common copy-paste sequences

First local audit:
npx @xerg/cli init
Hermes local audit:
npx @xerg/cli doctor --runtime hermes
npx @xerg/cli audit --runtime hermes
Before and after workflow test:
npx @xerg/cli audit
# make one workflow or model change
npx @xerg/cli audit --compare
Export JSON for an agent:
npx @xerg/cli audit --json > xerg-audit.json
Remote OpenClaw audit over SSH:
npx @xerg/cli doctor --remote [email protected]
npx @xerg/cli audit --remote [email protected] --since 24h
Push into the hosted Xerg workspace:
npx @xerg/cli connect
npx @xerg/cli mcp-setup

14. Flag reference

FlagApplies toWhat it does
`—runtime [openclawhermes]`doctor, auditChooses the local runtime explicitly
--log-file [path]doctor, auditPoints Xerg at one explicit local gateway log
--sessions-dir [path]doctor, auditPoints Xerg at one explicit local sessions directory
--cursor-usage-csv [path]doctor, auditUses a local Cursor usage export instead of runtime files
--since [duration]auditLimits the audit window, for example 24h, 7d, or 30m
--compareauditCompares against the newest compatible saved snapshot
--jsonauditEmits JSON output
--markdownauditEmits Markdown output
--db [path]auditUses a custom SQLite path for local snapshot storage
--no-dbauditSkips local persistence
--remote [user@host]doctor, auditTargets an SSH OpenClaw host
--remote-log-file [path]doctor, auditOverrides the remote OpenClaw log path
--remote-sessions-dir [path]doctor, auditOverrides the remote OpenClaw sessions path
--remote-config [path]auditRuns a multi-source remote OpenClaw audit
--keep-remote-filesauditKeeps pulled remote files under ~/.xerg/remote-cache/
--railwaydoctor, auditTargets a Railway OpenClaw service
--project [id]doctor, auditChooses a Railway project explicitly
--environment [id]doctor, auditChooses a Railway environment explicitly
--service [id]doctor, auditChooses a Railway service explicitly
--pushauditPushes the summary after computing it
--dry-runaudit --push, pushPrints the payload instead of sending it
--file [path]pushPushes one saved payload file instead of the most recent cached audit
--fail-above-waste-rate [n]auditExits 3 when waste rate is above the threshold
--fail-above-waste-usd [n]auditExits 3 when confirmed waste dollars are above the threshold
--verbosedoctor, auditPrints progress updates to stderr
-h, --helproot, doctor, audit, pushPrints help for the selected command
-v, --versionrootPrints the installed CLI version