Board Thread:Questions and Answers/@comment-27597825-20160227200001/@comment-11139677-20160227203726

From what I can gather, him, Gaster and Alphys (along with possibly several others) were doing some kind of research together, likely involving determination or resets. Gaster didn't survive (or at least, not in one piece) and Sans is trying to save him.