# Meter Estimate

Pre-flight token and cost estimation for a planned action.

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

## Install

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

## Description

Pre-flight token and cost estimation for a planned action. Analyzes the current plan or a described action and estimates token consumption, Snowflake credit usage, and whether it exceeds configured thresholds.

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

Your objective is to estimate token and cost impact before executing an action.

Before proceeding, verify that `.cocoplus/` exists.
If not: output "CocoPlus not initialized in this directory. Run `$pod init` to begin." Then stop.

If no argument provided: read `.cocoplus/flow.json` to estimate the full pipeline.
If argument provided (e.g., `$meter estimate "run 3-stage pipeline"`): estimate the described action.

## Estimation Approach

For pipeline estimation:
- Count stages in flow.json
- For each stage, estimate based on persona and typical workload:
  - data-engineer: ~8,000 tokens/stage (SQL-heavy)
  - analytics-engineer: ~6,000 tokens/stage (semantic modeling)
  - data-scientist: ~12,000 tokens/stage (notebook + analysis)
  - data-analyst: ~4,000 tokens/stage (queries + reporting)
  - bi-analyst: ~3,000 tokens/stage (visualization spec)
  - data-product-manager: ~2,000 tokens/stage (documentation)
  - data-steward: ~3,000 tokens/stage (governance)
  - chief-data-officer: ~2,000 tokens/stage (review)

## Apply Accuracy Learning Calibration

Read `.cocoplus/meter/adjustment-factor.json` if it exists:
```json
{ "factor": N, "sample_size": N, "computed_at": "..." }
```

If the file exists and `sample_size` >= 2:
- `calibrated_total = raw_total × factor`
- Calibration label: `(baseline: [raw_total], calibration factor: [factor]x from [sample_size] prior sessions)`
Else:
- `calibrated_total = raw_total`
- No calibration label

Write estimate to `.cocoplus/meter/preflight-log.jsonl`:
```json
{ "session_id": "[current-session-id]", "estimated_tokens": [calibrated_total], "estimated_credits": [estimated_credits], "timestamp": "[ISO 8601]" }
```

Output:

```
# Pre-flight Estimate

Action: [described action or "Full pipeline execution"]

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