给 Grok Bot 接 20 条 Jev 规则,周账单从 $612 降到 $38
作者用 Jev 拦截 1,247 次重复重试中的 1,161 次,并列出按成本选模型、去重、限额、同错两次即终止等 20 条省钱规则。
my Grok Bot just found $574 i was burning every week. in the retries. jev caught 1,247 of them and killed 1,161 before they ran. for 6 days the desk kept asking Grok the same question about the same broken scraper and getting the same wrong answer back. nobody capped it. nobody checked the output was identical. the week ran $612. after jev, the next week ran $38 retries alone were $441 of that bill. the rest: oversized prompts resent on every call, two models answering the same yes/no, one agent that re-indexed its own repo on every tool call 20 jev rules i wired into my Grok Bot: 01 model-by-cost → cheap tool calls go to Haiku first, Opus only on fail. saved $142 02 batch-reads → one shot of 8 files instead of 8 shots of 1. saved $81 03 pin-system → hash the system prompt, cache it on Grok’s side so it isn’t resent every turn. saved $47 04 token-count → estimate before send, trim locally if over 8k 05 schema-check → validate the output schema in code before Grok writes it, not after 06 context-strip → drop the last run’s log before the next prompt. old answers aren’t context, they’re confusion 07 dupe-check → hash the question. asked yesterday, use yesterday’s answer 08 per-task-cap → one task can spend $0.80, then it pauses and asks me 09 per-day-cap → desk eats $8 a day, hard stop. retries don’t bypass this 10 per-tool-cap → one tool can’t fire more than 6 times a minute 11 identical-output → last 2 responses byte-identical, the loop dies 12 same-error-twice → same stack trace twice, killed and routed to me 13 no-progress → nothing new in state for 3 cycles, killed 14 shrinking-diff → each retry removes more than it adds, dies on cycle 2 15 local-first → yes/no questions go to a 7B model. Grok sees only the hard ones 16 cache-answer → semantic cache. a reword of yesterday’s question gets yesterday’s answer 17 degrade → if Opus is rate-limited, fall back to Sonnet with a tighter system prompt, not a longer one 18 offline-plan → if Grok is down, run the last approved plan from disk and log the diff 19 per-call-log → every call has its cost on it. the leak shows in one glance 20 weekly-diff → this week’s cost per trade vs last week’s. if it doubles, pause the desk the order i’d go in: cap first, log second, dedup third, route last. caps give you a stop. logs show you the leak. dedup kills the cheap bleed. routing is only worth it once you know where the money is a bot without rules isn’t an agent. it’s a bill. the loop you don’t know about yet runs all weekend
这条是引用着另一条写的:x.com/0x_rody/status/2112558839589417355