How botingw/rulebook-ai works
Project type and purpose
• This is a Python-based CLI “template manager” for AI-coding-assistant rule sets.
• It ships with:
• A library of predefined rule sets (rule_sets/)
• Memory-starter documents (memory_starters/)
• Tool starter scripts (tool_starters/)
• A core script (src/manage_rules.py) that installs/synchronizes/cleans these assets into a user’s target project.
• Goal: standardize AI assistant behavior (Cursor, CLINE, RooCode, Windsurf, GitHub Copilot) across any codebase.
File structure
• Top-level:
• .env.example, requirements.txt – environment bootstrap files
• src/manage_rules.py – CLI entrypoint implementing subcommands: list-rules, install, sync, clean-rules, clean-all
• rule_sets/ – multiple rule-set variants (light, medium, heavy, no-memory)
• memory_starters/ & tool_starters/ – seed files for the target project’s memory/ and tools/
• memory/ – actual “memory bank” docs after install
• tests/ – integration & unit tests for the CLI and tool scripts
• Patterns:
• Template + generator pattern: transforms static templates into target-project artifacts
• Clear separation of “source” (in this repo) vs. “target” (user’s project)
Key insights from the README
• Defines the Source Template Repo vs. a Target Repo
• Describes workflow & commands:
• install → copies templates into target (project_rules/, memory/, tools/, env.example, requirements.txt), then sync
• sync → regenerates platform-specific rule directories (.cursor/, .clinerules/, .roo/, .windsurf/, .github/copilot-instructions.md)
• clean-rules, clean-all → cleanup workflows
• Highlights cross-platform outputs consumed by AI assistants
Main components
a. Inputs (blue rectangles):
• rule_sets/ (templates)
• memory_starters/ (docs templates)
• tool_starters/ (utility scripts)
• env.example, requirements.txt
• CLI (manage_rules.py) with subcommands:
• -rules
• install
• sync
• clean-rules / clean-all
• Target-project directories:
• project_rules/ (copied rule files)
• memory/ (populated docs/tasks)
• tools/ (copied scripts)
• env.example, requirements.txt
• Generated AI-assistant rule modules:
• .cursor/rules/
• .clinerules/
• .roo/…
• .windsurf/rules/
• .github/copilot-instructions.md
d. External actors/services (gray parallelogram):
• AI coding assistants (Cursor, CLINE, RooCode, Windsurf, Copilot)
• Python runtime & dependencies (Conda environment, Playwright)
Relationships & data flow
• AI assistants consume the generated rule directories/files in the target project.
Architectural patterns & design principles
• Template + generator (code-generation)
• Clear separation of concerns: “source templates” vs “generated artifacts”
• Modular (each rule set is a plugin)
• Idempotent file operations (non-destructive copy for starters, destructive for clean commands)