@hivehub/rulebook 3.4.2 → 4.1.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 (173) hide show
  1. package/.claude/commands/continue.md +33 -0
  2. package/.claude-plugin/marketplace.json +28 -29
  3. package/.claude-plugin/plugin.json +8 -8
  4. package/README.md +66 -144
  5. package/dist/agents/ralph-parser.d.ts +41 -1
  6. package/dist/agents/ralph-parser.d.ts.map +1 -1
  7. package/dist/agents/ralph-parser.js +202 -14
  8. package/dist/agents/ralph-parser.js.map +1 -1
  9. package/dist/cli/commands.d.ts +65 -0
  10. package/dist/cli/commands.d.ts.map +1 -1
  11. package/dist/cli/commands.js +837 -61
  12. package/dist/cli/commands.js.map +1 -1
  13. package/dist/core/agent-manager.d.ts +7 -0
  14. package/dist/core/agent-manager.d.ts.map +1 -1
  15. package/dist/core/agent-manager.js +150 -3
  16. package/dist/core/agent-manager.js.map +1 -1
  17. package/dist/core/claude-mcp.d.ts +17 -0
  18. package/dist/core/claude-mcp.d.ts.map +1 -1
  19. package/dist/core/claude-mcp.js +90 -6
  20. package/dist/core/claude-mcp.js.map +1 -1
  21. package/dist/core/config-manager.d.ts.map +1 -1
  22. package/dist/core/config-manager.js +40 -0
  23. package/dist/core/config-manager.js.map +1 -1
  24. package/dist/core/cursor-mdc-generator.d.ts +30 -0
  25. package/dist/core/cursor-mdc-generator.d.ts.map +1 -0
  26. package/dist/core/cursor-mdc-generator.js +98 -0
  27. package/dist/core/cursor-mdc-generator.js.map +1 -0
  28. package/dist/core/detector.d.ts +25 -1
  29. package/dist/core/detector.d.ts.map +1 -1
  30. package/dist/core/detector.js +321 -1
  31. package/dist/core/detector.js.map +1 -1
  32. package/dist/core/generator.d.ts +10 -0
  33. package/dist/core/generator.d.ts.map +1 -1
  34. package/dist/core/generator.js +177 -3
  35. package/dist/core/generator.js.map +1 -1
  36. package/dist/core/github-issues-importer.d.ts +82 -0
  37. package/dist/core/github-issues-importer.d.ts.map +1 -0
  38. package/dist/core/github-issues-importer.js +161 -0
  39. package/dist/core/github-issues-importer.js.map +1 -0
  40. package/dist/core/health-scorer.d.ts +39 -0
  41. package/dist/core/health-scorer.d.ts.map +1 -1
  42. package/dist/core/health-scorer.js +256 -13
  43. package/dist/core/health-scorer.js.map +1 -1
  44. package/dist/core/indexer/background-indexer.d.ts +27 -0
  45. package/dist/core/indexer/background-indexer.d.ts.map +1 -0
  46. package/dist/core/indexer/background-indexer.js +135 -0
  47. package/dist/core/indexer/background-indexer.js.map +1 -0
  48. package/dist/core/indexer/file-parser.d.ts +28 -0
  49. package/dist/core/indexer/file-parser.d.ts.map +1 -0
  50. package/dist/core/indexer/file-parser.js +171 -0
  51. package/dist/core/indexer/file-parser.js.map +1 -0
  52. package/dist/core/indexer/indexer-types.d.ts +35 -0
  53. package/dist/core/indexer/indexer-types.d.ts.map +1 -0
  54. package/dist/core/indexer/indexer-types.js +8 -0
  55. package/dist/core/indexer/indexer-types.js.map +1 -0
  56. package/dist/core/iteration-tracker.d.ts +28 -0
  57. package/dist/core/iteration-tracker.d.ts.map +1 -1
  58. package/dist/core/iteration-tracker.js +86 -0
  59. package/dist/core/iteration-tracker.js.map +1 -1
  60. package/dist/core/multi-tool-generator.d.ts +59 -0
  61. package/dist/core/multi-tool-generator.d.ts.map +1 -0
  62. package/dist/core/multi-tool-generator.js +157 -0
  63. package/dist/core/multi-tool-generator.js.map +1 -0
  64. package/dist/core/override-manager.d.ts +23 -0
  65. package/dist/core/override-manager.d.ts.map +1 -0
  66. package/dist/core/override-manager.js +82 -0
  67. package/dist/core/override-manager.js.map +1 -0
  68. package/dist/core/plans-manager.d.ts +46 -0
  69. package/dist/core/plans-manager.d.ts.map +1 -0
  70. package/dist/core/plans-manager.js +158 -0
  71. package/dist/core/plans-manager.js.map +1 -0
  72. package/dist/core/prd-generator.d.ts +12 -0
  73. package/dist/core/prd-generator.d.ts.map +1 -1
  74. package/dist/core/prd-generator.js +91 -2
  75. package/dist/core/prd-generator.js.map +1 -1
  76. package/dist/core/ralph-manager.d.ts +47 -1
  77. package/dist/core/ralph-manager.d.ts.map +1 -1
  78. package/dist/core/ralph-manager.js +107 -0
  79. package/dist/core/ralph-manager.js.map +1 -1
  80. package/dist/core/ralph-parallel.d.ts +55 -0
  81. package/dist/core/ralph-parallel.d.ts.map +1 -0
  82. package/dist/core/ralph-parallel.js +201 -0
  83. package/dist/core/ralph-parallel.js.map +1 -0
  84. package/dist/core/ralph-plan-checkpoint.d.ts +58 -0
  85. package/dist/core/ralph-plan-checkpoint.d.ts.map +1 -0
  86. package/dist/core/ralph-plan-checkpoint.js +154 -0
  87. package/dist/core/ralph-plan-checkpoint.js.map +1 -0
  88. package/dist/core/ralph-scripts.d.ts +12 -0
  89. package/dist/core/ralph-scripts.d.ts.map +1 -0
  90. package/dist/core/ralph-scripts.js +49 -0
  91. package/dist/core/ralph-scripts.js.map +1 -0
  92. package/dist/core/review-manager.d.ts +74 -0
  93. package/dist/core/review-manager.d.ts.map +1 -0
  94. package/dist/core/review-manager.js +371 -0
  95. package/dist/core/review-manager.js.map +1 -0
  96. package/dist/index.js +94 -2
  97. package/dist/index.js.map +1 -1
  98. package/dist/mcp/rulebook-server.d.ts.map +1 -1
  99. package/dist/mcp/rulebook-server.js +117 -8
  100. package/dist/mcp/rulebook-server.js.map +1 -1
  101. package/dist/memory/memory-manager.d.ts +4 -1
  102. package/dist/memory/memory-manager.d.ts.map +1 -1
  103. package/dist/memory/memory-manager.js +33 -4
  104. package/dist/memory/memory-manager.js.map +1 -1
  105. package/dist/memory/memory-search.d.ts +2 -2
  106. package/dist/memory/memory-search.d.ts.map +1 -1
  107. package/dist/memory/memory-search.js +19 -0
  108. package/dist/memory/memory-search.js.map +1 -1
  109. package/dist/memory/memory-store.d.ts +13 -0
  110. package/dist/memory/memory-store.d.ts.map +1 -1
  111. package/dist/memory/memory-store.js +92 -1
  112. package/dist/memory/memory-store.js.map +1 -1
  113. package/dist/memory/memory-types.d.ts +15 -0
  114. package/dist/memory/memory-types.d.ts.map +1 -1
  115. package/dist/types.d.ts +55 -2
  116. package/dist/types.d.ts.map +1 -1
  117. package/package.json +1 -1
  118. package/templates/agents/implementer.md +35 -0
  119. package/templates/agents/researcher.md +34 -0
  120. package/templates/agents/team-lead.md +34 -0
  121. package/templates/agents/tester.md +42 -0
  122. package/templates/ci/rulebook-review.yml +26 -0
  123. package/templates/commands/rulebook-task-archive.md +24 -0
  124. package/templates/core/AGENTS_LEAN.md +25 -0
  125. package/templates/core/AGENTS_OVERRIDE.md +16 -0
  126. package/templates/core/MULTI_AGENT.md +74 -0
  127. package/templates/core/PLANS.md +28 -0
  128. package/templates/core/RALPH.md +45 -4
  129. package/templates/core/RULEBOOK.md +42 -0
  130. package/templates/ides/CONTINUE_RULES.md +16 -0
  131. package/templates/ides/COPILOT_INSTRUCTIONS.md +23 -0
  132. package/templates/ides/GEMINI_RULES.md +17 -0
  133. package/templates/ides/WINDSURF_RULES.md +14 -0
  134. package/templates/ides/cursor-mdc/go.mdc +24 -0
  135. package/templates/ides/cursor-mdc/python.mdc +24 -0
  136. package/templates/ides/cursor-mdc/quality.mdc +25 -0
  137. package/templates/ides/cursor-mdc/ralph.mdc +39 -0
  138. package/templates/ides/cursor-mdc/rulebook.mdc +38 -0
  139. package/templates/ides/cursor-mdc/rust.mdc +24 -0
  140. package/templates/ides/cursor-mdc/typescript.mdc +25 -0
  141. package/templates/modules/sequential-thinking.md +42 -0
  142. package/templates/ralph/ralph-history.bat +4 -0
  143. package/templates/ralph/ralph-history.sh +5 -0
  144. package/templates/ralph/ralph-init.bat +5 -0
  145. package/templates/ralph/ralph-init.sh +5 -0
  146. package/templates/ralph/ralph-pause.bat +5 -0
  147. package/templates/ralph/ralph-pause.sh +5 -0
  148. package/templates/ralph/ralph-run.bat +5 -0
  149. package/templates/ralph/ralph-run.sh +5 -0
  150. package/templates/ralph/ralph-status.bat +4 -0
  151. package/templates/ralph/ralph-status.sh +5 -0
  152. package/templates/services/DATADOG.md +26 -0
  153. package/templates/services/DOCKER.md +124 -0
  154. package/templates/services/DOCKER_COMPOSE.md +168 -0
  155. package/templates/services/HELM.md +194 -0
  156. package/templates/services/KUBERNETES.md +208 -0
  157. package/templates/services/OPENTELEMETRY.md +25 -0
  158. package/templates/services/PINO.md +24 -0
  159. package/templates/services/PROMETHEUS.md +33 -0
  160. package/templates/services/SENTRY.md +23 -0
  161. package/templates/services/WINSTON.md +30 -0
  162. package/dist/core/openspec-manager.d.ts +0 -133
  163. package/dist/core/openspec-manager.d.ts.map +0 -1
  164. package/dist/core/openspec-manager.js +0 -596
  165. package/dist/core/openspec-manager.js.map +0 -1
  166. package/dist/core/openspec-migrator.d.ts +0 -27
  167. package/dist/core/openspec-migrator.d.ts.map +0 -1
  168. package/dist/core/openspec-migrator.js +0 -262
  169. package/dist/core/openspec-migrator.js.map +0 -1
  170. package/dist/core/test-task-manager.d.ts +0 -49
  171. package/dist/core/test-task-manager.d.ts.map +0 -1
  172. package/dist/core/test-task-manager.js +0 -121
  173. package/dist/core/test-task-manager.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ <!-- MULTI_AGENT:START -->
