The development of lightweight smart materials with exceptional shape memory and thermal insulation properties is highly important in the aerospace industry. The reported shape memory polymer aerogels (SMPAs) are restricted to harsh environments because of their poor high-temperature resistance and large volume shrinkage at elevated temperatures. Herein, shape memory polyimide (PI) composite aerogels with superior thermal insulation were fabricated by combining molecularly designed PI chains with amino-functionalized carbon nanotubes (NH2-CNTs) through freezing gelation and subsequent thermal imidization. Because shape memory behavior was thermally triggered, the thermal conductivity associated with the shape memory mechanisms of the aerogels was comprehensively explored. The presence of CNTs promoted heat transfer in the aerogel skeleton, facilitating the shape recovery response. Benefiting from chemical-crosslinked and physical-crosslinked structures, the fabricated PI composite aerogels demonstrated desirable thermo-mechanical properties, exceptional shape memory and superior thermal insulation performance. This study may provide guidelines for designing shape memory PI composite aerogels for harsh environment applications in aerospace engineering.