## TL;DR
Invalidate cached clause extractions when an amendment replaces them. Parse each amendment's replacement targets ("Section 12 is replaced in its entirety"), purge the cached extraction for those sections, and re-extract from the amendment text. The cache assumed sections are immutable, so the 2023 IP assignment kept serving after Amendment 6 replaced it.

```text
agent applied the MSA's 2023 IP assignment language  -  Amendment 6 replaced it and the agent never re-extracted
```

## Steps
1. Parse every amendment for replacement targets: section numbers named with 'replaced', 'restated', 'deleted', or 'superseded'.
   Expected: Amendment 6 yields an affected-sections list including the IP assignment section
2. Purge cached extractions for affected sections the moment the amendment is ingested.
   Expected: the 2023 IP assignment extraction is gone from the cache, not merely flagged
3. Re-extract the affected clauses from the amendment text itself.
   Expected: the current IP assignment language comes from Amendment 6
4. Add a staleness check: any extraction older than the newest amendment touching its section is dirty and must be rebuilt before use.
   Expected: dirty extractions block the report instead of shipping
5. Record the replacement chain per clause: which amendment replaced which text, in order.
   Expected: the operator sees the 2023 text and the Amendment 6 text as a linked history

## Use this when
- An amendment replaced a clause and the agent still quotes the old language.
- Cached extractions survive amendments that should have invalidated them.
- IP assignment, confidentiality, or liability language looks pre-amendment in output.
- You are auditing cache correctness in a multi-amendment pipeline.

## Not for this skill when
- The amendment only clarifies the clause without replacing it; the old extraction may still be valid.
- There are no amendments; the cache is fine.
- The clause text is identical before and after; re-extraction changes nothing.
- The question is what the clause means legally, not which version was extracted.

## Variant phrasings
### agent quoted superseded clause language after amendment
### cached extraction not invalidated by amendment
### Amendment 6 replaced the clause, agent used the old text
### stale clause cache in contract review pipeline

## Why it happens
Caches are keyed by (document, section) on the assumption that a section's text does not change. Amendments break that assumption by design: they replace section text without touching the base document. The cache key still hits, the old text still looks fresh, and nothing in the pipeline connects "Amendment 6 replaced Section 12" to "the cached Section 12 extraction is dead".
## Edge cases
- The amendment replaces a section partially ("the second paragraph of Section 12 is replaced"). Invalidate at paragraph granularity, not section granularity.
- The amendment is later superseded by another amendment. The invalidation chain must follow effective-date order to land on the truly current text.
- The replacement text lives in an exhibit attached to the amendment. Ingest the exhibit as part of the amendment before re-extracting.
- The cache is shared across deals. Scope invalidation to the deal bundle; a Section 12 replacement in one MSA must not purge another deal's cache.

## Provenance

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