It always happens like this.

Either I wake up and immediately remember the dream, and forget it later unless I write it down.

Or it all comes to me at once several minutes, or hours after I wake. Like, the entire storyline just floods in and I now have this perfect memory of what happened.

Mostly the latter.