# SPRINT v0.1.39 - NEXT FOR GLM
## Open-Project Editing, Less Symmetry, Less Silence, More Freedom Within Coherence

**Owner:** GLM via OpenCode  
**Reviewer:** Codex  
**Fecha:** 2026-04-03  
**Mode:** Edit existing project, not generate new song

Primary benchmark project:

- `C:\Users\ren\Desktop\song Project\song.als`

Required prior docs:

- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\docs\PROJECT_AUDIT_song_2026-04-03.md`
- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\docs\SPRINT_v0.1.38_VALIDATION_REPORT.md`

---

## 1. Reviewer Summary

GLM did useful work in v0.1.38:

- project inspection is substantially better
- session clip editing is real
- project coherence auditing exists and is now useful

But the musical result is still not where it needs to be.

The current open benchmark still has the same core musical problem:

- too symmetric
- too many silence islands
- too few distinct useful ideas
- harmonic MIDI exists only in Session, not Arrangement

This means the MCP is better at **inspecting** the project than at **repairing** it musically.

That is now the real product gap.

---

## 2. Live Truth You Must Start From

Before touching code, restart:

1. Ableton
2. OpenCode

Then reconnect MCP and re-check the currently open `song.als`.

Baseline truth that Codex saw before restart:

- `tempo = 95`
- `tracks = 16`
- `returns = 4`
- `scenes = 6`
- track 15 renamed to `HARMONY_AMIN_PLUCK`
- `HARMONY_AMIN_PLUCK` has:
  - `session_clip_count = 1`
  - `arrangement_clip_count = 0`

The benchmark also still shows these real musical problems:

- same one-shots repeated at nearly identical section boundaries
- long empty spans between useful blocks
- harmonic continuity leaning too much on audio loops and bass
- audio synth layers too sparse and too mirrored

Do not begin from the report alone.
Begin from live MCP truth.

---

## 3. Code Review Findings

These are the important findings from Codex review.

### 3.1 What is already fixed and now baseline

- duplicate public tool definitions were cleaned in `server.py`
- `get_track_info(...)` now supports `track_type`
- `validate_key_conflicts(...)` was rewired away from the broken legacy path
- runtime timeout for Arrangement editing fallback is now longer
- `get_device_parameters(...)` no longer assumes `value_items` is safe for non-quantized params
- `audit_project_coherence()` no longer misses harmonic MIDI emptiness just because `type` was not `"midi"`

### 3.2 What is still open

- Arrangement MIDI editing is still not proven stable end-to-end on the open benchmark
- `HARMONY_*` remains stranded in Session instead of becoming a real Arrangement backbone
- the project remains too regular and too mirrored
- the editing layer still diagnoses coherence better than it repairs it
- `inject_pattern_fills(...)` still has no real runtime implementation behind it; do not claim it is fixed

### 3.3 Musical diagnosis of the current benchmark

The current project is not failing because it lacks structure.
It is failing because its structure is too mechanically regular.

Symptoms visible in the project and screenshot:

- `AUDIO KICK`, `AUDIO CLAP`, `AUDIO HAT`, `AUDIO PERC MAIN` repeat the same sources on the same grid windows
- `AUDIO SYNTH LOOP` and `AUDIO SYNTH PEAK` enter in mirrored islands instead of evolving
- the useful material often lasts a few seconds and is followed by clear dead space
- the MIDI harmonic lane does not fill those holes because it is not in Arrangement

This is not “coherence”.
This is **grid-lock**.

---

## 4. Product Direction For v0.1.39

This sprint has two goals:

1. make open-project editing stronger and more truthful
2. make the repair logic reduce symmetry and silence without destroying identity

This sprint is not about generating another song.
It is about repairing the open benchmark song in a controlled, explainable way.

---

## 5. Semantic Rule

The user may say:

- `piano roll`
- `harmony MIDI`
- `armonia`

For this sprint, interpret that as:

- harmonic MIDI support
- note backbone
- continuity filler

It does **not** mean:

- force piano timbre
- make the project piano-forward
- add piano audio loops as product strategy

If a harmonic lane is needed, it should behave as `HARMONY_*_MIDI` and support coherence across Arrangement.

---

## 6. P0 Tasks

## P0.1 Re-validate live truth after restart

After restart, collect exact MCP outputs for:

- `get_session_info()`
- `get_tracks()`
- `get_track_info(track_index=15, track_type="track")`
- `audit_current_project()`
- `audit_project_coherence()`

You must include those exact outputs in the report.

If live truth differs from Codex baseline, say so explicitly.

---

## P0.2 Prove Arrangement MIDI editing on the open benchmark

Current benchmark failure:

- harmonic MIDI exists in Session
- harmonic MIDI does not exist in Arrangement

You must close that gap.

Required live edit proof:

1. inspect track 15
2. create or duplicate a harmonic MIDI clip into Arrangement
3. add or preserve notes there
4. re-inspect with MCP
5. prove `arrangement_clip_count > 0`

This is not optional.

If you cannot achieve this after restart, the sprint cannot be `COMPLETED`.

---

## P0.3 Add arrangement-specific clip inspection

Current MCP inspection is still too session-centric.

Implement one of these:

- `get_arrangement_clip_info(track_index, start_time, track_type="track")`
- or extend `get_clip_info(...)` with `view="session" | "arrangement"` plus `start_time`

Minimum returned fields:

