@hivehub/rulebook 3.4.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/continue.md +33 -0
- package/.claude-plugin/marketplace.json +28 -29
- package/.claude-plugin/plugin.json +8 -8
- package/README.md +32 -144
- package/dist/agents/ralph-parser.d.ts +41 -1
- package/dist/agents/ralph-parser.d.ts.map +1 -1
- package/dist/agents/ralph-parser.js +202 -14
- package/dist/agents/ralph-parser.js.map +1 -1
- package/dist/cli/commands.d.ts +65 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +837 -61
- package/dist/cli/commands.js.map +1 -1
- package/dist/core/agent-manager.d.ts +7 -0
- package/dist/core/agent-manager.d.ts.map +1 -1
- package/dist/core/agent-manager.js +150 -3
- package/dist/core/agent-manager.js.map +1 -1
- package/dist/core/claude-mcp.d.ts +17 -0
- package/dist/core/claude-mcp.d.ts.map +1 -1
- package/dist/core/claude-mcp.js +90 -6
- package/dist/core/claude-mcp.js.map +1 -1
- package/dist/core/config-manager.d.ts.map +1 -1
- package/dist/core/config-manager.js +40 -0
- package/dist/core/config-manager.js.map +1 -1
- package/dist/core/cursor-mdc-generator.d.ts +30 -0
- package/dist/core/cursor-mdc-generator.d.ts.map +1 -0
- package/dist/core/cursor-mdc-generator.js +98 -0
- package/dist/core/cursor-mdc-generator.js.map +1 -0
- package/dist/core/detector.d.ts +25 -1
- package/dist/core/detector.d.ts.map +1 -1
- package/dist/core/detector.js +321 -1
- package/dist/core/detector.js.map +1 -1
- package/dist/core/generator.d.ts +10 -0
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/generator.js +177 -3
- package/dist/core/generator.js.map +1 -1
- package/dist/core/github-issues-importer.d.ts +82 -0
- package/dist/core/github-issues-importer.d.ts.map +1 -0
- package/dist/core/github-issues-importer.js +161 -0
- package/dist/core/github-issues-importer.js.map +1 -0
- package/dist/core/health-scorer.d.ts +39 -0
- package/dist/core/health-scorer.d.ts.map +1 -1
- package/dist/core/health-scorer.js +256 -13
- package/dist/core/health-scorer.js.map +1 -1
- package/dist/core/iteration-tracker.d.ts +28 -0
- package/dist/core/iteration-tracker.d.ts.map +1 -1
- package/dist/core/iteration-tracker.js +86 -0
- package/dist/core/iteration-tracker.js.map +1 -1
- package/dist/core/multi-tool-generator.d.ts +59 -0
- package/dist/core/multi-tool-generator.d.ts.map +1 -0
- package/dist/core/multi-tool-generator.js +157 -0
- package/dist/core/multi-tool-generator.js.map +1 -0
- package/dist/core/override-manager.d.ts +23 -0
- package/dist/core/override-manager.d.ts.map +1 -0
- package/dist/core/override-manager.js +82 -0
- package/dist/core/override-manager.js.map +1 -0
- package/dist/core/plans-manager.d.ts +46 -0
- package/dist/core/plans-manager.d.ts.map +1 -0
- package/dist/core/plans-manager.js +158 -0
- package/dist/core/plans-manager.js.map +1 -0
- package/dist/core/prd-generator.d.ts +12 -0
- package/dist/core/prd-generator.d.ts.map +1 -1
- package/dist/core/prd-generator.js +91 -2
- package/dist/core/prd-generator.js.map +1 -1
- package/dist/core/ralph-manager.d.ts +47 -1
- package/dist/core/ralph-manager.d.ts.map +1 -1
- package/dist/core/ralph-manager.js +107 -0
- package/dist/core/ralph-manager.js.map +1 -1
- package/dist/core/ralph-parallel.d.ts +55 -0
- package/dist/core/ralph-parallel.d.ts.map +1 -0
- package/dist/core/ralph-parallel.js +201 -0
- package/dist/core/ralph-parallel.js.map +1 -0
- package/dist/core/ralph-plan-checkpoint.d.ts +58 -0
- package/dist/core/ralph-plan-checkpoint.d.ts.map +1 -0
- package/dist/core/ralph-plan-checkpoint.js +154 -0
- package/dist/core/ralph-plan-checkpoint.js.map +1 -0
- package/dist/core/ralph-scripts.d.ts +12 -0
- package/dist/core/ralph-scripts.d.ts.map +1 -0
- package/dist/core/ralph-scripts.js +49 -0
- package/dist/core/ralph-scripts.js.map +1 -0
- package/dist/core/review-manager.d.ts +74 -0
- package/dist/core/review-manager.d.ts.map +1 -0
- package/dist/core/review-manager.js +371 -0
- package/dist/core/review-manager.js.map +1 -0
- package/dist/index.js +94 -2
- package/dist/index.js.map +1 -1
- package/dist/mcp/rulebook-server.d.ts.map +1 -1
- package/dist/mcp/rulebook-server.js +9 -2
- package/dist/mcp/rulebook-server.js.map +1 -1
- package/dist/memory/memory-store.d.ts.map +1 -1
- package/dist/memory/memory-store.js +4 -0
- package/dist/memory/memory-store.js.map +1 -1
- package/dist/types.d.ts +55 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/templates/agents/implementer.md +35 -0
- package/templates/agents/researcher.md +34 -0
- package/templates/agents/team-lead.md +34 -0
- package/templates/agents/tester.md +42 -0
- package/templates/ci/rulebook-review.yml +26 -0
- package/templates/core/AGENTS_LEAN.md +25 -0
- package/templates/core/AGENTS_OVERRIDE.md +16 -0
- package/templates/core/MULTI_AGENT.md +74 -0
- package/templates/core/PLANS.md +28 -0
- package/templates/core/RALPH.md +45 -4
- package/templates/ides/CONTINUE_RULES.md +16 -0
- package/templates/ides/COPILOT_INSTRUCTIONS.md +23 -0
- package/templates/ides/GEMINI_RULES.md +17 -0
- package/templates/ides/WINDSURF_RULES.md +14 -0
- package/templates/ides/cursor-mdc/go.mdc +24 -0
- package/templates/ides/cursor-mdc/python.mdc +24 -0
- package/templates/ides/cursor-mdc/quality.mdc +25 -0
- package/templates/ides/cursor-mdc/ralph.mdc +39 -0
- package/templates/ides/cursor-mdc/rulebook.mdc +38 -0
- package/templates/ides/cursor-mdc/rust.mdc +24 -0
- package/templates/ides/cursor-mdc/typescript.mdc +25 -0
- package/templates/modules/sequential-thinking.md +42 -0
- package/templates/ralph/ralph-history.bat +4 -0
- package/templates/ralph/ralph-history.sh +5 -0
- package/templates/ralph/ralph-init.bat +5 -0
- package/templates/ralph/ralph-init.sh +5 -0
- package/templates/ralph/ralph-pause.bat +5 -0
- package/templates/ralph/ralph-pause.sh +5 -0
- package/templates/ralph/ralph-run.bat +5 -0
- package/templates/ralph/ralph-run.sh +5 -0
- package/templates/ralph/ralph-status.bat +4 -0
- package/templates/ralph/ralph-status.sh +5 -0
- package/templates/services/DATADOG.md +26 -0
- package/templates/services/DOCKER.md +124 -0
- package/templates/services/DOCKER_COMPOSE.md +168 -0
- package/templates/services/HELM.md +194 -0
- package/templates/services/KUBERNETES.md +208 -0
- package/templates/services/OPENTELEMETRY.md +25 -0
- package/templates/services/PINO.md +24 -0
- package/templates/services/PROMETHEUS.md +33 -0
- package/templates/services/SENTRY.md +23 -0
- package/templates/services/WINSTON.md +30 -0
- package/dist/core/openspec-manager.d.ts +0 -133
- package/dist/core/openspec-manager.d.ts.map +0 -1
- package/dist/core/openspec-manager.js +0 -596
- package/dist/core/openspec-manager.js.map +0 -1
- package/dist/core/openspec-migrator.d.ts +0 -27
- package/dist/core/openspec-migrator.d.ts.map +0 -1
- package/dist/core/openspec-migrator.js +0 -262
- package/dist/core/openspec-migrator.js.map +0 -1
- package/dist/core/test-task-manager.d.ts +0 -49
- package/dist/core/test-task-manager.d.ts.map +0 -1
- package/dist/core/test-task-manager.js +0 -121
- package/dist/core/test-task-manager.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<!-- RULEBOOK:START -->
|
|
2
|
+
# Project Agent Directives
|
|
3
|
+
|
|
4
|
+
Generated by @hivehub/rulebook (lean mode). Spec files are in `/.rulebook/specs/`.
|
|
5
|
+
|
|
6
|
+
## Core Rules
|
|
7
|
+
|
|
8
|
+
- **Task Management**: `/.rulebook/specs/RULEBOOK.md` ← ALWAYS READ FIRST
|
|
9
|
+
- **Quality Gates**: `/.rulebook/specs/QUALITY_ENFORCEMENT.md`
|
|
10
|
+
- **Git Workflow**: `/.rulebook/specs/GIT.md`
|
|
11
|
+
- **Session Context**: `PLANS.md` ← read this at session start for current task context
|
|
12
|
+
|
|
13
|
+
## Language & Framework Rules
|
|
14
|
+
|
|
15
|
+
LANGUAGE_REFS
|
|
16
|
+
|
|
17
|
+
## Module Rules
|
|
18
|
+
|
|
19
|
+
MODULE_REFS
|
|
20
|
+
|
|
21
|
+
## How to Use
|
|
22
|
+
|
|
23
|
+
Reference the appropriate spec file before working on a specific area.
|
|
24
|
+
Run `rulebook task create` to create tasks. Run `rulebook continue` for session context.
|
|
25
|
+
<!-- RULEBOOK:END -->
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- OVERRIDE:START -->
|
|
2
|
+
# Project-Specific Overrides
|
|
3
|
+
|
|
4
|
+
This file contains project-specific directives that take precedence over the generated AGENTS.md.
|
|
5
|
+
|
|
6
|
+
Add your custom rules, team conventions, or project-specific context here.
|
|
7
|
+
This file is NEVER overwritten by `rulebook init` or `rulebook update`.
|
|
8
|
+
|
|
9
|
+
## Example Overrides
|
|
10
|
+
|
|
11
|
+
- **Preferred patterns**: Always use X pattern for Y
|
|
12
|
+
- **Team conventions**: Code reviews require 2 approvals
|
|
13
|
+
- **Project context**: This project targets Node.js 20+ only
|
|
14
|
+
- **Custom quality gates**: Run `npm run e2e` before merging
|
|
15
|
+
|
|
16
|
+
<!-- OVERRIDE:END -->
|
|
@@ -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 -->
|
package/templates/core/RALPH.md
CHANGED
|
@@ -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
|
|
100
|
-
- ⚠️ **partial** - 2-
|
|
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
|
|
|
@@ -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,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 -->
|