Messages reveal how Musk and Twitter boss fell out
Messages between Elon Musk and Twitter boss Parag Agrawal have been published in a court filing. 
reveal how the pair's relationship, after a good start, went dramatically south. 
In late March, it became clear that Elon Musk was interested in purchasing shares in Twitter - and potentially sitting on Twitter's board. 
On 27 March, Parag Agrawal reaches out: "Hey Elon - great to be connected directly. Would love to chat," he says.
Elon Musk likes the message. "Perhaps tonight around 8?" he says. So far so good.
By 31 March, a hastily planned dinner is arranged near San Jose as the deal really starts heating up. 
f developments is clearly exhilarating for Mr Agrawal. The world's richest person is about to become a Twitter board member. Mr Agrawal tells Mr Musk he's "excited" to see him in person. 
Bret Taylor, Twitter's board chair, texts Musk about the dinner. "I think they were looking for an Airbnb near the airport and there are tractors and donkeys," he says in a text. The location, he continues, "wins for the weirdest place I've had a meeting recently".
r goes well despite the farmyard location. "Memorable for multiple reasons. Really enjoyed it", Mr Agrawal says.
A few days later it's announced that Elon Musk is to join the board. 
"Super excited" Mr Agrawal messages.
As the announcement goes public, all sorts of names begin to text Mr Musk. 
Podcaster Joe Rogan asks Mr Musk whether he is going to "liberate Twitter from the censorship happy mob".
"I will provide advice, which they may or may not choose to follow," Mr Musk replies.
On 5 April, Jack Dorsey, former chief executive of Twitter, tells Mr Musk that Mr Agrawal is an "incredible engineer", but that Twitter's board is "terrible". 
By 7 April, Mr Agrawal and Mr Musk are burnishing their coding credentials - the start of a seemingly beautiful working relationship. 
"I wrote heavy duty software for 20 years," Mr Musk says. "I interface way better with engineers who are able to do the hardcore programming than with program manager/MBA types". 
Agrawal replies: "In our next convo - treat me like an engineer instead of a CEO and let's see where we get to."
"You got it", Mr Musk replies.
But then disaster. 
On 9 April, Mr Musk tweets asking why so few of Twitter's most followed accounts tweeted very much. "Is Twitter dying?" he asks. 
weet angers Mr Agrawal. Later that day he messages: 
"You are free to tweet 'is Twitter dying?' or anything else about Twitter - but it's my responsibility to tell you that it's not helping me make Twitter better in the current context. 
"Next time we speak, I'd like to you provide you [sic] perspective on the level of the internal distraction right now and how it [sic] hurting our ability to do work."
Elon Musk, notoriously, does not like being told what to do - especially whether and what he can tweet. 
We can't be certain what is going on behind the scenes, but this message seems to have infuriated Elon Musk. A few hours later he shoots off a volley of irascible messages. 
"What did you get done this week?... I'm not joining the board… This is a waste of time. Will make an offer to take Twitter private."
Mr Agrawal appears bewildered by the texts.
He rings Bret Taylor, who desperately tries to understand what is going on. 
"Parag just called me and mentioned your text conversations. Can you talk?" he says.
"Fixing Twitter by chatting with Parag won't work," Mr Musk says. "Drastic action is needed."
"Can you take 10 minutes to talk through with me?" Mr Taylor asks. 
"It has been about 24 hours since you joined the board. I get your point, but just want to understand about the sudden pivot," he continues.
Elon Musk follows through. He offers $44bn to take Twitter private. On 25 April, the board accepts the offer. 
xt day, Jack Dorsey makes another attempt to patch up the relationship between the two. He organises a call. It doesn't go well.
"You and I are in complete agreement," Mr Musk messages Mr Dorsey after the conversation. "Parag is just moving far too slowly and trying to please people who will not be happy no matter what he does."
Mr Dorsey replies: "At least it became clear that you can't work together."
From there the relationship between Mr Musk and Twitter gets worse and worse. 
Mr Musk eventually attempts to pull out of the deal entirely in July.  But Twitter still approves the purchase in September.
A court case in Delaware in mid-October will decide whether he will be allowed to walk away - or forced to buy the company. 
But the messages show that the relationship between Twitter's CEO and Mr Musk had broken down far earlier. 
uggest that if Mr Musk is made to buy Twitter - Parag Agrawal will need to look for another job.
James Clayton is the BBC's North America technology reporter based in San Francisco. Follow him on Twitter @jamesclayton5.