Armed with a cup of hot tea, my wife sat down this morning, ready to finish the conversation that she tried to have last night, when she was flipping through headlines on her phone and I was falling asleep.

“Current events,” she said, reminding me of the topic. “Is it just me, or are things getting worse and worse?”

I know why she asked. Today, it’s a mass shooting. Yesterday, it was a natural disaster. Before that, a terrorist attack. Russian hacking, nuclear North Korea and the opioid epidemic. Lately the pace is wearing her down, even though she’s always followed the news.

“You pay attention all the time,” she said. “Is that why you’re so gloomy?”

I suppose, even though I know that in some ways, the world has never had it so good.

The percentage of people living in absolute poverty is lower now than in any time in human history. We’ve gone from 94 percent poor at the start of the Industrial Revolution to 9 percent in 2015, and according to the World Bank, the rate is dropping faster than ever.

People on every continent are living longer, thanks to advances in medicine and food production.

How many of us would want to trade places with an ancestor and live without electricity or immunotherapy?

But for some reason, the good stuff doesn’t seem as important as the bad stuff. Americans tell pollsters that we have never been so divided, which is saying a lot for a country that survived a civil war.

Taking on problems like racial injustice or climate change would require the kind of unity it took to beat Hitler, but we can’t even get everyone to agree that they are problems.

Maybe it’s not just the bad news that we’ve been getting, but the way that we get it. A majority of Americans get news from social media, with the biggest source being Facebook. About two-thirds of Americans use Facebook, and about half of them get their news there. That would make Facebook the world’s biggest newspaper with a circulation of about 115 million, if it were a newspaper, which, according to its lawyers, it’s not.

It is an advertising platform that promises customers a way to target their message to exactly the right people. It does that with an artificial intelligence algorithm programmed to learn as much about us as possible and use that information to know what ads to show us. It not only pays attention to what we do when we are using the Facebook site, but also follows us around the internet to see what we do elsewhere.

These machines know our attention spans are limited, so they decide what we should see and when we should see it to maximize value for their advertisers.

That’s how Facebook knows that I need a new pair of pants before I do, and knows what brand has appealed to others who watched “The Wire,” like to cook barbecue and stream a lot of Miles Davis.

It also might know if I were bipolar and on the verge of a manic episode. Then, instead of pants, Facebook might think it’s a good time to show me an ad for plane tickets to Las Vegas.

That last scenario was posited by Zeynep Tufekci, a computer scientist and sociologist. We don’t know exactly what kind of connections the algorithm makes because it’s proprietary, but Tufekci argues that the people who created it don’t really know, either. They built it to learn, and sent it off on its apolitical and amoral way.

That might be what makes me so gloomy. The most potent propaganda instrument in history is an advertising platform run by a robot.

Advertising works by telling you that you are not happy, or at least not as happy as you could be if you bought a new fly rod or lost 20 pounds.

People wouldn’t buy anything if they were satisfied. Facebook has 2 billion users. Google has 1.2 billion. They need us to be dissatisfied.

If the algorithms just sold us stuff that we didn’t really want, it would be tolerable. But to put the dissatisfaction machine in charge of our political discourse – letting it tailor millions of individual news feeds that isolate people and drive them apart – is a kind of dystopian nightmare that makes George Orwell look quaint.

You can’t vote out the algorithm. It doesn’t care who’s in the White House or what party controls Congress. It keeps sucking up your data because that makes it better able to influence your behavior, and if you are reading this on your phone, it’s doing it right now.

So, in answer to my wife: Yes. I feel that everything is getting worse and worse. But maybe that’s just the algorithm talking.

Greg Kesich is the editorial page editor. He can be contacted at:

[email protected]

Twitter: gregkesich