Long before the NSA was snuffling up our e-mails, philosopher Jeremy Bentham traveled to Belarus to visit his brother. Samuel Bentham worked for Prince Potemkin, and he gave his crusading brother an idea. One could construct a building in an arc around a central unit. Workers, employees, and — Jeremy later theorized — prisoners would never be unwatched.

Bentham's prisons were never made, but his idea has become a powerful touchstone today. Is there anywhere we aren't watched, and how has all this observation changed us?

In her fabulously sharp-elbowed debut novel, "The Panopticon" (Hogarth, 282 pages, $22), Scottish poet Jenni Fagan breathes life into a heroine who would have an opinion or two about these questions.

Anais Hendricks is a 15-year-old with a rap sheet longer than most Elmore Leonard villains. Bounced from one foster home to the next, cared for by prostitutes and drug pushers, she is hauled in to the Panopticon Home for chronic offenders, covered in blood and determined not to take any guff.

"It's not that I think I'm perfect," she says, after a bit of arrival peacocking, "I'm so imperfect it's offensive."

On its surface, "The Panopticon" is marginally a familiar story about a young orphan trying to make her way in the world. Find out a bit about where she actually came from. Maybe even help other kids like her survive.

And in a satisfying way, the novel delivers all this, from the ragtag bunch of screw-ups and victims who share the home with her. There's Isla, a cutter, John, a cross-dressing thief, and Shortie, who likes to scrap. Angus, one of the smarter, gentler workers in the home, keeps an eye out for her.

Fagan is too smart a writer, however, to simply recast this story in the modern era. Just when it approaches sentimentality, Anais' broken, but not beaten, cynical voice yanks the narrative back.

"The Panopticon" reclaims the one thing a surveillance state cannot claim from its denizens: their inner life. And so we follow Anais' state of mind as she weeps, thinks on her horrible past, gets high, theorizes about an evil conspiracy.

She is, in spite of her toughness, racked with self-doubt. And who can blame her? Under state law she can read her own files; judges mock her; even the caring ones look at her as if she is an experiment. The only defense, one former caretaker tells her, is to think. And still, that weapon can be turned against her.

"It's your own mind that kills you," the woman tells Anais, giving her cash, some drugs and a pep talk of strange proportions. "The most dangerous weapon in the world is a brain. You need to learn to master yours, Anais."

The true panopticon of this book is, in fact, Anais' own mind. It has been poked, prodded and filled with lies and half-truths and images she'd rather forget. And with her tale she is going to use language to smash her way out.

Not since Jonathan Safran Foer's "Extremely Loud" have we met such motor-mouthed metaphysics.

Layered with repetitions, peppered with hallucinations, "The Panopticon" reads like the monologue of a poet for whom words are bricks, they are arrows, they are, when well chosen, the way out.

John Freeman is the author of "How to Read a Novelist," forthcoming from Farrar, Straus & Giroux.