Skip to main content

Sprout Generator Spec

How do you prove the mycelium works — by growing something on it?

Build Contract

The deliverable. Commissioning reads this table. Tight Five sections below justify what's in it.

#FeatureFunctionOutcomeJobState
1Sprout generatorNx generator creates venture app from templatesNew venture in one commandPlatform proofBuilt
2Venture self-creationBootstrap creates venture row on first bootZero seed scripts neededSelf-healingGap
3Agent card auto-registrationAgent card writes to registry on startupMycelium discovers ventures automaticallyDiscoveryGap
4WorkChart venture scopingBoot seeds one WorkChart definition with ventureIdProves execution layer is venture-scopedScoped executionGap
5A2A endpoint stubsExecute and data routes respondVenture has API surfaceInteropGap
6Acceptance test7-line binary validation scriptBinary proof of platform thesisVerificationBuilt
7Safe Nx runnerPrevents hang on interactive promptsGenerator runs unattendedReliabilityBuilt
8Domain entity scaffoldingFeature scaffold generates per-entity CRUD with A2AVenture has real business logicDomain depthGap
9Real A2A executionReplace stubs with A2AHttpClientAdapter callsVentures can call each otherCompositionGap
10Venture access controlorg-venture-role permission tableVentures have their own usersSecurityGap
11Second sproutRun generator for a second venturePlatform proof — one works, two proves the patternValidationGap
12Cross-venture A2AAgent in venture A delegates to agent in venture BMycelium network effectNetworkGap

Principles

What truths constrain the design?

The Job

ElementDetail
SituationPlatform has 18 venture-scoped tables and shared libs, but new ventures require manual wiring
IntentionOne command produces a working venture app — thesis proven by automation
ObstacleUnknown coupling to drmg-sales. Shared libs built inside one app, never tested standalone
Hardest ThingAdditive template (from zero) must compose shared libs that carry invisible assumptions from their only consumer

Why Now

The platform has 7 ventures listed but 0 running independently. Every day without a second app is a day the "platform" claim is untested. The generator is built (Steps 1.1-1.5 complete). Schema migration is applied. The only thing between thesis and proof is running Step 1.6.

Design Constraints

ConstraintRationale
New app, not moduleModule inside drmg-sales proves ventures are features. Standalone app proves the mycelium pattern.
Venture IS the app boundaryventure_ventures table is first-class with 18+ scoped tables. Slug field = routing/A2A/agent namespace.
Additive, not subtractiveStripping drmg-sales carries invisible assumptions. Building from zero is slower but honest.
Auto-register, not server libAgent cards register on startup. Registration is a side effect of existing, not a task.
Self-create on bootMissing venture row → create it. Self-healing over seed scripts.
Domain-specific entitiesBerleytrails gets spots/reports/catches, not contacts/deals. Platform generator, not CRM template.

Refusal Spec

CategoryActionResponse
Copy from drmg-salesStrip app-drmg-sales-server into templateRefuse — additive principle. Build from zero.
Skip acceptance testShip without 7-line validationRefuse — the test IS the deliverable.
Add features before bootWire domain tables before generator proves it bootsRefuse — earn the right to build.
Shared namespaceUse berleytrails.a2a instead of berleytrailsRefuse — namespace derives from app name.

Performance

How do we know it's working?

Priority Score

PRIORITY = Pain x Demand x Edge x Trend x Conversion

DimensionScore (1-5)Evidence
Pain5Existential — platform thesis is unproven. 7 ventures listed, 0 running independently. Manual wiring costs days per venture with 30% boot failure rate.
Demand2Internal only — 7 ventures need platform proof. No external customers have asked. Second consumer rule drives the need.
Edge4Proprietary 18-table schema surface across 5 domains. 6 locked architecture decisions from strategic design session. Generator template pattern with auto-registration.
Trend5A2A protocol adoption accelerating. AI agent platforms becoming primary interface. Multi-venture composable platforms inevitable — structural shift.
Conversion2Internal tool — revenue path is indirect. Generator enables ventures that have pricing models (berleytrails, prettymint). No direct invoice this month.
Composite400Product of all five. Strong candidate — platform credibility at stake.

