# Meter Chargeback

CocoMeter chargeback and FinOps governance.

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

## Install

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

## Description

CocoMeter chargeback and FinOps governance. Usage: $meter chargeback refresh | $meter chargeback invoice | $meter chargeback onboarding

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

# CocoMeter Chargeback

Use this skill for `$meter chargeback refresh`, `$meter chargeback invoice`, and `$meter chargeback onboarding`.

Before proceeding, verify that `.cocoplus/` exists. If not, output: "CocoPlus not initialized. Run `$pod init` first." Then stop.

## Source Rules

CocoMeter chargeback reads token/inference usage from Snowflake's Cortex Code usage history surfaces and, when enabled, warehouse compute from query attribution history. Treat the chargeback fact table as governance evidence, not a cosmetic dashboard:

- Token credits come from the Cortex Code CLI, Desktop, and Snowsight usage history surfaces.
- Warehouse credits join through `query_tag.app` and `QUERY_ATTRIBUTION_HISTORY.CREDITS_ATTRIBUTED_COMPUTE`.
- `includeWarehouse` in `cocoplus.toml` controls whether warehouse credits are included.
- `SNOWFLAKE.LOCAL.AI_OBSERVABILITY_EVENTS` `CodingAgent.Step-0` spans are used for near-real-time observability when present.
- Exclude `SYSTEM`, sandbox runs, and background metadata-query traffic.

## `$meter chargeback refresh`

Run a 35-day trailing delete/insert refresh. On first setup, load 60 days. Schedule the Snowflake task for 06:00 UTC daily.

For local validation or dry-run fixtures, use:

```text
invoke cocometer/chargeback-refresh --input <fixture.json>
```

The applies the same deterministic rules used by the warehouse implementation:

- Strip `<system-reminder>...</system-reminder>` blocks before prompt persistence.
- Extract SQL from tool argument arrays.
- Resolve cost centers in this order: explicit user map, user object tag, role map, `UNMAPPED`.
- Produce invoice-ready per-user totals.

## `$meter chargeback invoice`

Generate one HTML and one CSV invoice package per user from the refreshed chargeback facts. Each invoice must include token credits, warehouse credits when included, total credits, credit-rate amount, cost center, and unmapped status.

## `$meter chargeback onboarding`

Report setup readiness:

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