# plugins — 扩展目录(微内核外挂) Agent / 开发者:**新能力优先写插件**,少改 `core/` / `rules/` / `cli/`。 | 路径 | 用途 | |------|------| | `hooks.py` | 钩子总线(内核只 `emit`) | | `builtin/` | 随仓内置(如 `intro_guard`) | | `/plugin.py` | 包式插件(推荐) | | `.py` | 单文件插件 | ## 钩子 | 钩子 | 何时 | 典型用途 | |------|------|----------| | `before_build_tags` | assemble 前 | 改风格参数 | | `after_assemble` | tags/歌词就绪 | 守卫、改写 | | `after_gen` | gen/dry-run 写完 manifest | `deliver_report` | | `after_qc` | qc 渲染结束 | `deliver_report` / `listen_pack` / `retry_on_intro_fail` | ## 当前插件 | 插件 | 作用 | |------|------| | `builtin/intro_guard` | tags 禁止点名衬词音节 | | `deliver_report` | 写 `data/runs/.../report.md` | | `listen_pack` | QC PASS 后截 `listen/intro.wav` + `chorus_approx.wav` | | `retry_on_intro_fail` | 写 `retry_hint.json`;配合 `gen --auto-retry` | ## 最小插件示例 ```python # plugins/hello/plugin.py from ..hooks import bus @bus.on("after_gen") def _hi(run_dir=None, **kw): print("[hello]", run_dir) ```