MotifAI 7.2.0: Building a Local-First AI Music Studio in Rust
I've been building MotifAI to make AI-assisted music composition feel less like asking a model for a block of code and more like working in a creative studio. MotifAI connects locally installed Ollama models to Strudel,
I've been building MotifAI to make AI-assisted music composition feel less like asking a model for a block of code and more like working in a creative studio.
MotifAI connects locally installed Ollama models to Strudel, turning a musical brief into an executable live-coding composition. The project is open source: explore MotifAI on GitHub.
From a musical idea to an executable score
A session starts with a musical vision and style direction: genre, energy, instrumentation, arrangement, or a targeted change to an existing score. MotifAI classifies the work as a new composition, focused edit, evolution, or technical repair, then builds a request that fits that job.
The composition palette includes 65 arrangement architectures, 31 instrument-role palettes, 13 production palettes, and 11 visual telemetry families. You can use a blueprint, let Smart Auto choose a structure, or switch to Free-Form and leave the blueprint out.
The result is Strudel JavaScript, with the goal of making each section, stem, and live control useful in the actual music environmentβnot just plausible in a text response.
The engineering around generation
A lot of the work has been about making generation predictable and recoverable:
- Recipe-based request compilation builds task-aware prompts and inference profiles, streams tokens over NDJSON, and reports the effective context and output limits.
- Two-stage score verification runs a conservative lexical preflight, then evaluates candidates in an embedded Strudel runtime when available. Missing runtime support is reported as unverified rather than treated as a pass.
- Bounded repair gives failed candidates a focused repair path while keeping the original available for diagnosis.
- Session controls support undo and redo, cancellation, exports, and optional reference material. Golden Scorebook tracks and empirical memory remain opt-in.
Whatβs new in v7.2.0: the Engram Planner
The newest addition is src/engram_planner.rs, a request-time memory planner. It works alongside MotifAIβs existing SonicIntelligence memory: that system stores experiments and feedback, while the Engram Planner decides whether a small piece of that history is supported and relevant enough to help with the current request.
The planner applies an evidence gate before anything can enter a prompt:
- A preference needs provenance, non-heuristic evidence, and at least two decisive explicit user signals.
- A technical warning needs repeated, non-heuristic AST diagnostic failures.
- Heuristic-only findings, descriptive counts, missing provenance, and weak or mixed evidence are excluded.
Eligible findings are ranked by relevance to the current musical vision and style, confidence, evidence quality and consistency, and recency. Retrieval is deterministic and bounded: at most eight notes, four per category, 240 characters per note, and a context-aware budget between 192 and 512 estimated tokens.
That last word matters: this does not apply a DeepSeek tokenizer to every Ollama model. MotifAI supports different model families, so the planner reuses the projectβs conservative character-based estimate instead. When Ollama reports prompt-token usage, MotifAI logs it beside the estimate so the two can be compared.
Memory injection stays off until enabled with Ctrl+A. The planner does not save model chain-of-thought, and retrieved memories are framed as untrusted evidence rather than instructions.
Why build it this way?
More context is not automatically better context. A useful memory system should retrieve fewer, stronger notes, fit within a predictable budget, and make it possible to inspect why a note was selected. The Engram Planner is a step toward that: a focused layer for relevant, evidence-backed memory, instead of a larger prompt stuffed with everything the app has ever observed.
MotifAI is still evolving, and Iβm testing the new release locally as I build. If youβre interested in local models, Rust, Strudel, or the design tradeoffs behind memory-aware creative tools, Iβd love to hear what you think.
Repository: github.com/ShamelesAbyss/MotifAI
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.