Work on the main principles of the agreement has already been completed, and only a handful of minor demands are left to be ironed out.
Hamas deputy chairman Saleh al-Arouri is expected to sign the agreement on behalf of Hamas, after he was allowed to visit Gaza for discussions on the deal—which in an unprecedented manner saw most of Hamas's political leadership convening in the strip.
The Hamas leadership was able to reach decisions despite the years-long tensions between Hamas leader in Gaza Yahya Sinwar and al-Arouri.
They are two strong, aggressive and prominent figures in Hamas with different—at times clashing—personalities. Sinwar is a restless man who follows his gut, tends to leave the Hamas councils out of the decision-making and prefers to work in smaller circles.
Al-Arouri, on the other hand, has a long-term strategic outlook and always seeks achievements for the entire Palestinian population, not just for Hamas supporters. Al-Arouri is thinking about the opportunities Hamas could have on the day after Mahmoud Abbas, when the ultimate goal is Hamas taking over the Palestine Liberation Organization (PLO) and from there the Palestinian Authority as well. While al-Arouri's views are similar to former Hamas leader Khaled Mashal's vision, al-Arouri is far more hawkish and a jihadist mindset.
In the discussions held by the Hamas leadership in Gaza, it was Sinwar who pushed for a more strict position in the negotiations over the arrangement in the strip and the ceasefire with Israel. Sinwar insisted Hamas should not make any compromises in an effort to maximize the achievements it could get.
Al-Arouri took a more compromising approach, as he is looking at a far bigger picture than Sinwar, who is only responsible for the Gaza Strip. Al-Arouri wants to have something to show for on the day after Abbas's departure, achievements Hamas can claim for the entire Palestinian people, despite the fact Hamas doesn't have a proper plan for the day after the Palestinian president.
In the middle is Hamas leader Ismail Haniyah, who is constantly trying to mediate between the two and find the middle ground. Since Hamas has kept its discussions under a cloak of complete secrecy, it's hard to tell exactly which approach got the upper hand, but in light of comments from Hamas officials that the agreement was in the "final stretch," it's safe to assume al-Arouri's more compromising approach is the one the organization chose to adopt.
It's important to remember that al-Arouri has gotten a lot of power and authorities in Hamas since being made the no.2 man in the organization. He's in charge of the terror group's foreign policy, the ties with Hezbollah and Iran, and Hamas's coffers. All of these fields of responsibility give him a lot of influence.
Throughout the "March of Return" campaign and the violent rounds of fighting that broke out during this campaign, it was unclear where exactly Hamas's military wing stands on the spectrum between a popular struggle and an all-out war against Israel.
In hindsight, it appears the military wing supported the organization's overarching strategy, contributing by bringing military force to the protests in the form of sabotaging the border fence and attempts to infiltrate Israel.
Furthermore, Hamas's research & development teams abandoned for a time the attempts to improve the Qassam rockets and instead conducted tests on ways to make incendiary kites and balloons fly further away and carry a more effective incendiary device.
The military wing realized that another war in the strip will lead to a similar or worse situation than the present, and so Hamas decided that going to war with Israel would only happen if there is an internal public protest in Gaza that forces the organization to move the focus outwards, toward Israel.