# Meter Sync

Refresh the CocoMeter Enhanced dashboard by re-querying Snowflake with current...

- 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-sync -g -a claude-code -y`
Codex: `npx skills add Snowflake-Labs/cocoplus --skill meter-sync -g -a codex -y`
Cursor: `npx skills add Snowflake-Labs/cocoplus --skill meter-sync -g -a cursor -y`
Gemini CLI: `npx skills add Snowflake-Labs/cocoplus --skill meter-sync -g -a gemini-cli -y`

## Description

Refresh the CocoMeter Enhanced dashboard by re-querying Snowflake with current request-map.jsonl data. Regenerates .cocoplus/meter-view.html without opening the browser. Use after the 90-minute Snowflake usage history latency window.

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

Your objective is to refresh the CocoMeter dashboard with updated Snowflake data.

## Pre-flight Check

Check that `.cocoplus/meter-view.html` exists. If not:
Output: "No meter dashboard found. Run $meter view first." Then stop.

Check that `.cocoplus/meter/request-map.jsonl` exists. If not:
Output: "No attribution data found. Run $meter on and execute some pipeline stages first." Then stop.

## Re-execute Dashboard Generation

Execute steps 2, 11 of `$meter view` exactly:
1. Read and partition `request-map.jsonl` (Direct IDs vs Anchor IDs)
2. Execute Pass 1 and Pass 2 Snowflake queries
3. Join Snowflake rows with attribution data
4. Compute aggregations
5. Serialise merged dataset as JSON
6. Read `meter-view.html.template`
7. Inject data between `/* __METER_INJECTION_START__ */` and `/* __METER_INJECTION_END__ */`
8. Write to `.cocoplus/meter-view.html` atomically
9. Update `.cocoplus/meter/last-sync.json`

Do NOT open the browser. Only refresh the file.

## Output

```
✓ CocoMeter dashboard refreshed.
  Snowflake rows added: <N>  |  Total requests tracked: <N>
  File updated: .cocoplus/meter-view.html
  (Reload the tab in your browser to see the latest data.)
```

## Anti-Rationalization

| Shortcut / Temptation | Why It Fails |
|-----------------------|--------------|
| Open the browser after sync | `$meter sync` is a background refresh, the developer has the tab open already |
| Skip if Snowflake returns same row count | Row count may be the same but token values may have updated |

## Exit Criteria

- [ ] `.cocoplus/meter-view.html` regenerated with latest data
- [ ] `.cocoplus/meter/last-sync.json` updated
- [ ] Output confirms row count and file path
- [ ] Browser NOT opened