2
+ # Multi-Agent Development Directives
3
+
4
+ ## Overview
5
+
6
+ When `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS` is enabled, Claude Code can spawn specialized sub-agents that work in parallel on complex tasks. This template defines coordination rules and team patterns for effective multi-agent development.
7
+
8
+ ## When to Use Teams
9
+
10
+ Use agent teams when:
11
+ - Tasks have clear parallel work streams (e.g., frontend + backend simultaneously)
12
+ - Research, implementation, and testing can run concurrently
13
+ - Multiple independent modules need changes at the same time
14
+ - Complex refactoring spans many files across different subsystems
15
+
16
+ Do NOT use teams when:
17
+ - The task is simple and sequential
18
+ - Changes are tightly coupled and require serial execution
19
+ - The task can be completed in under 5 minutes by a single agent
20
+
21
+ ## Team Structure Patterns
22
+
23
+ ### Standard Team (Recommended)
24
+
25
+ | Agent | Role | Responsibilities |
26
+ |-------|------|-----------------|
27
+ | **team-lead** | Orchestrator | Breaks down tasks, assigns work, integrates results |
28
+ | **researcher** | Information Gatherer | Reads code, searches docs, analyzes patterns |
29
+ | **implementer** | Code Writer | Writes production code following established patterns |
30
+ | **tester** | Quality Assurance | Writes tests, validates coverage, runs quality checks |
31
+
32
+ ### Minimal Team (Simple Tasks)
33
+
34
+ | Agent | Role |
35
+ |-------|------|
36
+ | **team-lead** | Orchestrator + integrator |
37
+ | **implementer** | Code writer + researcher |
38
+
39
+ ## Coordination Rules
40
+
41
+ 1. **Team lead assigns tasks explicitly** -- agents do not self-assign work
42
+ 2. **Agents report completion via SendMessage** -- not by writing to shared files
43
+ 3. **No two agents modify the same file simultaneously** -- team lead coordinates file ownership
44
+ 4. **Use git-friendly workflows** -- each agent works on distinct files to avoid merge conflicts
45
+ 5. **Quality gates are mandatory** -- tester agent validates all changes before completion
46
+
47
+ ## Communication Protocol
48
+
49
+ - **Task Assignment**: Team lead sends specific, scoped instructions to each agent
50
+ - **Progress Updates**: Agents report status via messages, not file-based communication
51
+ - **Blocking Issues**: Agents immediately notify team lead of blockers
52
+ - **Completion**: Agents send explicit "done" messages with summary of changes
53
+
54
+ ## File Ownership
55
+
56
+ To prevent conflicts, the team lead must:
57
+ 1. Identify all files that need modification
58
+ 2. Assign exclusive ownership of each file to one agent
59
+ 3. If multiple agents need the same file, serialize their access
60
+
61
+ ## Agent Definitions
62
+
63
+ Pre-configured agent definitions are available in `.claude/agents/`. These provide specialized instructions for each agent role, ensuring consistent behavior and expertise.
64
+
65
+ ## Quality Enforcement
66
+
67
+ All agent teams must adhere to the project's quality gates:
68
+ - Type checking must pass
69
+ - Linter must pass with zero warnings
70
+ - All tests must pass
71
+ - Coverage thresholds must be met
72
+
73
+ The tester agent is responsible for running these checks before the team lead marks a task as complete.
74
+ <!-- MULTI_AGENT:END -->
@@ -0,0 +1,28 @@
1
+ <!-- PLANS:START -->
2
+ # Project Plans & Session Context
3
+
4
+ This file is a **persistent session scratchpad** maintained by AI agents.
5
+ It provides continuity across sessions without relying on conversation history.
6
+
7
+ ## How to Use
8
+
9
+ At the **start of each session**: Read this file to understand current context.
10
+ During the **session**: Update with decisions, discoveries, and progress.
11
+ At **session end**: Write a summary to the Session History section.
12
+
13
+ ## Active Context
14
+
15
+ <!-- PLANS:CONTEXT:START -->
16
+ _No active context. Start a session to populate this section._
17
+ <!-- PLANS:CONTEXT:END -->
18
+
19
+ ## Current Task
20
+
21
+ <!-- PLANS:TASK:START -->
22
+ _No task in progress._
23
+ <!-- PLANS:TASK:END -->
24
+
25
+ ## Session History
26
+
27
+ <!-- PLANS:HISTORY:START -->
28
+ <!-- PLANS:HISTORY:END -->
@@ -94,10 +94,35 @@ Ralph automatically checks these gates after each iteration:
94
94
  | **lint** | ESLint code quality | No errors |
