Your Free AI Token Allowance Is a Budget, Not a Gift
Описание и применение
С помощью простого скрипта учета токенов, файла состояния и правила отказов команды смогли предсказать и контролировать расход токенов, завершив двухнедельный спринт на бесплатном тарифе MonkeyCode.
Задача
Teams running free AI models often exhaust token budgets mid‑sprint because they do not track or manage token consumption, leading to wasted requests and stalled work.
Результат
Token consumption dropped by ~30 % after state file and retry rules; teams could finish two‑week sprints on the free tier without running out of tokens.
Рабочий процесс
- 1. Wrap each agent task with a meter script that estimates prompt and completion tokens.
- 2. Log task metadata (label, start time, elapsed, exit code, estimated tokens) to a JSONL audit file.
- 3. After each task, write a concise STATE.md (≤5 lines) summarizing changes, failures, and next steps.
- 4. Before running a new task, have the agent read STATE.md to avoid re‑reading full context.
- 5. Apply a retry rule: if a command fails twice with the same error, stop retrying and change the approach.
- 6. Use the token estimator output to forecast weekly burn and adjust task selection accordingly.
Доказательства
The state file from the previous section fixed that leak within a couple of days, and the daily totals dropped accordingly.
Two failures in that period, an unstubbed network call and a missing fixture, each produced several repeated attempts... a one-line rule stopped that category: never repeat a command that produced the same failure twice.
- Дата записи: 2026-09-05T17:24:00.543Z