John Swinney "manually" deleted messages between himself, Nicola Sturgeon and Humza Yousaf in a practice which could date back to 2007, the UK COVID-19 Inquiry has heard.
The former deputy first minister said he rarely spoke to his former boss Ms Sturgeon via text messages or other informal means, saying texts were generally only used to set up a phone call.
These messages, he told the inquiry, were deleted in accordance with Scottish government guidance.
The inquiry has 18 pages of WhatsApp messages between Mr Swinney and now First Minister Mr Yousaf.
Mr Swinney had deleted the messages, which were recovered from an old handset of Mr Yousaf's and subsequently submitted to the inquiry.
Mr Swinney - who also held roles overseeing education, COVID recovery and finance in his time in government - defended his lack of retention of messages, which he said was in line with guidance from the Scottish government, issued in 2021.
He also added that he had held the same deletion practice since becoming a minister in 2007, based on advice from his private office at the time.
Asked why he had deleted the messages with Ms Sturgeon, Mr Swinney said: "I was advised by my private office that I should not hold information that was relevant to the government's official record in what were called ungoverned sources.
"Throughout my ministerial career I have deleted material after I have made sure any relevant information was placed on the official record of the government, and that was the approach I was advised to take."
He added: "That was advice given to me by my private office as far back as 2007 when I entered government and it was also consistent in my view with the government's record management policy.
"I also think it is consistent with the obligations of the ministerial code."
The way he handled messages, Mr Swinney said, was consistent with Holyrood policy, but "apologised unreservedly" if he had misunderstood the guidance.
Asked by Jamie Dawson KC, counsel to the inquiry, if there was a "defect" in the policy, rather than Mr Swinney's adherence to it, the MSP said: "That might well be the case, and what I would say to the inquiry was that I believed what I was doing was consistent with that policy and I was doing nothing during COVID that I wasn't doing at any stage the previous 13 years of my ministerial life.
"My handling of information had at no stage been questioned in that process."
Mr Swinney said he worked "all the hours that god sent" during the pandemic.
Read more on Sky News:
Freeman says she 'will regret care home deaths for rest of her life'
Sturgeon branded Johnson a 'clown' in foul-mouthed messages
Yousaf admits 'winging it' as Scotland's health secretary
The inquiry is currently sitting in Edinburgh as it probes the devolved administration's response to the pandemic.
Giving evidence earlier on Tuesday, former finance secretary Kate Forbes said she did not delete any of her WhatsApp messages with senior ministers and officials until January 2022 - after all major COVID decisions had been made.
The inquiry heard that Holyrood's equivalent of COBRA meetings - the Scottish government Resilience Room (SGoRR) - had not been minuted, nor meetings of the so-called "gold command" group.
Ms Forbes said she was "surprised", adding: "And this would be the first of me hearing it."
The MSP for Skye, Badenoch and Lochaber said she was unaware of the gold command group's existence until she was invited in 2021.
Inquiry chair Lady Hallett asked Ms Forbes: "Given your seniority in the Scottish government, why weren't you at the command meetings in 2020?"
Ms Forbes said: "I wasn't aware. I am not even sure I was aware they existed."
Lady Hallett said: "You would have expected to be invited, wouldn't you?"
Ms Forbes replied: "I would have expected to be invited to any meeting where there were significant financial implications."