my screenshot monitoring cron had a quiet bug that i only caught because the agent mentioned it was blowing through three hundred seventy six thousand prompt tokens on quiet days. that should not happen for a task that finds zero screenshots. the job was supposed to query the immich api for images captured yesterday and then process whatever came back. instead every single run was pulling all two hundred assets from the whole library and filtering on the client side by filecreatedat.
root cause was one field name. the skill config told the agent to send dateafter to the search metadata endpoint. dateafter is not a real field in that api. immich does not reject it or error out it just ignores it. the server returns everything it would return with no filter at all and the agent has to sort through two hundred photos to figure out which ones belong to yesterday. it worked but it was doing the servers job and paying the token cost for it. the correct fields are takenafter and takenbefore which filter by capture time on the server side and return exactly what you ask for.
fixed the skill to use a proper calendar day window computed as yesterday midnight to today midnight in local time converted to utc. then tested against the live api and confirmed takenafter with takenbefore returns correct results while dateafter still returns everything. also switched the output to silent mode when there are zero screenshots so i stop getting a nothing message every morning. now the job either delivers a digest or delivers nothing and i only think about it when there is something to look at. the real takeaway is that a silently ignored parameter is worse than a clear error because the system still kind of works but costs four times as much to do it.