Ten Thousand Things’ drama “The Sins of Sor Juana” is about breaking the spirit of a brilliant, passionate young woman.

Thallis Santesteban plays 17th-century Mexican writer Sor Juana Inés de la Cruz. In the opening scenes, the nun and innovative poet is struggling with restrictive life in a Catholic convent, which is both a sisterhood and a patriarchy. (The play invests in the idea that people and institutions can be two different things at once, including villains who have good qualities and friends who don’t.)

“I think God wants me to learn,” Juana insists. But after she defies the bishop’s order to stop writing secular verse, she is thrown into an isolation cell. Starving, she contemplates the injustices that led her to the convent, with the play continually connecting those calamitous events to her present circumstances.

Santesteban, who’s specific and direct, leads a cast that performs with clarity, humor and conviction.

Even by the standards of the always intimate Ten Thousand Things, the cast members are unusually attuned to the audience — whether it’s Juana, finding no allies in the convent and appealing to us for understanding. Or Ryan Colbert, a man who romanced Juana before she became a nun, implicating viewers in his seduction. Or Sun Mee Chomet plopping herself down with the theatergoers. The barriers between audience and artists are so small they’re almost nonexistent.

That deep connection helps us appreciate the nuances in Karen Zacarías’ insightful play, in which even the bad guys behave for reasons that make sense to them.

Although the play has a powerful message about what it’s like to be female in a time and place undervaluing women, Zacarías also notes that men can be allies and women can underestimate and even betray one another. That’s part of the frustration for Juana: Her friends and fellow nuns seem content to try to work within the system to improve their lives. But she’s determined to pull the whole thing down because, as she asks God, “Why instill curiosity in women and then punish them for having it?”

Under Marcela Lorca’s confident direction, “Sor Juana” shifts nimbly between drama and comedy, between English and Spanish, between reality and magic and even between time frames — sometimes actors in mid-costume change suggest ways in which two time frames inform each other. It’s a sad story, to be sure, but this fluid production insists that its title character did find a kind of freedom, even if only in her dreams.

You can probably guess that a 17th-century woman whose words were considered dangerous was not headed for a happy ending. But the pleasure of this bracing and entertaining play is this: Ten Thousand Things is still telling her story and people are still reading her poems. So, despite the powerful people and institutions that worked against her, Juana won.