# Understanding the Drafter-Reviewer Pipeline in the AI Job Search Framework

> Explore the drafter-reviewer pipeline for AI job search. This two-stage workflow uses distinct AI agents for accurate, ATS-compliant job applications. Learn how it works.

- Repository: [Mads Lorentzen/ai-job-search](https://github.com/MadsLorentzen/ai-job-search)
- Tags: internals
- Published: 2026-09-03

---

**The drafter-reviewer pipeline is a two-stage workflow that separates content generation from critical evaluation, using distinct AI agents to produce tailored job applications with higher accuracy and ATS compliance.**

The AI Job Search Framework by MadsLorentzen implements this architecture whenever the `/apply` command is invoked. By isolating drafting and reviewing responsibilities, the system reduces generic phrasing and ensures each CV and cover letter aligns precisely with the target job posting.

## How the Drafter-Reviewer Pipeline Works

The pipeline executes across five distinct phases, orchestrated through Claude Code agents and LaTeX compilation tools.

### Stage 1: Initial Drafting (Drafter)

When you trigger the `/apply` command with a job URL or raw text, the **drafter agent** parses the posting and evaluates fit against your candidate profile. According to the workflow overview in [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md)【README.md#apply】, the drafter then populates LaTeX templates to generate a tailored CV and cover letter. This agent focuses solely on content generation, pulling keywords from the job description and structuring achievements to match requirements.

### Stage 2: Spawning the Reviewer Agent

The framework launches a **second Claude Code agent** with a clean context that deliberately excludes the drafter's prompt history. As specified in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md)【.claude/commands/apply.md】, this isolation prevents the reviewer from inheriting the drafter's assumptions. The reviewer receives the drafts inline (not via file reads) and conducts independent research on the target company. It checks for missing keywords, weak framing, and generic language, then produces a structured critique.

### Stage 3: The Revision Loop

The drafter receives the reviewer's feedback as a **JSON list of concrete edits**. The drafter then revises the LaTeX sources in `cv/main_example.tex` and the cover letter templates accordingly. This loop may repeat until the reviewer reports no critical issues, ensuring iterative refinement without human intervention.

### Stage 4: PDF Compilation and ATS Verification

Once content is finalized, the pipeline compiles documents using specific LaTeX engines: **lualatex** for the CV and **xelatex** for the cover letter. The [`tools/verify_pdf.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tools/verify_pdf.py) script then checks page counts, layout sanity, and extracts the text layer to emulate an ATS parser. If layout problems are detected, the system applies automatic fixes using commands like `\needspace` or `\enlargethispage` to maintain professional formatting.

### Stage 5: Final Presentation

After PDF verification passes, the framework presents the final application package together with a human-readable checklist for user approval. This ensures you maintain full control over submissions while automating the tedious optimization work.

## Why a Two-Agent Architecture Matters

Separating drafting from reviewing gives each agent a focused context. The drafter concentrates on **content generation**, while the reviewer—operating with a fresh slate—can **critically evaluate** output without confirmation bias. This design reduces missed keywords, eliminates generic phrasing, and produces cleaner PDFs that survive automated applicant tracking systems.

## Implementing the Pipeline

Trigger the full workflow using the Claude Code CLI:

```bash

# Run the complete application pipeline for a specific job posting

claude /apply https://jobindex.dk/job/1234567

```

For programmatic integration, use Claude Code's Python SDK:

```python
from claude import ClaudeClient

client = ClaudeClient()
result = client.run_command(
    command="/apply",
    args=["https://jobindex.dk/job/1234567"]
)
print(result["final_output"])   # Contains compiled CV & cover-letter PDF links

```

You can also inspect the structured feedback for debugging or auditing:

```python
import json

# Parse the reviewer's JSON edit list

review_feedback = json.loads(result["reviewer_feedback"])
for edit in review_feedback:
    print(f"Edit: {edit['path']} – {edit['description']}")

```

## Key Files and Components

| File | Role in the Drafter-Reviewer Pipeline |
|------|----------------------------------------|
| [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md) | High-level description of the `/apply` workflow and pipeline architecture【README.md#apply】 |
| [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md) | Detailed command implementation, including reviewer agent spawning and edit return protocols【.claude/commands/apply.md】 |
| [`tools/verify_pdf.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tools/verify_pdf.py) | PDF verification, page-count validation, and ATS-text extraction logic |
| `cv/main_example.tex` | LaTeX CV template populated by the drafter before reviewer evaluation |
| `cover_letters/cover.cls` | Cover letter class file defining layout standards |
| `cover_letters/cover_example.tex` | LaTeX cover letter template compiled post-review |

## Summary

- The **drafter-reviewer pipeline** uses two isolated Claude Code agents to separate content creation from critical evaluation.
- The drafter generates tailored LaTeX documents based on job posting analysis, while the reviewer validates against company research and keyword alignment.
- Feedback travels as structured JSON between agents, enabling automated revision loops until quality thresholds are met.
- **lualatex** and **xelatex** handle PDF compilation, with [`tools/verify_pdf.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tools/verify_pdf.py) ensuring ATS compatibility through text-layer extraction and layout validation.
- All orchestration logic resides in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md), with workflow documentation in [`README.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/README.md).

## Frequently Asked Questions

### What is the drafter-reviewer pipeline in the AI Job Search Framework?

The drafter-reviewer pipeline is a two-stage automation workflow invoked by the `/apply` command. It uses one AI agent to draft tailored CV and cover letter content from LaTeX templates, then spawns a second agent with clean context to review, critique, and request revisions until the application meets quality standards.

### How does the reviewer agent avoid bias from the drafting process?

The framework explicitly launches the reviewer as a **fresh Claude Code agent** with no access to the drafter's prompt history or previous context. This clean-slate approach allows the reviewer to evaluate the drafts objectively without being influenced by the drafter's initial assumptions or reasoning patterns.

### Which LaTeX engines does the pipeline use for PDF generation?

The system uses **lualatex** specifically for compiling the CV and **xelatex** for the cover letter. This dual-engine approach optimizes rendering for different document structures, with [`tools/verify_pdf.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/tools/verify_pdf.py) subsequently verifying that the output meets ATS parsing requirements and contains no layout errors.

### How does the pipeline ensure applications pass ATS screening?

After compilation, [`verify_pdf.py`](https://github.com/MadsLorentzen/ai-job-search/blob/main/verify_pdf.py) extracts the text layer from each PDF to emulate an ATS parser, checking for readable content and proper structure. The tool validates page counts and layout sanity, automatically inserting LaTeX fixes like `\needspace` or `\enlargethispage` when formatting issues would otherwise cause parsing failures.