Hello and thanks for your question.
If you split, you and she can agree whatever you want between the two of you - but if you want a legally-binding agreement, that is only possible once a divorce petition has been filed at court - but you have to have been married for a year before you can issue divorce proceedings.
If you decide to divorce, you will have an interest in the property a) because you are a spouse and b) because you have put money into the flat and increased its' value as a result.
If the split was not amicable, you could protect your interest in the property by filing a restriction at the Land Registry called a Home Rights Notice in form HR1 - this would alert any potential buyer if your (by then) ex put the flat up for sale, (which she could do without your knowledge or consent if it remained in her sole name), that there is an ongoing matrimonial dispute, which hopefully would mean that they would back off from buying the flat - allowing time for a fair settlement to be reached between you and your ex.
You could file your HR1 notice now - but your wife as owner of the property would be notiifed by the Land Registry, so it miught not be the most diplomatic thing to do, as it's usually only done when couples are splitting up, so iyt would be like sayign to your wife that you don't trust her!
Or - if you get your name on the title deeds NOW, then if you later split, she cannot sell the flat without you also signing the conveyancing documents, which you won't agree to do until you and she agree that you get £X from the net sale proceeds or a lump sum of the same amount to transfer the flat back into her sole name.You would need to get a solicitor to draw up a Deed of Trust to set out what % share of the flat you each own, to be filed at the Land Registry at the same time the flat is transferred into joint names.
However, she is unlikely to agree to put your name onto the title deeds (which will mean that you benefit from any increase in value of the flat) if you don't also share in the risk - by putting your name on the mortgage as well. If your name is added to the mortgage deed, it will mean that the two of you instead of just her alone will each be jointly and severally liable for the whole of the mortgage debt. It might even be a condition of the buidling society that if the property goes into joint names, that you must also take on joint liability for the mortgage.
The effect is that you enter into a contract with the building society, which does not end just because your relationship with your wife ends - however, any settlement between the two of you when you split up could be a lump sum to you in return for your name off the title deeds, AND your name off the mortgage, or the property sold.
You could also look into getting a post-nuptial settlement drawn up by a solicitor - but this is expensive, and anyway, this is not legally binding as it's impossible to predict very much into the future when things might look very different if by that time you have kids or one of you is ill, or unemployed etc.
If you do get divorced, any final settlement would take into account ALL the assets including pension entitlements, and not just the fllat.
It may help to get face-to--face legal advice from a specialist family law solicitor. Here's where to find one:
I hope this helps and I wish you the best of luck.
Thanks and best wishes...