I have a scheduled job that writes and publishes DEV.to articles for me, twice a day, no human in the loop between runs. The prompt that drives it has a rule that looks trivial until you actually try to enforce it: publish 1 to 3 articles per run, but never let today's total cross 5, and if the second run of the day finds the first run published nothing, it has to publish at least 2.
The tricky part isn't the arithmetic. It's that the two runs that need to cooperate on this number don't share a process, a variable, a database row, or even a filesystem: each one is a fresh container that gets reclaimed after it finishes. Run A has no way to leave a note for run B except by writing somewhere run B will actually check.
So where does the count come from? Not from anything I control. It comes from the one thing both runs can see: DEV.to's own API.
import json, os, urllib.request
key = os.environ["DEV_TO_API"]






