Build with Business-as-Code
This is a running business.
Not a plan. Not a pitch deck. Not a slide. A program — vision, products, agent team, financial rails — written once, run forever, forked at will.
Vibe coding for businesses, not apps. You describe what the company does; the cascade compiles it to code. The agents staff it. Stripe takes payment from the first commit.
Why it works
AI went superhuman at math and code because both have four properties. Business has historically had none of them.
- 01Formal representation
- 02Execution
- 03Reward signal
- 04Fast iteration
Business-as-Code gives business all four.
Commitment 01
A business is a program.
Every recurring activity is a function — name, inputs, body, outputs. The company is the composition. Name it. Type it. Write it down. If you cannot, you do not yet understand it — and the business runs on luck.
import { Business } from 'business-as-code'
export const acme = Business({
name: 'Acme Books',
mission: 'Close the books for every small firm — automatically.',
icp: 'US accounting firms, 2–200 staff',
products: [
{ name: 'Monthly Close', model: 'outcome', price: 499, cogs: 40 },
],
})
// This file is the company.Commitment 02
The map is the territory.
The code does not describe the business. The code is the business. No second artifact. No gap to drift across. Durability is declared per step — not bolted on by a queue:
const onboard = Workflow($ => {
$.on.Customer.created(async (customer) => {
const account = await $.do('provision', customer) // must succeed
$.send('Email.welcome', { to: customer.email }) // fire and forget
const enriched = await $.try('enrich', customer) // nice to have
const activated = await $.do('activate', account) // must succeed
return { account, enriched, activated }
})
})
// Durability is declared per step — not bolted on by a queue.Three verbs do the work. $.do for steps that must succeed. $.try for steps that are nice to have. $.send for fire-and-forget. The runtime handles retries, idempotency, and history.
Commitment 03
Types are organizational discipline.
Customer, pricing, offer, goals — typed. Linked-data triad ($id, $type, $context) so every entity is uniquely addressable, semantically typed, and meaning-anchored against schema.org.ai.
type Customer = {
$id: string
$type: 'Customer'
$context: 'https://schema.org.ai'
name: string
segment: 'SMB' | 'Mid' | 'Enterprise'
arr: number
}
// Ambiguity is a type error. If you can't name it, you don't yet understand it.Org charts are made of types. Get the types right and the agents know who they are.
Commitment 04
Four kinds of work.One cascade.
Every step the business takes is one of four shapes — code, generative, agentic, or human. Each tier is cheaper, faster, and dumber than the next; each is more autonomous than the last. The point is to push work down the gradient — code does what code can; AI drafts what AI can; agents reconcile the exceptions; humans sign where the stakes demand.
const computePrice: CodeFunction = {
$type: 'CodeFunction',
fn: (plan, seats) => plan.basePrice + plan.perSeat * seats,
}
const draftAd: GenerativeFunction = {
$type: 'GenerativeFunction',
schema: { headline: 'punchy 6–8 word hook', body: '...', cta: 'action verb' },
prompt: ({ product, audience }) => `Write a StoryBrand ad for ${product.name} targeting ${audience}.`,
reward: (ad) => ad.clicks / ad.impressions,
}
const qualifyLead: AgenticFunction = {
$type: 'AgenticFunction',
goal: 'Decide whether this lead meets our ICP and is ready to buy.',
context: { icp: $.customer.icp, rubric: $.scoring.rubric },
tools: [enrichCompany, searchLinkedIn, readCrmHistory],
returns: { qualified: 'boolean', score: 'number', reasoning: 'string' },
reward: (lead) => lead.closedWon ? 1 : 0,
}
const approveRefund: HumanFunction = {
$type: 'HumanFunction',
assignee: ({ amount }) => amount > 1000 ? 'cfo' : 'support-lead',
channel: 'slack',
question: ({ customer, amount, reason }) =>
`${customer.name} asked for a $${amount} refund. Reason: "${reason}". Approve, deny, or counter?`,
options: ['approve', 'deny', 'counter'],
sla: '2 hours',
escalateTo: 'cfo',
}And when one tier can’t answer cleanly, the system doesn’t crash — it cascades:
const processRefund = new CascadeExecutor({
name: 'processRefund',
steps: [
{ $type: 'CodeFunction', fn: checkStandardPolicy, onMiss: 'cascade' },
{ $type: 'GenerativeFunction', fn: extractRefundReason, onMiss: 'cascade' },
{ $type: 'AgenticFunction', fn: assessRefundRisk,
onMatch: d => d.confidence > 0.85 ? d.action : 'cascade' },
{ $type: 'HumanFunction', fn: approveRefundEscalation },
],
})
// The system never crashes — it cascades.Cost gradient: code costs a thousandth of a cent. AI costs a cent. Agents cost a dollar. Humans cost hundreds. Every escalation is the system saying: this one’s worth the dollar.
Commitment 05
Defaults are inherited.
You don’t write invoicing from scratch. You don’t write payroll, dunning, compliance, or NDA review from scratch. Template business types ship with the 80% — APQC process libraries, standard SaaS rails, default agent assignments. You only write what makes your business different.
import { SaaS } from 'business-as-code/templates'
export const acme = Business({
...SaaS, // inherit invoicing, payroll, compliance, dunning
name: 'Acme Books',
pricing: { model: 'outcome', amount: 499, unit: 'close' },
})
// Defaults are inherited. You only write what's different.The spread operator is the inheritance. Override what differs. Adopt what doesn’t.
Commitment 06
Goals are tests.Tests are rewards.
OKRs are typed assertions. Each key result is a target the runtime checks continuously against the live business — every Stripe transaction, every customer interaction, every agent commit. Goals you can fail. Assertions, not aspirations.
import { okrs } from 'business-as-code'
export const goals = okrs([{
objective: 'Profitable growth',
period: '2026',
deadline: '2026-12-31',
keyResults: [
{ description: 'Reach $10M ARR', metric: 'arr', targetValue: 10_000_000 },
{ description: 'Hold gross margin above 70%', metric: 'grossMargin', targetValue: 0.70 },
{ description: 'Keep net retention above 110%', metric: 'nrr', targetValue: 1.10 },
],
}])
// Goals you can fail. Assertions, not aspirations.The reward signal isn’t a quarterly review. It’s continuous, mechanical, and tied to actual dollars moving through actual Stripe rails.
Commitment 07
Every action is an experiment.
The agents don’t just execute — they optimize. Ad creative, landing-page copy, pricing tiers, onboarding flows: each variant ships, the market grades it in real numbers, winners compound, losers get cut.
const pricingExperiment = Experiment({
name: 'monthly-close-price',
variants: [
{ price: 399, weight: 0.33 },
{ price: 499, weight: 0.33 },
{ price: 599, weight: 0.34 },
],
execute: (variant) => offer({ price: variant.price }),
metric: (result) => result.closedWon ? result.contractValue : 0,
})
// Every action is an experiment. The market is the reward function.The market is the reward function. Because the business runs on real Stripe rails, the reward is ground truth — not a proxy.
Commitment 08
Autonomy is earned.
New agents start in manual — every output reviewed. Earn a track record and the mode promotes to supervised: spot checks. Earn more and it promotes to autonomous: ship without a gate. Lose a track record and it demotes the same day.
const drafter = Agent({
name: 'Drafter',
role: 'Outbound Copywriter',
mode: 'supervised', // 'manual' | 'supervised' | 'autonomous'
goals: [{ id: 'open-rate', description: 'Email open rate > 40%', target: 0.40 }],
})
type TrackRecord = {
accuracy: number
samples: number
trend: 'improving' | 'stable' | 'declining'
}
// Autonomy is earned. Slow to promote, fast to demote.
// Trust is not faith. Trust is data.Trust is not faith. Trust is data. Slow to promote. Fast to demote. The same machinery rates a sales agent at 0.94, an onboarding agent at 0.62, and a compliance agent at 0.41 — and the cascade routes work accordingly.
Commitment 09
The business compounds.
Your second business is a diff. Take the first, spread it, override what changes, ship.
import { Business } from 'business-as-code'
import { acme } from './acme'
export const acmeEU = Business({
...acme,
name: 'Acme EU',
locale: 'en-EU',
pricing: euPricing,
compliance: gdpr,
})
// The second business is a diff.The franchise prototype was always a software problem. Now it has software. One Business definition, a thousand forks, each running, each transacting, each compounding the rails the first one paid for.
The worked example
The hundred-line company.
Here is Acme Books — the running business that opened this page — written end to end. Vision, products, the cascade, the agent team, the goals, the budgets, the experiments. One file. One repo. One company.
// Acme Books — the entire company in one file.
import { Business } from 'business-as-code'
import { SaaS } from 'business-as-code/templates'
import { okrs } from 'business-as-code'
import { priya, ralph, tom, mark, sally, quinn, rae, finn, casey, dana } from 'agents.do'
// Ch 2 — A Business Is a Program
export const acme = Business({
...SaaS, // Ch 6 — Defaults are inherited
name: 'Acme Books',
mission: 'Close the books for every small firm — automatically.',
icp: 'US accounting firms, 2–200 staff',
// Ch 4 — Types are organizational discipline
customer: {
$type: 'Customer',
segments: ['SMB', 'Mid'] as const,
},
// Ch 2 — Products are functions
products: [{
name: 'Monthly Close',
model: 'outcome',
price: 499,
cogs: 40, // ~92% margin
deliveryTime: '24h',
}],
// Ch 5 — Four kinds of work, one cascade
cascades: {
monthlyClose: [
{ $type: 'CodeFunction', fn: ingestTransactions },
{ $type: 'GenerativeFunction', fn: categorizeAndDraft },
{ $type: 'AgenticFunction', fn: reconcileExceptions },
{ $type: 'HumanFunction', fn: controllerSignOff }, // human at the bar
],
},
// Ch 9 — Autonomy is earned, role by role
team: [
priya.as('Product', { mode: 'autonomous' }),
ralph.as('Engineering', { mode: 'autonomous' }),
tom.as('Tech Lead', { mode: 'supervised' }),
mark.as('Marketing', { mode: 'autonomous' }),
sally.as('Sales', { mode: 'supervised' }),
quinn.as('QA', { mode: 'autonomous' }),
rae.as('Frontend', { mode: 'autonomous' }),
finn.as('Finance', { mode: 'supervised' }),
casey.as('Customer Success', { mode: 'autonomous' }),
dana.as('Data', { mode: 'autonomous' }),
],
// Ch 7 — Goals are tests
goals: okrs([{
objective: 'Profitable growth',
period: '2026',
keyResults: [
{ metric: 'arr', targetValue: 10_000_000 },
{ metric: 'grossMargin', targetValue: 0.70 },
{ metric: 'nrr', targetValue: 1.10 },
],
}]),
// Ch 11 — Finance is firmware
budgets: {
aiCompute: { monthly: 8_000, alert: 0.80 },
infra: { monthly: 3_000, alert: 0.85 },
humanOversight: { monthly: 2_500, alert: 0.90 },
},
})
// Ch 8 — Every action is an experiment
acme.experiment('monthly-close-price', {
variants: [{ price: 399 }, { price: 499 }, { price: 599 }],
metric: (r) => r.closedWon ? r.contractValue : 0,
})
// Ch 3 — The map is the territory
// This file is the company. No second artifact. No gap to drift across.That’s the business. Not a description of it. Not a model of it. It. Run npm run business and the cascade compiles, the agents wake up, Stripe issues the products, customers buy, the OKRs start measuring, the experiments start running.
Where it ships
One method.Three surfaces.
One more
Open question in, running business out.
Open question, captured anywhere — chat, email, a thought during a walk. The runtime takes it from there:
import { on, list, research, ai } from 'business-as-code'
on('idea.captured', async (idea) => {
for await (const market of list`10 market segments for ${idea}`) {
const insights = await research`${market} in the context of ${idea}`
for await (const icp of list`ideal customer profiles for ${{ idea, market, insights }}`) {
const canvas = await ai.leanCanvas({ idea, market, icp, insights })
const story = await ai.storyBrand({ canvas, icp })
const page = await ai.landingPage({ story, canvas })
const posts = await ai.blogPosts({ canvas, count: 25 })
await page.publish()
}
}
})And every step inside that — researching the market, ranking the ICPs, drafting the canvas, shipping the page — calls back to the same handful of verbs whether silicon or carbon answers:
import { priya, ralph, tom } from 'agents.do'
import { legal, ceo } from 'humans.do'
const spec = await priya`spec out user authentication`
const code = await ralph`build ${spec}`
const reviewed = await tom`review ${code}`
const contract = await legal`review the licensing agreement`
const approved = await ceo`approve the partnership`
// The verb is the same whether silicon or carbon answers it.
// The code never says.The verb is the same whether silicon or carbon answers it. The code never says.
Founders wanted
499 graduated startups.Zero founders each.Pick yours.
The studio graduates startups faster than it mints founders. Every seat in the portfolio — the substrate stacks, the door brands, the cascade-graduated hundred — is a running thesis with a name, a claim, and an open chair at the top. You bring the conviction; the studio brings the machine. Pick the one you’d give the next decade, and tell us why it’s yours.
499 startups · grouped by operating stack
Your second business is four lines.
Write the behavior you want, and the business manifests it.