---
phase: 08-coherence-engine
plan: 02
type: execute
wave: 2
depends_on: ["08-01"]
files_modified:
  - .claude/skills/create-track/steps/03-verify-and-save.md
  - reference/templates/discography-template.md
autonomous: true

must_haves:
  truths:
    - "Each generated track is logged in discography.md with title, date, themes, emotions, and language"
    - "Discography stats include emotion distribution with counts per emotion"
    - "Discography stats include theme counts"
    - "Discography stats show which emotions from the palette have not been explored yet"
    - "Stats are recomputed from the full table on every update, never incremented"
  artifacts:
    - path: ".claude/skills/create-track/steps/03-verify-and-save.md"
      provides: "Enhanced discography update instructions with recompute rule"
      contains: "RECOMPUTER"
    - path: "reference/templates/discography-template.md"
      provides: "Enhanced stats section with emotion distribution, theme counts, unexplored emotions"
      contains: "Distribution emotionnelle"
  key_links:
    - from: ".claude/skills/create-track/steps/03-verify-and-save.md"
      to: "reference/templates/discography-template.md"
      via: "Step 03 follows the template structure when updating discography"
      pattern: "discography"
    - from: "reference/templates/discography-template.md"
      to: "artists/[name]/bible.md"
      via: "Stats reference bible palette for unexplored emotions"
      pattern: "palette|bible|emotions"
---

<objective>
Enhance discography logging with richer metadata and stats (COH-05).

Purpose: The cross-track analysis (Plan 08-03) needs pre-computed stats to work efficiently. Currently, discography stats only track total tracks, languages, and a theme list. Phase 8 enriches this with emotion distribution, theme counts, unexplored emotions, and a "recompute don't increment" rule to prevent stats drift.

Output: Updated `discography-template.md` with enriched Stats section. Updated `03-verify-and-save.md` with enhanced discography update instructions.
</objective>

<execution_context>
@C:/Users/zekho/.claude/get-shit-done/workflows/execute-plan.md
@C:/Users/zekho/.claude/get-shit-done/templates/summary.md
</execution_context>

<context>
@.planning/PROJECT.md
@.planning/ROADMAP.md
@.planning/STATE.md
@.planning/phases/08-coherence-engine/08-RESEARCH.md
@.planning/phases/08-coherence-engine/08-01-SUMMARY.md
@.claude/skills/create-track/steps/03-verify-and-save.md
@reference/templates/discography-template.md
@.claude/skills/create-artist/examples/example-bible.md
</context>

<tasks>

<task type="auto">
  <name>Task 1: Enhance discography template with enriched Stats section</name>
  <files>reference/templates/discography-template.md</files>
  <action>
Update the Stats section of `reference/templates/discography-template.md` to include richer metadata fields. Replace the current basic Stats section with:

```markdown
## Stats

- **Total tracks :** 0
- **Langues utilisees :** --
- **Themes explores :** --
- **Distribution emotionnelle :** --
- **Emotions non-explorees :** --
- **Dernier theme :** --
```

Field definitions (these are for Claude executing the workflow, not displayed in the template):
- **Total tracks:** recomputed count of rows in the Tracks table
- **Langues utilisees:** deduplicated list of languages from the Langue column
- **Themes explores:** deduplicated list of all themes with occurrence count, format: "theme (N), theme (N)" sorted by count descending
- **Distribution emotionnelle:** count per emotion from the Emotions column, format: "Emotion (N), Emotion (N)" sorted by count descending
- **Emotions non-explorees:** emotions from the artist's bible palette (primaires + secondaires) that do NOT appear in any track's Emotions column
- **Dernier theme:** theme(s) from the most recent track (last row of table)

Keep the existing frontmatter (`last-updated: [date]`), title format (`# [Nom de l'Artiste] - Discographie`), Tracks table, and HTML comment unchanged. Only modify the Stats section.
  </action>
  <verify>
Read `reference/templates/discography-template.md` and confirm:
1. Stats section contains all 6 fields: Total tracks, Langues utilisees, Themes explores, Distribution emotionnelle, Emotions non-explorees, Dernier theme
2. Tracks table and frontmatter are preserved unchanged
3. HTML comment is preserved
  </verify>
  <done>Discography template includes enriched Stats section with emotion distribution, theme counts, and unexplored emotions fields</done>
</task>

<task type="auto">
  <name>Task 2: Update discography update instructions in Step 03 with recompute rule and enriched stats</name>
  <files>.claude/skills/create-track/steps/03-verify-and-save.md</files>
  <action>
Replace the existing "## Mise a Jour Discographie" section in Step 03 with an enhanced version. The section currently has two subsections (adding a table row and updating stats). Enhance it as follows:

**Keep subsection "### 1. Ajouter une ligne au tableau Tracks" unchanged** -- the table row format is already correct.

**Replace subsection "### 2. Mettre a jour la section Stats" with:**

```markdown
### 2. Mettre a jour la section Stats

RECOMPUTER tous les stats depuis le tableau complet (ne pas incrementer -- recompter a chaque fois pour eviter les derivations) :

- **Total tracks :** recompte du nombre de lignes de donnees dans le tableau (exclure header et separateur)
- **Langues utilisees :** liste dedupliquee de toutes les langues dans la colonne Langue
- **Themes explores :** liste dedupliquee de tous les themes avec comptage d'occurrences, tries par frequence decroissante. Format : "theme (N), theme (N)"
- **Distribution emotionnelle :** comptage par emotion depuis la colonne Emotions, trie par frequence decroissante. Format : "Emotion (N), Emotion (N)"
- **Emotions non-explorees :** lire la palette emotionnelle (Emotions primaires + secondaires) depuis `artists/[name]/bible.md`. Lister les emotions de la palette qui n'apparaissent dans AUCUNE ligne du tableau Emotions.
- **Dernier theme :** theme(s) de la derniere ligne du tableau (track le plus recent)
```

Also update the `last-updated` field instruction: after updating stats, set the frontmatter `last-updated` field to the current date.

Do NOT modify any other section of Step 03. The Verification de Coherence section added by Plan 08-01 must remain intact.
  </action>
  <verify>
Read the "Mise a Jour Discographie" section of `03-verify-and-save.md` and confirm:
1. "RECOMPUTER" instruction is present (not "incrementer")
2. All 6 stats fields are listed with computation instructions
3. "Emotions non-explorees" references the bible palette
4. The table row format (subsection 1) is unchanged
5. No other sections of Step 03 are modified
  </verify>
  <done>Step 03 discography update instructions use recompute rule and compute all 6 enriched stats fields including emotion distribution and unexplored emotions</done>
</task>

</tasks>

<verification>
1. Read `reference/templates/discography-template.md` -- verify 6 stats fields present
2. Read `03-verify-and-save.md` Mise a Jour section -- verify recompute rule and 6 stats fields
3. Verify consistency between template fields and Step 03 computation instructions (same 6 fields)
4. Verify Step 03 sections added by Plan 08-01 (Verification de Coherence) are not affected
</verification>

<success_criteria>
- Discography template has 6 stats fields including Distribution emotionnelle and Emotions non-explorees
- Step 03 discography update uses "recompute don't increment" rule
- Step 03 computes all 6 stats fields with clear instructions
- Unexplored emotions are derived from the bible palette, not hardcoded
- No regression on existing Step 03 content (Suno constraints, linguistic verification, coherence verification)
</success_criteria>

<output>
After completion, create `.planning/phases/08-coherence-engine/08-02-SUMMARY.md`
</output>
