The Rete algorithm (/ˈriːtiː/ REE-tee or /ˈreɪtiː/ RAY-tee, rarely /ˈriːt/ REET or /rɛˈteɪ/ re-TAY) is a pattern matching algorithm for implementing production rule systems. It is used to determine which of the system's rules should fire based on its data store.