Well my vague idea of what's happening is Ami found the wishing well after losing Sekai (and Nozomu) and having Akira broken as a result (since all of the Sekai-Akira stuff did happen for real) and made a bunch wishes in efforts to make a world where she can live with her family again. She wished for a best friend (Maya), then wished for the world, then wished for Akira to be happy or something but that resulted in his and Maya's backstory. This angers Ami so she tries wishing for rivals to Maya (the Nakayamas), Maya isn't able to properly resist her since she's literally her best friend, Akira resists since he's happy, things are said in anger and both the time loop purgatory is created, and all of the memories are fucked with (Except for Maya as a punishment, she had to watch his memories be deleted which is what she saw during the scary room, and then it was threatened to happen again)
And whatever the endgame is (I think ending the purgatory world), I believe it ends with Akira and Makoto going into the wishing well to rescue a trapped Ami."