## TL;DR

Git emits a backslash-led marker line when a file lacks a trailing newline; naive parsers treat it as content and misalign every line after it. Recognize the marker line, skip it, and keep line counting accurate.

## Error

```text
\ No newline at end of file
Agent parser: treated the marker as a context line  -  all subsequent line numbers off by one.
```

## Steps

1. Confirm the misalignment: the parser's line numbers drift exactly at the marker line. Expected: the marker was counted as content.
2. Handle the marker: when a line starts with a backslash followed by ' No newline at end of file', skip it without advancing the content line counter. Expected: numbering stays correct.
3. Add a regression test with a diff that has the marker on both the old and new side. Expected: the parser handles both.
4. Re-run the review. Expected: comments anchor to the right lines.

## When to use

- The agent's diff parser misaligns lines around the no-newline marker.
- The agent parses unified diffs itself.

## When not to use

- The parser handles the marker but misaligns elsewhere  -  different bug.
- The agent uses the API's parsed diff; the marker is already handled there.

## Tool compatibility

- Any hand-rolled unified-diff parser.
- Git-generated diffs.

## Variant phrasings

### Marker on the removed side only

The old-file line count is affected; skip the marker on both sides symmetrically.

### Multiple markers in one diff

Each file boundary can have one  -  the skip logic must be per-occurrence, not one-shot.

## Why it happens

The marker is metadata about the preceding line, not a diff line itself  -  but it looks like content to a parser that only checks the first character. Counting it shifts every subsequent line number by one.

## Edge cases

- In the error block above, the marker is shown with its literal leading backslash  -  a single backslash, which is correct and must be preserved by the parser.
- Some tools strip the marker when generating diffs; handle both its presence and absence.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_Qx8T89Dg9C_E0GXdwzLSHQ
