Skip to main content

Content Analyzer Agent

Purpose

Retrieved web content is rarely directly useful in its raw form. A general article on stress management may contain dozens of recommendations, but only a subset is relevant to a user whose specific pattern involves a stress-sleep feedback loop with midweek peaks.

The Content Analyzer Agent acts as a contextual filter, processing retrieved content against the user's detected patterns, correlations, and objectives. Each extracted insight includes an explanation of its relevance to the user's data, a concrete recommended action, and a confidence assessment.

Current workflow usage

The agent is exported from src/mastra/agents/reasoning-engine/core/content-analyzer.ts, but the committed domain-retrieval workflow step does not invoke it. Current Step 4 uses the Query Generator Agent plus Perplexity search when configured, then assembles Perplexity synthesis/citations or local fallback context.

Value Proposition

  • Contextually filtered -- insights are selected based on the user's actual analytical findings, not generic applicability
  • Evidence-linked -- each finding can include supporting evidence from the source material
  • Action-oriented -- every insight is paired with a specific, implementable recommendation
  • Confidence-rated -- each insight carries a confidence level reflecting the strength of the supporting evidence

Processing Model

The Content Analyzer receives two inputs:

  1. Full webpage content -- the complete text of a retrieved resource
  2. User context -- the analytical objective, detected patterns, correlations, and temporal insights from prior pipeline stages

The agent then:

  1. Evaluates the content against the user's specific patterns and correlations
  2. Extracts findings with direct applicability to the detected patterns
  3. Explains the relevance of each finding to specific analytical results
  4. Formulates concrete recommended actions
  5. Assigns confidence levels based on evidence strength

Contextual vs. Generic Extraction

Generic SummaryContextual Extraction
"Article discusses stress management techniques""Progressive muscle relaxation before bed reduces cortisol -- directly relevant to the detected stress-sleep correlation (r=-0.82)"
"Mentions exercise benefits""Morning exercise reduces midweek stress accumulation -- applicable to the detected pattern of stress building Monday through Wednesday"
"Covers sleep hygiene""Consistent sleep schedule within 30-minute window improves quality -- the data shows sleep disturbance correlates with irregular timing patterns"

Example Output

{
"insights": [
{
"finding": "Progressive muscle relaxation before bed reduces stress-related sleep disruption by up to 40% in clinical studies",
"relevance": "Directly addresses the detected stress-sleep correlation (r=-0.82)",
"actionable": "Incorporate 10 minutes of progressive muscle relaxation into the bedtime routine on elevated-stress days",
"confidence": "high",
"evidence": "Meta-analysis of 15 clinical studies (2024) found consistent benefits for stress-related insomnia"
},
{
"finding": "Midweek stress peaks frequently correlate with accumulated cognitive load from the start of the work week",
"relevance": "Aligns with the detected pattern of stress consistently peaking midweek",
"actionable": "Consider scheduling high-cognitive-load tasks for Monday/Tuesday and lighter tasks for Wednesday/Thursday",
"confidence": "medium"
}
],
"summary": "Two findings directly relevant to the stress-sleep pattern. Strongest evidence supports bedtime relaxation techniques for stress-related sleep disruption."
}

Pipeline Position

The Content Analyzer can be used by consumers that explicitly run a separate content extraction flow. It is not currently part of the committed Step 4 path in reasoningEngineWorkflow.


Technical Reference

Identifiers

PropertyValue
Registry IDreasoning-engine-content-analyzer-agent
Profile IDreasoning-content-analyzer
Codesrc/mastra/agents/reasoning-engine/core/content-analyzer.ts
AccessorgetContentAnalyzerAgent()

Input Schema

{
"content": "Full webpage content...",
"sourceUrl": "https://example.com/article",
"sourceTitle": "Stress Management Techniques for Better Sleep",
"userContext": {
"objective": "Understand my stress patterns",
"temporalInsights": ["Stress increasing over 5 days"],
"patterns": [{ "name": "stress_cycle", "series": "stress", "detail": "..." }],
"correlations": [{ "series1": "stress", "series2": "sleep", "correlation": -0.82 }],
"hints": []
}
}

Output Schema

{
"insights": [
{
"finding": "string - Extracted finding from the source",
"relevance": "string - Connection to the user's specific patterns",
"actionable": "string - Concrete recommended action",
"confidence": "high | medium | low",
"evidence": "string? - Optional supporting quote or citation"
}
],
"summary": "string - Brief overview of extracted insights"
}

Configuration

Update the prompt via Admin tools, SQL, or API targeting the reasoning-content-analyzer profile.


Next Steps