We write and update these documents when needed (this usually means when something has changed in the code) and when knowledge is fresh in people's mind.
If documents are referenced in the code it is straightforward to find them when needed. We also have documents to capture general architecture, which obviously help devs finding their way around the codebase.
If you do it the way you described, isn't it hard to search for some specific knowledge?