Quality Targets

TargetThresholdMethod
Generator completes100% (binary)Acceptance test line 1
Boot time< 30 secondsCold boot timer
Acceptance test7/7 passAcceptance script
drmg-sales regression0 failuresExisting test suite

Eval Strategy

WhatHowWhen
Generator output correctnessAcceptance test script (7-line)Every generator run
Shared lib independenceDependency audit (import chain map)Phase 1 completion
Platform proofSecond sprout (Phase 4)After Phase 1 acceptance
Template improvementLegacy principle — compare Phase 1 vs Phase 4 templatesPhase 4 completion

Kill signal: If berleytrails cannot cold boot and serve an A2A request within 60 days of first generator run, the shared libs are not shared — pivot to monolith architecture.

Platform

What do we control?

Current State

ComponentBuiltWiredWorkingNotes
Venture schema (18 tables)YesYesYes5 domains in production
Migration 0048 (WorkChart scoping)YesYesUntested3 nullable columns, zero breaking changes
Sprout generatorYesYesUntestedTemplates registered, never run
Safe Nx runnerYesYesYesHandles interactive prompt hang
Acceptance testYesUntestedScript written, waiting for generator output
A2A endpointsStubStubPhase 3 replaces stubs
Feature scaffoldYesYes (drmg-sales)Untested standalone
Shared libsYesYes (drmg-sales)Riskiest — never tested outside one consumer

Schema Surface

18 tables with ventureId across 5 domains:

DomainTablesWhat Berleytrails Inherits
schema-accounting (5)cost_centers, gl_accounts, metric_measurements, outcome_measurements, transactionsFinancial tracking
schema-planning (1)planning_projectsProject management
schema-value (1)venture_agent_value_eventsValue tracking
schema-venture (11)agent_cost_centers, agent_dev_timeseries, agent_execution_sessions, business_ideas, dashboard_slides, discovery_sessions, knowledge_base, llama_cloud_indexes, proposals, contacts, documentsKnowledge, contacts, proposals, dashboards
schema-agent (1)agent_profile_deals (via rfp_venture_id)Deal pipeline

Activation Backlog

Commented relations in venture.relations.ts — each activation adds composition ratio:

  • Agent layer: capabilities, performance history, skill gaps, team compositions, time allocation
  • Financial layer: cap table, financial KPIs, performance, funding rounds, investors, revenue streams
  • Operational layer: milestones, experiments, pivots, interventions
  • Team layer: team members, teams

Build Ratio

~85% composition (shared libs, schema, generator templates), ~15% new code (venture-specific boot sequence, A2A stubs)

Protocols

How do we coordinate?

Build Order

SprintFeaturesWhatEffortAcceptance
0#1, #6, #7Generator + acceptance test + safe runnerDoneSteps 1.1-1.5 complete
1#2, #3, #4, #5Run generator, boot, self-create, register, seed1 day7-line acceptance test passes
2#8Domain entities (spots, reports, catches) + feature scaffold3 daysPer-entity CRUD accessible via A2A data endpoint
3#9, #10Real A2A execute + access control5 daysCross-app A2A call succeeds with scoped permissions
4#11, #12Second sprout + cross-venture A2A2 daysTwo ventures compose same shared lib, call each other

Commissioning

#FeatureInstallTestOperationalOptimize
1Sprout generator100%0%0%0%
2Venture self-creation100%0%0%0%
3Agent card auto-registration100%0%0%0%
4WorkChart venture scoping100%0%0%0%
5A2A endpoint stubs100%0%0%0%
6Acceptance test100%0%0%0%
7Safe Nx runner100%100%100%0%
8Domain entity scaffolding0%0%0%0%
9Real A2A execution0%0%0%0%
10Venture access control0%0%0%0%
11Second sprout0%0%0%0%
12Cross-venture A2A0%0%0%0%

