Sonja Trauss, the love-her-or-hate-her rabble-rouser who helped make San Francisco’s housing shortage a trendy political cause, wants to move into a new home herself — an office at City Hall.

She’s entered the race to replace termed-out District Six Supervisor Jane Kim next year and represent an area that will probably shape housing and land use policy for the rest of the city. Trauss faces tough competition from progressive challenger Matt Haney, but a win would be a major coming-out for the Yes in My Backyard group she co-founded two years ago.

The question is whether Trauss is the right figurehead to get the YIMBYs a board seat. She’s smart and animated, armed with a master’s degree in economics and the simple message that more housing — a lot more, at all price points — will make cities affordable.

But she’s also the subject of a state ethics investigation and the enemy of older progressives, who believe the building boom is decimating San Francisco’s character and are using their considerable power in city politics to strike back at the YIMBYs.

On top of all that, Trauss, 35, is known for plainspoken statements that often offend people. In the past few weeks she’s struggled to downplay a 7-year-old, resurfaced blog post in which she said low-income public housing tenants “usually can’t read or write.” She’s also spent months trying to explain a tweet calling gentrification “the revaluation of black land to its correct price.”

The success or failure of her candidacy may rest on whether she’s perceived as a fearless truth-teller or as a loudmouth who doubles down on politically incorrect comments.

“As soon as she starts talking about something that’s not housing — say poor people, or equity — these comments are going to come up,” political strategist David Latterman said. “And I’m curious to see how her team is going to rationalize them.”

She shrugs. “I’ve always been a transparent person,” said Trauss, who lives with her husband, an electrician, in a tiny, one-bedroom apartment on Natoma Street.

Seven months pregnant, she’s trying to recast herself as a responsible person and forward-thinking policy-maker. And she’s managed to cultivate that image in the national press: In September, Politico Magazine profiled her as one of its Top 50 thinkers and visionaries guiding American politics.

She hopes District Six voters will see something refreshing in a person who makes mistakes, but also brings energy and new ideas to a city that’s full of careerist politicians.

“There’s going to be some stuff that’s impolitic,” she said. “And all of it is from the past.”

Granted, the past has a way of coming back during political campaigns. Trauss apologized for the old blog post when it recently appeared on Reddit and defended the “black land” tweet, saying she’d only intended to point out that home values are rising in black neighborhoods.

“I think people saw the words ‘gentrification,’ ‘black’ and ‘correct’ in the same sentence, and they just flipped out,” she said.

Her most memorable public comment came during a Board of Supervisors committee hearing last fall, when she compared opponents of a 157-unit apartment project at 1515 S. Van Ness Ave. to Trump voters who want to deport immigrants.

“It wasn’t just dismissive, it was very offensive,” said former Supervisor David Campos, a progressive who represented the Mission and has butted heads with Trauss on land use issues.

Trauss said the comment also got positive attention.

“It was very animating for both of our bases,” she said. “If you’re in one of those social worlds that thinks I’m a jerk, then yeah, it seemed like (the comment) totally didn’t work out for me. But on the other side ... I got so many emails of enthusiasm and support, it reminded a bunch of people I existed, and I raised some money (about $10,000) off of it. So it turned out great.”

Raised in Philadelphia, Trauss earned a bachelor’s degree in philosophy from Temple University and a master’s in economics from Washington University in St. Louis. She worked stints as a math teacher and baker, and was an unusually brash and unrelenting person long before she became an activist.

In 2004, she got into a protracted fight with a Philadelphia neighbor over noise and odors coming from his printing press. The neighbor filed a criminal complaint against her for stalking and harassment, saying she was calling at all hours of the day to complain. He eventually withdrew the complaint.

When she came to the Bay Area seven years later, Trauss became obsessed with the region’s housing crisis. She formed the San Francisco Bay Area Renters Federation — SFBARF — in 2014 and transformed it the next year into the more appetizingly named YIMBY, which consists of a political action committee, an advocacy organization and a nonprofit that sues communities for not building enough housing. In July, YIMBY got its first court win, forcing Berkeley to approve a three-unit building opposed by neighbors who said its residents would take their parking spaces.

Trauss easily drew followers in the tech world, many of whom are young, new to the city and frustrated by housing prices. She befriended Yelp CEO Jeremy Stoppelman, who donated $100,000 to her “sue the suburbs” effort, and state Sen. Scott Wiener, who endorsed her for supervisor.

“We need elected officials who understand that the way we’ve done housing for the last 50 years has gotten us into the mess we’re in today,” Wiener said. “Sonja gets that.”

As the 800-member YIMBY organization consolidated a political base, they also began a quiet war against San Francisco’s progressive leaders, using legal complaints as weapons.

In the past year, Trauss and another YIMBY activist, Vincent Woo, have filed city and state ethics complaints against three influential progressives — affordable housing activist John Elberling; Tim Redmond, who publishes the 48 Hills blog; and veteran political consultant Jim Stearns, who has run campaigns for many progressive politicians.

Trauss’ complaint to the state Fair Political Practices Commission accused Elberling of funneling secret campaign contributions through a shell entity. Woo sent a letter to the Internal Revenue Service saying Redmond uses his nonprofit news site to promote ballot measures and candidates. The FFPC case remains open, and the IRS would not comment.

Woo complained to the FPPC that Stearns violated a law barring candidates from communicating with independent expenditure committees. The FPPC declined to pursue a case against Stearns, who sees these legal complaints as part of a political strategy.

Trauss “is preemptively striking out at people and organizations she might feel are in the way of her being elected as supervisor,” Stearns said.

In December, one of Trauss’ enemies shot back, filing an anonymous complaint with the FPPC. It accused Trauss of misusing campaign money by paying herself $2,000 from the YIMBY June 2016 election fund while she was serving as treasurer. It also alleged that she spent more than $24,000 in June election money on the November election and that she failed to report 13 late contributions — totaling $83,500 — within the required 24-hour window.

The FPPC began an investigation on Dec. 28, and Trauss is still awaiting a decision. She said the alleged violations were unintentional.

“This is a grassroots organization, and I was trying to do the filings myself,” she said. “If I had been taking a test, I would have gotten a 97 percent.”

Still, the case raised concerns about whether Trauss can survive the crucible of a district race in San Francisco, let alone flip an area that’s gone to progressives in the past five elections. Trauss, who sides with the left on just about every social issue except housing, is considered a moderate because of her pro-development stances.

Longtime political strategist P.J. Johnston said she has a shot.

“It’s an open seat election, districts are small,” Johnston said, noting that Trauss would need only about 10,000 votes to win. “I definitely think she needs to be taken seriously as a candidate.”

But Latterman sees the past as a challenge.

“If she’s said something on paper or onscreen and it’s twistable, then someone will twist it,” he said. “So she and her team better be able to answer for everything.”

Rachel Swan is a San Francisco Chronicle staff writer. Email: rswan@sfchronicle.com Twitter: @rachelswan