# Meter Reconcile

Skill-native CocoMeter transcript reconciliation and adapter canary.

- Repository: https://github.com/Snowflake-Labs/cocoplus (727 stars)
- Category: Testing
- License: MIT
- Last updated: 2026-10-04
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Snowflake-Labs/cocoplus --skill meter-reconcile -g -a claude-code -y`
Codex: `npx skills add Snowflake-Labs/cocoplus --skill meter-reconcile -g -a codex -y`
Cursor: `npx skills add Snowflake-Labs/cocoplus --skill meter-reconcile -g -a cursor -y`
Gemini CLI: `npx skills add Snowflake-Labs/cocoplus --skill meter-reconcile -g -a gemini-cli -y`

## Description

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

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

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

The rest: https://github.com/Snowflake-Labs/cocoplus/blob/HEAD/.cortex/skills/cocometer/meter-reconcile/SKILL.md
