@hivehub/rulebook 2.0.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 (188) hide show
  1. package/README.md +779 -654
  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 -176
  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/cli/CLAUDE_CODE.md +114 -13
  67. package/templates/commands/rulebook-memory-save.md +48 -0
  68. package/templates/commands/rulebook-memory-search.md +47 -0
  69. package/templates/commands/rulebook-task-apply.md +2 -2
  70. package/templates/commands/rulebook-task-archive.md +2 -2
  71. package/templates/commands/rulebook-task-create.md +2 -2
  72. package/templates/commands/rulebook-task-list.md +2 -2
  73. package/templates/commands/rulebook-task-show.md +2 -2
  74. package/templates/commands/rulebook-task-validate.md +2 -2
  75. package/templates/git/CI_CD_PATTERNS.md +4 -4
  76. package/templates/git/GITHUB_ACTIONS.md +3 -3
  77. package/templates/git/GITLAB_CI.md +4 -4
  78. package/templates/git/SECRETS_MANAGEMENT.md +4 -4
  79. package/templates/hooks/COMMIT_MSG.md +4 -4
  80. package/templates/hooks/POST_CHECKOUT.md +3 -3
  81. package/templates/hooks/PREPARE_COMMIT_MSG.md +3 -3
  82. package/templates/hooks/PRE_COMMIT.md +4 -4
  83. package/templates/hooks/PRE_PUSH.md +4 -4
  84. package/templates/modules/MEMORY.md +63 -0
  85. package/templates/skills/cli/aider/SKILL.md +59 -0
  86. package/templates/skills/cli/amazon-q/SKILL.md +35 -0
  87. package/templates/skills/cli/auggie/SKILL.md +42 -0
  88. package/templates/skills/cli/claude/SKILL.md +42 -0
  89. package/templates/skills/cli/claude-code/SKILL.md +146 -0
  90. package/templates/skills/cli/cline/SKILL.md +42 -0
  91. package/templates/skills/cli/codebuddy/SKILL.md +30 -0
  92. package/templates/skills/cli/codeium/SKILL.md +30 -0
  93. package/templates/skills/cli/codex/SKILL.md +31 -0
  94. package/templates/skills/cli/continue/SKILL.md +44 -0
  95. package/templates/skills/cli/cursor-cli/SKILL.md +38 -0
  96. package/templates/skills/cli/factory/SKILL.md +28 -0
  97. package/templates/skills/cli/gemini/SKILL.md +45 -0
  98. package/templates/skills/cli/kilocode/SKILL.md +28 -0
  99. package/templates/skills/cli/opencode/SKILL.md +28 -0
  100. package/templates/skills/core/agent-automation/SKILL.md +194 -0
  101. package/templates/skills/core/dag/SKILL.md +314 -0
  102. package/templates/skills/core/documentation-rules/SKILL.md +47 -0
  103. package/templates/skills/core/quality-enforcement/SKILL.md +78 -0
  104. package/templates/skills/frameworks/angular/SKILL.md +46 -0
  105. package/templates/skills/frameworks/django/SKILL.md +93 -0
  106. package/templates/skills/frameworks/electron/SKILL.md +157 -0
  107. package/templates/skills/frameworks/flask/SKILL.md +48 -0
  108. package/templates/skills/frameworks/flutter/SKILL.md +65 -0
  109. package/templates/skills/frameworks/jquery/SKILL.md +42 -0
  110. package/templates/skills/frameworks/laravel/SKILL.md +48 -0
  111. package/templates/skills/frameworks/nestjs/SKILL.md +53 -0
  112. package/templates/skills/frameworks/nextjs/SKILL.md +137 -0
  113. package/templates/skills/frameworks/nuxt/SKILL.md +50 -0
  114. package/templates/skills/frameworks/rails/SKILL.md +76 -0
  115. package/templates/skills/frameworks/react/SKILL.md +48 -0
  116. package/templates/skills/frameworks/react-native/SKILL.md +57 -0
  117. package/templates/skills/frameworks/spring/SKILL.md +49 -0
  118. package/templates/skills/frameworks/symfony/SKILL.md +46 -0
  119. package/templates/skills/frameworks/vue/SKILL.md +46 -0
  120. package/templates/skills/frameworks/zend/SKILL.md +45 -0
  121. package/templates/skills/ides/copilot/SKILL.md +47 -0
  122. package/templates/skills/ides/cursor/SKILL.md +53 -0
  123. package/templates/skills/ides/jetbrains-ai/SKILL.md +45 -0
  124. package/templates/skills/ides/replit/SKILL.md +46 -0
  125. package/templates/skills/ides/tabnine/SKILL.md +39 -0
  126. package/templates/skills/ides/vscode/SKILL.md +50 -0
  127. package/templates/skills/ides/windsurf/SKILL.md +46 -0
  128. package/templates/skills/ides/zed/SKILL.md +42 -0
  129. package/templates/skills/languages/ada/SKILL.md +68 -0
  130. package/templates/skills/languages/c/SKILL.md +343 -0
  131. package/templates/skills/languages/cpp/SKILL.md +753 -0
  132. package/templates/skills/languages/csharp/SKILL.md +427 -0
  133. package/templates/skills/languages/dart/SKILL.md +342 -0
  134. package/templates/skills/languages/elixir/SKILL.md +464 -0
  135. package/templates/skills/languages/erlang/SKILL.md +371 -0
  136. package/templates/skills/languages/go/SKILL.md +655 -0
  137. package/templates/skills/languages/haskell/SKILL.md +187 -0
  138. package/templates/skills/languages/java/SKILL.md +617 -0
  139. package/templates/skills/languages/javascript/SKILL.md +641 -0
  140. package/templates/skills/languages/julia/SKILL.md +107 -0
  141. package/templates/skills/languages/kotlin/SKILL.md +521 -0
  142. package/templates/skills/languages/lisp/SKILL.md +110 -0
  143. package/templates/skills/languages/lua/SKILL.md +84 -0
  144. package/templates/skills/languages/objectivec/SKILL.md +100 -0
  145. package/templates/skills/languages/php/SKILL.md +426 -0
  146. package/templates/skills/languages/python/SKILL.md +692 -0
  147. package/templates/skills/languages/r/SKILL.md +360 -0
  148. package/templates/skills/languages/ruby/SKILL.md +431 -0
  149. package/templates/skills/languages/rust/SKILL.md +487 -0
  150. package/templates/skills/languages/sas/SKILL.md +83 -0
  151. package/templates/skills/languages/scala/SKILL.md +358 -0
  152. package/templates/skills/languages/solidity/SKILL.md +590 -0
  153. package/templates/skills/languages/sql/SKILL.md +147 -0
  154. package/templates/skills/languages/swift/SKILL.md +476 -0
  155. package/templates/skills/languages/zig/SKILL.md +275 -0
  156. package/templates/skills/modules/atlassian/SKILL.md +265 -0
  157. package/templates/skills/modules/context7/SKILL.md +64 -0
  158. package/templates/skills/modules/figma/SKILL.md +277 -0
  159. package/templates/skills/modules/github-mcp/SKILL.md +74 -0
  160. package/templates/skills/modules/grafana/SKILL.md +338 -0
  161. package/templates/skills/modules/memory/SKILL.md +73 -0
  162. package/templates/skills/modules/notion/SKILL.md +257 -0
  163. package/templates/skills/modules/playwright/SKILL.md +100 -0
  164. package/templates/skills/modules/rulebook-mcp/SKILL.md +166 -0
  165. package/templates/skills/modules/serena/SKILL.md +347 -0
  166. package/templates/skills/modules/supabase/SKILL.md +233 -0
  167. package/templates/skills/modules/synap/SKILL.md +79 -0
  168. package/templates/skills/modules/vectorizer/SKILL.md +73 -0
  169. package/templates/skills/services/azure-blob/SKILL.md +194 -0
  170. package/templates/skills/services/cassandra/SKILL.md +249 -0
  171. package/templates/skills/services/dynamodb/SKILL.md +318 -0
  172. package/templates/skills/services/elasticsearch/SKILL.md +357 -0
  173. package/templates/skills/services/gcs/SKILL.md +188 -0
  174. package/templates/skills/services/influxdb/SKILL.md +275 -0
  175. package/templates/skills/services/kafka/SKILL.md +351 -0
  176. package/templates/skills/services/mariadb/SKILL.md +193 -0
  177. package/templates/skills/services/memcached/SKILL.md +252 -0
  178. package/templates/skills/services/minio/SKILL.md +211 -0
  179. package/templates/skills/services/mongodb/SKILL.md +278 -0
  180. package/templates/skills/services/mysql/SKILL.md +368 -0
  181. package/templates/skills/services/neo4j/SKILL.md +257 -0
  182. package/templates/skills/services/oracle/SKILL.md +300 -0
  183. package/templates/skills/services/postgresql/SKILL.md +336 -0
  184. package/templates/skills/services/rabbitmq/SKILL.md +296 -0
  185. package/templates/skills/services/redis/SKILL.md +302 -0
  186. package/templates/skills/services/s3/SKILL.md +308 -0
  187. package/templates/skills/services/sqlite/SKILL.md +304 -0
  188. package/templates/skills/services/sqlserver/SKILL.md +304 -0
