Why did the Liberal Party of Canada (LPC) and the New Democratic Party (NDP) enter into a supply-and-confidence agreement in March 2022? Interparty cooperation among federal parties is rare during minority governments, and yet the agreement created a formal alliance in the House of Commons. In this article, we argue that ideational factors led to the 2022 agreement. We examine the role of programmatic beliefs and strategic learning during the COVID-19 crisis and the 2019-2021 election sequence to shed light on changes in federal parliamentary strategies in Canada. From ad-hoc voting coalitions to extended cooperation on social policymaking, the LPC and the NDP learned how to work together in the House of Commons while using the agreement as a tool to compete with each other in anticipation of the next federal election.