@xerg/cli 0.5.3 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # xerg
2
2
 
3
- Audit OpenClaw, Hermes, and Cursor spend in dollars, surface provenance-aware waste findings, compare fixes, and optionally connect hosted follow-up after the first local result.
3
+ Find wasted AI spend in OpenClaw, Hermes, and Cursor.
4
+
5
+ Xerg audits AI spend in dollars, surfaces provenance-aware waste findings, compares fixes, and optionally connects hosted follow-up after the first local result.
4
6
 
5
7
  Xerg runs locally by default. Local audits and `--compare` are free. No account is required for local value, and no data leaves your machine unless you explicitly push results to Xerg Cloud.
6
8
 
@@ -57,7 +59,7 @@ node_modules/@xerg/cli/skills/xerg/SKILL.md
57
59
 
58
60
  For a global install, the same file lives inside the global npm package directory instead. That file is a packaged copy of the canonical repo skill at [`skills/xerg/SKILL.md`](../../skills/xerg/SKILL.md). Use it if your agent platform imports skills from disk; installing the npm package does not automatically register the skill with every agent product.
59
61
 
60
- The bundled skill frontmatter declares the CLI/package surface plus optional Xerg Cloud, SSH, rsync, and Railway requirements so registries can distinguish the default local audit workflow from opt-in hosted sync and remote audit workflows.
62
+ The bundled skill frontmatter declares the CLI/package surface plus optional Xerg Cloud and remote audit requirements so registries can distinguish the default local audit workflow from opt-in hosted sync and remote audit workflows.
61
63
 
62
64
  ## Supported runtime
63
65
 
@@ -118,7 +120,7 @@ xerg push
118
120
  Remote prerequisites:
119
121
 
120
122
  - SSH audits require `ssh` and `rsync` on your `PATH`
121
- - Railway audits require the `railway` CLI on your `PATH`
123
+ - Optional legacy Railway audits require the `railway` CLI on your `PATH`
122
124
 
123
125
  ## Default paths
124
126
 
@@ -145,7 +147,6 @@ If local defaults are empty, `xerg init` prints next-step commands for explicit
145
147
 
146
148
  ```bash
147
149
  xerg audit --remote user@host
148
- xerg audit --railway
149
150
  ```
150
151
 
151
152
  ## Hosted follow-up
@@ -218,7 +219,7 @@ Xerg v0 stores economic metadata and audit summaries locally. It does not store
218
219
  - `xerg init` is interactive in v1. Use direct `doctor` / `audit` commands when you need non-interactive control.
219
220
  - `--verbose` prints progress updates to stderr for `xerg doctor` and `xerg audit`, which helps distinguish package install time from CLI runtime.
220
221
  - If `xerg audit --remote ...` fails before pulling files, verify that both `ssh` and `rsync` are installed and reachable on your `PATH`.
221
- - If `xerg audit --railway` fails immediately, verify that the `railway` CLI is installed, authenticated, and can access the target project.
222
+ - If a legacy Railway audit fails immediately, verify that the `railway` CLI is installed, authenticated, and can access the target project.
222
223
 
223
224
  ## Pilot and support
