@hivehub/rulebook 5.2.1 → 5.3.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 (157) hide show
  1. package/.claude/commands/analysis.md +35 -0
  2. package/.claude/commands/rulebook-task-apply.md +7 -25
  3. package/.claude/commands/rulebook-task-archive.md +10 -19
  4. package/.claude/commands/rulebook-task-create.md +1 -1
  5. package/README.md +354 -965
  6. package/dist/cli/commands/analysis.d.ts +8 -0
  7. package/dist/cli/commands/analysis.d.ts.map +1 -0
  8. package/dist/cli/commands/analysis.js +78 -0
  9. package/dist/cli/commands/analysis.js.map +1 -0
  10. package/dist/cli/commands/context-intelligence.d.ts +33 -0
  11. package/dist/cli/commands/context-intelligence.d.ts.map +1 -0
  12. package/dist/cli/commands/context-intelligence.js +181 -0
  13. package/dist/cli/commands/context-intelligence.js.map +1 -0
  14. package/dist/cli/commands/index.d.ts +19 -0
  15. package/dist/cli/commands/index.d.ts.map +1 -0
  16. package/dist/cli/commands/index.js +19 -0
  17. package/dist/cli/commands/index.js.map +1 -0
  18. package/dist/cli/commands/init.d.ts +15 -0
  19. package/dist/cli/commands/init.d.ts.map +1 -0
  20. package/dist/cli/commands/init.js +608 -0
  21. package/dist/cli/commands/init.js.map +1 -0
  22. package/dist/cli/commands/mcp.d.ts +10 -0
  23. package/dist/cli/commands/mcp.d.ts.map +1 -0
  24. package/dist/cli/commands/mcp.js +128 -0
  25. package/dist/cli/commands/mcp.js.map +1 -0
  26. package/dist/cli/commands/memory.d.ts +24 -0
  27. package/dist/cli/commands/memory.d.ts.map +1 -0
  28. package/dist/cli/commands/memory.js +265 -0
  29. package/dist/cli/commands/memory.js.map +1 -0
  30. package/dist/cli/commands/misc.d.ts +33 -0
  31. package/dist/cli/commands/misc.d.ts.map +1 -0
  32. package/dist/cli/commands/misc.js +576 -0
  33. package/dist/cli/commands/misc.js.map +1 -0
  34. package/dist/cli/commands/plans.d.ts +15 -0
  35. package/dist/cli/commands/plans.d.ts.map +1 -0
  36. package/dist/cli/commands/plans.js +266 -0
  37. package/dist/cli/commands/plans.js.map +1 -0
  38. package/dist/cli/commands/ralph.d.ts +45 -0
  39. package/dist/cli/commands/ralph.d.ts.map +1 -0
  40. package/dist/cli/commands/ralph.js +694 -0
  41. package/dist/cli/commands/ralph.js.map +1 -0
  42. package/dist/cli/commands/skills.d.ts +9 -0
  43. package/dist/cli/commands/skills.d.ts.map +1 -0
  44. package/dist/cli/commands/skills.js +249 -0
  45. package/dist/cli/commands/skills.js.map +1 -0
  46. package/dist/cli/commands/task.d.ts +16 -0
  47. package/dist/cli/commands/task.d.ts.map +1 -0
  48. package/dist/cli/commands/task.js +256 -0
  49. package/dist/cli/commands/task.js.map +1 -0
  50. package/dist/cli/commands/update.d.ts +14 -0
  51. package/dist/cli/commands/update.d.ts.map +1 -0
  52. package/dist/cli/commands/update.js +636 -0
  53. package/dist/cli/commands/update.js.map +1 -0
  54. package/dist/cli/commands/workspace.d.ts +6 -0
  55. package/dist/cli/commands/workspace.d.ts.map +1 -0
  56. package/dist/cli/commands/workspace.js +141 -0
  57. package/dist/cli/commands/workspace.js.map +1 -0
  58. package/dist/core/agent-template-engine.js +28 -28
  59. package/dist/core/analysis-manager.d.ts +56 -0
  60. package/dist/core/analysis-manager.d.ts.map +1 -0
  61. package/dist/core/analysis-manager.js +218 -0
  62. package/dist/core/analysis-manager.js.map +1 -0
  63. package/dist/core/claude-md-generator.d.ts +52 -0
  64. package/dist/core/claude-md-generator.d.ts.map +1 -0
  65. package/dist/core/claude-md-generator.js +104 -0
  66. package/dist/core/claude-md-generator.js.map +1 -0
  67. package/dist/core/claude-settings-manager.d.ts +37 -0
  68. package/dist/core/claude-settings-manager.d.ts.map +1 -0
  69. package/dist/core/claude-settings-manager.js +168 -0
  70. package/dist/core/claude-settings-manager.js.map +1 -0
  71. package/dist/core/compact-context-manager.d.ts +34 -0
  72. package/dist/core/compact-context-manager.d.ts.map +1 -0
  73. package/dist/core/compact-context-manager.js +60 -0
  74. package/dist/core/compact-context-manager.js.map +1 -0
  75. package/dist/core/doctor.d.ts +19 -0
  76. package/dist/core/doctor.d.ts.map +1 -0
  77. package/dist/core/doctor.js +163 -0
  78. package/dist/core/doctor.js.map +1 -0
  79. package/dist/core/generator.js +28 -28
  80. package/dist/core/mcp-reference-generator.d.ts +13 -0
  81. package/dist/core/mcp-reference-generator.d.ts.map +1 -0
  82. package/dist/core/mcp-reference-generator.js +66 -0
  83. package/dist/core/mcp-reference-generator.js.map +1 -0
  84. package/dist/core/merger.d.ts +35 -0
  85. package/dist/core/merger.d.ts.map +1 -1
  86. package/dist/core/merger.js +120 -0
  87. package/dist/core/merger.js.map +1 -1
  88. package/dist/core/prd-generator.d.ts.map +1 -1
  89. package/dist/core/prd-generator.js +7 -1
  90. package/dist/core/prd-generator.js.map +1 -1
  91. package/dist/core/ralph-manager.d.ts.map +1 -1
  92. package/dist/core/ralph-manager.js +17 -0
  93. package/dist/core/ralph-manager.js.map +1 -1
  94. package/dist/core/rules-generator.d.ts +73 -0
  95. package/dist/core/rules-generator.d.ts.map +1 -0
  96. package/dist/core/rules-generator.js +201 -0
  97. package/dist/core/rules-generator.js.map +1 -0
  98. package/dist/core/state-writer.d.ts +35 -0
  99. package/dist/core/state-writer.d.ts.map +1 -0
  100. package/dist/core/state-writer.js +81 -0
  101. package/dist/core/state-writer.js.map +1 -0
  102. package/dist/core/task-manager.d.ts +35 -0
  103. package/dist/core/task-manager.d.ts.map +1 -1
  104. package/dist/core/task-manager.js +135 -38
  105. package/dist/core/task-manager.js.map +1 -1
  106. package/dist/core/telemetry.d.ts +29 -0
  107. package/dist/core/telemetry.d.ts.map +1 -0
  108. package/dist/core/telemetry.js +57 -0
  109. package/dist/core/telemetry.js.map +1 -0
  110. package/dist/core/workflow-generator.d.ts.map +1 -1
  111. package/dist/core/workflow-generator.js +2 -177
  112. package/dist/core/workflow-generator.js.map +1 -1
  113. package/dist/index.js +28 -1
  114. package/dist/index.js.map +1 -1
  115. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  116. package/dist/mcp/rulebook-server.js +190 -7
  117. package/dist/mcp/rulebook-server.js.map +1 -1
  118. package/dist/memory/memory-store.js +91 -91
  119. package/dist/types.d.ts +11 -0
  120. package/dist/types.d.ts.map +1 -1
  121. package/dist/utils/gitignore.d.ts +10 -0
  122. package/dist/utils/gitignore.d.ts.map +1 -0
  123. package/dist/utils/gitignore.js +38 -0
  124. package/dist/utils/gitignore.js.map +1 -0
  125. package/package.json +1 -1
  126. package/templates/compact-context/_default.md +23 -0
  127. package/templates/compact-context/cpp.md +26 -0
  128. package/templates/compact-context/go.md +26 -0
  129. package/templates/compact-context/python.md +26 -0
  130. package/templates/compact-context/rust.md +28 -0
  131. package/templates/compact-context/typescript.md +29 -0
  132. package/templates/core/CLAUDE_MD_v2.md +71 -0
  133. package/templates/hooks/check-context-and-handoff.ps1 +50 -0
  134. package/templates/hooks/check-context-and-handoff.sh +69 -0
  135. package/templates/hooks/enforce-mcp-for-tasks.sh +31 -0
  136. package/templates/hooks/enforce-no-deferred.sh +21 -0
  137. package/templates/hooks/enforce-no-shortcuts.sh +31 -0
  138. package/templates/hooks/enforce-team-for-background-agents.ps1 +63 -0
  139. package/templates/hooks/enforce-team-for-background-agents.sh +55 -0
  140. package/templates/hooks/on-compact-reinject.sh +34 -0
  141. package/templates/hooks/resume-from-handoff.ps1 +33 -0
  142. package/templates/hooks/resume-from-handoff.sh +55 -0
  143. package/templates/rules/consult-analysis-before-implementing.md +23 -0
  144. package/templates/rules/cpp.md +46 -0
  145. package/templates/rules/csharp.md +44 -0
  146. package/templates/rules/diagnostic-first.md +39 -0
  147. package/templates/rules/fail-twice-escalate.md +46 -0
  148. package/templates/rules/go.md +40 -0
  149. package/templates/rules/java.md +43 -0
  150. package/templates/rules/javascript.md +39 -0
  151. package/templates/rules/multi-agent-teams.md +75 -0
  152. package/templates/rules/python.md +43 -0
  153. package/templates/rules/respect-handoff-trigger.md +41 -0
  154. package/templates/rules/rust.md +40 -0
  155. package/templates/rules/typescript.md +40 -0
  156. package/templates/skills/dev/analysis/SKILL.md +19 -0
  157. package/templates/skills/dev/handoff/SKILL.md +27 -0
