livepilot 1.9.14 → 1.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/AGENTS.md +3 -3
  3. package/CHANGELOG.md +82 -0
  4. package/CONTRIBUTING.md +1 -1
  5. package/README.md +8 -8
  6. package/livepilot/.Codex-plugin/plugin.json +2 -2
  7. package/livepilot/.claude-plugin/plugin.json +2 -2
  8. package/livepilot/agents/livepilot-producer/AGENT.md +243 -49
  9. package/livepilot/skills/livepilot-core/SKILL.md +81 -6
  10. package/livepilot/skills/livepilot-core/references/m4l-devices.md +2 -2
  11. package/livepilot/skills/livepilot-core/references/overview.md +3 -3
  12. package/livepilot/skills/livepilot-core/references/sound-design.md +3 -2
  13. package/livepilot/skills/livepilot-release/SKILL.md +13 -13
  14. package/m4l_device/livepilot_bridge.js +32 -15
  15. package/mcp_server/__init__.py +1 -1
  16. package/mcp_server/connection.py +24 -2
  17. package/mcp_server/curves.py +14 -6
  18. package/mcp_server/evaluation/__init__.py +1 -0
  19. package/mcp_server/evaluation/fabric.py +575 -0
  20. package/mcp_server/evaluation/feature_extractors.py +84 -0
  21. package/mcp_server/evaluation/policy.py +67 -0
  22. package/mcp_server/evaluation/tools.py +53 -0
  23. package/mcp_server/m4l_bridge.py +9 -1
  24. package/mcp_server/memory/__init__.py +11 -2
  25. package/mcp_server/memory/anti_memory.py +78 -0
  26. package/mcp_server/memory/promotion.py +94 -0
  27. package/mcp_server/memory/session_memory.py +108 -0
  28. package/mcp_server/memory/taste_memory.py +158 -0
  29. package/mcp_server/memory/technique_store.py +27 -18
  30. package/mcp_server/memory/tools.py +112 -0
  31. package/mcp_server/mix_engine/__init__.py +1 -0
  32. package/mcp_server/mix_engine/critics.py +299 -0
  33. package/mcp_server/mix_engine/models.py +152 -0
  34. package/mcp_server/mix_engine/planner.py +103 -0
  35. package/mcp_server/mix_engine/state_builder.py +316 -0
  36. package/mcp_server/mix_engine/tools.py +220 -0
  37. package/mcp_server/performance_engine/__init__.py +1 -0
  38. package/mcp_server/performance_engine/models.py +148 -0
  39. package/mcp_server/performance_engine/planner.py +267 -0
  40. package/mcp_server/performance_engine/safety.py +165 -0
  41. package/mcp_server/performance_engine/tools.py +183 -0
  42. package/mcp_server/project_brain/__init__.py +6 -0
  43. package/mcp_server/project_brain/arrangement_graph.py +64 -0
  44. package/mcp_server/project_brain/automation_graph.py +72 -0
  45. package/mcp_server/project_brain/builder.py +123 -0
  46. package/mcp_server/project_brain/capability_graph.py +64 -0
  47. package/mcp_server/project_brain/models.py +282 -0
  48. package/mcp_server/project_brain/refresh.py +86 -0
  49. package/mcp_server/project_brain/role_graph.py +103 -0
  50. package/mcp_server/project_brain/session_graph.py +51 -0
  51. package/mcp_server/project_brain/tools.py +144 -0
  52. package/mcp_server/reference_engine/__init__.py +1 -0
  53. package/mcp_server/reference_engine/gap_analyzer.py +239 -0
  54. package/mcp_server/reference_engine/models.py +105 -0
  55. package/mcp_server/reference_engine/profile_builder.py +149 -0
  56. package/mcp_server/reference_engine/tactic_router.py +117 -0
  57. package/mcp_server/reference_engine/tools.py +236 -0
  58. package/mcp_server/runtime/__init__.py +1 -0
  59. package/mcp_server/runtime/action_ledger.py +117 -0
  60. package/mcp_server/runtime/action_ledger_models.py +91 -0
  61. package/mcp_server/runtime/action_tools.py +57 -0
  62. package/mcp_server/runtime/capability_state.py +219 -0
  63. package/mcp_server/runtime/safety_kernel.py +339 -0
  64. package/mcp_server/runtime/safety_tools.py +42 -0
  65. package/mcp_server/runtime/tools.py +67 -0
  66. package/mcp_server/server.py +17 -0
  67. package/mcp_server/sound_design/__init__.py +1 -0
  68. package/mcp_server/sound_design/critics.py +297 -0
  69. package/mcp_server/sound_design/models.py +147 -0
  70. package/mcp_server/sound_design/planner.py +104 -0
  71. package/mcp_server/sound_design/tools.py +297 -0
  72. package/mcp_server/tools/_agent_os_engine.py +947 -0
  73. package/mcp_server/tools/_composition_engine.py +1530 -0
  74. package/mcp_server/tools/_conductor.py +199 -0
  75. package/mcp_server/tools/_conductor_budgets.py +222 -0
  76. package/mcp_server/tools/_evaluation_contracts.py +91 -0
  77. package/mcp_server/tools/_form_engine.py +416 -0
  78. package/mcp_server/tools/_motif_engine.py +351 -0
  79. package/mcp_server/tools/_planner_engine.py +516 -0
  80. package/mcp_server/tools/_research_engine.py +542 -0
  81. package/mcp_server/tools/_research_provider.py +185 -0
  82. package/mcp_server/tools/_snapshot_normalizer.py +49 -0
  83. package/mcp_server/tools/agent_os.py +448 -0
  84. package/mcp_server/tools/analyzer.py +18 -0
  85. package/mcp_server/tools/automation.py +25 -10
  86. package/mcp_server/tools/composition.py +645 -0
  87. package/mcp_server/tools/devices.py +15 -1
  88. package/mcp_server/tools/midi_io.py +3 -1
  89. package/mcp_server/tools/motif.py +104 -0
  90. package/mcp_server/tools/planner.py +144 -0
  91. package/mcp_server/tools/research.py +223 -0
  92. package/mcp_server/tools/tracks.py +21 -6
  93. package/mcp_server/tools/transport.py +10 -2
  94. package/mcp_server/transition_engine/__init__.py +6 -0
  95. package/mcp_server/transition_engine/archetypes.py +167 -0
  96. package/mcp_server/transition_engine/critics.py +340 -0
  97. package/mcp_server/transition_engine/models.py +90 -0
  98. package/mcp_server/transition_engine/tools.py +291 -0
  99. package/mcp_server/translation_engine/__init__.py +5 -0
  100. package/mcp_server/translation_engine/critics.py +297 -0
  101. package/mcp_server/translation_engine/models.py +27 -0
  102. package/mcp_server/translation_engine/tools.py +108 -0
  103. package/package.json +2 -2
  104. package/remote_script/LivePilot/__init__.py +1 -1
  105. package/remote_script/LivePilot/arrangement.py +21 -3
  106. package/remote_script/LivePilot/clips.py +22 -6
  107. package/remote_script/LivePilot/notes.py +9 -1
  108. package/remote_script/LivePilot/server.py +6 -6
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
3
  "name": "dreamrec-LivePilot",
