## TL;DR
Resolve citations against the fully-amended text, never the base document. Build a versioned clause map keyed by (section, amendment chain) and apply every amendment in effective-date order before the agent looks up any cross-reference. "As amended by Amendment No. 2" is a pointer into the post-amendment document, so resolving it against the original text silently reads wording that is no longer operative.

```text
clause points to "Section 4.2 of the Original Agreement as amended by Amendment No. 2"  -  the agent resolved it against the unamended text
```

## Steps
1. Index every amendment in effective-date order, parsing the effective date from the amendment text itself, not from the filename or upload time.
   Expected: each amendment has an effective-date field; the order matches the legal sequence
2. Build a layered section map: for each numbered section, stack the base text then each amendment's replacement text on top.
   Expected: "Section 4.2" resolves to a stack of versions, each tagged with the amendment that produced it
3. Parse the citation's amendment qualifier ('as amended by Amendment No. 2') as a version selector, and resolve the citation to that layer of the stack.
   Expected: the resolved text comes from the Amendment 2 version of Section 4.2, not the base
4. Add a regression check that diffs the resolved text against the base text whenever a qualifier is present; if they are identical, the qualifier was ignored and the resolution is flagged.
   Expected: every citation resolution logs which amendment layer it came from
5. Re-run the full extraction suite after this change and confirm no citation with an amendment qualifier points at raw base text.
   Expected: zero qualifier-bearing citations resolve against the unamended text

## Use this when
- A citation names an amendment: "as amended by Amendment No. 2", "as restated by Amendment 3".
- The agent extracts clauses from agreements that have an amendment chain.
- Resolved text looks subtly wrong but matches the original agreement.
- You are auditing an extraction pipeline and want citation-resolution correctness.

## Not for this skill when
- The contract is a single version with no amendments.
- The reference carries no amendment qualifier; it is a plain section pointer.
- You need legal interpretation of what the clause means, not a fix for which text was resolved.
- The wrong text came from OCR or PDF parsing, not from version selection.

## Variant phrasings
### agent resolved against the original agreement instead of the amended version
### clause citation ignores the amendment chain
### "as amended by" qualifier dropped by the extraction agent
### cross-reference points at pre-amendment wording

## Why it happens
Agents usually resolve citations eagerly against the base document and apply amendments in a separate, later pass (or never). Because the base and the amended version share section numbers, the wrong hit looks exactly right: the section exists, the text is plausible, and nothing errors. The failure is silent by construction.
## Edge cases
- An amendment restates only part of a section; the untouched paragraphs of the base text are still live. Resolve paragraph-level, not section-level.
- The qualifier names an amendment the agent does not have. Raise a missing-document warning; never guess what the amendment said.
- Effective date and signing date disagree. Order by effective date; use signing date only as a tiebreak.
- Multiple amendments touch the same section. The qualifier selects one layer; without a qualifier, the latest effective layer wins.

## Provenance

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