A philosophical guide to avoiding the AI doomsday scenarios.