---
title: "miod"
url: "https://claudemods.dev/zh-cn/builds/miod-b4a4b1"
source: "https://github.com/delexw/miod"
source_type: "github"
repo: "https://github.com/delexw/miod"
author: "delexw"
author_handle: "delexw"
stars: 4
category: "声音与多媒体"
categories: ["audio"]
tags: ["audio", "claude-code", "cli", "generative-music", "hooks", "macos", "midi"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add delexw/miod\nclaude plugin install miod@miod"
added: "2026-10-08T04:07:35.144Z"
updated: "2026-10-08T00:15:47Z"
locale: "zh-cn"
content_locale: "zh-cn"
---

# miod

miod 是一款 Claude Code 模组，会在代理工作时实时生成原创 MIDI 音乐。它把情绪映射到代理的活动（思考、编辑、测试、发布、失败），并附带实时状态栏与波形可视化。

## Description

miod（“MIDI + mod”）是一款 Claude Code 插件，会在 Claude 工作时实时作曲。它不使用音乐文件、音乐库或 AI 模型。

- 每项任务都会选出自己的风格（lo-fi、chiptune、ambient、jazzy 等）、调性、和弦进行、速度、音色与主题。
- 情绪会跟随代理的动作变化。它依情绪从加权列表中选出音阶，每种情绪有 10 种变体，会随活动变化轮换，每 4 个乐句也会换一次。
- 音乐密度会随 token 消耗速率增加。上下文窗口填满时，旋律会更突出；超过 80% 后，会加入低沉的持续音。
- 提示上方的状态栏会显示情绪、风格、调性、速度与能量，还有一条会随音乐滚动、以颜色标示的波形。
- 任务之间会通过相关调性衔接。如果乐句结束时没有新任务，收尾和弦会淡出。

安装（需要 macOS 上的 Claude Code 2.1.290 及以上版本）：

    claude plugin marketplace add delexw/miod
    claude plugin install miod@miod

命令：/miod（查看开关状态）、/miod off、/miod on、/miod wave（列出或切换波形样式）。

自定义通过 hooks 文件完成：hooks/moods.ts 中的 MOODS 与 MOOD_SCALES、hooks/flavours.ts 中的 FLAVOURS、hooks/theory.ts 中的 SCALES 与 PROGRESSIONS、hooks/waves/ 中的波形样式，以及 hooks/styles.ts 中的 STYLES。验证使用 `claude plugin validate .` 与 `claude plugin test .`；若是未安装的运行，可用 `claude --plugin-dir <path>`。

限制：只在 macOS 上测试（音频通过 afplay 播放），音色是简单的 chiptune 风格，而且只会听到加载它的那个会话。

## Install

```
claude plugin marketplace add delexw/miod
claude plugin install miod@miod
```

## Original README

<p align="center">
  <img src="docs/miod.png" alt="miod logo: a honey-amber music note with code brackets" width="200">
</p>

# miod

> [!IMPORTANT]
> Only tested on macOS. Not sure yet how it behaves on Linux or Windows.

I'm an engineer, but these days I solve the boring problems entirely by vibe coding. Somewhere along the way I felt I had lost the creativity and curiosity I used to have when writing code myself.

So I started thinking about how to make vibe coding fun again. miod is the first try: while the agent does the work, you get to hear it think, read, edit, fail and fix, with a little piece of music no one has heard before.

Feel free to add more moods, flavours and styles. Each mood is one row in `hooks/moods.ts`, each flavour one row in `hooks/flavours.ts`, each sound style one entry in `hooks/styles.ts`, and each wave look one file in `hooks/waves/`.

Feeling it's a bit too noisy? 🙉 No hard feelings. Just [turn it off](#usage) with `/miod off`.

## What it is

A Claude Code mod (MIDI + mod) that writes music on the spot while Claude works. No music files, no library, no AI model.

- Every task picks its own flavour (lo-fi, chiptune, ambient, jazzy and 8 more), key, chord progression, tempo, sound and theme.
- The mood follows what the agent is doing, and the mood picks the scale (16 of them) from its own weighted list: failing leans on minor and harmonic minor, shipping on mixolydian and major. Every mood has 10 variants, and a new variant and scale are picked as the task goes: whenever the activity changes, and every 4 phrases. The task's flavour bends it too, so editing in a lo-fi task sounds nothing like editing in a chiptune one.
- The faster it spends tokens, the busier the music.
- Above the prompt, one line shows the mood, flavour, key, tempo and energy, with a wave under it that scrolls with the music, coloured by mood:

![miod's status line and moving wave](docs/miod-wave.gif)
- Tasks flow into each other: the next task fades in, in a related key. If no new task comes, a closing chord fades out at the end of the phrase.

## Install

Needs Claude Code 2.1.290 or newer, on macOS.

```bash
claude plugin marketplace add delexw/miod
claude plugin install miod@miod
```

Then start a new session.

## Usage

```
/miod        is it on or off?
/miod off    stop the music
/miod on     play again from the next task
/miod wave   list the wave looks: bars, line, mirror, dots, pulse
/miod wave dots   switch the wave to the dots look
```

## How the mood is picked

Each row shows the mood's first variant and its most likely scale. The variants are in `MOODS` and the scale weights in `MOOD_SCALES`, both in `hooks/moods.ts`.

| The agent is… | When it uses… | Sounds |
| --- | --- | --- |
| thinking | no tool | calm |
| reading | Read, Grep, Glob, MCP tools | airy |
| exploring | WebSearch, WebFetch | curious (lydian) |
| planning | TodoWrite, plan mode | hopeful (major pentatonic) |
| asking | AskUserQuestion | waiting, almost silent |
| editing | Edit, Write | bright (major) |
| running | Bash | driving beat |
| installing | npm, bun, pip, brew… install | patient (minor pentatonic) |
| testing | test, check, lint, tsc | focused (dorian), busy beat |
| shipping | git commit, push, merge, gh pr | triumphant (mixolydian) |
| deleting | rm -r, git reset --hard, git clean | ominous (phrygian), low drone |
| delegating | Agent | one harmony voice per subagent |
| failing | a Bash command that failed | tense (minor), until a command passes |

When several happen in one 8-beat phrase, the one higher in `STRONGEST_FIRST` (`hooks/activity.ts`) wins. A filling context window lifts the melody and, past 80%, adds a low drone.

The scales follow how musicians describe each mode ([musical-u](https://www.musical-u.com/learn/the-many-moods-of-musical-modes/), [Jiang et al. 2024](https://www.frontiersin.org/journals/psychology/articles/10.3389/fpsyg.2024.1414014/full)).

## Add a mood or style

- **Mood variant:** add a row to that mood's list in `MOODS` in `hooks/moods.ts`.
- **New mood:** add the name to `Activity` and `STRONGEST_FIRST` in `hooks/activity.ts`, map tools or commands to it there, give it a list of at least 10 variants in `MOODS` and a row of scale weights in `MOOD_SCALES`.
- **Flavour:** add a row to `FLAVOURS` in `hooks/flavours.ts`. Each field nudges every mood: brighter or darker scale, busier or calmer, drums up or down, swing, bass line.
- **Scale:** add it to `SCALES` in `hooks/theory.ts`, then give it a weight in at least one mood's `MOOD_SCALES` row. A test fails if a scale belongs to no mood.
- **Chords:** add to `PROGRESSIONS` in `hooks/theory.ts`.
- **Wave look:** add a file to `hooks/waves/` that exports a `WaveLook` (how many rows, and a `draw` function), then list it in `WAVES` in `hooks/waves/index.ts`.
- **Style:** add a wave function to `STYLES` in `hooks/styles.ts`. It must return values between -1 and 1.

Then check it:

```sh
claude plugin validate .
claude plugin test .
```

Run a checkout without installing it with `claude --plugin-dir <path to this repo>`.

## Limitations

- Only tested on macOS, where Claude Code plays the audio through `afplay`.
- The sound is simple chiptune-style tones.
- miod only hears the session it's loaded in.
