Skip to main content

What ingest is for

If your agent framework is not one of the built-in sources (OpenClaw, Hermes, QM, Claude Code, Cursor CSV), you can still audit it. Export your usage as a Xerg event payload — a small, versioned JSON format — and run:
The full audit pipeline runs on the payload: spend rollups, waste findings, recommendations, local snapshots, --compare, and --push all work the same way they do for built-in sources.

The event payload format

Rules:
  • id must be a stable, unique string per event. Xerg uses it for deterministic deduplication, so re-exporting the same history does not double-count.
  • runId groups events into runs (a trace, session, or task execution).
  • Four event types are accepted: model-call, agent-invocation, tool-execution, and delegation. Orchestration events are first-class — they are preserved in run structure (agent lists, tool attribution, delegation counts) and never filtered.
  • Version 4 is current and adds the evidence needed for the latest detector and comparison contracts. Version 3 added stable request/cost-component IDs and content-free input, result, state, and cache-entry fingerprints. Version 2 added modelCallId and toolCallId; modelCallId must reference a model-call event in the same payload and runId. Versions 1 through 4 are accepted, but older payloads cannot gain evidence they did not contain.
  • The public machine-readable contract is Xerg Event Payload v4 JSON Schema. Generate a minimal valid example with npx @xerg/cli@latest ingest --print-example.
  • On model-call events, pass costUsd when your platform reports billed cost (it becomes observed spend). Without it, Xerg estimates from local model pricing; models it cannot price stay visible as unpriced rather than being silently zeroed.
  • Numeric fields are validated strictly: inputTokens, outputTokens, retries, attempt, and iteration must be nonnegative integers; costUsd and latencyMs must be nonnegative finite numbers. Negative or fractional token/count values reject the payload.
  • An optional outcome: { "status": "success" | "failure" | "partial" | "unknown" } marker can be attached to any event. It is carried through to run tags for future cost-per-outcome analysis.

Options

The same output, persistence, and push flags as audit apply: --details, --json, --markdown, --db, --no-db, --compare, --push, --dry-run, and --verbose. --details selects the full human report and cannot be combined with --json, --markdown, --print-example, or --push --dry-run. Automation should use --json. Invalid payloads fail with per-event error messages (bad timestamps, unknown event types, duplicate IDs) instead of partial results.