Omit files whose owner is not the current user? This would not work for Python for example where pip often installs packages in user mode, but for C/C++ and Latex it would probably work pretty well.
Selecting sub-directories of the current working directory could cause issues in C/C++, where include files are typically separated from source files, and the compiler may enter a sub-directory to compile its source files (hence leaving the root where the include files would be matched).
With a build tool (CMake for C++, Maven for Java), dependencies can be installed inside a sub-directory at the root. This is also maybe a case other than standard library / packages where excluding directories could be useful.
Moving discussion about include/exclude over from https://github.com/plasma-umass/cwhy/pull/16.
A few notes/ideas:
pip
often installs packages in user mode, but for C/C++ and Latex it would probably work pretty well.