Docter recruited a story crew to help develop the film's plot line. Although animation as an industry had been dominated by men, half of the story crew were women, in attempt to have more diverse input. The choice to focus the film on a girl came from research that claimed that females age 11 to 17 are more attuned to expressions and emotions than others. The idea to have Riley play hockey came from Del Carmen, who noted that the sport is big in Minnesota. They tried to stray away from stereotypically "girly" interests, such as the color pink or dresses. Initial ideas for the film found the main character, Riley, falling into a deep depression. Docter later scrapped these ideas, as he felt they were inappropriate.
The film was first storyboarded over a period of two to three years, all the while undergoing screenings for Pixar's "Brain Trust," a small group of creative leaders at Pixar who oversee development on all movies. After multiple screenings and suggestions from other filmmakers, the picture was put into production. It was again evaluated three months into that process. Kevin Nolting, editor of the film, estimated there were seven versions of Inside Out created before it even went into production. The story team attempted to create as much contrast with characters as possible. They found Joy the most complex character to write for, as she illustrates a broad range of "happy feelings." The earliest idea present in the final film is that Joy holds onto youth too long, setting about a "social storm" for Riley. It was not until several screenings later that they came upon the concept of moving to a new place, which created an external conflict that made the story easier to write. Initially, this crisis was to be set at a Thanksgiving Day pageant, in which Riley was hoping to be cast as its lead role, the turkey. Docter later deemed this idea too "bizarre" and it was replaced.
Docter estimated it took four years of development for the film to achieve success in marrying the architecture of Riley's mind and her personal troubles. The concept of "personality islands" helped develop the film's emotional stakes, as they directly affect events inside her mind and in her life. In one draft, the characters fell into "Idea Fields," where they would "cultivate new ideas," much like a farmer would cultivate crop. The character of Bing Bonga discarded old imaginary friendcame about in one draft of the film as part of a refugee camp inside Riley's mind. It was difficult to achieve the correct tone for the film; for example, viewers could not be distracted by Joy's nature or feel negative about the mess she helps steer Riley into. Rivera credited the casting of Amy Poehler, in addition to the idea of moving, with helping the film find the right tone.
An early version of the film focused on Joy and Fear getting lost together, as it seemed to be the most humorous choice. By July 2012, the project was set for an evaluation screening with other Pixar filmmakers. Docter gradually began to feel that the story was not working, which led to fears that he may be fired. He took a long walk at his home one Sunday, in which he began to consider himself a failure, his previous successes "flukes," and a general sense that he should resign from the film. While pondering what he would miss about Pixar, he concluded that he would miss his coworkers and friends most of all. He soon reached a breakthrough: that emotions are meant to connect people together, and that relationships are the most important things in life. He decided to replace Fear with Sadness, which he felt is crucial to renewal. He met with Rivera and Del Carmen that night to explain his change of plans, and to his surprise, they reacted positively to it. At the screening, he informed his superiors that new plans for the film were in order. Although a "scary moment," the film remained in production.
Screenwriter Michael Arndt worked for a year on the film's script, calling it "both a brilliantly creative idea but also incredibly challenging," but left the project in early 2011, adding that "knowing the Pixar process, there may not be a single word [I wrote] that remains in the final script! Theyve had writers work on it since then."