apt and aptitude both remember which packages were installed automatically as dependencies of some other package or manually for some reason. For various reasons the list of manually packages may become needlessly large and can start to accumulate over time. These packages will be uninstalled only when specifically requested.
One common example are library packages which may be installed as hotfix for some reason, but later they could be marked as automatically installed once some software depending on them is installed. However, if that doesn't happen, they will remain installed even once the packages depending on them are uninstalled. Tools like
deborphan may find these left-over packages in some cases, but they have to guess a lot and it's not a systemic solution.
Description of a possible solution
That's why I'm looking for a way to find such packages that can be marked as automatically installed without them resulting to be uninstalled. This would mean finding packages that are currently marked as manually installed, but are dependencies (or recommended dependencies) of some other installed package. These packages could then be marked as automatically installed and will be removed once they are not needed anymore by other software.
I think I might be able to make a tool like that with the Python bindings for libapt, but I would hate to reinvent the wheel if something like that already exists.