- clip name
- start time
- length
- is_audio_clip / is_midi_clip
- loop state when available

The point is to inspect Arrangement clips directly, not infer them indirectly.

---

## P0.4 Add first-class repair metrics for symmetry and silence

`audit_project_coherence()` is already useful, but it still needs metrics that describe the exact current failure mode.

Add at least these new outputs:

- `silence_islands`
  - list of long empty spans by family/bus
- `grid_lock_tracks`
  - tracks whose clips recur on near-identical spacing and lengths
- `same_source_dominance_tracks`
  - already present in code; validate and keep
- `mirrored_section_pairs`
  - detect when two sections reuse the same source+spacing pattern too literally
- `harmonic_backbone_status`
  - whether harmonic MIDI/audio actually spans the arrangement

These metrics must be computed from the open project, not from a manifest.

---

## P0.5 Add bounded repair tools for open projects

The MCP now has primitives.
What it still lacks are bounded repair actions.

Implement at least two tools like these:

- `repair_harmonic_gaps(track_index, start_time=None, end_time=None, mode="midi_backbone")`
- `reduce_same_source_dominance(track_index, strategy="variation")`
- `extend_track_continuity(track_index, source_mode="existing")`
- `soften_grid_lock(track_index, strategy="density_variation")`

Rules:

- must return a JSON report of actions taken
- must report clips touched
- must report created/duplicated/deleted/edited clips
- must not silently regenerate the whole song

These tools are for project repair, not for black-box generation.

---

## 7. P1 Tasks

## P1.1 Reduce destructive position consolidation

Codex review points to the arrangement layer becoming too regular after consolidation.

You must review the consolidation/materialization path around:

- `server.py` audio layer consolidation
- duplicate-layer merge behavior
- role limit clipping
- section-variant preservation

Focus on the code near:

- `_consolidate_duplicate_layers(...)`
- `_materialize_audio_layers(...)`
- logic around preserved variant positions and role limits

Goal:

- keep coherence
- stop flattening interesting section-level differences into mirrored anchors

Do not “solve” this by allowing chaos.
Solve it by keeping section-aware differences alive.

---

## P1.2 Fill silence with harmonic backbone, not random clutter

The benchmark has spaces where the harmonic lane should sustain the track.

Add a safe repair path that prefers:

- extending harmonic MIDI
- supporting bass continuity
- reusing coherent family material

It must not:

- spray random FX
- fill every gap blindly
- replace structure with constant density

Good result:

- fewer dead spans
- stronger continuity
- same identity

---

## P1.3 More freedom in sound choice, but bounded by coherence

The next version should be less predictable, but not incoherent.

Add or improve a selection policy that allows:

- more than one valid source candidate per role
- section-specific alternates
- timbral variation inside the same family/pack/bus logic

But keep hard constraints:

- do not break family lock
- do not scatter unrelated packs arbitrarily
- do not let one harsh one-shot dominate the whole arrangement

This is the target:

- more freedom inside identity
- not “same exact clip everywhere”
- not “random collage”

---

## 8. Explicit Non-Goals

Do not spend this sprint on:

- new genre generation
- vocals
- piano-forward sound design
- giant refactors unrelated to project editing
- fake wrappers without runtime support

Especially:

- do not claim `inject_pattern_fills(...)` is fixed unless runtime support exists and is live-validated

---

## 9. Required Files

Primary:

- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\server.py`
- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\abletonmcp_init.py`
- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\abletonmcp_runtime.py`
- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\tests\test_runtime_truth.py`

Important review targets:

- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\reference_listener.py`
- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\song_generator.py`

Benchmark:

- `C:\Users\ren\Desktop\song Project\song.als`

---

## 10. Required Validation

Minimum local:

```powershell
python -m py_compile "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\server.py" "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\abletonmcp_init.py" "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\abletonmcp_runtime.py" "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\tests\test_runtime_truth.py"
python "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\tests\test_runtime_truth.py"
python "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\tests\test_selection_coherence.py"
python "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\tests\test_piano_forward.py"
```

Required live validation:

- restart Ableton
- restart OpenCode
- reconnect MCP
- inspect current benchmark truth
- perform at least one Arrangement-level harmonic edit
- re-inspect to prove persistence
- run both:
  - `audit_current_project()`
  - `audit_project_coherence()`

---

## 11. Deliverable

Write:

- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\docs\SPRINT_v0.1.39_VALIDATION_REPORT.md`

Must include:

### A. Runtime truth

- exact outputs after restart

### B. Tool/runtime fixes

- exact code paths changed
- exact live calls used

### C. Symmetry/silence audit

- exact output of `audit_project_coherence()`
- explicit interpretation of:
  - symmetry
  - silence islands
  - repeated-source dominance

### D. Arrangement MIDI proof

- exact edit call
- exact re-inspection result
- proof that harmonic MIDI is now in Arrangement or clear blocker if not

### E. Reviewer conclusion

Only one of:

- `COMPLETED`
- `PARTIAL`
- `BLOCKED`

If the open benchmark still looks mirrored and hollow, and `HARMONY_*` remains only in Session, it is not `COMPLETED`.

---

## 12. Final Rule

Do not optimize for “more clips”.
Optimize for:

- fewer dead spaces
- less mirror repetition
- more life inside the same identity
- actual harmonic support in Arrangement

This sprint closes only if the MCP becomes better at **repairing** an open project musically, not just inspecting it.