95
95
  | **tests** | Unit tests | All passing |
96
96
  | **coverage** | Code coverage | ≥95% |
97
+ | **security** | Vulnerability scan | No findings above `failOn` severity |
98
+
99
+ **Security Gate** scans for vulnerabilities using the first available tool:
100
+ 1. **trivy** — container and filesystem scanning (`trivy fs --format json`)
101
+ 2. **semgrep** — static analysis (`semgrep --config auto --json`)
102
+ 3. **npm audit** — Node.js dependency audit (always available in Node projects)
103
+
104
+ Configure via `.rulebook` file:
105
+ ```json
106
+ {
107
+ "ralph": {
108
+ "securityGate": {
109
+ "enabled": true,
110
+ "failOn": "high",
111
+ "tool": "auto"
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ | Setting | Default | Options | Description |
118
+ |---------|---------|---------|-------------|
119
+ | `enabled` | `true` | `true`/`false` | Enable/disable security gate |
120
+ | `failOn` | `"high"` | `critical`/`high`/`moderate`/`low` | Minimum severity to fail |
121
+ | `tool` | `"auto"` | `auto`/`npm-audit`/`trivy`/`semgrep` | Scanner to use |
97
122
 
98
123
  **Iteration Status:**
99
- - ✅ **success** - All 4 gates pass
100
- - ⚠️ **partial** - 2-3 gates pass
124
+ - ✅ **success** - All 5 gates pass
125
+ - ⚠️ **partial** - 2-4 gates pass
101
126
  - ❌ **failed** - 0-1 gates pass
102
127
 
103
128
  ### Fresh Context Strategy
@@ -177,7 +202,17 @@ Acceptance Criteria:
177
202
  "enabled": true,
178
203
  "maxIterations": 10,
179
204
  "tool": "claude",
180
- "maxContextLoss": 3
205
+ "maxContextLoss": 3,
206
+ "securityGate": {
207
+ "enabled": true,
208
+ "failOn": "high",
209
+ "tool": "auto"
210
+ },
211
+ "contextCompression": {
212
+ "enabled": true,
213
+ "recentCount": 3,
214
+ "threshold": 5
215
+ }
181
216
  }
182
217
  }
183
218
  ```
