A senior U.S. official said discussions Thursday in Washington “went very well” between Lt. Gen. Ahmed Shuja Pasha, the ISI director-general, and Michael Morrell, the acting director of the CIA. “Overall, the meetings with senior Pakistani officials have led to improved intelligence cooperation for a couple of months now,” the U.S. official added.

A senior Pakistani official agreed with this account of patched-up relations. “Neither side wants a rupture,” he said.

The token of renewed cooperation: The Pakistanis have approved 87 visas for CIA officers working in the country, according to U.S. and Pakistani officials. That will bring the agency back toward normal operations in Pakistan, after what both sides say was a low point after the January arrest of CIA contractor Raymond Davis. He was seized in Lahore after killing two Pakistani surveillants; he was released after the CIA agreed to pay more than $2 million in “blood money” to compensate the families of the two victims.

Under new rules of the road, the CIA — in theory, at least — will share with the Pakistanis more information about what its operatives are doing in the country. Sources say, for example, that joint CIA-ISI counter-terrorism operations have resumed.

A tricky issue is the fate of Shakil Afridi, a Pakistani doctor who was arrested by the ISI in May for allegedly helping the CIA try to identify DNA of Osama bin Laden’s family by running a private vaccination campaign in Abbottabad before the May 2 raid on Bin Laden’s compound. U.S. officials are said to have pressed for Afridi’s release. The Pakistani countered that, because Afridi is a Pashtun who works in Khyber Agency in the tribal areas, certain tribal customs for compensation of victims must first be satisfied.

Another explosive issue is the ISI’s alleged role in the torture and death of Pakistani journalist Saleem Shahzad, whose body was found in May after he had reported critically about the Pakistani military’s failure in preventing al-Qaeda supporters from seizing a naval base in Karachi on May 22. A Pakistani judicial commission, headed by a supreme court judge, is looking into the journalist’s murder — which shocked Pakistanis and Americans alike.

The double-game pattern for the CIA and ISI seems clear enough by now: Work together as if you are allies, but at the same time pursue independent operations as if you are enemies; protest loudly in public when the other side does something you don’t like, but keep working together in private because you have no choice — and because that’s what intelligence agencies do.