The dramatic arc of the series revolves around the character’s relationship with her former lover, who is in the same prison on drug charges. In real life, Ms. Kerman saw her nemesis only when they both appeared in court and has never heard from her regarding the memoir or TV show.

“I’ve been getting a lot of questions about that on Twitter,” Ms. Kerman said. “The thing about being incarcerated is that many of your struggles are internal. You’re thinking about what landed you in this wretched place, which is hard to dramatize. So external conflict, which any sensible person in prison is trying to avoid, is really important for television.”

Sitting in the Brooklyn apartment she shares with her husband, Larry Smith, an editor, and their toddler son, Ms. Kerman took from a shelf her notebook of prison memorabilia. It included nametags of prisoners who had worn her uniforms before her, like a kind of pentimento, and a menu of items sold at the commissary (shower shoes, hot sauce, stamps, eye shadows in hummingbird colors) — tiny creature comforts that made her feel human.

Most treasured are photographs of the women with whom she served, women who, despite the counsel of her lawyer to remain aloof, became friends. As she reviewed them, she mentioned sad details: one who was bipolar, another who got pregnant shortly after being released. “The backgrounds of women in prison include physical abuse, addiction and mental health issues, to a much larger extent than male prisoners,” she said. “Larry was phenomenal, but there were plenty of women in Danbury whose husbands were locked up in other prisons. One of the heartbreaking things I saw was the envelopes in the mailbox with kiss marks on them, addressed to another federal penitentiary.”

Much of “Orange” presents what she calls the astonishingly low standard of living for prisoners: rats in the dorms, mold in the showers, inedible food. (She developed a recipe for prison cheesecake, using confiscated margarine, vanilla pudding and powdered coffee creamer.) But she’s well aware that many people do not care about the quality of life for prisoners.

“As one warden said, we’re throwing people in jail that we’re mad at instead of people we’re scared of,” said Ms. Kerman, who serves on the board of the Women’s Prison Association, an advocacy group founded in 1845. “Most women are not there for violent offenses. Like almost all the women in that place, I endured things like groping from the guards, but no prisoner ever laid a hand on me, and I didn’t witness any physical violence.”