Skip to content

Mentha-cli is the CLI for Mentha’s AEO/GEO platform to audit, measure, and optimize how AIs talk about your brand across ChatGPT, Claude, Perplexity, and Gemini — not SEO, not content.

License

Notifications You must be signed in to change notification settings

beenruuu/mentha-cli

Repository files navigation

🌿 Mentha CLI (V3.0 Enterprise)

The AEO/GEO Intelligence Platform - Geo-Spatial, Agentic & Hallucination-Proof Brand Monitoring.

TypeScript Node.js Supabase License


What is Mentha V3.0?

Mentha is an Answer Engine Optimization (AEO) platform designed for the AI Search era. It helps brands control their narrative in ChatGPT, Perplexity, and Google SGE by monitoring, evaluating, and optimizing their visibility deeply.

New in V3.0 (Enterprise):

  • 🌍 Geo-Spatial Intelligence: Scans from specific locations (e.g., "Toys in Madrid" vs "Toys in London").
  • 🧠 Universal Entity Resolution: Distinguishes your brand from generic words (e.g., "Action" the store vs "action" the verb).
  • 🤖 Agentic Fan-Out: Uses AI Personas ("Bargain Hunter", "Skeptic", "Local Shopper") to generate natural, intent-driven searches.
  • Multi-Model Support: Native integrations for ChatGPT (OpenAI), Perplexity, Gemini, and Claude (Anthropic).
  • 🕵️ Hallucination Monitor: Automatically flags if the AI invents products, prices, or scams involving your brand.

📚 Deep Dive: What is AEO & GEO?

(And why traditional SEO is dead)

🧠 AEO (Answer Engine Optimization)

Is the art of optimizing your brand to appear in ChatGPT, Claude, and Perplexity responses. Users no longer search "best toys"; they ask "What are the safest durable toys for a 3-year-old in Madrid?". The AI synthesizes an answer. If you aren't in its training data or RAG sources, you don't exist.

🎨 GEO (Generative Engine Optimization)

Applies to multi-modal results (images, videos) in platforms like Google Gemini (SGE). It's about convincing the AI that your content is the most authoritative source to cite.

🛑 Does Mentha fix this 100%?

The Short Answer: No tool can guarantee 100% visibility, because AI models are probabilistic non-deterministic black boxes. A model might "hallucinate" or prefer a competitor randomly.

The Mentha Answer: We maximize your statistical probability of appearing by:

  1. Feeding the AI what it wants: Structured Data (JSON-LD) and Knowledge Graphs.
  2. Monitoring Reality: We don't guess; we scan continuously to see exactly what the AI is saying about you today.
  3. Correcting the Record: If Claude thinks you sell "cheap plastic", Mentha guides you to inject "premium durability" facts into the sources Claude reads (E-E-A-T).

🚀 How to Optimize (The Strategy)

  1. Be Explicit: Use the Knowledge Graph to define your entity clearly. Ambiguity is the enemy.
  2. Be Local: Use Mentha Geo to ensure you exist in Madrid, not just "Global".
  3. Be Referenced: Getting mentioned in AI responses requires being mentioned in trusted sources (Reviews, News, Wikipedia). Mentha's Share of Model metric tells you if you are winning this battle.

Features

Category Feature Description
Monitoring Multi-LLM Scanning Query OpenAI, Perplexity, Gemini, and Claude simultaneously.
Agentic Fan-Out [NEW] AI Personas generate 100+ variations of user queries (Price vs Quality vs Proximity).
Entity Resolution [NEW] Semantic disambiguation to filter out homonyms ("GAP" clothing vs "gap" analysis).
Compliance Monitor [NEW] Detects hallucinations, scams, and legal risks in AI responses.
Optimization Knowledge Graph Define entities, claims, and FAQs in structured PostgreSQL.
Dynamic JSON-LD Generate Schema.org markup automatically for your site.
llms.txt Endpoint Host a standard llms.txt file for AI crawlers.
Distribution Multi-Tenant Full RLS isolation per tenant/project.
I18n Support [NEW] CLI available in English and Spanish.

Quick Start

Prerequisites

  • Node.js 20+
  • Supabase account (or Docker)
  • OpenAI API Key

Installation

# Clone the repository
git clone https://github.com/yourusername/mentha-cli.git
cd mentha-cli

# Install dependencies
npm install

# Setup Environment (Interactive Wizard)
npm run setup

# Or manually:
# cp .env.example .env

Database Setup (Migrations)

Run the SQL files in migrations/ in order using your Supabase Query Editor.

  • Important: Ensure you run migrations/009_geo_spatial.sql and migrations/010_qa_hallucination.sql for V3.0 features.

Running

# Start the Interactive CLI (Wizard)
npm run cli

Note: On first run, you will be asked to select your language: English or Español.


Usage

CLI Mode

🌿 MENTHA CLI - AEO/GEO Intelligence Platform

--------------------------------------------------
   ✅ Project: MyBrand [ES]  |  🤖 OPENAI  |  🌍 ES
--------------------------------------------------

