How the Drafter Agent Works in AI Job Search: An 8-Step Technical Breakdown

The drafter agent is the first Claude Code agent that parses job postings, generates tailored LaTeX CVs and cover letters from your candidate profile, and orchestrates a structured review loop to produce ATS-optimized PDFs.

In the MadsLorentzen/ai-job-search repository, the drafter agent serves as the core engine behind the /apply command. This specialized agent transforms raw job descriptions into polished application materials by coordinating with a secondary reviewer agent through a token-efficient, file-based workflow defined in .claude/commands/apply.md and documented in the repository's core workflow section.

The Drafter Agent's Role in the /apply Pipeline

The drafter agent initiates the application process during the /apply command execution. According to the repository's README, it is the first of two specialized Claude Code agents responsible for creating the initial application deliverables—specifically the cv_draft.tex and cover_letter.tex files.

The agent operates under strict constraints defined in .claude/commands/apply.md and relies exclusively on immutable source files including:

Step-by-Step Workflow of the Drafter Agent

Step 1: Parse the Job Posting

The drafter receives the raw job posting—either via URL or pasted text—and extracts required skills, responsibilities, and hard constraints. This parsing logic follows the specifications outlined in README.md (lines 25-27), ensuring no critical requirements are missed before generation begins.

Step 2: Evaluate Fit Against the Candidate Profile

Using the evaluation rubric defined in .claude/skills/job-application-assistant/04-job-evaluation.md, the agent scores the posting against the user's profile. This step ensures the drafter only proceeds with high-quality matches and understands which specific experiences to emphasize in the drafts.

Step 3: Generate LaTeX Drafts

The drafter populates the active LaTeX templates (cv/main_example.tex for the CV and cover.cls for the cover letter) with data from 01-candidate-profile.md. It produces two files in memory:

  • cv_draft.tex
  • cover_letter.tex

These drafts remain in the agent's working memory rather than being written to disk immediately, enabling efficient string manipulation during the revision phase.

Step 4: Inline Hand-off to the Reviewer Agent

Rather than saving drafts to disk for the reviewer to read, the drafter embeds the full text of both LaTeX files inline within the reviewer agent's prompt. As specified in .claude/commands/apply.md (lines 97-103), this inline hand-off saves tokens and guarantees the reviewer works on the exact version the drafter just produced.

Step 5: Reviewer Critique and JSON Feedback

A fresh Claude Code reviewer agent researches the target company and returns structured feedback formatted as a JSON array of concrete edits. According to the apply command specification (lines 151-160), each edit object includes:

  • file: The target filename
  • old_string: Exact text to replace
  • new_string: Replacement text
  • reason: Classification (e.g., "grounding", "formatting", "keywords")

Step 6: Apply Structured Edits Using the Edit Tool

The drafter consumes the JSON edit list and applies each change to the in-memory drafts using the Edit tool. Because the drafts never left memory, the drafter can safely execute exact string replacements without re-reading files from disk. This process is documented in .claude/commands/apply.md under "Apply Part A (structured edits)" (lines 182-191).

Step 7: Compile LaTeX and Verify PDF Constraints

After revisions, the drafter compiles the LaTeX files using lualatex for the CV and xelatex for the cover letter. It then runs an optional ATS-check using pdftotext to verify text extraction quality. The verification loop ensures the final output meets strict page limits: 2 pages maximum for the CV and 1 page for the cover letter, as noted in README.md (lines 36-39).

Step 8: Present Final Output

The polished PDFs, accompanied by a verification checklist, are presented to the user as the final deliverables of the /apply command.

Technical Implementation: The JSON Edit Contract

The communication protocol between drafter and reviewer relies on a strict JSON schema. The reviewer returns edits in this format:

[
  {
    "file": "cv_draft.tex",
    "old_string": "Senior Data Scientist at Acme Corp (2020-2023)",
    "new_string": "Senior Data Scientist at Acme Corp (Jan 2020 – Mar 2023)",
    "reason": "formatting"
  },
  {
    "file": "cover_letter.tex",
    "old_string": "I have extensive experience with Python.",
    "new_string": "I have 5 years of experience building data pipelines in Python.",
    "reason": "grounding"
  }
]

The drafter validates each edit against the in-memory document state before applying it via the Edit tool, ensuring atomic updates and preventing partial application failures.

Running the Drafter Agent

To trigger the complete drafter-reviewer pipeline with a live job posting:

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

The command automatically executes all eight steps, from initial parsing through PDF verification. The drafter handles the entire orchestration, including spawning the reviewer agent and processing its feedback, without requiring manual intervention.

Summary

  • The drafter agent is the primary Claude Code agent in the /apply command that generates LaTeX application documents.
  • It sources all factual claims exclusively from .claude/skills/job-application-assistant/01-candidate-profile.md and template files.
  • The inline hand-off mechanism passes draft content directly to the reviewer agent without intermediate file writes, optimizing token usage.
  • Reviewer feedback follows a strict JSON edit list format that the drafter applies using the Edit tool on in-memory documents.
  • Final compilation uses lualatex (CV) and xelatex (cover letter) with automated ATS verification and strict page constraints.

Frequently Asked Questions

What is the difference between the drafter agent and the reviewer agent?

The drafter agent generates the initial LaTeX files and executes revisions, while the reviewer agent provides independent fact-checking and quality control. The reviewer researches the company and returns structured JSON feedback, but does not modify files directly—the drafter applies all edits.

How does the drafter agent achieve token efficiency?

By embedding the full LaTeX draft content inline in the reviewer prompt rather than writing files to disk and requiring the reviewer to read them, the system avoids redundant token consumption. This inline hand-off pattern ensures the reviewer sees the exact draft state while minimizing context window usage.

Which source files does the drafter agent read during execution?

The drafter reads the candidate profile from .claude/skills/job-application-assistant/01-candidate-profile.md, evaluation criteria from 04-job-evaluation.md, and LaTeX templates from cv/main_example.tex and cover.cls. All factual claims in the final documents must be traceable to these immutable source files.

What LaTeX engines does the drafter agent use for compilation?

The drafter uses lualatex to compile the CV and xelatex for the cover letter. This dual-engine approach ensures optimal font rendering and layout fidelity across both documents before the final ATS compliance check.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →