The process of completing, correcting and prioritising specications is an essential but very complex task for the maintenance and improvement of software systems. The preservation of functionalities and the ability to accommodate changes are main objectives of the software development cycle to guarantee system reliability. Logical theories able to fully model such processes are still insucient. In this paper we propose a full formalisation of such operations on software systems inspired by the AGM (Alchourrón-Gärdenfors-Makinson) paradigm for belief revision of human epistemic states. We represent specications as nite sets of formulas equipped with a priority relation that models functional entrenchment of properties. We propose to handle specication incompleteness through ordered expansion, inconsistency through ordered safe contraction and prioritisation through revision with reordering, and model all three in an algorithmic fashion. We show how the system satises basic properties of the AGM paradigm, including Levi's and Harper's identities. We oer a concrete example and complexity results for the inference and model checking problems on revision. We conclude by describing resilience and evolvability of software systems based on such revision operators.