It should be a new building where people should be able to fill their spellbooks with spells. Spells in library should be available constantly to reduce waiting time for example for vision/another "do not dive without" spell. To keep 9 usefull spells in library should be 3-4 times more expensive.
To conclude:
1. player bring codex to Library
2. choses spell and than codex
3. and the spell in added to codex