YakusokuKeeper

YakusokuKeeper

A rule-based MCP server that automatically applies configured rules at specified intervals to enforce consistent LLM behavior, with support for dynamic rule management and integration with Claude Code.

Category
访问服务器

README

Yakusoku Keeper

A rule-based prompting MCP server that enforces consistent LLM behavior through input count and time-based triggers.

Yakusoku (約束) means "promise" in Japanese - this tool helps Claude Code keep its promises by automatically applying configured rules at specified intervals.

Features

  • 🎯 Automatic Rule Application: Rules are automatically triggered based on input count or elapsed time
  • 🔄 Dynamic Rule Management: Add, remove, and modify rules in real-time
  • ⚙️ Flexible Configuration: Support for user-level and project-specific rules
  • 📊 Multiple Trigger Types: First-time, every N inputs, and every N minutes rules
  • 🔌 Claude Code Integration: Seamless MCP server integration with Claude Code

Quick Start

Installation

  1. Clone the repository:
git clone https://github.com/ShigeruWakida/YakusokuKeeper.git
cd YakusokuKeeper
  1. Install dependencies:
pip install -r requirements.txt
  1. Test the server:
python yakusoku_keeper.py

Claude Code Configuration

Add the server using the Claude Code CLI:

claude mcp add yakusoku_keeper --scope project -- python /path/to/YakusokuKeeper/yakusoku_keeper.py

Or manually add this to your Claude Code MCP settings:

{
  "mcpServers": {
    "yakusoku_keeper": {
      "type": "stdio",
      "command": "python",
      "args": ["/path/to/YakusokuKeeper/yakusoku_keeper.py"],
      "env": {}
    }
  }
}

How It Works

Rule Types

  • first: Triggers on the very first interaction
  • every_N_inputs: Triggers every N user inputs (e.g., every 5 interactions)
  • every_N_minutes: Triggers after N minutes have elapsed since the last trigger

Configuration Files

Yakusoku Keeper uses a two-tier configuration system:

  • ~/.yakusoku/yakusoku_config.yml: Global rules (created commented-out by default)
  • .yakusoku/project.yml: Project-specific rules (created active by default)

Example Configuration

# --- 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.md

MCP Tools

Core Tools

  • get_rules(): Returns rules that match current conditions (called automatically)
  • reset(): Resets input counters and time triggers
  • initial_instructions(): Provides high-priority instructions to Claude Code

Rule Management Tools

  • add_rule(rule_type, rule_content, target, value): Dynamically add new rules
  • remove_rule(rule_type, rule_content, target, value): Remove existing rules

Examples

# 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")

Project Structure

YakusokuKeeper/
├── yakusoku_keeper.py    # Main MCP server
├── README.md           # This file
├── requirements.txt    # Dependencies
├── LICENSE            # MIT License
└── .yakusoku/          # Project configuration (auto-created)

Use Cases

  • Coding Standards: Automatically remind about code style requirements
  • Documentation: Prompt for documentation at regular intervals
  • Code Review: Trigger quality checks every few interactions
  • Break Reminders: Suggest breaks during long coding sessions
  • Greeting Messages: Consistent welcome messages for new sessions

Combo: YakusokuKeeper + mcp-win-toast

mcp-win-toast is an MCP server that lets AI assistants send Windows toast notifications and dialog boxes. By combining it with YakusokuKeeper, you can build a self-managing AI assistant that notifies you at the right moments — automatically, without being asked.

Break Reminder

Add a time-based rule to remind you to take a break every 30 minutes, delivered as a toast notification.

every_30_minutes:
  - "Call show_toast with title 'Break Time' and message 'You have been working for 30 minutes. Stand up and stretch!'"

Progress Report at Regular Intervals

Have Claude automatically summarize what it has done every 10 interactions and notify you.

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."

Critical File Protection

Show a blocking dialog for confirmation whenever Claude is about to modify important files.

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."

Session Duration Warning

Warn the user with a dialog box after a long session so they can decide whether to continue.

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."

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with FastMCP for MCP server implementation
  • Designed for seamless integration with Claude Code

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选