On Delete Cascade for Code

I would love a feature that behaves like SQL table delete cascades but for code. So if I delete a function, a high-level API ingress declaration, etc. then Cursor could trace back and ask me if I want to delete all of the related code (or even models) that were used by that code exclusively and are now stranded and unused.

In relation to the above would be awesome to have a tool for finding unused code in general to clean it all up.

1 Like

Hey, really cool feature suggestion!

You can probably already do this using the Composer agent, first asking it to remove the function you want to be deleted, and then in a follow-up message asking it to look at your codebase to find any usage of that function and remove it.

You may have to point it in the right direction, especially with very large code bases, as the composer would be unable to look at every file one by one.