State tracking
Also said as Flags, Story variables, Quality-based narrative
The game keeps a list of what has happened: did you pay, who did you lie to, how many times have you died. Scenes then read that list to decide what to say.
One flag can buy a whole scene's worth of memory for one extra line. Forget a flag and a character will thank you for something you never did, which players do notice.
Say it
“Set a flag "lied_to_warden" when they lie at the gate. In the prison scene, if that flag is set, the warden skips the greeting and says "I know what your word is worth."”
Where you’ve seen it
Undertale keeps some memories even if you reset your save: Flowey can tell you what you did on a timeline you just erased. Mass Effect 2 and 3 read your earlier save and bring your decisions forward.
Not to be confused with save file
A save file stores the whole game so that you can come back to it. Flags are the story's own memory, and a save just happens to contain them.