@xerg/cli 0.5.2 → 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 +7 -6
- package/dist/browser.js +3 -0
- package/dist/browser.js.map +1 -0
- package/dist/index.js +92 -394
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/skills/xerg/SKILL.md +19 -242
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xerg/cli",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "
|
|
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",
|
|
@@ -37,8 +37,11 @@
|
|
|
37
37
|
},
|
|
38
38
|
"files": ["dist", "README.md", "LICENSE", "skills"],
|
|
39
39
|
"main": "./dist/index.js",
|
|
40
|
+
"browser": "./dist/browser.js",
|
|
40
41
|
"exports": {
|
|
41
42
|
".": {
|
|
43
|
+
"browser": "./dist/browser.js",
|
|
44
|
+
"node": "./dist/index.js",
|
|
42
45
|
"default": "./dist/index.js"
|
|
43
46
|
}
|
|
44
47
|
},
|
|
@@ -53,8 +56,8 @@
|
|
|
53
56
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
54
57
|
},
|
|
55
58
|
"dependencies": {
|
|
56
|
-
"@inquirer/
|
|
57
|
-
"
|
|
59
|
+
"@inquirer/confirm": "^6.1.1",
|
|
60
|
+
"@inquirer/select": "^5.2.1"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
63
|
"@xerg/schemas": "workspace:*",
|
package/skills/xerg/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: xerg
|
|
3
|
-
description:
|
|
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
|
-
|
|
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
|
-
|
|
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 SQLite 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 database 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
+
## What It Finds
|
|
285
67
|
|
|
286
|
-
|
|
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
|
-
|
|
74
|
+
## Optional Cloud
|
|
289
75
|
|
|
290
|
-
|
|
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
|
-
##
|
|
78
|
+
## Links
|
|
299
79
|
|
|
300
|
-
-
|
|
301
|
-
-
|
|
302
|
-
-
|
|
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`
|