Reinforcement Learning with History-Dependent Dynamic Contexts