Externals Specialist Agent
Scaffold, generate, build, and validate C++ externals using the Min-DevKit. Supports three archetypes (message, dsp, scheduler) with automated build loops, .mxo validation, and help patch generation.
Capabilities
- Min-DevKit scaffolding: Create complete project directories with source, CMake, and help files via
scaffold_external - Three archetypes: message (control objects), dsp (signal processing), scheduler (timed events)
- Code generation: Generate archetype-specific C++ source via
generate_external_code - Build and compile: Automated cmake/make build loop with error parsing and auto-fix via
build_external - Min-DevKit setup: Clone Min-DevKit (recursively, with min-api) into the external's own
min-devkit/folder viasetup_min_devkit, listed in that folder's.gitignoreso it stays outside the framework repo's index - .mxo validation: Post-compile binary validation (Mach-O type, arm64 architecture) via
validate_mxo - Help patch generation: Create .maxhelp demonstration patches via
generate_help_patch - Code review: Run external critic for structural code issues
Shared Capabilities: See
.claude/skills/references/shared-capabilities.mdfor Z-Order Manipulation, Aesthetic Capabilities, Layout Options, Editing Functions, and Edit Workflow reference.
Domain Context Loading
When invoked:
- Read
.claude/skills/max-ext-agent/BOUNDARIES.mdfor scope and conventions, and TECHNICAL.md "External Critic (ext_critic.py)" for what the critic checks (CLAUDE.md has no externals section beyond the.mxofile convention) - No object database needed -- externals are custom objects not in the DB
Python API References
from src.maxpat.externals import (
scaffold_external,
generate_external_code,
build_external,
setup_min_devkit,
generate_help_patch,
)
from src.maxpat.ext_validation import (
validate_mxo,
BuildResult,
)
from src.maxpat.critics import review_patch
from src.maxpat.critics.ext_critic import review_external
Key Functions
scaffold_external(project_dir, name, archetype, description): Creates complete project directory structuregenerate_external_code(name, archetype, description, **kwargs): Returns C++ code stringsetup_min_devkit(ext_dir): Clones Min-DevKit recursively (with min-api) intoext_dir/min-devkit/and listsmin-devkit/inext_dir/.gitignore, outside the framework repo's index;ext_diris the scaffold root, and a MAX name with~scaffolds as<name>_tilde/(min-api's CMake builds it back into<name>~.mxo)build_external(ext_dir, max_attempts=5): cmake/make build loop with auto-fix and loop detectionvalidate_mxo(mxo_path): Post-compile .mxo bundle validationgenerate_help_patch(name, archetype): Builds a demonstration .maxhelp Patcherreview_external(code_str, archetype): Semantic code review for structural issuesBuildResult: Dataclass with success, mxo_path, errors, attempts, message
Editing Existing Patches (via /max-iterate)
Domain focus: Edit external help patches; C++ source edits are direct file writes.
Output Protocol (New Patches)
- Scaffold the external project using
scaffold_externalwith the chosen archetype - Set up Min-DevKit via
setup_min_devkit(clones Min-DevKit with min-api into the external's ownmin-devkit/folder and lists it in that folder's.gitignore) - Build the external using
build_externalwith auto-fix loop (max 5 attempts, loop detection via error hashing) - Validate .mxo output using
validate_mxo(checks Mach-O type, arm64 architecture) - Write help patch via
generate_help_patchfor the external
Output Protocol (Edited Patches)
Follow "Output Protocol (Edited Patches)" in .claude/skills/references/shared-capabilities.md.
Archetype Reference
| Archetype | Use Case | Key Patterns |
|-----------|----------|-------------|
| message | Control objects, data processing | inlet<>, outlet<>, message handlers |
| dsp | Signal processing externals | sample_operator / vector_operator |
| scheduler | Timed/scheduled events | timer<>, interval attributes |
When to Use
- User asks about building C/C++ externals for Max
- User wants to create a custom DSP object, message processor, or scheduler
- User needs Min-DevKit project scaffolding
- Router dispatches an externals-related task
When NOT to Use
- gen~ DSP code (runs inside MAX, not as an external) -- use max-dsp-agent
- RNBO export (export-ready patches, not native code) -- use max-rnbo-agent
- Node for Max or js scripts (JavaScript, not C++) -- use max-js-agent
- UI externals using the classic Max SDK (deferred -- not yet supported)
- Distribution or code signing