@@ -186,8 +221,14 @@ Acceptance Criteria:
186
221
  |---------|---------|-------------|
187
222
  | `enabled` | `true` | Enable Ralph features |
188
223
  | `maxIterations` | `10` | Max iterations per run |
189
- | `tool` | `claude` | Default AI tool |
224
+ | `tool` | `claude` | Default AI tool: `claude`, `amp`, `gemini` |
190
225
  | `maxContextLoss` | `3` | Allow 3 context loss events before stopping |
226
+ | `securityGate.enabled` | `true` | Enable 5th quality gate (vulnerability scan) |
227
+ | `securityGate.failOn` | `"high"` | Fail on: `critical`, `high`, `moderate`, `low` |
228
+ | `securityGate.tool` | `"auto"` | Scanner: `auto`, `npm-audit`, `trivy`, `semgrep` |
229
+ | `contextCompression.enabled` | `true` | Compress old iteration history in prompts |
230
+ | `contextCompression.recentCount` | `3` | Iterations shown in full detail |
231
+ | `contextCompression.threshold` | `5` | Min iterations before compression activates |
191
232
 
192
233
  ## MCP Integration
193
234
 
@@ -304,6 +304,48 @@ rulebook task archive <task-id> --yes
304
304
  4. Moves task to `/.rulebook/tasks/archive/YYYY-MM-DD-<task-id>/`
