# How Edits from the Reviewer Agent Are Applied in the AI Job Search Workflow

> Discover how reviewer agent edits are applied in the AI job search workflow. Learn about the two-stage pipeline and agent collaboration for effective edits.

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

---

**Edits from the reviewer agent are applied through a two-stage pipeline where structured string replacements are executed mechanically via the Edit tool while narrative suggestions are handled manually by the drafter agent.**

When you trigger the `/apply` command in the MadsLorentzen/ai-job-search repository, the workflow enters a sophisticated review phase where a dedicated reviewer agent critiques your cover letter and CV. Understanding how edits from the reviewer agent are applied reveals a hybrid approach that combines deterministic string replacement with creative iteration. The implementation, documented in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md), splits feedback into structured mechanical edits and high-level narrative guidance.

## The Reviewer Agent Feedback Structure

The reviewer agent returns a structured JSON payload containing two distinct parts that the apply pipeline processes sequentially.

### Part A – Structured Edits

This component contains a list of objects, each specifying the **target file**, the exact string to replace (`old_string`), and the replacement content (`new_string`). These are deterministic, low-level changes that require no interpretation. For example, the reviewer might identify a specific typo or formatting inconsistency that must be corrected.

### Part B – Narrative Suggestions

This section contains higher-level advice such as "add a company-specific angle" or "re-phrase passive language." Unlike Part A, these suggestions require creative interpretation and contextual understanding. The drafter agent must weave in verified company facts and rewrite prose according to the style rules defined in [`.claude/skills/job-application-assistant/03-writing-style.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/03-writing-style.md).

## The Apply Pipeline Workflow

The transition from Step 3 to Step 6 in the apply workflow handles the reviewer feedback through a precise sequence of operations.

### Step 4 – Parsing the Reviewer Response

After the reviewer agent completes its critique, the system parses the JSON payload to separate Part A (structured edits) from Part B (narrative suggestions). This parsing happens in-memory, meaning the original draft content remains available for immediate modification without requiring disk re-reads.

### Step 5 – Mechanical Application via the Edit Tool

Part A edits are applied deterministically using the **Edit tool**. For each entry in the structured edits list, the tool receives the `file`, `old_string`, and `new_string` parameters. This approach ensures exact string replacement without hallucination or drift. According to [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md), this step applies Part A edits directly with the Edit tool, ensuring safe, unambiguous modifications to [`cover_letter.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/cover_letter.md) and [`cv.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/cv.md).

### Step 6 – Manual Handling of Narrative Suggestions

Part B feedback bypasses the Edit tool entirely. Instead, the drafter agent interprets each suggestion type—whether inserting company-specific facts or rephrasing passive constructions—and generates revised prose. This step requires the language model to exercise creative judgment, verifying facts against the company research gathered earlier in the workflow.

## Implementing the Edit Application in Code

The following Python implementation illustrates how the apply command consumes and processes the reviewer agent's response:

```python

# Assume `review_response` is a dict returned by the reviewer agent

edits = review_response["part_a"]          # List of {file, old_string, new_string}

suggestions = review_response["part_b"]    # Free-form advice

# Part A – apply deterministic edits

for edit in edits:
    EditTool.apply(
        file=edit["file"],
        old_string=edit["old_string"],
        new_string=edit["new_string"]
    )

# Part B – handle narrative suggestions (example)

for s in suggestions:
    if s["type"] == "company_specific":
        draft = insert_verified_fact(draft, s["content"])
    elif s["type"] == "rephrase":
        draft = rephrase_passive(draft, s["content"])

# Finally, write updated drafts to disk

write_file("cover_letter.md", draft_cover_letter)
write_file("cv.md", draft_cv)

```

This implementation ensures that Part A changes are applied atomically and verifiably, while Part B changes benefit from the drafter agent's ability to maintain narrative flow and tone consistency.

## Configuration and Source Files

The apply workflow relies on several key files that define how edits from the reviewer agent are processed:

- [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md) – Describes the full workflow, including the split between Part A (Edit tool) and Part B (manual revision) processing
- [`.claude/commands/rank.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/rank.md) – Demonstrates the contrast: the `/rank` command runs without a reviewer agent, confirming that reviewer-generated edits are unique to the `/apply` workflow
- [`.claude/commands/interview.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/interview.md) – References reviewer-style feedback patterns also used in interview preparation, reinforcing the same edit-application architecture
- [`.claude/skills/job-application-assistant/03-writing-style.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/03-writing-style.md) – Defines the style rules that the reviewer enforces, which subsequently generate the structured edits in Part A
- [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) – Lists the overall workflow steps, explicitly documenting the "Spawn a reviewer agent" phase and the "Apply Part A edits directly with the Edit tool" step

## Summary

- Edits from the reviewer agent are split into **Part A (structured string replacements)** and **Part B (narrative suggestions)**.
- Part A edits are applied mechanically using the **Edit tool** with `file`, `old_string`, and `new_string` parameters.
- Part B suggestions are processed manually by the drafter agent to incorporate creative changes and verified company facts.
- The workflow is defined in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md) and progresses through Steps 4, 5, and 6 of the apply pipeline.
- This dual approach ensures deterministic safety for simple edits while preserving creative flexibility for content improvements.

## Frequently Asked Questions

### What is the difference between Part A and Part B reviewer feedback?

Part A contains **structured edits** with exact string replacements specified as `old_string` and `new_string` values targeting specific files. Part B contains **narrative suggestions**—high-level advice like adding company-specific angles or rephrasing passive language that requires creative interpretation rather than mechanical replacement.

### Why are narrative suggestions not applied using the Edit tool?

Narrative suggestions in Part B require contextual understanding, fact verification, and creative rewriting that cannot be reduced to simple string substitution. The Edit tool performs deterministic replacements, whereas Part B changes involve the drafter agent exercising judgment to weave in verified company facts and maintain consistent tone according to the style guide.

### Which files control the reviewer agent behavior?

The primary workflow definition resides in [`.claude/commands/apply.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/apply.md), while the style rules the reviewer enforces are defined in [`.claude/skills/job-application-assistant/03-writing-style.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/03-writing-style.md). The [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) file documents the overall workflow steps, and [`.claude/commands/interview.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/interview.md) shows similar reviewer patterns used in interview preparation.

### How does the apply workflow differ from the rank command?

The `/apply` command spawns a reviewer agent that generates Part A and Part B feedback for iterative refinement of cover letters and CVs. The `/rank` command, as documented in [`.claude/commands/rank.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/commands/rank.md), executes without a reviewer agent, performing initial job matching and prioritization without the multi-stage edit application process unique to `/apply`.