📋 MAIN MENU:

  1. 🚀 DASHBOARD & MONITORING
     (Keywords, Scan, Results)

  2. 🧠 KNOWLEDGE GRAPH (AEO)
     (Entities, Claims, JSON-LD)

  3. ⭐ AUTHORITY (E-E-A-T)
     (Authors, Clusters, Reviews)

  --------------------------------------------------
  4. ⚙️ SETTINGS
     (Project, Engine, Language)

  0. EXIT

API Mode

# Health check
curl http://localhost:3000/health

# List projects
curl http://localhost:3000/api/v1/projects

# Get entity JSON-LD
curl http://localhost:3000/api/v1/kg/entities/my-brand/jsonld

# Get llms.txt
curl http://localhost:3000/llms.txt

# Get Share of Model metrics
curl "http://localhost:3000/api/v1/dashboard/share-of-model?project_id=..."

Architecture

                    ┌─────────────────┐
                    │   CLI / API     │
                    └────────┬────────┘
                             │
         ┌───────────────────┼───────────────────┐
         ▼                   ▼                   ▼
  ┌─────────────┐    ┌─────────────┐    ┌─────────────┐
  │   Scan +    │    │  Knowledge  │    │   Edge      │
  │   Evaluate  │    │    Graph    │    │ Injection   │
  └──────┬──────┘    └──────┬──────┘    └──────┬──────┘
         │                  │                  │
         └──────────────────┼──────────────────┘
                            ▼
                   ┌─────────────────┐
                   │   PostgreSQL    │
                   │   (Supabase)    │
                   └─────────────────┘

Key Components

Path Description
src/app.ts Express server entry point
src/cli.ts Interactive CLI entry point
src/mcp-server.ts MCP server for AI agents
src/controllers/ API route handlers
src/domain/evaluation/ LLM-as-a-Judge logic
src/infrastructure/search/ Multi-provider LLM clients
src/infrastructure/rag/ RAG simulation for testing
src/infrastructure/redteam/ Adversarial testing
edge/ Cloudflare Worker for edge injection
migrations/ PostgreSQL schema files
docs/ Platform integration guides

Integration Options

Option 1: Cloudflare Worker (Enterprise)

The Worker intercepts HTML responses and injects JSON-LD automatically.

cd edge
npm install -g wrangler
wrangler deploy

See docs/PLATFORM_INTEGRATION.md for configuration.

Option 2: Native Integration (Self-Service)

Copy-paste code snippets for your platform.

See docs/NATIVE_INTEGRATION_SNIPPETS.md for:

  • WordPress (PHP)
  • Shopify (Liquid)
  • Wix (Velo)
  • Next.js (Middleware)
  • Express.js
  • Django (Python)
  • Laravel (PHP)

Database Schema

Core Tables

Table Purpose
tenants Organizations using Mentha
domains Verified domains per tenant
projects Brand monitoring projects
keywords Search queries to monitor
scan_jobs Scan execution records
scan_results LLM responses + evaluations

Knowledge Graph Tables

Table Purpose
entities Schema.org entities (Organization, Product)
entity_relationships Connections between entities
claims Verified facts about entities
faq_vectors FAQs with optional embeddings

E-E-A-T Tables

Table Purpose
authors Expert authors with credentials
content_clusters Topical authority modeling
aggregate_ratings Review aggregations
reviews Individual testimonials

Enterprise Tables

Table Purpose
ai_firewall_rules Bot blocking/allowing rules
edge_injection_config Per-URL injection settings
action_schemas SearchAction, OrderAction for agents

Contributing

Development Setup

# Install dependencies
npm install

# Run in development mode (hot reload)
npm run dev

# Run type checking
npm run typecheck

# Run linting
npm run lint

Code Style

  • TypeScript strict mode
  • ESM modules (.js imports)
  • Functional style where possible
  • Controllers → Domain → Infrastructure layering

Pull Request Process

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Write tests for new functionality
  4. Ensure npm run typecheck passes
  5. Commit with conventional commits (feat:, fix:, docs:)
  6. Push and open a Pull Request

Areas for Contribution

  • Additional LLM providers (Claude, Mistral)
  • Improved citation extraction
  • Dashboard UI (React/Next.js)
  • Scheduled probing worker
  • Document embedding with pgvector
  • WordPress plugin
  • Shopify app

API Reference

Full OpenAPI specification available at public/openapi.json.

Key endpoints:

Method Endpoint Description
GET /health Health check
GET /api/v1/projects List projects
POST /api/v1/projects Create project
GET /api/v1/keywords List keywords
POST /api/v1/scans Queue scan job
GET /api/v1/kg/entities List entities
GET /api/v1/kg/entities/:slug/jsonld Get JSON-LD
GET /llms.txt AI-readable content
GET /api/v1/dashboard/share-of-model Visibility metrics
GET /api/v1/edge/resolve-tenant Tenant lookup (for workers)

License

MIT License - see LICENSE for details.


Acknowledgments


Built with 🌿 by the Mentha team

About

Mentha-cli is the CLI for Mentha’s AEO/GEO platform to audit, measure, and optimize how AIs talk about your brand across ChatGPT, Claude, Perplexity, and Gemini — not SEO, not content.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published