The agreement between Cohen's lawyers and federal prosecutors also frees Cohen to engage with news organizations and use social media, as he serves the remainder of his three-year term for campaign finance violations and other crimes in home confinement.
"There shall be no specific media provision" governing Cohen's activities, according to the agreement, which requires approval by US District Judge Alvin Hellerstein in Manhattan.
Cohen, 53, had served about one year of his prison term before being sent home to his Manhattan apartment in May, because of the risk of contracting COVID-19 behind bars.
Federal authorities returned him to prison on July 9, one week after Cohen tweeted he was close to finishing his book, when Cohen questioned their new requirement that he agree to steer clear of media.
But Hellerstein ordered his release last week, saying the return to prison amounted to government retaliation against Cohen's desire to exercise his First Amendment rights.
The judge gave both sides a week to negotiate a media provision that is "consistent with the First Amendment but yet serves the purposes of confinement."
Cohen pleaded guilty in 2018 to campaign violations tied to hush money payments to pornographic film actress Stormy Daniels and former Playboy model Karen McDougal, who claimed they had affairs with Trump.
He also pleaded guilty to evading taxes on more than $4 million in income and making false statements to a bank.
Trump has denied having the encounters with Daniels and McDougal, and called Cohen a "rat."Cohen, who once said he would "take a bullet" for Trump, said in court papers that his planned book would contain unflattering details about Trump, including racist and anti-Semitic remarks.