# Spec Delta ## Purpose Compaction keeps the memory store and skill library small, current, and auditable: stale entries are marked, duplicates are merged by fixed rules, and nothing is rewritten or deleted. ## ADDED Requirements ### Requirement: Stale detection `flywheel.py verify` SHALL report active entries whose backticked repo-relative paths (containing a slash) no longer exist, and with `--apply` SHALL mark them stale and refresh `last_verified` on entries whose paths all exist. #### Scenario: Referenced file deleted - **GIVEN** an active entry that names `` `src/old/file.ts` `` and that file does not exist - **WHEN** `flywheel.py verify --apply` runs - **THEN** the entry has `status: stale` and is no longer in the index #### Scenario: Bare file names are not checked - **GIVEN** an entry that mentions `` `SKILL.md` `` without a folder - **WHEN** `flywheel.py verify` runs - **THEN** the entry is not reported as stale ### Requirement: Duplicate detection `flywheel.py dupes` SHALL list pairs of active entries whose token Jaccard similarity is at or above the configured threshold, in a deterministic order. #### Scenario: Two entries about the same lesson - **GIVEN** two active entries with largely the same words - **WHEN** `flywheel.py dupes` runs - **THEN** the pair is listed with its score ### Requirement: Fixed representative and no rewriting When duplicates are merged, the representative SHALL be chosen by more occurrences, then more recent `last_verified`, then longer body, then name order; the other entry's sources SHALL be added to it, the other entry SHALL be marked superseded, and no entry text SHALL be rewritten or deleted. #### Scenario: Merge keeps the entry with more occurrences - **GIVEN** entry A with 2 occurrences and entry B with 1 occurrence and a newer date - **WHEN** the compaction pass merges them - **THEN** A is kept, B's sources are added to A, and B is superseded by A ### Requirement: Human decisions for contradictions and retirement Resolving a contradiction or deprecating a skill SHALL require explicit human approval; a deprecated skill keeps its folder with `status: deprecated`. #### Scenario: Skill retired - **GIVEN** a skill whose latest eval results fail the gate - **WHEN** the user approves its retirement - **THEN** its frontmatter has `status: deprecated` and a `deprecated_reason`, and the folder remains