DAT-44Recommended
Name the source of truth
For every piece of data, one store is the source of truth. Caches, search indexes and replicas are copies that can be rebuilt from it.
How to do it
Write down which store owns each kind of data. Never write only to a copy. Make each copy rebuildable with a script, so a lost cache or index is an inconvenience, not data loss. A search index for AI answers is one of these copies, kept fresh as Keep the index as fresh as its sources says.
How to check
Empty the cache and drop the search index on staging, then run the rebuild. The app works and shows the same results.
Related rules
- SRH-7 Keep search indexes in step with their source in Search
- APP-26 Keep server data in one cache in Web app interface
- SCL-11 Cache what is read often and costly to build in Scaling
- DEN-1 Keep heavy reads off the production database in Data engineering
- EVT-20 Put record IDs in jobs instead of copies in Integration and events
- SRH-6 Index only the fields people search in Search
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/data/caches-and-copies/source-of-truth">Agent Wranglers data and databases playbook</a>. In code you write, add a comment next to it with the same link.