@hivehub/rulebook 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +779 -661
  2. package/dist/cli/commands.d.ts +22 -0
  3. package/dist/cli/commands.d.ts.map +1 -1
  4. package/dist/cli/commands.js +291 -8
  5. package/dist/cli/commands.js.map +1 -1
  6. package/dist/core/claude-mcp.d.ts +32 -0
  7. package/dist/core/claude-mcp.d.ts.map +1 -0
  8. package/dist/core/claude-mcp.js +92 -0
  9. package/dist/core/claude-mcp.js.map +1 -0
  10. package/dist/core/config-manager.d.ts.map +1 -1
  11. package/dist/core/config-manager.js +27 -6
  12. package/dist/core/config-manager.js.map +1 -1
  13. package/dist/core/generator.d.ts.map +1 -1
  14. package/dist/core/generator.js +98 -49
  15. package/dist/core/generator.js.map +1 -1
  16. package/dist/core/migrator.d.ts +13 -0
  17. package/dist/core/migrator.d.ts.map +1 -1
  18. package/dist/core/migrator.js +76 -9
  19. package/dist/core/migrator.js.map +1 -1
  20. package/dist/core/openspec-migrator.d.ts +1 -1
  21. package/dist/core/openspec-migrator.d.ts.map +1 -1
  22. package/dist/core/openspec-migrator.js +14 -7
  23. package/dist/core/openspec-migrator.js.map +1 -1
  24. package/dist/core/workflow-generator.js +297 -261
  25. package/dist/core/workflow-generator.js.map +1 -1
  26. package/dist/index.js +40 -1
  27. package/dist/index.js.map +1 -1
  28. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  29. package/dist/mcp/rulebook-server.js +255 -74
  30. package/dist/mcp/rulebook-server.js.map +1 -1
  31. package/dist/memory/hnsw-index.d.ts +63 -0
  32. package/dist/memory/hnsw-index.d.ts.map +1 -0
  33. package/dist/memory/hnsw-index.js +421 -0
  34. package/dist/memory/hnsw-index.js.map +1 -0
  35. package/dist/memory/memory-cache.d.ts +33 -0
  36. package/dist/memory/memory-cache.d.ts.map +1 -0
  37. package/dist/memory/memory-cache.js +85 -0
  38. package/dist/memory/memory-cache.js.map +1 -0
  39. package/dist/memory/memory-hooks.d.ts +42 -0
  40. package/dist/memory/memory-hooks.d.ts.map +1 -0
  41. package/dist/memory/memory-hooks.js +193 -0
  42. package/dist/memory/memory-hooks.js.map +1 -0
  43. package/dist/memory/memory-manager.d.ts +55 -0
  44. package/dist/memory/memory-manager.d.ts.map +1 -0
  45. package/dist/memory/memory-manager.js +209 -0
  46. package/dist/memory/memory-manager.js.map +1 -0
  47. package/dist/memory/memory-search.d.ts +42 -0
  48. package/dist/memory/memory-search.d.ts.map +1 -0
  49. package/dist/memory/memory-search.js +166 -0
  50. package/dist/memory/memory-search.js.map +1 -0
  51. package/dist/memory/memory-store.d.ts +59 -0
  52. package/dist/memory/memory-store.d.ts.map +1 -0
  53. package/dist/memory/memory-store.js +394 -0
  54. package/dist/memory/memory-store.js.map +1 -0
  55. package/dist/memory/memory-types.d.ts +69 -0
  56. package/dist/memory/memory-types.d.ts.map +1 -0
  57. package/dist/memory/memory-types.js +7 -0
  58. package/dist/memory/memory-types.js.map +1 -0
  59. package/dist/memory/memory-vectorizer.d.ts +29 -0
  60. package/dist/memory/memory-vectorizer.d.ts.map +1 -0
  61. package/dist/memory/memory-vectorizer.js +104 -0
  62. package/dist/memory/memory-vectorizer.js.map +1 -0
  63. package/dist/types.d.ts +7 -0
  64. package/dist/types.d.ts.map +1 -1
  65. package/package.json +107 -106
  66. package/templates/commands/rulebook-memory-save.md +48 -0
  67. package/templates/commands/rulebook-memory-search.md +47 -0
  68. package/templates/commands/rulebook-task-apply.md +2 -2
  69. package/templates/commands/rulebook-task-archive.md +2 -2
  70. package/templates/commands/rulebook-task-create.md +2 -2
  71. package/templates/commands/rulebook-task-list.md +2 -2
  72. package/templates/commands/rulebook-task-show.md +2 -2
  73. package/templates/commands/rulebook-task-validate.md +2 -2
  74. package/templates/git/CI_CD_PATTERNS.md +4 -4
  75. package/templates/git/GITHUB_ACTIONS.md +3 -3
  76. package/templates/git/GITLAB_CI.md +4 -4
  77. package/templates/git/SECRETS_MANAGEMENT.md +4 -4
  78. package/templates/hooks/COMMIT_MSG.md +4 -4
  79. package/templates/hooks/POST_CHECKOUT.md +3 -3
  80. package/templates/hooks/PREPARE_COMMIT_MSG.md +3 -3
  81. package/templates/hooks/PRE_COMMIT.md +4 -4
  82. package/templates/hooks/PRE_PUSH.md +4 -4
  83. package/templates/modules/MEMORY.md +63 -0
  84. package/templates/skills/cli/aider/SKILL.md +59 -0
  85. package/templates/skills/cli/amazon-q/SKILL.md +35 -0
  86. package/templates/skills/cli/auggie/SKILL.md +42 -0
  87. package/templates/skills/cli/claude/SKILL.md +42 -0
  88. package/templates/skills/cli/claude-code/SKILL.md +146 -0
  89. package/templates/skills/cli/cline/SKILL.md +42 -0
  90. package/templates/skills/cli/codebuddy/SKILL.md +30 -0
  91. package/templates/skills/cli/codeium/SKILL.md +30 -0
  92. package/templates/skills/cli/codex/SKILL.md +31 -0
  93. package/templates/skills/cli/continue/SKILL.md +44 -0
  94. package/templates/skills/cli/cursor-cli/SKILL.md +38 -0
  95. package/templates/skills/cli/factory/SKILL.md +28 -0
  96. package/templates/skills/cli/gemini/SKILL.md +45 -0
  97. package/templates/skills/cli/kilocode/SKILL.md +28 -0
  98. package/templates/skills/cli/opencode/SKILL.md +28 -0
  99. package/templates/skills/core/agent-automation/SKILL.md +194 -0
  100. package/templates/skills/core/dag/SKILL.md +314 -0
  101. package/templates/skills/core/documentation-rules/SKILL.md +47 -0
  102. package/templates/skills/core/quality-enforcement/SKILL.md +78 -0
  103. package/templates/skills/frameworks/angular/SKILL.md +46 -0
  104. package/templates/skills/frameworks/django/SKILL.md +93 -0
  105. package/templates/skills/frameworks/electron/SKILL.md +157 -0
  106. package/templates/skills/frameworks/flask/SKILL.md +48 -0
  107. package/templates/skills/frameworks/flutter/SKILL.md +65 -0
  108. package/templates/skills/frameworks/jquery/SKILL.md +42 -0
  109. package/templates/skills/frameworks/laravel/SKILL.md +48 -0
  110. package/templates/skills/frameworks/nestjs/SKILL.md +53 -0
  111. package/templates/skills/frameworks/nextjs/SKILL.md +137 -0
  112. package/templates/skills/frameworks/nuxt/SKILL.md +50 -0
  113. package/templates/skills/frameworks/rails/SKILL.md +76 -0
  114. package/templates/skills/frameworks/react/SKILL.md +48 -0
  115. package/templates/skills/frameworks/react-native/SKILL.md +57 -0
  116. package/templates/skills/frameworks/spring/SKILL.md +49 -0
  117. package/templates/skills/frameworks/symfony/SKILL.md +46 -0
  118. package/templates/skills/frameworks/vue/SKILL.md +46 -0
  119. package/templates/skills/frameworks/zend/SKILL.md +45 -0
  120. package/templates/skills/ides/copilot/SKILL.md +47 -0
  121. package/templates/skills/ides/cursor/SKILL.md +53 -0
  122. package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -0
  123. package/templates/skills/ides/replit/SKILL.md +46 -0
  124. package/templates/skills/ides/tabnine/SKILL.md +39 -0
  125. package/templates/skills/ides/vscode/SKILL.md +50 -0
  126. package/templates/skills/ides/windsurf/SKILL.md +46 -0
  127. package/templates/skills/ides/zed/SKILL.md +42 -0
  128. package/templates/skills/languages/ada/SKILL.md +68 -0
  129. package/templates/skills/languages/c/SKILL.md +343 -0
  130. package/templates/skills/languages/cpp/SKILL.md +753 -0
  131. package/templates/skills/languages/csharp/SKILL.md +427 -0
  132. package/templates/skills/languages/dart/SKILL.md +342 -0
  133. package/templates/skills/languages/elixir/SKILL.md +464 -0
  134. package/templates/skills/languages/erlang/SKILL.md +371 -0
  135. package/templates/skills/languages/go/SKILL.md +655 -0
  136. package/templates/skills/languages/haskell/SKILL.md +187 -0
  137. package/templates/skills/languages/java/SKILL.md +617 -0
  138. package/templates/skills/languages/javascript/SKILL.md +641 -0
  139. package/templates/skills/languages/julia/SKILL.md +107 -0
  140. package/templates/skills/languages/kotlin/SKILL.md +521 -0
  141. package/templates/skills/languages/lisp/SKILL.md +110 -0
  142. package/templates/skills/languages/lua/SKILL.md +84 -0
  143. package/templates/skills/languages/objectivec/SKILL.md +100 -0
  144. package/templates/skills/languages/php/SKILL.md +426 -0
  145. package/templates/skills/languages/python/SKILL.md +692 -0
  146. package/templates/skills/languages/r/SKILL.md +360 -0
  147. package/templates/skills/languages/ruby/SKILL.md +431 -0
  148. package/templates/skills/languages/rust/SKILL.md +487 -0
  149. package/templates/skills/languages/sas/SKILL.md +83 -0
  150. package/templates/skills/languages/scala/SKILL.md +358 -0
  151. package/templates/skills/languages/solidity/SKILL.md +590 -0
  152. package/templates/skills/languages/sql/SKILL.md +147 -0
  153. package/templates/skills/languages/swift/SKILL.md +476 -0
  154. package/templates/skills/languages/zig/SKILL.md +275 -0
  155. package/templates/skills/modules/atlassian/SKILL.md +265 -0
  156. package/templates/skills/modules/context7/SKILL.md +64 -0
  157. package/templates/skills/modules/figma/SKILL.md +277 -0
  158. package/templates/skills/modules/github-mcp/SKILL.md +74 -0
  159. package/templates/skills/modules/grafana/SKILL.md +338 -0
  160. package/templates/skills/modules/memory/SKILL.md +73 -0
  161. package/templates/skills/modules/notion/SKILL.md +257 -0
  162. package/templates/skills/modules/playwright/SKILL.md +100 -0
  163. package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -0
  164. package/templates/skills/modules/serena/SKILL.md +347 -0
  165. package/templates/skills/modules/supabase/SKILL.md +233 -0
  166. package/templates/skills/modules/synap/SKILL.md +79 -0
  167. package/templates/skills/modules/vectorizer/SKILL.md +73 -0
  168. package/templates/skills/services/azure-blob/SKILL.md +194 -0
  169. package/templates/skills/services/cassandra/SKILL.md +249 -0
  170. package/templates/skills/services/dynamodb/SKILL.md +318 -0
  171. package/templates/skills/services/elasticsearch/SKILL.md +357 -0
  172. package/templates/skills/services/gcs/SKILL.md +188 -0
  173. package/templates/skills/services/influxdb/SKILL.md +275 -0
  174. package/templates/skills/services/kafka/SKILL.md +351 -0
  175. package/templates/skills/services/mariadb/SKILL.md +193 -0
  176. package/templates/skills/services/memcached/SKILL.md +252 -0
  177. package/templates/skills/services/minio/SKILL.md +211 -0
  178. package/templates/skills/services/mongodb/SKILL.md +278 -0
  179. package/templates/skills/services/mysql/SKILL.md +368 -0
  180. package/templates/skills/services/neo4j/SKILL.md +257 -0
  181. package/templates/skills/services/oracle/SKILL.md +300 -0
  182. package/templates/skills/services/postgresql/SKILL.md +336 -0
  183. package/templates/skills/services/rabbitmq/SKILL.md +296 -0
  184. package/templates/skills/services/redis/SKILL.md +302 -0
  185. package/templates/skills/services/s3/SKILL.md +308 -0
  186. package/templates/skills/services/sqlite/SKILL.md +304 -0
  187. package/templates/skills/services/sqlserver/SKILL.md +304 -0
