An algebraic theory of local knottedness. I