Supported AI Assistant Platforms
mainrulebook-ai supports rule synchronization and environment management for the following AI coding assistants:
- Cursor
- CLINE
- RooCode
- Windsurf
repository·main·Indexed 20 days ago
https://github.com/botingw/rulebook-aiA command-line tool for managing and deploying consistent AI environments—including rules, context, and tools—across AI coding assistants such as Cursor, Copilot, Gemini, Windsurf, Cline, and RooCode. It utilizes a pack system (e.g., light-spec, medium-spec, heavy-spec) to provide standardized software development lifecycle environments and generates assistant-specific rule files via a project sync workflow.
rulebook-ai supports rule synchronization and environment management for the following AI coding assistants:
rulebook-ai is a Python package designed to manage LLM (Large Language Model) rulesets and assistant configurations. It is intended for development teams and individual developers who want to standardize AI-assisted development practices.
test-set pack provides a minimal set of rules specifically designed to verify the functionality of the rulebook-ai CLI and its core logic. It is intended for testing purposes rather than production use.The Custom User Prompt (Rules) framework is designed to provide a consistent and context-aware environment for AI coding assistants such as Cursor, CLINE, RooCode, and Windsurf.
It addresses the problem of inconsistent AI behavior and poor context management in complex software projects by using:
docs/ and tasks/ directories to provide shared, persistent project context.A Rulebook-AI Pack is a self-contained directory. To pass validation, the root directory must contain only the following items. Any extra files or directories at the root (like tests/ or docs/) will cause validation to fail; such content must be moved inside standard directories like memory_starters/docs/.
manifest.yaml: Metadata for the pack.README.md: Description and usage.rules/: The universal source for AI assistant rules.memory_starters/: Starter files for the user's memory/ directory.tool_starters/: Starter scripts for the user's tools/ directory.my-awesome-pack/
├── manifest.yaml
├── README.md
├── rules/
│ ├── 01-rules/
│ │ ├── 00-meta.md
│ │ └── 01-principles.md
│ ├── 02-rules-architect/
│ │ └── 01-planning.md
│ └── 03-rules-code/
│ └── 01-coding.md
├── memory_starters/
│ └── docs/
│ └── new-feature-template.md
└── tool_starters/
└── my-custom-script.pySingle-file assistants (such as Warp, GitHub Copilot, or Claude) read from one consolidated rule file.
When you run sync, the CLI:
WARP.md)..rulebook-ai/selection.json, followed by the alphabetical order of files within each pack's rules/ directory. Using numeric prefixes (e.g., 01-) in your pack structure ensures this order is deterministic.To avoid duplicating microagents in every repository, you can define them at a higher scope:
.openhands (or openhands-config on GitLab). These are automatically loaded for every project owned by that organization.~/.openhands/microagents to have them loaded for all conversations across your machine.A Decision Log is a vital component for preventing AI from contradicting past architectural or technical choices.
Usage requirements:
The READ_ARCHITECTURE rule set is designed to guide AI assistants in parsing and understanding solution architecture from a specific file: /memory/docs/architecture.md.
When this rule is active, the AI is instructed to:
Error Handling Behavior:
/memory/docs/architecture.md is missing, the AI must STOP and notify the user.READ_ARCHITECTURE: |
File: /memory/docs/architecture.md @architecture.md
Required parsing:
1. Load and parse complete Mermaid diagram
2. Extract and understand:
- Module boundaries and relationships
- Data flow patterns
- System interfaces
- Component dependencies
3. Validate any changes against architectural constraints
4. Ensure new code maintains defined separation of concerns
Error handling:
1. If file not found: STOP and notify user
2. If diagram parse fails: REQUEST clarification
3. If architectural violation detected: WARN userThe 03-lessons-learned.md rule is a living document designed to capture important patterns, preferences, and project intelligence. It is intended to grow smarter as development progresses. When using AI assistants with this rule enabled, the assistant should use this file to record and retrieve context that prevents repetitive mistakes and maintains project consistency.
Key behaviors captured in this rule include:
write_to_file vs. replace_in_file).tasks/tasks_plan.md before implementation.The project follows the modern Python src layout. This structure separates the main package code from tests and configuration files, ensuring that imports work correctly and the package is ready for distribution.
src/rulebook_ai/: Contains the main package code.__init__.py: Package initialization.__main__.py: Enables running the package via python -m rulebook_ai.core.py: Contains the business logic, specifically the RuleManager class.cli.py: Defines the command-line interface.tests/integration/: Contains integration tests (e.g., test_rule_manager.py, test_cli_commands.py).rule_sets/: Stores rule templates for various AI assistants.memory_starters/: Contains memory bank templates.tool_starters/: Contains tool integration examples.pyproject.toml: The declarative project configuration file.rulebook-ai/
├── src/rulebook_ai/ # Main package (src layout)
│ ├── __init__.py # Package initialization
│ ├── __main__.py # Allow python -m rulebook_ai
│ ├── core.py # Business logic (RuleManager class)
│ └── cli.py # Command-line interface
├── tests/integration/ # Integration tests only
│ ├── conftest.py # Shared test fixtures
│ ├── test_package_installation.py
│ ├── test_rule_manager.py
│ ├── test_cli_commands.py
│ └── test_tools_integration.py
├── rule_sets/ # Rule templates for AI assistants
├── memory_starters/ # Memory bank templates
├── tool_starters/ # Tool integration examples
├── pyproject.toml # Project configuration
└── README.md # Project documentationLight-Spec operates on a dual-system model: Procedural Rules (how the AI acts) and Contextual Memory (what the AI knows).
Rules are stored in .rulebook-ai/packs/light-spec/rules/ and define systematic workflows. The project sync command translates these into assistant-specific formats:
.mdc files in .cursor/rules/..roo/rules-architect/ or .roo/rules-code/..md files in .windsurf/rules/.The memory/ directory is a user-owned space for persistent, structured knowledge. It includes PRDs, architecture docs, and task plans. This acts as the AI's long-term project 'second brain'.
To get the best results, use file references (e.g., @filename) to connect rules and memory:
"Add a 'Refactor Auth' task to @memory/tasks/tasks_plan.md with a short description.""What database did we choose in @memory/docs/architecture.md?""Follow @.rulebook-ai/packs/light-spec/rules/03-rules-code/01-code_v1.md to build the login flow described in @memory/tasks/active_context.md."