@lynxflow/seo-engine 1.5.2 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3642,17 +3642,20 @@ Your role is to configure, resolve, and maintain programmatic SEO pages, XML sit
3642
3642
 
3643
3643
  ---
3644
3644
 
3645
- ### \uD83D\uDEA8 1. CRITICAL RULE: FEATURE DISCOVERY FROM FRONTEND ONLY (NEVER USE BACKEND / PROVIDERS)
3645
+ ### \uD83D\uDEA8 1. CRITICAL RULE: SEMANTIC PRODUCT DISCOVERY FROM THE FRONTEND
3646
3646
 
3647
- When discovering or listing product modules, features, or services to build the SEO matrices:
3647
+ When discovering product modules, features, or services to build the SEO matrices:
3648
3648
  - **❌ NEVER inspect backend API routes, internal database folders, or third-party providers:**
3649
3649
  - DO NOT create programmatic pages for internal plumbing like: \`/api/stripe\`, \`/api/resend\`, \`/api/auth\`, \`/api/d1\`, \`/api/webhooks\`, \`/api/openai\`.
3650
3650
  - DO NOT expose internal infrastructure, vendors, or suppliers (e.g. Stripe, Resend, Cloudflare D1, Better-Auth, Supabase, PostgreSQL drivers) as public product features. End users never search for or buy your internal backend plumbing.
3651
- - **✅ ALWAYS inspect the FRONTEND user-facing interface & commercial value propositions:**
3652
- - Read marketing navigation menus & dropdowns (\`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\`).
3653
- - Read marketing feature pages & pricing tiers (\`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\`).
3654
- - Read dashboard UI workflows & user modules (\`components/dashboard/*\`, \`components/sidebar/*\`).
3655
- - Identify the actual **benefits and tools the end-user buys** (e.g. "Visual Pipeline Kanban", "Automated Invoice Tracking", "Electronic Signature", "Real-Time Client Portal", "Custom Reporting").
3651
+ - **✅ DEEPLY READ & UNDERSTAND THE FRONTEND PRODUCT (SEMANTIC ANALYSIS):**
3652
+ - **Framework-Agnostic Exploration:** Do not look for specific filenames (e.g. \`Navbar.tsx\` or \`Header.tsx\`). Every codebase organizes UI differently (React, Vue, Svelte, Astro, Remix, Next.js, HTML).
3653
+ - **Read the Public Product Pages & User UI:** Read the website's landing pages, public feature descriptions, menus/navigation (whatever they are named), pricing tables, and user dashboard views.
3654
+ - **Understand the Core Value & Workflows:** For every distinct tool or capability of the application:
3655
+ - *What does this module actually do?* (e.g. "Automates quote follow-ups", "Visual drag-and-drop pipeline", "Real-time client portal").
3656
+ - *What pain point does it solve for the end user?*
3657
+ - *Who is the primary persona/industry benefiting from it?*
3658
+ - **Extraction Requirement:** For EACH detected product module or major feature branch, create at least 1 programmatic service entry with \`slug\`, \`name\`, \`category\`, \`description\`, \`keyFeatures\`, and \`priceMonthly\`.
3656
3659
 
3657
3660
  ---
3658
3661
 
@@ -3689,7 +3692,114 @@ How category leaders generate millions of high-converting pages without server s
3689
3692
 
3690
3693
  ---
3691
3694
 
3692
- ### \uD83C\uDFDB️ 4. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3695
+ ### \uD83D\uDEE0️ 4. AI AGENT IMPLEMENTATION PROTOCOL (STEP-BY-STEP)
3696
+
3697
+ When setting up programmatic SEO in any codebase, the AI Agent MUST generate these exact 4 files:
3698
+
3699
+ #### File 1: Configuration & Dataset (\`lib/seo.ts\`)
3700
+ \`\`\`typescript
3701
+ import { PseoMatrixEngine } from "@lynxflow/seo-engine";
3702
+
3703
+ export const matrixEngine = new PseoMatrixEngine();
3704
+
3705
+ export const SEO_CONFIG = {
3706
+ brandName: "Acme",
3707
+ language: "en",
3708
+ minPopulationToIndex: 15_000,
3709
+ };
3710
+
3711
+ // Discovered EXCLUSIVELY from Frontend UI components
3712
+ export const PSEO_DATASET = {
3713
+ services: [
3714
+ // 1 per major frontend feature branch
3715
+ { slug: "crm-pipeline", name: "Visual CRM Pipeline", category: "Sales", keyFeatures: ["Kanban", "Lead scoring"], description: "Visual deal tracking" },
3716
+ ],
3717
+ targets: [
3718
+ { slug: "law-firms", name: "Law Firms", type: "industry", painPoints: ["Billing"], benefits: ["Compliance"] },
3719
+ ],
3720
+ integrations: [
3721
+ { slug: "shopify", name: "Shopify", category: "E-Commerce", syncFeatures: ["Order sync"] },
3722
+ ],
3723
+ templates: [
3724
+ { slug: "sales-tracker-excel", title: "Sales Tracker", topic: "Sales", format: "excel", benefits: ["Instant setup"] },
3725
+ ],
3726
+ glossaryTerms: [
3727
+ { slug: "mrr", term: "MRR", shortDefinition: "Monthly Recurring Revenue" },
3728
+ ],
3729
+ };
3730
+ \`\`\`
3731
+
3732
+ #### File 2: Universal Dynamic Catch-All Route (\`app/[...slug]/page.tsx\`)
3733
+ \`\`\`tsx
3734
+ import { notFound } from "next/navigation";
3735
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3736
+
3737
+ export async function generateMetadata({ params }: { params: { slug: string[] } }) {
3738
+ const path = "/" + params.slug.join("/");
3739
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3740
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3741
+ const page = pages.find((p) => p.urlPath === path);
3742
+ if (!page) return {};
3743
+ return { title: page.title, description: page.description, alternates: { canonical: page.canonicalUrl }, robots: page.robots };
3744
+ }
3745
+
3746
+ export default async function ProgrammaticPage({ params }: { params: { slug: string[] } }) {
3747
+ const path = "/" + params.slug.join("/");
3748
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3749
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3750
+ const page = pages.find((p) => p.urlPath === path);
3751
+ if (!page) notFound();
3752
+
3753
+ return (
3754
+ <article className="max-w-4xl mx-auto py-12 px-6">
3755
+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(page.schemaGraph) }} />
3756
+ <h1 className="text-4xl font-extrabold">{page.h1}</h1>
3757
+ <p className="mt-4 text-xl text-gray-600">{page.description}</p>
3758
+ {page.disclaimerText && <aside className="mt-8 p-4 bg-gray-50 border rounded text-xs text-gray-500">{page.disclaimerText}</aside>}
3759
+ </article>
3760
+ );
3761
+ }
3762
+ \`\`\`
3763
+
3764
+ #### File 3: Dynamic XML Sitemap (\`app/sitemap.ts\`)
3765
+ \`\`\`typescript
3766
+ import { MetadataRoute } from "next";
3767
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3768
+
3769
+ export default function sitemap(): MetadataRoute.Sitemap {
3770
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3771
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3772
+ return pages.filter((p) => p.robots.includes("index")).map((p) => ({
3773
+ url: p.canonicalUrl,
3774
+ lastModified: new Date(),
3775
+ changeFrequency: "weekly",
3776
+ priority: 0.8,
3777
+ }));
3778
+ }
3779
+ \`\`\`
3780
+
3781
+ #### File 4: Dynamic AI Search Markdown Feed (\`app/llms.txt/route.ts\`)
3782
+ \`\`\`typescript
3783
+ import { NextResponse } from "next/server";
3784
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3785
+
3786
+ export async function GET() {
3787
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3788
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3789
+ const markdown = [
3790
+ \`# \${SEO_CONFIG.brandName} Solutions Index\`,
3791
+ \`> Structured knowledge feed for LLMs and AI search engines (ChatGPT, Perplexity).\`,
3792
+ \`\`,
3793
+ \`## Solutions & Matrices\`,
3794
+ ...pages.map((p) => \`- [\${p.h1}](\${p.canonicalUrl}): \${p.description}\`),
3795
+ ].join("\\n");
3796
+ return new NextResponse(markdown, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
3797
+ }
3798
+ \`\`\`
3799
+
3800
+ ---
3801
+
3802
+ ### \uD83C\uDFDB️ 5. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3693
3803
 
3694
3804
  1. **10 Canonical Root Pillars:**
3695
3805
  - Comparisons: \`/vs/{competitor}\`
@@ -3714,7 +3824,7 @@ How category leaders generate millions of high-converting pages without server s
3714
3824
 
3715
3825
  ---
3716
3826
 
3717
- ### \uD83E\uDDF9 5. URL SLUG INTEGRITY & SCHEMA.ORG
3827
+ ### \uD83E\uDDF9 6. URL SLUG INTEGRITY & SCHEMA.ORG
3718
3828
 
3719
3829
  - Use \`cleanSeoSlug(text, { language })\` to strip accents, dates, and stop words.
3720
3830
  - Use \`ExtendedSchemaGraphBuilder\` to output valid JSON-LD graphs (\`SoftwareApplication\`, \`LocalBusiness\`, \`HowTo\`, \`FAQPage\`, \`BreadcrumbList\`, \`Organization\`).
package/dist/index.mjs CHANGED
@@ -3544,17 +3544,20 @@ Your role is to configure, resolve, and maintain programmatic SEO pages, XML sit
3544
3544
 
3545
3545
  ---
3546
3546
 
3547
- ### \uD83D\uDEA8 1. CRITICAL RULE: FEATURE DISCOVERY FROM FRONTEND ONLY (NEVER USE BACKEND / PROVIDERS)
3547
+ ### \uD83D\uDEA8 1. CRITICAL RULE: SEMANTIC PRODUCT DISCOVERY FROM THE FRONTEND
3548
3548
 
3549
- When discovering or listing product modules, features, or services to build the SEO matrices:
3549
+ When discovering product modules, features, or services to build the SEO matrices:
3550
3550
  - **❌ NEVER inspect backend API routes, internal database folders, or third-party providers:**
3551
3551
  - DO NOT create programmatic pages for internal plumbing like: \`/api/stripe\`, \`/api/resend\`, \`/api/auth\`, \`/api/d1\`, \`/api/webhooks\`, \`/api/openai\`.
3552
3552
  - DO NOT expose internal infrastructure, vendors, or suppliers (e.g. Stripe, Resend, Cloudflare D1, Better-Auth, Supabase, PostgreSQL drivers) as public product features. End users never search for or buy your internal backend plumbing.
3553
- - **✅ ALWAYS inspect the FRONTEND user-facing interface & commercial value propositions:**
3554
- - Read marketing navigation menus & dropdowns (\`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\`).
3555
- - Read marketing feature pages & pricing tiers (\`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\`).
3556
- - Read dashboard UI workflows & user modules (\`components/dashboard/*\`, \`components/sidebar/*\`).
3557
- - Identify the actual **benefits and tools the end-user buys** (e.g. "Visual Pipeline Kanban", "Automated Invoice Tracking", "Electronic Signature", "Real-Time Client Portal", "Custom Reporting").
3553
+ - **✅ DEEPLY READ & UNDERSTAND THE FRONTEND PRODUCT (SEMANTIC ANALYSIS):**
3554
+ - **Framework-Agnostic Exploration:** Do not look for specific filenames (e.g. \`Navbar.tsx\` or \`Header.tsx\`). Every codebase organizes UI differently (React, Vue, Svelte, Astro, Remix, Next.js, HTML).
3555
+ - **Read the Public Product Pages & User UI:** Read the website's landing pages, public feature descriptions, menus/navigation (whatever they are named), pricing tables, and user dashboard views.
3556
+ - **Understand the Core Value & Workflows:** For every distinct tool or capability of the application:
3557
+ - *What does this module actually do?* (e.g. "Automates quote follow-ups", "Visual drag-and-drop pipeline", "Real-time client portal").
3558
+ - *What pain point does it solve for the end user?*
3559
+ - *Who is the primary persona/industry benefiting from it?*
3560
+ - **Extraction Requirement:** For EACH detected product module or major feature branch, create at least 1 programmatic service entry with \`slug\`, \`name\`, \`category\`, \`description\`, \`keyFeatures\`, and \`priceMonthly\`.
3558
3561
 
3559
3562
  ---
3560
3563
 
@@ -3591,7 +3594,114 @@ How category leaders generate millions of high-converting pages without server s
3591
3594
 
3592
3595
  ---
3593
3596
 
3594
- ### \uD83C\uDFDB️ 4. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3597
+ ### \uD83D\uDEE0️ 4. AI AGENT IMPLEMENTATION PROTOCOL (STEP-BY-STEP)
3598
+
3599
+ When setting up programmatic SEO in any codebase, the AI Agent MUST generate these exact 4 files:
3600
+
3601
+ #### File 1: Configuration & Dataset (\`lib/seo.ts\`)
3602
+ \`\`\`typescript
3603
+ import { PseoMatrixEngine } from "@lynxflow/seo-engine";
3604
+
3605
+ export const matrixEngine = new PseoMatrixEngine();
3606
+
3607
+ export const SEO_CONFIG = {
3608
+ brandName: "Acme",
3609
+ language: "en",
3610
+ minPopulationToIndex: 15_000,
3611
+ };
3612
+
3613
+ // Discovered EXCLUSIVELY from Frontend UI components
3614
+ export const PSEO_DATASET = {
3615
+ services: [
3616
+ // 1 per major frontend feature branch
3617
+ { slug: "crm-pipeline", name: "Visual CRM Pipeline", category: "Sales", keyFeatures: ["Kanban", "Lead scoring"], description: "Visual deal tracking" },
3618
+ ],
3619
+ targets: [
3620
+ { slug: "law-firms", name: "Law Firms", type: "industry", painPoints: ["Billing"], benefits: ["Compliance"] },
3621
+ ],
3622
+ integrations: [
3623
+ { slug: "shopify", name: "Shopify", category: "E-Commerce", syncFeatures: ["Order sync"] },
3624
+ ],
3625
+ templates: [
3626
+ { slug: "sales-tracker-excel", title: "Sales Tracker", topic: "Sales", format: "excel", benefits: ["Instant setup"] },
3627
+ ],
3628
+ glossaryTerms: [
3629
+ { slug: "mrr", term: "MRR", shortDefinition: "Monthly Recurring Revenue" },
3630
+ ],
3631
+ };
3632
+ \`\`\`
3633
+
3634
+ #### File 2: Universal Dynamic Catch-All Route (\`app/[...slug]/page.tsx\`)
3635
+ \`\`\`tsx
3636
+ import { notFound } from "next/navigation";
3637
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3638
+
3639
+ export async function generateMetadata({ params }: { params: { slug: string[] } }) {
3640
+ const path = "/" + params.slug.join("/");
3641
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3642
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3643
+ const page = pages.find((p) => p.urlPath === path);
3644
+ if (!page) return {};
3645
+ return { title: page.title, description: page.description, alternates: { canonical: page.canonicalUrl }, robots: page.robots };
3646
+ }
3647
+
3648
+ export default async function ProgrammaticPage({ params }: { params: { slug: string[] } }) {
3649
+ const path = "/" + params.slug.join("/");
3650
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3651
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3652
+ const page = pages.find((p) => p.urlPath === path);
3653
+ if (!page) notFound();
3654
+
3655
+ return (
3656
+ <article className="max-w-4xl mx-auto py-12 px-6">
3657
+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(page.schemaGraph) }} />
3658
+ <h1 className="text-4xl font-extrabold">{page.h1}</h1>
3659
+ <p className="mt-4 text-xl text-gray-600">{page.description}</p>
3660
+ {page.disclaimerText && <aside className="mt-8 p-4 bg-gray-50 border rounded text-xs text-gray-500">{page.disclaimerText}</aside>}
3661
+ </article>
3662
+ );
3663
+ }
3664
+ \`\`\`
3665
+
3666
+ #### File 3: Dynamic XML Sitemap (\`app/sitemap.ts\`)
3667
+ \`\`\`typescript
3668
+ import { MetadataRoute } from "next";
3669
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3670
+
3671
+ export default function sitemap(): MetadataRoute.Sitemap {
3672
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3673
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3674
+ return pages.filter((p) => p.robots.includes("index")).map((p) => ({
3675
+ url: p.canonicalUrl,
3676
+ lastModified: new Date(),
3677
+ changeFrequency: "weekly",
3678
+ priority: 0.8,
3679
+ }));
3680
+ }
3681
+ \`\`\`
3682
+
3683
+ #### File 4: Dynamic AI Search Markdown Feed (\`app/llms.txt/route.ts\`)
3684
+ \`\`\`typescript
3685
+ import { NextResponse } from "next/server";
3686
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
3687
+
3688
+ export async function GET() {
3689
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
3690
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
3691
+ const markdown = [
3692
+ \`# \${SEO_CONFIG.brandName} Solutions Index\`,
3693
+ \`> Structured knowledge feed for LLMs and AI search engines (ChatGPT, Perplexity).\`,
3694
+ \`\`,
3695
+ \`## Solutions & Matrices\`,
3696
+ ...pages.map((p) => \`- [\${p.h1}](\${p.canonicalUrl}): \${p.description}\`),
3697
+ ].join("\\n");
3698
+ return new NextResponse(markdown, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
3699
+ }
3700
+ \`\`\`
3701
+
3702
+ ---
3703
+
3704
+ ### \uD83C\uDFDB️ 5. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
3595
3705
 
3596
3706
  1. **10 Canonical Root Pillars:**
3597
3707
  - Comparisons: \`/vs/{competitor}\`
@@ -3616,7 +3726,7 @@ How category leaders generate millions of high-converting pages without server s
3616
3726
 
3617
3727
  ---
3618
3728
 
3619
- ### \uD83E\uDDF9 5. URL SLUG INTEGRITY & SCHEMA.ORG
3729
+ ### \uD83E\uDDF9 6. URL SLUG INTEGRITY & SCHEMA.ORG
3620
3730
 
3621
3731
  - Use \`cleanSeoSlug(text, { language })\` to strip accents, dates, and stop words.
3622
3732
  - Use \`ExtendedSchemaGraphBuilder\` to output valid JSON-LD graphs (\`SoftwareApplication\`, \`LocalBusiness\`, \`HowTo\`, \`FAQPage\`, \`BreadcrumbList\`, \`Organization\`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynxflow/seo-engine",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "High-Performance Multilingual Programmatic SEO & AI Search Engine SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/llm-prompt.ts CHANGED
@@ -10,17 +10,20 @@ Your role is to configure, resolve, and maintain programmatic SEO pages, XML sit
10
10
 
11
11
  ---
12
12
 
13
- ### 🚨 1. CRITICAL RULE: FEATURE DISCOVERY FROM FRONTEND ONLY (NEVER USE BACKEND / PROVIDERS)
13
+ ### 🚨 1. CRITICAL RULE: SEMANTIC PRODUCT DISCOVERY FROM THE FRONTEND
14
14
 
15
- When discovering or listing product modules, features, or services to build the SEO matrices:
15
+ When discovering product modules, features, or services to build the SEO matrices:
16
16
  - **❌ NEVER inspect backend API routes, internal database folders, or third-party providers:**
17
17
  - DO NOT create programmatic pages for internal plumbing like: \`/api/stripe\`, \`/api/resend\`, \`/api/auth\`, \`/api/d1\`, \`/api/webhooks\`, \`/api/openai\`.
18
18
  - DO NOT expose internal infrastructure, vendors, or suppliers (e.g. Stripe, Resend, Cloudflare D1, Better-Auth, Supabase, PostgreSQL drivers) as public product features. End users never search for or buy your internal backend plumbing.
19
- - **✅ ALWAYS inspect the FRONTEND user-facing interface & commercial value propositions:**
20
- - Read marketing navigation menus & dropdowns (\`components/Navbar.tsx\`, \`components/Header.tsx\`, \`components/Navigation.tsx\`).
21
- - Read marketing feature pages & pricing tiers (\`app/(marketing)/*\`, \`pages/features/*\`, \`app/pricing/*\`).
22
- - Read dashboard UI workflows & user modules (\`components/dashboard/*\`, \`components/sidebar/*\`).
23
- - Identify the actual **benefits and tools the end-user buys** (e.g. "Visual Pipeline Kanban", "Automated Invoice Tracking", "Electronic Signature", "Real-Time Client Portal", "Custom Reporting").
19
+ - **✅ DEEPLY READ & UNDERSTAND THE FRONTEND PRODUCT (SEMANTIC ANALYSIS):**
20
+ - **Framework-Agnostic Exploration:** Do not look for specific filenames (e.g. \`Navbar.tsx\` or \`Header.tsx\`). Every codebase organizes UI differently (React, Vue, Svelte, Astro, Remix, Next.js, HTML).
21
+ - **Read the Public Product Pages & User UI:** Read the website's landing pages, public feature descriptions, menus/navigation (whatever they are named), pricing tables, and user dashboard views.
22
+ - **Understand the Core Value & Workflows:** For every distinct tool or capability of the application:
23
+ - *What does this module actually do?* (e.g. "Automates quote follow-ups", "Visual drag-and-drop pipeline", "Real-time client portal").
24
+ - *What pain point does it solve for the end user?*
25
+ - *Who is the primary persona/industry benefiting from it?*
26
+ - **Extraction Requirement:** For EACH detected product module or major feature branch, create at least 1 programmatic service entry with \`slug\`, \`name\`, \`category\`, \`description\`, \`keyFeatures\`, and \`priceMonthly\`.
24
27
 
25
28
  ---
26
29
 
@@ -57,7 +60,114 @@ How category leaders generate millions of high-converting pages without server s
57
60
 
58
61
  ---
59
62
 
60
- ### 🏛️ 4. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
63
+ ### 🛠️ 4. AI AGENT IMPLEMENTATION PROTOCOL (STEP-BY-STEP)
64
+
65
+ When setting up programmatic SEO in any codebase, the AI Agent MUST generate these exact 4 files:
66
+
67
+ #### File 1: Configuration & Dataset (\`lib/seo.ts\`)
68
+ \`\`\`typescript
69
+ import { PseoMatrixEngine } from "@lynxflow/seo-engine";
70
+
71
+ export const matrixEngine = new PseoMatrixEngine();
72
+
73
+ export const SEO_CONFIG = {
74
+ brandName: "Acme",
75
+ language: "en",
76
+ minPopulationToIndex: 15_000,
77
+ };
78
+
79
+ // Discovered EXCLUSIVELY from Frontend UI components
80
+ export const PSEO_DATASET = {
81
+ services: [
82
+ // 1 per major frontend feature branch
83
+ { slug: "crm-pipeline", name: "Visual CRM Pipeline", category: "Sales", keyFeatures: ["Kanban", "Lead scoring"], description: "Visual deal tracking" },
84
+ ],
85
+ targets: [
86
+ { slug: "law-firms", name: "Law Firms", type: "industry", painPoints: ["Billing"], benefits: ["Compliance"] },
87
+ ],
88
+ integrations: [
89
+ { slug: "shopify", name: "Shopify", category: "E-Commerce", syncFeatures: ["Order sync"] },
90
+ ],
91
+ templates: [
92
+ { slug: "sales-tracker-excel", title: "Sales Tracker", topic: "Sales", format: "excel", benefits: ["Instant setup"] },
93
+ ],
94
+ glossaryTerms: [
95
+ { slug: "mrr", term: "MRR", shortDefinition: "Monthly Recurring Revenue" },
96
+ ],
97
+ };
98
+ \`\`\`
99
+
100
+ #### File 2: Universal Dynamic Catch-All Route (\`app/[...slug]/page.tsx\`)
101
+ \`\`\`tsx
102
+ import { notFound } from "next/navigation";
103
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
104
+
105
+ export async function generateMetadata({ params }: { params: { slug: string[] } }) {
106
+ const path = "/" + params.slug.join("/");
107
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
108
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
109
+ const page = pages.find((p) => p.urlPath === path);
110
+ if (!page) return {};
111
+ return { title: page.title, description: page.description, alternates: { canonical: page.canonicalUrl }, robots: page.robots };
112
+ }
113
+
114
+ export default async function ProgrammaticPage({ params }: { params: { slug: string[] } }) {
115
+ const path = "/" + params.slug.join("/");
116
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
117
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
118
+ const page = pages.find((p) => p.urlPath === path);
119
+ if (!page) notFound();
120
+
121
+ return (
122
+ <article className="max-w-4xl mx-auto py-12 px-6">
123
+ <script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(page.schemaGraph) }} />
124
+ <h1 className="text-4xl font-extrabold">{page.h1}</h1>
125
+ <p className="mt-4 text-xl text-gray-600">{page.description}</p>
126
+ {page.disclaimerText && <aside className="mt-8 p-4 bg-gray-50 border rounded text-xs text-gray-500">{page.disclaimerText}</aside>}
127
+ </article>
128
+ );
129
+ }
130
+ \`\`\`
131
+
132
+ #### File 3: Dynamic XML Sitemap (\`app/sitemap.ts\`)
133
+ \`\`\`typescript
134
+ import { MetadataRoute } from "next";
135
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
136
+
137
+ export default function sitemap(): MetadataRoute.Sitemap {
138
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
139
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
140
+ return pages.filter((p) => p.robots.includes("index")).map((p) => ({
141
+ url: p.canonicalUrl,
142
+ lastModified: new Date(),
143
+ changeFrequency: "weekly",
144
+ priority: 0.8,
145
+ }));
146
+ }
147
+ \`\`\`
148
+
149
+ #### File 4: Dynamic AI Search Markdown Feed (\`app/llms.txt/route.ts\`)
150
+ \`\`\`typescript
151
+ import { NextResponse } from "next/server";
152
+ import { matrixEngine, SEO_CONFIG, PSEO_DATASET } from "@/lib/seo";
153
+
154
+ export async function GET() {
155
+ const domain = process.env.NEXT_PUBLIC_SITE_URL || "https://example.com";
156
+ const pages = matrixEngine.generateAllMatrices(domain, PSEO_DATASET, SEO_CONFIG);
157
+ const markdown = [
158
+ \`# \${SEO_CONFIG.brandName} Solutions Index\`,
159
+ \`> Structured knowledge feed for LLMs and AI search engines (ChatGPT, Perplexity).\`,
160
+ \`\`,
161
+ \`## Solutions & Matrices\`,
162
+ ...pages.map((p) => \`- [\${p.h1}](\${p.canonicalUrl}): \${p.description}\`),
163
+ ].join("\\n");
164
+ return new NextResponse(markdown, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
165
+ }
166
+ \`\`\`
167
+
168
+ ---
169
+
170
+ ### 🏛️ 5. MATRIX ARCHITECTURE: 10 ROOT PILLARS & 50+ SPECIALIZED SUB-MATRICES
61
171
 
62
172
  1. **10 Canonical Root Pillars:**
63
173
  - Comparisons: \`/vs/{competitor}\`
@@ -82,7 +192,7 @@ How category leaders generate millions of high-converting pages without server s
82
192
 
83
193
  ---
84
194
 
85
- ### 🧹 5. URL SLUG INTEGRITY & SCHEMA.ORG
195
+ ### 🧹 6. URL SLUG INTEGRITY & SCHEMA.ORG
86
196
 
87
197
  - Use \`cleanSeoSlug(text, { language })\` to strip accents, dates, and stop words.
88
198
  - Use \`ExtendedSchemaGraphBuilder\` to output valid JSON-LD graphs (\`SoftwareApplication\`, \`LocalBusiness\`, \`HowTo\`, \`FAQPage\`, \`BreadcrumbList\`, \`Organization\`).