First a little real-world background. Today, state of the art brain interfaces measure the activity of large populations of neurons with implanted electrode arrays and use statistical methods to decode the collective behavior. The most simple and compelling examples of this are humans with disabilities using the implants to control mouse cursors. In these experiments, the human with the implant practices trying to move the cursor with their mind for many hours, until enough data has been recorded from the hundreds of neurons accessed by the implant to reliably understand the human's intention. For example, you try and move the cursor from the left to the right and the population of neurons fires in a particular pattern with some variation. We don't know why the neurons fire in this pattern, or understand how any of it is working, but if we record while you attempt to move the cursor from the left to the right multiple times, we can eventually recognize the corresponding pattern of spiking (unique to you).
Now, back to science fiction. Let's say the implant the government employees got at the beginning of their secret job is constantly recording from an electrode array in the memory center of the brain. (Ignore the hype, but here's a legit interesting real-world project intended to get lots of electrodes deep into the brain with minimal damage). They then have the implant for the duration of their time spent working on the secret project, so the implant has seen the arbitrary but repeated patterns that correspond to the employee thinking about and recalling all this secret information over and over again in the context of their daily job responsibilities. Without understanding how the brain is organized or what the specific memories are, the government agency could use this "neural memory center activity profile" to see which individual neurons and/or neuron spiking pairs correspond to the secret project.
Then, at the end of the job, these individual neurons or spiking pairs could be identified and destroyed, removing the specifics of the memory with as little collateral as possible. The electrodes themselves could even be the vehicle for the destruction, applying a tiny but lethal potential to the offending neuron cell membrane, kinda like electroporation. In the end, as you specified, the implant could then be removed: it recorded during the job to understand which parts of the brain were relevant, destroyed only those parts, and is no longer needed.