By summarizing past experience, one can 'know gain and loss' and avoid repeating mistakes.
Tips
history
From 唐太宗李世民 (Tang Taizong, at the death of minister Wei Zheng 魏征, 643 CE), recorded in 《旧唐书·魏徵传》: 以铜为镜,可以正衣冠;以史为镜,可以知兴替;以人为镜,可以明得失 (Take bronze as a mirror to straighten your robes and hat; take history as a mirror to know the rise and fall of dynasties; take people as a mirror to clarify gain and loss). The 'three mirrors' of Taizong — foundational text of Chinese political wisdom.
usage
Often cited in the condensed form 以史为镜,可以知得失 (conflating the second and third mirrors). 得失 = 'gains and losses' i.e. what was done rightly and wrongly.