There would be a rustle of oily black feathers as a raven settled on the window ledge of a once-grand apartment building in some Eastern European capital. The bird would pace across the ledge a few times but quickly depart. In an apartment on the other side of the window, no one would shift his attention from the briefing papers or the chilled vodka set out on a table. Nor would anything seem amiss in the jagged piece of gray slate resting on the ledge, seemingly jetsam from the roof of an old and unloved building. Those in the apartment might be dismayed to learn, however, that the slate had come not from the roof but from a technical laboratory at CIA headquarters in Langley, Virginia. In a small cavity at the slate’s center was an electronic transmitter powerful enough to pick up their conversation. The raven that transported it to the ledge was no random city bird, but a U.S.-trained intelligence asset.

Half a world away from the murk of the cold war, it would be a typical day at the I.Q. Zoo, one of the touristic palaces that dotted the streets of Hot Springs, Arkansas, in the 1960s. With their vacationing parents inca tow, children would squeal as they watched chickens play baseball, macaws ride bicycles, ducks drumming and pigs pawing at pianos. You would find much the same in any number of mom-and-pop theme parks or on television variety shows of the era. But chances are that if an animal had been trained to do something whimsically human, the animal—or the technique—came from Hot Springs.

Two scenes, seemingly disjointed: the John le Carré shadows against the bright midway lights of county-fair Americana. But wars make strange bedfellows, and in one of the most curious, if little-known, stories of the cold war, the people involved in making poultry dance or getting cows to play bingo were also involved in training animals, under government contract, for defense and intelligence work. The same methods that lay behind Priscilla the Fastidious Pig or the Educated Hen informed projects such as training ravens to deposit and retrieve objects, pigeons to warn of enemy ambushes, or even cats to eavesdrop on human conversations. At the center of this Venn diagram were two acolytes of the psychologist B.F. Skinner, plus Bob Bailey, the first director of training for the Navy’s pioneering dolphin program. The use of animals in military intelligence dates back to ancient Greece, but the work that this trio undertook in the 1960s promised an entirely new level of sophistication, as if James Bond’s Q had met Marlin Perkins.

***

“We never found an animal we could not train,” says Bailey, 76, who in his career has done everything from teaching dolphins to detect submarines to inventing the Bird Brain, an apparatus that enabled a person to play tick-tack-toe against a chicken. (One is in the collection of the Smithsonian National Museum of American History.) “Never,” he repeats, as we sit in the book-cluttered living room of his modest lakefront house in Hot Springs. “Never.”

As I try to summon particularly challenging creatures—Alligators? Moles? Crustaceans?—he asks, “Do you know who Susan Garrett is?” I do not. Garrett, it turns out, is a world champion trainer in the sport of dog agility. A few years ago, Bailey was teaching a course on stimulus control for her students. His stimulus was a laser pointer. One day, he was in the bathroom and saw a spider. “I looked down at this spider and said, hmmm.” He took out his laser, turned it on, and gently blew on the spider. “Spiders don’t like wind—it blows their web down,” he says. “They pull themselves down into the smallest size they can get and hunker down.”

Turn on laser. Blow. Turn on laser. Blow. Bailey did this at several intervals during the day. “By the time I finished all I had to do is turn that light on,” he says, and the spider would go defensive. He returned to the classroom where Garrett was lecturing and announced: “You’ve got a trained spider in your bathroom.”

This is Psych 101: Pavlovian, or “classical,” conditioning. The laser is a conditioned stimulus, the breath an unconditioned stimulus. Over time, the spider so associates one with the other that the mere appearance of the former is enough to trigger a “conditioned response.”

While Pavlov plays a part in our story—“I have a saying in the training business,” Bailey says, “Pavlov is always on your shoulder”—the real inspiration is B.F. Skinner, the Harvard University psychologist who was, in the middle of the 20th century, the most cited scholar of the human mind after Freud. Skinner popularized “operant conditioning,” a practice based less on primal reflex responses and more on getting animals (including humans) to do things voluntarily, based on cues in the environment. When “behavior is followed by a consequence,” Skinner wrote, “the nature of the consequence modifies the organism’s tendency to repeat the behavior in the future.” In his famous operant-conditioning chamber, or “box,” an animal learns to associate an action with a reward. He favored pigeons, which received food for pecking at certain buttons.

