---
title: "Phase 2: Cleaning and Organizing the Data"
description: Use the research agent to decide how to extract EML files, then build the converter and download images.
---

# Phase 2: Cleaning and Organizing the Data

Now that you have a research agent, use it to decide how to extract EML files to markdown. The agent evaluates options, considers your environment, and documents findings. Then you build the converter based on that research — and discover that the plain text emails are already markdown, a simplification you'd miss by jumping straight to code.

The key pattern in this phase: **Discovery before implementation**. Let the agent examine the data before writing any code.

## Lessons

1. **[Research → Build Converter](/content-repurpose/02-extraction/04-eml-to-markdown/)** — Ask the research agent to evaluate extraction approaches, then build the converter based on its recommendations. Discover that plain text emails are already markdown.

2. **[Image Extraction](/content-repurpose/02-extraction/05-image-download/)** — Download and deduplicate images from emails, replace remote URLs with local paths, and handle edge cases like tracking pixels.
