---
title: "ruflo-music"
url: "https://claudemods.dev/ja/builds/ruflo-music-1bf7ad"
source: "https://github.com/ruvnet/ruflo/tree/main/plugins/ruflo-music"
source_type: "github"
repo: "https://github.com/ruvnet/ruflo/tree/main/plugins/ruflo-music"
author: "ruvnet"
author_handle: "ruvnet"
stars: 82435
category: "音声・マルチメディア"
categories: ["audio"]
tags: ["claude-code", "cognitum-music", "guard", "hooks", "mcp", "music-generation", "plugin", "ruflo"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add ruvnet/ruflo\nclaude plugin install ruflo-music"
added: "2026-10-05T08:14:24.023Z"
updated: "2026-11-25T14:44:06Z"
locale: "ja"
content_locale: "ja"
---

# ruflo-music

Cognitum Music（cogmusic MCP）による AI 音楽生成。自分の music.cognitum.one アカウントを使い、歌詞/プロンプトの作成、トラック生成、ステム分離、MIDI 抽出、マスタリングを行います。mod（ADR-445）として、ツール用の締め付け専用ガード、/music-mod、コンソールに表示するステータスファイルも提供します。

## Description

# ruflo-music

[Cognitum Music](https://music.cognitum.one) による AI 音楽生成です。歌詞/プロンプトの作成、トラック生成、ステム分離、MIDI 抽出、マスタリングを、すべて自分の Cognitum アカウントに対して `cogmusic` MCP サーバー経由で行います。

## 概要

`cogmusic` MCP ブリッジを Ruflo プラグインとして包み、2 つの agent、7 つの skill、1 つのディスパッチャーコマンドを提供します。多くの兄弟プラグインと違い、ここにローカルで実行される CLI ランタイムはありません。実際の生成はすべてリモート GPU 推論サービス（MiniMax-Music3）で実行され、独自に作られた MCP サーバーへ接続します。自分のアカウントは自分で発行した personal access token で認証します。

## 前提条件

- Cognitum Music アカウント：[music.cognitum.one](https://music.cognitum.one)。
- `music.cognitum.one/mcp` で発行した `cogmcp_...` personal access token（サインイン後に「Generate connection token」を選択）。表示されるのは 1 回だけなので、すぐにコピーしてください。このプラグインがトークンを発行またはローテーションすることはできません。
- `cogmusic@0.1.1` 以降を MCP サーバーとして登録します。
  ```bash
  claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest
  ```
  `0.1.0` には fetch timeout の上書きがないため、Node の既定値である約 5 分を超えて実行される `create_production` 呼び出しは失敗します。実際の生成は通常もっと長くかかります。詳しい設定手順は `music-connect` skill を参照してください。

## インストール

```bash
claude --plugin-dir plugins/ruflo-music
```

## MCP 統合（6 ツール）

登録すると、`cogmusic` は 6 つのツールを公開します。

```bash
claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest
claude mcp get cogmusic   # 期待値：✔ Connected
```

| ツール | 用途 |
|------|---------|
| `list_productions` | 保存済みの制作物を一覧表示（各項目に metadata と `audio_url`） |
| `get_production` | 1 つの制作物の現在の metadata と `audio_url` を取得 |
| `create_production` | 歌詞とスタイルプロンプトから新しいトラックを生成（数分間ブロック） |
| `separate_stems` | 4 ステムに分離（ボーカル/ドラム/ベース/その他） |
| `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 ステム分離を実行 |
| `music-midi` | 既存の制作物から MIDI を抽出 |
| `music-master` | 既存の制作物にマスタリング（LUFS）処理を実行 |

## Commands

```bash
/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` を行う必要があります。
- **ステムと MIDI にはまだ `audio_url` がありません。** `separate_stems`/`extract_midi` は生成されたものを（`get_production` 経由の `has_stems`/`has_midi` で）確認しますが、派生した音声/MIDI ファイルは現在 dashboard からしか取得できません。主トラックをすでに扱っている PAT-authorized-URL パターン（Architecture Decisions 参照）は、上流でこの 2 つのエンドポイントにはまだ拡張されていません。
- **GPU 推論サービスには実際に信頼性の履歴があります。** 間欠的なコールドスタート失敗は、3 回のイテレーションを経て上流で根本原因が特定され、修正されました（ADR-0001 の Related セクション参照）。1 回のリトライで一時的な失敗の大半は解決します。生成系の各 skill は、最初の失敗を最終結果として扱わず、この事情を記載しています。

## 互換性

- **CLI：** `@claude-flow/cli` v3.6 の major+minor に固定しています。
- **Runtime：** `cogmusic@0.1.1+` npm パッケージ（stdio↔HTTP MCP ブリッジ）を `claude mcp add` で登録します。ローカル計算はなく、生成は自分で制御しないリモート GPU サービスで実行されます。
- **検証：** `bash plugins/ruflo-music/scripts/smoke.sh` が契約です。

## Namespace の連携

このプラグインは 2 つの AgentDB namespace を所有します（kebab-case。[ruflo-agentdb ADR-0001 §「Namespace convention」](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md) の規約に従います）。

| Namespace | 用途 |
|-----------|---------|
| `music-productions` | 制作物の metadata（id、title、`audio_url`、prompt、lyrics、duration、処理ステップのフラグ）をキャッシュします。`list_productions`/`get_production` への往復なしで呼び出せます。 |
| `music-briefs` | 各制作物を生み出したクリエイティブブリーフを制作物 id をキーに保存します。後で「さっきのようなものをもう 1 つ」と言われたとき、うまくいった prompt/lyrics の形を正確に取り出せます。 |

アクセスはすべて `memory_*`（namespace でルーティング）経由です。このプラグイン内で `namespace` 引数を付けた `agentdb_pattern-*` や `agentdb_hierarchical-*` を呼び出すことはありません。予約済み namespace（`pattern`、`claude-memories`、`default`）を上書きすることもありません。

## 検証

```bash
bash plugins/ruflo-music/scripts/smoke.sh
# 期待値：「10 passed, 0 failed」
```

## アーキテクチャ決定

- [ADR-0001](docs/adrs/0001-music-contract.md)：プラグイン契約。PAT 認証モデル、`audio_url` の配信パターン、namespace の主張、開示済みの信頼性方針を定義します。

## 関連プラグイン

- [ruflo-agentdb](../ruflo-agentdb)：このプラグインが従う namespace 規約
- [ruflo-neural-trader](../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 に添付する価値のあるものがないためです。

| Option | Default | Effect |
|---|---|---|
| `guard` | `on` | 上記の呼び出しを拒否 |

テスト：`claude plugin validate plugins/ruflo-music`、`claude plugin test plugins/ruflo-music`、`bash plugins/ruflo-music/scripts/smoke.sh`。

## Install

```
claude plugin marketplace add ruvnet/ruflo
claude plugin install ruflo-music
```

## Original README

# ruflo-music

AI music generation via [Cognitum Music](https://music.cognitum.one) — 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](https://music.cognitum.one).
- A `cogmcp_...` personal access token, minted at `music.cognitum.one/mcp` (sign in → "Generate connection token"). Shown exactly once — copy it immediately. This plugin cannot mint or rotate this token for you.
- `cogmusic@0.1.1` or later registered as an MCP server:
  ```bash
  claude mcp add cogmusic --env COGMUSIC_TOKEN=cogmcp_... -- npx -y cogmusic@latest
  ```
  `0.1.0` has no fetch timeout override and fails any `create_production` call that runs past Node's ~5-minute default — real generations routinely take longer. See the `music-connect` skill for the full setup flow.

## Installation

```bash
claude --plugin-dir plugins/ruflo-music
```

## MCP Integration (6 Tools)

`cogmusic` exposes 6 tools once registered:

```bash
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

```bash
/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 authenticated `GET` with the same `cogmcp_` token as `Authorization: Bearer`.
- **Stems and MIDI have no `audio_url` yet.** `separate_stems`/`extract_midi` confirm what was produced (`has_stems`/`has_midi` via `get_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/cli` v3.6 major+minor.
- **Runtime:** `cogmusic@0.1.1+` npm package (stdio↔HTTP MCP bridge) registered via `claude mcp add`; no local compute — generation runs on a remote GPU service you don't control.
- **Verification:** `bash plugins/ruflo-music/scripts/smoke.sh` is the contract.

## Namespace coordination

This plugin owns two AgentDB namespaces (kebab-case, follows the convention from [ruflo-agentdb ADR-0001 §"Namespace convention"](../ruflo-agentdb/docs/adrs/0001-agentdb-optimization.md)):

| 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
bash plugins/ruflo-music/scripts/smoke.sh
# Expected: "10 passed, 0 failed"
```

## Architecture Decisions

- [ADR-0001](docs/adrs/0001-music-contract.md) — plugin contract: PAT auth model, `audio_url` delivery pattern, namespace claims, disclosed reliability posture.

## Related Plugins

- [ruflo-agentdb](../ruflo-agentdb) — namespace convention this plugin follows
- [ruflo-neural-trader](../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 `cogmusic` call (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`**: local `status` and `scan <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`.
