Let's say someone works on personal software projects on their own time while also working for a software company. One day a situation arises such that the source code of one of these personal projects would be very useful within the context of the employee's primary job.
What legal avenues exist for the employee to include the source code in the employer's codebase while also retaining the right to use the source code in future projects of their own?
Let's also say, the employer is based in NY and the employee works from home in MA. And, there's no clause in their job contract that would imply the employer automatically gains the rights to code the employee writes on their own time.
One such avenue would probably be to release the source code as open source under the MIT license, for example. This should work, but presumably will require that the the employer permanently include the MIT license text inside their codebase if the source code needs to be altered to fit their needs.
Are there other ways?