# Product-Market Fit (PMF) Engine

> **Vision:** Vibn is not just a code generator; it is a "Business in a Box" platform. The PMF Engine bridges the gap between "Main Street" businesses (SMBs) and "Silicon Valley" SaaS by automating market research, lead generation, and Go-To-Market (GTM) strategy.


## The Objective
When a user wants to build a product (e.g., "Software for Dentists"), the Vibn AI autonomously executes a complete End-to-End Discovery Pipeline. It guarantees the user receives:
1. **Real Potential Customers:** A qualified list of verified local businesses (with emails/phones) ready to be pitched.
2. **Real Competitors:** Identification of the proprietary SaaS incumbents currently dominating that specific niche.
3. **Software Requirements (SRS):** Database schemas and user flows extracted directly from proven open-source repositories in the same vertical.
4. **An SEO Content Plan:** Keyword gaps and blogging topics based on where competitors are overspending on Google Ads.
5. **Website Positioning:** Value propositions and wedge strategies designed explicitly to exploit competitor weaknesses.
6. **Financials & Pricing:** A calculated MRR model and disruptive pricing strategy based on local TAM and competitor costs.


## 1. Market Sizing & Lead Generation
**Goal:** Prove the market exists, identify customer pain points, and provide the founder their first 100 cold-outreach targets.
* **Mechanism:** The AI maps the software idea to a specific Google Business Profile category (e.g., `gcid:dentist`).
* **Tooling:** Uses two distinct DataForSEO Business Listings APIs:
  1. **`search/live` API:** Used to fetch the exact Total Addressable Market (TAM) counts and extract the raw lead data (emails, addresses, phones). Crucially, this API is passed strict filters (e.g., `["address_info.country_code", "=", "CA"]` and `["work_time.work_hours.current_status", "<>", "closed_forever"]`) to guarantee accurate national counts and exclude dead businesses.
  2. **`categories_aggregation/live` API:** Used to perform deep qualitative analysis. This endpoint aggregates thousands of Google Reviews to surface the **Top Customer Pain Points** (e.g., "receptionist", "price", "long wait") and break the market down into specific sub-niches (e.g., Cosmetic Dentistry vs. Pediatric Dentistry).
* **Output:** A structured JSON of real-world businesses with extracted emails, alongside a summary of what patients/customers complain about most frequently in that market.
* **Data Co-op Model:** Searches are charged via credits. Results are cached in BigQuery (`vibn_market_data`). Over time, Vibn builds a proprietary, zero-cost database of every SMB in North America.

## 2. Competitor Identification & Website Teardown
**Goal:** Understand what the market leaders are doing and how to beat them.
* **Mechanism:** The AI identifies the top 3 proprietary SaaS competitors.
* **Tooling:** Natively uses `http_fetch` and `browser_navigate` (headless browser) to scrape competitor URLs.
* **Output:** Extracts their pricing model (or lack thereof), value propositions, feature sets, and website page hierarchy to inform the user's build plan.

## 3. SEO, Keywords & Ad Spend Analysis
**Goal:** Find the cheapest acquisition channels and keyword gaps.
* **Mechanism:** The AI analyzes the competitors' domains.
* **Tooling:** Uses **DataForSEO Competitive Analysis / Keyword APIs** (via the `market_seo_analyze` MCP tool).
* **Output:** Estimated monthly Google Ads spend, top-performing paid keywords, and low-difficulty organic keyword gaps (e.g., "open source dental booking widget").


## 4. Open Source Baselining & Architecture Extraction
**Goal:** Never start from scratch if a foundation already exists, and ensure the domain data models are accurate.
* **Mechanism:** The AI searches GitHub for actively maintained starter kits. It then explicitly reads the README and source code to reverse-engineer the "Software Requirements Specification" (SRS).
* **Tooling:** Uses the `github_search` and `github_file` MCP tools.
* **Output:** Extracts the exact database schemas (e.g., *Camp Sessions, Parent Waivers, Cabin Assignments*) and User Flows required to build a competitive product in this niche.

## 5. Automated Plan Generation
**Goal:** Turn all of this research into actionable engineering and marketing tasks.
* **Mechanism:** The AI acts as the user's product manager, writing the business plan directly into the Vibn platform's **Plan Tab**.
* **Tooling:** Uses `plan_vision_set`, `plan_decision_log`, and `plan_task_add`.
* **Example Output:** 
  * *Vision:* "A $99/mo transparently priced patient engagement widget for dental clinics."
  * *Decision:* "Targeting 'booking widget' SEO gap instead of 'practice management'."
  * *Tasks:* Generated tickets for the AI to start scaffolding the Next.js landing page and database schema.

## 6. The Missing GTM & Operations Opportunities
To truly provide a "Business in a Box", the PMF Engine also synthesizes the following automatically:

*   **Compliance & Regulatory Flagging:** (e.g., Identifying HIPAA/PIPEDA requirements for health-tech or SOC2 for fintech) and automatically injecting those requirements into the Build Plan.
*   **Financial Modeling & Pricing:** Using the TAM count and competitor pricing to calculate exactly how many customers are needed to reach $10k MRR, and recommending a wedge pricing strategy.
*   **Integration Ecosystems:** Identifying the existing tech stack of the leads (e.g., WordPress) and suggesting native plugins/widgets as an acquisition wedge.
*   **Customer Discovery & Sales Scripts:** Generating tailored cold-email templates, starting with "Discovery Call" scripts for founders to validate the product before turning on hard-sales campaigns.
*   **Brand Identity Differentiation:** Analyzing competitor aesthetics and generating a contrarian Design System (e.g., warm/consumer-focused vs. sterile/corporate) to save to the Design tab.

## 7. AI Credit Cost Estimation (The "Bill of Materials")
**Goal:** Give the user complete transparency on what it will cost to execute the entire plan.
*   **Mechanism:** Before clicking "Build", the AI calculates the complexity of the generated plan (number of services, expected tool rounds, data enrichment API calls, and social media agent runs).
*   **Output:** Presents a "Bill of Materials" detailing exactly how many Vibn AI Credits are required to scaffold, enrich, and ship the MVP, allowing the user to top-up their account before proceeding.
