Ive wondered before if using magnets would be viable in a rifle. Simply get two strong rectangular magnets and place them beside the barrel (you could even use a circular magnet around the barrel if space is an issue) and have two magnets on the bolt too. The bolt face would have to be quite large to have enough surface area to make a strong lockup. You wouldn't need a strong recoil spring at all, but would need a handle that levers back, like a G3 charging handle, to separate the magnets as they would be, as expected, hard to separate. I was pretty happy for myself for thinking of this idea until about 2 months ago I found out that magnets actually stop being magnetic at a certain temperature. Steel or iron magets can only really withstand temps of up to 500F, and obviously that is way too low to be used on anything other than a bolt action or maybe a .22lr rifle or something like that. Even if heat didnt pose a problem the magnets being too brittle probably would.