P1 输出过滤插件 — 对 LLM 回复进行 PII/敏感词过滤。
与 SecurityGuard 互补:SecurityGuard 管输入(工具参数),OutputFilter 管输出(LLM 回复)。
配置
{CMDC.Plugin.Builtin.OutputFilter,
patterns: [~r/\b\d{3}-\d{2}-\d{4}\b/], # 正则模式列表
keywords: ["机密", "internal only"], # 关键词列表
replacement: "[已过滤]", # 替换文本
action: :replace # :replace | :abort
}触发 Hook
{:after_response, assistant_msg} — 收到 LLM 回复后触发。