validate

A command that checks an OTEL or Claude Code trace file and extracts information such as its format, identifiers, events, and system-prompt presence.

In plain words
What is it for?
Use it to validate trace files and report whether they are valid, which format they use, and what metadata they contain.
Why use it?
It provides a consistent validation result with errors and warnings instead of requiring manual inspection of trace data.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/not-diamond/self-care/validate
Clone the repo
git clone --depth 1 https://github.com/Not-Diamond/self-care
Per session 14 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 946 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00014 $0.00946
Opus 5 $0.00007 $0.00473
Sonnet 5 $0.00003 $0.00189
Haiku 4.5 $0.00001 $0.00095

Measured 2d ago against content hash e54d213a47c6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

validate scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/validate.md · 131 lines

How it starts

The opening of the file, as written. The whole thing — 131 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Validate Trace

Validate the provided trace file and report its metadata. Supports both OTEL (JSON) and Claude Code (JSONL) formats.

Instructions

Run the deterministic trace validator:

node "${CLAUDE_PLUGIN_ROOT}/agents/tools/validate-trace.mjs" $ARGUMENTS

Parse the JSON output. The result contains:

  • valid: boolean — whether the trace passed validation
  • format: "otel" | "claude-code" | "unknown"
  • errors: array of critical failure messages
  • warnings: array of non-critical issues
  • metadata: object with format-specific fields

If valid is true, display the validation results:

For OTEL:

Trace Validation: PASSED
Format: OTEL
Trace ID: <metadata.traceId>
Service Name: <metadata.serviceName>
Span Count: <metadata.spanCount>
System Prompt: <metadata.systemPromptDetected ? "FOUND (via " + metadata.systemPromptMethod + ")" : "NOT FOUND">

For Claude Code:

Trace Validation: PASSED
Format: Claude Code
Session ID: <metadata.sessionId>
Event Types: <metadata.eventTypes joined with ", ">
System Prompt: <metadata.systemPromptDetected ? "FOUND (via " + metadata.systemPromptMethod + ")" : "NOT FOUND">

If valid is false, check whether the errors are recoverable (eligible for flexible validation):

Recoverable errors (any of these present → offer fallback):

  • "No system prompt found"
  • "Unknown trace format"
  • "Invalid Claude Code event structure"

Unrecoverable errors (if ANY of these are present → do NOT offer fallback):

  • "File not found"
  • "File is not valid JSON or JSONL"
  • "Empty Claude Code trace"
  • "Missing resourceSpans"
  • "No spans found in trace"

If any unrecoverable error is present, display the errors and stop:

Trace Validation: FAILED
Errors:
- <each error on its own line>

If at least one error is recoverable, offer flexible validation via AskUserQuestion:

  • question:
    Deterministic validation failed:
    ─────────────────────────────────────────────────────────
    <each error on its own line, prefixed with •>
    ─────────────────────────────────────────────────────────
    Would you like to try flexible (AI-assisted) validation?
    This uses an LLM to assess whether the trace is still
    structurally usable despite not passing strict format checks.
    
  • header: "Flexible Validation"
  • options:
    • { "label": "Try flexible validation", "description": "Use AI to assess trace structure" }
    • { "label": "Stop", "description": "Accept the validation failure" }

Read the full file on GitHub · 131 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 131 lines · 14 tokens per session scan A e54d213a47c6

Subscribe to this mod's changes

validate is a command published in the GitHub repository Not-Diamond/self-care (28 stars, last pushed 4mo ago), licensed MIT. It adds 14 tokens to every session and 946 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.