Modal logic flourished throughout the twentieth century. Kripke provided a semantics in terms of possible world recognized by mathematicians to be an example of varying sets. This allows a formulation in terms of monads generated by adjunctions. Modal homotopy type theory adds the radical idea that modalities apply to all types, not just propositions, so as to make sense of possible steps and necessary ingredients. The proximity is shown between the structures discovered by modal logicians and common ideas in mathematics of stability under variation. We can then reformulate many ideas in current philosophical metaphysical uses of modal logic, such as rigid designators, counterparts, the de re/de dicto distinction, and so on. Worlds are understood as extended contexts, allowing a formulation of counterfactuals. A form of temporal logic is also easily generated in the same vein.