During World War II, Skinner received defense funding to research a pigeon-based homing device for missiles. (The birds would be housed in the nose cone; their pecking would activate steering engines.) It was never deployed, but the project captured the imagination of two of his graduate students, Keller Breland and his wife, Marian. They left Skinner’s lab in 1947 and went into business in Minnesota as Animal Behavior Enterprises, or ABE. Their main client was General Mills, for whom they trained chickens and other animals for shows advertising General Mills feed at county fairs.

Their business gradually expanded, to zoos and theme parks and appearances on “The Tonight Show” and “Wild Kingdom.” They trained a slew of animals for TV commercials, including Buck Bunny, the coin-depositing rabbit protagonist of a Coast Federal Savings Bank commercial that set a record for repeat airings over two decades. In 1955, in their new home of Hot Springs, Arkansas, the Brelands opened the I.Q. Zoo, where visitors would pay, in essence, to watch Skinnerian conditioning in action—even if in the form of basketball-playing raccoons.

The I.Q. Zoo was both a tourist attraction and a proving ground for systems of operant conditioning. The Brelands didn’t just become America’s pre-eminent commercial animal trainers, they also published their observations in scholarly journals like American Psychologist. Everyone from Walt Disney to Florida’s Marineland wanted their advice. It is thus little surprise that they were invited to the Naval Air Weapons Station at China Lake, California, to address a new Navy program on the training of marine mammals for defense work, headed by Bob Bailey. The fact that China Lake, on the western edge of the Mojave Desert, has neither water nor marine mammals is the sort of detail that does not seem out of place in a story like this.

***

Bailey’s tenure at China Lake was not his first stint in the desert. As an undergraduate at UCLA in the 1950s, he was hired by the School of Medicine to collect and photograph animals. In his long hours laying traps for kangaroo rats out near Palmdale, he noticed a patch of alfalfa.

“Alfalfa in the middle of nowhere attracts rabbits,” he says. “Any time you have rabbits out in the middle of the Mojave, you’re going to have coyotes.” He found a den nearby and began to notice that the coyotes, upon setting out, would head toward one of two fields. Curious to see if he could condition their behavior, he began placing dead rabbits along the paths he wanted the coyotes to choose. After some months he found that 85 percent of the time, he could get the coyotes to choose the path he designated. He then began tying white strips of cloth near the rabbits. Soon, those white strips alone were enough to direct the coyotes. “It was me,” Bailey says. “That was just me.”

As he earned his bachelor of science degree, he became a kind of part-time animal-behavior boffin. After a brief stint in the Army, with the 525 Military Intelligence Brigade, he found himself back at UCLA, employed as a researcher at the medical school. One day he noticed a flier advertising for a director of training of the Navy’s new dolphin program, which would develop methods of training marine mammals to perform tasks ranging from detecting and clearing mines to retrieving tools. He applied for the job and eventually got it. Any number of scholars were brought out to consult on the program—people like Gregory Bateson, the English anthropologist who was once married to Margaret Mead, and, of course, the Brelands. As Bailey conducted his research, including a quasi-covert training program involving search and detection tasks in the open ocean, he grew increasingly disenchanted with research directives coming from China Lake that focused more on psychology than on intelligence work. “I could see very quickly where these animals would be really useful,” he says, “and yet people who were involved, we would joke, wanted to ‘talk to the dolphins.’”

In 1965, Bailey agreed to join the Brelands and Animal Behavior Enterprises in Hot Springs. Suddenly he found himself in the entertainment business. “I was designing sets, building sets, had to learn how to write a show script,” he says. Training animals “was the easy part.” By now, ABE had more than 50 employees and a full-blown systematic approach to animal training. “We had file drawers full of training protocols,” Bailey says. “You want a macaw to ride a bicycle?” The trainer would go to the front office, ask a secretary for the bicycle-riding protocols. “They’d ask: Was it for cockatoos or macaws? It’s different.”

