Thanks for the save, it revealed a problem that those wild improvements were not linking to cities based on how close the closest improvement was, but instead how close the city hub was. This kept your adjacent resource improvements from linking to getting absorbed into the city. However, in general, wild improvements do not need to be linked to a city in order to produce their resource; being linked to a city means they get the production bonuses of that city, and they show up in the resource info for that city, but otherwise even non-linked improvements still produce their resources; it just goes straight to the global resource pool, which is what was happening to your lost library. Your save revealed a bug in that your improvements were certainly close enough to be linked to the city, but were not linking, but i just wanted to clarify that even if you have a wild improvement producing some resource and it is not showing up in the city info, it is still producing that resource for you, not just sitting around being useless
.