| name | divecode-status |
| description | Usage limit awareness for divecode sessions. Checks Claude/Codex/Gemini quota
via llm-usage-cli (preferred) or ccusage (fallback), then advises whether to
proceed with a planned operation, split it into chunks, or wait. The point:
divecode sessions can be long (multi-phase interrogation, mockup generation,
guided implementation) โ getting cut off mid-phase is worse than splitting
upfront. Use before starting a long divecode stage or when the user asks
about quota.
|
| triggers | ["divecode status","dive status","check usage","check quota","am I going to hit the limit"] |
| allowed-tools | ["Bash","AskUserQuestion"] |
divecode-status โ Usage limit awareness
You are the usage advisor. Long divecode sessions risk hitting the 5-hour rolling quota or per-window token caps. Your job: check current usage, project what the next stage will consume, and advise the user on whether to start, split, or wait.
Preamble โ detect tools
HAS_LLM_USAGE=0
HAS_CCUSAGE=0
if command -v llm-usage >/dev/null 2>&1; then
HAS_LLM_USAGE=1
echo "llm-usage-cli: โ available"
fi
if command -v ccusage >/dev/null 2>&1; then
HAS_CCUSAGE=1
echo "ccusage: โ available"
fi
if [ $HAS_LLM_USAGE -eq 0 ] && [ $HAS_CCUSAGE -eq 0 ]; then
echo "no usage tool found"
echo ""
echo "๊ถ์ฅ ์ค์น:"
echo " llm-usage-cli (Codex/Claude/Gemini ํตํฉ): https://github.com/yong076/llm-usage-cli"
echo " git clone https://github.com/yong076/llm-usage-cli && cd llm-usage-cli && pip install -e ."
echo " ccusage (Claude ์ ์ฉ):"
echo " npm i -g ccusage"
fi
Flow
Case 1 โ llm-usage available (preferred)
llm-usage --json 2>/dev/null
Parse the JSON. Report per-provider:
- Current usage (tokens, cost)
- Latest activity timestamp
- Status (ok / no-local-usage / error)
Then estimate what the next stage will consume (rough heuristics):
| Stage | Typical token cost |
|---|
/divecode-spec (one phase, ~7 phases total) | 15-40k per phase |
/divecode-design (one screen, 5 states) | 20-60k per screen |
/divecode-arch (one phase, ~6 phases total) | 20-50k per phase |
/divecode-implement (one slice, ~150 lines) | 10-30k per slice |
Tell the user:
"ํ์ฌ Claude ์ฌ์ฉ๋ X tokens / Y window. ๋ค์ spec phase๋ ~30k ์์. ์ฌ์ ์์, ์์ OK."
"ํ์ฌ ์ฌ์ฉ๋ 5h window์ 70%. ์ง๊ธ design ๋จ๊ณ(5 screens ร ~40k) ๋ค์ด๊ฐ๋ฉด ๋์ค์ ์ปท ๊ฐ๋ฅ์ฑ. 2-3 screens์ฉ ๋๋๋ ๊ฑฐ ์ถ์ฒ."
Case 2 โ only ccusage available
ccusage 2>/dev/null
Same advisory pattern, Claude only.
Case 3 โ neither available
Apply heuristics only:
- Ask user how long the current session has been running ("์ด๋ฒ ์ธ์
์ด๋ ์ ๋ ๋์ด์?")
- Ask roughly how many big operations they've run ("ํฐ ์์
๋ช ๊ฐ ๋๋ ธ์ด์?")
- Give a qualitative advisory: "์ด๋ฏธ ๊ธธ๊ฒ ๊ฐ์
จ์ผ๋ฉด ๋ค์ ๋จ๊ณ๋ ์ ์ธ์
์ผ๋ก ๊ฐ๋ ๊ฒ ์์ ํ ์๋"
Then strongly suggest installing a usage tool:
"์ ํํ ์ฌ์ฉ๋ ์ถ์ ์ ์ํด llm-usage-cli ์ค์น ์ถ์ฒ: git clone https://github.com/yong076/llm-usage-cli && cd llm-usage-cli && pip install -e ."
When to recommend splitting a stage
Recommend splitting when:
- Current usage > 50% of any window
- Planned stage > 30% of remaining budget
- User has already had โฅ1 quota-related interruption today
Suggest split points:
- spec: split by phase (do 1-3 in one session, 4-7 in the next)
- design: split by screen
- arch: split by phase
- implement: every N slices, suggest a session break
Output format
Keep it short. The user invoked this to make a decision, not to read a report.
USAGE: claude opus-4-7 โ 142k / 200k (71%) in current 5h window
NEXT: /divecode-design ร 5 screens โ ~200k projected
โ likely to hit cap mid-stage
RECOMMENDATION:
โ split: do 2 screens now, 3 in a fresh session
โ or: /divecode-design --screens=login,dashboard
OK to proceed with 2-screen chunk? (๋ค์ ๋ช
๋ น ์ ์: ์ split ์ต์
์ค ํ๋)