Your cron job runs every morning at 6. It scans for price drops, drafts the summary, posts it. Solid automation. There is just one problem: it has no idea what it did yesterday. Same alerts, same re-reads, same re-tries of the thing that failed on Tuesday. Your scheduled AI task has amnesia, and it is costing you tokens and trust.
The fix is not a smarter model. It is a memory the task can read when it wakes up and write to before it goes back to sleep.
Why scheduled runs forget
Every scheduled execution is a fresh process. ChatGPT scheduled tasks, n8n workflow runs, cron-triggered agents, they all start with a blank slate. Whatever the last run learned lived in that run's output, and output is not memory. So the new run re-discovers everything: which items already alerted, which sources were already checked, which approach already failed.
If you have ever watched a nightly agent cheerfully re-report the same three findings three days in a row, you have seen this. The agent is not broken. It just cannot see yesterday.
The ledger: what a run should actually persist
You do not need a transcript. You need a ledger, five things:
- Checked: what the run looked at
- Changed: what was different from last time
- Decided: conclusions the run reached
- Failed: attempts that did not work, with the reason
- Open: what is still unresolved
That reason field is doing the heavy lifting. "Tried the vendor API, broken" invites the next run to try it again. "Tried the vendor API, returns 403 for our key tier" actually prevents the retry. Reasons stop repetition; bare facts do not.
The pattern: load, diff, save
Here is the whole technique in pseudocode terms:
- Run starts. First action: read
state/<job-name>.json. - Do the work, but diff every finding against the loaded state. Only changes trigger alerts, messages, or writes.
- Run ends. Last action: write the new state back. Timestamp, the five ledger fields, done.
- Next run repeats from step 1.
A minimal state file looks like this:
{
"job": "nightly-price-scan",
"last_run": "2026-09-25T06:00:00Z",
"changed": ["sku-4821 dropped 12%", "sku-9910 back in stock"],
"decided": ["alert threshold stays at 10%"],
"failed": [{"attempt": "vendor feed v2", "reason": "403 on our key tier"}],
"open": ["check sku-3300 supplier ETA"]
}
Nothing fancy. The part people skip is making the write-back an explicit instruction in the task prompt. "Update the state file before finishing" has to be in the prompt, or the agent finishes without writing and the memory never forms.
Making it work on real platforms
ChatGPT scheduled tasks are stateless per run, so the memory has to live outside: a file the task can access, a doc, a database row, or a memory service with an API. Name it explicitly in the prompt. "Read state/last-run.json first, update it last" works. "Remember what you did" does not.
n8n gives you a few options: Postgres, the built-in memory nodes, or a state record keyed by workflow and date. Load it before the agent node, inject it into context, save the new summary at the end of the workflow. Same pattern, different storage.
MCP agents (Claude Code, OpenClaw, Hermes, anything MCP-compatible) can use an MCP memory server as the shared store. Each scheduled run calls the memory tools on wake, saves on exit. The trap here is per-client memory: every tool remembering its own runs while the job needs the one shared picture. Point them at the same account.
When the JSON file stops cutting it
One file per job is great until you have thirty jobs and you are grepping through state files to answer "did we already try this." At that scale you want a real store with search: semantic recall across old runs, shared across every tool you use.
That is the gap Vilix AI fills: cloud-hosted memory over MCP, so scheduled runs from different clients read and write the same store. Tradeoff, stated plainly: it is cloud-only, and each client needs its own setup. If you want everything local, a self-hosted vector DB plus your own write-back logic is the honest alternative. But either way, stop letting the file be a database with extra steps.
Start with the worst offender
Do not build the perfect system today. Take the one scheduled task that annoys you most, give it one state file and two prompt lines (load first, save last), and run it twice. When the second run says "no changes since yesterday" instead of re-reporting everything, you have cured the amnesia. Scale the storage after that, not before.
Top comments (0)