224
225
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xerg/cli",
3
- "version": "0.5.3",
4
- "description": "Audit OpenClaw, Hermes, and Cursor spend in dollars with provenance-aware waste findings and compare output.",
3
+ "version": "0.5.5",
4
+ "description": "Find wasted AI spend in OpenClaw, Hermes, and Cursor.",
5
5
  "keywords": [
6
6
  "xerg",
7
7
  "ai",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: xerg
3
- description: Audit OpenClaw, Hermes, and Cursor spend in dollars. Local-first audits with provenance-aware findings, compare mode, OpenClaw remote support, CI gates, and optional hosted follow-up.
3
+ description: Find wasted AI spend in OpenClaw, Hermes, and Cursor.
4
4
  homepage: https://xerg.ai
5
5
  metadata:
6
6
  openclaw:
@@ -46,13 +46,7 @@ metadata:
46
46
 
47
47
  # Xerg
48
48
 
49
- Use `xerg` if it is already installed. If not, use `npx @xerg/cli` with the same arguments.
50
-
51
- Xerg audits OpenClaw, Hermes, and Cursor spend in dollars, not tokens. It reads gateway logs, session transcripts, and Cursor usage exports, surfaces provenance-aware confirmed waste plus savings opportunities, and helps you measure fixes with `--compare`.
52
-
53
- Local audits need no account. Hosted sync and hosted MCP are optional paid workspace features. No data leaves your machine unless you explicitly push results to Xerg Cloud.
54
-
55
- The initial `npx @xerg/cli` path fetches and executes the published npm package. To avoid that runtime fetch, install and review the CLI first with `npm install -g @xerg/cli`, or use a locally built `xerg` binary.
49
+ Xerg is a local-first CLI for finding wasted AI spend in OpenClaw, Hermes, and Cursor. It audits dollars instead of raw token counts, separates confirmed waste from savings opportunities, and uses `--compare` to measure whether a workflow or model change actually helped.
56
50
 
57
51
  ## Quick Start
58
52
 
@@ -61,246 +55,29 @@ xerg init
61
55
  xerg audit --compare
62
56
  ```
63
57
 
64
- Use direct commands when you need explicit control, non-interactive behavior, JSON output, or CI gates:
65
-
66
- ```bash
67
- xerg doctor
68
- xerg audit
69
- xerg audit --cursor-usage-csv ./cursor-usage.csv
70
- xerg audit --json
71
- xerg audit --fail-above-waste-rate 0.30
72
- ```
73
-
74
- ## Inputs
75
-
76
- Xerg needs one of these source inputs:
77
-
78
- - Local OpenClaw data at the default paths:
79
- - `/tmp/openclaw/openclaw-*.log`
80
- - `~/.openclaw/agents/*/sessions/*.jsonl`
81
- - Local Hermes data at the default paths:
82
- - `~/.hermes/logs/agent.log*` with `gateway.log*` fallback
83
- - `~/.hermes/sessions/`
84
- - An exported Cursor usage CSV via `--cursor-usage-csv`
85
- - Explicit paths via `--log-file` and/or `--sessions-dir`
86
- - An SSH target via `--remote`
87
- - A Railway target via `--railway`
88
- - A multi-source config via `--remote-config`
89
-
90
- Additional requirements:
91
-
92
- - `--compare` needs at least one previously stored compatible local snapshot
93
- - Pushing needs auth via `XERG_API_KEY`, `~/.xerg/config.json`, or browser credentials from `xerg login`
94
- - Cursor audits require an explicit exported usage CSV path
95
- - SSH audits require `ssh` and `rsync` on your local `PATH` and are OpenClaw-only in this phase
96
- - Railway audits require the `railway` CLI on your local `PATH` and are OpenClaw-only in this phase
97
-
98
- ## Security And Data Flow
99
-
100
- Default `doctor`, `init`, `audit`, `--compare`, `--json`, and `--markdown` commands analyze data on the local machine. They read OpenClaw, Hermes, or Cursor usage files, compute economic summaries, print reports, and may write local JSON snapshots for future comparison.
101
-
102
- Remote OpenClaw audits over SSH, Railway, or `--remote-config` pull selected gateway logs and session files to local temporary storage, then run the same local audit engine. These flows require the corresponding remote transport credentials already configured on the machine.
103
-
104
- Hosted sync is opt-in. `connect`, `audit --push`, `push`, and `mcp-setup` use `XERG_API_KEY`, `~/.xerg/config.json`, or browser login credentials only for Xerg Cloud actions. The push payload contains audit totals, daily rollups, findings, recommendations, comparison deltas, and source metadata; it does not include raw prompt or response content, local source file paths, local snapshot store paths, or internal finding details.
105
-
106
- Local JSON findings may include `signalSource`, `ruleId`, and evidence references. Use those fields to distinguish observed signals from inferred or legacy unknown provenance. These provenance fields are local-only in this release and are not part of the pushed v2 wire payload.
107
-
108
- ## Default Flow
109
-
110
- 1. Start with the default first-run path when you want the fastest local result:
111
-
112
- ```bash
113
- xerg init
114
- ```
115
-
116
- - `init` detects local OpenClaw or Hermes data
117
- - it runs a first audit with local snapshot persistence enabled
118
- - it offers optional hosted follow-up after the audit completes
119
- - if no local data is found, it prints explicit local-path commands plus remote OpenClaw-only guidance
120
-
121
- 2. Detect sources directly when paths or connectivity are uncertain:
122
-
123
- ```bash
124
- xerg doctor
125
- xerg doctor --verbose
126
- xerg doctor --remote user@host
127
- xerg doctor --railway
128
- ```
129
-
130
- - `xerg doctor --verbose` shows progress on stderr while Xerg checks local paths or remote transports
131
- - If local defaults are empty, prefer `xerg doctor --remote ...` or `xerg doctor --railway` instead of guessing paths
132
-
133
- 3. Run a baseline audit explicitly when you want direct control:
134
-
135
- ```bash
136
- xerg audit
137
- xerg audit --runtime openclaw
138
- xerg audit --runtime hermes
139
- xerg audit --cursor-usage-csv ./cursor-usage.csv
140
- ```
141
-
142
- 4. Choose the right output mode for the task:
143
-
144
- ```bash
145
- xerg audit
146
- xerg audit --json
147
- xerg audit --markdown
148
- ```
149
-
150
- - Plain `xerg audit` is best for a human-readable summary
151
- - `xerg audit --json` is best for automation and agents
152
- - `xerg audit --markdown` is best for a shareable report
153
-
154
- 5. After a workflow or model change, measure the delta:
155
-
156
- ```bash
157
- xerg audit --compare
158
- xerg audit --compare --json
159
- ```
160
-
161
- 6. Export, push, or hosted-setup only when needed:
162
-
163
- ```bash
164
- xerg audit --markdown > xerg-audit.md
165
- xerg connect
166
- xerg mcp-setup
167
- xerg audit --push
168
- xerg push
169
- ```
170
-
171
- - `connect` is the guided hosted path: it reuses existing auth, prompts before browser login when needed, and offers to push the latest audit
172
- - `mcp-setup` prints or writes hosted MCP config for Cursor, Claude Code, Codex, or another client
173
- - local audits and compare remain available if you skip hosted setup
174
-
175
- ## Source Selection
176
-
177
- Local defaults:
178
-
179
- ```bash
180
- xerg audit
181
- ```
182
-
183
- If both OpenClaw and Hermes are present locally, pass `--runtime openclaw` or `--runtime hermes` explicitly.
184
-
185
- Explicit local paths:
186
-
187
- ```bash
188
- xerg audit --runtime openclaw --log-file /path/to/openclaw.log
189
- xerg audit --runtime openclaw --sessions-dir /path/to/sessions
190
- xerg audit --runtime hermes --log-file ~/.hermes/logs/agent.log
191
- xerg audit --runtime hermes --sessions-dir ~/.hermes/sessions
192
- xerg audit --cursor-usage-csv ./cursor-usage.csv
193
- ```
194
-
195
- SSH remote:
196
-
197
- ```bash
198
- xerg audit --remote user@vps.example.com
199
- xerg audit --remote user@vps.example.com \
200
- --remote-log-file /opt/openclaw/logs/openclaw.log \
201
- --remote-sessions-dir /opt/openclaw/sessions
202
- ```
203
-
204
- Railway:
205
-
206
- ```bash
207
- xerg audit --railway
208
- xerg audit --railway --project <id> --environment <id> --service <id>
209
- ```
210
-
211
- Multiple remote sources:
212
-
213
- ```bash
214
- xerg audit --remote-config ~/.xerg/remotes.json
215
- ```
216
-
217
- Remote config files use this shape:
218
-
219
- ```json
220
- {
221
- "remotes": [
222
- {
223
- "name": "prod",
224
- "transport": "ssh",
225
- "host": "deploy@prod.example.com"
226
- },
227
- {
228
- "name": "railway-prod",
229
- "transport": "railway",
230
- "railway": {
231
- "projectId": "...",
232
- "environmentId": "...",
233
- "serviceId": "..."
234
- }
235
- }
236
- ]
237
- }
238
- ```
239
-
240
- ## CI And Automation
241
-
242
- For CI gates, prefer a single command so the audit can still be pushed before threshold failure:
243
-
244
- ```bash
245
- xerg audit --push --fail-above-waste-rate 0.25 --fail-above-waste-usd 100
246
- ```
247
-
248
- Common variants:
249
-
250
- ```bash
251
- xerg audit --fail-above-waste-rate 0.30
252
- xerg audit --fail-above-waste-usd 50
253
- xerg audit --since 24h --fail-above-waste-rate 0.30
254
- ```
255
-
256
- Documented exit codes:
257
-
258
- - `0` success
259
- - `1` runtime error
260
- - `2` no supported local runtime data found
261
- - `3` threshold exceeded
262
-
263
- Automation can branch on those codes instead of scraping terminal output.
264
-
265
- ## Recommendations
266
-
267
- When using `--json`, expect a `recommendations` array alongside the audit summary. Each recommendation item includes:
268
-
269
- - `id`, `findingId`, `kind`, `title`, `summary`
270
- - `priorityBucket`, `recommendedOrder`, `implementationSurface`, `category`
271
- - `severity`, `confidence`, `effort`
272
- - `estimatedSavingsUsd`, `estimatedSavingsPct`
273
- - `scope`, `scopeId`, `scopeLabel`
274
- - `whereToChange`, `validationPlan`, `actions`
275
-
276
- Current recommendation kinds map into the Action queue buckets:
58
+ If `xerg` is not installed, use `npx @xerg/cli` with the same arguments.
277
59
 
278
- - `fix_now`: `retry-waste`, `loop-waste`
279
- - `test_next`: `context-outlier`, `idle-spend`, `candidate-downgrade`, `cache-carryover`, `max-mode-concentration`
280
- - `watch`: unknown or uncategorized findings
60
+ ## What It Audits
281
61
 
282
- Prefer high-confidence or reversible fixes first. Treat model downgrades, context changes, and Cursor behavior changes as compare-friendly experiments, not guaranteed savings.
62
+ - OpenClaw gateway logs and session transcripts
63
+ - Hermes logs and session transcripts
64
+ - Cursor usage CSV exports via `xerg audit --cursor-usage-csv ./cursor-usage.csv`
283
65
 
284
- For `--compare`, prefer the normalized rows first: waste rate, waste per run, waste per 1k calls, and inferred waste share when available. Absolute spend and waste deltas are still useful, but they are workload-dependent when run or call volume changed.
66
+ ## What It Finds
285
67
 
286
- ## Checks
68
+ - Retry waste from failed calls before a later success
69
+ - Loop waste from runs that exceed efficient iteration bounds
70
+ - Context bloat from unusually large inputs
71
+ - Downgrade candidates where cheaper models may be enough
72
+ - Idle spend from recurring heartbeat or monitoring loops
287
73
 
288
- Before finalizing work that used Xerg:
74
+ ## Optional Cloud
289
75
 
290
- - Say whether the audit was local, SSH, Railway, or multi-source
291
- - Say whether the output was plain terminal text, JSON, or Markdown
292
- - If `--compare` was used, confirm that it compared against a compatible stored snapshot
293
- - If no data was found, run `xerg doctor` or use explicit source flags rather than guessing
294
- - Say whether results were pushed to the Xerg API
295
- - Distinguish confirmed waste (`retry-waste`, `loop-waste`) from directional opportunities (`context-outlier`, `idle-spend`, `candidate-downgrade`)
296
- - Mention inferred or unknown provenance when it materially affects confidence in the finding or compare result
76
+ Local audits need no account. Hosted sync and hosted MCP are optional workspace features and only run when you explicitly use `xerg connect`, `xerg audit --push`, `xerg push`, or `xerg mcp-setup`.
297
77
 
298
- ## Notes
78
+ ## Links
299
79
 
300
- - `--compare` and `--no-db` cannot be used together
301
- - Xerg is local-first: it stores economic metadata and audit snapshots locally, not prompt or response content
302
- - Local provenance fields are intentionally not part of the pushed v2 payload yet
303
- - `XERG_API_KEY` is recommended for CI and non-interactive automation
304
- - If browser auth is needed without the hosted setup flow, use `xerg login`; remove stored credentials with `xerg logout`
305
- - Pilot: [xerg.ai/pilot](https://xerg.ai/pilot)
80
+ - Docs: [xerg.ai/docs](https://xerg.ai/docs)
81
+ - GitHub: [xergai/xerg](https://github.com/xergai/xerg)
82
+ - npm: [@xerg/cli](https://www.npmjs.com/package/@xerg/cli)
306
83
  - Support: `query@xerg.ai`