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.
Installs into .claude/skills of the current project.
Are you the author of Cocometer?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/snowflake-labs-cocometer-d325d229)
---
name: "meter-estimate"
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."
version: "1.0.3"
author: "CocoPlus"
tags:
- cocoplus
- cocometer
---
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"]
## Token Estimate
Per stage breakdown:
[stage name] ([persona]): ~[estimate] tokens
...
Baseline estimate: ~[raw_total] tokens
[If calibrated:] Calibrated estimate: ~[calibrated_total] tokens [calibration label]
[If not calibrated:] Total estimate: ~[raw_total] tokens (conservative — no calibration data yet)
## Snowflake Credit Estimate
Estimated SQL calls: ~[N]
Estimated credits: ~[N × 0.00001] credits
## Budget Check
Configured threshold: [from cost-tracker.monitor.json]
Estimate vs threshold: [WITHIN / EXCEEDS by N%]
Note: These are estimates. Actual usage depends on response length, query complexity, and data volume.
Run `$meter accuracy` to view calibration history.
```
## Anti-Rationalization
| Shortcut / Temptation | Why It Fails |
|-----------------------|--------------|
| Use a single flat estimate without per-stage breakdown | Different personas have very different token footprints; a flat estimate hides cost concentration in expensive stages |
| Skip the budget threshold check | The entire value of pre-flight estimation is knowing whether to proceed — skipping the check defeats the purpose |
## Exit Criteria
- [ ] Per-stage token breakdown is shown with persona label for each stage
- [ ] Total token estimate is shown
- [ ] Configured budget threshold is compared against the estimate with WITHIN or EXCEEDS result