Honey Loop
A loop is the one place token waste compounds: cost = per_tick × ticks. The
honey levers still apply inside each tick (less code, less prose), but a loop adds
two leaks the single-shot levers don't cover — re-paying for context every
wake-up, and re-doing work that didn't change. Cut those.
The five levers
Pace to the cache, skip the dead zone. The prompt cache TTL is 5 min.
< 270s → context stays warm; right for actively polling external state.
≥ 1200s → one cache miss amortized over a long idle wait; the default for
idle ticks (use 1200–1800s).
~300s is the worst choice — pays the cache miss without amortizing it.
Never round to "5 minutes." Drop to 270s or commit to 1200s+.
Event-driven over polling. Harness-tracked work (background Bash, Agent,
Workflow) re-invokes you automatically on completion. Don't schedule a short
tick to poll it — that re-reads full context for nothing. Set a long fallback
heartbeat (1200s+) and let the completion notification drive you. Poll only
external state the harness can't see (CI, a deploy, a remote queue), at a
cadence matched to how fast that state actually changes.
No-change short-circuit. Re-generating output is the bulk of per-tick cost.
Check cheaply first (a hash, a timestamp, a git rev-parse, a status field). If
nothing changed: emit one line and reschedule. Don't redo the task, don't
re-read the world, don't write a report.
Carry a compact state handle, don't re-derive. Keep what the loop has done
so far in a small file (.honey-loop/state.json or a <<honey:HASH>> stash via
eso stash), and read that each tick — not the full history re-discovered from
scratch. Lever 3b: the cheapest input token is the one that never re-enters context.
Define done; then stop. An unbounded loop is unbounded cost. State the exit
condition up front (target reached, N empty ticks, deadline). When met, end the
loop — omit the wake-up reschedule. "Loop forever" is a bug, not a feature.
Per-tick output: ultra by default
A loop tick is an agent-to-self / agent-to-log message, not a deliverable. Default
to ultra: status line only, near-zero prose. One line is enough —
tick 4/∞ · no change · next 1800s. Step up to a full report only on the tick
where something actually needs the user (state changed, a decision, an error).
Don't cut
- The stop/exit check — dropping it is how a loop runs all night.
- Error surfacing — a tick that hit an error reports it; silent failure in a
loop hides for hours.
- The cheap pre-check in lever 3 — skipping it to "just redo it" defeats the point.
1---2name: honey-loop-43description: "Cost discipline for recurring /loop runs: cache-aware pacing, event-driven-over-polling, no-change short-circuit, compact state handle, stop condition."4homepage: https://github.com/Green-PT/honey-for-devs5license: MIT6metadata:7 source: https://skillmd.com/skills/green-pt/honey-loop-48---910# Honey Loop1112A loop is the one place token waste *compounds*: `cost = per_tick × ticks`. The13honey levers still apply inside each tick (less code, less prose), but a loop adds14two leaks the single-shot levers don't cover — **re-paying for context** every15wake-up, and **re-doing work** that didn't change. Cut those.1617## The five levers18191. **Pace to the cache, skip the dead zone.** The prompt cache TTL is 5 min.20 - `< 270s` → context stays warm; right for actively polling external state.21 - `≥ 1200s` → one cache miss amortized over a long idle wait; the default for22 idle ticks (use **1200–1800s**).23 - **`~300s` is the worst choice** — pays the cache miss without amortizing it.24 Never round to "5 minutes." Drop to 270s or commit to 1200s+.25262. **Event-driven over polling.** Harness-tracked work (background `Bash`, `Agent`,27 `Workflow`) re-invokes you automatically on completion. Don't schedule a short28 tick to poll it — that re-reads full context for nothing. Set a long fallback29 heartbeat (`1200s+`) and let the completion notification drive you. Poll only30 external state the harness can't see (CI, a deploy, a remote queue), at a31 cadence matched to how fast that state actually changes.32333. **No-change short-circuit.** Re-generating output is the bulk of per-tick cost.34 Check cheaply first (a hash, a timestamp, a `git rev-parse`, a status field). If35 nothing changed: emit **one line** and reschedule. Don't redo the task, don't36 re-read the world, don't write a report.37384. **Carry a compact state handle, don't re-derive.** Keep what the loop has done39 so far in a small file (`.honey-loop/state.json` or a `<<honey:HASH>>` stash via40 `eso stash`), and read *that* each tick — not the full history re-discovered from41 scratch. Lever 3b: the cheapest input token is the one that never re-enters context.42435. **Define done; then stop.** An unbounded loop is unbounded cost. State the exit44 condition up front (target reached, N empty ticks, deadline). When met, end the45 loop — omit the wake-up reschedule. "Loop forever" is a bug, not a feature.4647## Per-tick output: ultra by default4849A loop tick is an agent-to-self / agent-to-log message, not a deliverable. Default50to **ultra**: status line only, near-zero prose. One line is enough —51`tick 4/∞ · no change · next 1800s`. Step up to a full report **only** on the tick52where something actually needs the user (state changed, a decision, an error).5354## Don't cut5556- The **stop/exit check** — dropping it is how a loop runs all night.57- **Error surfacing** — a tick that hit an error reports it; silent failure in a58 loop hides for hours.59- The **cheap pre-check** in lever 3 — skipping it to "just redo it" defeats the point.