brew list on an older Mac is a wall of libraries I never asked for. A shorter list answers the real question, which is what I installed on purpose.
brew leaves
brew leaves --installed-on-request
The Homebrew manual describes leaves as listing installed formulae that are not dependencies of another installed formula or cask. Add --installed-on-request (short form -r) to keep only the ones that were installed manually. There is also --installed-as-dependency (-p) for the leaves that came along as dependencies.
It pairs well with two other commands from the same manual. brew autoremove uninstalls formulae that were only installed as a dependency and are no longer needed, and it has a dry-run flag, so look first:
brew autoremove --dry-run
And brew bundle dump writes everything installed, casks and taps included, into a Brewfile, a snapshot you can keep in version control.
The caveat is that a leaf is not the same as something you want to keep. A formula that nothing depends on may still be a tool you use daily, and a package you installed yourself can disappear from the leaves list once something else depends on it. Treat the output as a shortlist to read, never as a list to delete.
Further reading: Homebrew manpage