In Silicon Valley, companies that collaborate one day can become bitter rivals the next.

And two recent trade secrets disputes pitting small ventures against tech veterans Google and Intel highlight the potentially expensive consequences when a company spills its secrets — even under the protection of nondisclosure and confidentiality agreements.