My answer is going to be deeply dissatisfying because the best way to learn about and understand ancient Greek words for dirt, pollution, purity, and cleanliness (and literally anything else) is to explore the primary sources that contain these words in the original Greek.
This is why my biggest piece of advice for Hellenic polytheists who aren't actively learning philology is to use words in their own language(s) to communicate ancient Greek religious concepts. It is a much safer bet to do this than to accidentally misuse ancient Greek words and potentially propagate that same misuse.
As for what these specific words mean, you are largely correct!
Lyma (pl. lymata) denotes physical dirt that is washed away with water.
Miasma (pl. miasmata) describes, typically, spiritual pollution, especially as it relates to murder, certain crimes, immoral actions, and death. Other times—such as in Thucydides—"miasma" refers to diseases and other bodily excretions.
In a way, miasma is a product of our humanness because gods are in no sense spiritually polluted. In fewer words, the theoi are above miasma, while human beings must—and will—incur miasma, either through contact with sickness, death, birth, bodily excretions, or by committing murder, certain other crimes, or associated immoral acts.
It should go without saying that the miasma one incurs from being sick is not remotely as severe as the miasma incurred from killing someone, though they are both regarded as contagious. In this way, miasma exists on a continuum, with varying levels of severity that require varying levels of purification.
Purification, too, exists on a continuum, with purity and pollution acting as opposites to normal states of being rather than to each other.
As for agos, I will need to make an addendum to this post when I better understand the concept! I have an acquaintance who is especially well-versed in agos that I will consult before saying anything for certain on the matter.