@xerg/cli 0.1.5 → 0.1.7
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 +19 -3
- package/package.json +5 -3
- package/skills/xerg/SKILL.md +191 -0
package/README.md
CHANGED
|
@@ -20,11 +20,27 @@ xerg doctor
|
|
|
20
20
|
xerg audit
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
+
## Bundled skill
|
|
24
|
+
|
|
25
|
+
The published `@xerg/cli` package includes the portable Xerg skill bundle inside the installed package at:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
skills/xerg/SKILL.md
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For a local project install, that usually resolves to:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
node_modules/@xerg/cli/skills/xerg/SKILL.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
23
39
|
## Supported runtime
|
|
24
40
|
|
|
25
|
-
`@xerg/cli` supports Node `
|
|
41
|
+
`@xerg/cli` supports Node `22` and `24`.
|
|
26
42
|
|
|
27
|
-
If you are developing
|
|
43
|
+
If you are developing or releasing from this repo, `.nvmrc` pins the default toolchain to Node `24.14.0`.
|
|
28
44
|
|
|
29
45
|
## Sample output
|
|
30
46
|
|
|
@@ -74,7 +90,7 @@ xerg audit --since 24h --compare
|
|
|
74
90
|
|
|
75
91
|
- Local machine: yes
|
|
76
92
|
- VPS or remote server: yes
|
|
77
|
-
- If OpenClaw runs remotely,
|
|
93
|
+
- If OpenClaw runs remotely, you can audit it from your local machine with `xerg audit --remote user@host`
|
|
78
94
|
- Or point Xerg at exported files directly with flags
|
|
79
95
|
|
|
80
96
|
Remote prerequisites:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xerg/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Audit OpenClaw agent spend, waste, and before/after improvements.",
|
|
5
5
|
"keywords": ["ai", "agents", "finops", "llm", "openclaw", "cost", "cli"],
|
|
6
6
|
"homepage": "https://xerg.ai",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
|
-
"files": ["dist", "README.md", "LICENSE"],
|
|
25
|
+
"files": ["dist", "README.md", "LICENSE", "skills"],
|
|
26
26
|
"main": "./dist/index.js",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
@@ -30,11 +30,13 @@
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": ">=22 <25"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
+
"prebuild": "node ../../scripts/sync-cli-skill.mjs",
|
|
36
37
|
"build": "tsup",
|
|
37
38
|
"dev": "tsx src/index.ts",
|
|
39
|
+
"prepack": "node ../../scripts/sync-cli-skill.mjs",
|
|
38
40
|
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: xerg
|
|
3
|
+
description: Audit OpenClaw agent spend in dollars. Use for local or remote audits, before/after comparisons, CI threshold gates, and machine-readable recommendations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Xerg
|
|
7
|
+
|
|
8
|
+
Use `xerg` if it is already installed. If not, use `npx @xerg/cli` with the same arguments.
|
|
9
|
+
|
|
10
|
+
Xerg audits OpenClaw spend in dollars and surfaces both confirmed waste and savings opportunities. It can analyze local files, pull remote sources over SSH or Railway, compare against prior local snapshots, and optionally push audit summaries to the Xerg API.
|
|
11
|
+
|
|
12
|
+
## Inputs
|
|
13
|
+
|
|
14
|
+
Xerg needs one of these source inputs:
|
|
15
|
+
|
|
16
|
+
- Local OpenClaw data at the default paths:
|
|
17
|
+
- `/tmp/openclaw/openclaw-*.log`
|
|
18
|
+
- `~/.openclaw/agents/*/sessions/*.jsonl`
|
|
19
|
+
- Explicit paths via `--log-file` and/or `--sessions-dir`
|
|
20
|
+
- An SSH target via `--remote`
|
|
21
|
+
- A Railway target via `--railway`
|
|
22
|
+
- A multi-source config via `--remote-config`
|
|
23
|
+
|
|
24
|
+
Additional requirements:
|
|
25
|
+
|
|
26
|
+
- `--compare` needs at least one previously stored compatible local snapshot
|
|
27
|
+
- Pushing needs auth via `XERG_API_KEY`, `~/.xerg/config.json`, or `xerg login`
|
|
28
|
+
- SSH audits require `ssh` and `rsync` on your local `PATH`
|
|
29
|
+
- Railway audits require the `railway` CLI on your local `PATH`
|
|
30
|
+
|
|
31
|
+
## Default Flow
|
|
32
|
+
|
|
33
|
+
1. Detect sources first when paths or connectivity are uncertain:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
xerg doctor
|
|
37
|
+
xerg doctor --remote user@host
|
|
38
|
+
xerg doctor --railway
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Run a baseline audit:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
xerg audit
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
3. Choose the right output mode for the task:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
xerg audit
|
|
51
|
+
xerg audit --json
|
|
52
|
+
xerg audit --markdown
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Plain `xerg audit` is best for a human-readable summary
|
|
56
|
+
- `xerg audit --json` is best for automation and agents
|
|
57
|
+
- `xerg audit --markdown` is best for a shareable report
|
|
58
|
+
|
|
59
|
+
4. After a workflow or model change, measure the delta:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
xerg audit --compare
|
|
63
|
+
xerg audit --compare --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. Export or push only when needed:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
xerg audit --markdown > xerg-audit.md
|
|
70
|
+
xerg audit --push
|
|
71
|
+
xerg push
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Source Selection
|
|
75
|
+
|
|
76
|
+
Local defaults:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
xerg audit
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Explicit local paths:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
xerg audit --log-file /path/to/openclaw.log
|
|
86
|
+
xerg audit --sessions-dir /path/to/sessions
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
SSH remote:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
xerg audit --remote user@vps.example.com
|
|
93
|
+
xerg audit --remote user@vps.example.com \
|
|
94
|
+
--remote-log-file /opt/openclaw/logs/openclaw.log \
|
|
95
|
+
--remote-sessions-dir /opt/openclaw/sessions
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Railway:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
xerg audit --railway
|
|
102
|
+
xerg audit --railway --project <id> --environment <id> --service <id>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Multiple remote sources:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
xerg audit --remote-config ~/.xerg/remotes.json
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Remote config files use this shape:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"remotes": [
|
|
116
|
+
{
|
|
117
|
+
"name": "prod",
|
|
118
|
+
"transport": "ssh",
|
|
119
|
+
"host": "deploy@prod.example.com"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"name": "railway-prod",
|
|
123
|
+
"transport": "railway",
|
|
124
|
+
"railway": {
|
|
125
|
+
"projectId": "...",
|
|
126
|
+
"environmentId": "...",
|
|
127
|
+
"serviceId": "..."
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## CI And Automation
|
|
135
|
+
|
|
136
|
+
For CI gates, prefer a single command so the audit can still be pushed before threshold failure:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
xerg audit --push --fail-above-waste-rate 0.25 --fail-above-waste-usd 100
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Common variants:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
xerg audit --fail-above-waste-rate 0.30
|
|
146
|
+
xerg audit --fail-above-waste-usd 50
|
|
147
|
+
xerg audit --since 24h --fail-above-waste-rate 0.30
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Documented exit codes:
|
|
151
|
+
|
|
152
|
+
- `0` success
|
|
153
|
+
- `1` runtime error
|
|
154
|
+
- `2` no OpenClaw data found
|
|
155
|
+
- `3` threshold exceeded
|
|
156
|
+
|
|
157
|
+
Automation can branch on those codes instead of scraping terminal output.
|
|
158
|
+
|
|
159
|
+
## Recommendations
|
|
160
|
+
|
|
161
|
+
When using `--json`, expect a `recommendations` array alongside the audit summary. Recommendation items include:
|
|
162
|
+
|
|
163
|
+
- `id`, `findingId`, `kind`, `title`, `description`
|
|
164
|
+
- `estimatedSavingsUsd`, `confidence`, `actionType`
|
|
165
|
+
- optional `suggestedChange`
|
|
166
|
+
|
|
167
|
+
Current recommendation kinds fall into two buckets:
|
|
168
|
+
|
|
169
|
+
- Confirmed waste: `retry-waste`, `loop-waste`
|
|
170
|
+
- Savings opportunities or directional findings: `context-outlier`, `idle-spend`, `candidate-downgrade`
|
|
171
|
+
|
|
172
|
+
Prefer reversible or high-confidence fixes first. Treat model downgrades and context reductions as A/B-test candidates, not guaranteed savings.
|
|
173
|
+
|
|
174
|
+
## Checks
|
|
175
|
+
|
|
176
|
+
Before finalizing work that used Xerg:
|
|
177
|
+
|
|
178
|
+
- Say whether the audit was local, SSH, Railway, or multi-source
|
|
179
|
+
- Say whether the output was plain terminal text, JSON, or Markdown
|
|
180
|
+
- If `--compare` was used, confirm that it compared against a compatible stored snapshot
|
|
181
|
+
- If no data was found, run `xerg doctor` or use explicit source flags rather than guessing
|
|
182
|
+
- Say whether results were pushed to the Xerg API
|
|
183
|
+
|
|
184
|
+
## Notes
|
|
185
|
+
|
|
186
|
+
- `--compare` and `--no-db` cannot be used together
|
|
187
|
+
- Xerg is local-first: it stores economic metadata and audit snapshots locally, not prompt or response content
|
|
188
|
+
- `XERG_API_KEY` is recommended for CI and non-interactive automation
|
|
189
|
+
- If browser auth is needed locally, use `xerg login`; remove stored credentials with `xerg logout`
|
|
190
|
+
- Pilot: [xerg.ai/pilot](https://xerg.ai/pilot)
|
|
191
|
+
- Support: `query@xerg.ai`
|