package/README.md CHANGED
@@ -1,661 +1,779 @@
1
- # @hivehub/rulebook
2
-
3
- [![npm version](https://img.shields.io/npm/v/@hivehub/rulebook?logo=npm&logoColor=white)](https://www.npmjs.com/package/@hivehub/rulebook)
4
- [![npm downloads](https://img.shields.io/npm/dm/@hivehub/rulebook?logo=npm&logoColor=white)](https://www.npmjs.com/package/@hivehub/rulebook)
5
- [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
6
- [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)
7
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
-
9
- [![Tests](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/test.yml?label=tests&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/test.yml)
10
- [![Coverage](https://img.shields.io/codecov/c/github/hivellm/rulebook?logo=codecov&logoColor=white)](https://codecov.io/gh/hivellm/rulebook)
11
- [![Build](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/build.yml?label=build&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/build.yml)
12
- [![Lint](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/lint.yml?label=lint&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/lint.yml)
13
-
14
- > Standardize AI-generated projects with automated templates, quality gates, and framework detection for 28 languages, 17 frameworks, 12 MCP modules, and 20 services.
15
-
16
- ---
17
-
18
- ## Why Rulebook?
19
-
20
- Large Language Models (LLMs) for software development need **clear directives** to generate high-quality code consistently. Without standardized guidelines, AI-generated code can be inconsistent, error-prone, and difficult to maintain.
21
-
22
- **Rulebook solves this by providing:**
23
-
24
- - 📋 **Comprehensive Rule Sets**: Language-specific guidelines (TypeScript, Rust, Python, etc.), framework conventions (NestJS, Django, React), testing standards, linting rules, spell-checking, CI/CD pipelines, Git hooks, and version control best practices
25
- - 🎯 **Normalized Deliverables**: Ensures consistent code quality across all AI-generated outputs
26
- - 🛡️ **Error Reduction**: Catches issues early through automated quality gates and pre-commit/pre-push hooks
27
- - ⚙️ **Process Automation**: Automates repetitive tasks like formatting, testing, and deployment
28
- - 🔌 **MCP Integration**: Supports multiple Model Context Protocol (MCP) modules for enhanced AI capabilities
29
- - 📊 **Task Management**: Built-in task management system (OpenSpec-compatible format) for structured development
30
-
31
- By giving LLMs a clear "rulebook" to follow, you ensure that every piece of generated code meets your project's standards—**automatically**.
32
-
33
- ## Quick Start
34
-
35
- ```bash
36
- # New project (interactive)
37
- npx @hivehub/rulebook@latest init
38
-
39
- # Minimal setup (essentials only)
40
- npx @hivehub/rulebook@latest init --minimal
41
-
42
- # Light mode (prototypes without strict rules)
43
- npx @hivehub/rulebook@latest init --light
44
-
45
- # Update existing project
46
- npx @hivehub/rulebook@latest update
47
- ```
48
-
49
- ## What's New
50
-
51
- ### v2.1.0 (Latest)
52
-
53
- - 🔒 **Claude Code Critical Directives**: New mandatory rules for Claude Code CLI
54
- - **Sequential File Editing**: Files must be edited one at a time to prevent failures from parallel edits
55
- - **Complete Test Implementation**: Strict rules against simplifying tests, placeholder assertions, or skipping test cases
56
- - Updated `CLAUDE.md` generation with comprehensive guidelines and examples
57
- - 🪟 **Windows Test Suite Fix**: Tests no longer hang on Windows (705 tests passing, 11x faster)
58
-
59
- ### v2.0.0
60
-
61
- - 🧩 **Skills System**: New modular skills architecture for AI-assisted development
62
- - Skills are YAML-frontmatter Markdown files with enable/disable functionality
63
- - 10 skill categories: languages, frameworks, modules, services, workflows, ides, core, cli, git, hooks
64
- - Auto-detection of skills based on project configuration
65
- - CLI commands: `rulebook skill list|add|remove|show|search`
66
- - MCP functions: `rulebook_skill_list|show|enable|disable|search|validate`
67
- - 🤖 **AI CLI Configuration Files**: Auto-generated files for AI CLI tools
68
- - `CLAUDE.md` - Claude Code CLI configuration
69
- - `CODEX.md` - OpenAI Codex CLI configuration
70
- - `GEMINI.md` - Google Gemini CLI configuration
71
- - `gemini-extension.json` - Gemini CLI extension manifest
72
- - 🔌 **Claude Code Plugin**: `marketplace.json` + `.claude-plugin/` structure for marketplace distribution
73
- - `marketplace.json` - Marketplace manifest for plugin discovery
74
- - Plugin manifest, MCP configuration, slash commands, and skills
75
-
76
- ### v1.1.5
77
-
78
- - 🗄️ **Service Integration Templates**: Added comprehensive service integration templates
79
- - 20 service templates: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite, MongoDB, Cassandra, DynamoDB, Redis, Memcached, Elasticsearch, Neo4j, InfluxDB, RabbitMQ, Kafka, S3, Azure Blob, GCS, MinIO
80
- - Automatic service detection from `package.json`, `.env`, and `docker-compose.yml`
81
- - Service-specific integration instructions with connection setup, operations, best practices, and configuration
82
- - Templates generated in `/rulebook/[SERVICE].md` with references in `AGENTS.md`
83
- - Interactive CLI prompt to select which services to include templates for
84
-
85
- ### v1.1.4
86
-
87
- - 🔧 **Cross-platform Git Hooks**: Git hooks now work on both Windows and Linux
88
- - Hooks are now generated as Node.js scripts with shell wrappers
89
- - Shell wrapper detects Node.js in common locations (Windows and Linux)
90
- - Node.js scripts use native `child_process.spawn` for cross-platform command execution
91
- - Pre-commit and pre-push hooks now function correctly on Windows (Git Bash) and Linux
92
- - 🔄 **Git Hooks Architecture**: Refactored hook generation system
93
- - Hooks are now generated as two files: shell wrapper + Node.js script
94
- - Shell templates (`.sh`) are automatically converted to Node.js scripts
95
- - Improved command parsing from shell templates to Node.js
96
- - Better error handling and cross-platform compatibility
97
-
98
- ### v1.1.3
99
-
100
- - 🗑️ **MCP Tool: `rulebook_task_delete`**: Delete tasks permanently
101
- - New tool to permanently delete tasks from the filesystem
102
- - Removes task directory recursively
103
- - Useful for cleaning up test tasks or removing unwanted tasks
104
- - Total of 7 MCP functions now available
105
-
106
- ### v1.1.2
107
-
108
- - 🔧 **ESLint v9 Migration**: Updated to ESLint flat config format
109
- - Migrated from `.eslintrc.json` to `eslint.config.js`
110
- - Updated to ESLint 9.37.0 with TypeScript ESLint 8.47.0
111
- - Added proper Node.js global type definitions
112
- - Linting now shows only errors (warnings suppressed with `--quiet`)
113
-
114
- ### v1.0.3
115
-
116
- - 🔧 **Zod v3 Compatibility**: Using Zod v3.25.76 for full MCP SDK compatibility
117
- - MCP SDK v1.22.0 requires Zod v3 (see [Issue #1429](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1429))
118
- - Will upgrade to Zod v4 when MCP SDK officially supports it
119
- - 🔄 **Dependency Updates**: All dependencies updated to latest versions
120
- - TypeScript tooling (ESLint 8.47.0, Vitest 4.0.13)
121
- - Node.js types updated to support Node.js 24.x
122
- - CLI tools and build utilities updated
123
- - 🐛 **Windows CI Fix**: Fixed PowerShell compatibility in GitHub Actions workflows
124
- - Removed bash-specific syntax from Windows runners
125
- - Cross-platform compatibility improved
126
-
127
- ### v1.0.2
128
-
129
- - 🔌 **MCP Server for Task Management**: New MCP server enables AI models to manage tasks programmatically
130
- - 7 MCP functions: create, list, show, update, validate, archive, delete tasks
131
- - Available via `npx @hivellm/rulebook@latest mcp-server` or `npx rulebook-mcp`
132
- - Better integration with MCP-compatible AI assistants
133
- - **Faster Pre-commit Hooks**: Tests removed from pre-commit for faster backup commits
134
- - Pre-commit now runs only: format check, lint, type-check
135
- - Tests moved to pre-push hook for comprehensive validation
136
- - 🏗️ **Build Verification**: Build check now mandatory before push (runs first)
137
- - 📦 **pnpm Recommendation**: Added pnpm as preferred package manager with `.npmrc` configuration
138
- - 🚀 **Rust Build Optimization**: Comprehensive guide for faster Rust builds
139
- - sccache configuration, incremental compilation, lld linker
140
- - Anti-pattern documentation for `pub use big_crate::*;`
141
- - 📋 **Enhanced Task Management**: Strengthened OpenSpec format compliance and archiving rules
142
- - 📁 **Strict Markdown Organization**: UPPERCASE naming and `/docs` directory requirements
143
-
144
- ### v1.0.0
145
-
146
- - 🎉 **First Stable Release**: Production-ready with comprehensive features
147
- - 🔒 **Apache 2.0 License**: Changed from MIT to Apache License 2.0 for better compatibility
148
- - 🛡️ **Git Hooks Enforcement**: Pre-commit and pre-push hooks now block commits with lint/test errors
149
- - 📋 **Task File Structure Rules**: Enhanced directives in AGENTS.md about correct task structure
150
- - 🎯 **Built-in Task Management**: OpenSpec deprecated and integrated into Rulebook's native task system
151
- - 📋 **RULEBOOK.md Template**: Core template with task management directives and Context7 MCP requirements
152
- - 🚫 **Automatic .gitignore**: `npx @hivellm/rulebook@latest init` now creates/updates `.gitignore` automatically for 28 languages
153
- - 🔄 **Migration Support**: Existing OpenSpec tasks automatically migrated to `/rulebook/tasks/` format
154
-
155
- > **Breaking Change**: OpenSpec module removed. Use `npx @hivellm/rulebook@latest task` commands instead. See [Migration Guide](docs/guides/OPENSPEC_MIGRATION.md).
156
-
157
- ## Key Features
158
-
159
- - 🔍 **Auto-Detection**: Detects languages, frameworks (NestJS, React, Spring, etc.), MCP modules, and services (databases, caches, message queues, etc.)
160
- - 📁 **Modular Architecture**: Templates stored in `/rulebook/` directory for better organization
161
- - Smaller AGENTS.md files (prevents 100k+ character limits)
162
- - QUALITY_ENFORCEMENT and Git rules moved to `/rulebook/` for cleaner structure
163
- - On-demand loading for better AI performance
164
- - Easier maintenance and updates
165
- - 📋 **Simplified AGENTS.md**: Clean, focused structure with only core rules and references
166
- - Proper hierarchy with `##` and `###` subsections
167
- - All modules grouped logically
168
- - Better readability and navigation
169
- - 🔗 **Git Hook Automation**: Optional pre-commit/pre-push hooks with language-aware quality checks
170
- - 🚫 **Automatic .gitignore**: Creates/updates `.gitignore` automatically for 28 languages on `npx @hivellm/rulebook@latest init`
171
- - 🎯 **Minimal Mode**: Quick setup with just README, LICENSE, tests/, and basic CI
172
- - 📝 **106+ Templates**: Languages, frameworks, IDEs, workflows, and services pre-configured
173
- - 🤖 **AI-Optimized**: Works with 23 AI assistants (Cursor, Claude, Gemini, etc.)
174
- - 📦 **Publication Ready**: CI/CD pipelines for npm, crates.io, PyPI, Maven Central, and more
175
- - 🔄 **Automatic Migration**: Existing projects automatically migrated to modular structure and OpenSpec tasks
176
-
177
- ## What It Does
178
-
179
- **For New Projects:**
180
- 1. Detects your language(s), frameworks, MCP modules, and services
181
- 2. Asks setup questions (or use `--minimal` for defaults)
182
- 3. Generates AGENTS.md with AI assistant rules (modular structure)
183
- 4. Creates `/rulebook/` directory with language/framework/module/service templates
184
- 5. Creates/updates `.gitignore` automatically for detected languages
185
- 6. Optionally installs Git hooks (pre-commit/pre-push)
186
- 7. Creates GitHub Actions workflows
187
- 8. Scaffolds README, LICENSE, /docs, and /tests
188
-
189
- **For Existing Projects:**
190
- ```bash
191
- npx @hivehub/rulebook update
192
- ```
193
- - Automatically migrates embedded templates to modular `/rulebook/` structure
194
- - Automatically migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
195
- - Merges latest templates while preserving your customizations
196
- - Updates AGENTS.md with references to modular files
197
- - Updates `.gitignore` with missing patterns for detected languages
198
-
199
- ## Commands
200
-
201
- ### Core Commands
202
-
203
- ```bash
204
- # Project Initialization & Updates
205
- npx @hivehub/rulebook@latest init # Initialize new project (interactive)
206
- npx @hivehub/rulebook@latest init --minimal # Minimal setup (essentials only)
207
- npx @hivehub/rulebook@latest init --light # Light mode (no quality enforcement)
208
- npx @hivehub/rulebook@latest init --yes # Skip prompts, use defaults
209
- npx @hivehub/rulebook@latest update # Update AGENTS.md to latest version
210
- npx @hivehub/rulebook@latest update --yes # Update without confirmation
211
- npx @hivehub/rulebook@latest update --light # Update in light mode
212
-
213
- # Workflow & CI/CD
214
- npx @hivehub/rulebook@latest workflows # Generate GitHub Actions workflows
215
-
216
- # Validation & Health
217
- npx @hivehub/rulebook@latest validate # Check project standards
218
- npx @hivehub/rulebook@latest health # Project health score (0-100)
219
- npx @hivehub/rulebook@latest fix # Auto-fix common issues
220
-
221
- # Documentation
222
- npx @hivehub/rulebook@latest generate-docs # Create /docs structure
223
- npx @hivehub/rulebook@latest generate-docs --yes # Skip prompts, use defaults
224
-
225
- # Dependencies & Coverage
226
- npx @hivehub/rulebook@latest check-deps # Check outdated/vulnerable dependencies
227
- npx @hivehub/rulebook@latest check-coverage # Check test coverage (default: 95%)
228
- npx @hivehub/rulebook@latest check-coverage -t 80 # Custom threshold
229
-
230
- # Versioning
231
- npx @hivehub/rulebook@latest version <type> # Bump version (major|minor|patch)
232
- npx @hivehub/rulebook@latest changelog # Generate changelog from git commits
233
- npx @hivehub/rulebook@latest changelog -v 1.0.0 # Specify version
234
- ```
235
-
236
- > **Note**: If installed globally (`npm install -g @hivehub/rulebook`), you can use `rulebook` directly instead of `npx @hivehub/rulebook@latest`.
237
-
238
- ### Advanced Commands (Beta)
239
-
240
- ```bash
241
- # Real-time Monitoring
242
- npx @hivehub/rulebook@latest watcher # Full-screen task monitoring UI
243
- # - Live task progress tracking
244
- # - Activity log with timestamps
245
- # - System status monitoring
246
- # - Auto-refresh every 2 seconds
247
-
248
- # Autonomous Agent
249
- npx @hivehub/rulebook@latest agent # Start AI CLI workflow automation
250
- npx @hivehub/rulebook@latest agent --dry-run # Simulate without changes
251
- npx @hivehub/rulebook@latest agent --tool cursor-agent # Specify CLI tool
252
- npx @hivehub/rulebook@latest agent --iterations 10 # Max iterations
253
- npx @hivehub/rulebook@latest agent --watch # Enable watcher mode
254
-
255
- # Task Management
256
- npx @hivehub/rulebook@latest task create <task-id> # Create new task
257
- npx @hivehub/rulebook@latest task list # List all tasks
258
- npx @hivehub/rulebook@latest task list --archived # List including archived tasks
259
- npx @hivehub/rulebook@latest task show <task-id> # Show task details
260
- npx @hivehub/rulebook@latest task validate <task-id> # Validate task format
261
- npx @hivehub/rulebook@latest task archive <task-id> # Archive completed task
262
- npx @hivehub/rulebook@latest task archive --skip-validation <task-id> # Archive without validation
263
- npx @hivehub/rulebook@latest tasks [options] # Legacy command (DEPRECATED - use 'task' commands)
264
-
265
- # Skills Management (v2.0)
266
- npx @hivehub/rulebook@latest skill list # List all available skills
267
- npx @hivehub/rulebook@latest skill list --category languages # Filter by category
268
- npx @hivehub/rulebook@latest skill list --enabled # Show only enabled skills
269
- npx @hivehub/rulebook@latest skill add <skill-id> # Enable a skill
270
- npx @hivehub/rulebook@latest skill remove <skill-id> # Disable a skill
271
- npx @hivehub/rulebook@latest skill show <skill-id> # Show skill details
272
- npx @hivehub/rulebook@latest skill search <query> # Search for skills
273
-
274
- # Configuration
275
- npx @hivehub/rulebook@latest config --show # Show current config
276
- npx @hivehub/rulebook@latest config --set key=value # Set config value
277
- npx @hivehub/rulebook@latest config --feature watcher --enable # Enable feature
278
- npx @hivehub/rulebook@latest config --feature agent --disable # Disable feature
279
- ```
280
-
281
- ## Setup Modes
282
-
283
- ### Full Mode (Default)
284
- Complete setup with all features: Task management, Watcher, MCP modules, comprehensive workflows.
285
-
286
- ### Minimal Mode
287
- ```bash
288
- npx @hivehub/rulebook@latest init --minimal
289
- ```
290
- Essentials only: README, LICENSE, tests/, basic CI. Perfect for small teams or initial adoption.
291
-
292
- ### Light Mode
293
- ```bash
294
- npx @hivehub/rulebook@latest init --light
295
- ```
296
- Bare minimum rules: no quality enforcement, no testing requirements, no linting. Use for quick prototypes or non-production projects.
297
-
298
- ## Supported Languages & Frameworks
299
-
300
- **28 Languages**: TypeScript, JavaScript, Python, Rust, Go, Java, Kotlin, C, C++, C#, PHP, Ruby, Swift, Elixir, Dart, Scala, Haskell, Julia, R, Lua, Solidity, Zig, Erlang, Ada, SAS, Lisp, Objective-C, SQL
301
-
302
- **17 Frameworks** (auto-detected):
303
- - Backend: NestJS, Spring Boot, Laravel, Django, Flask, Ruby on Rails, Symfony, Zend
304
- - Frontend: Angular, React, Vue, Nuxt, Next.js, jQuery
305
- - Mobile: React Native, Flutter
306
- - Desktop: Electron
307
-
308
- ## MCP Modules (12)
309
-
310
- **Core**: Vectorizer Synap Context7 GitHub MCP • Playwright
311
-
312
- **Services**: Supabase Notion • Atlassian • Serena • Figma • Grafana
313
-
314
- ### MCP Server for Task Management
315
-
316
- Rulebook provides an MCP (Model Context Protocol) server that exposes task management functions, allowing AI models to manage tasks programmatically through MCP instead of executing terminal commands.
317
-
318
- **Benefits:**
319
- - ✅ Direct MCP integration - no shell command execution needed
320
- - ✅ Structured error handling with proper error codes and messages
321
- - Consistent interface with other MCP operations
322
- - Better automation capabilities for AI agents
323
- - ✅ Improved reliability compared to terminal command execution
324
- - Automatic project detection - finds `.rulebook` by walking up directories (like git)
325
- - Zero configuration - works out of the box after `rulebook mcp init`
326
-
327
- **Quick Setup:**
328
-
329
- ```bash
330
- # Initialize MCP configuration in your project (one-time setup)
331
- npx @hivehub/rulebook@latest mcp init
332
- ```
333
-
334
- This command:
335
- - Adds `mcp` block to your `.rulebook` file
336
- - Creates/updates `.cursor/mcp.json` automatically
337
- - Server uses stdio transport (MCP standard)
338
-
339
- **Available MCP Functions:**
340
-
341
- - `rulebook_task_create` - Create a new task with OpenSpec-compatible format
342
- - Input: `taskId` (string), optional `proposal` object
343
- - Output: Task creation confirmation with path
344
- - `rulebook_task_list` - List all tasks with optional filters
345
- - Input: `includeArchived` (boolean), `status` (enum)
346
- - Output: Array of tasks with metadata
347
- - `rulebook_task_show` - Show detailed task information
348
- - Input: `taskId` (string)
349
- - Output: Complete task details including proposal, tasks, specs
350
- - `rulebook_task_update` - Update task status or progress
351
- - Input: `taskId` (string), optional `status`, `progress`
352
- - Output: Update confirmation
353
- - `rulebook_task_validate` - Validate task format against OpenSpec requirements
354
- - Input: `taskId` (string)
355
- - Output: Validation results with errors and warnings
356
- - `rulebook_task_archive` - Archive completed task and apply spec deltas
357
- - Input: `taskId` (string), optional `skipValidation`
358
- - Output: Archive confirmation with archive path
359
- - `rulebook_task_delete` - Delete a task permanently
360
- - Input: `taskId` (string)
361
- - Output: Deletion confirmation
362
-
363
- **Total: 7 MCP functions** for complete task lifecycle management.
364
-
365
- **Skills MCP Functions (v2.0):**
366
-
367
- - `rulebook_skill_list` - List available skills with optional category filter
368
- - `rulebook_skill_show` - Show detailed skill information
369
- - `rulebook_skill_enable` - Enable a skill for the project
370
- - `rulebook_skill_disable` - Disable a skill
371
- - `rulebook_skill_search` - Search skills by name, description, or tags
372
- - `rulebook_skill_validate` - Validate skills configuration
373
-
374
- **Total: 13 MCP functions** (7 task + 6 skills).
375
-
376
- ## Skills System (v2.0)
377
-
378
- Rulebook v2.0 introduces a modular skills system for AI-assisted development. Skills are pluggable capabilities that can be enabled or disabled per project.
379
-
380
- ### What are Skills?
381
-
382
- Skills are YAML-frontmatter Markdown files that define specific capabilities or rules for AI assistants. Each skill has:
383
-
384
- - **Metadata**: Name, description, version, category, tags, dependencies
385
- - **Content**: Markdown content with rules, patterns, and examples
386
-
387
- ### Skill Categories
388
-
389
- Skills are organized into 10 categories:
390
-
391
- | Category | Description | Examples |
392
- |----------|-------------|----------|
393
- | `languages` | Language-specific rules | TypeScript, Rust, Python |
394
- | `frameworks` | Framework conventions | NestJS, React, Django |
395
- | `modules` | MCP module integration | Vectorizer, Context7 |
396
- | `services` | Service integration | PostgreSQL, Redis |
397
- | `workflows` | CI/CD patterns | GitHub Actions |
398
- | `ides` | IDE configuration | Cursor, VS Code |
399
- | `core` | Core rulebook standards | Quality gates |
400
- | `cli` | AI CLI configuration | Claude Code, Codex |
401
- | `git` | Git workflow rules | Branching, commits |
402
- | `hooks` | Git hooks configuration | Pre-commit, pre-push |
403
-
404
- ### Using Skills
405
-
406
- ```bash
407
- # List all available skills
408
- rulebook skill list
409
-
410
- # Filter by category
411
- rulebook skill list --category languages
412
-
413
- # Enable a skill
414
- rulebook skill add languages/typescript
415
-
416
- # Disable a skill
417
- rulebook skill remove languages/typescript
418
-
419
- # Show skill details
420
- rulebook skill show languages/typescript
421
-
422
- # Search for skills
423
- rulebook skill search "testing"
424
- ```
425
-
426
- ### Auto-Detection
427
-
428
- During `rulebook init` and `rulebook update`, skills are automatically detected and enabled based on your project's:
429
-
430
- - Detected languages (e.g., TypeScript `languages/typescript`)
431
- - Detected frameworks (e.g., NestJS `frameworks/nestjs`)
432
- - Detected modules (e.g., Vectorizer `modules/vectorizer`)
433
- - Detected services (e.g., PostgreSQL → `services/postgresql`)
434
-
435
- ### Creating Custom Skills
436
-
437
- Create a `SKILL.md` file in `templates/skills/<category>/<skill-name>/`:
438
-
439
- ```markdown
440
- ---
441
- name: My Custom Skill
442
- description: Description of what this skill does
443
- version: 1.0.0
444
- category: core
445
- tags: ["custom", "example"]
446
- ---
447
-
448
- # My Custom Skill
449
-
450
- Add your rules and patterns here.
451
- ```
452
-
453
- ## Service Integration Templates (20)
454
-
455
- Rulebook provides comprehensive integration templates for popular backend services, including databases, caches, message queues, and object storage.
456
-
457
- **Relational Databases**: PostgreSQL • MySQL • MariaDB • SQL Server • Oracle • SQLite
458
-
459
- **NoSQL Databases**: MongoDB Cassandra DynamoDB
460
-
461
- **Caches**: Redis Memcached
462
-
463
- **Search & Analytics**: Elasticsearch
464
-
465
- **Graph Databases**: Neo4j
466
-
467
- **Time-Series Databases**: InfluxDB
468
-
469
- **Message Queues**: RabbitMQ • Kafka
470
-
471
- **Object Storage**: AWS S3 • Azure Blob Storage • Google Cloud Storage • MinIO
472
-
473
- ### Automatic Service Detection
474
-
475
- The CLI automatically detects services in your project by analyzing:
476
- - **`package.json`**: Database drivers and client libraries (e.g., `pg`, `mongoose`, `redis`, `ioredis`)
477
- - **`.env` files**: Connection strings and environment variables (e.g., `POSTGRES_*`, `REDIS_*`, `MONGODB_*`)
478
- - **`docker-compose.yml`**: Service definitions in Docker Compose files
479
-
480
- ### Service Templates Include
481
-
482
- Each service template provides:
483
- - Connection setup and configuration
484
- - Basic CRUD operations (where applicable)
485
- - Advanced patterns and best practices
486
- - Docker Compose examples
487
- - Environment variable configuration
488
- - Development and testing integration
489
- - Common pitfalls and solutions
490
-
491
- Templates are generated in `/rulebook/[SERVICE].md` and referenced in `AGENTS.md` for easy access during development.
492
-
493
- **Server Details:**
494
- - **Transport**: stdio only - stdout contains ONLY JSON-RPC 2.0 messages
495
- - **Configuration**: Loaded from `.rulebook` file automatically
496
- - **Project Detection**: Finds `.rulebook` by walking up directories (like git)
497
- - **Protocol**: MCP over stdio (MCP-compliant, no stdout pollution)
498
-
499
- **Configuration:**
500
-
501
- The MCP server configuration lives in your `.rulebook` file:
502
-
503
- ```json
504
- {
505
- "mcp": {
506
- "enabled": true,
507
- "tasksDir": "rulebook/tasks",
508
- "archiveDir": "rulebook/archive"
509
- }
510
- }
511
- ```
512
-
513
- **Note:** The server uses stdio transport only (no configuration needed).
514
-
515
- **Cursor Configuration (`.cursor/mcp.json`):**
516
-
517
- After running `rulebook mcp init`, your `.cursor/mcp.json` will be automatically configured:
518
-
519
- ```json
520
- {
521
- "mcpServers": {
522
- "rulebook": {
523
- "command": "npx",
524
- "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"]
525
- }
526
- }
527
- }
528
- ```
529
-
530
- That's it! No need for `--project-root`, `--port`, or environment variables. The server automatically:
531
- - Finds your `.rulebook` file by walking up directories
532
- - Uses the `mcp` configuration from `.rulebook`
533
- - Works from any subdirectory in your project
534
-
535
- **Manual Override (if needed):**
536
-
537
- If you need to override the `.rulebook` location:
538
-
539
- ```json
540
- {
541
- "mcpServers": {
542
- "rulebook": {
543
- "command": "npx",
544
- "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"],
545
- "env": {
546
- "RULEBOOK_CONFIG": "/path/to/.rulebook"
547
- }
548
- }
549
- }
550
- }
551
- ```
552
-
553
- **Note:** After running `rulebook mcp init` or updating `.cursor/mcp.json`, restart Cursor for the changes to take effect.
554
-
555
- **Troubleshooting:**
556
-
557
- ### Server Not Starting
558
-
559
- If the MCP server fails to start:
560
-
561
- 1. **Verify `.rulebook` exists**: Run `rulebook mcp init` in your project root
562
- 2. **Check Node.js version**: Requires Node.js 20+ (`node --version`)
563
- 3. **Verify MCP configuration**: Check that `.cursor/mcp.json` exists and is valid JSON
564
- 4. **Debug mode**: Set `RULEBOOK_MCP_DEBUG=1` to see debug logs in stderr:
565
- ```bash
566
- RULEBOOK_MCP_DEBUG=1 npx @hivehub/rulebook@latest mcp-server
567
- ```
568
-
569
- ### Empty Schemas or Missing Parameters
570
-
571
- If tools don't show descriptions or parameters:
572
-
573
- 1. **Clear npm cache**:
574
- ```bash
575
- # Clear npm cache
576
- npm cache clean --force
577
-
578
- # Or clear npx cache specifically
579
- rm -rf ~/.npm/_npx
580
- ```
581
-
582
- 2. **Rebuild the project**:
583
- ```bash
584
- npm run build
585
- ```
586
-
587
- 3. Restart your MCP client and try again.
588
-
589
- ### "Unexpected token" or "Invalid JSON" Errors
590
-
591
- These errors occur when the server outputs non-JSON to stdout. This is fixed in v1.0.9+:
592
- - Ensure you're using `@hivehub/rulebook@latest` (v1.0.9 or newer)
593
- - stdout now contains ONLY JSON-RPC 2.0 messages
594
- - All logs go to stderr (use `RULEBOOK_MCP_DEBUG=1` to see them)
595
-
596
- ### ".rulebook not found" Error
597
-
598
- If you see this error:
599
- 1. Run `rulebook mcp init` in your project root
600
- 2. Or manually create `.rulebook` file with `mcp` block
601
- 3. Or set `RULEBOOK_CONFIG` environment variable to point to your `.rulebook` file
602
-
603
- ### "Received a response for an unknown message ID" Warning
604
-
605
- If you see this warning in Cursor logs:
606
- - **This is a cosmetic warning** - it does NOT affect functionality
607
- - All tools work correctly despite this warning
608
- - The server is responding correctly with valid JSON-RPC 2.0 messages
609
- - This is a known issue with Cursor's MCP client ID tracking
610
- - The warning can be safely ignored - all MCP tools function normally
611
-
612
- ### "Received a response for an unknown message ID" Warning
613
-
614
- If you see this warning in the logs:
615
- - This is usually harmless - the server is working correctly
616
- - The warning appears during the initial handshake but doesn't affect functionality
617
- - If you see "Successfully connected to stdio server" after the warning, everything is fine
618
- - This is a known behavior with some MCP clients and can be safely ignored
619
-
620
- **Automated Setup:**
621
-
622
- ```bash
623
- # Initialize MCP in your project (recommended)
624
- npx @hivehub/rulebook@latest mcp init
625
-
626
- # Or use the setup script (for CI/CD)
627
- npm run setup:mcp
628
- ```
629
-
630
- ## AI Tools Supported (23)
631
-
632
- **IDEs**: Cursor, Windsurf, VS Code, GitHub Copilot, Tabnine, Replit, JetBrains AI, Zed
633
-
634
- **CLI Agents**: Aider, Continue, Claude, Claude Code, Gemini, Cline, Amazon Q, Auggie, CodeBuddy, Factory, OpenCode, Kilo, Codex, Codeium, Cursor CLI
635
-
636
- ## Documentation
637
-
638
- Full documentation available in `/docs`:
639
- - [Getting Started](docs/guides/GETTING_STARTED.md)
640
- - [Best Practices](docs/guides/BEST_PRACTICES.md)
641
- - [CLI Agents](docs/CLI_AGENTS.md)
642
- - [Roadmap](docs/ROADMAP.md)
643
- - [Framework Templates](templates/frameworks/)
644
-
645
- ## Contributing
646
-
647
- Contributions welcome! Node.js 18+ required.
648
-
649
- ```bash
650
- npm install
651
- npm test
652
- npm run build
653
- ```
654
-
655
- ## License
656
-
657
- Apache License 2.0 © HiveLLM Team
658
-
659
- ---
660
-
661
- **Links**: [Issues](https://github.com/hivellm/rulebook/issues) • [Discussions](https://github.com/hivellm/rulebook/discussions)
1
+ # @hivehub/rulebook
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@hivehub/rulebook?logo=npm&logoColor=white)](https://www.npmjs.com/package/@hivehub/rulebook)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@hivehub/rulebook?logo=npm&logoColor=white)](https://www.npmjs.com/package/@hivehub/rulebook)
5
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-20+-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
+
9
+ [![Tests](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/test.yml?label=tests&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/test.yml)
10
+ [![Coverage](https://img.shields.io/codecov/c/github/hivellm/rulebook?logo=codecov&logoColor=white)](https://codecov.io/gh/hivellm/rulebook)
11
+ [![Build](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/build.yml?label=build&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/build.yml)
12
+ [![Lint](https://img.shields.io/github/actions/workflow/status/hivellm/rulebook/lint.yml?label=lint&logo=github)](https://github.com/hivellm/rulebook/actions/workflows/lint.yml)
13
+
14
+ > Standardize AI-generated projects with automated templates, quality gates, persistent memory, and framework detection for 28 languages, 17 frameworks, 13 MCP modules, and 20 services.
15
+
16
+ ---
17
+
18
+ ## Why Rulebook?
19
+
20
+ Large Language Models (LLMs) for software development need **clear directives** to generate high-quality code consistently. Without standardized guidelines, AI-generated code can be inconsistent, error-prone, and difficult to maintain.
21
+
22
+ **Rulebook solves this by providing:**
23
+
24
+ - 📋 **Comprehensive Rule Sets**: Language-specific guidelines (TypeScript, Rust, Python, etc.), framework conventions (NestJS, Django, React), testing standards, linting rules, spell-checking, CI/CD pipelines, Git hooks, and version control best practices
25
+ - 🧠 **Persistent Memory**: Context that survives across AI sessions with hybrid BM25+HNSW search, zero native dependencies
26
+ - 🎯 **Normalized Deliverables**: Ensures consistent code quality across all AI-generated outputs
27
+ - 🛡️ **Error Reduction**: Catches issues early through automated quality gates and pre-commit/pre-push hooks
28
+ - ⚙️ **Process Automation**: Automates repetitive tasks like formatting, testing, and deployment
29
+ - 🔌 **MCP Integration**: 19 MCP functions for task management, skills, and persistent memory
30
+ - 📊 **Task Management**: Built-in task management system (OpenSpec-compatible format) for structured development
31
+
32
+ By giving LLMs a clear "rulebook" to follow, you ensure that every piece of generated code meets your project's standards—**automatically**.
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ # New project (interactive)
38
+ npx @hivehub/rulebook@latest init
39
+
40
+ # Minimal setup (essentials only)
41
+ npx @hivehub/rulebook@latest init --minimal
42
+
43
+ # Light mode (prototypes without strict rules)
44
+ npx @hivehub/rulebook@latest init --light
45
+
46
+ # Update existing project
47
+ npx @hivehub/rulebook@latest update
48
+ ```
49
+
50
+ ## What's New
51
+
52
+ ### v3.0.0 (Latest)
53
+
54
+ - 🧠 **Persistent Memory System**: Zero-dependency persistent context across AI sessions
55
+ - Hybrid search: BM25 keyword + HNSW vector with Reciprocal Rank Fusion
56
+ - TF-IDF embeddings with FNV1a feature hashing (256-dim, pure TypeScript)
57
+ - SQLite persistence via sql.js WASM (zero native compilation)
58
+ - LRU cache eviction (500MB default, protects decision memories)
59
+ - Privacy filter: auto-redacts `<private>...</private>` tags
60
+ - 7 memory types: bugfix, feature, refactor, decision, discovery, change, observation
61
+ - 6 MCP tools + 6 CLI commands for complete memory management
62
+ - 🧩 **119 Skills with YAML Frontmatter**: All 106 legacy templates converted to proper SKILL.md format
63
+ - 28 languages, 17 frameworks, 13 modules, 20 services, 8 IDEs, 15 CLI, 5 core + git/hooks
64
+ - 🔌 **Claude Code Commands**: Memory + task commands auto-installed to `.claude/commands/`
65
+ - 🔧 **Update Preserves Config**: `rulebook update` no longer resets custom `.rulebook` fields (memory, skills, timeouts, etc.)
66
+ - 🛡️ **MCP Config Safety**: `.mcp.json` entry preserved if already configured (no more overwriting)
67
+
68
+ ### v2.1.0
69
+
70
+ - 🔒 **Claude Code Critical Directives**: New mandatory rules for Claude Code CLI
71
+ - **Sequential File Editing**: Files must be edited one at a time to prevent failures from parallel edits
72
+ - **Complete Test Implementation**: Strict rules against simplifying tests, placeholder assertions, or skipping test cases
73
+ - Updated `CLAUDE.md` generation with comprehensive guidelines and examples
74
+ - 🪟 **Windows Test Suite Fix**: Tests no longer hang on Windows (705 tests passing, 11x faster)
75
+
76
+ ### v2.0.0
77
+
78
+ - 🧩 **Skills System**: New modular skills architecture for AI-assisted development
79
+ - Skills are YAML-frontmatter Markdown files with enable/disable functionality
80
+ - 10 skill categories: languages, frameworks, modules, services, workflows, ides, core, cli, git, hooks
81
+ - Auto-detection of skills based on project configuration
82
+ - CLI commands: `rulebook skill list|add|remove|show|search`
83
+ - MCP functions: `rulebook_skill_list|show|enable|disable|search|validate`
84
+ - 🤖 **AI CLI Configuration Files**: Auto-generated files for AI CLI tools
85
+ - `CLAUDE.md` - Claude Code CLI configuration
86
+ - `CODEX.md` - OpenAI Codex CLI configuration
87
+ - `GEMINI.md` - Google Gemini CLI configuration
88
+ - `gemini-extension.json` - Gemini CLI extension manifest
89
+ - 🔌 **Claude Code Plugin**: `marketplace.json` + `.claude-plugin/` structure for marketplace distribution
90
+ - `marketplace.json` - Marketplace manifest for plugin discovery
91
+ - Plugin manifest, MCP configuration, slash commands, and skills
92
+
93
+ ### v1.1.5
94
+
95
+ - 🗄️ **Service Integration Templates**: Added comprehensive service integration templates
96
+ - 20 service templates: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite, MongoDB, Cassandra, DynamoDB, Redis, Memcached, Elasticsearch, Neo4j, InfluxDB, RabbitMQ, Kafka, S3, Azure Blob, GCS, MinIO
97
+ - Automatic service detection from `package.json`, `.env`, and `docker-compose.yml`
98
+ - Service-specific integration instructions with connection setup, operations, best practices, and configuration
99
+ - Templates generated in `/rulebook/[SERVICE].md` with references in `AGENTS.md`
100
+ - Interactive CLI prompt to select which services to include templates for
101
+
102
+ ### v1.1.4
103
+
104
+ - 🔧 **Cross-platform Git Hooks**: Git hooks now work on both Windows and Linux
105
+ - Hooks are now generated as Node.js scripts with shell wrappers
106
+ - Shell wrapper detects Node.js in common locations (Windows and Linux)
107
+ - Node.js scripts use native `child_process.spawn` for cross-platform command execution
108
+ - Pre-commit and pre-push hooks now function correctly on Windows (Git Bash) and Linux
109
+ - 🔄 **Git Hooks Architecture**: Refactored hook generation system
110
+ - Hooks are now generated as two files: shell wrapper + Node.js script
111
+ - Shell templates (`.sh`) are automatically converted to Node.js scripts
112
+ - Improved command parsing from shell templates to Node.js
113
+ - Better error handling and cross-platform compatibility
114
+
115
+ ### v1.1.3
116
+
117
+ - 🗑️ **MCP Tool: `rulebook_task_delete`**: Delete tasks permanently
118
+ - New tool to permanently delete tasks from the filesystem
119
+ - Removes task directory recursively
120
+ - Useful for cleaning up test tasks or removing unwanted tasks
121
+ - Total of 7 MCP functions now available
122
+
123
+ ### v1.1.2
124
+
125
+ - 🔧 **ESLint v9 Migration**: Updated to ESLint flat config format
126
+ - Migrated from `.eslintrc.json` to `eslint.config.js`
127
+ - Updated to ESLint 9.37.0 with TypeScript ESLint 8.47.0
128
+ - Added proper Node.js global type definitions
129
+ - Linting now shows only errors (warnings suppressed with `--quiet`)
130
+
131
+ ### v1.0.3
132
+
133
+ - 🔧 **Zod v3 Compatibility**: Using Zod v3.25.76 for full MCP SDK compatibility
134
+ - MCP SDK v1.22.0 requires Zod v3 (see [Issue #1429](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1429))
135
+ - Will upgrade to Zod v4 when MCP SDK officially supports it
136
+ - 🔄 **Dependency Updates**: All dependencies updated to latest versions
137
+ - TypeScript tooling (ESLint 8.47.0, Vitest 4.0.13)
138
+ - Node.js types updated to support Node.js 24.x
139
+ - CLI tools and build utilities updated
140
+ - 🐛 **Windows CI Fix**: Fixed PowerShell compatibility in GitHub Actions workflows
141
+ - Removed bash-specific syntax from Windows runners
142
+ - Cross-platform compatibility improved
143
+
144
+ ### v1.0.2
145
+
146
+ - 🔌 **MCP Server for Task Management**: New MCP server enables AI models to manage tasks programmatically
147
+ - 7 MCP functions: create, list, show, update, validate, archive, delete tasks
148
+ - Available via `npx @hivellm/rulebook@latest mcp-server` or `npx rulebook-mcp`
149
+ - Better integration with MCP-compatible AI assistants
150
+ - **Faster Pre-commit Hooks**: Tests removed from pre-commit for faster backup commits
151
+ - Pre-commit now runs only: format check, lint, type-check
152
+ - Tests moved to pre-push hook for comprehensive validation
153
+ - 🏗️ **Build Verification**: Build check now mandatory before push (runs first)
154
+ - 📦 **pnpm Recommendation**: Added pnpm as preferred package manager with `.npmrc` configuration
155
+ - 🚀 **Rust Build Optimization**: Comprehensive guide for faster Rust builds
156
+ - sccache configuration, incremental compilation, lld linker
157
+ - Anti-pattern documentation for `pub use big_crate::*;`
158
+ - 📋 **Enhanced Task Management**: Strengthened OpenSpec format compliance and archiving rules
159
+ - 📁 **Strict Markdown Organization**: UPPERCASE naming and `/docs` directory requirements
160
+
161
+ ### v1.0.0
162
+
163
+ - 🎉 **First Stable Release**: Production-ready with comprehensive features
164
+ - 🔒 **Apache 2.0 License**: Changed from MIT to Apache License 2.0 for better compatibility
165
+ - 🛡️ **Git Hooks Enforcement**: Pre-commit and pre-push hooks now block commits with lint/test errors
166
+ - 📋 **Task File Structure Rules**: Enhanced directives in AGENTS.md about correct task structure
167
+ - 🎯 **Built-in Task Management**: OpenSpec deprecated and integrated into Rulebook's native task system
168
+ - 📋 **RULEBOOK.md Template**: Core template with task management directives and Context7 MCP requirements
169
+ - 🚫 **Automatic .gitignore**: `npx @hivellm/rulebook@latest init` now creates/updates `.gitignore` automatically for 28 languages
170
+ - 🔄 **Migration Support**: Existing OpenSpec tasks automatically migrated to `/rulebook/tasks/` format
171
+
172
+ > **Breaking Change**: OpenSpec module removed. Use `npx @hivellm/rulebook@latest task` commands instead. See [Migration Guide](docs/guides/OPENSPEC_MIGRATION.md).
173
+
174
+ ---
175
+
176
+ ## Persistent Memory System
177
+
178
+ > **NEW in v3.0.0** — Give your AI assistant a brain that persists across sessions.
179
+
180
+ Every time you open a new tab or restart your editor, the AI loses all context about your project. Rulebook's persistent memory solves this — decisions, bugs, discoveries, and preferences are stored locally and searchable across sessions.
181
+
182
+ ### How It Works
183
+
184
+ ```
185
+ Session 1: "Let's use sql.js instead of better-sqlite3 for zero native deps"
186
+ Saved to memory automatically
187
+
188
+ Session 2 (new tab, days later):
189
+ AI searches memory → finds the decision → continues with full context
190
+ ```
191
+
192
+ ### Architecture
193
+
194
+ | Component | Technology | Purpose |
195
+ |-----------|-----------|---------|
196
+ | **Storage** | SQLite via sql.js WASM | Zero native compilation, works everywhere |
197
+ | **Keyword Search** | BM25 | Fast exact-match scoring |
198
+ | **Vector Search** | HNSW index | Semantic similarity matching |
199
+ | **Embeddings** | TF-IDF + FNV1a hashing | 256-dim vectors, pure TypeScript, no API calls |
200
+ | **Ranking** | Reciprocal Rank Fusion | Combines BM25 + vector scores |
201
+ | **Eviction** | LRU cache | 500MB default, protects decision/bugfix memories |
202
+ | **Privacy** | Auto-redact filter | `<private>...</private>` tags stripped before storage |
203
+
204
+ ### Memory Types
205
+
206
+ | Type | When to Use |
207
+ |------|-------------|
208
+ | `decision` | Chose one approach over another |
209
+ | `bugfix` | Root cause and resolution |
210
+ | `feature` | What was built, key design choices |
211
+ | `discovery` | Codebase patterns, gotchas, constraints |
212
+ | `refactor` | Structural changes and reasoning |
213
+ | `change` | Configuration or dependency updates |
214
+ | `observation` | Session summaries, general notes |
215
+
216
+ ### Auto-Capture
217
+
218
+ Tool interactions are captured automatically when the AI creates a task, updates a status, enables a skill, etc., the memory system records it without any manual action.
219
+
220
+ For conversation context (decisions, discussions, user preferences), the AI saves manually following the mandatory directives in `CLAUDE.md` and `AGENTS.md`.
221
+
222
+ ### Usage
223
+
224
+ **CLI Commands:**
225
+ ```bash
226
+ rulebook memory search "authentication approach" # Hybrid BM25+vector search
227
+ rulebook memory save "Chose JWT over sessions" # Save manually
228
+ rulebook memory stats # DB size, count, health
229
+ rulebook memory cleanup # Evict old memories
230
+ rulebook memory export # Export as JSON/CSV
231
+ ```
232
+
233
+ **MCP Tools (used by AI agents):**
234
+ ```
235
+ rulebook_memory_save — Save context with type, title, content, tags
236
+ rulebook_memory_search — Hybrid search (bm25/vector/hybrid modes)
237
+ rulebook_memory_get — Get full details by memory ID
238
+ rulebook_memory_timeline — Chronological context around a memory
239
+ rulebook_memory_stats — Database statistics and health
240
+ rulebook_memory_cleanup — Force eviction and cleanup
241
+ ```
242
+
243
+ ### Configuration
244
+
245
+ Memory is enabled in `.rulebook`:
246
+
247
+ ```json
248
+ {
249
+ "memory": {
250
+ "enabled": true,
251
+ "autoCapture": true,
252
+ "dbPath": ".rulebook-memory/memory.db",
253
+ "maxSizeBytes": 524288000,
254
+ "vectorDimensions": 256
255
+ }
256
+ }
257
+ ```
258
+
259
+ > Add `.rulebook-memory/` to your `.gitignore` memory is local per developer.
260
+
261
+ ---
262
+
263
+ ## Key Features
264
+
265
+ - 🧠 **Persistent Memory**: Context that survives across AI sessions — hybrid BM25+HNSW search, auto-capture, zero native dependencies
266
+ - 🔍 **Auto-Detection**: Detects languages, frameworks, MCP modules, and services from your project files
267
+ - 📁 **Modular Architecture**: Templates in `/rulebook/` directory smaller AGENTS.md, on-demand loading
268
+ - 🔗 **Git Hook Automation**: Pre-commit/pre-push hooks with language-aware quality checks
269
+ - 🔌 **19 MCP Functions**: Task management (7), skills (6), and persistent memory (6) via Model Context Protocol
270
+ - 📝 **106+ Templates**: 28 languages, 17 frameworks, 8 IDEs, 20 services, 15 CLI agents
271
+ - 🤖 **AI-Optimized**: Works with 23 AI assistants (Cursor, Claude, Gemini, etc.)
272
+ - 📦 **Publication Ready**: CI/CD pipelines for npm, crates.io, PyPI, Maven Central, and more
273
+ - 🔄 **Automatic Migration**: Existing projects automatically migrated to modular structure
274
+
275
+ ## What It Does
276
+
277
+ **For New Projects:**
278
+ 1. Detects your language(s), frameworks, MCP modules, and services
279
+ 2. Asks setup questions (or use `--minimal` for defaults)
280
+ 3. Generates AGENTS.md with AI assistant rules (modular structure)
281
+ 4. Creates `/rulebook/` directory with language/framework/module/service templates
282
+ 5. Creates/updates `.gitignore` automatically for detected languages
283
+ 6. Auto-configures Claude Code integration (MCP + skills) if detected
284
+ 7. Optionally installs Git hooks (pre-commit/pre-push)
285
+ 8. Creates GitHub Actions workflows
286
+ 9. Scaffolds README, LICENSE, /docs, and /tests
287
+
288
+ **For Existing Projects:**
289
+ ```bash
290
+ npx @hivehub/rulebook update
291
+ ```
292
+ - Automatically migrates embedded templates to modular `/rulebook/` structure
293
+ - Automatically migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
294
+ - Merges latest templates while preserving your customizations
295
+ - Updates AGENTS.md with references to modular files
296
+ - Updates `.gitignore` with missing patterns for detected languages
297
+
298
+ ## Commands
299
+
300
+ ### Core Commands
301
+
302
+ ```bash
303
+ # Project Initialization & Updates
304
+ npx @hivehub/rulebook@latest init # Initialize new project (interactive)
305
+ npx @hivehub/rulebook@latest init --minimal # Minimal setup (essentials only)
306
+ npx @hivehub/rulebook@latest init --light # Light mode (no quality enforcement)
307
+ npx @hivehub/rulebook@latest init --yes # Skip prompts, use defaults
308
+ npx @hivehub/rulebook@latest update # Update AGENTS.md to latest version
309
+ npx @hivehub/rulebook@latest update --yes # Update without confirmation
310
+ npx @hivehub/rulebook@latest update --light # Update in light mode
311
+
312
+ # Workflow & CI/CD
313
+ npx @hivehub/rulebook@latest workflows # Generate GitHub Actions workflows
314
+
315
+ # Validation & Health
316
+ npx @hivehub/rulebook@latest validate # Check project standards
317
+ npx @hivehub/rulebook@latest health # Project health score (0-100)
318
+ npx @hivehub/rulebook@latest fix # Auto-fix common issues
319
+
320
+ # Documentation
321
+ npx @hivehub/rulebook@latest generate-docs # Create /docs structure
322
+ npx @hivehub/rulebook@latest generate-docs --yes # Skip prompts, use defaults
323
+
324
+ # Dependencies & Coverage
325
+ npx @hivehub/rulebook@latest check-deps # Check outdated/vulnerable dependencies
326
+ npx @hivehub/rulebook@latest check-coverage # Check test coverage (default: 95%)
327
+ npx @hivehub/rulebook@latest check-coverage -t 80 # Custom threshold
328
+
329
+ # Versioning
330
+ npx @hivehub/rulebook@latest version <type> # Bump version (major|minor|patch)
331
+ npx @hivehub/rulebook@latest changelog # Generate changelog from git commits
332
+ npx @hivehub/rulebook@latest changelog -v 1.0.0 # Specify version
333
+ ```
334
+
335
+ > **Note**: If installed globally (`npm install -g @hivehub/rulebook`), you can use `rulebook` directly instead of `npx @hivehub/rulebook@latest`.
336
+
337
+ ### Advanced Commands (Beta)
338
+
339
+ ```bash
340
+ # Real-time Monitoring
341
+ npx @hivehub/rulebook@latest watcher # Full-screen task monitoring UI
342
+ # - Live task progress tracking
343
+ # - Activity log with timestamps
344
+ # - System status monitoring
345
+ # - Auto-refresh every 2 seconds
346
+
347
+ # Autonomous Agent
348
+ npx @hivehub/rulebook@latest agent # Start AI CLI workflow automation
349
+ npx @hivehub/rulebook@latest agent --dry-run # Simulate without changes
350
+ npx @hivehub/rulebook@latest agent --tool cursor-agent # Specify CLI tool
351
+ npx @hivehub/rulebook@latest agent --iterations 10 # Max iterations
352
+ npx @hivehub/rulebook@latest agent --watch # Enable watcher mode
353
+
354
+ # Task Management
355
+ npx @hivehub/rulebook@latest task create <task-id> # Create new task
356
+ npx @hivehub/rulebook@latest task list # List all tasks
357
+ npx @hivehub/rulebook@latest task list --archived # List including archived tasks
358
+ npx @hivehub/rulebook@latest task show <task-id> # Show task details
359
+ npx @hivehub/rulebook@latest task validate <task-id> # Validate task format
360
+ npx @hivehub/rulebook@latest task archive <task-id> # Archive completed task
361
+ npx @hivehub/rulebook@latest task archive --skip-validation <task-id> # Archive without validation
362
+ npx @hivehub/rulebook@latest tasks [options] # Legacy command (DEPRECATED - use 'task' commands)
363
+
364
+ # Skills Management (v2.0)
365
+ npx @hivehub/rulebook@latest skill list # List all available skills
366
+ npx @hivehub/rulebook@latest skill list --category languages # Filter by category
367
+ npx @hivehub/rulebook@latest skill list --enabled # Show only enabled skills
368
+ npx @hivehub/rulebook@latest skill add <skill-id> # Enable a skill
369
+ npx @hivehub/rulebook@latest skill remove <skill-id> # Disable a skill
370
+ npx @hivehub/rulebook@latest skill show <skill-id> # Show skill details
371
+ npx @hivehub/rulebook@latest skill search <query> # Search for skills
372
+
373
+ # Persistent Memory (v3.0)
374
+ npx @hivehub/rulebook@latest memory search <query> # Search memories (hybrid BM25+vector)
375
+ npx @hivehub/rulebook@latest memory save <text> # Save a memory
376
+ npx @hivehub/rulebook@latest memory list # List all memories
377
+ npx @hivehub/rulebook@latest memory stats # Database stats and health
378
+ npx @hivehub/rulebook@latest memory cleanup # Run cache eviction
379
+ npx @hivehub/rulebook@latest memory export # Export as JSON or CSV
380
+
381
+ # Configuration
382
+ npx @hivehub/rulebook@latest config --show # Show current config
383
+ npx @hivehub/rulebook@latest config --set key=value # Set config value
384
+ npx @hivehub/rulebook@latest config --feature watcher --enable # Enable feature
385
+ npx @hivehub/rulebook@latest config --feature agent --disable # Disable feature
386
+ ```
387
+
388
+ ## Setup Modes
389
+
390
+ ### Full Mode (Default)
391
+ Complete setup with all features: Task management, Watcher, MCP modules, comprehensive workflows.
392
+
393
+ ### Minimal Mode
394
+ ```bash
395
+ npx @hivehub/rulebook@latest init --minimal
396
+ ```
397
+ Essentials only: README, LICENSE, tests/, basic CI. Perfect for small teams or initial adoption.
398
+
399
+ ### Light Mode
400
+ ```bash
401
+ npx @hivehub/rulebook@latest init --light
402
+ ```
403
+ Bare minimum rules: no quality enforcement, no testing requirements, no linting. Use for quick prototypes or non-production projects.
404
+
405
+ ## Supported Languages & Frameworks
406
+
407
+ **28 Languages**: TypeScript, JavaScript, Python, Rust, Go, Java, Kotlin, C, C++, C#, PHP, Ruby, Swift, Elixir, Dart, Scala, Haskell, Julia, R, Lua, Solidity, Zig, Erlang, Ada, SAS, Lisp, Objective-C, SQL
408
+
409
+ **17 Frameworks** (auto-detected):
410
+ - Backend: NestJS, Spring Boot, Laravel, Django, Flask, Ruby on Rails, Symfony, Zend
411
+ - Frontend: Angular, React, Vue, Nuxt, Next.js, jQuery
412
+ - Mobile: React Native, Flutter
413
+ - Desktop: Electron
414
+
415
+ ## MCP Modules (13)
416
+
417
+ **Core**: Vectorizer Synap • Context7 • GitHub MCP • Playwright • Memory
418
+
419
+ **Services**: Supabase Notion • Atlassian • Serena • Figma • Grafana
420
+
421
+ ### MCP Server for Task Management
422
+
423
+ Rulebook provides an MCP (Model Context Protocol) server that exposes task management functions, allowing AI models to manage tasks programmatically through MCP instead of executing terminal commands.
424
+
425
+ **Benefits:**
426
+ - ✅ Direct MCP integration - no shell command execution needed
427
+ - ✅ Structured error handling with proper error codes and messages
428
+ - Consistent interface with other MCP operations
429
+ - ✅ Better automation capabilities for AI agents
430
+ - Improved reliability compared to terminal command execution
431
+ - Automatic project detection - finds `.rulebook` by walking up directories (like git)
432
+ - Zero configuration - works out of the box after `rulebook mcp init`
433
+
434
+ **Quick Setup:**
435
+
436
+ ```bash
437
+ # Initialize MCP configuration in your project (one-time setup)
438
+ npx @hivehub/rulebook@latest mcp init
439
+ ```
440
+
441
+ This command:
442
+ - Adds `mcp` block to your `.rulebook` file
443
+ - Creates/updates `.cursor/mcp.json` automatically
444
+ - Server uses stdio transport (MCP standard)
445
+
446
+ > **Note**: `rulebook init` and `rulebook update` automatically detect Claude Code and configure `.mcp.json` at the project root + install skills to `.claude/commands/`. No manual setup needed for Claude Code users.
447
+
448
+ **Available MCP Functions:**
449
+
450
+ - `rulebook_task_create` - Create a new task with OpenSpec-compatible format
451
+ - Input: `taskId` (string), optional `proposal` object
452
+ - Output: Task creation confirmation with path
453
+ - `rulebook_task_list` - List all tasks with optional filters
454
+ - Input: `includeArchived` (boolean), `status` (enum)
455
+ - Output: Array of tasks with metadata
456
+ - `rulebook_task_show` - Show detailed task information
457
+ - Input: `taskId` (string)
458
+ - Output: Complete task details including proposal, tasks, specs
459
+ - `rulebook_task_update` - Update task status or progress
460
+ - Input: `taskId` (string), optional `status`, `progress`
461
+ - Output: Update confirmation
462
+ - `rulebook_task_validate` - Validate task format against OpenSpec requirements
463
+ - Input: `taskId` (string)
464
+ - Output: Validation results with errors and warnings
465
+ - `rulebook_task_archive` - Archive completed task and apply spec deltas
466
+ - Input: `taskId` (string), optional `skipValidation`
467
+ - Output: Archive confirmation with archive path
468
+ - `rulebook_task_delete` - Delete a task permanently
469
+ - Input: `taskId` (string)
470
+ - Output: Deletion confirmation
471
+
472
+ **Total: 7 MCP functions** for complete task lifecycle management.
473
+
474
+ **Skills MCP Functions (v2.0):**
475
+
476
+ - `rulebook_skill_list` - List available skills with optional category filter
477
+ - `rulebook_skill_show` - Show detailed skill information
478
+ - `rulebook_skill_enable` - Enable a skill for the project
479
+ - `rulebook_skill_disable` - Disable a skill
480
+ - `rulebook_skill_search` - Search skills by name, description, or tags
481
+ - `rulebook_skill_validate` - Validate skills configuration
482
+
483
+ **Memory MCP Functions (v3.0):**
484
+
485
+ - `rulebook_memory_search` - Hybrid BM25+vector search with mode selection (hybrid/bm25/vector)
486
+ - `rulebook_memory_timeline` - Chronological context around a specific memory
487
+ - `rulebook_memory_get` - Full details for specific memory IDs
488
+ - `rulebook_memory_save` - Save new memories with type, title, content, and tags
489
+ - `rulebook_memory_stats` - Database statistics (size, count, usage, health)
490
+ - `rulebook_memory_cleanup` - Force eviction and cleanup
491
+
492
+ **Total: 19 MCP functions** (7 task + 6 skills + 6 memory).
493
+
494
+ ## Skills System (v2.0)
495
+
496
+ Rulebook v2.0 introduces a modular skills system for AI-assisted development. Skills are pluggable capabilities that can be enabled or disabled per project.
497
+
498
+ ### What are Skills?
499
+
500
+ Skills are YAML-frontmatter Markdown files that define specific capabilities or rules for AI assistants. Each skill has:
501
+
502
+ - **Metadata**: Name, description, version, category, tags, dependencies
503
+ - **Content**: Markdown content with rules, patterns, and examples
504
+
505
+ ### Skill Categories
506
+
507
+ Skills are organized into 10 categories:
508
+
509
+ | Category | Description | Examples |
510
+ |----------|-------------|----------|
511
+ | `languages` | Language-specific rules | TypeScript, Rust, Python |
512
+ | `frameworks` | Framework conventions | NestJS, React, Django |
513
+ | `modules` | MCP module integration | Vectorizer, Context7 |
514
+ | `services` | Service integration | PostgreSQL, Redis |
515
+ | `workflows` | CI/CD patterns | GitHub Actions |
516
+ | `ides` | IDE configuration | Cursor, VS Code |
517
+ | `core` | Core rulebook standards | Quality gates |
518
+ | `cli` | AI CLI configuration | Claude Code, Codex |
519
+ | `git` | Git workflow rules | Branching, commits |
520
+ | `hooks` | Git hooks configuration | Pre-commit, pre-push |
521
+
522
+ ### Using Skills
523
+
524
+ ```bash
525
+ # List all available skills
526
+ rulebook skill list
527
+
528
+ # Filter by category
529
+ rulebook skill list --category languages
530
+
531
+ # Enable a skill
532
+ rulebook skill add languages/typescript
533
+
534
+ # Disable a skill
535
+ rulebook skill remove languages/typescript
536
+
537
+ # Show skill details
538
+ rulebook skill show languages/typescript
539
+
540
+ # Search for skills
541
+ rulebook skill search "testing"
542
+ ```
543
+
544
+ ### Auto-Detection
545
+
546
+ During `rulebook init` and `rulebook update`, skills are automatically detected and enabled based on your project's:
547
+
548
+ - Detected languages (e.g., TypeScript → `languages/typescript`)
549
+ - Detected frameworks (e.g., NestJS → `frameworks/nestjs`)
550
+ - Detected modules (e.g., Vectorizer → `modules/vectorizer`)
551
+ - Detected services (e.g., PostgreSQL → `services/postgresql`)
552
+
553
+ ### Creating Custom Skills
554
+
555
+ Create a `SKILL.md` file in `templates/skills/<category>/<skill-name>/`:
556
+
557
+ ```markdown
558
+ ---
559
+ name: My Custom Skill
560
+ description: Description of what this skill does
561
+ version: 1.0.0
562
+ category: core
563
+ tags: ["custom", "example"]
564
+ ---
565
+
566
+ # My Custom Skill
567
+
568
+ Add your rules and patterns here.
569
+ ```
570
+
571
+ ## Service Integration Templates (20)
572
+
573
+ Rulebook provides comprehensive integration templates for popular backend services, including databases, caches, message queues, and object storage.
574
+
575
+ **Relational Databases**: PostgreSQL • MySQL • MariaDB • SQL Server • Oracle • SQLite
576
+
577
+ **NoSQL Databases**: MongoDB • Cassandra • DynamoDB
578
+
579
+ **Caches**: Redis • Memcached
580
+
581
+ **Search & Analytics**: Elasticsearch
582
+
583
+ **Graph Databases**: Neo4j
584
+
585
+ **Time-Series Databases**: InfluxDB
586
+
587
+ **Message Queues**: RabbitMQ Kafka
588
+
589
+ **Object Storage**: AWS S3 Azure Blob Storage • Google Cloud Storage • MinIO
590
+
591
+ ### Automatic Service Detection
592
+
593
+ The CLI automatically detects services in your project by analyzing:
594
+ - **`package.json`**: Database drivers and client libraries (e.g., `pg`, `mongoose`, `redis`, `ioredis`)
595
+ - **`.env` files**: Connection strings and environment variables (e.g., `POSTGRES_*`, `REDIS_*`, `MONGODB_*`)
596
+ - **`docker-compose.yml`**: Service definitions in Docker Compose files
597
+
598
+ ### Service Templates Include
599
+
600
+ Each service template provides:
601
+ - Connection setup and configuration
602
+ - Basic CRUD operations (where applicable)
603
+ - Advanced patterns and best practices
604
+ - Docker Compose examples
605
+ - Environment variable configuration
606
+ - Development and testing integration
607
+ - Common pitfalls and solutions
608
+
609
+ Templates are generated in `/rulebook/[SERVICE].md` and referenced in `AGENTS.md` for easy access during development.
610
+
611
+ **Server Details:**
612
+ - **Transport**: stdio only - stdout contains ONLY JSON-RPC 2.0 messages
613
+ - **Configuration**: Loaded from `.rulebook` file automatically
614
+ - **Project Detection**: Finds `.rulebook` by walking up directories (like git)
615
+ - **Protocol**: MCP over stdio (MCP-compliant, no stdout pollution)
616
+
617
+ **Configuration:**
618
+
619
+ The MCP server configuration lives in your `.rulebook` file:
620
+
621
+ ```json
622
+ {
623
+ "mcp": {
624
+ "enabled": true,
625
+ "tasksDir": "rulebook/tasks",
626
+ "archiveDir": "rulebook/archive"
627
+ }
628
+ }
629
+ ```
630
+
631
+ **Note:** The server uses stdio transport only (no configuration needed).
632
+
633
+ **Cursor Configuration (`.cursor/mcp.json`):**
634
+
635
+ After running `rulebook mcp init`, your `.cursor/mcp.json` will be automatically configured:
636
+
637
+ ```json
638
+ {
639
+ "mcpServers": {
640
+ "rulebook": {
641
+ "command": "npx",
642
+ "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"]
643
+ }
644
+ }
645
+ }
646
+ ```
647
+
648
+ That's it! No need for `--project-root`, `--port`, or environment variables. The server automatically:
649
+ - Finds your `.rulebook` file by walking up directories
650
+ - Uses the `mcp` configuration from `.rulebook`
651
+ - Works from any subdirectory in your project
652
+
653
+ **Manual Override (if needed):**
654
+
655
+ If you need to override the `.rulebook` location:
656
+
657
+ ```json
658
+ {
659
+ "mcpServers": {
660
+ "rulebook": {
661
+ "command": "npx",
662
+ "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"],
663
+ "env": {
664
+ "RULEBOOK_CONFIG": "/path/to/.rulebook"
665
+ }
666
+ }
667
+ }
668
+ }
669
+ ```
670
+
671
+ **Note:** After running `rulebook mcp init` or updating `.cursor/mcp.json`, restart Cursor for the changes to take effect.
672
+
673
+ **Troubleshooting:**
674
+
675
+ ### Server Not Starting
676
+
677
+ If the MCP server fails to start:
678
+
679
+ 1. **Verify `.rulebook` exists**: Run `rulebook mcp init` in your project root
680
+ 2. **Check Node.js version**: Requires Node.js 20+ (`node --version`)
681
+ 3. **Verify MCP configuration**: Check that `.cursor/mcp.json` exists and is valid JSON
682
+ 4. **Debug mode**: Set `RULEBOOK_MCP_DEBUG=1` to see debug logs in stderr:
683
+ ```bash
684
+ RULEBOOK_MCP_DEBUG=1 npx @hivehub/rulebook@latest mcp-server
685
+ ```
686
+
687
+ ### Empty Schemas or Missing Parameters
688
+
689
+ If tools don't show descriptions or parameters:
690
+
691
+ 1. **Clear npm cache**:
692
+ ```bash
693
+ # Clear npm cache
694
+ npm cache clean --force
695
+
696
+ # Or clear npx cache specifically
697
+ rm -rf ~/.npm/_npx
698
+ ```
699
+
700
+ 2. **Rebuild the project**:
701
+ ```bash
702
+ npm run build
703
+ ```
704
+
705
+ 3. Restart your MCP client and try again.
706
+
707
+ ### "Unexpected token" or "Invalid JSON" Errors
708
+
709
+ These errors occur when the server outputs non-JSON to stdout. This is fixed in v1.0.9+:
710
+ - Ensure you're using `@hivehub/rulebook@latest` (v1.0.9 or newer)
711
+ - stdout now contains ONLY JSON-RPC 2.0 messages
712
+ - All logs go to stderr (use `RULEBOOK_MCP_DEBUG=1` to see them)
713
+
714
+ ### ".rulebook not found" Error
715
+
716
+ If you see this error:
717
+ 1. Run `rulebook mcp init` in your project root
718
+ 2. Or manually create `.rulebook` file with `mcp` block
719
+ 3. Or set `RULEBOOK_CONFIG` environment variable to point to your `.rulebook` file
720
+
721
+ ### "Received a response for an unknown message ID" Warning
722
+
723
+ If you see this warning in Cursor logs:
724
+ - **This is a cosmetic warning** - it does NOT affect functionality
725
+ - All tools work correctly despite this warning
726
+ - The server is responding correctly with valid JSON-RPC 2.0 messages
727
+ - This is a known issue with Cursor's MCP client ID tracking
728
+ - The warning can be safely ignored - all MCP tools function normally
729
+
730
+ ### "Received a response for an unknown message ID" Warning
731
+
732
+ If you see this warning in the logs:
733
+ - This is usually harmless - the server is working correctly
734
+ - The warning appears during the initial handshake but doesn't affect functionality
735
+ - If you see "Successfully connected to stdio server" after the warning, everything is fine
736
+ - This is a known behavior with some MCP clients and can be safely ignored
737
+
738
+ **Automated Setup:**
739
+
740
+ ```bash
741
+ # Initialize MCP in your project (recommended)
742
+ npx @hivehub/rulebook@latest mcp init
743
+
744
+ # Or use the setup script (for CI/CD)
745
+ npm run setup:mcp
746
+ ```
747
+
748
+ ## AI Tools Supported (23)
749
+
750
+ **IDEs**: Cursor, Windsurf, VS Code, GitHub Copilot, Tabnine, Replit, JetBrains AI, Zed
751
+
752
+ **CLI Agents**: Aider, Continue, Claude, Claude Code, Gemini, Cline, Amazon Q, Auggie, CodeBuddy, Factory, OpenCode, Kilo, Codex, Codeium, Cursor CLI
753
+
754
+ ## Documentation
755
+
756
+ Full documentation available in `/docs`:
757
+ - [Getting Started](docs/guides/GETTING_STARTED.md)
758
+ - [Best Practices](docs/guides/BEST_PRACTICES.md)
759
+ - [CLI Agents](docs/CLI_AGENTS.md)
760
+ - [Roadmap](docs/ROADMAP.md)
761
+ - [Framework Templates](templates/frameworks/)
762
+
763
+ ## Contributing
764
+
765
+ Contributions welcome! Node.js 18+ required.
766
+
767
+ ```bash
768
+ npm install
769
+ npm test
770
+ npm run build
771
+ ```
772
+
773
+ ## License
774
+
775
+ Apache License 2.0 © HiveLLM Team
776
+
777
+ ---
778
+
779
+ **Links**: [Issues](https://github.com/hivellm/rulebook/issues) • [Discussions](https://github.com/hivellm/rulebook/discussions)