Both militaries will also remove some of the heavily armed guard posts they have built within the Demilitarized Zone, the 2.5-mile-wide buffer zone along the border, the agreement said.

South Korean analysts have warned that much is at stake in Mr. Moon’s efforts to mediate a breakthrough in the stalled dialogue between Washington and Pyongyang. They said that if he failed to coax Mr. Trump and Mr. Kim to hold a second summit meeting, following up on their June talks in Singapore, the Korean Peninsula might revert to the roiling tensions of last year.

When Mr. Moon’s special envoys visited Mr. Kim in Pyongyang earlier this month, he told them that he was willing to denuclearize within Mr. Trump’s first term. But he said he would start taking phased actions toward that goal only if Washington reciprocated with “simultaneous” measures to prove that it was no longer hostile, the envoys said. At the same time, the North is continuing to expand its nuclear arsenal.

As a first step, the North wants the United States to declare an end to the 1950-53 Korean War. The war was halted in a truce, not formally with a peace treaty, 65 years ago, leaving the peninsula still technically at war.

Next week, Mr. Moon is expected to brief Mr. Trump during a trip to the United Nations. Then, Mr. Trump is expected to decide whether he will meet with Mr. Kim again. White House officials said last week that Mr. Kim had recently proposed a second meeting.