## TL;DR
Incremental chains are ordered by the backup product sequence semantics, not by filename or modification time, and agents that sort naively break when numbers roll over, reset after a full, or arrive out of order from the API. Read the sequence from product metadata, sort by it, detect gaps and duplicate sequences as findings, and only then diff chain state.

```text
agent's diff of the incremental chain broke on out-of-order sequence numbers and failed the check
```

## Use this when
- Agent chain checks fail or report false gaps on healthy chains.
- Problems start after a new full backup resets sequence numbers.
- API returns chain members in non-sequential order and the agent trusts it.

## Not for this skill when
- Chain files are genuinely missing. That is data loss the diff correctly senses.
- A single backup file is corrupt. Integrity problem, not ordering.

## Steps
1. Collect chain metadata for several healthy chains and document how sequence values behave across fulls and rollovers. Verify: the sequence semantics are written down
2. Change the agent to order chain members by product sequence metadata, never by name or timestamp. Verify: shuffled API output produces the same ordered chain in tests
3. Add explicit handling for sequence resets at full backups, treating a reset as a new chain segment. Verify: chains spanning a full validate cleanly
4. Report true gaps and duplicates as findings with chain context instead of a generic diff failure. Verify: a seeded gap produces a precise report
5. Run the checker across all production chains. Verify: healthy chains pass and only real gaps are reported

## Variant phrasings
### incremental chain sequence order agent check
The ordering phrasing.
### backup chain diff false gap rollover
The rollover variant.
### sequence reset full backup chain validation
The reset wording.

Compatibility: Agents validating Veeam, restic-style and proprietary incremental chains via product APIs and catalog metadata.

## Why it happens
Sequence numbers are an internal ordering key with wrap and reset behaviour that filenames only approximate. An agent diffing in arrival or lexical order manufactures disorder that the product never had, then reports it as chain damage, eroding trust in real findings. Using the product own ordering semantics aligns the checker with the system it checks.

## Edge cases / pitfalls
- Lexical sort puts 10 before 2. Numeric extraction is a minimum, product metadata is the answer.
- A gap can mean a backup was deleted legitimately. Correlate with retention before declaring damage.
- Keep chain validation read-only. A checker that tidies as it goes destroys evidence.

## Provenance

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