# Intel agent failed to detect an amended filing superseding the original

## TL;DR
Missing an amendment means the briefing uses superseded numbers while the world moved on. The fix is amendment-aware intake: for every filing consumed, check EDGAR for a newer /A form covering the same period, and prefer it. Record the accession used so the briefing's provenance names the amendment, not the original.

## The error
```text
(stale data)
intel agent failed to detect amended filing superseding original; briefing used 10-K, 10-K/A existed
```

## When this helps
- an agent misses amended filings
- briefings use superseded numbers
- building amendment-aware intake
- auditing filing provenance

## When it doesn't
- no amendment exists; the original stands
- the amendment only adds exhibits; numbers are unchanged
- you need as-filed history; cite both explicitly

## Works with
EDGAR browse and archives as of 2026; curl 7.x+, python 3.8+.

## Steps
### 1. Check for amendments covering each consumed period
```bash
curl -s -A "IntelBriefingBot/1.0" "https://www.sec.gov/cgi-bin/browse-edgar?action=getcompany&CIK=[cik]&type=10-K&count=10" -o filings.html
grep -o "10-K/A" filings.html | wc -l
```
Expected: The amendment count. Any /A for a consumed period means the original is stale.

### 2. Resolve every period to its latest accession
```python
import re
html = open("filings.html").read()
acc = re.findall(r"\d{10}-\d{2}-\d{6}", html)
print("latest accession:", acc[0] if acc else "none")
print("intake uses the latest accession per period, always")
```
Expected: The newest accession. Intake keys on latest-per-period, never on first-found.

### 3. Re-run the extraction when an amendment appears
```python
import json
state = {"period": "FY2026", "accession_used": "[old]", "latest": "[new]"}
if state["accession_used"] != state["latest"]:
    print("amendment detected: re-extract from", state["latest"])
open("amend_state.json", "w").write(json.dumps(state))
```
Expected: A re-extract trigger. Amendments invalidate cached extractions for that period.

### 4. Cite the amendment in the briefing provenance
```python
import json
cite = {"form": "10-K/A", "accession": "[new]", "period": "FY2026"}
open("citation.json", "w").write(json.dumps(cite, indent=2))
print("provenance names the amendment")
```
Expected: An amendment citation. Readers see the numbers came from the corrected filing.

## Other ways people phrase this
### amended filing superseding original missed
Check for /A forms per period. Latest accession wins.

### 10-k/a not detected agent
Intake must key on latest-per-period, not first-found.

### stale filing data amendment
Amendments invalidate cached extractions. Re-extract and re-cite.

## Why it happens
Amendments supersede originals, but intake pipelines that cache the first filing they see never look back. EDGAR lists amendments alongside originals; the pipeline must check for /A forms per period and prefer them. Provenance that names the accession makes staleness visible.

## Edge cases
- Amendments can lag by months; re-check consumed periods on a schedule.
- Some amendments restate multiple periods; map each one.
- 8-K/A works the same for event disclosures.
- A period with no amendment keeps the original; absence of /A is fine.

## Provenance

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