Meter Estimate
Pre-flight token and cost estimation for a planned action.
Install
npx skills add Snowflake-Labs/cocoplus --skill meter-estimate -g -a claude-code -y- Repository
- Snowflake-Labs/cocoplus727
- Category
- Engineering
- Updated
- 1mo ago
- License
- MIT
- Context cost
- Lightabout 779 tokens
- Runs scripts
- No, instructions only
What it does
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.
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:
{ "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:
{ "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"]