That June, Keller Breland died of a heart attack at the age of 50, and the day-to-day running of the business largely fell to Bailey. More than a decade later, he and Marian married. “Marian was a softhearted person,” he says. (She died in 2001.) “Business is pretty hard-nosed.”

While at ABE, Bailey designed the Bird Brain, which housed a chicken that would appear to engage the patron in a game of tick-tack-toe. (In reality, a circuit board chose the chicken’s squares; when the chicken retired to its “thinkin’ booth” during play, it was pressing a button in response to a light triggered by the human’s moves.) The game was immensely popular (if not without criticism, Bailey says, by the fledgling People for the Ethical Treatment of Animals), though it was rigged so the human—even B.F. Skinner himself—never won. “We built three pieces of equipment where the chicken could lose,” Bailey says. “It didn’t improve our income at all.”

But by then, ABE had a sideline: Not long after Bailey joined the firm, it had begun hearing from various government agencies: the CIA and the Army’s Aberdeen Proving Ground and Limited Warfare Laboratories. “They came to us to solve problems,” Bailey says. “It was the height of the cold war.”

***

A raven, in espionage parlance, is a male agent tasked with seducing intelligence targets. But avian ravens can be spies as well. When Bailey describes the Western raven, he sounds as if he’s talking about Jason Bourne. “It operates alone, and it does very well alone,” he says. Western ravens are adept at pattern recognition. “They could learn to respond to classes of objects,” he says. “If you’ve got a big desk and a little desk, you could train it to always go to the small one.” They can also carry quite a load. “These things could pick up weights, heavy packages, even file folders,” he says. “It was incredible to watch these ravens carry a load in their beaks that would have defeated an ordinary bird.” They also, he says, could be trained to open file drawers.

Robert Wallace, who headed the CIA’s Office of Technical Services in the 1990s, says the use of animals in intelligence has a long history. “Animals can go places people can’t. Animals are unalerting,” he told me. “The other side of the coin is that although animals can be trained, they have to be constantly trained. The upkeep, care and maintenance is significant.”

It is striking that even as the television program “Flipper” was making dolphins popular with American children, the creatures were becoming embroiled in the cold war arms race. As a partially declassified 1976 CIA document on naval dolphin training notes, the Soviets were “also assessing and replicating U.S. systems while possibly developing countermeasures to certain U.S. systems.” (The Navy still has its Marine Mammal Program, whose website notes that it “is an accredited member of the Alliance of Marine Mammal Parks and Aquariums, an international organization committed to the care and conservation of marine mammals.”)

Even bugs—the kind with legs—were considered by the military establishment. “The Use of Arthropods as Personnel Detectors,” a 1972 report by the Army’s Limited Warfare Laboratory in Aberdeen, Maryland, summarizes research on the possibility of exploiting the “sensory capabilities of insects”—bedbugs, mosquitoes and ticks among them—“for the detection of people.” Scientists ruled out lice (“in a preliminary test they simply crawled about at random”) but saw “feasible” promise in the mosquito Anopheles quadrimaculatus, which “is normally at rest and will fly at the approach of a host,” and so might be used “to detect the approach of people during darkness.”

One of the first projects Bailey says he worked on involved creatures that, in many people’s minds, are beyond training: cats. While cats have a shorter history of domestication than dogs, Bailey insists it is “absolutely not true” that they cannot be trained.

In what has come to be called the “acoustic kitty” project, the CIA’s Directorate of Science and Technology proposed using a cat as a listening device. In their book Spycraft, the CIA’s Wallace and co-author H. Keith Melton write that the agency was targeting an Asian head of state for surveillance, and that “during the target’s long strategy sessions with his aides, cats wandered in and out of the meeting area.” The theory, says Bailey, was that no one would pay attention to the animals’ comings and goings.

