Skip to main content
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 four-command 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. Four-command path

If you only remember four commands, remember these:
npx @xerg/cli doctor
npx @xerg/cli audit
npx @xerg/cli audit --compare
npx @xerg/cli audit --push
What they mean:
  • doctor: checks whether Xerg can see your local source files
  • audit: runs the baseline audit
  • audit --compare: compares against the newest compatible saved snapshot
  • audit --push: sends the resulting summary to the hosted Xerg API
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
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
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
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:
  • 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. Pick the source you want to audit

SourceBest first commandNotes
Local OpenClawnpx @xerg/cli doctor --runtime openclawUse this when both local runtimes exist and you want OpenClaw specifically
Local Hermesnpx @xerg/cli doctor --runtime hermesHermes support is local-only in this phase
Local auto-detectnpx @xerg/cli doctorBest when only one supported local runtime is present
Local Cursor CSVnpx @xerg/cli doctor --cursor-usage-csv [file]Uses exported usage rows instead of runtime logs and transcripts
Remote OpenClaw over SSHnpx @xerg/cli doctor --remote [user@host]Pulls remote files to your machine and analyzes them locally
Remote OpenClaw on Railwaynpx @xerg/cli doctor --railwayUses your linked Railway context unless you pass explicit IDs

5. Local runtime basics

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

6. 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

7. 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.

8. Output modes

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

9. Compare and local snapshot storage

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
npx @xerg/cli audit --since 30m --compare
Use a custom database:
npx @xerg/cli audit --db /path/to/xerg.sqlite
Skip local persistence:
npx @xerg/cli audit --no-db
Important:
  • --compare needs saved local snapshots
  • --compare and --no-db cannot be used together

10. 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.

11. Push and authentication

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 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

12. 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

13. 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

14. Common copy-paste sequences

First local audit:
npx @xerg/cli doctor
npx @xerg/cli audit
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 login
npx @xerg/cli audit --push

15. 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