There's enough logic in here for getting the wiki link, that I think we should move it into its own file/module. If we name that module notes (to match the command), we could just call notes.recent() to get the appropriate link. This would also make the code easier to extend in the future if we want to add other "notes" functionality.