# Spec Delta ## Purpose Promotion turns lessons that recurred across distinct changes into skills or constitution rules, through an evaluation gate followed by explicit human approval. ## ADDED Requirements ### Requirement: Recurrence threshold A memory entry SHALL become a promotion candidate only when it is active, of type observation, feedback, or decision, and its distinct source changes reach `promotion.min_occurrences`. #### Scenario: Below the threshold - **GIVEN** a feedback entry with one source change and a threshold of 2 - **WHEN** `flywheel.py candidates` runs - **THEN** the entry is not listed #### Scenario: At the threshold - **GIVEN** an observation entry with sources `[add-a, add-b]` and a threshold of 2 - **WHEN** `flywheel.py candidates` runs - **THEN** the entry is listed with the suggested target `skill` ### Requirement: Drafts stay in the change folder A promotion draft SHALL be written only inside `openspec/changes/promote-/` and MUST NOT be written to the skill library or the constitution before approval. #### Scenario: Gate passed, no answer yet - **GIVEN** a draft skill that passed its evaluation gate - **WHEN** the user has not approved it - **THEN** nothing is written to `.claude/skills/` and no entry is marked promoted ### Requirement: Gate, then approve A promoted skill SHALL pass the evaluation gate (every eval at its min_score, at least `eval.min_evals` evals, no constitution violation) before a human is asked, and SHALL carry `promoted_from`, `approved_by`, `date`, and `eval` fields once installed. #### Scenario: Promoted skill without provenance - **GIVEN** a skill with `promoted_from` and no `approved_by` - **WHEN** `flywheel.py check` runs - **THEN** it reports an error #### Scenario: Promoted skill below the gate - **GIVEN** a promoted skill whose `eval.score` is below `eval.min_score` - **WHEN** `flywheel.py check` runs - **THEN** it reports an error ### Requirement: Recorded gate result The `eval` field of a promoted skill MUST be a map with a numeric `score` at or above `eval.min_score`, a non-empty `models` list, and a `date` (YYYY-MM-DD). `flywheel.py check` SHALL report an error for any other form, so a gate result cannot be recorded as a bare number. #### Scenario: Eval recorded without models or date - **GIVEN** a promoted skill with `eval: {score: 0.95}` - **WHEN** `flywheel.py check` runs - **THEN** it reports that `eval.models` and `eval.date` are missing #### Scenario: Eval recorded as a bare number - **GIVEN** a promoted skill with `eval: 0.1` - **WHEN** `flywheel.py check` runs - **THEN** it reports that `eval` must be a map ### Requirement: Constitution rule gate A constitution rule SHALL be added only after a contradiction check against existing rules, a regression check on recently archived changes, and human approval. #### Scenario: Rule would fail accepted work - **GIVEN** a draft rule and an archived change that the judge finds would violate it - **WHEN** the rule gate runs - **THEN** the rule is not added and both are shown to the user ### Requirement: Source entries are marked promoted On approval, every source entry SHALL be set to `status: promoted` with `promoted_to` naming an existing skill in the skill library or `constitution`, which removes it from the index. `flywheel.py set-status` MUST refuse a `--promoted-to` skill that does not exist, and `flywheel.py check` SHALL report a promoted entry whose `promoted_to` names no existing skill. #### Scenario: Entry promoted - **GIVEN** an active entry and an installed skill `ascii-punctuation` - **WHEN** `flywheel.py set-status promoted --promoted-to ascii-punctuation` runs - **THEN** the entry has `status: promoted` and is no longer listed in `MEMORY.md` #### Scenario: Promotion to a skill that does not exist - **GIVEN** an active entry and no skill named `ghost-skill` - **WHEN** `flywheel.py set-status promoted --promoted-to ghost-skill` runs - **THEN** the command fails, names the missing skill, and the entry is unchanged