It is the most common startup origin story there is. You have a job. You have an idea. So you build at night, on weekends, in the quiet hours your employer does not see. Six months later you have a working product, a cofounder, maybe early users.
Then a lawyer asks the question nobody asked in month one: who owns this code?
I litigated cofounder disputes for years, and this question has a special place in my files. It rarely explodes early. It explodes at the worst possible moment: during a fundraise, when an investor's counsel reads your history and finds a previous employer standing quietly in the chain of title.
Your employment contract was written for this exact situation
Most employment contracts contain an IP assignment clause. In plain language: work you create in the scope of your employment belongs to your employer. Some clauses stop there. Many go further, and claim inventions related to the employer's business, or made with the employer's resources, even outside working hours.
Whether those broad clauses hold up depends on where you are. Some US states limit how far an employer can reach into your personal time. California is famously protective: an invention built entirely on your own time, without company equipment or trade secrets, and outside the company's business, generally stays yours. Other states give employers more room. In France, the rule for software is blunt: code written by an employee in the exercise of their functions or following the employer's instructions belongs to the employer, automatically.
The pattern across systems is consistent, though. Three factors do most of the work: whose time, whose tools, and whose field. Build on the company laptop, and you have handed your employer an argument. Build something that competes with your employer's product, and you have handed them a better one.
Note the trap in that sentence. It is not "who is right". It is "who has an argument". A startup with a plausible claim hanging over its codebase is a startup that is harder to finance, harder to sell, and easy to pressure. I have seen a single letter from an ex-employer's counsel freeze a funding round for months. The startup did not lose the argument. It lost the time, and nearly the round.
You left the office. The contract did not.
What careful founders do
First, read your employment contract before your cofounder writes a line of code. The IP clause, the non-compete, any moonlighting policy. You are looking for what is claimed, not what feels fair.
Second, keep the separation physical. Your own machine, your own accounts, your own hours. Never the company laptop, never the company cloud, never between two meetings. The cleaner the separation, the weaker the future argument against you.
Third, mind the field. The closer your project sits to your employer's business, the more dangerous every other factor becomes. This is the factor founders most want to ignore, because good ideas often come from the job. It is also the factor litigators love most.
Fourth, write the history down while it is fresh. Who wrote what, starting when, on what equipment. In a dispute, the team with a clean written timeline starts three moves ahead.
And fifth, deal with it between cofounders now. Your founder agreement should state what each founder brings, confirm that each founder's contributions are committed to the future company, and require each founder to confirm they are not bound by conflicting obligations. That last line matters: your cofounder's old employment contract is your problem too. You are building on their code. Who owns the IP before incorporation covers the wider mechanics.
Before and after incorporation
Before incorporation, there is no company to own anything. The code belongs to whoever wrote it, subject to whatever their employment contract claims. That is precisely why the founder agreement matters at this stage: it is the written promise that everything built lands in the future company, signed while everyone is still friends.
At incorporation, the promise becomes a transfer. Each founder formally assigns their pre-incorporation work to the company. Investors will check for exactly this paper trail. If a founder was employed during the build, expect the question, and be glad you prepared the answer.
Your founder agreement should say what each founder brings and where it goes. Build it before incorporation, in plain language.