Skills

Meter Reconcile

Skill-native CocoMeter transcript reconciliation and adapter canary.

Install

npx skills add Snowflake-Labs/cocoplus --skill meter-reconcile -g -a claude-code -y
Category
Testing
Updated
1mo ago
License
MIT
Context cost
Lightabout 972 tokens
Runs scripts
No, instructions only

What it does

Skill-native CocoMeter transcript reconciliation and adapter canary. Replaces the former meter-reconcile and adapter-self-test runtime helpers.

Your objective is to reconcile CocoMeter session totals against an authoritative JSONL transcript using only named transcript fields.

Inputs

Accept either direct invocation arguments or a queued request from .cocoplus/v2-runtime-requests.jsonl:

  • transcript_path
  • session_file
  • out
  • threshold (default 0.05)
  • session_id
  • idempotency_key
  • optional operation: "adapter-canary" for migration self-tests

Idempotency

Use idempotency_key when supplied. Otherwise derive it from session_id, transcript_path, session_file, and out. If .cocoplus/v2-runtime-settlements.jsonl already contains state: "completed" for the key and out exists, report the existing artifact path and stop.

Do not infer token totals from prose. Only named usage fields from the transcript adapter and numeric runtime meter fields may contribute to totals.

Transcript Adapter Rules

Read JSONL one line at a time. For each valid JSON object, preserve only named fields needed for metering:

  • id, message_id, parent_id
  • timestamp
  • type, role, event, kind
  • model, model_tier, actual_model
  • usage, tokens, input_tokens, output_tokens, cache_read_input, cache_write_input

Unknown fields are ignored. Malformed lines produce kind: "other" adapter records and never abort reconciliation.

Deduplicate assistant messages by message_id when present; otherwise use a stable fingerprint of role, timestamp, model, and usage fields.

Reconciliation

Read the whole SKILL.md on GitHub

More in Testing