SpotlightFS is a MacFUSE file system that creates true smart folders, where the folders' contents are dynamically generated by querying Spotlight. This differs from Finder's version of smart folders, which are really plist files with a ".savedSearch" file extension. Since SpotlightFS smart folders are true folders, they can be used from anywhere—including the command line!
SpotlightFS is not very complicated, and it's a good example of what can quickly and easily be done using MacFUSE. Please check out SpotlightFS and the other cool stuff on the newly updated MacFUSE project site.