Overview
ThegenerateArgumentBlueprint flow analyzes a topic, URL, or document to create a comprehensive, structured argument blueprint. It performs web searches, scrapes sources, detects logical fallacies, analyzes social media sentiment, and generates a detailed breakdown of arguments on both sides of an issue.
This is the core analysis engine of Argument Cartographer.
Function Signature
src/ai/flows/generate-argument-blueprint.ts:91
Input Schema
A topic query, URL, or document to analyze.
Input Type
Output Schema
The function returns a comprehensive analysis object containing:A structured JSON blueprint of the arguments. Each node represents a thesis, claim, counterclaim, or evidence.See Argument Node Schema for details.
A concise, neutral summary of the overall state of the debate.
AI-driven meta-analysis providing novel insights, identifying emerging themes, logical gaps, or the overall state of the debate.
A score from 1-10 rating the overall quality, diversity, and reliability of the sources found.
A candid, slightly cynical, ‘no-BS’ summary of the situation, written in simple, conversational language.
A list of 3-5 key takeaways or summary points.
A summary of the public sentiment and key discussion points on the topic from social media platform X (Twitter).
An array of relevant tweets from X/Twitter with author information and engagement metrics.
An array of logical fallacies detected in the source material.See Fallacy Detection Schema for details.
Output Type
How It Works
The flow executes the following pipeline:- Query Generation: Converts user input into an optimized 2-4 word search query
- Web Search: Performs dual web searches using Firecrawl to find diverse news sources
- Source Selection: Selects up to 8 unique domains from trusted news outlets
- Parallel Scraping: Batch scrapes selected URLs in parallel for maximum efficiency
- Context Assembly: Constructs research context from scraped articles (up to 12,000 chars per source)
- AI Analysis: Runs main analysis prompt with context to generate blueprint and detect fallacies
- Twitter Analysis: Fetches relevant tweets and generates social pulse summary
- Result Aggregation: Combines all outputs into final blueprint
Example Usage
Core Principles
The analysis follows these principles:- Objectivity is Paramount: Acts as a neutral synthesizer of information
- Depth and Detail: Identifies distinct lines of reasoning and supporting evidence
- Ground Everything in Sources: Every node must be tied to the provided context
- Detect Logical Fallacies: Actively scans source text for errors in reasoning
Fallback Behavior
The flow includes multiple fallback mechanisms:- If scraping fails, uses search snippets as context
- If search APIs are unavailable, generates analysis from training knowledge (limited mode)
- Validates and fixes AI output (e.g., credibility scores, null source URIs)
