SUN · 9:02 PM
SUN · 9:02 PM

It’s 9 PM. The rate limiter ships tomorrow.

Alex has forty Stack Overflow tabs open, a chat that stopped making sense at message thirty, and a demo in twelve hours. The one diff that mattered is buried six edits deep.

rate limit my express api, per-user
You could use express-rate-limit with a fixed window…
wait, what about multiple instances behind a load balancer
Good question — you’d want a shared store like Redis…
going back to the sliding window thing —
⋯ 30 messages later, still scrolling

She closes the tab. Starts over — differently.

9:14 PM

One task, explored differently.

9:31 PM

The fork

Section two holds the claim her fix depends on. Do what Alex did — select the sentence.

Fixed windows let a client send double its limit in the two seconds either side of the reset.

ASK AI · ON THE HIGHLIGHTED SENTENCE

At a 100 requests/minute limit, a client can send 100 requests at 11:59:59 — the tail of one window — and another 100 at 12:00:01, the head of the next: 200 requests in two seconds against a stated 100/minute cap. The fix in this branch is a Redis-backed sliding window counter — it keeps the current bucket’s count plus a weighted fraction of the previous bucket’s, so the effective limit degrades smoothly across the boundary instead of resetting to zero. Cost: one extra GET per request, still O(1).

GO DEEPER · SLIDING WINDOW

In production the sliding-window counter has to be atomic across replicas — a naive GET-then-INCR from two API instances can race, and both can pass a check that should have failed one of them. The fix is a single Redis Lua script (EVAL) that reads the previous bucket, computes the weighted count, and increments the current bucket in one round trip, so the check-and-increment can’t interleave. Clock skew between app servers is the usual failure mode in review: if two instances disagree on which 60-second bucket a request falls into by even a second, users near the boundary get double- or under-counted. Redis’s own TIME command sidesteps this by using the server’s clock instead of each app instance’s.

Every tangent becomes its own node. Nothing buries anything.
10:05 PM

The right brain for the branch

×1
GO DEEPER · SLIDING WINDOW · CLAUDE HAIKU

In production the sliding-window counter has to be atomic across replicas — a naive GET-then-INCR from two API instances can race, and both can pass a check that should have failed one of them. The fix is a single Redis Lua script (EVAL) that reads the previous bucket, computes the weighted count, and increments the current bucket in one round trip, so the check-and-increment can’t interleave. Clock skew between app servers is the usual failure mode in review: if two instances disagree on which 60-second bucket a request falls into by even a second, users near the boundary get double- or under-counted. Redis’s own TIME command sidesteps this by using the server’s clock instead of each app instance’s.

The branch that matters gets the sharper mind. She’s paying per thought, not per month.

10:40 PM

Receipts

It adds a Redis-backed sliding-window counter in a new rate limiter module. It writes a matching test file covering the boundary case where fixed windows used to double-count. It wires the middleware into the Express app ahead of the existing routes. The first run fails on a TTL type mismatch — FAIL — the fix casts the argument to a number, and the suite goes green: PASS.

11:47 PM

Two hours. Not a transcript — a map.

Every step reviewable. No mega-diff.

🚦
ROOT
Rate Limiting: Per-User Quotas
drag to pan
MON · 12:56 AM

The merge

She stops branching and starts merging. Every thread that mattered, one PR:

Select 2–6 nodes to fold into the PR — including the ones you made.
🚦
ROOT
Rate Limiting: Per-User Quotas
drag to pan
0 / 6 SELECTED
MON · 8:15 AM

It survives the night

Monday morning: she reopens the project from Projects. Same map, same commits, exactly where she left them.

Adds per-user rate limiting to the API with a Redis-backed sliding-window counter. Fixes the boundary-burst issue where fixed windows let a client send up to 2x its limit across a reset.

github.com/acme-labs/billing-service/pull/42

Reopen it anytime — the whole map, every commit, is still there.

№4 — It ends as a reviewable PR, not a transcript you’ll never reopen.

MON · 8:15 AM

The bill

FORKAI CODE — PROJECT RECEIPT
SUN 9:14 PM – 11:47 PM
1× opening question$0.01
3× agent commits$0.21
2× follow-ups (Gemini Flash-Lite)$0.01
1× deep dive (Sonnet)$0.07
1× PR merge synthesis$0.03

TOTAL$0.33

“No subscription was harmed.”

Illustrative estimate — actual cost varies with models and task complexity.

Price your own nights

Typical model tier
Claude Haiku tier — Gemini, DeepSeek, and GLM are typically cheaper still.
$/month
$20 is just a common flat-fee reference point for illustration — edit it to match whatever you’re comparing against.
About $0.93/month with forkai code’s pay-as-you-go credit, at 40 tasks/month on the fast tier.
That’s about $19.07 less than a flat $20.00/month plan.
Your free $5.00 signup credit covers about 215 tasks at this tier before you’d need to add credit.

Estimate based on a typical multi-section answer (~1,500 input / ~2,800 output tokens) — your mileage will vary with task complexity and model choice. Not a guarantee.

11:59 PM — a flaky test, two follow-ups, $0.04
A sprint week — five PRs merged, forty agent commits, $1.80
Always — commits that land on main, not in a chat you’ll never reopen.
Fine print

Yes — forkai code needs a free account to start a project. Your first $5 of usage is on us, no card required.

WHAT THE NIGHT PROVED
№1 — A coding flow you can’t lose your place in. Concepts, not forty tabs.
№2 — Each branch carries only its own thread. Cleaner context in, sharper commits out.
№3 — The structure is the interaction: highlight → branch → node.
№4 — It ends as a reviewable PR, not a transcript you’ll never reopen.
№5 — PR & merge: land only the branch that survived review.
It’s 9 PM somewhere.
Try forkai code free
Ask once. Branch forever.
Free $5 credit when you sign up