Agent-Facing Spec

Commands:

# Run generator
npx tsx tools/scripts/platform-engineering/nx/run-generator-safe.ts ./tools:sprout \
--name=berleytrails --domain=berleytrails --entities=spots,reports,catches

# Run acceptance test
A2A_API_KEY=dev-key \
DATABASE_URL=postgresql://dev_user:dev_password@localhost:5434/stackmates_dev \
npx tsx tools/scripts/platform-engineering/sprout/sprout-acceptance.ts --slug berleytrails

# Cold boot
pnpm nx dev berleytrails-app

# Verify no regression
pnpm nx dev drmg-sales

Boundaries:

AlwaysAsk FirstNever
Run acceptance test after generatorAdd new shared lib dependencyStrip from drmg-sales
Use additive templateActivate commented venture relationsSkip acceptance test
Self-create on bootChange generator output structureManual seed scripts

Test Contract:

#FeatureTestAssertion
1Generator runssprout-acceptance.ts line 1Exit code 0
2Venture existssprout-acceptance.ts line 2Row with slug = berleytrails
3Agent cardsprout-acceptance.ts line 3Card in registry under berleytrails namespace
4WorkChart seedsprout-acceptance.ts line 4Definition row with ventureId = berleytrails.id
5A2A respondssprout-acceptance.ts line 5HTTP 200 from execute and data endpoints
6Entities stubbedsprout-acceptance.ts line 6spots, reports, catches registered
7No regressionsprout-acceptance.ts line 7drmg-sales jobs have ventureId = null

Players

Who creates harmony?

Demand-Side Jobs

Job 1: Platform Engineer Creates a New Venture

Situation: Nav has 7 venture concepts but no mechanism to instantiate them. Each requires days of manual wiring — composition roots, A2A endpoints, DB scoping, agent registration — with 30% failure rate on first boot.

ElementDetail
Struggling moment"I want to prove berleytrails works on the mycelium but I'd need to manually wire 18 tables, create a new app structure, set up A2A endpoints, and register an agent card"
Current workaroundClone drmg-sales patterns manually, debug import failures, seed data by hand
What progress looks likeRun one command, boot the app, see it serve requests with venture-scoped data
Hidden objection"What if running the generator reveals the shared libs aren't actually shared — that we built a monolith?"
Switch triggerCodex crash resolved, manual path estimated at 3+ days, generator ready to run

Features that serve this job: #1, #2, #3, #4, #5, #6, #7

Job 2: Venture Founder Validates an Idea

Situation: Someone with a business idea (berleytrails: fishing platform) needs operational infrastructure without building from scratch.

ElementDetail
Struggling moment"I have a domain (fishing) and know my entities (spots, reports, catches) but I don't know how to build a full-stack app with auth, agents, and data pipelines"
Current workaroundBuild from scratch on a different platform, or don't build at all
What progress looks likeTell the platform what the domain is and what entities matter, get a working app with CRUD, A2A, and agents
Hidden objection"Will this platform lock me in, or can I customize for my domain?"
Switch triggerSeeing berleytrails run with domain-specific entities (spots, not contacts)

Features that serve this job: #1, #8, #9

Role Definitions

RoleAccessPermissions
Platform engineerFull — generator, templates, schemaCreate ventures, modify templates, run acceptance
Venture founderVenture-scoped — their app, their dataConfigure domain, manage entities, operate
Platform consumerRead — A2A endpoints, agent cardsQuery data, delegate tasks, compose

Relationship to Other PRDs

PRDRelationshipData Flow
Agent PlatformPeerSprout registers agent cards → Agent Platform manages them
Identity & AccessPeer (dependency)Identity provides auth → Sprout apps consume auth
ETL Data ToolPeerETL loads data → Venture apps consume data
Sales CRM & RFPPeer (first consumer)drmg-sales = first app on platform → Sprout = second app proof

Context