TL; DR- Tie individual KPIs/OKRs to developmental goals unrelated to the product/project they are working on. 

My advice is based on a successful implementation one of my own agile mentors did and I hope to do someday with one of my clients.

The overhauled the entire HR review process and put in place a 50/50 model. 

The first 50% of your review is based on your team. If your team scored a 36, you get a 36. If your team scored a 2, you got a 2. Teams were measured on the delivery of value to the customer. This is a whole other answer and I've got some blogs and other writing I could share. Short form is, make sure the teams are measured on metrics they can't easily game and choose more than one so you can see if a metric is being gamed. For example, Jeff Sutherland recommends Cycle Time, Escaped Defects and Team Happiness Metric. 

The second 50% of your review is based on developmental, learning or growth based goals. Learning a new language, learning a new process, speaking at a conference, and so on. The key here is the individual goals are about making them a better employee, not if they shipped 1000 lines of code. 

The two scores are put together to form your total review. 

The key to this is it prevents teams from falling into conflict over who gets credit for work done. The whole team is measured equally. It also helps with self-organization as it is in the team's best interest to help the team member who is falling behind.