.claude/skills/max-patch-agent/SKILL.md
Generate MAX patches with control flow, message routing, subpatcher organization, and MIDI handling
npx skillsauth add taylorbrook/MAX-MSP_CC_Framework max-patch-agentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The Patch agent generates MAX/MSP .maxpat files focused on control-rate operations: object routing, message passing, subpatcher organization, MIDI handling, and data management.
Before any generation:
CLAUDE.md at project root -- follow all 5 rules and patch style guidelinesObjectDatabase from src.maxpat.db_lookup for all object lookups -- it loads all domains, resolves aliases, checks PD blocklist, and provides relationship data automatically.claude/max-objects/relationships.json for common object pairings (if needed for design decisions)config.json via load_project_config() from src.maxpat.project for allowed packages. Pass allowed_packages to Patcher(allowed_packages=allowed) so package objects outside the project's selection are blocked at creation time.Domain focus: Max control/data/UI objects. Signal processing and RNBO are handled by their respective agents.
Patcher instances with boxes and connections via src.maxpat.patcherBox constructor for all standard objects (validates against ObjectDatabase)Box.__new__() bypass for structural objects: subpatchers, bpatcherPatcher.add_connection(src_box, src_outlet, dst_box, dst_inlet)Patcher() -- create a new patchBox(name, args, db) -- create a validated boxPatcher.add_box(box) -- add box to patchPatcher.add_connection(src_box, src_outlet, dst_box, dst_inlet) -- connect boxesPatcher.add_subpatcher(name, inlets, outlets, inlet_comments, outlet_comments) -- add a subpatcher with labeled I/OPatcher.populate_assistance_comments() -- auto-fill empty inlet/outlet comments from connection contextfinalize_patch(patcher, is_new=True) -- single-call layout cleanup: styling, layout, comments, midpoints (new); midpoints + comments (edit)apply_layout(patcher, layout_options=None) -- row-based topological layout positioning (accepts LayoutOptions)validate_patch(patcher.to_dict(), db=patcher.db) -- run four-layer validation pipelinesave_patch_roundtrip(patcher.to_dict(), path) -- write .maxpat to diskPatcher.add_comment(text, x, y) -- add a comment box (for inline annotations, critic notes)Patcher.add_message(text, x, y) -- add a message box (for triggering messages, storing values)Patcher.add_node_script(filename, code=None, num_outlets=2, x, y) -- add a node.script box for Node for Max (returns tuple of Box and code string)Patcher.add_js(filename, code=None, num_inlets=1, num_outlets=1, x, y) -- add a js object box for V8 JavaScript (returns tuple of Box and code string)#N tokens in bpatcher subpatches must be standalone (space-delimited), never embedded in compound stringsbuffer~ slot-#1 -- compound substitution fails silently in MAXbuffer~ #1 with bpatcher arg "slot-1" -- standalone token works correctly#1, #2, etc.)["slot-1", "slot-1-out"] where #1 = buffer name, #2 = send nametrigger (t) for ALL control-rate fan-out -- connecting one outlet to 2+ destinations without trigger is a structural defect (see shared-capabilities.md "Control-Rate Fan-Out Rule")trigger to guarantee ordering (CLAUDE.md Rule #3).claude/skills/references/ui-presets.mdShared Capabilities: See
.claude/skills/references/shared-capabilities.mdfor Control-Rate Fan-Out Rule, Assistance Comments, Aesthetic Capabilities, Layout Options, Editing Functions, and Edit Workflow reference.
When generating patches with package objects (BEAP, Vizzie, etc.), read .claude/max-objects/PACKAGES.md for:
BEAP modules are bpatchers that emulate analog modular synthesis:
add_bpatcher(object_name="bp.Oscillator", filename="bp.Oscillator.maxpat") for auto-sized placementCommunity packages (FluCoMa, CNMAT, Bach, Odot, ml-lib, IRCAM Spat, Cage, Dada, EARS, Rhythmic Time Toolkit) have stub DB entries but require local extraction before generation.
Before using any community package object:
ObjectDatabase().get_package_info(package_name)["extracted"]false: inform the user they must install and extract first (see max-lifecycle SKILL.md for exact messages)true: proceed normally -- extracted data is verified and safe for generationPackage-specific notes:
fluid.*): Audio analysis/decomposition. Signal objects + offline buf* objects.resonators~, analyzer~).bach.*): Uses llll data type (NOT standard MAX lists). Never mix llll with regular lists. Use bach.list2llll/bach.llll2list for conversion.o.*): OSC bundle-based expression language.ml.*): Machine learning. All follow add/train/map pattern.spat5.*): Spatial audio. Parameters via OSC bundles.rtk.*): Signal-rate RNBO sequencing.Vizzie modules pass Jitter matrices (video frames) between bpatchers:
add_bpatcher(object_name="vz.playr", filename="vz.playr.maxpat") for auto-sized placementStructured workflow blueprints for generating working package patches. Each template specifies objects, connection order, I/O types, parameter ranges, and gotchas. Templates are generation guidance -- not pre-built .maxpat files.
Use case: Build nested list structures for algorithmic composition Chain: data source (message/number) -> bach.list2llll -> bach.join / bach.flat / bach.nth (llll manipulation) -> bach.score or bach.roll
| # | Source | Outlet | Destination | Inlet | Type | |---|--------|--------|-------------|-------|------| | 1 | (MAX list source) | 0 | bach.list2llll | 0 (list in) | list | | 2 | bach.list2llll | 0 (llll out) | bach.join | 0 (llll in 1) | llll | | 3 | bach.list2llll | 0 (llll out) | bach.join | 1 (llll in 2) | llll | | 4 | bach.join | 0 (joined llll) | bach.flat | 0 (llll in) | llll | | 5 | bach.flat | 0 (flattened llll) | bach.nth | 0 (llll in) | llll | | 6 | bach.nth | 0 (extracted element) | bach.score | 0 (llll data) | llll |
Parameter ranges:
@numins default 2 (number of llll inlets to join)bach.nth 1 extracts the first element)Gotchas:
Use case: Display and edit musical notation with bach.score or bach.roll Chain: bach.score (or bach.roll) <- llll data via inlet 0; message box commands (addchord, delete) via inlet 0
| # | Source | Outlet | Destination | Inlet | Type | |---|--------|--------|-------------|-------|------| | 1 | (llll data source) | 0 | bach.score | 0 (llll data / commands) | llll | | 2 | message box ("addchord ...") | 0 | bach.score | 0 (command) | message | | 3 | bach.score | 0 (modified llll) | (downstream bach processing) | 0 | llll | | 4 | bach.score | 1 (notifications) | (status display) | 0 | list |
Parameter ranges:
Gotchas:
Use case: Generate musical material algorithmically and display in notation Chain: algorithm source (metro + counter / random) -> bach.list2llll -> bach.collect -> bach.quantize -> bach.score
| # | Source | Outlet | Destination | Inlet | Type | |---|--------|--------|-------------|-------|------| | 1 | metro | 0 (bang) | trigger b b | 0 | bang | | 2 | trigger | 0 | random 12700 | 0 (bang) | bang | | 3 | random | 0 (pitch value) | bach.list2llll | 0 | list | | 4 | bach.list2llll | 0 (llll) | bach.collect | 0 (llll in) | llll | | 5 | trigger | 1 | bach.collect | 0 (bang to flush) | bang | | 6 | bach.collect | 0 (collected llll) | bach.quantize | 0 (llll in) | llll | | 7 | bach.quantize | 0 (quantized llll) | bach.score | 0 (llll data) | llll |
Parameter ranges:
Gotchas:
Domain focus: Edit control flow routing, message handling, subpatcher organization.
finalize_patch(patcher, is_new=True) -- applies styling, layout, assistance comments, and midpoint generation for all patchers and subpatcherspatch_dict = patcher.to_dict(), results = validate_patch(patch_dict, db=patcher.db)(patch_dict, results) tuple for critic reviewsave_patch_roundtrip(patch_dict, path) to project's generated/ directoryread_patch() and patcher.analyze()finalize_patch(patcher, is_new=False) -- regenerates cable midpoints and populates assistance comments without repositioning existing objectsvalidate_patch(patcher)save_patch_roundtrip()data-ai
Design and position UI controls for MAX patches in presentation and patching mode
testing
Analyzes user task descriptions and dispatches to the correct specialist agent(s) for MAX/MSP generation
data-ai
RNBO export-aware patch generation, target validation, and param mapping
testing
Manages MAX project creation, status tracking, project switching, and test protocol execution