Over the last few years, context-aware computing has received a growing amount of attention among the researchers in the IoT and ubiquitous computing community. In principle, context-aware computing transforms a physical environment into a smart space by sensing the surrounding environment and interpreting the situation of the user. This process involves three major steps: context acquisition, context modelling, and context-aware reasoning. Among other approaches, ontologybased context modelling and rule-based context reasoning are widely used techniques to enable semantic interoperability and interpreting user situations. However, implementing rich context-aware applications that perform reasoning on resourcebounded mobile devices is quite challenging. In this paper, we present a context-aware systems development framework for smart spaces, which includes a lightweight efficient rule engine and a wide range of user preferences to reduce the number of rules while inferring personalized contexts. This shows rules can be reduced in order to optimize the inference engine execution speed, and ultimately to reduce total execution time and execution cost.