xerg
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseXerg
Xerg
Xerg is a local-first CLI for finding wasted AI runtime spend. Runtime audits separate three evidence-strict monetary findings from seven neutral signals, report detector coverage, and use to measure compatible changes. Runtime costs may be observed, locally estimated, or unpriced; they are not authoritative provider invoices.
--compareXerg是一款本地优先的CLI工具,用于发现AI运行时的浪费性支出。运行时审计会将三类有严格证据支撑的货币化发现与七类中性信号区分开来,报告检测器覆盖率,并使用参数衡量兼容变更的效果。运行时成本可以是观测值、本地估算值或未定价的数值;它们并非权威的服务商发票金额。
--compareCold-fetch setup
冷获取配置流程
When this file was fetched from rather than loaded from an installed skill:
https://xerg.ai/skill.md- Identify the current agent host. OpenClaw, Hermes, QM, Claude Code, Cursor, and Codex are setup hosts; they are not automatically the data source being audited. QM can also be the audit source, but only through its explicit administrator-provisioned Xerg connection.
- Check whether Xerg is already installed for this host. Before writing to a persistent or global skill directory, explain the destination and ask the user for permission.
- If the host has a supported skill installer, use it after permission. OpenClaw can install from ClawHub. Agent Skills hosts can install the public
xergrepository. Hermes can use Xerg's well-known skill discovery. Deterministic host-specific commands live at xerg.ai/agents.xergai/skills - If persistent installation is unavailable or declined, use these fetched instructions for the current session. Do not invent an install location.
- Run , use its output to choose the non-interactive audit command below, and offer to run the first audit locally. On QM, do not use bare doctor: follow the private-scope QM procedure below.
npx @xerg/cli@latest doctor
Always ask before uploading. A local audit needs no account and must not be pushed automatically. After a successful local result, offer to connect and push it with:
bash
npx @xerg/cli@latest activate --push-latestactivate--organization-id org_...If approval covers pairing only, use . It must stop after verified credential storage and must not be combined with a source or push flag. A later audit or push requires its own explicit approval.
activate --connect-only --organization-id org_...Codex is an execution host, not a native Xerg audit source. A Codex user audits whatever finds: OpenClaw, Hermes, Claude Code, a Cursor export, or a generic ingest payload.
doctorIf the current host is QM, a cold request can explain prerequisites but cannot claim it persisted an admin skill pack, created PostgreSQL privileges, or provisioned secrets. Require an administrator-only private scope. Refuse deployment-wide output in public/shared scopes. Never ask anyone to paste a DSN, identity key, Fly token, provider credential, or Xerg API key into Slack or chat.
set up https://xerg.ai/skill.md当本文件是从获取,而非从已安装的skill加载时:
https://xerg.ai/skill.md- 识别当前Agent宿主。OpenClaw、Hermes、QM、Claude Code、Cursor和Codex均为支持的配置宿主,但它们并非默认的审计数据源。QM也可作为审计源,但仅能通过管理员明确配置的Xerg连接实现。
- 检查当前宿主是否已安装Xerg。在写入持久化或全局skill目录前,需向用户说明目标路径并获取许可。
- 若宿主支持skill安装器,获取许可后使用对应方式安装:OpenClaw可从ClawHub安装;Agent Skills宿主可安装公开的
xerg仓库;Hermes可使用Xerg的知名skill发现机制。宿主专属的确定性命令可查看xerg.ai/agents。xergai/skills - 若无法进行持久化安装或用户拒绝,仅在当前会话中使用本次获取的指令,不得自行指定安装位置。
- 运行,根据输出选择下方的非交互式审计命令,并主动提出在本地执行首次审计。在QM环境中,请勿直接使用doctor命令,需遵循下方的私有域QM操作流程。
npx @xerg/cli@latest doctor
上传前务必征得用户同意。本地审计无需账户,且禁止自动推送。本地审计成功后,可提议通过以下命令连接并推送结果:
bash
npx @xerg/cli@latest activate --push-latestactivate--organization-id org_...若仅需完成配对授权,使用。该命令在验证凭证存储后必须停止,不得与数据源或推送参数组合使用。后续的审计或推送操作需单独获取明确批准。
activate --connect-only --organization-id org_...Codex是执行宿主,而非Xerg原生审计源。Codex用户需根据命令的结果选择审计对象:OpenClaw、Hermes、Claude Code、Cursor导出文件或通用导入负载。
doctor若当前宿主为QM,通过发起的冷配置请求仅可说明前置条件,不得声称已持久化admin skill包、创建PostgreSQL权限或配置密钥。需要求使用管理员专属的私有域,拒绝在公共/共享域中输出部署级内容。切勿要求任何人在Slack或聊天中粘贴DSN、身份密钥、Fly令牌、服务商凭证或Xerg API密钥。
set up https://xerg.ai/skill.mdFirst run (agent execution path)
首次运行(Agent执行路径)
Use the non-interactive commands. Do not run unless the user explicitly asks for guided interactive setup — it is TTY-only and prompts for input.
xerg initbash
npx @xerg/cli@latest doctor
npx @xerg/cli@latest audit --json- Run first. It reports which local sources exist (OpenClaw, Hermes, Claude Code) and which default paths were checked. QM is never auto-probed.
doctor - Run . If more than one runtime is detected, add
audit --json,--runtime openclaw, or--runtime hermes.--runtime claude-code - Summarize the result for the user in dollars: total spend, identified waste (), assessed spend from
wasteSpendUsd, active findings, neutral signals, and the per-agent spend breakdown (detectionCoverage) when present. Never monetize a signal or describespendByAgentas no waste when active-finding coverage is none, partial, unsupported, or unknown.$0 - If the user applies a fix, re-run the same audit with to report the before/after delta:
--compare
bash
npx @xerg/cli@latest audit --json --compareIf no local data is found, prints the paths it checked. Fallbacks:
doctor- Cursor usage CSV export:
npx @xerg/cli@latest audit --cursor-usage-csv ./cursor-usage.csv - Claude Code transcripts elsewhere:
--claude-code-dir <path> - Hermes profile database:
--runtime hermes --state-db <path> - Any framework's exported event payload:
npx @xerg/cli@latest ingest --file payload.json - Existing sanitized OpenClaw trace capture:
npx @xerg/cli@latest audit --otlp-file <capture.jsonl> - New local OpenClaw trace capture: (interactive until
npx @xerg/cli@latest collect openclaw; use only when the user asks to collect a workload)Ctrl-C - Certified local Hermes trace enrichment: (interactive until
npx @xerg/cli@latest collect hermes --state-db <path>; state.db remains required)Ctrl-C - Remote OpenClaw over SSH:
npx @xerg/cli@latest audit --remote user@host - Railway-hosted OpenClaw:
npx @xerg/cli@latest audit --railway - Existing QM snapshot:
npx @xerg/cli@latest audit --runtime qm --qm-snapshot <snapshot.jsonl> - Configured QM direct/Fly source: an operator collects outside Slack; follow the private-scope procedure below only for an authorized snapshot
If is installed globally, use in place of .
xergxergnpx @xerg/cli@latest使用非交互式命令。除非用户明确要求引导式交互式配置,否则请勿运行——该命令仅支持TTY交互并会提示输入信息。
xerg initbash
npx @xerg/cli@latest doctor
npx @xerg/cli@latest audit --json- 先运行命令。它会报告本地存在的数据源(OpenClaw、Hermes、Claude Code)及已检查的默认路径。QM不会被自动探测。
doctor - 运行。若检测到多个运行时环境,添加
audit --json、--runtime openclaw或--runtime hermes参数。--runtime claude-code - 以美元为单位向用户总结结果:总支出、已识别的浪费成本()、基于
wasteSpendUsd评估的支出、有效发现项、中性信号,以及(若存在)按Agent划分的支出明细(detectionCoverage)。当有效发现项的覆盖率为无、部分、不支持或未知时,切勿将信号货币化,也不得将spendByAgent描述为无浪费。$0 - 若用户应用了修复方案,使用参数重新运行相同的审计以报告变更前后的差异:
--compare
bash
npx @xerg/cli@latest audit --json --compare若未找到本地数据,命令会打印已检查的路径。可使用以下备选方案:
doctor- Cursor使用情况CSV导出:
npx @xerg/cli@latest audit --cursor-usage-csv ./cursor-usage.csv - 其他位置的Claude Code会话记录:
--claude-code-dir <path> - Hermes配置数据库:
--runtime hermes --state-db <path> - 任意框架导出的事件负载:
npx @xerg/cli@latest ingest --file payload.json - 已脱敏的OpenClaw跟踪捕获文件:
npx @xerg/cli@latest audit --otlp-file <capture.jsonl> - 新的本地OpenClaw跟踪捕获:(交互式运行,直到按下
npx @xerg/cli@latest collect openclaw;仅在用户要求收集工作负载时使用)Ctrl-C - 认证的本地Hermes跟踪增强:(交互式运行,直到按下
npx @xerg/cli@latest collect hermes --state-db <path>;必须提供state.db)Ctrl-C - SSH远程OpenClaw:
npx @xerg/cli@latest audit --remote user@host - Railway托管的OpenClaw:
npx @xerg/cli@latest audit --railway - 已有的QM快照:
npx @xerg/cli@latest audit --runtime qm --qm-snapshot <snapshot.jsonl> - 已配置的QM直接/Fly数据源:由操作员在Slack外收集;仅针对授权快照遵循下方的私有域操作流程
若已全局安装,可使用替代。
xergxergnpx @xerg/cli@latestWhat It Audits
审计范围
- OpenClaw gateway logs and session transcripts
- Optional independent OpenClaw trace captures created by the loopback traces-only collector
- Hermes v0.17+ (read-only), with legacy log/transcript fallback where present
state.db - QM durable run/model economics and current retained activity through and
xerg_export/v1qm-snapshot/v1 - Claude Code session transcripts via
xerg audit --runtime claude-code - Cursor usage CSV exports via
xerg audit --cursor-usage-csv ./cursor-usage.csv - Any framework's exported event payload via
xerg ingest --file payload.json
Xerg does not currently ingest provider bills, reconcile invoices, or convert runtime observations into FOCUS. If a user asks for one of those capabilities, explain the boundary and do not present modeled runtime spend as invoice-authoritative.
- OpenClaw网关日志和会话记录
- 可选的、由环回仅跟踪收集器创建的独立OpenClaw跟踪捕获文件
- Hermes v0.17+版本的(只读),若存在旧版日志/记录则作为备选
state.db - 通过和
xerg_export/v1获取的QM持久化运行/模型经济性数据及当前保留的活动记录qm-snapshot/v1 - 通过获取的Claude Code会话记录
xerg audit --runtime claude-code - 通过获取的Cursor使用情况CSV导出文件
xerg audit --cursor-usage-csv ./cursor-usage.csv - 通过导入的任意框架导出的事件负载
xerg ingest --file payload.json
Xerg目前不支持导入服务商账单、对账发票或将运行时观测值转换为FOCUS格式。若用户询问这些功能,需说明当前功能边界,且不得将建模的运行时支出视为发票权威数据。
What It Finds
审计发现
- Retry waste only from a stable charged failed/aborted attempt chain that ends in a higher successful attempt
- Tool-loop waste only from exact repeated tool name/input/result/state evidence with no progress and exact cost correlation
- Cache churn only when a cache-entry lifecycle costs more than its uncached counterfactual
- Neutral signals for deep loops, context outliers/growth, fixed cadence, premium-model routine labels, cache-read concentration, and Max Mode concentration; ordered metrics and optional associated spend remain descriptive, and signals have no avoidable-spend, recommendation, optimization, or CI effect
- Per-agent spend attribution, including delegated sub-agent spend for Claude Code sidechains and ingest payloads
- Cost per outcome when runs carry outcome signals; declare outcomes with
xerg outcome --workflow <name> --status success|failure - Separate local Hermes mechanical metrics when the optional observer is enabled; these have no dollar classification, recommendation impact, or CI-gate effect
- Shared local ,
analysisCoverage, andtoolActivityblocks for OpenClaw and Hermes; these are neutral evidence and never affect findings, recommendations, waste totals, or CI gatesworkloadEconomics - QM request-versus-aggregate reconciliation, pricing coverage, source stability, pseudonymous scope attribution, and current-window unassociated tool activity
Costs are priced across input, output, cache read, and cache write tokens using a catalog covering hundreds of current models. Run to see per-file extraction coverage (which economic signals the parser found).
xerg doctor --verboseFor current Hermes, use ; Xerg prefers . Use for another profile. is mutually exclusive with legacy and . State-only audits retain aggregate spend, request/token/cache, workflow/model/tool, and delegated-workload totals, but first-request cost, initial context, request growth, retry sequences, and identical-input loops are unavailable. The optional plugin writes content-free local events under ; it never adds economics or sends content to Xerg Cloud. Complete observer evidence can split an aggregate only after exact request/token reconciliation.
xerg audit --runtime hermes~/.hermes/state.db--state-db--state-db--log-file--sessions-dirxergai/hermes-observer~/.hermes/xerg/events/After installing the observer, restart Hermes, start a new session, and run . Report doctor status and assessed spend. Do not imply that historical aggregate sessions can be reconstructed. Use for CI; unmet coverage exits .
xerg doctor --runtime hermes--require-detection-coverage full|partial5For OpenClaw traces, binds only to , accepts OTLP/HTTP protobuf traces, persists a bounded sanitized capture, and audits after shutdown. It does not modify OpenClaw configuration or push automatically. Without explicit , is independent OpenClaw evidence and cannot be combined with transcript, log, other-runtime, or remote sources.
xerg collect openclaw127.0.0.1--runtime hermes--otlp-fileFor certified Hermes traces, uses the same loopback traces-only protocol but HMACs identifiers with a persistent local key and requires . Use only the exact certified commit printed in Xerg's docs. Xerg never installs or edits that plugin. The first-party observer stays primary; cache-inclusive plugin prompt totals are normalized into Xerg's separate input/cache buckets, optional enrichment preserves while analysis identity reflects changed coverage, and conflicting evidence restores the original aggregate. For non-default profiles, use the equivalent environment-variable block printed by the command because the pinned plugin resolves YAML under .
xerg collect hermesstate.dbbriancaffey/hermes-oteleconomicAuditIdHERMES_HOME~/.hermes- 仅针对稳定收费的失败/中止尝试链且最终以更高成本成功的重试浪费
- 仅针对完全重复的工具名称/输入/结果/状态且无进展、成本完全相关的工具循环浪费
- 仅当缓存条目生命周期成本高于未缓存替代方案时的缓存 churn
- 针对深度循环、上下文异常/增长、固定节奏、高级模型常规标签、缓存读取集中化和Max Mode集中化的中性信号;有序指标及可选关联支出仅作描述用,这些信号无可避免支出、建议、优化或CI影响
- 按Agent划分的支出归因,包括Claude Code侧链和导入负载的委托子Agent支出
- 当运行携带结果信号时的单位结果成本;可使用声明结果
xerg outcome --workflow <name> --status success|failure - 启用可选观测器后,会生成独立的本地Hermes机械指标;这些指标无货币分类、建议影响或CI门禁作用
- OpenClaw和Hermes共享的本地、
analysisCoverage和toolActivity模块;这些为中性证据,绝不会影响发现项、建议、浪费总额或CI门禁workloadEconomics - QM请求与聚合对账、定价覆盖率、数据源稳定性、匿名域归因及当前窗口中未关联的工具活动
成本会根据涵盖数百种当前模型的目录,对输入、输出、缓存读取和缓存写入Token进行定价。运行可查看每个文件的提取覆盖率(解析器已识别的经济信号)。
xerg doctor --verbose对于当前版本的Hermes,使用;Xerg默认优先读取。可使用指定其他配置文件。与旧版的和互斥。仅基于状态的审计会保留聚合支出、请求/Token/缓存、工作流/模型/工具及委托工作负载的总计,但无法获取首次请求成本、初始上下文、请求增长、重试序列和相同输入循环数据。可选的插件会在下写入无内容的本地事件;它绝不会添加经济数据或向Xerg Cloud发送内容。仅在完成精确的请求/Token对账后,完整的观测器证据才能拆分聚合数据。
xerg audit --runtime hermes~/.hermes/state.db--state-db--state-db--log-file--sessions-dirxergai/hermes-observer~/.hermes/xerg/events/安装观测器后,重启Hermes并启动新会话,然后运行。报告doctor状态及评估支出。不得暗示可重建历史聚合会话。CI场景下可使用;未达到覆盖率要求时会以状态码5退出。
xerg doctor --runtime hermes--require-detection-coverage full|partial对于OpenClaw跟踪,仅绑定到,接受OTLP/HTTP protobuf跟踪,持久化有限的脱敏捕获数据,并在关闭后执行审计。它不会修改OpenClaw配置或自动推送。若未明确指定,为独立的OpenClaw证据,无法与记录、日志、其他运行时或远程数据源组合使用。
xerg collect openclaw127.0.0.1--runtime hermes--otlp-file对于认证的Hermes跟踪,使用相同的环回仅跟踪协议,但会使用持久化本地密钥对标识符进行HMAC加密,且需要。仅使用Xerg文档中指定的提交版本。Xerg绝不会安装或编辑该插件。官方观测器为首选;包含缓存的插件提示总计会被归一化到Xerg的独立输入/缓存桶中,可选增强功能会保留,同时分析标识会反映变更后的覆盖率,冲突证据会恢复原始聚合数据。对于非默认配置文件,使用命令输出的等效环境变量块,因为固定版本的插件会解析下的YAML文件。
xerg collect hermesstate.dbbriancaffey/hermes-oteleconomicAuditIdHERMES_HOME~/.hermesQM private-scope procedure
QM私有域操作流程
QM currently supports bounded one-shot collection through a host-independent snapshot adapter. An operator outside Slack creates through either a strict view-only direct reader or the Fly-contained one-shot exporter. Fly contained mode uses QM core's existing only inside the hidden exporter, records a process boundary with no database-level least-privilege claim, and never exposes that credential to this skill. Do not mutate setup, install/persist the skill, activate, or push without explicit approval.
qm-snapshot/v1DATABASE_URLIn a QM Slack scope, never initiate live database or Fly collection. Accept only an authorized sanitized snapshot already made available in an administrator-only private scope, and use only the exact CLI the operator has explicitly provisioned and version-verified inside that runtime. Current Fly Sprites do not apply the configured sandbox OCI image to persistent Sprites, so never assume an image pin installed the CLI. If it is absent, explain that prerequisite instead of installing it without explicit approval. Continuous follow capture, durable tool-history capture beyond QM's retention window, and live Slack-triggered collection are not currently supported. Never request or receive a DSN, identity key, Fly token, provider credential, or Xerg API key.
Run doctor before every first audit:
bash
xerg doctor --runtime qm --qm-snapshot <snapshot.jsonl>
xerg audit --runtime qm --qm-snapshot <snapshot.jsonl> --since 7d --jsonOperator documentation may explain , , , and , but the agent must not execute or provision those live paths from Slack. Direct, Fly, and modes are mutually exclusive.
--database-url-env--fly-app--print-sql--print-views-sql--qm-snapshotExplain the result conservatively:
- positive QM cost is observed; an explicit deterministic model may be catalog-estimated
- zero/negative placeholders and unresolved are unpriced, never free or actual
openrouter/auto$0 - unpriced patterns say “monetary impact unavailable” and monetary gates exit
5 - Pi/OpenCode timestamps are flush/capture time; Claude is near result-step recording; Codex rows are turn aggregates
- request-sequence detectors run only on exactly reconciled request observations; aggregate rows are excluded
- QM keeps activity for one hour, so older tool history is unavailable and tool-to-model association is not claimed
- retry attempts are neutral evidence without spend attribution; unsupported findings are not described as assessed
Local snapshot audit is the default. Ask for explicit approval before , , or any other hosted write. Xerg's hosted MCP can read an already-pushed pseudonymous summary but has no native QM database or Fly access.
xerg activate --runtime qmaudit --pushQM目前通过宿主独立的快照适配器支持有限的一次性收集。操作员需在Slack外通过严格的只读直接读取器或Fly托管的一次性导出器创建。Fly托管模式仅在隐藏的导出器内部使用QM核心已有的,记录进程边界且无数据库级最小权限声明,绝不会向本skill暴露该凭证。未经明确批准,不得修改配置、安装/持久化skill、激活或推送数据。
qm-snapshot/v1DATABASE_URL在QM Slack域中,绝不能启动实时数据库或Fly收集操作。仅接受已在管理员专属私有域中提供的授权脱敏快照,并仅使用操作员在该运行时中明确配置并验证版本的CLI。当前Fly Sprites不会将配置的沙箱OCI镜像应用到持久化Sprites,因此切勿假设镜像固定安装了CLI。若CLI缺失,需说明该前置条件,不得未经明确批准自行安装。目前不支持持续跟踪捕获、超出QM保留窗口的持久化工具历史捕获及Slack触发的实时收集操作。切勿请求或接收DSN、身份密钥、Fly令牌、服务商凭证或Xerg API密钥。
每次首次审计前需运行doctor命令:
bash
xerg doctor --runtime qm --qm-snapshot <snapshot.jsonl>
xerg audit --runtime qm --qm-snapshot <snapshot.jsonl> --since 7d --json操作员文档可能会说明、、和参数,但Agent不得从Slack执行或配置这些实时路径。直接模式、Fly模式和模式互斥。
--database-url-env--fly-app--print-sql--print-views-sql--qm-snapshot需保守地解释结果:
- 正QM成本为观测值;可能会根据目录中的明确确定性模型进行估算
- 零/负占位符及未解析的为未定价,绝非免费或实际
openrouter/auto$0 - 未定价模式需标注“货币影响不可用”,货币门禁会以状态码5退出
- Pi/OpenCode时间戳为刷新/捕获时间;Claude时间戳接近结果步骤记录时间;Codex行为回合聚合数据
- 请求序列检测器仅在精确对账的请求观测值上运行;聚合行被排除
- QM仅保留一小时的活动记录,因此无法获取更早的工具历史,且不保证工具与模型的关联
- 重试尝试为中性证据,无支出归因;不支持的发现项不得描述为已评估
本地快照审计为默认方式。执行、或其他托管写入操作前需获取明确批准。Xerg的托管MCP可读取已推送的匿名摘要,但无原生QM数据库或Fly访问权限。
xerg activate --runtime qmaudit --pushOptional Cloud
可选云端功能
Local audits need no account. To connect a workspace and push the latest local result, ask permission and run:
bash
npx @xerg/cli@latest activate --push-latestFor a website-first user with no cached audit, securely connects, detects a supported local source, runs the audit, and pushes it. Hosted sync and hosted MCP remain optional and never run without explicit user action.
npx @xerg/cli@latest activate本地审计无需账户。如需连接工作区并推送最新本地结果,需征得用户同意后运行:
bash
npx @xerg/cli@latest activate --push-latest对于无缓存审计结果的网页端优先用户,会安全连接,检测支持的本地数据源,运行审计并推送结果。托管同步和托管MCP均为可选功能,绝不会在未经用户明确操作的情况下运行。
npx @xerg/cli@latest activateAdvanced authentication
高级认证方式
Use only as a manual recovery path when browser pairing is unavailable. It opens Workspace Settings and masks the key pasted into the terminal. Never ask for or paste a workspace key in agent chat.
xerg login --replaceUse only for non-interactive CI or deployment automation. Store it in the CI provider's secret manager; never place it inline in a shell command, source file, log, URL, or conversation.
XERG_API_KEY仅当浏览器配对不可用时,才可将作为手动恢复路径。它会打开工作区设置并隐藏终端中粘贴的密钥。切勿在Agent聊天中要求或粘贴工作区密钥。
xerg login --replace仅在非交互式CI或部署自动化场景中使用。需将其存储在CI服务商的密钥管理器中;切勿在shell命令、源文件、日志、URL或对话中明文放置。
XERG_API_KEYLinks
链接
- Docs: xerg.ai/docs
- Service status: status.xerg.ai
- Skill: xerg.ai/skill.md
- npm: @xerg/cli
- Support:
query@xerg.ai
- 文档:xerg.ai/docs
- 服务状态:status.xerg.ai
- Skill:xerg.ai/skill.md
- npm:@xerg/cli
- 支持:
query@xerg.ai