“We found that we could condition the cat to listen to voices,” says Bailey. “We have no idea how we did it. But...we found that the cat would more and more listen to people’s voices, and listen less to other things.” Working with Robin Michelson, a California otolaryngologist and one of the inventors of the human cochlear implant, the team turned the cat into a transmitter—with, says Bailey, a wire running from the cat’s inner ear to a battery and instrument cluster implanted in its rib cage. The cat’s movements could be directed—left, right, straight ahead—with ultrasonic sound.

The fate of this asset has become serio-comic lore, obscured by conflicting accounts and CIA classification. Jeffrey Richelson, in his book The Wizards of Langley, quotes ex-CIA official Victor Marchetti on the program’s demise during a field trial: “They put [the cat] out of the van, and a taxi comes and runs him over. There they were, sitting in the van with all those dials, and the cat was dead!”

But Wallace disputes that. “It was a serious project,” he says. “The acoustic kitty was not killed by getting run over by a taxicab.” His source? “The guy who was a principal in the project.” Wallace says Bailey’s name is not familiar to him, though he adds that by the time he joined the agency, “the animal work was really historic.”

Bailey says ABE’s records were destroyed in a 1989 fire, and the CIA declined my request under the Freedom of Information Act for documents relating to animal training for intelligence activities, noting that even “the fact of the existence or nonexistence of requested records is currently and properly classified.” A CIA press officer told me, “Unfortunately, we cannot help you with this.” Thus the agency’s only official word on the project appears in “Views on Trained Cats,” a heavily redacted document in the National Security Archive at George Washington University. While acknowledging that “cats can indeed be trained to move short distances,” it concludes that “the program would not lend itself in a practical sense to our highly specialized needs.”

During the 1960s and 1970s, as dancing chickens entertained crowds at the I.Q. Zoo, Bailey and a handful of his colleagues were undertaking intelligence scenarios nearby. “We had a 270-acre farm,” he says. “We built towns. Like a movie set, there’d be only fronts.” Without disclosing who they were working for, Bailey had his team rearrange the town according to photographs they were given. There were also field demonstrations—including one at the Watergate Hotel in Washington, D.C. “‘This is the room we want to get to,’” Bailey says he was told. “ ‘Can you get your raven up there to deposit a device, and can we listen?’ Yes, we can.” The bird would be conditioned, via a laser spotter, to pick out the room. At Fort Bragg, North Carolina, Bailey created a so-called “squab squad,” pigeons that would fly ahead of a column and signal the presence of enemy soldiers by landing. In tests, the pigeons, says Bailey, thwarted more than 45 attempts by Special Forces troops to ambush a convoy. But, as was so often the case, field operations revealed a problem: There was no way to retrieve the pigeons if they saw no enemy troops.

When I ask Bailey if any of the various animal projects were ever used in real-world scenarios, he turns uncharacteristically laconic. But then a thin smile cracks his face. “We got the ravens into places. We got the cats into places,” he says. “Usually using diplomatic pouches.” He says he carried a raven aboard a commercial flight, against regulations. “It was in a map case under the front seat,” he says, “and every now and then the raven would make a noise.” He makes a low guttural groaning. “I’d be in my seat and I’d go like this,” he says, squirming.

But the nexus between the shadows and the midway proved brittle: When the Senate Select Committee to Study Government Operations with Respect to Intelligence Activities (also known as the Church Committee, for chairman Frank Church of Idaho) was formed in 1975 to investigate abuses of power at several U.S. intelligence agencies, including the CIA, ABE decided to end its intelligence work. And in 1990, the I.Q. Zoo served up its last match of chicken tick-tack-toe.

Over lunch at McClard’s Bar-B-Q (a favorite of former President Bill Clinton, who grew up in Hot Springs), Bailey notes that animal intelligence work of the sort he did has been rendered largely superfluous by technology. “Today, all you have to do is illuminate someone with an infrared laser and pick up the scatter back from that, and you can listen to their conversation without any trouble at all,” he says. “You don’t need a cat.”

But that doesn’t mean Bailey is done. He’s been working with security agencies in Europe, he says, on training dogs, via acoustic signals, to perform any number of security tasks. “There’s nothing that can run up stairs like a dog,” he says. “It has a billion years of evolution behind it.”