Lily brings a goat home from school. Ted celebrates his 30th birthday. Barney and Robin deal with the repercussions from their night together. Barney hires Marshall to help him find a loophole in The Bro Code.
The episode begins with the aftermath of the events of Sandcastles in the Sand. Barney and Robin are in bed together. Robin proposes that they pretend their tryst never happened, and Barney agrees. However, Barney feels quite awkward and uncomfortable around Ted at MacLaren's later in the day. Hoping to find an excuse for his and Robin's actions, Barney seeks out Marshall to help him find a loophole in the Bro Code, a document very important to Barney's life as a bro (including articles placing bros before hoes, banning bros from hooking up with each other's mothers, and banning eye-contact between bros during a Devil's Three-way). Allegedly written by Barnabas Stinson in the 18th century when Benjamin Franklin and George Washington were too busy to write it themselves, the Bro Code proves to be a very tight document that Ted has followed flawlessly and Barney fails in finding a loophole. Though she seems fine with it at first, Robin finds the secret even harder to keep than Barney and eventually admits to Ted that she and Barney slept together. That night, when Barney picks up Ted in a limo to take him to Ted's 30th birthday party, an outraged Ted yells at Barney, telling him how wrong it was to sleep with his best friend's ex-girlfriend. Ted ends his rant by telling Barney that he not only does not want to be bros anymore, but also does not want to be his friend anymore.
Meanwhile, Lily rescues a goat named Missy when a farmer (played by Alan Fudge) brings it to her kindergarten class and horrifies her students by going into great detail about what will happen to Missy when she visits the butcher. Lily plans to give the goat away to animal control, but becomes attached to the goat while waiting for Ted to arrive at his birthday party. Future Ted reveals at the end of the episode, after hinting at the destruction the goat would do, that he had the story wrong: Everything involving the goat actually takes place during his 31st birthday, at which point — Future Ted also reveals — Robin is living in the apartment.
Barney references the Bro Code for the first time in Zip, Zip, Zip, when he promises Robin not tell Ted that she likes him.
In Zip, Zip, Zip, before he and Robin get together in Come On, Ted gives Barney his blessing (albeit seemingly sarcastically) to pursue Robin, while here, Ted gets upset with Barney for hooking up with her.
The story of the goat is alluded to in Milk, where Future Ted mentions that his 30th birthday was fun "apart from the thing with the goat".
Barney mentions mentally "storing" the image of Robin's breasts in "the BPEG folder"; he discusses the concept of "boob images, or BPEGs" with Marshall in Where Were We?.
In Rebound Bro, Randy hands Barney a Sky Mall catalogue, referencing the numerous gadgets he bought from Sky Mall here. Also, in False Positive, the picture he shows Ted and Robin of the diamond-studded suit he plans on buying is in the Platinum Sky Mall catalogue.
Ted eventually forgives Barney for sleeping with Robin in Miracles.
One of the Bro Code articles Ted has abided by include alerting Barney to a girl-fight. Barney displays his interest in girl-fights again in Intervention, Happily Ever After, and Jenkins.
Future Ted mentions that Robin would be living with Ted by his 31st birthday. Robin later moves in with Ted in Not a Father's Day.
Ted angrily asks Barney if he wants to nail his mother too, and in Little Minnesota, Barney reveals that he kissed Ted's mom. When he elaborates (and embellishes) upon the story in Home Wreckers, he reveals that it happened soon after the events in Brunch, meaning he has already broken the Bro Code with Ted.
Barney gives a "fake history lesson " about the Founding Fathers comissioning his ancestor, Barnabus Stinson, to write The Bro Code. He does so again several times:
In The Three Days Rule, he explains how Jesus came up with the rule of waiting three days before calling a woman by waiting three days between dying on Good Friday and being resurrected on Easter Sunday, when he additionally invented the high-five.
In Hooked, he explains the evolution of "The Hot Girl Profession".
In Big Days, Ted cuts him off as he is about to explain the invention of "the dib" in the 1800s by Sir Walter Dib, aboard the SS Dib.
In Desperation Day, he claims that Februrary 13th is an actual holiday, Desperation Day, named for St. Desperatious, who preyed on insecure bridesmaids at weddings officiated by St. Valentine.
In The Broath, he describes the Bro Oath, or "Broath", dating back to Ancient Rome, where Julius Caesar thwarted an assassination attempt (by ninjas) on him, killed his best friend "Brotus" for breaking his Broath by not warning him, and then invented a salad.
While here, Barney is seen reciting Article 89, which states that the mom of a bro is always off-limits (with the clarification that a stepmom is fair game under certain circumstances), when Ted reads from the Bro Code in The Broken Code, it is Article 104 that states this, without the clarification.
Marshall finds a contract in Barney's office detailing the poisoning of the water supply in Lisbon, Portugal, hinting at Barney's job being to sign off on the company's illegal contracts, thereby making himself a scapegoat, as revealed in Unpause.
In the limo, when Ted derides Barney for sleeping with Robin, Ranjit yells at Barney in Persian. Ranjit was previously said to be from Bangladesh, but actor Marshall Manesh is from Iran, where Persian is spoken.
Lily asks if Barney is "all smooth down there", but in Columns she saw Barney naked when painting his portrait and so would already know the answer to that question.
Almost certainly Lily's blocked any images of naked Barney from her memory.
While on the roof with the goat anticipating Ted's arrival at his party, Lily tells Barney that "Stella just arrived." However, Ted (as the narrator) later realizes that the events involving the goat took place a year later, in the episode The Leap, by which point he and Stella had broken up. In fact, Stella moved to California as described in the epilogue of As Fast As She Can, the episode immediately preceding The Leap. But it could be that only the goat related incidents were from his 31st birthday and not anything else mentioned. Because when Lily is talking to Robin about having sex with Barney, the goat is there, but the whole Robin/Barney sex thing happened around Ted's 30th birthday.
It is revealed that in The Bro Code, 'A mother of a Bro is off-limits', but Barney has admitted to kissing, and perhaps sleeping with Ted's mother, yet Barney does not acknowledge he has broken The Bro Code in this aspect.
In the limo, Barney says "But not me, brah". Retrospectively, it was clearly stated by Barney that they would never say "Brah" anymore in the 4th episode of the 3rd season, Little Boys. He says to Marshall "One, we agreed we would never say "Brah" anymore. It was a good week, we had a lot of fun but it's over".
It's revealed that Ted's birthday is April 25th, 1978.
The Bro Code is an actual book released as a tie-in for the show. Several of the quoted articles in the show are the same as in the book, although under different article numbers.
Curiously enough, according to Bro Code, Article 38, a bro should never punch another bro in the groin, "even in a fight to the death". Early in the episode, Marshall claims that Ted never broke the code. But Ted breaks the Bro Code by the end of the episode, when he punches Barney in the groin in the limo. Although Ted did punch Barney in the groin it can be assumed that Ted was able to do it because they were no longer bros and friends anymore. The fact that Barney gave Ted verbal permission to hit him "anywhere but the face" may also factor into Ted's possible exemption from the code.
In Barney's flashback to the writing of the Bro Code, the girl on past Barney's left is wearing a dress from the episode "Halloween" from the show Buffy the Vampire Slayer, which Alyson Hannigan also starred in.
This episode shares many similarities with Tick Tick Tick. Both episodes begin with Barney and Robin lying in bed together following on from a kiss at the end of the previous episode (Sandcastles in the Sand and Disaster Averted ). In both episodes they try to pretend it never happened but Barney is so nervous he almost slips up. Similarly in both episodes it is Barney who gets the rawer end of the deal. In this episode, Ted forgives Robin but refuses to forgive Barney, ending their friendship. In Tick Tick Tick, after agreeing to break up with their perspective partners so that they can be together, Barney breaks up with Nora but Robin stays with Kevin , leaving Barney heartbroken. Also the proceeding episodes' titles are similar: This episode is proceeded by Rebound Bro and Tick Tick Tick is proceeded by The Rebound Girl .