Then look no further, this simple mod remembers chat and previous command history.
At the moment, this mod only works on Forge 1.16.4. Fabric support may be added in the future.
Yes, this mod doesn't interfere with the clear chat debug function.
This mod only saves history while the game is still running. It does not save history to a file.
The use cases of this mod varies depending on how you play Minecraft. From remembering long commands you've typed if you accidently get disconnected from a server, to saving chat when switching between worlds, this mod has a variety of difference uses.
Yes, https://github.com/ryanbester/keepcommandhistory.