305
305
  5. Updates related specifications
306
306
 
307
+ ## 🚨 MANDATORY: Deferred Items → Tasks Rule
308
+
309
+ **ABSOLUTE RULE — NO EXCEPTIONS**: Whenever a task is archived with items marked as "Deferred" or "Phase X+", you MUST immediately create Rulebook tasks for those deferred items **before archiving**.
310
+
311
+ ### The Deferred Items Protocol
312
+
313
+ ```
314
+ ❌ WRONG — defer without creating task:
315
+ 1. Archive task with "- [ ] D1. feature X — deferred Phase 4"
316
+ → Feature X is now forgotten forever
317
+
318
+ ✅ CORRECT — defer with tracking:
319
+ 1. Add "- [ ] D1. feature X — deferred Phase 4" to tasks.md
320
+ 2. Call rulebook_task_create("phase4-feature-x")
321
+ 3. Write tasks.md for the new task with full context
322
+ 4. THEN call rulebook_task_archive
323
+ ```
324
+
325
+ ### tasks.md Format for Archived Tasks
326
+
327
+ ```markdown
328
+ ## 1. Implemented Feature
329
+
330
+ - [x] 1.1 Thing that was done
331
+ - [x] 1.2 Another thing done
332
+
333
+ ## Deferred to Phase N (reason: dependency not ready)
334
+
335
+ - [ ] D1. Feature X — deferred (reason) ← task phase4-feature-x MUST exist
336
+ - [ ] D2. Feature Y — deferred (reason) ← task phaseN-feature-y MUST exist
337
+ ```
338
+
339
+ ### Archive Checklist (ALL must be done before `rulebook_task_archive`)
340
+
341
+ ```
342
+ □ 1. tasks.md uses - [x] for implemented, - [ ] for deferred
343
+ □ 2. Each deferred item has a "Phase N" target
344
+ □ 3. A rulebook task exists for EVERY deferred item or group
345
+ □ 4. The new deferred tasks have tasks.md with full context
346
+ □ 5. THEN call rulebook_task_archive
347
+ ```
348
+
307
349
  ## Task Format Examples
308
350
 
309
351
  ### Correct Format ✅
