@xerg/cli 0.5.0 → 0.5.2

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xerg/cli",
3
- "version": "0.5.0",
4
- "description": "Audit OpenClaw and Hermes workflows in dollars, compare fixes, and export daily spend and waste trends.",
3
+ "version": "0.5.2",
4
+ "description": "Audit OpenClaw, Hermes, and Cursor spend in dollars with provenance-aware waste findings and compare output.",
5
5
  "keywords": [
6
6
  "xerg",
7
7
  "ai",
@@ -13,7 +13,8 @@
13
13
  "cost",
14
14
  "cli",
15
15
  "cursor",
16
- "analytics"
16
+ "analytics",
17
+ "provenance"
17
18
  ],
18
19
  "homepage": "https://xerg.ai",
19
20
  "repository": {
@@ -53,7 +54,7 @@
53
54
  },
54
55
  "dependencies": {
55
56
  "@inquirer/prompts": "^8.4.1",
56
- "better-sqlite3": "^11.10.0"
57
+ "better-sqlite3": "^12.11.1"
57
58
  },
58
59
  "devDependencies": {
59
60
  "@xerg/schemas": "workspace:*",
@@ -1,16 +1,59 @@
1
1
  ---
2
2
  name: xerg
3
- description: Audit OpenClaw and Hermes workflows in dollars. Local-first audits with init, compare mode, OpenClaw remote support, CI gates, and optional hosted follow-up.
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.
4
+ homepage: https://xerg.ai
5
+ metadata:
6
+ openclaw:
7
+ homepage: https://xerg.ai
8
+ links:
9
+ repository: https://github.com/xergai/xerg
10
+ documentation: https://xerg.ai/docs
11
+ primaryEnv: XERG_API_KEY
12
+ requires:
13
+ anyBins:
14
+ - xerg
15
+ - npx
16
+ config:
17
+ - ~/.xerg/config.json
18
+ - ~/.config/xerg/credentials.json
19
+ - ~/.xerg/remotes.json
20
+ install:
21
+ - kind: node
22
+ package: "@xerg/cli"
23
+ bins:
24
+ - xerg
25
+ envVars:
26
+ - name: XERG_API_KEY
27
+ required: false
28
+ description: Optional Xerg Cloud workspace API key for explicit push, connect, and hosted MCP setup.
29
+ - name: XERG_API_URL
30
+ required: false
31
+ description: Optional override for the Xerg API endpoint; defaults to https://api.xerg.ai.
32
+ dependencies:
33
+ - name: "@xerg/cli"
34
+ type: npm
35
+ repository: https://github.com/xergai/xerg
36
+ - name: ssh
37
+ type: other
38
+ url: https://www.openssh.com/
39
+ - name: rsync
40
+ type: other
41
+ url: https://rsync.samba.org/
42
+ - name: railway
43
+ type: npm
44
+ repository: https://github.com/railwayapp/cli
4
45
  ---
5
46
 
6
47
  # Xerg
7
48
 
8
49
  Use `xerg` if it is already installed. If not, use `npx @xerg/cli` with the same arguments.
9
50
 
10
- Xerg audits OpenClaw and Hermes workflows in dollars, not tokens. It reads gateway logs and session transcripts, surfaces confirmed waste plus savings opportunities, and helps you measure fixes with `--compare`.
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`.
11
52
 
12
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.
13
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.
56
+
14
57
  ## Quick Start
15
58
 
16
59
  ```bash
@@ -23,6 +66,7 @@ Use direct commands when you need explicit control, non-interactive behavior, JS
23
66
  ```bash
24
67
  xerg doctor
25
68
  xerg audit
69
+ xerg audit --cursor-usage-csv ./cursor-usage.csv
26
70
  xerg audit --json
27
71
  xerg audit --fail-above-waste-rate 0.30
28
72
  ```
@@ -37,6 +81,7 @@ Xerg needs one of these source inputs:
37
81
  - Local Hermes data at the default paths:
38
82
  - `~/.hermes/logs/agent.log*` with `gateway.log*` fallback
39
83
  - `~/.hermes/sessions/`
84
+ - An exported Cursor usage CSV via `--cursor-usage-csv`
40
85
  - Explicit paths via `--log-file` and/or `--sessions-dir`
41
86
  - An SSH target via `--remote`
42
87
  - A Railway target via `--railway`
@@ -46,9 +91,20 @@ Additional requirements:
46
91
 
47
92
  - `--compare` needs at least one previously stored compatible local snapshot
48
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
49
95
  - SSH audits require `ssh` and `rsync` on your local `PATH` and are OpenClaw-only in this phase
50
96
  - Railway audits require the `railway` CLI on your local `PATH` and are OpenClaw-only in this phase
51
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
+
52
108
  ## Default Flow
53
109
 
54
110
  1. Start with the default first-run path when you want the fastest local result:
@@ -80,6 +136,7 @@ xerg doctor --railway
80
136
  xerg audit
81
137
  xerg audit --runtime openclaw
82
138
  xerg audit --runtime hermes
139
+ xerg audit --cursor-usage-csv ./cursor-usage.csv
83
140
  ```
84
141
 
85
142
  4. Choose the right output mode for the task:
@@ -112,7 +169,7 @@ xerg push
112
169
  ```
113
170
 
114
171
  - `connect` is the guided hosted path: it reuses existing auth, prompts before browser login when needed, and offers to push the latest audit
115
- - `mcp-setup` prints or writes hosted MCP config for Cursor, Claude Code, or another client
172
+ - `mcp-setup` prints or writes hosted MCP config for Cursor, Claude Code, Codex, or another client
116
173
  - local audits and compare remain available if you skip hosted setup
117
174
 
118
175
  ## Source Selection
@@ -132,6 +189,7 @@ xerg audit --runtime openclaw --log-file /path/to/openclaw.log
132
189
  xerg audit --runtime openclaw --sessions-dir /path/to/sessions
133
190
  xerg audit --runtime hermes --log-file ~/.hermes/logs/agent.log
134
191
  xerg audit --runtime hermes --sessions-dir ~/.hermes/sessions
192
+ xerg audit --cursor-usage-csv ./cursor-usage.csv
135
193
  ```
136
194
 
137
195
  SSH remote:
@@ -223,6 +281,8 @@ Current recommendation kinds map into the Action queue buckets:
223
281
 
224
282
  Prefer high-confidence or reversible fixes first. Treat model downgrades, context changes, and Cursor behavior changes as compare-friendly experiments, not guaranteed savings.
225
283
 
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.
285
+
226
286
  ## Checks
227
287
 
228
288
  Before finalizing work that used Xerg:
@@ -233,11 +293,13 @@ Before finalizing work that used Xerg:
233
293
  - If no data was found, run `xerg doctor` or use explicit source flags rather than guessing
234
294
  - Say whether results were pushed to the Xerg API
235
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
236
297
 
237
298
  ## Notes
238
299
 
239
300
  - `--compare` and `--no-db` cannot be used together
240
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
241
303
  - `XERG_API_KEY` is recommended for CI and non-interactive automation
242
304
  - If browser auth is needed without the hosted setup flow, use `xerg login`; remove stored credentials with `xerg logout`
243
305
  - Pilot: [xerg.ai/pilot](https://xerg.ai/pilot)