package/README.md CHANGED
@@ -1,654 +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.0.0 (Latest)
52
-
53
- - 🧩 **Skills System**: New modular skills architecture for AI-assisted development
54
- - Skills are YAML-frontmatter Markdown files with enable/disable functionality
55
- - 10 skill categories: languages, frameworks, modules, services, workflows, ides, core, cli, git, hooks
56
- - Auto-detection of skills based on project configuration
57
- - CLI commands: `rulebook skill list|add|remove|show|search`
58
- - MCP functions: `rulebook_skill_list|show|enable|disable|search|validate`
59
- - 🤖 **AI CLI Configuration Files**: Auto-generated files for AI CLI tools
60
- - `CLAUDE.md` - Claude Code CLI configuration
61
- - `CODEX.md` - OpenAI Codex CLI configuration
62
- - `GEMINI.md` - Google Gemini CLI configuration
63
- - `gemini-extension.json` - Gemini CLI extension manifest
64
- - 🔌 **Claude Code Plugin**: `marketplace.json` + `.claude-plugin/` structure for marketplace distribution
65
- - `marketplace.json` - Marketplace manifest for plugin discovery
66
- - Plugin manifest, MCP configuration, slash commands, and skills
67
- - 🪟 **Windows Test Suite Fix**: Tests no longer hang on Windows (705 tests passing, 11x faster)
68
-
69
- ### v1.1.5
70
-
71
- - 🗄️ **Service Integration Templates**: Added comprehensive service integration templates
72
- - 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
73
- - Automatic service detection from `package.json`, `.env`, and `docker-compose.yml`
74
- - Service-specific integration instructions with connection setup, operations, best practices, and configuration
75
- - Templates generated in `/rulebook/[SERVICE].md` with references in `AGENTS.md`
76
- - Interactive CLI prompt to select which services to include templates for
77
-
78
- ### v1.1.4
79
-
80
- - 🔧 **Cross-platform Git Hooks**: Git hooks now work on both Windows and Linux
81
- - Hooks are now generated as Node.js scripts with shell wrappers
82
- - Shell wrapper detects Node.js in common locations (Windows and Linux)
83
- - Node.js scripts use native `child_process.spawn` for cross-platform command execution
84
- - Pre-commit and pre-push hooks now function correctly on Windows (Git Bash) and Linux
85
- - 🔄 **Git Hooks Architecture**: Refactored hook generation system
86
- - Hooks are now generated as two files: shell wrapper + Node.js script
87
- - Shell templates (`.sh`) are automatically converted to Node.js scripts
88
- - Improved command parsing from shell templates to Node.js
89
- - Better error handling and cross-platform compatibility
90
-
91
- ### v1.1.3
92
-
93
- - 🗑️ **MCP Tool: `rulebook_task_delete`**: Delete tasks permanently
94
- - New tool to permanently delete tasks from the filesystem
95
- - Removes task directory recursively
96
- - Useful for cleaning up test tasks or removing unwanted tasks
97
- - Total of 7 MCP functions now available
98
-
99
- ### v1.1.2
100
-
101
- - 🔧 **ESLint v9 Migration**: Updated to ESLint flat config format
102
- - Migrated from `.eslintrc.json` to `eslint.config.js`
103
- - Updated to ESLint 9.37.0 with TypeScript ESLint 8.47.0
104
- - Added proper Node.js global type definitions
105
- - Linting now shows only errors (warnings suppressed with `--quiet`)
106
-
107
- ### v1.0.3
108
-
109
- - 🔧 **Zod v3 Compatibility**: Using Zod v3.25.76 for full MCP SDK compatibility
110
- - MCP SDK v1.22.0 requires Zod v3 (see [Issue #1429](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1429))
111
- - Will upgrade to Zod v4 when MCP SDK officially supports it
112
- - 🔄 **Dependency Updates**: All dependencies updated to latest versions
113
- - TypeScript tooling (ESLint 8.47.0, Vitest 4.0.13)
114
- - Node.js types updated to support Node.js 24.x
115
- - CLI tools and build utilities updated
116
- - 🐛 **Windows CI Fix**: Fixed PowerShell compatibility in GitHub Actions workflows
117
- - Removed bash-specific syntax from Windows runners
118
- - Cross-platform compatibility improved
119
-
120
- ### v1.0.2
121
-
122
- - 🔌 **MCP Server for Task Management**: New MCP server enables AI models to manage tasks programmatically
123
- - 7 MCP functions: create, list, show, update, validate, archive, delete tasks
124
- - Available via `npx @hivellm/rulebook@latest mcp-server` or `npx rulebook-mcp`
125
- - Better integration with MCP-compatible AI assistants
126
- - **Faster Pre-commit Hooks**: Tests removed from pre-commit for faster backup commits
127
- - Pre-commit now runs only: format check, lint, type-check
128
- - Tests moved to pre-push hook for comprehensive validation
129
- - 🏗️ **Build Verification**: Build check now mandatory before push (runs first)
130
- - 📦 **pnpm Recommendation**: Added pnpm as preferred package manager with `.npmrc` configuration
131
- - 🚀 **Rust Build Optimization**: Comprehensive guide for faster Rust builds
132
- - sccache configuration, incremental compilation, lld linker
133
- - Anti-pattern documentation for `pub use big_crate::*;`
134
- - 📋 **Enhanced Task Management**: Strengthened OpenSpec format compliance and archiving rules
135
- - 📁 **Strict Markdown Organization**: UPPERCASE naming and `/docs` directory requirements
136
-
137
- ### v1.0.0
138
-
139
- - 🎉 **First Stable Release**: Production-ready with comprehensive features
140
- - 🔒 **Apache 2.0 License**: Changed from MIT to Apache License 2.0 for better compatibility
141
- - 🛡️ **Git Hooks Enforcement**: Pre-commit and pre-push hooks now block commits with lint/test errors
142
- - 📋 **Task File Structure Rules**: Enhanced directives in AGENTS.md about correct task structure
143
- - 🎯 **Built-in Task Management**: OpenSpec deprecated and integrated into Rulebook's native task system
144
- - 📋 **RULEBOOK.md Template**: Core template with task management directives and Context7 MCP requirements
145
- - 🚫 **Automatic .gitignore**: `npx @hivellm/rulebook@latest init` now creates/updates `.gitignore` automatically for 28 languages
146
- - 🔄 **Migration Support**: Existing OpenSpec tasks automatically migrated to `/rulebook/tasks/` format
147
-
148
- > **Breaking Change**: OpenSpec module removed. Use `npx @hivellm/rulebook@latest task` commands instead. See [Migration Guide](docs/guides/OPENSPEC_MIGRATION.md).
149
-
150
- ## Key Features
151
-
152
- - 🔍 **Auto-Detection**: Detects languages, frameworks (NestJS, React, Spring, etc.), MCP modules, and services (databases, caches, message queues, etc.)
153
- - 📁 **Modular Architecture**: Templates stored in `/rulebook/` directory for better organization
154
- - Smaller AGENTS.md files (prevents 100k+ character limits)
155
- - QUALITY_ENFORCEMENT and Git rules moved to `/rulebook/` for cleaner structure
156
- - On-demand loading for better AI performance
157
- - Easier maintenance and updates
158
- - 📋 **Simplified AGENTS.md**: Clean, focused structure with only core rules and references
159
- - Proper hierarchy with `##` and `###` subsections
160
- - All modules grouped logically
161
- - Better readability and navigation
162
- - 🔗 **Git Hook Automation**: Optional pre-commit/pre-push hooks with language-aware quality checks
163
- - 🚫 **Automatic .gitignore**: Creates/updates `.gitignore` automatically for 28 languages on `npx @hivellm/rulebook@latest init`
164
- - 🎯 **Minimal Mode**: Quick setup with just README, LICENSE, tests/, and basic CI
165
- - 📝 **106+ Templates**: Languages, frameworks, IDEs, workflows, and services pre-configured
166
- - 🤖 **AI-Optimized**: Works with 23 AI assistants (Cursor, Claude, Gemini, etc.)
167
- - 📦 **Publication Ready**: CI/CD pipelines for npm, crates.io, PyPI, Maven Central, and more
168
- - 🔄 **Automatic Migration**: Existing projects automatically migrated to modular structure and OpenSpec tasks
169
-
170
- ## What It Does
171
-
172
- **For New Projects:**
173
- 1. Detects your language(s), frameworks, MCP modules, and services
174
- 2. Asks setup questions (or use `--minimal` for defaults)
175
- 3. Generates AGENTS.md with AI assistant rules (modular structure)
176
- 4. Creates `/rulebook/` directory with language/framework/module/service templates
177
- 5. Creates/updates `.gitignore` automatically for detected languages
178
- 6. Optionally installs Git hooks (pre-commit/pre-push)
179
- 7. Creates GitHub Actions workflows
180
- 8. Scaffolds README, LICENSE, /docs, and /tests
181
-
182
- **For Existing Projects:**
183
- ```bash
184
- npx @hivehub/rulebook update
185
- ```
186
- - Automatically migrates embedded templates to modular `/rulebook/` structure
187
- - Automatically migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
188
- - Merges latest templates while preserving your customizations
189
- - Updates AGENTS.md with references to modular files
190
- - Updates `.gitignore` with missing patterns for detected languages
191
-
192
- ## Commands
193
-
194
- ### Core Commands
195
-
196
- ```bash
197
- # Project Initialization & Updates
198
- npx @hivehub/rulebook@latest init # Initialize new project (interactive)
199
- npx @hivehub/rulebook@latest init --minimal # Minimal setup (essentials only)
200
- npx @hivehub/rulebook@latest init --light # Light mode (no quality enforcement)
201
- npx @hivehub/rulebook@latest init --yes # Skip prompts, use defaults
202
- npx @hivehub/rulebook@latest update # Update AGENTS.md to latest version
203
- npx @hivehub/rulebook@latest update --yes # Update without confirmation
204
- npx @hivehub/rulebook@latest update --light # Update in light mode
205
-
206
- # Workflow & CI/CD
207
- npx @hivehub/rulebook@latest workflows # Generate GitHub Actions workflows
208
-
209
- # Validation & Health
210
- npx @hivehub/rulebook@latest validate # Check project standards
211
- npx @hivehub/rulebook@latest health # Project health score (0-100)
212
- npx @hivehub/rulebook@latest fix # Auto-fix common issues
213
-
214
- # Documentation
215
- npx @hivehub/rulebook@latest generate-docs # Create /docs structure
216
- npx @hivehub/rulebook@latest generate-docs --yes # Skip prompts, use defaults
217
-
218
- # Dependencies & Coverage
219
- npx @hivehub/rulebook@latest check-deps # Check outdated/vulnerable dependencies
220
- npx @hivehub/rulebook@latest check-coverage # Check test coverage (default: 95%)
221
- npx @hivehub/rulebook@latest check-coverage -t 80 # Custom threshold
222
-
223
- # Versioning
224
- npx @hivehub/rulebook@latest version <type> # Bump version (major|minor|patch)
225
- npx @hivehub/rulebook@latest changelog # Generate changelog from git commits
226
- npx @hivehub/rulebook@latest changelog -v 1.0.0 # Specify version
227
- ```
228
-
229
- > **Note**: If installed globally (`npm install -g @hivehub/rulebook`), you can use `rulebook` directly instead of `npx @hivehub/rulebook@latest`.
230
-
231
- ### Advanced Commands (Beta)
232
-
233
- ```bash
234
- # Real-time Monitoring
235
- npx @hivehub/rulebook@latest watcher # Full-screen task monitoring UI
236
- # - Live task progress tracking
237
- # - Activity log with timestamps
238
- # - System status monitoring
239
- # - Auto-refresh every 2 seconds
240
-
241
- # Autonomous Agent
242
- npx @hivehub/rulebook@latest agent # Start AI CLI workflow automation
243
- npx @hivehub/rulebook@latest agent --dry-run # Simulate without changes
244
- npx @hivehub/rulebook@latest agent --tool cursor-agent # Specify CLI tool
245
- npx @hivehub/rulebook@latest agent --iterations 10 # Max iterations
246
- npx @hivehub/rulebook@latest agent --watch # Enable watcher mode
247
-
248
- # Task Management
249
- npx @hivehub/rulebook@latest task create <task-id> # Create new task
250
- npx @hivehub/rulebook@latest task list # List all tasks
251
- npx @hivehub/rulebook@latest task list --archived # List including archived tasks
252
- npx @hivehub/rulebook@latest task show <task-id> # Show task details
253
- npx @hivehub/rulebook@latest task validate <task-id> # Validate task format
254
- npx @hivehub/rulebook@latest task archive <task-id> # Archive completed task
255
- npx @hivehub/rulebook@latest task archive --skip-validation <task-id> # Archive without validation
256
- npx @hivehub/rulebook@latest tasks [options] # Legacy command (DEPRECATED - use 'task' commands)
257
-
258
- # Skills Management (v2.0)
259
- npx @hivehub/rulebook@latest skill list # List all available skills
260
- npx @hivehub/rulebook@latest skill list --category languages # Filter by category
261
- npx @hivehub/rulebook@latest skill list --enabled # Show only enabled skills
262
- npx @hivehub/rulebook@latest skill add <skill-id> # Enable a skill
263
- npx @hivehub/rulebook@latest skill remove <skill-id> # Disable a skill
264
- npx @hivehub/rulebook@latest skill show <skill-id> # Show skill details
265
- npx @hivehub/rulebook@latest skill search <query> # Search for skills
266
-
267
- # Configuration
268
- npx @hivehub/rulebook@latest config --show # Show current config
269
- npx @hivehub/rulebook@latest config --set key=value # Set config value
270
- npx @hivehub/rulebook@latest config --feature watcher --enable # Enable feature
271
- npx @hivehub/rulebook@latest config --feature agent --disable # Disable feature
272
- ```
273
-
274
- ## Setup Modes
275
-
276
- ### Full Mode (Default)
277
- Complete setup with all features: Task management, Watcher, MCP modules, comprehensive workflows.
278
-
279
- ### Minimal Mode
280
- ```bash
281
- npx @hivehub/rulebook@latest init --minimal
282
- ```
283
- Essentials only: README, LICENSE, tests/, basic CI. Perfect for small teams or initial adoption.
284
-
285
- ### Light Mode
286
- ```bash
287
- npx @hivehub/rulebook@latest init --light
288
- ```
289
- Bare minimum rules: no quality enforcement, no testing requirements, no linting. Use for quick prototypes or non-production projects.
290
-
291
- ## Supported Languages & Frameworks
292
-
293
- **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
294
-
295
- **17 Frameworks** (auto-detected):
296
- - Backend: NestJS, Spring Boot, Laravel, Django, Flask, Ruby on Rails, Symfony, Zend
297
- - Frontend: Angular, React, Vue, Nuxt, Next.js, jQuery
298
- - Mobile: React Native, Flutter
299
- - Desktop: Electron
300
-
301
- ## MCP Modules (12)
302
-
303
- **Core**: Vectorizer Synap • Context7 • GitHub MCP • Playwright
304
-
305
- **Services**: Supabase Notion Atlassian Serena • Figma • Grafana
306
-
307
- ### MCP Server for Task Management
308
-
309
- 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.
310
-
311
- **Benefits:**
312
- - Direct MCP integration - no shell command execution needed
313
- - Structured error handling with proper error codes and messages
314
- - ✅ Consistent interface with other MCP operations
315
- - Better automation capabilities for AI agents
316
- - Improved reliability compared to terminal command execution
317
- - ✅ Automatic project detection - finds `.rulebook` by walking up directories (like git)
318
- - Zero configuration - works out of the box after `rulebook mcp init`
319
-
320
- **Quick Setup:**
321
-
322
- ```bash
323
- # Initialize MCP configuration in your project (one-time setup)
324
- npx @hivehub/rulebook@latest mcp init
325
- ```
326
-
327
- This command:
328
- - Adds `mcp` block to your `.rulebook` file
329
- - Creates/updates `.cursor/mcp.json` automatically
330
- - Server uses stdio transport (MCP standard)
331
-
332
- **Available MCP Functions:**
333
-
334
- - `rulebook_task_create` - Create a new task with OpenSpec-compatible format
335
- - Input: `taskId` (string), optional `proposal` object
336
- - Output: Task creation confirmation with path
337
- - `rulebook_task_list` - List all tasks with optional filters
338
- - Input: `includeArchived` (boolean), `status` (enum)
339
- - Output: Array of tasks with metadata
340
- - `rulebook_task_show` - Show detailed task information
341
- - Input: `taskId` (string)
342
- - Output: Complete task details including proposal, tasks, specs
343
- - `rulebook_task_update` - Update task status or progress
344
- - Input: `taskId` (string), optional `status`, `progress`
345
- - Output: Update confirmation
346
- - `rulebook_task_validate` - Validate task format against OpenSpec requirements
347
- - Input: `taskId` (string)
348
- - Output: Validation results with errors and warnings
349
- - `rulebook_task_archive` - Archive completed task and apply spec deltas
350
- - Input: `taskId` (string), optional `skipValidation`
351
- - Output: Archive confirmation with archive path
352
- - `rulebook_task_delete` - Delete a task permanently
353
- - Input: `taskId` (string)
354
- - Output: Deletion confirmation
355
-
356
- **Total: 7 MCP functions** for complete task lifecycle management.
357
-
358
- **Skills MCP Functions (v2.0):**
359
-
360
- - `rulebook_skill_list` - List available skills with optional category filter
361
- - `rulebook_skill_show` - Show detailed skill information
362
- - `rulebook_skill_enable` - Enable a skill for the project
363
- - `rulebook_skill_disable` - Disable a skill
364
- - `rulebook_skill_search` - Search skills by name, description, or tags
365
- - `rulebook_skill_validate` - Validate skills configuration
366
-
367
- **Total: 13 MCP functions** (7 task + 6 skills).
368
-
369
- ## Skills System (v2.0)
370
-
371
- Rulebook v2.0 introduces a modular skills system for AI-assisted development. Skills are pluggable capabilities that can be enabled or disabled per project.
372
-
373
- ### What are Skills?
374
-
375
- Skills are YAML-frontmatter Markdown files that define specific capabilities or rules for AI assistants. Each skill has:
376
-
377
- - **Metadata**: Name, description, version, category, tags, dependencies
378
- - **Content**: Markdown content with rules, patterns, and examples
379
-
380
- ### Skill Categories
381
-
382
- Skills are organized into 10 categories:
383
-
384
- | Category | Description | Examples |
385
- |----------|-------------|----------|
386
- | `languages` | Language-specific rules | TypeScript, Rust, Python |
387
- | `frameworks` | Framework conventions | NestJS, React, Django |
388
- | `modules` | MCP module integration | Vectorizer, Context7 |
389
- | `services` | Service integration | PostgreSQL, Redis |
390
- | `workflows` | CI/CD patterns | GitHub Actions |
391
- | `ides` | IDE configuration | Cursor, VS Code |
392
- | `core` | Core rulebook standards | Quality gates |
393
- | `cli` | AI CLI configuration | Claude Code, Codex |
394
- | `git` | Git workflow rules | Branching, commits |
395
- | `hooks` | Git hooks configuration | Pre-commit, pre-push |
396
-
397
- ### Using Skills
398
-
399
- ```bash
400
- # List all available skills
401
- rulebook skill list
402
-
403
- # Filter by category
404
- rulebook skill list --category languages
405
-
406
- # Enable a skill
407
- rulebook skill add languages/typescript
408
-
409
- # Disable a skill
410
- rulebook skill remove languages/typescript
411
-
412
- # Show skill details
413
- rulebook skill show languages/typescript
414
-
415
- # Search for skills
416
- rulebook skill search "testing"
417
- ```
418
-
419
- ### Auto-Detection
420
-
421
- During `rulebook init` and `rulebook update`, skills are automatically detected and enabled based on your project's:
422
-
423
- - Detected languages (e.g., TypeScript `languages/typescript`)
424
- - Detected frameworks (e.g., NestJS → `frameworks/nestjs`)
425
- - Detected modules (e.g., Vectorizer → `modules/vectorizer`)
426
- - Detected services (e.g., PostgreSQL `services/postgresql`)
427
-
428
- ### Creating Custom Skills
429
-
430
- Create a `SKILL.md` file in `templates/skills/<category>/<skill-name>/`:
431
-
432
- ```markdown
433
- ---
434
- name: My Custom Skill
435
- description: Description of what this skill does
436
- version: 1.0.0
437
- category: core
438
- tags: ["custom", "example"]
439
- ---
440
-
441
- # My Custom Skill
442
-
443
- Add your rules and patterns here.
444
- ```
445
-
446
- ## Service Integration Templates (20)
447
-
448
- Rulebook provides comprehensive integration templates for popular backend services, including databases, caches, message queues, and object storage.
449
-
450
- **Relational Databases**: PostgreSQL MySQL MariaDB SQL Server • Oracle • SQLite
451
-
452
- **NoSQL Databases**: MongoDB Cassandra DynamoDB
453
-
454
- **Caches**: Redis Memcached
455
-
456
- **Search & Analytics**: Elasticsearch
457
-
458
- **Graph Databases**: Neo4j
459
-
460
- **Time-Series Databases**: InfluxDB
461
-
462
- **Message Queues**: RabbitMQ Kafka
463
-
464
- **Object Storage**: AWS S3 Azure Blob Storage • Google Cloud Storage • MinIO
465
-
466
- ### Automatic Service Detection
467
-
468
- The CLI automatically detects services in your project by analyzing:
469
- - **`package.json`**: Database drivers and client libraries (e.g., `pg`, `mongoose`, `redis`, `ioredis`)
470
- - **`.env` files**: Connection strings and environment variables (e.g., `POSTGRES_*`, `REDIS_*`, `MONGODB_*`)
471
- - **`docker-compose.yml`**: Service definitions in Docker Compose files
472
-
473
- ### Service Templates Include
474
-
475
- Each service template provides:
476
- - Connection setup and configuration
477
- - Basic CRUD operations (where applicable)
478
- - Advanced patterns and best practices
479
- - Docker Compose examples
480
- - Environment variable configuration
481
- - Development and testing integration
482
- - Common pitfalls and solutions
483
-
484
- Templates are generated in `/rulebook/[SERVICE].md` and referenced in `AGENTS.md` for easy access during development.
485
-
486
- **Server Details:**
487
- - **Transport**: stdio only - stdout contains ONLY JSON-RPC 2.0 messages
488
- - **Configuration**: Loaded from `.rulebook` file automatically
489
- - **Project Detection**: Finds `.rulebook` by walking up directories (like git)
490
- - **Protocol**: MCP over stdio (MCP-compliant, no stdout pollution)
491
-
492
- **Configuration:**
493
-
494
- The MCP server configuration lives in your `.rulebook` file:
495
-
496
- ```json
497
- {
498
- "mcp": {
499
- "enabled": true,
500
- "tasksDir": "rulebook/tasks",
501
- "archiveDir": "rulebook/archive"
502
- }
503
- }
504
- ```
505
-
506
- **Note:** The server uses stdio transport only (no configuration needed).
507
-
508
- **Cursor Configuration (`.cursor/mcp.json`):**
509
-
510
- After running `rulebook mcp init`, your `.cursor/mcp.json` will be automatically configured:
511
-
512
- ```json
513
- {
514
- "mcpServers": {
515
- "rulebook": {
516
- "command": "npx",
517
- "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"]
518
- }
519
- }
520
- }
521
- ```
522
-
523
- That's it! No need for `--project-root`, `--port`, or environment variables. The server automatically:
524
- - Finds your `.rulebook` file by walking up directories
525
- - Uses the `mcp` configuration from `.rulebook`
526
- - Works from any subdirectory in your project
527
-
528
- **Manual Override (if needed):**
529
-
530
- If you need to override the `.rulebook` location:
531
-
532
- ```json
533
- {
534
- "mcpServers": {
535
- "rulebook": {
536
- "command": "npx",
537
- "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"],
538
- "env": {
539
- "RULEBOOK_CONFIG": "/path/to/.rulebook"
540
- }
541
- }
542
- }
543
- }
544
- ```
545
-
546
- **Note:** After running `rulebook mcp init` or updating `.cursor/mcp.json`, restart Cursor for the changes to take effect.
547
-
548
- **Troubleshooting:**
549
-
550
- ### Server Not Starting
551
-
552
- If the MCP server fails to start:
553
-
554
- 1. **Verify `.rulebook` exists**: Run `rulebook mcp init` in your project root
555
- 2. **Check Node.js version**: Requires Node.js 20+ (`node --version`)
556
- 3. **Verify MCP configuration**: Check that `.cursor/mcp.json` exists and is valid JSON
557
- 4. **Debug mode**: Set `RULEBOOK_MCP_DEBUG=1` to see debug logs in stderr:
558
- ```bash
559
- RULEBOOK_MCP_DEBUG=1 npx @hivehub/rulebook@latest mcp-server
560
- ```
561
-
562
- ### Empty Schemas or Missing Parameters
563
-
564
- If tools don't show descriptions or parameters:
565
-
566
- 1. **Clear npm cache**:
567
- ```bash
568
- # Clear npm cache
569
- npm cache clean --force
570
-
571
- # Or clear npx cache specifically
572
- rm -rf ~/.npm/_npx
573
- ```
574
-
575
- 2. **Rebuild the project**:
576
- ```bash
577
- npm run build
578
- ```
579
-
580
- 3. Restart your MCP client and try again.
581
-
582
- ### "Unexpected token" or "Invalid JSON" Errors
583
-
584
- These errors occur when the server outputs non-JSON to stdout. This is fixed in v1.0.9+:
585
- - Ensure you're using `@hivehub/rulebook@latest` (v1.0.9 or newer)
586
- - stdout now contains ONLY JSON-RPC 2.0 messages
587
- - All logs go to stderr (use `RULEBOOK_MCP_DEBUG=1` to see them)
588
-
589
- ### ".rulebook not found" Error
590
-
591
- If you see this error:
592
- 1. Run `rulebook mcp init` in your project root
593
- 2. Or manually create `.rulebook` file with `mcp` block
594
- 3. Or set `RULEBOOK_CONFIG` environment variable to point to your `.rulebook` file
595
-
596
- ### "Received a response for an unknown message ID" Warning
597
-
598
- If you see this warning in Cursor logs:
599
- - **This is a cosmetic warning** - it does NOT affect functionality
600
- - All tools work correctly despite this warning
601
- - The server is responding correctly with valid JSON-RPC 2.0 messages
602
- - This is a known issue with Cursor's MCP client ID tracking
603
- - The warning can be safely ignored - all MCP tools function normally
604
-
605
- ### "Received a response for an unknown message ID" Warning
606
-
607
- If you see this warning in the logs:
608
- - This is usually harmless - the server is working correctly
609
- - The warning appears during the initial handshake but doesn't affect functionality
610
- - If you see "Successfully connected to stdio server" after the warning, everything is fine
611
- - This is a known behavior with some MCP clients and can be safely ignored
612
-
613
- **Automated Setup:**
614
-
615
- ```bash
616
- # Initialize MCP in your project (recommended)
617
- npx @hivehub/rulebook@latest mcp init
618
-
619
- # Or use the setup script (for CI/CD)
620
- npm run setup:mcp
621
- ```
622
-
623
- ## AI Tools Supported (23)
624
-
625
- **IDEs**: Cursor, Windsurf, VS Code, GitHub Copilot, Tabnine, Replit, JetBrains AI, Zed
626
-
627
- **CLI Agents**: Aider, Continue, Claude, Claude Code, Gemini, Cline, Amazon Q, Auggie, CodeBuddy, Factory, OpenCode, Kilo, Codex, Codeium, Cursor CLI
628
-
629
- ## Documentation
630
-
631
- Full documentation available in `/docs`:
632
- - [Getting Started](docs/guides/GETTING_STARTED.md)
633
- - [Best Practices](docs/guides/BEST_PRACTICES.md)
634
- - [CLI Agents](docs/CLI_AGENTS.md)
635
- - [Roadmap](docs/ROADMAP.md)
636
- - [Framework Templates](templates/frameworks/)
637
-
638
- ## Contributing
639
-
640
- Contributions welcome! Node.js 18+ required.
641
-
642
- ```bash
643
- npm install
644
- npm test
645
- npm run build
646
- ```
647
-
648
- ## License
649
-
650
- Apache License 2.0 © HiveLLM Team
651
-
652
- ---
653
-
654
- **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)