# SPRINT v0.1.38 - NEXT FOR GLM
## Expand Open-Project Editing Tools And Add Real Coherence Auditing

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

Primary benchmark project:

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

Reference 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.37_VALIDATION_REPORT.md`
- `C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\docs\SPRINT_v0.1.37_NEXT_GLM_PROJECT_EDITING.md`

---

## 1. Reviewer Summary

GLM did advance the editing runtime path, but the report in `SPRINT_v0.1.37_VALIDATION_REPORT.md` still overclaimed closure.

Codex reviewed:

- the report
- the active code
- the live MCP state against the currently open benchmark set
- the editing runtime and tests

### The real outcome of v0.1.37

- good progress
- not complete

The main reason is simple:

- the report claimed `HARMONY_PIANO_MIDI` had an arrangement clip
- the live MCP state now shows `HARMONY_PIANO_MIDI` with:
  - `session_clip_count = 0`
  - `arrangement_clip_count = 0`

So the report cannot be treated as final truth for the actual open benchmark project.

---

## 2. What Codex Fixed After The Report

These fixes are already in the tree and are the new baseline.

### 2.1 MCP/runtime fixes

Codex fixed:

- `get_clips` routing in both runtimes
- `track_type` propagation for new editing commands
- arrangement clip fallback via session-record-to-arrangement when direct `track.create_clip(...)` is unavailable
- `set_device_parameter(...)` public API now supports `parameter_name`
- public `get_device_parameters(...)` was added
- `audit_current_project()` now reports `repeated_clip_overuse`

### 2.2 Product-level cleanup

Codex also fixed:

- duplicate MCP tool definitions in `server.py`
- broken `create_clip(...)` validation path that used nonexistent `_validate_float`
- fragile side effect where arrangement fallback could leave tracks armed; it now preserves/restores arm state more safely
- `get_track_info(...)` now carries more useful nested clip/device details for editing workflows

### 2.3 Current validated tests

Passing locally:

- `test_runtime_truth.py`
- `test_selection_coherence.py`
- `test_piano_forward.py`

---

## 3. Live Truth You Must Respect

Codex re-checked the current project through MCP.

Current live facts:

- Ableton is reachable
- session is at `95 BPM`
- current project has `16` tracks and `6` scenes
- `HARMONY_PIANO_MIDI` is still present as track `15`
- but it is still empty in Arrangement in the current live set

So for this sprint:

- do not use the v0.1.37 report as your source of truth
- use live MCP responses as the source of truth

---

## 4. Code Review Findings

### 4.1 Main report failure

The report treated a transient or unpersisted edit as if it were benchmark truth.

That is not acceptable for project-editing work.

If a report claims a live edit succeeded, you must prove:

1. the edit exists in the open set
2. MCP sees it
3. it still exists after re-inspection

If not:

- status is not `COMPLETED`

### 4.2 Editing tools are improving, but still not complete enough

The MCP now has useful editing surface:

- `get_clips`
- `get_devices`
- `get_device_parameters`
- `create_clip`
- `add_notes_to_clip`
- `create_arrangement_clip`
- `add_notes_to_arrangement_clip`
- `duplicate_clip_to_arrangement`
- track mute/pan/send/device control
- `audit_current_project`

But serious open-project editing still needs more public tools.

### 4.3 Coherence is still under-tooled for open projects

Right now the project audit sees structural issues, but not enough musical ones.

The system still lacks a first-class **project coherence audit** for an already-open song.

That is the next real product gap.

---

## 5. Product Direction For v0.1.38

We now have two parallel goals:

1. give MCP more real edit tools for already-open projects
2. make coherence measurable on the open project itself

This sprint is not about a new generation path.
It is about:

- editing a real `.als`
- auditing coherence in that real `.als`

---

## 6. Important Semantic Rule

The user comes from FL and may say `piano roll`.

For this product, that must be interpreted as:

- harmonic MIDI editing
- note editing
- arrangement MIDI support

It does **not** mean:

- force piano timbre
- add more piano sounds
- make the song piano-forward

If the track is named `HARMONY_PIANO_MIDI`, treat it as:

- a harmonic MIDI support lane

Do not turn this sprint into piano sound design.

---

## 7. P0 Tasks

## P0.1 Re-validate the live benchmark truth

Before any new work, restart:

1. Ableton
2. OpenCode

Then reconnect MCP and inspect the live benchmark again.

You must verify:

- `get_session_info()`
- `get_tracks()`
- `get_track_info(track_index=15)`

The goal is to start from real live state, not from old screenshots or stale outputs.

Required evidence:

- exact responses

---

## P0.2 Add missing public edit tools for real project work

The MCP still needs more low-level editing primitives exposed publicly.

Add public MCP tools in `server.py` for:

### Session / clip editing

- `delete_clip(track_index, clip_index)`
- `set_clip_name(track_index, clip_index, name)`
- `set_clip_loop(track_index, clip_index, loop_start, loop_end, loop_length=0.0, looping=True)`
- `fire_clip(track_index, clip_index)`
- `stop_clip(track_index, clip_index)`

These already exist or are very close in runtime support. Expose them cleanly.

### Transport / editing support

- `jump_to(time)`
- `set_loop(enabled)`
- `set_loop_region(start, length)`
- `show_arrangement_view()`

Do not rely on shell or hidden helpers when MCP can own these editing actions.

### Track inspection quality

Extend `get_track_info(...)` so it can optionally accept:

- `track_type="track" | "return" | "master"`

and do not leave return/master inspection as second-class behavior.

---

## P0.3 Add a first-class project coherence audit

Add a new public MCP tool:

- `audit_project_coherence()`

This is not a generation manifest audit.
It is an audit of the currently open live project.

Minimum required outputs:

- `longest_drum_gap`
- `longest_harmonic_gap`
- `tracks_with_zero_arrangement_clips`
- `harmonic_midi_tracks_without_arrangement_clips`
- `dominant_repeated_audio_sources`
- `repetition_by_track`
- `harmonic_coverage_ratio`
- `drum_coverage_ratio`
- `same_sample_overuse_flags`
- `coherence_summary`

The audit must use:

- current track names
- arrangement clips
- device presence
- real repeated source names

Do not fake this from manifests alone.

---

## P0.4 Make the coherence audit useful for this actual benchmark

The benchmark project currently shows exactly the kind of issues we care about:

- repetitive one-shots
- arrangement islands
- empty harmonic MIDI support
- continuity depending too much on audio bass only

`audit_project_coherence()` must be able to make those issues visible.

At minimum it must highlight:

- `HARMONY_PIANO_MIDI` exists but has no arrangement clips
- `AUDIO KICK`, `AUDIO CLAP`, `AUDIO HAT`, `AUDIO PERC MAIN` reuse the same small set of sources heavily
- `AUDIO SYNTH LOOP` and `AUDIO SYNTH PEAK` are sparse
- the song still has continuity/coherence gaps despite looking more structured

---

## P0.5 Validate real editing persistence

Pick one real edit on `song.als` and prove it persists across re-inspection.

Examples:

- create a session clip on `HARMONY_PIANO_MIDI`
- add notes to it
- duplicate it to arrangement
- rename the created session clip
- inspect again

Required proof:

1. action call
2. immediate success result
3. re-inspection result showing it exists

If re-inspection does not confirm it:

- the edit does not count as validated

---

## 8. P1 Tasks

## P1.1 Add arrangement-specific clip inspection

Current `get_clip_info(...)` remains session-slot-centric.

That is still too weak for serious arrangement editing.

Implement one of:

- `get_arrangement_clip_info(track_index, clip_start_time, track_type="track")`
- or extend `get_clip_info(...)` with a `view` argument

This tool should report:

- clip name
- start time
- length
- audio vs MIDI
- loop state when available

Do not leave arrangement inspection ambiguous.

---

## P1.2 Add a safe orchestration helper for project refinement

Only after P0 works.

Add a tool like:

- `refine_existing_project_section(...)`

This must not be a fake black box.
It must return:

- actions taken
- tracks touched
- clips created/duplicated/edited

Good first scope:

- fill one harmonic gap
- extend one rhythmic section
- reduce one repeated-source hotspot

Keep it bounded.

---

## 9. Non-Goals

Do not spend this sprint on:

- new genre generation logic
- reference remake quality
- new piano timbre logic
- vocal generation
- cosmetic md writing

The focus is:

- project editing tools
- live project coherence visibility

---

## 10. 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`

Benchmark:

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

---

## 11. 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"
python "C:\ProgramData\Ableton\Live 12 Suite\Resources\MIDI Remote Scripts\AbletonMCP_AI\AbletonMCP_AI\MCP_Server\tests\test_runtime_truth.py"
```

Required live validation:

- inspect benchmark project with MCP
- run at least one real edit
- re-inspect to prove persistence
- run `audit_current_project()`
- run `audit_project_coherence()`

---

## 12. Deliverable

Write:

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

Must include:

### A. Runtime truth

- restart evidence
- MCP connection evidence
- benchmark loaded evidence

### B. Tool results

- exact call
- exact output
- pass/fail

### C. Coherence audit results

- exact output of `audit_project_coherence()`
- interpretation against the benchmark project

### D. Real edit proof

- action
- success result
- re-inspection result

### E. Reviewer conclusion

Only one of:

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

If the live benchmark still contradicts the report, it is not `COMPLETED`.

---

## 13. Final Rule

Do not close this sprint because the MCP *can* call editing commands.

Close it only if:

- the editing commands work on the open benchmark project
- the effects are visible on re-inspection
- the new coherence audit makes the benchmark's musical problems legible

