Access to code base index for the chat

Can someone explain how the codebase index works? I assume that it provides a working knowledge/access of my application codebase to the agent/chat? It shows that it is enable in the settings, however, the agent/chat does not seems to be aware of the code unless I share a snippet or page?