We present a context-aware architecture that supports seamless coordination and management of hardware devices through adaptive web services. Our context engine (CE) architecture focuses on context modeling in a smart space environment. The architecture supports logic-based context reasoning and creating a consistent context knowledge base. As a proof of concept, a prototype demo has been developed to exhibit the functionalities of our CE through a Web-based Device Workflow Management (WDWM) system. In this paper, a novel two-tier reasoning mechanism: pre-programmed rules definition and semi-automated rules generation based on available contexts are proposed to maximize the usage of available contexts. With this mechanism in place, various types of reasoning tasks can be performed while minimizing conflicting contexts in order to preserve the consistency of context knowledge database.