Hi there. I understand lack of sleep as a vital possibility causing the confused and foggy mental state with short-term memory loss. pain and soreness in joints along with brain fog also need fibromyalgia workup. the defining criteria according to the guidelines laid are, apart from pain and fatigue, about 11 trigger points, sleep disturbance, morning stiffness, headaches, irritable bowel syndrome, numbness or tingling of extremities, restless leg syndrome, temperature sensitivity and cognitive and memory problems. various tests and tender points in back of neck, shoulders, sternum, lower back etc. no definite diagnostic criteria so a combination of non invasive spinal care, trigger point therapy and lifestyle changes are very helpful in therapy. Consult a neurologist as soon as possible. Hope this helps. Take care.
What you are describing began happening to me in graduate school. It sounds like you have a combination of burnout and symptoms of depression. Do you work alot and rarely schedule time for yourself? It's quite possible depression, anxiety are factors you should consider. Talking to a psychatrist and therapist might help.