And they were not done out of impulse. Mr. Trump’s advisers have become more involved in his free-form Twitter feed in the last few weeks, ever since his impetuous, conspiratorial posts about President Barack Obama’s supposedly wiretapping his phones touched off a still-running controversy.

Stephen K. Bannon, Mr. Trump’s chief strategist, has counseled a tough tone with the rebels, instructing his staff to use Twitter as a rhetorical prod to keep the party in line. Dan Scavino, an aide who controls Mr. Trump’s official White House Twitter account, recently moved into Mr. Bannon’s West Wing office, where he closely monitors social activity by and about the president, according to two officials.

A handful of people have always had access to Mr. Trump’s personal Twitter account, but in the weeks since the president’s accusation against his predecessor, there has been a stricter imposition by aides to make sure there is a strategic imperative behind his posts, according to two people briefed on the process.

The cannon blasts at the House Freedom Caucus followed nearly a week of the president’s stewing about the debacle over his failed health care effort. He did not take the loss especially well. His aides quickly began discussions about reopening negotiations that would at least demonstrate a commitment to what in the past has been one of his party’s most urgent priorities.

The House Freedom Caucus came away from the health care fight feeling emboldened, and Mr. Trump’s senior advisers are now mindful of the need to slow any momentum the group has going into other legislative battles, including the budget fight just four weeks away.

The health care bill that the many House members rejected was extremely unpopular. Only 17 percent of Americans — and 41 percent of Republicans — supported the proposal, according to a Quinnipiac poll released last week.