雅库索库守门员
一种基于规则的提示MCP服务器,通过输入计数和基于时间的触发器强制执行一致的LLM行为。
Yakusoku在日语中意为“promise”-此工具通过在指定时间间隔自动应用配置的规则来帮助Claude Code遵守其承诺。
特性
- 🎯 自动规则应用程序:规则会根据输入计数或经过的时间自动触发
- 🔄 动态规则管理:实时添加、删除和修改规则
- ⚙️ 灵活的配置:支持用户级别和项目特定规则
- 📊 多种触发器类型:第一次,每N个输入,每N分钟规则
- 🔌 Claude代码集成:MCP服务器与Claude Code无缝集成
快速开始
安装
- 克隆存储库:
git clone https://github.com/ShigeruWakida/YakusokuKeeper.git
cd YakusokuKeeper- 安装依赖项:
pip install -r requirements.txt- 测试服务器:
python yakusoku_keeper.pyClaude代码配置
使用Claude Code CLI添加服务器:
claude mcp add yakusoku_keeper --scope project -- python /path/to/YakusokuKeeper/yakusoku_keeper.py或者手动将此添加到您的Claude Code MCP设置中:
{
"mcpServers": {
"yakusoku_keeper": {
"type": "stdio",
"command": "python",
"args": ["/path/to/YakusokuKeeper/yakusoku_keeper.py"],
"env": {}
}
}
}运作原理
规则类型
first:触发第一次交互every_N_inputs:每N个用户输入触发一次(例如,每5次交互)every_N_minutes:自上次触发后经过N分钟后触发
配置文件
Yakusoku Keeper使用两层配置系统:
~/.yakusoku/yakusoku_config.yml:全局规则(默认情况下已创建并注释掉).yakusoku/project.yml:项目特定规则(默认情况下创建为活动)
配置示例
# --- First time rules ---
first:
- At the beginning of the response, insert the string that follows "say".
- say Hello! I am Yakusoku Keeper.
- Generate code using the K&R coding style.
- Use only < and <= operators for all comparisons.
- Read and follow ./docs/README_CODING_STANDARDS.md
- When using replace_symbol_body, insert_after_symbol, or insert_before_symbol, you MUST present the code block—preferably in diff format—and you MUST obtain explicit approval before applying any change.
# --- Input count based rules ---
every_5_inputs:
- Generate code using the K&R coding style.
every_10_inputs:
- Use only < and <= operators for all comparisons.
- When using replace_symbol_body, insert_after_symbol, or insert_before_symbol, you MUST present the code block—preferably in diff format—and you MUST obtain explicit approval before applying any change.
# --- Time based rules ---
every_60_minutes:
- Read and follow ./docs/README_CODING_STANDARDS.mdMCP工具
核心工具
get_rules():返回符合当前条件的规则(自动调用)reset():重置输入计数器和时间触发器initial_instructions():为Claude Code提供高优先级指令
规则管理工具
add_rule(rule_type, rule_content, target, value):动态添加新规则remove_rule(rule_type, rule_content, target, value):删除现有规则
例子
# Add a first-time rule
add_rule("first", "Always be polite and helpful")
# Add an input-based rule (every 3 inputs)
add_rule("every_N_inputs", "Check code for best practices", value=3)
# Add a time-based rule (every 30 minutes)
add_rule("every_N_minutes", "Suggest taking a break", value=30)
# Remove a rule
remove_rule("first", "Always be polite and helpful")项目结构
YakusokuKeeper/
├── yakusoku_keeper.py # Main MCP server
├── README.md # This file
├── requirements.txt # Dependencies
├── LICENSE # MIT License
└── .yakusoku/ # Project configuration (auto-created)用例
- 编码标准:自动提醒代码样式要求
- 文档:定期提示提供文件
- 代码审查:每隔几次交互就触发质量检查
- 休息提醒:建议在长时间编码会话中休息
- 问候语:为新会议提供一致的欢迎信息
组合:雅库索库守门员+mcp获胜祝酒词
mcp胜利干杯 是一个MCP服务器,允许AI助手发送Windows吐司通知和对话框。通过将其与YakusokuKeeper结合,您可以构建一个 自我管理AI助手 它会在适当的时候自动通知你,而不会被问到。
休息提醒
添加一个基于时间的规则,以吐司通知的形式提醒您每30分钟休息一次。
every_30_minutes:
- "Call show_toast with title 'Break Time' and message 'You have been working for 30 minutes. Stand up and stretch!'"定期进度报告
让克劳德每10次交互自动总结一下它所做的事情,并通知你。
every_10_inputs:
- "Summarize what you have accomplished so far in 2-3 bullet points, then call show_toast with title 'Progress Report' and the summary as the message."关键文件保护
每当Claude要修改重要文件时,都会显示一个阻止对话框进行确认。
first:
- "Before editing any file matching *.env, *.config, or docker-compose.*, always call show_dialog with title 'Confirm Edit' and a message describing which file you are about to modify. Wait for the user to acknowledge before proceeding."会话持续时间警告
在长时间会话后用对话框警告用户,以便他们决定是否继续。
every_60_minutes:
- "Call show_dialog with title 'Long Session' and message 'You have been working for over an hour. Would you like to wrap up or continue?' to check in with the user."贡献
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
