The combined challenge of climate change and population aging requires novel solutions that enhance the resilience of building energy systems and secure indoor comfort for vulnerable occupants in extreme weather conditions. This research investigates the performance of a newly developed Energy Management (EM) system based on Collective Intelligence (CI) and Reinforcement Learning (RL), called CIRLEM, managing the energy performance of an urban complex in Ålesund, Norway, including an elderly care center with decentralized PV generation, EV charging and storage, while connected to a main electricity grid. CIRLEM controls multiple flexibility assets including independent thermal zones (the demand-side agents) and Electric Vehicle (EV) charging stations (the local storage). In a novel approach, CIRLEM coordinates the distributed storage and generation together with the demand side to control energy systems and react collaboratively to environmental variations. Under extreme weather conditions, without applying CIRLEM, the demand can be more than double that of typical weather conditions. The implementation of the double-layer CIRLEM can reduce the total demand by 35 % over a month. Furthermore, the inclusion of photovoltaic (PV) systems allows the system to be independent from the grid for almost 40 % of its operational hours, while adding EV storage can increase it to around 70 %. Finally, the application of CIRLEM reduced overheating hours from 17 h ∙°C to 2 h ∙°C under extreme conditions, while maintaining comfortable conditions even during temperature ramps.