ruvnet/ruflo/tree/main/plugins/ruflo-music
ruflo-music
通过 Cognitum Music(cogmusic MCP)进行 AI 音乐生成:使用你自己的 music.cognitum.one 账号创作歌词/提示词、生成音轨、分离 stem、提取 MIDI 并进行母带处理。作为 mod(ADR-445),它还提供仅收紧的工具防护、/music-mod,以及在控制台显示的状态文件。
关于这个 mod
ruflo-music
通过 Cognitum Music 生成 AI 音乐:创作歌词/提示词、生成音轨、分离 stem、提取 MIDI 并进行母带处理,全部通过 cogmusic MCP 服务器,使用你自己的 Cognitum 账号完成。
概览
它把 cogmusic MCP 桥接封装成 Ruflo 插件,包含 2 个 agent、7 个 skill 和一个调度命令。与大多数同系列插件不同,这里没有本地执行的 CLI 执行阶段:每次真正的生成都在远程 GPU 推理服务(MiniMax-Music3)上运行,通过手工编写的 MCP 服务器访问;你的账号使用自己签发的 personal access token 进行身份验证。
前置条件
- 一个 Cognitum Music 账号:music.cognitum.one。
- 一个
cogmcp_...personal access token,在music.cognitum.one/mcp签发(登录后选择“Generate connection token”)。它只会显示一次,请立即复制。这个插件无法替你签发或轮换 token。 - 将
[email protected]或更高版本注册为 MCP 服务器:claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest0.1.0没有 fetch timeout 覆写功能,任何运行超过 Node 默认约 5 分钟的create_production调用都会失败;真实生成通常需要更久。完整设置流程请参阅music-connectskill。
安装
claude --plugin-dir plugins/ruflo-music
MCP 整合(6 个工具)
注册后,cogmusic 会公开 6 个工具:
claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest
claude mcp get cogmusic # 预期:✔ Connected
| 工具 | 用途 |
|------|------|
| list_productions | 列出已保存的制作项目(每项包含 metadata 和 audio_url) |
| get_production | 取得一个制作项目的当前 metadata 和 audio_url |
| create_production | 根据歌词和风格提示词生成新音轨(会阻塞数分钟) |
| separate_stems | 分离 4 条 stem(人声/鼓/贝斯/其他) |
| extract_midi | 提取经过音高追踪的 MIDI/乐谱 |
| master | 进行 LUFS 响度标准化和峰值限制 |
Agents
| Agent | 角色 |
|-------|------|
| music-composer | 根据创意简报编写结构化歌词和流派/风格提示词。不调用 MCP 工具。 |
| music-producer | 流程入口:将编曲委派给 music-composer,调用 create_production,缓存结果,可选择后处理,并报告 audio_url。 |
Skills
| Skill | 用途 |
|-------|------|
| music-connect | 一次性设置:注册 cogmusic MCP 服务器 |
| music-generate | 根据完整指定的简报生成音轨 |
| music-list | 列出账号中的所有制作项目 |
| music-get | 取得一个制作项目的 metadata 和 audio_url |
| music-stems | 对现有制作项目执行 4-stem 分离 |
| music-midi | 从现有制作项目提取 MIDI |
| music-master | 对现有制作项目执行一次母带处理(LUFS) |
Commands
/music connect [--token cogmcp_...]
/music generate <brief>
/music list
/music get <production-id>
/music stems <production-id>
/music midi <production-id>
/music master <production-id>
已知缺口(已披露,不会静默省略)
- MCP 按设计不会传送音频字节。 每个返回制作项目的工具都会提供
audio_url,而不是音频本身;必须使用相同的cogmcp_token,以Authorization: Bearer发出另一次经过身份验证的GET。 - 目前 stem 和 MIDI 没有
audio_url。separate_stems/extract_midi会确认生成了什么(通过get_production查看has_stems/has_midi),但衍生的音频/MIDI 文件目前只能在 dashboard 中取得。已经用于主要音轨的 PAT-authorized-URL 模式(见 Architecture Decisions)尚未由上游扩展到这两个端点。 - GPU 推理服务确实有可靠性历史问题。 间歇性的冷启动失败已在上游经过 3 次迭代完成根因分析和修复(见 ADR-0001 的 Related 部分);单次重试可以解决大多数暂时性失败。每个生成类 skill 都会记录这一点,而不是把第一次失败视为最终结果。
相容性
- CLI: 固定使用
@claude-flow/cliv3.6 major+minor。 - Runtime:
[email protected]+npm 套件(stdio↔HTTP MCP bridge)通过claude mcp add注册;没有本地计算,生成会在你无法控制的远程 GPU 服务上执行。 - 验证:
bash plugins/ruflo-music/scripts/smoke.sh是约定。
Namespace 协作
这个插件拥有两个 AgentDB namespace(kebab-case,遵循 ruflo-agentdb ADR-0001 §“Namespace convention” 的约定):
| Namespace | 用途 |
|-----------|------|
| music-productions | 缓存制作项目 metadata:id、title、audio_url、prompt、lyrics、duration、处理步骤旗标,用于回忆,无需往返调用 list_productions/get_production |
| music-briefs | 生成每个制作项目的创意简报,以制作项目 id 为键;之后说“再做一个类似的”时,可以取回确实有效的完整 prompt/lyrics 结构 |
所有访问都通过 memory_*(按 namespace 路由)。这个插件中任何地方都不会调用带有 namespace 参数的 agentdb_pattern-* 或 agentdb_hierarchical-*。保留的 namespace(pattern、claude-memories、default)绝不会被遮蔽。
验证
bash plugins/ruflo-music/scripts/smoke.sh
# 预期:“10 passed, 0 failed”
架构决策
- ADR-0001:插件契约,包括 PAT 身份验证模型、
audio_url传递模式、namespace 声明和已披露的可靠性状况。
相关插件
- ruflo-agentdb:本插件遵循的 namespace 约定
- ruflo-neural-trader:最接近的外部服务封装插件契约先例(本地 CLI 与远程 PAT 身份验证 MCP 服务器的形态不适用之处已分开处理)
许可证
MIT
作为 mod
Function-hook mod(ADR-445 模式,hooks/register.ts)。它不会联网、启动进程或调用模型,但会加入以下内容:
- Guard(仅收紧,默认开启):如果
cogmusic调用(create_production、separate_stems、master、extract_midi)或 memory 写入的 prompt/lyrics/payload 含有秘密,就拒绝该调用(prompt 会离开本机前往 music.cognitum.one)。拒绝原因只会指出规则,不会透露值。 /music-mod:本机status和scan <text>(秘密检查,规则与 guard 相同);状态文件也会统计已开始的制作项目数量。- 状态文件
.claude-flow/music-mod/status.json({version:1, updatedMs, guard, checked, blocked, ...}),会在工作阶开始和计数器变化时写入。
这里刻意没有加入每个 prompt 的上下文:这个插件没有值得附加到每个 prompt 的内容。
| 选项 | 默认值 | 效果 |
|---|---|---|
| guard | on | 拒绝上述调用 |
测试:claude plugin validate plugins/ruflo-music、claude plugin test plugins/ruflo-music、bash plugins/ruflo-music/scripts/smoke.sh。
安装
请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。
claude plugin marketplace add ruvnet/ruflo claude plugin install ruflo-music
原文 / README
ruflo-music
AI music generation via Cognitum Music — compose lyrics/prompts, generate tracks, separate stems, extract MIDI, and master, all through the cogmusic MCP server against your own Cognitum account.
Overview
Wraps the cogmusic MCP bridge as a Ruflo plugin with 2 agents, 7 skills, and one dispatcher command. Unlike most sibling plugins, there's no locally-executed CLI runtime here — every real generation runs on a remote GPU inference service (MiniMax-Music3), reached over a hand-rolled MCP server your own account authenticates against with a personal access token you mint yourself.
Prerequisites
- A Cognitum Music account at music.cognitum.one.
- A
cogmcp_...personal access token, minted atmusic.cognitum.one/mcp(sign in → "Generate connection token"). Shown exactly once — copy it immediately. This plugin cannot mint or rotate this token for you. [email protected]or later registered as an MCP server:claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest0.1.0has no fetch timeout override and fails anycreate_productioncall that runs past Node's ~5-minute default — real generations routinely take longer. See themusic-connectskill for the full setup flow.
Installation
claude --plugin-dir plugins/ruflo-music
MCP Integration (6 Tools)
cogmusic exposes 6 tools once registered:
claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest
claude mcp get cogmusic # expect: ✔ Connected
| Tool | Purpose |
|------|---------|
| list_productions | List saved productions (metadata + audio_url each) |
| get_production | Fetch one production's current metadata + audio_url |
| create_production | Generate a new track from lyrics + a style prompt (blocks for minutes) |
| separate_stems | 4-stem separation (vocals/drums/bass/other) |
| extract_midi | Pitch-tracked MIDI/score extraction |
| master | LUFS loudness normalization + peak limiting |
Agents
| Agent | Role |
|-------|------|
| music-composer | Writes structured lyrics + a genre/style prompt from a creative brief. Calls no MCP tools. |
| music-producer | Pipeline entry point — delegates composition to music-composer, calls create_production, caches the result, optionally post-processes, reports the audio_url. |
Skills
| Skill | Purpose |
|-------|---------|
| music-connect | One-time setup — register the cogmusic MCP server |
| music-generate | Generate a track from a fully-specified brief |
| music-list | List all productions in the account |
| music-get | Fetch one production's metadata + audio_url |
| music-stems | Run 4-stem separation on an existing production |
| music-midi | Extract MIDI from an existing production |
| music-master | Run a mastering (LUFS) pass on an existing production |
Commands
/music connect [--token cogmcp_...]
/music generate <brief>
/music list
/music get <production-id>
/music stems <production-id>
/music midi <production-id>
/music master <production-id>
Known gaps (disclosed, not silently omitted)
- No audio bytes over MCP, by design. Every tool that returns a production carries an
audio_url, not the audio itself — always a separate authenticatedGETwith the samecogmcp_token asAuthorization: Bearer. - Stems and MIDI have no
audio_urlyet.separate_stems/extract_midiconfirm what was produced (has_stems/has_midiviaget_production), but the derived audio/MIDI files are dashboard-only today — the PAT-authorized-URL pattern that already covers the primary track (see Architecture Decisions) hasn't been extended to these two endpoints upstream. - The GPU inference service has a real reliability history. Intermittent cold-start failures were root-caused and fixed upstream across three iterations (see ADR-0001's Related section) — a single retry resolves most transient failures; every generation-class skill documents this rather than treating a first failure as final.
Compatibility
- CLI: pinned to
@claude-flow/cliv3.6 major+minor. - Runtime:
[email protected]+npm package (stdio↔HTTP MCP bridge) registered viaclaude mcp add; no local compute — generation runs on a remote GPU service you don't control. - Verification:
bash plugins/ruflo-music/scripts/smoke.shis the contract.
Namespace coordination
This plugin owns two AgentDB namespaces (kebab-case, follows the convention from ruflo-agentdb ADR-0001 §"Namespace convention"):
| Namespace | Purpose |
|-----------|---------|
| music-productions | Cached production metadata — id, title, audio_url, prompt, lyrics, duration, processing-step flags — for recall without a round-trip to list_productions/get_production |
| music-briefs | The creative brief that produced each production, keyed by production id, so a later "make another one like that" can retrieve the exact prompt/lyrics shape that worked |
All access via memory_* (namespace-routed). No agentdb_pattern-* or agentdb_hierarchical-* calls with a namespace argument anywhere in this plugin. Reserved namespaces (pattern, claude-memories, default) are never shadowed.
Verification
bash plugins/ruflo-music/scripts/smoke.sh
# Expected: "10 passed, 0 failed"
Architecture Decisions
- ADR-0001 — plugin contract: PAT auth model,
audio_urldelivery pattern, namespace claims, disclosed reliability posture.
Related Plugins
- ruflo-agentdb — namespace convention this plugin follows
- ruflo-neural-trader — closest sibling precedent for an external-service-wrapping plugin contract (diverged where local-CLI vs. remote-PAT-authed-MCP-server shape doesn't fit)
License
MIT
As a mod
Function-hook mod (ADR-445 pattern, hooks/register.ts). It adds, with no network, no process spawning and no model call:
- Guard (tighten-only, default on): refuses a
cogmusiccall (create_production, separate_stems, master, extract_midi) or memory write whose prompt/lyrics/payload holds a secret (prompts leave the machine for music.cognitum.one). The deny reason names the rule, never the value. /music-mod: localstatusandscan <text>(secret check, same rules as the guard); the status file also counts productions started.- Status file
.claude-flow/music-mod/status.json({version:1, updatedMs, guard, checked, blocked, ...}), written at session start and when counters change.
Per-prompt context is deliberately not added: this plugin has nothing worth attaching to every prompt.
| Option | Default | Effect |
|---|---|---|
| guard | on | refuse the calls above |
Test: claude plugin validate plugins/ruflo-music, claude plugin test plugins/ruflo-music, bash plugins/ruflo-music/scripts/smoke.sh.
