I Trusted mtime to Invalidate a Cache. Same-Second Writes Never Looked Stale.
Have you ever saved a source file, kicked a rebuild, and still watched the old output win? I did that for two long days and nearly blamed a remote disk for being haunted. The file on disk was already current, and the cache key refused to notice. Does that sound like an agent loop you have already watched chew the same file? I was wiring a small rebuild helper so an agent would skip work when the output still looked fresh. A model drafted the obvious stat comparison, and I pasted it like a reasonable adult. I then ran the same loop on a second machine because my laptop had become an unreliable narrator. Disclosure: This article was prepared as part of MonkeyCode's product outreach. I used MonkeyCode's free model access to draft that helper, and I used the free server option as a clean tree I could not gaslight. Field notes, hour by hour I keep these as field notes on purpose, because the timeline is the bug. If you only read the punchline, you will write the same helper tomorrow. I would rather you steal the reproduction and the decision table. Ready to walk the hours with me? Hours 0–8: I blamed the agent The loop kept reporting cache hit right after it wrote schema.json from schema.yaml . I asked the agent to print the output file, and the bytes were yesterday's shape. I then asked it to “touch the source and try again,” which it did with great confidence. Why would a model ignore a file it had just rewritten in the same turn? I added more instructions, because that is what tired people do. I told it to always rebuild. I told it to delete the output first. I told it to echo the path twice so I could see the string. The helper still returned False from should_rebuild , and the next command reused the stale file. Have you noticed how an agent will obey the wrong predicate with perfect manners? Hours 8–20: I blamed the remote box My laptop had editor plugins, a crowded /tmp , and a shell history I no longer trusted. I copied the repo to the free server option and ran