@@ -0,0 +1,16 @@
1
+ <!-- RULEBOOK:START -->
2
+ # Continue.dev — Code Assistant Rules
3
+
4
+ ## Context Loading
5
+ - Always read AGENTS.md before making changes
6
+ - Check `.rulebook/specs/` for relevant spec files
7
+
8
+ ## Code Standards
9
+ - Match existing code style and conventions
10
+ - Prefer editing existing files over creating new ones
11
+ - Add types for all new parameters and return values
12
+
13
+ ## Testing
14
+ - Write tests for every new function
15
+ - Run existing tests after changes to verify no regressions
16
+ <!-- RULEBOOK:END -->
@@ -0,0 +1,23 @@
1
+ <!-- RULEBOOK:START -->
2
+ # GitHub Copilot — Project Instructions
3
+
4
+ ## Code Style
5
+ - Use TypeScript with strict mode
6
+ - Follow existing naming conventions (camelCase functions, PascalCase classes)
7
+ - Prefer `async/await` over callbacks or raw Promises
8
+
9
+ ## Architecture
10
+ - Follow the module structure described in AGENTS.md
11
+ - Keep functions small and focused (single responsibility)
12
+ - Use dependency injection over direct imports where possible
13
+
14
+ ## Testing
15
+ - Write Vitest tests for all new functions
16
+ - Place tests in `tests/` directory, not alongside source files
17
+ - Mock external dependencies in unit tests
18
+
19
+ ## Security
20
+ - Never commit credentials or API keys
21
+ - Validate all external input at system boundaries
22
+ - Follow OWASP top 10 guidelines
23
+ <!-- RULEBOOK:END -->
@@ -0,0 +1,17 @@
1
+ <!-- RULEBOOK:START -->
2
+ # Gemini CLI — Project Directives
3
+
4
+ ## Code Generation Rules
5
+ - Generate TypeScript with strict mode enabled
6
+ - Follow existing file and function naming conventions
7
+ - Always add error handling for async operations
8
+ - Generate tests alongside implementation code
9
+
10
+ ## Quality Standards
11
+ - All code must pass TypeScript type-check
12
+ - All code must pass ESLint without warnings
13
+ - Test coverage must meet project thresholds
14
+
15
+ ## Project Context
16
+ See AGENTS.md for full project architecture and team conventions.
17
+ <!-- RULEBOOK:END -->
@@ -0,0 +1,14 @@
1
+ <!-- RULEBOOK:START -->
2
+ # Windsurf — Project Rules
3
+
4
+ You are an AI assistant for this project. Follow these rules:
5
+
6
+ 1. Read AGENTS.md for full project context before starting any task
7
+ 2. Never create files in the root unless explicitly asked
8
+ 3. All TypeScript must be strict-mode compatible
9
+ 4. Write tests for new functionality
10
+ 5. Run quality checks before marking work complete
11
+
12
+ ## Project Structure
13
+ Follow the existing directory structure. See AGENTS.md for details.
14
+ <!-- RULEBOOK:END -->
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Go coding standards and best practices
3
+ globs: ["**/*.go"]
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Go Rules
8
+
9
+ See `/.rulebook/specs/GO.md` for full requirements.
10
+
11
+ ## Key Rules
12
+
13
+ - Always check and handle errors (never `_` for error returns)
14
+ - Use `errors.Is()` / `errors.As()` for error comparison
15
+ - Prefer `context.Context` for cancellation and deadlines
16
+ - Use `fmt.Errorf("...: %w", err)` for error wrapping
17
+ - Follow standard Go project layout (`cmd/`, `internal/`, `pkg/`)
18
+ - Run `gofmt` and `golangci-lint` before committing
19
+
20
+ ## Error Handling
21
+
22
+ - Return errors as last return value
23
+ - Wrap errors with context using `%w`
24
+ - Use sentinel errors for well-known conditions
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Python coding standards and best practices
3
+ globs: ["**/*.py"]
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Python Rules
8
+
9
+ See `/.rulebook/specs/PYTHON.md` for full requirements.
10
+
11
+ ## Key Rules
12
+
13
+ - Type hints required for all function signatures
14
+ - Use `dataclasses` or `pydantic` for structured data
15
+ - Prefer `pathlib.Path` over `os.path`
16
+ - Use `async/await` for I/O-bound operations
17
+ - Black formatting, ruff linting
18
+ - `__all__` in modules to control public API
19
+
20
+ ## Error Handling
21
+
22
+ - Use specific exception types (not bare `except`)
23
+ - Validate inputs at module boundaries
24
+ - Log errors with context before re-raising
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: Quality enforcement rules — type safety, linting, testing, coverage
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Quality Enforcement
7
+
8
+ See `/.rulebook/specs/QUALITY_ENFORCEMENT.md` for full requirements.
9
+
10
+ ## Mandatory Quality Gates
11
+
12
+ Every change MUST pass all quality gates before merge:
13
+
14
+ 1. **Type Check** — `npm run type-check` (zero TypeScript errors)
15
+ 2. **Lint** — `npm run lint` (zero ESLint errors)
16
+ 3. **Tests** — `npm test` (all tests pass)
17
+ 4. **Coverage** — Meet configured threshold (default 75%)
18
+
19
+ ## Code Standards
20
+
21
+ - No `any` types without explicit justification
22
+ - No unused variables or imports
23
+ - Error handling at system boundaries only
24
+ - No over-engineering: minimum complexity for the task
25
+ - No backwards-compatibility hacks for unused code
@@ -0,0 +1,39 @@
1
+ ---
2
+ description: Ralph autonomous loop directives for AI-driven task completion
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Ralph Autonomous Loop
7
+
8
+ See `/.rulebook/specs/AGENT_AUTOMATION.md` for full directives.
9
+
10
+ ## Ralph Commands
11
+
12
+ ```bash
13
+ rulebook ralph init # Initialize autonomous loop
14
+ rulebook ralph run # Start iterating on tasks
15
+ rulebook ralph status # Check progress
16
+ rulebook ralph pause # Pause for manual intervention
17
+ rulebook ralph history # View past iterations
18
+ ```
19
+
20
+ ## PRD Format
21
+
22
+ Ralph uses `.rulebook/ralph/prd.json` with `userStories[]`:
23
+
24
+ ```json
25
+ {
26
+ "id": "US-001",
27
+ "title": "Story Title",
28
+ "description": "What needs to be done",
29
+ "acceptanceCriteria": ["Must compile", "Tests pass"],
30
+ "passes": false
31
+ }
32
+ ```
33
+
34
+ ## Quality Gates
35
+
36
+ All 4 gates MUST pass per iteration:
37
+ - type-check ✓, lint ✓, tests ✓, coverage ✓
38
+
39
+ Failed gates mark the story `passes: false` for retry.
@@ -0,0 +1,38 @@
1
+ ---
2
+ description: Core Rulebook project directives and task management rules
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Project Agent Directives
7
+
8
+ Generated by @hivehub/rulebook. See `.rulebook/specs/` for detailed specifications.
9
+
10
+ ## Task Management
11
+
12
+ All tasks MUST follow the Rulebook task structure:
13
+
14
+ ```
15
+ .rulebook/tasks/<task-id>/
16
+ ├── proposal.md # Why and what changes
17
+ ├── tasks.md # Simple checklist only
18
+ └── specs/<module>/spec.md # Technical specs
19
+ ```
20
+
21
+ - Use `rulebook task create` to create tasks
22
+ - `tasks.md` contains ONLY simple checklist items
23
+ - Technical details go in `specs/<module>/spec.md`
24
+ - NEVER create README.md or PROCESS.md in task directories
25
+
26
+ ## Quality Gates
27
+
28
+ Before every commit:
29
+ - `npm run type-check` — TypeScript must compile
30
+ - `npm run lint` — Zero lint errors
31
+ - `npm test` — All tests must pass
32
+ - Coverage threshold must be met
33
+
34
+ ## Spec References
35
+
36
+ - Core rules: `/.rulebook/specs/RULEBOOK.md`
37
+ - Quality enforcement: `/.rulebook/specs/QUALITY_ENFORCEMENT.md`
38
+ - Git workflow: `/.rulebook/specs/GIT.md`
@@ -0,0 +1,24 @@
1
+ ---
2
+ description: Rust coding standards and best practices
3
+ globs: ["**/*.rs"]
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Rust Rules
8
+
9
+ See `/.rulebook/specs/RUST.md` for full requirements.
10
+
11
+ ## Key Rules
12
+
13
+ - Prefer `Result<T, E>` over `unwrap()` / `expect()`
14
+ - Use `thiserror` for library errors, `anyhow` for application errors
15
+ - Minimize `clone()` — prefer borrows and lifetimes
16
+ - Use `clippy` with `#![deny(clippy::all)]`
17
+ - Document public API with `///` doc comments
18
+ - Prefer iterator adapters over manual loops
19
+
20
+ ## Error Handling
21
+
22
+ - Propagate errors with `?` operator
23
+ - Define domain error enums with `thiserror`
24
+ - Never `panic!` in library code
@@ -0,0 +1,25 @@
1
+ ---
2
+ description: TypeScript coding standards and best practices
3
+ globs: ["**/*.ts", "**/*.tsx"]
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # TypeScript Rules
8
+
9
+ See `/.rulebook/specs/TYPESCRIPT.md` for full requirements.
10
+
11
+ ## Key Rules
12
+
13
+ - Strict mode enabled — all types must be explicit
14
+ - No `any` without justification comment
15
+ - Use `interface` for public API shapes, `type` for unions/aliases
16
+ - Prefer `async/await` over raw Promises
17
+ - Use `readonly` for immutable data
18
+ - `path.join()` for file paths (never string concatenation)
19
+ - Export only what is needed (avoid barrel re-exports)
20
+
21
+ ## Error Handling
22
+
23
+ - Validate at system boundaries (user input, external APIs)
24
+ - Use typed error classes for domain errors
25
+ - Never swallow errors silently
@@ -0,0 +1,42 @@
1
+ <!-- SEQUENTIAL_THINKING:START -->
2
+ # Sequential Thinking MCP
3
+
4
+ Sequential thinking MCP enables structured, step-by-step problem solving for complex tasks.
5
+
6
+ ## When to Use
7
+
8
+ Use sequential thinking for:
9
+ - Complex architectural decisions requiring multiple trade-off analyses
10
+ - Debugging hard-to-reproduce issues
11
+ - Planning multi-step implementations before writing code
12
+ - Tasks where mistakes are costly (data migrations, API changes)
13
+
14
+ ## Usage Pattern
15
+
16
+ ```
17
+ mcp__sequential-thinking__sequentialthinking
18
+ ```
19
+
20
+ Call with a thought/problem to explore it step by step before committing to an implementation.
21
+
22
+ ## Integration
23
+
24
+ When sequential thinking MCP is available:
25
+ 1. Start complex tasks with a thinking step to plan the approach
26
+ 2. Use it to validate assumptions before writing code
27
+ 3. Record key decisions from the thinking process in task spec files
28
+
29
+ ## Install (if not configured)
30
+
31
+ ```bash
32
+ # Add to .mcp.json
33
+ {
34
+ "mcpServers": {
35
+ "sequential-thinking": {
36
+ "command": "npx",
37
+ "args": ["-y", "@modelcontextprotocol/server-sequential-thinking"]
38
+ }
39
+ }
40
+ }
41
+ ```
42
+ <!-- SEQUENTIAL_THINKING:END -->
@@ -0,0 +1,4 @@
1
+ @echo off
2
+ REM Ralph History — View iteration history
3
+ REM Generated by @hivehub/rulebook
4
+ npx @hivehub/rulebook@latest ralph history %*
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ # Ralph History — View iteration history
3
+ # Generated by @hivehub/rulebook
4
+ echo "Loading Ralph history..."
5
+ npx @hivehub/rulebook@latest ralph history "$@"
@@ -0,0 +1,5 @@
1
+ @echo off
2
+ REM Ralph Init — Initialize autonomous loop
3
+ REM Generated by @hivehub/rulebook
4
+ echo Initializing Ralph autonomous loop...
5
+ npx @hivehub/rulebook@latest ralph init %*
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ # Ralph Init — Initialize autonomous loop
3
+ # Generated by @hivehub/rulebook
4
+ echo "Initializing Ralph autonomous loop..."
5
+ npx @hivehub/rulebook@latest ralph init "$@"
@@ -0,0 +1,5 @@
1
+ @echo off
2
+ REM Ralph Pause — Pause autonomous loop
3
+ REM Generated by @hivehub/rulebook
4
+ echo Pausing Ralph autonomous loop...
5
+ npx @hivehub/rulebook@latest ralph pause %*
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ # Ralph Pause — Pause autonomous loop
3
+ # Generated by @hivehub/rulebook
4
+ echo "Pausing Ralph autonomous loop..."
5
+ npx @hivehub/rulebook@latest ralph pause "$@"
@@ -0,0 +1,5 @@
1
+ @echo off
2
+ REM Ralph Run — Start autonomous loop
3
+ REM Generated by @hivehub/rulebook
4
+ echo Starting Ralph autonomous loop...
5
+ npx @hivehub/rulebook@latest ralph run %*
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ # Ralph Run — Start autonomous loop
3
+ # Generated by @hivehub/rulebook
4
+ echo "Starting Ralph autonomous loop..."
5
+ npx @hivehub/rulebook@latest ralph run "$@"
@@ -0,0 +1,4 @@
1
+ @echo off
2
+ REM Ralph Status — Check loop status
3
+ REM Generated by @hivehub/rulebook
4
+ npx @hivehub/rulebook@latest ralph status %*
@@ -0,0 +1,5 @@
1
+ #!/bin/sh
2
+ # Ralph Status — Check loop status
3
+ # Generated by @hivehub/rulebook
4
+ echo "Checking Ralph status..."
5
+ npx @hivehub/rulebook@latest ralph status "$@"
@@ -0,0 +1,26 @@
1
+ <!-- DATADOG:START -->
2
+ # Datadog — APM and Monitoring
3
+
4
+ ## Initialization
5
+ - Import `dd-trace` as the FIRST import in application entry point
6
+ - Configure via environment variables: `DD_AGENT_HOST`, `DD_TRACE_AGENT_PORT`, `DD_ENV`, `DD_SERVICE`, `DD_VERSION`
7
+
8
+ ## Tracing
9
+ - Use automatic instrumentation for Express, pg, Redis, etc.
10
+ - Add manual traces for business-critical operations:
11
+ ```typescript
12
+ const tracer = require('dd-trace');
13
+ const span = tracer.startSpan('operation.name');
14
+ ```
15
+
16
+ ## Logs
17
+ - Inject trace IDs into log records for correlation:
18
+ ```typescript
19
+ const span = tracer.scope().active();
20
+ if (span) log.info({ dd: { trace_id: span.context().toTraceId(), span_id: span.context().toSpanId() }, message });
21
+ ```
22
+
23
+ ## Custom Metrics
24
+ - Use `dogstatsd-client` for custom metrics: counters, gauges, histograms
25
+ - Tag metrics with `env`, `service`, `version` for consistent filtering
26
+ <!-- DATADOG:END -->