package/README.md CHANGED
@@ -1,965 +1,354 @@
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
- > Tool-agnostic AI development framework. Standardize projects across Claude Code, Cursor, Gemini, Codex, Windsurf, Copilot 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
- - 🤖 **Ralph Autonomous Loop**: Multi-iteration AI agent task solving with quality gates (type-check, lint, tests, coverage), iteration tracking, learnings extraction, and graceful pause/resume
26
- - 🧠 **Persistent Memory**: Context that survives across AI sessions with hybrid BM25+HNSW search, native SQLite with WASM fallback
27
- - 🎯 **Normalized Deliverables**: Ensures consistent code quality across all AI-generated outputs
28
- - 🛡️ **Error Reduction**: Catches issues early through automated quality gates and pre-commit/pre-push hooks
29
- - ⚙️ **Process Automation**: Automates repetitive tasks like formatting, testing, and deployment
30
- - 🔌 **MCP Integration**: 40 MCP tools for task management, skills, memory, decisions, knowledge, and learnings
31
- - 📊 **Task Management**: Built-in task management system (OpenSpec-compatible format) for structured development
32
-
33
- By giving LLMs a clear "rulebook" to follow, you ensure that every piece of generated code meets your project's standards—**automatically**.
34
-
35
- ## Quick Start
36
-
37
- ```bash
38
- # New project — auto-detects languages, tools, and complexity
39
- npx @hivehub/rulebook@latest init
40
-
41
- # Target specific AI tools
42
- npx @hivehub/rulebook@latest init --tools claude-code,cursor,gemini
43
-
44
- # Assess project complexity before configuring
45
- npx @hivehub/rulebook@latest assess
46
-
47
- # Minimal setup (essentials only)
48
- npx @hivehub/rulebook@latest init --minimal
49
-
50
- # Lean mode AGENTS.md as <3KB index (fast AI loading)
51
- npx @hivehub/rulebook@latest init --lean
52
-
53
- # Update existing project (re-projects rules to all detected tools)
54
- npx @hivehub/rulebook@latest update
55
-
56
- # Manage canonical rules
57
- npx @hivehub/rulebook@latest rules list # List rules by tier
58
- npx @hivehub/rulebook@latest rules add no-shortcuts # Install from library
59
- npx @hivehub/rulebook@latest rules project # Project to all tools
60
- ```
61
-
62
- ## What's New
63
-
64
- See the full [CHANGELOG](CHANGELOG.md) for details.
65
-
66
- ### v5.2.0Phase-Based Task Organization
67
-
68
- Tasks are now organized by **phases with enforced naming**: `phase<N>_<description>` (e.g., `phase0_setup`, `phase3a_fix-auth`). Inspired by real-world project management where priority and execution order must be visible at a glance in the file explorer.
69
-
70
- **Phase Naming Convention**
71
- - Task IDs MUST start with `phase<N>[subletter]_` prefix — rejected at creation otherwise
72
- - Phases define execution order and priority: `phase0` → `phase1` → `phase2a` → `phase2b` → ...
73
- - Tasks must fit a single implementation cycle large tasks are split into multiple phase-prefixed tasks
74
-
75
- **Auto-Generated Tasks Index**
76
- - `tasks/README.md` auto-generated on every task create, archive, delete, and status update
77
- - Tasks grouped by phase with status icons, progress counters (`3/5`), and descriptions
78
- - Optimized for LLM context loading one file gives full project status
79
-
80
- **Archive Relocated**
81
- - Moved from `.rulebook/tasks/archive/` to `.rulebook/archive/` for cleaner directory structure
82
- - Legacy archives auto-migrated during `rulebook update`
83
-
84
- **Knowledge Base Enforcement**
85
- - New Tier 1 rule: `knowledge-base-usage` — installed on all projects via `rulebook update`
86
- - `/rulebook-task-apply`: must check `rulebook knowledge list` before starting, capture learnings after completing
87
- - `/rulebook-task-archive`: must record at least 1 learning before archiving
88
-
89
- ### v5.1.3 — MCP Server EMFILE Fix
90
-
91
- Function-based chokidar ignore, reduced watch depth, EMFILE auto-recovery to polling mode, configurable indexer settings.
92
-
93
- ### v5.1.2 MCP Per-Session PID Lock
94
-
95
- Session-scoped PID files allow multiple concurrent MCP server instances. Auto-cleanup of stale processes.
96
-
97
- ### v5.1.0 — Incremental Implementation & Knowledge Base Integration
98
-
99
- Step-by-step implementation and knowledge base usage mandatory for all agents. New `incremental-implementation` tier 1 rule with 3-attempt restart policy.
100
-
101
- ### v5.0.0 Multi-Tool AI Framework
102
-
103
- Tool-agnostic AI development framework canonical rules in `.rulebook/rules/` projected to 6 tool formats simultaneously (Claude Code, Cursor, Gemini, Copilot, Windsurf, Continue.dev). 15 adaptive agent templates, complexity detection, and critical performance fixes (better-sqlite3, chokidar, HNSW optimization).
104
-
105
- ### v4.4.0 — Context Intelligence Layer
106
-
107
- - 🧠 **Decision Records**: `rulebook decision create|list|show|supersede` — Architecture Decision Records with auto-numbering and status lifecycle
108
- - 📚 **Knowledge Base**: `rulebook knowledge add|list|show|remove` Explicit patterns and anti-patterns auto-injected into AGENTS.md
109
- - 💡 **Learn Phase**: `rulebook learn capture|from-ralph|list|promote` Capture learnings, extract from Ralph, promote to patterns or decisions
110
- - 🔌 **10 New MCP Tools**: Decision, knowledge, and learning management — **40 MCP tools total**
111
- - 🤖 **Context Intelligence Agent**: New `context-intelligence` (haiku) agent for managing project knowledge
112
- - 📋 **6 New Skills**: `/rulebook-decision-create`, `/rulebook-decision-list`, `/rulebook-knowledge-add`, `/rulebook-knowledge-list`, `/rulebook-learn-capture`, `/rulebook-learn-list`
113
-
114
- ### v4.3.0 — Agent Delegation & Cost Optimization
115
-
116
- - 🤖 **18 Specialist Agents**: Cost-appropriate model assignments (opus for architecture, sonnet for code, haiku for read-only) with full Claude Code fields (`tools`, `maxTurns`, `disallowedTools`)
117
- - ⚡ **14 Dev Skills**: `/docs`, `/review`, `/debug`, `/refactor`, `/security-audit`, `/deploy`, `/perf`, `/architect`, `/api-design`, `/db-design`, `/accessibility`, `/migrate`, `/research`, `/build-fix` — each linked to a specialist agent via `context: fork`
118
- - 📋 **Delegation Rules in AGENTS.md**: Auto-generated table instructing LLMs to delegate work to specialist agents instead of doing everything in the main conversation
119
- - 🌐 **Dynamic Agent Templates**: Placeholders (`{{language}}`, `{{test_framework}}`, etc.) resolved at generation time for 14 languages
120
-
121
- ### v4.2.1 Workspace Config Path Fix
122
-
123
- - 📁 **Workspace config moved to `.rulebook/workspace.json`** (was `.rulebook-workspace.json` at root)
124
- - 🔄 **Backward compatible**: Legacy `.rulebook-workspace.json` still discovered automatically
125
- - 📝 **Documentation updates** for new config path
126
-
127
- ### v4.2.0 — Multi-Project Workspace Support
128
-
129
- - 🏗️ **Workspace Orchestration**: Manage multiple projects simultaneously (monorepo or independent folders)
130
- - 🔀 **MCP `--workspace` mode**: Single MCP server manages all projects with `projectId` routing on every tool
131
- - 🧩 **4 New Workspace MCP Tools**: `rulebook_workspace_list`, `rulebook_workspace_status`, `rulebook_workspace_search`, `rulebook_workspace_tasks`
132
- - 🔍 **Auto-detection**: Discovers workspace from `.rulebook/workspace.json`, `*.code-workspace`, pnpm/turbo/nx/lerna
133
- - 📋 **CLI `--project` and `--all-projects` flags** on all task commands
134
- - 🔄 **`rulebook update` in workspace**: Auto-updates all projects + injects workspace routing instructions
135
- - 📚 **26 MCP Functions** total (was 22)
136
-
137
- ### v4.1.0 — Background Indexer & Codebase Intelligence
138
-
139
- - 🔍 **Background Indexer**: Autonomous daemon that continuously indexes your codebase into a searchable vector + graph database
140
- - 🧠 **3 New MCP Tools**: `rulebook_codebase_search` (semantic code search), `rulebook_codebase_graph` (import/export relationships), `rulebook_indexer_status` (daemon status)
141
- - 📋 **Deferred Items Protocol**: New mandatory directive ensuring deferred task items always get tracked as new Rulebook tasks before archiving
142
- - 📚 **22 MCP Functions** total (was 19)
143
-
144
- ### v4.0.0 — AI-first DX & Ralph maturity
145
-
146
- - 🚀 **Zero-prompt `init`**: auto-configures from detection, no questionnaires
147
- - 🛡️ **AGENTS.override.md**: project rules that survive every update
148
- - 📊 **Health Scorer v2**: 9-category scoring with letter grade A–F
149
- - 🤖 **Ralph v2**: parallel execution, plan checkpoint, context compression, security gate, GitHub Issues import
150
- - 🐳 **Container + Observability**: Docker, K8s, Helm, Sentry, OTel, Datadog, Pino, Winston, Prometheus
151
- - 🛠️ **Multi-tool**: Gemini CLI, Continue.dev, Windsurf, Copilot configs auto-generated
152
- - 🔍 **AI Code Review**: `rulebook review` + GitHub Actions workflow
153
- - 👥 **Multi-agent teams**: Claude Code agent definitions + team auto-configuration (expanded to 18 agents in v4.2)
154
-
155
- ### v3.0.0 Persistent Memory & Skills
156
-
157
- - 🧠 **Persistent Memory**: zero-dependency BM25+HNSW hybrid search, SQLite/WASM, 7 memory types
158
- - 🧩 **Skills System**: 244 skills across 10 categories with auto-detection and YAML frontmatter
159
- - 🤖 **Ralph Autonomous Loop**: multi-iteration AI agent with quality gates, PRD, pause/resume
160
-
161
- ### v2.0.0 Multi-tool & MCP
162
-
163
- - 🔌 **MCP Server**: 19 functions for task management, skills, and memory
164
- - 🤖 **AI CLI configs**: CLAUDE.md, CODEX.md, GEMINI.md auto-generated
165
- - 🧩 **Skills**: modular enable/disable architecture
166
-
167
- ### v1.0.0 — Foundation
168
-
169
- - 📋 **Task management**: OpenSpec-compatible format with full lifecycle
170
- - 🛡️ **Git hooks**: pre-commit (format, lint, type-check) + pre-push (build, tests)
171
- - 🌍 **28 languages, 17 frameworks**, auto-detection with confidence scores
172
-
173
- ---
174
-
175
- ## Persistent Memory System
176
-
177
- > **NEW in v3.0.0** — Give your AI assistant a brain that persists across sessions.
178
-
179
- 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.
180
-
181
- ### How It Works
182
-
183
- ```
184
- Session 1: "Chose event sourcing over CRUD for the audit trail"
185
- Saved to memory automatically
186
-
187
- Session 2 (new tab, days later):
188
- AI searches memory finds the decision → continues with full context
189
- ```
190
-
191
- ### Architecture
192
-
193
- | Component | Technology | Purpose |
194
- |-----------|-----------|---------|
195
- | **Storage** | better-sqlite3 (native) with sql.js fallback | Fast native SQLite with WAL journal; falls back to WASM if no build tools |
196
- | **Keyword Search** | BM25 via FTS5 | Fast exact-match scoring |
197
- | **Vector Search** | HNSW index | Semantic similarity matching |
198
- | **Embeddings** | TF-IDF + FNV1a hashing | 256-dim vectors, pure TypeScript, no API calls |
199
- | **Ranking** | Reciprocal Rank Fusion | Combines BM25 + vector scores |
200
- | **Eviction** | LRU cache | 500MB default, protects decision/bugfix memories |
201
- | **Privacy** | Auto-redact filter | `<private>...</private>` tags stripped before storage |
202
-
203
- ### Memory Types
204
-
205
- | Type | When to Use |
206
- |------|-------------|
207
- | `decision` | Chose one approach over another |
208
- | `bugfix` | Root cause and resolution |
209
- | `feature` | What was built, key design choices |
210
- | `discovery` | Codebase patterns, gotchas, constraints |
211
- | `refactor` | Structural changes and reasoning |
212
- | `change` | Configuration or dependency updates |
213
- | `observation` | Session summaries, general notes |
214
-
215
- ### Auto-Capture
216
-
217
- 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.
218
-
219
- For conversation context (decisions, discussions, user preferences), the AI saves manually following the mandatory directives in `CLAUDE.md` and `AGENTS.md`.
220
-
221
- ### Usage
222
-
223
- **CLI Commands:**
224
- ```bash
225
- rulebook memory search "authentication approach" # Hybrid BM25+vector search
226
- rulebook memory save "Chose JWT over sessions" # Save manually
227
- rulebook memory stats # DB size, count, health
228
- rulebook memory cleanup # Evict old memories
229
- rulebook memory export # Export as JSON/CSV
230
- ```
231
-
232
- **MCP Tools (used by AI agents):**
233
- ```
234
- rulebook_memory_save — Save context with type, title, content, tags
235
- rulebook_memory_search — Hybrid search (bm25/vector/hybrid modes)
236
- rulebook_memory_get — Get full details by memory ID
237
- rulebook_memory_timeline — Chronological context around a memory
238
- rulebook_memory_stats — Database statistics and health
239
- rulebook_memory_cleanup — Force eviction and cleanup
240
- ```
241
-
242
- ### Configuration
243
-
244
- Memory is enabled in `.rulebook`:
245
-
246
- ```json
247
- {
248
- "memory": {
249
- "enabled": true,
250
- "autoCapture": true,
251
- "dbPath": ".rulebook/memory/memory.db",
252
- "maxSizeBytes": 524288000,
253
- "vectorDimensions": 256
254
- }
255
- }
256
- ```
257
-
258
- > Add `.rulebook/` to your `.gitignore` — memory is local per developer.
259
-
260
- ---
261
-
262
- ## Multi-Project Workspace
263
-
264
- > **NEW in v4.2.0** — Manage multiple projects (monorepo or independent folders) with a single MCP server.
265
-
266
- ### The Problem
267
-
268
- When working on a monorepo or multiple related projects, each project needs its own `.mcp.json` and runs a separate MCP server. This wastes resources and prevents cross-project operations like searching memory across all projects.
269
-
270
- ### The Solution
271
-
272
- Rulebook workspace mode runs **one MCP server** that manages all projects, with fully isolated per-project managers (tasks, memory, skills, config).
273
-
274
- ```
275
- ┌─────────────────────────────────────────┐
276
- │ Workspace Orchestrator (1 MCP) │
277
- │ - Routes calls via projectId │
278
- │ - Cross-project memory search │
279
- │ - Idle worker lifecycle management │
280
- └──────┬──────────┬──────────┬────────────┘
281
- │ │ │
282
- v v v
283
- ┌─────────┐ ┌─────────┐ ┌─────────┐
284
- │backend │ │frontend panel │ (on-demand)
285
- │.rulebook│ │.rulebook│ │.rulebook│
286
- │tasks/ │ │tasks/ │ │tasks/ │
287
- │memory.db│ │memory.db│ │memory.db│
288
- └─────────┘ └─────────┘ └─────────┘
289
- ```
290
-
291
- ### Quick Start
292
-
293
- ```bash
294
- # 1. Initialize workspace at the monorepo root
295
- cd my-monorepo
296
- rulebook workspace init
297
-
298
- # 2. Add projects (auto-detected from pnpm/turbo/nx or manually)
299
- rulebook workspace add ./frontend
300
- rulebook workspace add ./backend
301
- rulebook workspace add ./shared-lib
302
-
303
- # 3. Setup MCP for workspace mode
304
- rulebook mcp init --workspace
305
-
306
- # 4. Update all projects at once
307
- rulebook update
308
- ```
309
-
310
- ### Workspace Discovery
311
-
312
- Rulebook auto-discovers workspace config from (in priority order):
313
-
314
- 1. `.rulebook/workspace.json` — native config (highest priority)
315
- 2. `*.code-workspace` — VSCode workspace format
316
- 3. `pnpm-workspace.yaml` / `turbo.json` / `nx.json` / `lerna.json` — monorepo detection
317
-
318
- ### CLI Commands
319
-
320
- ```bash
321
- # Workspace management
322
- rulebook workspace init # Create .rulebook/workspace.json
323
- rulebook workspace add <path> # Add project to workspace
324
- rulebook workspace remove <name> # Remove project
325
- rulebook workspace list # List all projects
326
- rulebook workspace status # Status with task counts
327
-
328
- # Task commands with project targeting
329
- rulebook task list # Auto-detects project from cwd
330
- rulebook task list --project frontend # Target specific project
331
- rulebook task list --all-projects # List across all projects
332
- rulebook task create my-task --project backend
333
- ```
334
-
335
- ### MCP Tools
336
-
337
- All existing MCP tools accept an optional `projectId` parameter:
338
-
339
- ```
340
- rulebook_task_list({ projectId: "frontend" }) # Tasks from frontend
341
- rulebook_memory_search({ query: "auth", projectId: "backend" })
342
-
343
- # Workspace-specific tools:
344
- rulebook_workspace_list() # All projects and paths
345
- rulebook_workspace_status() # Active workers, task counts
346
- rulebook_workspace_search() # Cross-project memory search
347
- rulebook_workspace_tasks() # Tasks from all projects
348
- ```
349
-
350
- ### Isolation Guarantee
351
-
352
- Each project has **completely isolated** managers:
353
- - **Tasks** → `{project}/.rulebook/tasks/` — never shared
354
- - **Memory** → `{project}/.rulebook/memory.db` separate SQLite databases
355
- - **Config** → `{project}/.rulebook/rulebook.json` — independent settings
356
- - **Skills** → resolved per project root
357
-
358
- Cross-project operations (search, task listing) are explicit and deliberate.
359
-
360
- ### Configuration
361
-
362
- `.rulebook/workspace.json` at the workspace root:
363
-
364
- ```json
365
- {
366
- "name": "my-workspace",
367
- "version": "1.0.0",
368
- "projects": [
369
- { "name": "frontend", "path": "./frontend" },
370
- { "name": "backend", "path": "./backend" },
371
- { "name": "shared", "path": "/absolute/path/to/shared-lib" }
372
- ],
373
- "defaultProject": "backend",
374
- "idleTimeoutMs": 300000
375
- }
376
- ```
377
-
378
- > **Tip**: `rulebook workspace init` auto-generates this from your monorepo structure.
379
-
380
- ---
381
-
382
- ## Key Features
383
-
384
- - 🤖 **Ralph Autonomous Loop**: Multi-iteration AI task solving with fresh context per iteration (v3.1+)
385
- - Quality gates: type-check, lint, tests, coverage verification
386
- - Graceful pause/resume capabilities
387
- - Complete iteration history and metrics
388
- - 6 CLI commands + 4 MCP tools
389
- - 🧠 **Persistent Memory**: Context that survives across AI sessions — hybrid BM25+HNSW search, auto-capture, native SQLite with WASM fallback
390
- - 🔍 **Auto-Detection**: Detects languages, frameworks, MCP modules, and services from your project files
391
- - 📁 **Modular Architecture**: Templates in `/.rulebook/` directory — smaller AGENTS.md, on-demand loading
392
- - 🔗 **Git Hook Automation**: Pre-commit/pre-push hooks with language-aware quality checks
393
- - 🔌 **26 MCP Functions**: Task management (7), skills (6), persistent memory (6), Ralph loop (4), workspace (4) via Model Context Protocol
394
- - 📝 **106+ Templates**: 28 languages, 17 frameworks, 8 IDEs, 20 services, 15 CLI agents
395
- - 🤖 **AI-Optimized**: Works with 23 AI assistants (Cursor, Claude, Gemini, etc.)
396
- - 📦 **Publication Ready**: CI/CD pipelines for npm, crates.io, PyPI, Maven Central, and more
397
- - 🔄 **Automatic Migration**: Existing projects automatically migrated to modular structure
398
-
399
- ## VSCode Extension
400
-
401
- The **Rulebook Dashboard** extension brings full visibility into your AI-powered workflow directly inside VSCode.
402
-
403
- ```bash
404
- # Install from .vsix (local)
405
- code --install-extension vscode-extension/rulebook-dashboard-*.vsix
406
-
407
- # Or build from source
408
- cd vscode-extension && npm install && npm run compile
409
- # Press F5 to launch Extension Development Host
410
- ```
411
-
412
- | Tab | What it shows |
413
- |-----|---------------|
414
- | 🤖 **Agents** | All Claude agent team members with real-time status (active/idle), memory state, last activity |
415
- | 📋 **Tasks** | Project tasks with progress bars, expandable details, Archive & Update via AI buttons |
416
- | 🔄 **Ralph** | Autonomous loop status, current iteration, progress tracking |
417
- | 🧠 **Memory** | Memory stats (count, DB size, types), full-text search, clear/reprocess |
418
- | 🔍 **Indexer** | Background indexer status, files processed, queue size, reindex button |
419
-
420
- **Multi-root workspace support** — scans all open workspace folders for `.claude/agents/`, `.rulebook/tasks/`, and more.
421
-
422
- **Status Bar** — `📖 Rulebook` button (opens dashboard), indexer indicator, Ralph running state.
423
-
424
- > See [`vscode-extension/README.md`](vscode-extension/README.md) for full documentation.
425
-
426
- ## What It Does
427
-
428
- **For New Projects:**
429
- 1. Detects your language(s), frameworks, MCP modules, and services
430
- 2. Asks setup questions (or use `--minimal` for defaults)
431
- 3. Generates AGENTS.md with AI assistant rules (modular structure)
432
- 4. Creates `/.rulebook/` directory with language/framework/module/service templates
433
- 5. Creates/updates `.gitignore` automatically for detected languages
434
- 6. Auto-configures Claude Code integration (MCP + skills) if detected
435
- 7. Optionally installs Git hooks (pre-commit/pre-push)
436
- 8. Creates GitHub Actions workflows
437
- 9. Scaffolds README, LICENSE, /docs, and /tests
438
-
439
- **For Existing Projects:**
440
- ```bash
441
- npx @hivehub/rulebook update
442
- ```
443
- - Automatically migrates embedded templates to modular `/.rulebook/` structure
444
- - Automatically migrates OpenSpec tasks to Rulebook format (if OpenSpec exists)
445
- - Merges latest templates while preserving your customizations
446
- - Updates AGENTS.md with references to modular files
447
- - Updates `.gitignore` with missing patterns for detected languages
448
-
449
- ## Commands
450
-
451
- ### Core Commands
452
-
453
- ```bash
454
- # Project Initialization & Updates
455
- npx @hivehub/rulebook@latest init # Initialize new project (interactive)
456
- npx @hivehub/rulebook@latest init --minimal # Minimal setup (essentials only)
457
- npx @hivehub/rulebook@latest init --light # Light mode (no quality enforcement)
458
- npx @hivehub/rulebook@latest init --yes # Skip prompts, use defaults
459
- npx @hivehub/rulebook@latest update # Update AGENTS.md to latest version
460
- npx @hivehub/rulebook@latest update --yes # Update without confirmation
461
- npx @hivehub/rulebook@latest update --light # Update in light mode
462
-
463
- # Workflow & CI/CD
464
- npx @hivehub/rulebook@latest workflows # Generate GitHub Actions workflows
465
-
466
- # Validation & Health
467
- npx @hivehub/rulebook@latest validate # Check project standards
468
- npx @hivehub/rulebook@latest health # Project health score (0-100)
469
- npx @hivehub/rulebook@latest fix # Auto-fix common issues
470
-
471
- # Documentation
472
- npx @hivehub/rulebook@latest generate-docs # Create /docs structure
473
- npx @hivehub/rulebook@latest generate-docs --yes # Skip prompts, use defaults
474
-
475
- # Dependencies & Coverage
476
- npx @hivehub/rulebook@latest check-deps # Check outdated/vulnerable dependencies
477
- npx @hivehub/rulebook@latest check-coverage # Check test coverage (default: 95%)
478
- npx @hivehub/rulebook@latest check-coverage -t 80 # Custom threshold
479
-
480
- # Versioning
481
- npx @hivehub/rulebook@latest version <type> # Bump version (major|minor|patch)
482
- npx @hivehub/rulebook@latest changelog # Generate changelog from git commits
483
- npx @hivehub/rulebook@latest changelog -v 1.0.0 # Specify version
484
- ```
485
-
486
- > **Note**: If installed globally (`npm install -g @hivehub/rulebook`), you can use `rulebook` directly instead of `npx @hivehub/rulebook@latest`.
487
-
488
- ### Advanced Commands (Beta)
489
-
490
- ```bash
491
- # Real-time Monitoring
492
- npx @hivehub/rulebook@latest watcher # Full-screen task monitoring UI
493
- # - Live task progress tracking
494
- # - Activity log with timestamps
495
- # - System status monitoring
496
- # - Auto-refresh every 2 seconds
497
-
498
- # Autonomous Agent
499
- npx @hivehub/rulebook@latest agent # Start AI CLI workflow automation
500
- npx @hivehub/rulebook@latest agent --dry-run # Simulate without changes
501
- npx @hivehub/rulebook@latest agent --tool cursor-agent # Specify CLI tool
502
- npx @hivehub/rulebook@latest agent --iterations 10 # Max iterations
503
- npx @hivehub/rulebook@latest agent --watch # Enable watcher mode
504
-
505
- # Task Management
506
- npx @hivehub/rulebook@latest task create <task-id> # Create new task
507
- npx @hivehub/rulebook@latest task list # List all tasks
508
- npx @hivehub/rulebook@latest task list --archived # List including archived tasks
509
- npx @hivehub/rulebook@latest task show <task-id> # Show task details
510
- npx @hivehub/rulebook@latest task validate <task-id> # Validate task format
511
- npx @hivehub/rulebook@latest task archive <task-id> # Archive completed task
512
- npx @hivehub/rulebook@latest task archive --skip-validation <task-id> # Archive without validation
513
- npx @hivehub/rulebook@latest tasks [options] # Legacy command (DEPRECATED - use 'task' commands)
514
-
515
- # Skills Management (v2.0)
516
- npx @hivehub/rulebook@latest skill list # List all available skills
517
- npx @hivehub/rulebook@latest skill list --category languages # Filter by category
518
- npx @hivehub/rulebook@latest skill list --enabled # Show only enabled skills
519
- npx @hivehub/rulebook@latest skill add <skill-id> # Enable a skill
520
- npx @hivehub/rulebook@latest skill remove <skill-id> # Disable a skill
521
- npx @hivehub/rulebook@latest skill show <skill-id> # Show skill details
522
- npx @hivehub/rulebook@latest skill search <query> # Search for skills
523
-
524
- # Persistent Memory (v3.0)
525
- npx @hivehub/rulebook@latest memory search <query> # Search memories (hybrid BM25+vector)
526
- npx @hivehub/rulebook@latest memory save <text> # Save a memory
527
- npx @hivehub/rulebook@latest memory list # List all memories
528
- npx @hivehub/rulebook@latest memory stats # Database stats and health
529
- npx @hivehub/rulebook@latest memory cleanup # Run cache eviction
530
- npx @hivehub/rulebook@latest memory export # Export as JSON or CSV
531
-
532
- # Ralph Autonomous Loop (v3.1)
533
- npx @hivehub/rulebook@latest ralph init # Initialize Ralph and generate PRD
534
- npx @hivehub/rulebook@latest ralph run # Execute autonomous iteration loop
535
- npx @hivehub/rulebook@latest ralph run --max-iterations 10 # Set max iterations
536
- npx @hivehub/rulebook@latest ralph run --tool claude # Specify AI tool (claude|amp|gemini)
537
- npx @hivehub/rulebook@latest ralph status # Show loop status
538
- npx @hivehub/rulebook@latest ralph history # View iteration history
539
- npx @hivehub/rulebook@latest ralph history --limit 5 # Last N iterations
540
- npx @hivehub/rulebook@latest ralph pause # Gracefully pause loop
541
- npx @hivehub/rulebook@latest ralph resume # Resume from pause
542
-
543
- # Configuration
544
- npx @hivehub/rulebook@latest config --show # Show current config
545
- npx @hivehub/rulebook@latest config --set key=value # Set config value
546
- npx @hivehub/rulebook@latest config --feature watcher --enable # Enable feature
547
- npx @hivehub/rulebook@latest config --feature agent --disable # Disable feature
548
- ```
549
-
550
- ## Setup Modes
551
-
552
- ### Full Mode (Default)
553
- Complete setup with all features: Task management, Watcher, MCP modules, comprehensive workflows.
554
-
555
- ### Minimal Mode
556
- ```bash
557
- npx @hivehub/rulebook@latest init --minimal
558
- ```
559
- Essentials only: README, LICENSE, tests/, basic CI. Perfect for small teams or initial adoption.
560
-
561
- ### Light Mode
562
- ```bash
563
- npx @hivehub/rulebook@latest init --light
564
- ```
565
- Bare minimum rules: no quality enforcement, no testing requirements, no linting. Use for quick prototypes or non-production projects.
566
-
567
- ## Supported Languages & Frameworks
568
-
569
- **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
570
-
571
- **17 Frameworks** (auto-detected):
572
- - Backend: NestJS, Spring Boot, Laravel, Django, Flask, Ruby on Rails, Symfony, Zend
573
- - Frontend: Angular, React, Vue, Nuxt, Next.js, jQuery
574
- - Mobile: React Native, Flutter
575
- - Desktop: Electron
576
-
577
- ## MCP Modules (13)
578
-
579
- **Core**: Vectorizer • Synap • Context7 • GitHub MCP • Playwright • Memory
580
-
581
- **Services**: Supabase • Notion • Atlassian • Serena • Figma • Grafana
582
-
583
- ### MCP Server for Task Management
584
-
585
- 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.
586
-
587
- **Benefits:**
588
- - ✅ Direct MCP integration - no shell command execution needed
589
- - ✅ Structured error handling with proper error codes and messages
590
- - ✅ Consistent interface with other MCP operations
591
- - ✅ Better automation capabilities for AI agents
592
- - ✅ Improved reliability compared to terminal command execution
593
- - ✅ Automatic project detection - finds `.rulebook` by walking up directories (like git)
594
- - ✅ Zero configuration - works out of the box after `rulebook mcp init`
595
-
596
- **Quick Setup:**
597
-
598
- ```bash
599
- # Initialize MCP configuration in your project (one-time setup)
600
- npx @hivehub/rulebook@latest mcp init
601
- ```
602
-
603
- This command:
604
- - Adds `mcp` block to your `.rulebook` file
605
- - Creates/updates `.cursor/mcp.json` automatically
606
- - Server uses stdio transport (MCP standard)
607
-
608
- > **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.
609
-
610
- **Available MCP Functions:**
611
-
612
- - `rulebook_task_create` - Create a new task with OpenSpec-compatible format
613
- - Input: `taskId` (string), optional `proposal` object
614
- - Output: Task creation confirmation with path
615
- - `rulebook_task_list` - List all tasks with optional filters
616
- - Input: `includeArchived` (boolean), `status` (enum)
617
- - Output: Array of tasks with metadata
618
- - `rulebook_task_show` - Show detailed task information
619
- - Input: `taskId` (string)
620
- - Output: Complete task details including proposal, tasks, specs
621
- - `rulebook_task_update` - Update task status or progress
622
- - Input: `taskId` (string), optional `status`, `progress`
623
- - Output: Update confirmation
624
- - `rulebook_task_validate` - Validate task format against OpenSpec requirements
625
- - Input: `taskId` (string)
626
- - Output: Validation results with errors and warnings
627
- - `rulebook_task_archive` - Archive completed task and apply spec deltas
628
- - Input: `taskId` (string), optional `skipValidation`
629
- - Output: Archive confirmation with archive path
630
- - `rulebook_task_delete` - Delete a task permanently
631
- - Input: `taskId` (string)
632
- - Output: Deletion confirmation
633
-
634
- **Total: 7 MCP functions** for complete task lifecycle management.
635
-
636
- **Skills MCP Functions (v2.0):**
637
-
638
- - `rulebook_skill_list` - List available skills with optional category filter
639
- - `rulebook_skill_show` - Show detailed skill information
640
- - `rulebook_skill_enable` - Enable a skill for the project
641
- - `rulebook_skill_disable` - Disable a skill
642
- - `rulebook_skill_search` - Search skills by name, description, or tags
643
- - `rulebook_skill_validate` - Validate skills configuration
644
-
645
- **Memory MCP Functions (v3.0):**
646
-
647
- - `rulebook_memory_search` - Hybrid BM25+vector search with mode selection (hybrid/bm25/vector)
648
- - `rulebook_memory_timeline` - Chronological context around a specific memory
649
- - `rulebook_memory_get` - Full details for specific memory IDs
650
- - `rulebook_memory_save` - Save new memories with type, title, content, and tags
651
- - `rulebook_memory_stats` - Database statistics (size, count, usage, health)
652
- - `rulebook_memory_cleanup` - Force eviction and cleanup
653
-
654
- **Total: 19 MCP functions** (7 task + 6 skills + 6 memory).
655
-
656
- ## Skills System (v2.0)
657
-
658
- Rulebook v2.0 introduces a modular skills system for AI-assisted development. Skills are pluggable capabilities that can be enabled or disabled per project.
659
-
660
- ### What are Skills?
661
-
662
- Skills are YAML-frontmatter Markdown files that define specific capabilities or rules for AI assistants. Each skill has:
663
-
664
- - **Metadata**: Name, description, version, category, tags, dependencies
665
- - **Content**: Markdown content with rules, patterns, and examples
666
-
667
- ### Skill Categories
668
-
669
- Skills are organized into 10 categories:
670
-
671
- | Category | Description | Examples |
672
- |----------|-------------|----------|
673
- | `languages` | Language-specific rules | TypeScript, Rust, Python |
674
- | `frameworks` | Framework conventions | NestJS, React, Django |
675
- | `modules` | MCP module integration | Vectorizer, Context7 |
676
- | `services` | Service integration | PostgreSQL, Redis |
677
- | `workflows` | CI/CD patterns | GitHub Actions |
678
- | `ides` | IDE configuration | Cursor, VS Code |
679
- | `core` | Core rulebook standards | Quality gates |
680
- | `cli` | AI CLI configuration | Claude Code, Codex |
681
- | `git` | Git workflow rules | Branching, commits |
682
- | `hooks` | Git hooks configuration | Pre-commit, pre-push |
683
-
684
- ### Using Skills
685
-
686
- ```bash
687
- # List all available skills
688
- rulebook skill list
689
-
690
- # Filter by category
691
- rulebook skill list --category languages
692
-
693
- # Enable a skill
694
- rulebook skill add languages/typescript
695
-
696
- # Disable a skill
697
- rulebook skill remove languages/typescript
698
-
699
- # Show skill details
700
- rulebook skill show languages/typescript
701
-
702
- # Search for skills
703
- rulebook skill search "testing"
704
- ```
705
-
706
- ### Auto-Detection
707
-
708
- During `rulebook init` and `rulebook update`, skills are automatically detected and enabled based on your project's:
709
-
710
- - Detected languages (e.g., TypeScript → `languages/typescript`)
711
- - Detected frameworks (e.g., NestJS → `frameworks/nestjs`)
712
- - Detected modules (e.g., Vectorizer → `modules/vectorizer`)
713
- - Detected services (e.g., PostgreSQL → `services/postgresql`)
714
-
715
- ### Creating Custom Skills
716
-
717
- Create a `SKILL.md` file in `templates/skills/<category>/<skill-name>/`:
718
-
719
- ```markdown
720
- ---
721
- name: My Custom Skill
722
- description: Description of what this skill does
723
- version: 1.0.0
724
- category: core
725
- tags: ["custom", "example"]
726
- ---
727
-
728
- # My Custom Skill
729
-
730
- Add your rules and patterns here.
731
- ```
732
-
733
- ## Service Integration Templates (20)
734
-
735
- Rulebook provides comprehensive integration templates for popular backend services, including databases, caches, message queues, and object storage.
736
-
737
- **Relational Databases**: PostgreSQL • MySQL • MariaDB • SQL Server • Oracle • SQLite
738
-
739
- **NoSQL Databases**: MongoDB • Cassandra • DynamoDB
740
-
741
- **Caches**: Redis • Memcached
742
-
743
- **Search & Analytics**: Elasticsearch
744
-
745
- **Graph Databases**: Neo4j
746
-
747
- **Time-Series Databases**: InfluxDB
748
-
749
- **Message Queues**: RabbitMQ • Kafka
750
-
751
- **Object Storage**: AWS S3 • Azure Blob Storage • Google Cloud Storage • MinIO
752
-
753
- ### Automatic Service Detection
754
-
755
- The CLI automatically detects services in your project by analyzing:
756
- - **`package.json`**: Database drivers and client libraries (e.g., `pg`, `mongoose`, `redis`, `ioredis`)
757
- - **`.env` files**: Connection strings and environment variables (e.g., `POSTGRES_*`, `REDIS_*`, `MONGODB_*`)
758
- - **`docker-compose.yml`**: Service definitions in Docker Compose files
759
-
760
- ### Service Templates Include
761
-
762
- Each service template provides:
763
- - Connection setup and configuration
764
- - Basic CRUD operations (where applicable)
765
- - Advanced patterns and best practices
766
- - Docker Compose examples
767
- - Environment variable configuration
768
- - Development and testing integration
769
- - Common pitfalls and solutions
770
-
771
- Templates are generated in `/.rulebook/specs/[SERVICE].md` and referenced in `AGENTS.md` for easy access during development.
772
-
773
- **Server Details:**
774
- - **Transport**: stdio only - stdout contains ONLY JSON-RPC 2.0 messages
775
- - **Configuration**: Loaded from `.rulebook` file automatically
776
- - **Project Detection**: Finds `.rulebook` by walking up directories (like git)
777
- - **Protocol**: MCP over stdio (MCP-compliant, no stdout pollution)
778
-
779
- **Configuration:**
780
-
781
- The MCP server configuration lives in your `.rulebook` file:
782
-
783
- ```json
784
- {
785
- "mcp": {
786
- "enabled": true,
787
- "tasksDir": ".rulebook/tasks",
788
- "archiveDir": ".rulebook/archive"
789
- }
790
- }
791
- ```
792
-
793
- **Note:** The server uses stdio transport only (no configuration needed).
794
-
795
- **Cursor Configuration (`.cursor/mcp.json`):**
796
-
797
- After running `rulebook mcp init`, your `.cursor/mcp.json` will be automatically configured:
798
-
799
- ```json
800
- {
801
- "mcpServers": {
802
- "rulebook": {
803
- "command": "npx",
804
- "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"]
805
- }
806
- }
807
- }
808
- ```
809
-
810
- That's it! No need for `--project-root`, `--port`, or environment variables. The server automatically:
811
- - Finds your `.rulebook` file by walking up directories
812
- - Uses the `mcp` configuration from `.rulebook`
813
- - Works from any subdirectory in your project
814
-
815
- **Manual Override (if needed):**
816
-
817
- If you need to override the `.rulebook` location:
818
-
819
- ```json
820
- {
821
- "mcpServers": {
822
- "rulebook": {
823
- "command": "npx",
824
- "args": ["-y", "@hivehub/rulebook@latest", "mcp-server"],
825
- "env": {
826
- "RULEBOOK_CONFIG": "/path/to/.rulebook"
827
- }
828
- }
829
- }
830
- }
831
- ```
832
-
833
- **Note:** After running `rulebook mcp init` or updating `.cursor/mcp.json`, restart Cursor for the changes to take effect.
834
-
835
- **Troubleshooting:**
836
-
837
- ### Server Not Starting
838
-
839
- If the MCP server fails to start:
840
-
841
- 1. **Verify `.rulebook` exists**: Run `rulebook mcp init` in your project root
842
- 2. **Check Node.js version**: Requires Node.js 20+ (`node --version`)
843
- 3. **Verify MCP configuration**: Check that `.cursor/mcp.json` exists and is valid JSON
844
- 4. **Debug mode**: Set `RULEBOOK_MCP_DEBUG=1` to see debug logs in stderr:
845
- ```bash
846
- RULEBOOK_MCP_DEBUG=1 npx @hivehub/rulebook@latest mcp-server
847
- ```
848
-
849
- ### Empty Schemas or Missing Parameters
850
-
851
- If tools don't show descriptions or parameters:
852
-
853
- 1. **Clear npm cache**:
854
- ```bash
855
- # Clear npm cache
856
- npm cache clean --force
857
-
858
- # Or clear npx cache specifically
859
- rm -rf ~/.npm/_npx
860
- ```
861
-
862
- 2. **Rebuild the project**:
863
- ```bash
864
- npm run build
865
- ```
866
-
867
- 3. Restart your MCP client and try again.
868
-
869
- ### "Unexpected token" or "Invalid JSON" Errors
870
-
871
- These errors occur when the server outputs non-JSON to stdout. This is fixed in v1.0.9+:
872
- - Ensure you're using `@hivehub/rulebook@latest` (v1.0.9 or newer)
873
- - stdout now contains ONLY JSON-RPC 2.0 messages
874
- - All logs go to stderr (use `RULEBOOK_MCP_DEBUG=1` to see them)
875
-
876
- ### ".rulebook not found" Error
877
-
878
- If you see this error:
879
- 1. Run `rulebook mcp init` in your project root
880
- 2. Or manually create `.rulebook` file with `mcp` block
881
- 3. Or set `RULEBOOK_CONFIG` environment variable to point to your `.rulebook` file
882
-
883
- ### "Received a response for an unknown message ID" Warning
884
-
885
- If you see this warning in Cursor logs:
886
- - **This is a cosmetic warning** - it does NOT affect functionality
887
- - All tools work correctly despite this warning
888
- - The server is responding correctly with valid JSON-RPC 2.0 messages
889
- - This is a known issue with Cursor's MCP client ID tracking
890
- - The warning can be safely ignored - all MCP tools function normally
891
-
892
- ### "Received a response for an unknown message ID" Warning
893
-
894
- If you see this warning in the logs:
895
- - This is usually harmless - the server is working correctly
896
- - The warning appears during the initial handshake but doesn't affect functionality
897
- - If you see "Successfully connected to stdio server" after the warning, everything is fine
898
- - This is a known behavior with some MCP clients and can be safely ignored
899
-
900
- **Automated Setup:**
901
-
902
- ```bash
903
- # Initialize MCP in your project (recommended)
904
- npx @hivehub/rulebook@latest mcp init
905
-
906
- # Or use the setup script (for CI/CD)
907
- npm run setup:mcp
908
- ```
909
-
910
- ## AI Tools Supported (23)
911
-
912
- **IDEs**: Cursor, Windsurf, VS Code, GitHub Copilot, Tabnine, Replit, JetBrains AI, Zed
913
-
914
- **CLI Agents**: Aider, Continue, Claude, Claude Code, Gemini, Cline, Amazon Q, Auggie, CodeBuddy, Factory, OpenCode, Kilo, Codex, Codeium, Cursor CLI
915
-
916
- ## Documentation
917
-
918
- Full documentation available in `/docs`:
919
- - [Getting Started](docs/guides/GETTING_STARTED.md)
920
- - [Best Practices](docs/guides/BEST_PRACTICES.md)
921
- - [CLI Agents](docs/CLI_AGENTS.md)
922
- - [Roadmap](docs/ROADMAP.md)
923
- - [Framework Templates](templates/frameworks/)
924
-
925
- ## Contributing
926
-
927
- Contributions welcome! Node.js 18+ required.
928
-
929
- ```bash
930
- npm install
931
- npm test
932
- npm run build
933
- ```
934
-
935
- ## Acknowledgments
936
-
937
- We gratefully acknowledge and draw inspiration from these excellent open-source projects:
938
-
939
- ### [Ralph - Autonomous AI Agent Loop](https://github.com/snarktank/ralph)
940
- Ralph inspired the autonomous loop integration in Rulebook v3.1+, enabling multi-iteration AI task solving with fresh context per iteration. We adapted Ralph's architectural patterns for integration with the Rulebook task management system, enabling AI agents to solve complex problems across multiple iterations without context exhaustion.
941
-
942
- ### [OpenSpec - AI-Native Task Format](https://github.com/Fission-AI/openspec)
943
- OpenSpec's innovative approach to AI-native task management influenced Rulebook's task structure, including:
944
- - Delta-based specifications (ADDED/MODIFIED/REMOVED)
945
- - Given/When/Then scenario definitions
946
- - Requirement-focused organization
947
- - Structured task metadata and tracking
948
-
949
- Rulebook builds on these concepts to provide a comprehensive task management system that works seamlessly with AI agents while maintaining compatibility with the OpenSpec format.
950
-
951
- ### Special Thanks
952
-
953
- - **Ralph Team** for pioneering autonomous AI iteration patterns
954
- - **Fission AI** for the OpenSpec format that standardizes AI task management
955
- - All contributors who have helped shape Rulebook into a comprehensive solution for AI-generated project standardization
956
-
957
- These projects demonstrate that with clear structure and standards, AI agents can consistently deliver high-quality code and documentation.
958
-
959
- ## License
960
-
961
- Apache License 2.0 © HiveLLM Team
962
-
963
- ---
964
-
965
- **Links**: [Issues](https://github.com/hivellm/rulebook/issues) • [Discussions](https://github.com/hivellm/rulebook/discussions) • [Ralph](https://github.com/snarktank/ralph) • [OpenSpec](https://github.com/Fission-AI/openspec)
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
+ > Tool-agnostic AI development framework. Standardize projects across Claude Code, Cursor, Gemini, Codex, Windsurf, and Copilot 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
+ ## Quick Start
19
+
20
+ ```bash
21
+ # Initialize — auto-detects languages, tools, and complexity
22
+ npx @hivehub/rulebook@latest init
23
+
24
+ # Update existing project to latest rules
25
+ npx @hivehub/rulebook@latest update
26
+
27
+ # Check project health
28
+ npx @hivehub/rulebook@latest doctor
29
+ ```
30
+
31
+ That's it. Rulebook detects your stack, generates rules for every AI tool in your project, sets up quality gates, and configures MCP integration — all in one command.
32
+
33
+ > Install globally with `npm install -g @hivehub/rulebook` to use `rulebook` directly.
34
+
35
+ ---
36
+
37
+ ## What Rulebook Does
38
+
39
+ AI coding assistants produce inconsistent, error-prone code without clear guidelines. Rulebook gives every AI tool in your project the same set of rules — automatically.
40
+
41
+ **One `init`, every tool configured:**
42
+
43
+ | What | How |
44
+ |------|-----|
45
+ | **Rules for every AI tool** | `AGENTS.md` + `CLAUDE.md` + `.cursor/rules/` + Gemini/Copilot/Windsurf configs — all generated from a single source of truth |
46
+ | **Quality gates** | Pre-commit hooks (lint, type-check, format) + pre-push hooks (build, tests) — language-aware, cross-platform |
47
+ | **40+ MCP tools** | Task management, persistent memory, skills, decisions, knowledge, learnings, Ralph loop, workspace — all via Model Context Protocol |
48
+ | **Structural enforcement** | `PreToolUse` hooks block forbidden patterns (deferred tasks, stubs/TODOs, manual task files) before edits reach disk |
49
+ | **Session continuity** | Persistent memory across sessions, automatic handoff at context limits, STATE.md live status |
50
+ | **Autonomous task solving** | Ralph loop: multi-iteration AI agent with quality gates, learning extraction, pause/resume |
51
+ | **28 languages, 17 frameworks** | Auto-detected with confidence scores, language-specific templates and CI/CD workflows |
52
+
53
+ ---
54
+
55
+ ## Core Features
56
+
57
+ ### Modular Rule System
58
+
59
+ Rulebook generates a **modular `@import` chain** instead of one massive file:
60
+
61
+ ```
62
+ CLAUDE.md (thin, ~100 lines)
63
+ @imports AGENTS.md — team-shared rules
64
+ @imports AGENTS.override.md your project overrides (survives updates)
65
+ @imports .rulebook/STATE.md — live task/health status
66
+ @imports .rulebook/PLANS.mdsession scratchpad
67
+ ```
68
+
69
+ Path-scoped rules in `.claude/rules/` load only when the AI touches matching files (e.g., TypeScript rules load only for `.ts` files). 5 always-on rules enforce core behaviors: diagnostic-first, fail-twice-escalate, no-deferred, no-shortcuts, sequential-editing.
70
+
71
+ ### Persistent Memory
72
+
73
+ Context that survives across AI sessions. Decisions, bugs, patterns, and preferences are stored locally and searchable.
74
+
75
+ | Component | Technology |
76
+ |-----------|-----------|
77
+ | Storage | better-sqlite3 (native) with sql.js WASM fallback |
78
+ | Search | Hybrid BM25 keyword + HNSW vector (256-dim TF-IDF, no API calls) |
79
+ | Ranking | Reciprocal Rank Fusion |
80
+ | Privacy | Auto-redact `<private>` tags, local-only storage |
81
+
82
+ ```bash
83
+ rulebook memory search "authentication approach" # Hybrid search
84
+ rulebook memory save "Chose JWT over sessions" # Save context
85
+ rulebook memory stats # DB health
86
+ ```
87
+
88
+ ### Task Management
89
+
90
+ Spec-driven development with OpenSpec-compatible format. Phase-prefixed task IDs, mandatory tail items (docs + tests + verify), and automatic archival.
91
+
92
+ ```bash
93
+ rulebook task create phase1_add-auth # Create task with structure
94
+ rulebook task list # See pending work
95
+ rulebook task validate phase1_add-auth # Check format
96
+ rulebook task archive phase1_add-auth # Archive when done
97
+ ```
98
+
99
+ Each task gets: `proposal.md` (why), `tasks.md` (checklist), `specs/` (technical requirements with SHALL/MUST keywords and Given/When/Then scenarios).
100
+
101
+ ### Ralph Autonomous Loop
102
+
103
+ Multi-iteration AI agent that solves tasks from a PRD with fresh context per iteration. 5 quality gates (type-check, lint, tests, coverage, security) must pass before an iteration succeeds.
104
+
105
+ ```bash
106
+ rulebook ralph init # Generate PRD from tasks
107
+ rulebook ralph run --max-iterations 10 # Execute loop
108
+ rulebook ralph status # Check progress
109
+ rulebook ralph history # Review iterations
110
+ ```
111
+
112
+ Features: parallel story execution, plan checkpoints, context compression, learning extraction, graceful pause/resume.
113
+
114
+ ### Multi-Project Workspace
115
+
116
+ One MCP server manages all projects in a monorepo, with fully isolated per-project managers.
117
+
118
+ ```bash
119
+ rulebook workspace init # Create workspace config
120
+ rulebook workspace add ./frontend # Add projects
121
+ rulebook mcp init --workspace # Single MCP for all
122
+ ```
123
+
124
+ Auto-discovers from `pnpm-workspace.yaml`, `turbo.json`, `nx.json`, `lerna.json`, or `*.code-workspace`.
125
+
126
+ ### Structural Enforcement Hooks
127
+
128
+ 3 `PreToolUse` hooks block forbidden patterns at the tool level — before edits reach disk:
129
+
130
+ | Hook | Blocks |
131
+ |------|--------|
132
+ | `enforce-no-deferred` | `deferred`, `skip`, `later`, `TODO` in tasks.md |
133
+ | `enforce-no-shortcuts` | Stubs, placeholders, `HACK`/`FIXME` in source files |
134
+ | `enforce-mcp-for-tasks` | Manual `mkdir`/`Write` in `.rulebook/tasks/` |
135
+
136
+ Cross-platform (Node.js, no `jq` dependency).
137
+
138
+ ---
139
+
140
+ ## MCP Server
141
+
142
+ 40+ MCP tools exposed via stdio transport. Zero configuration after `rulebook mcp init`.
143
+
144
+ ```bash
145
+ rulebook mcp init # One-time setup — configures .mcp.json automatically
146
+ ```
147
+
148
+ | Category | Tools | Examples |
149
+ |----------|-------|---------|
150
+ | Tasks (7) | CRUD + validate + archive + delete | `rulebook_task_create`, `rulebook_task_list` |
151
+ | Skills (6) | List, show, enable, disable, search, validate | `rulebook_skill_enable`, `rulebook_skill_search` |
152
+ | Memory (6) | Save, search, get, timeline, stats, cleanup | `rulebook_memory_search`, `rulebook_memory_save` |
153
+ | Ralph (4) | Init, run, status, history | `rulebook_ralph_run`, `rulebook_ralph_status` |
154
+ | Workspace (4) | List, status, search, tasks | `rulebook_workspace_search`, `rulebook_workspace_tasks` |
155
+ | Knowledge (3) | Add, list, show | `rulebook_knowledge_add`, `rulebook_knowledge_list` |
156
+ | Decisions (4) | Create, list, show, update | `rulebook_decision_create`, `rulebook_decision_list` |
157
+ | Learnings (3) | Capture, list, promote | `rulebook_learn_capture`, `rulebook_learn_list` |
158
+ | Analysis (3) | Create, list, show | `rulebook_analysis_create`, `rulebook_analysis_list` |
159
+ | Other (3+) | Doctor, rules list, blockers, session, codebase | `rulebook_doctor_run`, `rulebook_rules_list` |
160
+
161
+ All tools accept optional `projectId` for workspace routing.
162
+
163
+ ---
164
+
165
+ ## CLI Reference
166
+
167
+ ### Project Setup
168
+
169
+ ```bash
170
+ rulebook init # Interactive setup (auto-detects everything)
171
+ rulebook init --minimal # Essentials only
172
+ rulebook init --lean # AGENTS.md as <3KB index
173
+ rulebook init --light # No quality enforcement
174
+ rulebook update # Update to latest rules
175
+ rulebook doctor # 7 health checks
176
+ rulebook validate # Check project standards
177
+ rulebook health # Health score (0-100)
178
+ rulebook fix # Auto-fix common issues
179
+ ```
180
+
181
+ ### Task Management
182
+
183
+ ```bash
184
+ rulebook task create <task-id> # Create (phase-prefixed: phase1_add-auth)
185
+ rulebook task list # List active tasks
186
+ rulebook task show <task-id> # Show details
187
+ rulebook task validate <task-id> # Validate format
188
+ rulebook task archive <task-id> # Archive completed task
189
+ rulebook task delete <task-id> # Delete permanently
190
+ ```
191
+
192
+ ### Memory & Knowledge
193
+
194
+ ```bash
195
+ rulebook memory search <query> # Hybrid BM25+vector search
196
+ rulebook memory save <text> # Save context
197
+ rulebook memory stats # Database health
198
+ rulebook memory cleanup # Evict old memories
199
+ rulebook knowledge list # View patterns and anti-patterns
200
+ rulebook learn list # View captured learnings
201
+ rulebook decision list # View architecture decisions
202
+ ```
203
+
204
+ ### Ralph Autonomous Loop
205
+
206
+ ```bash
207
+ rulebook ralph init # Generate PRD from tasks
208
+ rulebook ralph run # Execute iteration loop
209
+ rulebook ralph status # Current progress
210
+ rulebook ralph history # Past iterations
211
+ rulebook ralph pause # Gracefully pause
212
+ rulebook ralph resume # Resume from pause
213
+ ```
214
+
215
+ ### Workspace
216
+
217
+ ```bash
218
+ rulebook workspace init # Create workspace config
219
+ rulebook workspace add <path> # Add project
220
+ rulebook workspace list # List all projects
221
+ rulebook workspace status # Status with task counts
222
+ ```
223
+
224
+ ### Rules & Skills
225
+
226
+ ```bash
227
+ rulebook rules list # List rules by tier
228
+ rulebook rules add <rule> # Install from library
229
+ rulebook rules project # Project to all tools
230
+ rulebook skill list # List available skills
231
+ rulebook skill add <skill-id> # Enable a skill
232
+ rulebook skill show <skill-id> # Show skill details
233
+ ```
234
+
235
+ ### CI/CD & Quality
236
+
237
+ ```bash
238
+ rulebook workflows # Generate GitHub Actions
239
+ rulebook check-deps # Check dependencies
240
+ rulebook check-coverage # Check test coverage
241
+ rulebook version <major|minor|patch> # Bump version
242
+ rulebook changelog # Generate from git commits
243
+ ```
244
+
245
+ ---
246
+
247
+ ## Supported Stack
248
+
249
+ **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
250
+
251
+ **17 Frameworks**: NestJS, Spring Boot, Laravel, Django, Flask, Rails, Symfony, Zend, Angular, React, Vue, Nuxt, Next.js, jQuery, React Native, Flutter, Electron
252
+
253
+ **20 Services**: PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite, MongoDB, Cassandra, DynamoDB, Redis, Memcached, Elasticsearch, Neo4j, InfluxDB, RabbitMQ, Kafka, S3, Azure Blob, GCS, MinIO
254
+
255
+ **13 MCP Modules**: Vectorizer, Synap, Context7, GitHub MCP, Playwright, Memory, Supabase, Notion, Atlassian, Serena, Figma, Grafana, Sequential Thinking
256
+
257
+ **23 AI Tools**: Cursor, Windsurf, VS Code, GitHub Copilot, Tabnine, Replit, JetBrains AI, Zed, Aider, Continue, Claude, Claude Code, Gemini, Cline, Amazon Q, Auggie, CodeBuddy, Factory, OpenCode, Kilo, Codex, Codeium, Cursor CLI
258
+
259
+ ---
260
+
261
+ ## VSCode Extension
262
+
263
+ The **Rulebook Dashboard** extension provides full visibility into your AI workflow.
264
+
265
+ ```bash
266
+ code --install-extension vscode-extension/rulebook-dashboard-*.vsix
267
+ ```
268
+
269
+ | Tab | Shows |
270
+ |-----|-------|
271
+ | Agents | Team members with real-time status, memory state, last activity |
272
+ | Tasks | Progress bars, expandable details, Archive & Update buttons |
273
+ | Memory | Stats (count, DB size, types), full-text search |
274
+ | Analysis | Structured analyses with findings and execution plans |
275
+ | Doctor | 7 health checks with auto-run |
276
+ | Telemetry | MCP tool latency and success rates |
277
+
278
+ Status bar: context usage indicator (`ctx 78%` with green/yellow/red), Rulebook button, indexer state.
279
+
280
+ ---
281
+
282
+ ## Configuration
283
+
284
+ All config lives in `.rulebook/rulebook.json`:
285
+
286
+ ```json
287
+ {
288
+ "version": "5.3.0",
289
+ "mode": "full",
290
+ "features": {
291
+ "mcp": true,
292
+ "memory": true,
293
+ "ralph": true,
294
+ "multiAgent": true,
295
+ "hooks": true,
296
+ "telemetry": false
297
+ }
298
+ }
299
+ ```
300
+
301
+ **Key files generated by Rulebook:**
302
+
303
+ | File | Purpose |
304
+ |------|---------|
305
+ | `AGENTS.md` | Team-shared AI rules (regenerated on update) |
306
+ | `AGENTS.override.md` | Your project overrides (survives updates) |
307
+ | `CLAUDE.md` | Claude Code entry point with @imports |
308
+ | `.claude/rules/` | Path-scoped rules (language-specific + always-on) |
309
+ | `.claude/settings.json` | Hooks and env vars for Claude Code |
310
+ | `.rulebook/specs/` | Detailed spec templates per language/framework |
311
+ | `.rulebook/STATE.md` | Machine-written live status |
312
+ | `.rulebook/tasks/` | Active task directories |
313
+
314
+ ---
315
+
316
+ ## Documentation
317
+
318
+ Full documentation in [`/docs`](docs/):
319
+
320
+ - [Getting Started](docs/guides/GETTING_STARTED.md)
321
+ - [Best Practices](docs/guides/BEST_PRACTICES.md)
322
+ - [CLI Agents](docs/CLI_AGENTS.md)
323
+ - [Roadmap](docs/ROADMAP.md)
324
+
325
+ See the full [CHANGELOG](CHANGELOG.md) for version history.
326
+
327
+ ---
328
+
329
+ ## Contributing
330
+
331
+ Contributions welcome! Requires Node.js 20+.
332
+
333
+ ```bash
334
+ git clone https://github.com/hivellm/rulebook.git
335
+ cd rulebook
336
+ npm install
337
+ npm test
338
+ npm run build
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Acknowledgments
344
+
345
+ - **[Ralph](https://github.com/snarktank/ralph)** Inspired the autonomous loop integration (multi-iteration AI task solving with fresh context per iteration)
346
+ - **[OpenSpec](https://github.com/Fission-AI/openspec)** — Influenced the task management format (delta-based specs, Given/When/Then scenarios, requirement-focused organization)
347
+
348
+ ---
349
+
350
+ ## License
351
+
352
+ Apache License 2.0 &copy; HiveLLM Team
353
+
354
+ [Issues](https://github.com/hivellm/rulebook/issues) &middot; [Discussions](https://github.com/hivellm/rulebook/discussions) &middot; [npm](https://www.npmjs.com/package/@hivehub/rulebook)