Note that the source code agreement would control the rights and duties of the parties-- no need to put T&C in the agreement itself: just list it.
Typically owners of closely-held companies are involved in the operation of the business (whereas shareholders in publicly-held companies are generally not). They're employees, directors, etc. So they're in constant contact with one another, and they make policy decisions with minimal formality (and not necessarily with strong regard for the respective shares of ownership of the deciding parties). So at shareholder meetings, there's often a lot of just ratification of things that are already done.
There's often pickyness about who can become a shareholder, or who can quit being one (especially since the shareholder may also perform a key function for the company).
You can avoid double taxation if you're a shareholder-employee (just take your money in salary). But a non-employee shareholder can only get returns through dividends, which is money left over in the corporation after taxes and salaries, etc., and which are, in turn, taxed as income. So there's a conflict of interest between employee and non-employee shareholders (one wants dividends, and one doesn't).
Anyway, there are lots of reasons to want to limit the number and identity of shareholders (e.g., S-Corp statutes, etc.). So the shareholders want to adopt transfer restrictions: stock can only be sold/bought under certain circumstances. This is diametrically opposed to the default rules (statutes): anyone is entitled to transfer stock to anyone else, regardless of pretty much anything, absent some overriding rule.
This means that your investment in a closely-held company is not liquid. Finding a buyer for a minority interest in a family business is not necessarily easy. And even if you do find one, the transfer restrictions might get in the way. So it's a double-bind: a shareholder wants to be able to cash out at some point, but wants to prevent others from cashing out and saddling them with outsiders as replacements.
So shareholders want to have some kind of buy-out provision, so they can get their money out of the corporation at some point. Lots have mandatory buy-outs upon death or retirement, for example. Buy-out agreements can also set the value of the shares (remember, there is no public market deciding the value of the company).
As a result of all this, the shareholder agreement is really important: it's not just the LLC filing and the bylaws. Most company founders just want barebones documents, and don't want to spend time sitting down and answering all kinds of "what if" questions about the future. Maybe you don't need a shareholder agreement the first day, but you really should get one in place within the first year or two.
A lot of things that can go in a shareholder agreement could go in an operating agreement, or the articles of incorporation, or bylaws. But if you put it in a shareholder agreement, it can't be modified without everyone's agreement, whereas there might be circumstances where others could be modified.
The goal is to restrict transfers and provide a liquidity mechanism. Be sure to be aware of what limitations state law might place on transfer agreements. Also make sure that certificates that are restricted bear notice of the fact that there are restrictions (so a purchaser will have notice).
"Restraints on alienation are frowned upon," as we have apparently been told. So you can't make totally non-transferrable stock: it's always subject to reasonability, at least.
Types of restriction:
The good thing is that nobody knows who the buyers and sellers will be, so there's no incentive to be adversarial. But that's more incentive to get things hammered out now, before conflicts of interest arise.
So you can get as fancy as you want with how you create the share price: capitalized earnings, appraisal (second most common after a book value formula, and very nice but expensive).
But there's also the right of first offer: a shareholder who wants out can name the price at which he/she is willing to sell to the other shareholders; if they decline, the shareholder is free to sell at that price or higher to a 3rd party for some finite period of time. That's nicer for potential purchasers: they can know that they have a bona fide opportunity to purchase.
Where should these restrictions be placed? If it's complex, you want all the shareholders and the company to sign it, so it'll be a stand-alone agreement. And again, there should be a legend on any stock certificates. And a requirement that any new shareholders become parties to the agreement, and their shares will be legended and subject to the same agreement.
The agreement should create default results (i.e., a shareholder who does not reply to an offer to buy shall be deemed to have refused). And place time limits on things like option periods, with clear beginnings and endings. So procedural language gets complex and detailed: it's helpful to create defined terms.
Avoid traps where option holders can just purchase some shares (i.e., enough so they have control) and leave the seller with some small, and irredemable, amount. Make sure there are no left-overs. Can buyers purchase in proportion to their current share holdings (most common, because it preserves current structure).
Time limits tend to go from 10 to 90 days.
And maybe it's better to have the corporation purchase the stock: it might have the money. But, of course, you need to make sure that the corporation is legally allowed to purchase its own stock (i.e., can it only do this out of surplus, or is it prohibited by some credit agreement?). Often, the corporation has the first right, then it goes to the shareholders.
Often a company will carry life insurance on the shareholders to fund the buyback of their shares.