hassha
hassha (発車, Japanese for "departure") is a plugin for Claude Code and OpenCode that plays audio effects at various hook events. Configure different melodies for different projects using JR East departure melodies or custom sounds.
Features
- Multi-project support: Configure different melodies per project using
.hassha/config.toml
- Hierarchical configuration: Config files are resolved by walking up the directory tree
- 64 predefined melodies: From 6 JR East lines (Yamanote, Keihin-Tohoku, Sobu, Saikyo, Ueno-Tokyo, Narita Express)
- Custom audio: Support for URLs and local file paths
- Smart caching: Audio files are downloaded once and cached in
~/.hassha/audio/
- History tracking: View the last 10 played melodies with
hassha history
- Easy installation: Built-in install command for Claude Code and OpenCode
Installation
The hassha binary is fully self-contained with all assets bundled. You only need the single binary to install.
Install via Cargo
cargo install hassha
Install for Claude Code
hassha install --claude-code
This creates the plugin at ~/.claude/plugins/hassha/ with all required files.
Then follow the steps printed in your terminal for activation.
Install for OpenCode
hassha install --open-code
This installs the TypeScript plugin to ~/.config/opencode/plugins/ and the binary to ~/.config/opencode/bin/.
Uninstall
# Uninstall from Claude Code
hassha uninstall --claude-code
# Uninstall from OpenCode
hassha uninstall --open-code
Configuration
Create a .hassha/config.toml file in your project directory:
# Play Shibuya melody when Claude finishes responding
[hooks.Stop]
melody = "JY-Shibuya"
volume = 0.8
# Play Akihabara melody on notifications (Keihin-Tohoku Line version)
[hooks.Notification]
melody = "JK-Akihabara"
matcher = "permission_prompt" # Only for permission prompts
# Play custom sound on session start (only for new sessions)
[hooks.SessionStart]
melody = "https://example.com/startup.mp3"
matcher = "startup" # Only on new sessions, not resume
# Play sound after Bash commands
[hooks.PostToolUse]
melody = "NEX-Shinjuku"
matcher = "Bash" # Only for Bash tool
# Play sound when subagent starts
[hooks.SubagentStart]
melody = "JY-Tokyo"
matcher = "Explore" # Only for Explore agent
Supported Hook Events
| Event | Description | Matcher Values |
|---|
SessionStart | When a session begins or resumes | startup, resume, clear, compact |
UserPromptSubmit | When you submit a prompt | (no matcher support) |
PreToolUse | Before a tool call executes | Tool names: Bash, Edit, Write, Read, mcp__.*, etc. |
PermissionRequest | When a permission dialog appears | Tool names |
PostToolUse | After a tool call succeeds | Tool names |
PostToolUseFailure | After a tool call fails | Tool names |
Notification | When Claude needs your attention | permission_prompt, idle_prompt, auth_success, elicitation_dialog |
SubagentStart | When a subagent is spawned | Bash, Explore, Plan, or custom agent names |
SubagentStop | When a subagent finishes | Agent names |
Stop | When Claude finishes responding | (no matcher support) |
PreCompact | Before context compaction | manual, auto |
SessionEnd | When a session terminates | clear, logout, prompt_input_exit, other |
OpenCode Event Mapping
OpenCode uses a different event system. The hassha plugin maps OpenCode events to Claude Code equivalents: