1. I was debugging why our retrieval was pulling garbage results at scale. Turns out Sonnet 4.6 was drifting on embedding consistency when you feed it the same text twice with slight context changes. Not a bug, just... unexpected behavior that nobody talks about.
2. So I wrote a little normalizer that sits between your chunks and the embedding call. It's dumb but it works: canonicalizes whitespace, strips metadata noise, makes sure you're feeding the model the same signal every time. Threw it on GitHub because why not, maybe someone else is pulling their hair out over this too.
3. It's not a silver bullet. Just saved us about 6% of bad retrievals, which sounds small until your sales cycle is eating your runway and you can't afford to lose deals to search trash. Code's here if you want to fork it or yell at me about why I'm doing it wrong.
just my setup.