4
- "description": "Agentic MCP production system for Ableton Live 12 — 178 tools, 17 domains",
4
+ "description": "Agentic MCP production system for Ableton Live 12 — 236 tools, 32 domains",
5
5
  "owner": {
6
6
  "name": "dreamrec",
7
7
  "email": "dreamrec@users.noreply.github.com"
@@ -9,8 +9,8 @@
9
9
  "plugins": [
10
10
  {
11
11
  "name": "livepilot",
12
- "description": "Agentic production system for Ableton Live 12 — 178 tools, 17 domains, device atlas, spectral perception, technique memory, neo-Riemannian harmony, Euclidean rhythm, species counterpoint, MIDI I/O",
13
- "version": "1.9.14",
12
+ "description": "Agentic production system for Ableton Live 12 — 236 tools, 32 domains, device atlas, spectral perception, technique memory, neo-Riemannian harmony, Euclidean rhythm, species counterpoint, MIDI I/O",
13
+ "version": "1.9.16",
14
14
  "author": {
15
15
  "name": "Pilot Studio"
16
16
  },
package/AGENTS.md CHANGED
@@ -1,4 +1,4 @@
1
- # LivePilot v1.9.14 — Ableton Live 12
1
+ # LivePilot v1.9.16 — Ableton Live 12
2
2
 
3
3
  ## Project
4
4
  - **Repo:** This directory (LivePilot)
@@ -22,7 +22,7 @@
22
22
  ## Key Rules
23
23
  - ALL Live Object Model (LOM) calls must execute on Ableton's main thread via schedule_message queue
24
24
  - Live 12 minimum — use modern note API (add_new_notes, get_notes_extended, apply_note_modifications)
25
- - 178 tools across 17 domains: transport, tracks, clips, notes, devices, scenes, mixing, browser, arrangement, memory, analyzer, automation, theory, generative, harmony, midi_io, perception
25
+ - 236 tools across 32 domains: transport, tracks, clips, notes, devices, scenes, mixing, browser, arrangement, memory, analyzer, automation, theory, generative, harmony, midi_io, perception, agent_os, composition, motif, research, planner, project_brain, runtime, evaluation, memory_fabric, mix_engine, sound_design, transition_engine, reference_engine, translation_engine, performance_engine
26
26
  - JSON over TCP, newline-delimited, port 9878
27
27
  - Structured errors with codes: INDEX_ERROR, NOT_FOUND, INVALID_PARAM, STATE_ERROR, TIMEOUT, INTERNAL
28
28
 
@@ -43,4 +43,4 @@ When modifying .amxd attributes that Max editor won't persist (e.g., `openinpres
43
43
  4. Structure: 24-byte `ampf` header + `ptch` chunk + `mx@c` header + JSON patcher + frozen deps
44
44
 
45
45
  ## Tool Count
46
- Currently 178 tools. If adding/removing tools, update: README.md, package.json description, livepilot/.Codex-plugin/plugin.json, server.json, livepilot/skills/livepilot-core/SKILL.md, livepilot/skills/livepilot-core/references/overview.md, AGENTS.md, CHANGELOG.md, tests/test_tools_contract.py, docs/manual/index.md, docs/manual/tool-reference.md
46
+ Currently 236 tools. If adding/removing tools, update: README.md, package.json description, livepilot/.Codex-plugin/plugin.json, server.json, livepilot/skills/livepilot-core/SKILL.md, livepilot/skills/livepilot-core/references/overview.md, AGENTS.md, CHANGELOG.md, tests/test_tools_contract.py, docs/manual/index.md, docs/manual/tool-reference.md
package/CHANGELOG.md CHANGED
@@ -1,5 +1,87 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.16 — Comprehensive Bug Fix Audit (April 2026)
4
+
5
+ ### Critical Fixes
6
+ - **connection.py** — Don't retry TCP commands after timeout (prevents duplicate mutations in Ableton)
7
+ - **connection.py** — Add `send_command_async()` to avoid blocking the asyncio event loop
8
+ - **technique_store.py** — Thread-safe initialization with double-checked locking; add missing `_ensure_initialized()` in `increment_replay`
9
+ - **capability_state.py** — Fix inverted mode logic: offline analyzer is now correctly more restrictive than stale analyzer
10
+ - **server.py** — Fix thread safety: assign `_client_thread` inside lock
11
+ - **action_ledger_models.py** — Thread-safe unique IDs with UUID session suffix
12
+
13
+ ### High-Priority Fixes
14
+ - **notes.py / arrangement.py** — `modify_notes` now applies `mute`, `velocity_deviation`, `release_velocity` (previously silently dropped)
15
+ - **clips.py** — `create_clip` checks `has_clip` first; `set_clip_loop` uses conditional ordering for shrink vs expand
16
+ - **notes.py / arrangement.py** — Fix `transpose_notes` default `time_span` when `from_time > 0`
17
+ - **m4l_bridge.py** — Clear stale response future after timeout
18
+ - **composition.py** — Fix `get_phrase_grid` using section_index as clip_index
19
+ - **devices.py** — Fix `_postflight_loaded_device` always reporting plugins as failed
20
+ - **tracks.py** — Correct input monitoring enum (0=Off, 1=In, 2=Auto); fix `set_group_fold` allowing return tracks
21
+ - **research.py** — Fix browser path casing (`"Instruments"` → `"instruments"`)
22
+ - **midi_io.py** — Fix path traversal check prefix collision
23
+ - **fabric.py** — Distinguish `measured` vs `measured_reject` decision modes
24
+ - **critics.py** — Fix dynamics critic double-counting `over_compressed` + `flat_dynamics`
25
+ - **refresh.py** — Deep-copy freshness objects to prevent mutation leak
26
+ - **mix_engine/tools.py** — Fix `track_count` key (always 0) → use `len(tracks)`
27
+ - **safety.py** — Distinguish `unknown` from `caution` for unrecognized move types
28
+ - **translation_engine** — Fix pan values always 0 (check nested `mixer.panning`)
29
+ - **livepilot_bridge.js** — Track selection by LiveAPI ID (not name); 4-byte UTF-8 support (emoji)
30
+
31
+ ### Medium Fixes
32
+ - Version strings bumped across all files
33
+ - `hashlib.md5` calls use `usedforsecurity=False` (FIPS compat)
34
+ - `.mcp.json` uses portable `node` command
35
+ - README "32 additional tools" → "29"
36
+ - Lazy `asyncio.Lock` creation in M4L bridge
37
+ - `_friendly_error` now includes `command_type` in output
38
+
39
+ ### Test Improvements
40
+ - Tests updated to match corrected capability_state, dynamics critic, and safety logic
41
+ - `test_default_name_detection` now imports production function instead of local copy
42
+
43
+ ## 1.9.15 — V2 Engine Architecture (April 2026)
44
+
45
+ ### New Engine Packages (12)
46
+ - **Project Brain** — shared state substrate with 5 subgraphs (session, arrangement, role, automation, capability), freshness tracking, scoped refresh
47
+ - **Capability State** — runtime capability model (5 domains: session, analyzer, memory, web, research), operating mode inference
48
+ - **Action Ledger** — semantic move tracking with undo groups, memory promotion candidates
49
+ - **Evaluation Fabric** — unified evaluation layer with 5 engine-specific evaluators (sonic, composition, mix, transition, translation)
50
+ - **Memory Fabric V2** — anti-memory (tracks user dislikes), promotion rules, session memory, taste memory (8 extended dimensions)
51
+ - **Mix Engine** — 6 critics (balance, masking, dynamics, stereo, depth, translation), move planner with ranking
52
+ - **Sound Design Engine** — timbral goals, patch model, layer strategy, 5 critics, move planner
53
+ - **Transition Engine** — boundary model, 7 archetypes, 5 critics, payoff scoring
54
+ - **Reference Engine** — audio/style profiles, gap analysis with identity warnings, tactic routing to target engines
55
+ - **Translation Engine** — playback robustness (mono, small speaker, harshness, low-end, front-element)
56
+ - **Performance Engine** — live-safe mode with scene steering, safety policies, energy path planning
57
+ - **Safety Kernel** — policy enforcement (blocked/confirm-required/safe action classification, scope limits, capability gating)
58
+
59
+ ### New Infrastructure
60
+ - **Conductor** — intelligent request routing to engines with keyword classification (22 patterns across 8 engines)
61
+ - **Budget System** — 6 resource pools per turn (latency, risk, novelty, change, undo, research) shaped by mode
62
+ - **Snapshot Normalizer** — canonical input normalization for all evaluators
63
+ - **Evaluation Contracts** — shared types (EvaluationRequest, EvaluationResult, dimension measurability registry)
64
+ - **Research Provider Router** — 6-level provider ladder with mode-based routing and outcome feedback
65
+
66
+ ### Composition Engine Extensions (Rounds 1-4)
67
+ - Round 1: HarmonyField, TransitionCritic, OutcomeAnalyzer
68
+ - Round 2: MotifGraph, 11 GestureTemplates, TechniqueCards, SectionOutcomes
69
+ - Round 3: ResearchEngine (targeted+deep), PlannerEngine (5 styles), EmotionalArcCritic
70
+ - Round 4: TasteModel, 6 StyleTactics, FormEngine (9 transforms), CrossSectionCritic, OrchestrationPlanner
71
+
72
+ ### Bug Fixes
73
+ - Fix(High): Remove async/await from engine tools — send_command is sync
74
+ - Fix(High): Mix engine extracts mixer.volume/panning from nested Remote Script response
75
+ - Fix(High): Replace calls to nonexistent commands (get_device_reference, walk_device_tree)
76
+ - Fix(Med): Remove refs to nonexistent session fields (last_export_path, selected_scene)
77
+ - Fix(Med): Ledger key mismatch — memory promotion now reads correct 'action_ledger' key
78
+
79
+ ### Stats
80
+ - 236 tools across 32 domains (was 194)
81
+ - 1,014 tests passing (was ~400)
82
+ - 12 new engine packages
83
+ - 36 new MCP tools
84
+
3
85
  ## 1.9.14 — Install Reliability + CI Expansion (April 2026)
4
86
 
5
87
  - Fix(High): `--install` now shows all detected Ableton directories when multiple exist and accepts `LIVEPILOT_INSTALL_PATH` env var to override — previously silently picked the first candidate which could be wrong
package/CONTRIBUTING.md CHANGED
@@ -98,7 +98,7 @@ Prefix with `fix:`, `feat:`, `docs:`, `refactor:`, `test:`, or `chore:`.
98
98
 
99
99
  ## Tool Count Discipline
100
100
 
101
- Currently **178 tools**. If you add or remove a `@mcp.tool()` decorator, update all of these files:
101
+ Currently **236 tools**. If you add or remove a `@mcp.tool()` decorator, update all of these files:
102
102
 
103
103
  - `README.md`
104
104
  - `CLAUDE.md`
package/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
 
18
18
  <p align="center">
19
19
  An agentic production system for Ableton Live 12.<br>
20
- 178 tools. Device atlas. Spectral perception. Technique memory.
20
+ 236 tools. Device atlas. Spectral perception. Technique memory.
21
21
  </p>
22
22
 
23
23
  <br>
@@ -49,8 +49,8 @@
49
49
  │ └───────────────────┼───────────────────┘ │
50
50
  │ ▼ │
51
51
  │ ┌─────────────────┐ │
52
- │ │ 178 MCP Tools │ │
53
- │ │ 17 domains │ │
52
+ │ │ 236 MCP Tools │ │
53
+ │ │ 32 domains │ │
54
54
  │ └────────┬────────┘ │
55
55
  │ │ │
56
56
  │ Remote Script ──┤── TCP 9878 │
@@ -71,7 +71,7 @@ via a Max for Live device.
71
71
  The **memory** gives it history — a searchable library of production decisions
72
72
  that persists across sessions.
73
73
 
74
- All three feed into 178 deterministic tools that execute on Ableton's main thread.
74
+ All three feed into 236 deterministic tools that execute on Ableton's main thread.
75
75
 
76
76
  <br>
77
77
 
@@ -79,7 +79,7 @@ All three feed into 178 deterministic tools that execute on Ableton's main threa
79
79
 
80
80
  ## Tools
81
81
 
82
- 178 tools across 17 domains. Highlights below — [full catalog here](docs/manual/tool-catalog.md).
82
+ 236 tools across 32 domains. Highlights below — [full catalog here](docs/manual/tool-catalog.md).
83
83
 
84
84
  <br>
85
85
 
@@ -105,7 +105,7 @@ The M4L Analyzer sits on the master track. UDP 9880 carries spectral data
105
105
  from Max to the server. OSC 9881 sends commands back.
106
106
 
107
107
  > [!TIP]
108
- > All 149 core tools work without the analyzer — it adds 29 more and closes the feedback loop.
108
+ > All 207 core tools work without the analyzer — it adds 29 more and closes the feedback loop.
109
109
 
110
110
  ```
111
111
  SPECTRAL ─────── 8-band frequency decomposition (sub → air)
@@ -322,7 +322,7 @@ read_audio_metadata Format, duration, sample rate, tags
322
322
 
323
323
  <br>
324
324
 
325
- > **[View all 178 tools →](docs/manual/tool-catalog.md)**
325
+ > **[View all 236 tools →](docs/manual/tool-catalog.md)**
326
326
 
327
327
  <br>
328
328
 
@@ -448,7 +448,7 @@ Windsurf — `~/.codeium/windsurf/mcp_config.json`:
448
448
 
449
449
  Drag `LivePilot_Analyzer.amxd` onto the master track.
450
450
 
451
- Unlocks 32 additional tools: spectral analysis, key detection,
451
+ Unlocks 29 additional tools: spectral analysis, key detection,
452
452
  sample manipulation, deep device introspection, plugin parameter mapping.
453
453
 
454
454
  > [!IMPORTANT]
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "livepilot",
3
- "version": "1.9.14",
4
- "description": "Agentic production system for Ableton Live 12 — 178 tools, 17 domains, device atlas, spectral perception, technique memory, neo-Riemannian harmony, Euclidean rhythm, species counterpoint, MIDI I/O",
3
+ "version": "1.9.16",
4
+ "description": "Agentic production system for Ableton Live 12 — 236 tools, 32 domains, device atlas, spectral perception, technique memory, neo-Riemannian harmony, Euclidean rhythm, species counterpoint, MIDI I/O",
5
5
  "author": {
6
6
  "name": "Pilot Studio"
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "livepilot",
3
- "version": "1.9.14",
4
- "description": "Agentic production system for Ableton Live 12 — 178 tools, 17 domains, device atlas, spectral perception, technique memory, neo-Riemannian harmony, Euclidean rhythm, species counterpoint, MIDI I/O",
3
+ "version": "1.9.16",
4
+ "description": "Agentic production system for Ableton Live 12 — 236 tools, 32 domains, device atlas, spectral perception, technique memory, neo-Riemannian harmony, Euclidean rhythm, species counterpoint, MIDI I/O",
5
5
  "author": {
6
6
  "name": "Pilot Studio"
7
7
  }
@@ -10,34 +10,191 @@ tools:
10
10
  - Grep
11
11
  ---
12
12
 
13
- You are LivePilot Producer — an autonomous music production agent for Ableton Live 12.
13
+ You are LivePilot Producer — an autonomous music production agent for Ableton Live 12 powered by Agent OS V1.
14
14
 
15
- ## Your Process
15
+ ## Core Loop
16
16
 
17
- Given a high-level description, you:
17
+ Every production task follows a cyclical evaluation loop. The user says something simple ("make this hit harder"); you run a rigorous internal process.
18
18
 
19
- 1. **Plan** — decide tempo, key, track layout, instrument choices, arrangement structure
20
- 2. **Consult memory** (unless user requests fresh exploration) — call `memory_recall` with a query matching the task (limit=5). Read the returned qualities and let them shape your plan: kit choices, tempo range, rhythmic approach, sound palette. Don't copy — be influenced. If the user says "fresh" / "ignore history" / "something new", skip this step entirely.
21
- 3. **Build tracks** — create and name tracks with appropriate colors
22
- 4. **Load instruments** find and load the right synths, drum kits, and samplers
23
- 5. **HEALTH CHECK** verify every track actually produces sound (see below)
24
- 6. **Program patterns** write MIDI notes that fit the genre and style
25
- 7. **Add effects** load and configure effect chains for the desired sound
26
- 8. **HEALTH CHECK** verify effects aren't pass-throughs (Dry/Wet > 0, Drive set, etc.)
27
- 9. **Automate** add movement and evolution to the mix (see Automation Phase below)
28
- 10. **Mix** balance volumes, set panning, configure sends
29
- 11. **Final verify** `get_session_info`, fire scenes, confirm audio output
19
+ ```
20
+ 1. COMPILE GOAL → compile_goal_vector
21
+ 2. BUILD WORLD → build_world_model
22
+ 3. CONSULT MEMORY → memory_recall (unless "fresh")
23
+ 4. RUN CRITICS → read world model issues
24
+ 5. CHOOSE MOVE → smallest reversible high-confidence intervention
25
+ 6. CAPTURE BEFORE → get_master_spectrum + get_master_rms
26
+ 7. EXECUTE → perform the intervention (with health checks)
27
+ 8. CAPTURE AFTER → same reads
28
+ 9. EVALUATE → evaluate_move with before/after
29
+ 10. KEEP or UNDO → if keep_change=false undo()
30
+ 11. LEARN → if kept, optionally memory_learn(type="outcome")
31
+ → REPEAT from step 4 until goal satisfied or budget exhausted
32
+ ```
33
+
34
+ ### Step 1: Compile Goal
35
+
36
+ Interpret the user's natural language into quality dimensions. Call `compile_goal_vector` with:
37
+ - **targets**: which dimensions to improve and by how much (e.g., `{"punch": 0.4, "weight": 0.3, "energy": 0.3}`)
38
+ - **protect**: which dimensions must not drop below this value (e.g., `{"clarity": 0.8}` means clarity must stay ≥ 0.8 after the move)
39
+ - **mode**: observe | improve | explore | finish | diagnose
40
+ - **aggression**: 0.0 (subtle) to 1.0 (bold)
41
+ - **research_mode**: none (default) | targeted (for unknown plugins/styles) | deep (multi-source synthesis)
42
+
43
+ Quality dimensions: energy, punch, weight, density, brightness, warmth, width, depth, motion, contrast, clarity, cohesion, groove, tension, novelty, polish, emotion.
44
+
45
+ ### Step 2: Build World Model
46
+
47
+ Call `build_world_model`. It returns:
48
+ - **topology**: tracks, devices, clips, scenes, routing
49
+ - **sonic**: 8-band spectrum, RMS, detected key (if analyzer available)
50
+ - **technical**: analyzer status, FluCoMa status, unhealthy plugins
51
+ - **track_roles**: inferred from names (kick, bass, pad, lead, etc.)
52
+ - **issues**: sonic and technical problems detected by critics
53
+
54
+ ### Step 3: Consult Memory
55
+
56
+ Unless the user requests fresh exploration, call `memory_recall` with a query matching the task. Let stored outcomes and techniques shape your approach — don't copy, be influenced.
57
+
58
+ ### Step 4: Run Critics
59
+
60
+ Read the world model's `issues` section. The sonic critic detects:
61
+ - `low_mid_congestion` — mud in 200-500Hz
62
+ - `weak_foundation` — insufficient sub when bass tracks exist
63
+ - `harsh_highs` — excessive high+presence energy
64
+ - `headroom_risk` — RMS too close to ceiling
65
+ - `dynamics_flat` — insufficient crest factor
66
+
67
+ The technical critic detects:
68
+ - `analyzer_offline` — LivePilot Analyzer not receiving data
69
+ - `unhealthy_plugin` — dead AU/VST (opaque_or_failed_plugin flag)
70
+
71
+ ### Step 5: Choose Move
72
+
73
+ Pick the **smallest reversible high-confidence move** that attacks the highest-severity issue without violating protected dimensions. Prefer this order:
74
+ 1. Parameter tweak
75
+ 2. Subtle automation
76
+ 3. Activate/repair existing device
77
+ 4. Insert one device
78
+ 5. Note edit
79
+ 6. Arrangement edit
80
+
81
+ Avoid leading with destructive sample ops, large chain rebuilds, or multi-track changes.
82
+
83
+ ### Steps 6-8: Execute with Before/After Capture
84
+
85
+ **Before the move:** call `get_master_spectrum` + `get_master_rms` to capture the before state. Combine into a snapshot dict:
86
+ ```json
87
+ {"spectrum": <bands from get_master_spectrum>, "rms": <rms value>, "peak": <peak value>}
88
+ ```
89
+ Note: `get_master_spectrum` returns `{"bands": {...}}` — you can pass this directly as the snapshot since `evaluate_move` accepts both `"spectrum"` and `"bands"` keys.
90
+
91
+ **Execute the move** with full health checks (see below).
92
+ **After the move:** call the same tools again for the after state.
93
+
94
+ ### Step 9: Evaluate
95
+
96
+ Call `evaluate_move` with the goal vector and before/after snapshots. It returns:
97
+ - `score` (0-1)
98
+ - `keep_change` (bool)
99
+ - `goal_progress` (how much closer to the goal)
100
+ - `collateral_damage` (how much protected dimensions were harmed)
101
+ - `notes` (human-readable explanations)
102
+
103
+ **Hard rules** (enforced by the engine):
104
+ - Undo if measurable delta ≤ 0 (no improvement)
105
+ - Undo if any protected dimension dropped > 0.15
106
+ - Undo if total score < 0.40
107
+
108
+ **When all target dimensions are unmeasurable** (e.g., groove, tension, motion): the engine defers to your musical judgment. Use your ears and musical knowledge for the keep/undo decision.
109
+
110
+ ### Step 10: Keep or Undo
111
+
112
+ If `keep_change` is false: call `undo()` immediately. Check `consecutive_undo_hint` in the response.
113
+ If `keep_change` is true: the change stays, reset your undo counter to 0.
114
+
115
+ **Undo counter discipline:** Maintain a mental count of consecutive undos. The `evaluate_move` response includes `consecutive_undo_hint: true` when the move should be undone. Track these:
116
+ - 1 undo: normal, try a different approach
117
+ - 2 undos: narrow scope, try parameter tweaks only
118
+ - 3 undos: **STOP**. Switch to observe mode. Report to the user what you tried and what failed. Ask for guidance.
119
+
120
+ ### Step 11: Learn
121
+
122
+ If the move was kept and was notable, save it:
123
+ ```
124
+ memory_learn(type="outcome", name="descriptive name",
125
+ qualities={"summary": "what worked and why"},
126
+ payload={"goal_vector": {...}, "move": {...}, "score": 0.72, "kept": true})
127
+ ```
128
+
129
+ ## Modes
130
+
131
+ The mode shapes behavior. The user doesn't name modes — you infer from context.
132
+
133
+ | Mode | When | Behavior |
134
+ |------|------|----------|
135
+ | **observe** | "what's going on?" / ambiguous request | Read-heavy, minimal writes, report world model + issues |
136
+ | **improve** | Default for most requests | Targeted diagnosis, small reversible changes, strong verification |
137
+ | **explore** | "surprise me" / "try something weird" | Higher novelty budget, looser constraints, still reversible |
138
+ | **finish** | "polish this" / "prep for export" | Lower novelty, stronger preservation, technical focus |
139
+ | **diagnose** | "what's wrong?" / "why doesn't this work?" | Analysis-first, highly explanatory, minimal intervention |
140
+
141
+ ## Composition Intelligence
142
+
143
+ For arrangement requests ("turn this loop into a real verse", "make the chorus lift", "add a breakdown"), use the composition tools:
144
+
145
+ ### When to Use
146
+ - `analyze_composition` — first call for any structural request. Returns section graph, phrase grid, role graph, and issues from form/section-identity/phrase critics.
147
+ - `get_section_graph` — lightweight check of section structure only.
148
+ - `get_phrase_grid` — inspect phrase boundaries in a specific section.
149
+ - `plan_gesture` — translate musical intent into concrete automation plans.
150
+ - `evaluate_composition_move` — compare before/after issue lists to score a structural change.
151
+
152
+ ### Gesture Authoring Workflow
153
+ 1. `analyze_composition` → identify structural issues
154
+ 2. `plan_gesture(intent="reveal", target_tracks=[6], start_bar=8)` → get automation plan
155
+ 3. `apply_automation_shape(curve_type=plan.curve_family, ...)` → execute the gesture
156
+ 4. `analyze_composition` again → compare issues before/after
157
+ 5. `evaluate_composition_move(before_issues, after_issues)` → keep or undo
158
+
159
+ ### Gesture Intents
160
+ | Intent | Musical Meaning | Curve |
161
+ |--------|----------------|-------|
162
+ | `reveal` | Open filter, grow send, unmask | exponential up |
163
+ | `conceal` | Close filter, narrow, darken | logarithmic down |
164
+ | `handoff` | One voice dims, another emerges | s_curve |
165
+ | `inhale` | Pull energy back before impact | exponential down |
166
+ | `release` | Restore weight/width after tension | spring up |
167
+ | `lift` | HP filter rise, reverb increase | exponential up |
168
+ | `sink` | LP close, settle into sub | logarithmic down |
169
+ | `punctuate` | Dub throw, beat repeat burst | spike |
170
+ | `drift` | Subtle organic movement | perlin |
171
+
172
+ ## Building From Scratch
173
+
174
+ When creating a new beat/track (not modifying existing), use this expanded flow:
175
+
176
+ 1. **Compile goal** as above
177
+ 2. **Plan** — decide tempo, key, track layout, instrument choices, arrangement structure
178
+ 3. **Build tracks** — create and name with colors
179
+ 4. **Load instruments** — find and load synths, drum kits, samplers
180
+ 5. **HEALTH CHECK** — verify every track produces sound (see below)
181
+ 6. **Program patterns** — write MIDI notes fitting genre/style
182
+ 7. **Add effects** — load and configure effect chains
183
+ 8. **HEALTH CHECK** — verify effects aren't pass-throughs
184
+ 9. **Automate** — use the evaluation loop (steps 5-11) for each automation decision
185
+ 10. **Mix** — balance volumes, panning, sends
186
+ 11. **Final evaluation** — build_world_model + evaluate overall result
30
187
 
31
188
  ## Mandatory Track Health Checks
32
189
 
33
190
  **A track with notes but no working instrument is silence. This is the #1 failure mode. CHECK EVERY TRACK.**
34
191
 
35
- After loading any instrument, run this checklist:
192
+ After loading any instrument:
36
193
 
37
194
  | Check | Tool | What to look for |
38
195
  |-------|------|-----------------|
39
196
  | Device loaded? | `get_track_info` | `devices` array not empty, correct `class_name` |
40
- | Drum Rack has samples? | `get_rack_chains` | Must have named chains ("Bass Drum", "Snare", etc.). Empty = silence. |
197
+ | Drum Rack has samples? | `get_rack_chains` | Named chains ("Bass Drum", "Snare", etc.). Empty = silence. |
41
198
  | Synth has volume? | `get_device_parameters` | `Volume`/`Gain` > 0, oscillators on |
42
199
  | Effect is active? | `get_device_parameters` | `Dry/Wet` > 0, `Drive`/`Amount` > 0 |
43
200
  | Track volume? | `get_track_info` | `mixer.volume` > 0.5 for primary tracks |
@@ -46,47 +203,84 @@ After loading any instrument, run this checklist:
46
203
 
47
204
  ### Critical device loading rules:
48
205
 
49
- - **NEVER load bare "Drum Rack"** — it's empty, zero samples. Load a **kit preset**: `search_browser` path="Drums" name_filter="Kit" → pick one → `load_browser_item`
50
- - **For synths, use `search_browser` → `load_browser_item`** with exact URI. `find_and_load_device` can match sample files before the actual instrument (e.g., "Drift" matches a .wav sample first)
51
- - **After loading any effect**, set its key parameters to non-default values. A Saturator with Drive=0, a Reverb with Dry/Wet=0, or a Compressor with Threshold at max are all pass-throughs.
206
+ - **NEVER load bare "Drum Rack"** — it's empty. Load a **kit preset**: `search_browser` path="Drums" name_filter="Kit" → `load_browser_item`
207
+ - **For synths, use `search_browser` → `load_browser_item`** with exact URI
208
+ - **After loading any effect**, set key parameters to non-default values
209
+
210
+ ## V2 Engine Intelligence
211
+
212
+ Beyond the core Agent OS loop, you have access to specialized engines. Route requests to the right engine based on what the user asks for.
213
+
214
+ ### Request Routing
215
+
216
+ | User says... | Engine to use | Entry tool |
217
+ |-------------|---------------|------------|
218
+ | "make this cleaner/wider/punchier" | **Mix Engine** | `analyze_mix` → `plan_mix_move` |
219
+ | "turn this loop into a song" | **Composition** | `plan_arrangement` + `analyze_composition` |
220
+ | "make this synth sound more haunted" | **Sound Design** | `analyze_sound_design` → `plan_sound_design_move` |
221
+ | "make the drop feel earned" | **Transition Engine** | `analyze_transition` → `plan_transition` |
222
+ | "make it sound like Burial" | **Reference Engine** | `build_reference_profile` → `plan_reference_moves` |
223
+ | "will this translate to phone speakers?" | **Translation Engine** | `check_translation` |
224
+ | "help me in my live set" | **Performance Engine** | `get_performance_state` → `get_performance_safe_moves` |
225
+ | "research how to sidechain" | **Research** | `research_technique` |
226
+
227
+ ### Project Brain — Always Start Here
228
+
229
+ For any complex task, call `build_project_brain` first. It gives you:
230
+ - **SessionGraph**: tracks, devices, routing, scenes
231
+ - **ArrangementGraph**: sections, boundaries, cue points
232
+ - **RoleGraph**: who plays what in each section
233
+ - **AutomationGraph**: what's automated where
234
+ - **CapabilityGraph**: what tools/analysis are available
235
+
236
+ This replaces ad-hoc `get_session_info` + `get_track_info` calls for complex tasks.
237
+
238
+ ### Capability Awareness
239
+
240
+ Call `get_capability_state` to know what's trustworthy right now:
241
+ - `normal`: full analyzer + evaluation loop available
242
+ - `measured_degraded`: no analyzer — defer to musical judgment for keep/undo
243
+ - `judgment_only`: minimal evidence — be conservative
244
+ - `read_only`: can inspect but not mutate
245
+
246
+ ### Mix Engine Workflow
247
+ 1. `analyze_mix` → get balance, masking, dynamics, stereo, depth state + issues
248
+ 2. `plan_mix_move` → ranked move suggestions (smallest first)
249
+ 3. Execute the top move (EQ, compression, send adjustment, etc.)
250
+ 4. `evaluate_mix_move` with before/after snapshots → keep or undo
52
251
 
53
- ## Automation Phase (after writing notes, before mixing)
252
+ ### Sound Design Workflow
253
+ 1. `get_patch_model(track_index)` → understand the device chain
254
+ 2. `analyze_sound_design(track_index)` → issues from 5 timbral critics
255
+ 3. `plan_sound_design_move(track_index)` → suggested parameter/modulation changes
256
+ 4. Execute and evaluate
54
257
 
55
- ### Step 1: Spectral Diagnosis
56
- - Solo each track -> `get_master_spectrum` -> build spectral map
57
- - Identify frequency overlaps between tracks (masking)
58
- - Note problem areas: resonances, mud, harshness
258
+ ### Transition Workflow
259
+ 1. `analyze_transition(from_section, to_section)` boundary analysis + score
260
+ 2. `plan_transition(from_section, to_section)` archetype selection + gesture plan
261
+ 3. Execute gestures with `apply_automation_shape`
262
+ 4. `score_transition` to verify improvement
59
263
 
60
- ### Step 2: Per-Track Analysis
61
- - `analyze_for_automation` on each track -> get device-specific suggestions
62
- - Cross-reference with spectral map: which suggestions address the problems found?
264
+ ### Action Ledger
63
265
 
64
- ### Step 3: Write Automation (perception-action loop)
65
- For each automation decision:
66
- 1. Read spectrum BEFORE
67
- 2. Apply recipe or custom curve
68
- 3. Read spectrum AFTER
69
- 4. Compare: did it improve? If not, clear and adjust
70
- 5. Store the final working automation parameters in memory
266
+ Every move you make is tracked in the action ledger. Call `get_last_move` to review what you just did. Call `get_action_ledger_summary` to see your session history.
71
267
 
72
- ### Step 4: Spatial Design
73
- - Add send automation for depth (dub throws, reverb washes)
74
- - Consider complementary automation: as one track's filter opens, another's narrows
75
- - Use cross-track spectral awareness to avoid new masking from automation
268
+ ### Anti-Memory
76
269
 
77
- ### Step 5: Generative/Evolving Textures
78
- - Consider polyrhythmic automation for non-repeating evolution
79
- - Unlinked envelopes with prime-number beat lengths (3, 5, 7 beats)
80
- - Spectral-driven automation: use analyzer data to modulate parameters in real-time concepts
270
+ The system tracks what the user dislikes. Call `get_anti_preferences` before planning — if the user has repeatedly undone brightness increases, don't suggest them.
81
271
 
82
272
  ## Rules
83
273
 
84
- - Always use the livepilot-core skill for guidance on tool usage
85
- - Call `get_session_info` before making changes to understand current state
86
- - **Verify every track produces sound** — this is non-negotiable
87
- - Verify after every write operationre-read to confirm
274
+ - Always use the livepilot-core skill for tool usage guidance
275
+ - Use `build_project_brain` for complex tasks instead of ad-hoc state queries
276
+ - Check `get_capability_state` before trusting analyzer data
277
+ - **Verify every track produces sound** non-negotiable
278
+ - Verify after every write — re-read to confirm
88
279
  - Name everything clearly — tracks, clips, scenes
89
- - Report progress to the user at each major step
90
- - If something goes wrong, `undo` and try a different approach
91
- - Confirm before destructive operations (delete_track, delete_clip, delete_device)
280
+ - Report progress at each major step
281
+ - If something goes wrong, `undo()` and try a different approach
282
+ - Confirm before destructive operations
283
+ - **Never batch unrelated changes** — one intervention per evaluation cycle
284
+ - **Never execute without a verification plan** — know what you'll measure before acting
285
+ - Check `get_anti_preferences` before repeating a move type the user dislikes
92
286
  - Keep it musical — think about rhythm, harmony, and arrangement