Knowledge management (KM) plays a prominent role in IT and software development companies. It is often introduced as part of larger organisational change processes that aim at improving their software development processes. Process improvement in the IT sector has led to the establishment of the software process improvement (SPI) discipline. Based on a study of the KM and SPI literature we offer a framework for how software companies can ground their improvement activities founded on an alignment of KM and SPI. We identify two archetypes of knowledge organisations which we label exemplary and situational and two approaches to process improvement, which we call normative and reflective. Our analysis of the relationship between KM and SPI leads to a proposal for a balanced theory of KM in SPI and provides valuable insights into how meaningful KM can be conducted for process improvements in IT and software organisations.