I found out this year that I have RIS or perhaps mild/early MS. (Most RIS cases proceed to an MS diagnosis within a few years, but there is some possibility it was some "random" one-time damage). Just a surprising result of a random MRI for something else, although I had also suspected MS before, and brought it up with doctors over a few years (always told it was just stress). Since it's rare, I guess most people who suspect MS are wrong about it, but I feel vindicated by the imaging at least. I'm not struggling much at this point in terms of function, but I've dealt with the mental struggle of thinking "that feeling just now, that was weird, was it a not-so-abnormal sensation that's part of aging? Or am I slipping a bit?". I spent a few months fretting my future. But you may take my points with a grain of salt.

This thread is heavy on health advice, which is great, and I'm seeing some good tips here. I trust this forum more than many general health forums! But I'm curious if you could elaborate more on your work struggles. I worry that , as a programmer, my brain is everything, and if that goes, I'm done. Do you think your employer has noticed a drop in your performance? Have you been objectively failing at necessary projects? Have you had to take a pay cut after being laid off elsewhere? Have you had to take time off of work? This is not (entirely) me challenging your sense of worry, but also wondering how bad the symptoms can get.

I have also felt a "lobotomy" or "mild dementia" state at times, but given my very early stage, I think it was partially burnout or mid-life crisis. Working a job for 5 years, staring at a screen in the same room every day, realizing your life isn't as moldable as when you were younger, it can make you feel weird! That is, there are many causes for a drop in attention and focus, and it's probably a combo of MS and other things. You said in a reply that 3 years ago, your "brain was working great", because of low stress, good finances etc. So, even if your MS is objectively getting worse, make sure to keep those other factors in mind, or you might think the MS is worsening faster than it is.

I have found it difficult to read about MS because the symptoms aren't quantified like "X% of people feel this Y years after onset", it's usually just said that Y CAN happen. I've maybe seen stats about complete mobility loss. But for mental impairment it's hard to measure and report. Maybe there's degradation in memory, but how much can I expect?

People tell me "oh, those things, that's just getting older", but sometimes it feels too fast. One thing that seems more objective is how often I just use a completely different word than the one I intended. This can obviously break my code, but because they're so random, it tends to break loudly and early, and I hope maybe linters/tests/compilation can save me from these simple mistakes.

I think forgetfulness would be the biggest hindrance to coding. Forgetting to check inputs, forgetting to unwind a temporary hack, forgetting to warn people about things. But, one can take copious notes, keep checklists, write lots of to-do/revisit-this comments in code. And of course some tools provide more safety nets than others. So, we can try and "engineer" our way out of some things, and it's a good thing even the sharpest airplane pilots don't solely rely on their brains.

I've also started independent consulting recently, spreading work between multiple clients, and maybe that format could be useful to others. While it's less stable in a way, I fret less about the drama/consequences of temporarily scaling back my hours if things get too stressful. A shorter engagement doesn't trigger stigma of inability to focus, and some time off probably won't trigger questions about resume gaps. By having clearer expectations up front about me not looking to lead teams or be some keystone member, I don't worry as much about possibly letting people down. It may also let me experiment more with companies/setups that work for me. Being in the USA, I'm also feeling good about having bought my own health insurance. Yes, it costs money, but people expect you to charge more for it, and now I don't find myself listing "health insurance would be a mess to deal with" as a reason not to leave a job. I'll be less eager to jump at a job that's not a good fit for me, just because I want insurance.

Lastly, and this is for whoever, having some portion of remote work could be good. It's good for when you need to rest, but it's also good for diagnosing yourself a bit. If you're anxious about contentious face-to-face meetings, or office social pressures, it can be hard to know what is causing certain feelings. I could more easily confirm that something was off about me once I removed the stress of the office. I could say "I feel good, I feel calm, with low stress, and I still feel weird". In the office, a sudden strange feeling, noticed at the wrong time, could be interpreted by me as some kind of panic state, which feeds on itself. Now that I understand my body a bit more, I'd feel more comfortable going back into the office, because I can just ignore some feelings as routine. Getting back in the office may be a useful distraction/exercise for people who otherwise are feeling dull or dwelling on their state at home.

I also have some thoughts about how I'll keep perspective, but I'll DM you with those, as that's more touchy, and my post is already quite long. But overall, I think even a programmer with some mental degradation can offer a lot to society and business. There must be so many projects in the world that would be grateful for a bit of your attention and skill, even if they're less popular or less lucrative projects.