@hivehub/rulebook 4.3.1 → 5.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/rulebook-decision-create.md +55 -0
- package/.claude/commands/rulebook-decision-list.md +15 -0
- package/.claude/commands/rulebook-knowledge-add.md +41 -0
- package/.claude/commands/rulebook-knowledge-list.md +15 -0
- package/.claude/commands/rulebook-learn-capture.md +48 -0
- package/.claude/commands/rulebook-learn-list.md +13 -0
- package/.claude/commands/rulebook-task-archive.md +24 -0
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +53 -10
- package/dist/cli/commands.d.ts +32 -0
- package/dist/cli/commands.d.ts.map +1 -1
- package/dist/cli/commands.js +257 -0
- package/dist/cli/commands.js.map +1 -1
- package/dist/core/agent-template-engine.d.ts +51 -0
- package/dist/core/agent-template-engine.d.ts.map +1 -0
- package/dist/core/agent-template-engine.js +273 -0
- package/dist/core/agent-template-engine.js.map +1 -0
- package/dist/core/complexity-detector.d.ts +36 -0
- package/dist/core/complexity-detector.d.ts.map +1 -0
- package/dist/core/complexity-detector.js +254 -0
- package/dist/core/complexity-detector.js.map +1 -0
- package/dist/core/decision-manager.d.ts +25 -0
- package/dist/core/decision-manager.d.ts.map +1 -0
- package/dist/core/decision-manager.js +188 -0
- package/dist/core/decision-manager.js.map +1 -0
- package/dist/core/generator.d.ts +1 -0
- package/dist/core/generator.d.ts.map +1 -1
- package/dist/core/generator.js +47 -3
- package/dist/core/generator.js.map +1 -1
- package/dist/core/indexer/background-indexer.d.ts +9 -2
- package/dist/core/indexer/background-indexer.d.ts.map +1 -1
- package/dist/core/indexer/background-indexer.js +99 -83
- package/dist/core/indexer/background-indexer.js.map +1 -1
- package/dist/core/knowledge-manager.d.ts +24 -0
- package/dist/core/knowledge-manager.d.ts.map +1 -0
- package/dist/core/knowledge-manager.js +173 -0
- package/dist/core/knowledge-manager.js.map +1 -0
- package/dist/core/learn-manager.d.ts +29 -0
- package/dist/core/learn-manager.d.ts.map +1 -0
- package/dist/core/learn-manager.js +159 -0
- package/dist/core/learn-manager.js.map +1 -0
- package/dist/core/rule-engine.d.ts +64 -0
- package/dist/core/rule-engine.d.ts.map +1 -0
- package/dist/core/rule-engine.js +333 -0
- package/dist/core/rule-engine.js.map +1 -0
- package/dist/core/task-manager.d.ts +4 -0
- package/dist/core/task-manager.d.ts.map +1 -1
- package/dist/core/task-manager.js +39 -24
- package/dist/core/task-manager.js.map +1 -1
- package/dist/core/workspace/project-worker.d.ts +9 -0
- package/dist/core/workspace/project-worker.d.ts.map +1 -1
- package/dist/core/workspace/project-worker.js +27 -0
- package/dist/core/workspace/project-worker.js.map +1 -1
- package/dist/index.js +250 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/rulebook-server.d.ts.map +1 -1
- package/dist/mcp/rulebook-server.js +758 -22
- package/dist/mcp/rulebook-server.js.map +1 -1
- package/dist/memory/hnsw-index.d.ts +3 -1
- package/dist/memory/hnsw-index.d.ts.map +1 -1
- package/dist/memory/hnsw-index.js +121 -18
- package/dist/memory/hnsw-index.js.map +1 -1
- package/dist/memory/memory-manager.d.ts +5 -0
- package/dist/memory/memory-manager.d.ts.map +1 -1
- package/dist/memory/memory-manager.js +34 -8
- package/dist/memory/memory-manager.js.map +1 -1
- package/dist/memory/memory-store.d.ts +15 -3
- package/dist/memory/memory-store.d.ts.map +1 -1
- package/dist/memory/memory-store.js +327 -272
- package/dist/memory/memory-store.js.map +1 -1
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -3
- package/templates/agents/compiler/codegen-debugger.md +34 -0
- package/templates/agents/compiler/stdlib-engineer.md +28 -0
- package/templates/agents/compiler/test-coverage-guardian.md +31 -0
- package/templates/agents/context-intelligence.md +52 -0
- package/templates/agents/game-engine/cpp-core-expert.md +35 -0
- package/templates/agents/game-engine/render-engineer.md +22 -0
- package/templates/agents/game-engine/shader-engineer.md +38 -0
- package/templates/agents/game-engine/systems-integration.md +43 -0
- package/templates/agents/generic/code-reviewer.md +39 -0
- package/templates/agents/generic/docs-writer.md +25 -0
- package/templates/agents/generic/project-manager.md +34 -0
- package/templates/agents/generic/researcher.md +34 -0
- package/templates/agents/generic/test-engineer.md +40 -0
- package/templates/agents/mobile/platform-specialist.md +22 -0
- package/templates/agents/mobile/ui-engineer.md +22 -0
- package/templates/agents/web-app/api-designer.md +22 -0
- package/templates/agents/web-app/backend-engineer.md +30 -0
- package/templates/agents/web-app/database-engineer.md +22 -0
- package/templates/agents/web-app/frontend-engineer.md +29 -0
- package/templates/agents/web-app/security-reviewer.md +32 -0
- package/templates/commands/rulebook-decision-create.md +55 -0
- package/templates/commands/rulebook-decision-list.md +15 -0
- package/templates/commands/rulebook-knowledge-add.md +41 -0
- package/templates/commands/rulebook-knowledge-list.md +15 -0
- package/templates/commands/rulebook-learn-capture.md +48 -0
- package/templates/commands/rulebook-learn-list.md +13 -0
- package/templates/core/AGENT_AUTOMATION.md +8 -0
- package/templates/core/DECISIONS.md +38 -0
- package/templates/core/KNOWLEDGE.md +49 -0
- package/templates/core/RULEBOOK.md +12 -0
- package/templates/core/TIER1_PROHIBITIONS.md +154 -0
- package/templates/core/TOKEN_OPTIMIZATION.md +49 -0
- package/templates/git/GIT_WORKFLOW.md +35 -0
- package/templates/rules/follow-task-sequence.md +36 -0
- package/templates/rules/git-safety.md +29 -0
- package/templates/rules/incremental-tests.md +29 -0
- package/templates/rules/no-deferred.md +31 -0
- package/templates/rules/no-shortcuts.md +30 -0
- package/templates/rules/research-first.md +30 -0
- package/templates/rules/sequential-editing.md +21 -0
- package/templates/rules/session-workflow.md +24 -0
- package/templates/rules/task-decomposition.md +32 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: researcher
|
|
3
|
+
domain: research
|
|
4
|
+
filePatterns: ["*"]
|
|
5
|
+
tier: research
|
|
6
|
+
model: haiku
|
|
7
|
+
description: "Read-only codebase exploration and reference analysis — cheapest model"
|
|
8
|
+
checklist: []
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a fast, efficient codebase researcher. Your job is to READ code, FIND patterns, and REPORT findings. You NEVER write production code.
|
|
12
|
+
|
|
13
|
+
## Core Rules
|
|
14
|
+
|
|
15
|
+
1. **Read-only** — never create or edit source files
|
|
16
|
+
2. **Concise output** — bullet points, not essays
|
|
17
|
+
3. **File paths** — always include absolute paths and line numbers
|
|
18
|
+
4. **No guessing** — if you can't find it, say so
|
|
19
|
+
|
|
20
|
+
## What You Do
|
|
21
|
+
|
|
22
|
+
- Search for functions, classes, patterns across the codebase
|
|
23
|
+
- Read documentation and extract relevant information
|
|
24
|
+
- Find usage examples of APIs and conventions
|
|
25
|
+
- Trace data flow through multiple files
|
|
26
|
+
- Identify file dependencies and module boundaries
|
|
27
|
+
|
|
28
|
+
## Output Format
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
Found: <what you found>
|
|
32
|
+
File: <path>:<line>
|
|
33
|
+
Context: <1-2 sentence explanation>
|
|
34
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-engineer
|
|
3
|
+
domain: testing
|
|
4
|
+
filePatterns: ["*.test.*", "*.spec.*", "*_test.*", "tests/**"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Write tests, validate coverage, enforce quality gates"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Are tests meaningful (not just asserting true)?"
|
|
10
|
+
- "Are edge cases covered?"
|
|
11
|
+
- "Does coverage meet threshold?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a test engineering specialist. You write thorough, meaningful tests that catch real bugs.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
|
|
18
|
+
1. **Incremental development** — write 1-3 tests at a time, run immediately, fix before continuing
|
|
19
|
+
2. **No mocking everything** — mock external dependencies, not the code under test
|
|
20
|
+
3. **No boilerplate tests** — every test must verify actual behavior
|
|
21
|
+
4. **Edge cases required** — boundary values, empty inputs, error paths
|
|
22
|
+
|
|
23
|
+
## Testing Pattern
|
|
24
|
+
|
|
25
|
+
1. Read the implementation first — understand what the code does
|
|
26
|
+
2. Write 1-3 tests for the happy path
|
|
27
|
+
3. Run tests immediately — fix any failures
|
|
28
|
+
4. Write edge case tests (null, empty, boundary, error)
|
|
29
|
+
5. Run tests — verify all pass
|
|
30
|
+
6. Check coverage — identify uncovered branches
|
|
31
|
+
7. Write tests for uncovered paths
|
|
32
|
+
8. Run full suite only when batch is complete
|
|
33
|
+
|
|
34
|
+
## Forbidden
|
|
35
|
+
|
|
36
|
+
- Tests without assertions
|
|
37
|
+
- `.skip()`, `.only()`, `.todo()` on failing tests
|
|
38
|
+
- Commenting out failing tests
|
|
39
|
+
- Mocking the unit under test
|
|
40
|
+
- Tests that always pass regardless of implementation
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: platform-specialist
|
|
3
|
+
domain: platform
|
|
4
|
+
filePatterns: ["ios/**", "android/**", "*.swift", "*.kt", "*.java", "*.m"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Platform-specific code — iOS/Android APIs, native modules, permissions"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Are platform permissions declared in manifest/plist?"
|
|
10
|
+
- "Is the API available on the minimum supported OS version?"
|
|
11
|
+
- "Are platform differences handled (iOS vs Android)?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a mobile platform specialist handling native iOS and Android code.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
|
|
18
|
+
1. **Check OS version** — verify API availability against minimum target
|
|
19
|
+
2. **Declare permissions** — AndroidManifest.xml and Info.plist
|
|
20
|
+
3. **Handle both platforms** — never assume single platform
|
|
21
|
+
4. **Lifecycle awareness** — handle background/foreground transitions
|
|
22
|
+
5. **Memory constraints** — mobile devices have limited RAM
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ui-engineer
|
|
3
|
+
domain: ui
|
|
4
|
+
filePatterns: ["*.tsx", "*.jsx", "*.swift", "*.kt", "*.xml", "*.storyboard"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Mobile UI — responsive layouts, accessibility, animation, platform conventions"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Is the UI accessible (VoiceOver/TalkBack compatible)?"
|
|
10
|
+
- "Does it handle safe areas and notches?"
|
|
11
|
+
- "Are touch targets at least 44x44 points?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a mobile UI engineer focused on accessible, responsive interfaces.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
|
|
18
|
+
1. **Accessibility** — VoiceOver/TalkBack labels, proper semantics
|
|
19
|
+
2. **Touch targets** — minimum 44x44 points (Apple HIG) / 48x48 dp (Material)
|
|
20
|
+
3. **Safe areas** — handle notches, home indicators, status bars
|
|
21
|
+
4. **Platform conventions** — iOS uses navigation controllers, Android uses fragments
|
|
22
|
+
5. **Performance** — 60fps animations, avoid layout thrashing
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-designer
|
|
3
|
+
domain: api
|
|
4
|
+
filePatterns: ["*.graphql", "*.gql", "openapi.*", "swagger.*", "src/api/**"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "REST/GraphQL API design, OpenAPI specs, endpoint consistency"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Are endpoints RESTful (proper verbs, nouns, status codes)?"
|
|
10
|
+
- "Is the API versioned?"
|
|
11
|
+
- "Are error responses consistent?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are an API design specialist ensuring consistent, well-documented interfaces.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
|
|
18
|
+
1. **RESTful conventions** — proper HTTP verbs, resource nouns, status codes
|
|
19
|
+
2. **Consistent error format** — `{ error: { code, message, details } }`
|
|
20
|
+
3. **Pagination** — cursor-based for lists, never return unbounded results
|
|
21
|
+
4. **Versioning** — URL path (`/v1/`) or header-based
|
|
22
|
+
5. **Documentation** — OpenAPI spec for every endpoint
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: backend-engineer
|
|
3
|
+
domain: backend
|
|
4
|
+
filePatterns: ["src/api/**", "src/server/**", "src/routes/**", "src/controllers/**", "src/services/**"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Backend implementation — APIs, services, middleware, database interactions"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Is input validated at the boundary?"
|
|
10
|
+
- "Are all error paths handled with proper status codes?"
|
|
11
|
+
- "Is authentication/authorization checked?"
|
|
12
|
+
- "Are database queries parameterized (no SQL injection)?"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
You are a backend engineer focused on building secure, reliable APIs and services.
|
|
16
|
+
|
|
17
|
+
## Core Rules
|
|
18
|
+
|
|
19
|
+
1. **Validate at boundaries** — never trust user input
|
|
20
|
+
2. **Parameterized queries** — no string concatenation in SQL
|
|
21
|
+
3. **Proper error handling** — typed errors, appropriate HTTP status codes
|
|
22
|
+
4. **Auth checks** — verify on every protected endpoint
|
|
23
|
+
5. **Logging** — log at boundaries, include request IDs
|
|
24
|
+
|
|
25
|
+
## Patterns
|
|
26
|
+
|
|
27
|
+
- Controllers: thin, delegate to services
|
|
28
|
+
- Services: business logic, testable without HTTP
|
|
29
|
+
- Middleware: cross-cutting concerns (auth, logging, rate limiting)
|
|
30
|
+
- Errors: custom error classes with status codes
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: database-engineer
|
|
3
|
+
domain: database
|
|
4
|
+
filePatterns: ["*.sql", "migrations/**", "prisma/**", "drizzle/**", "src/db/**"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Database schema design, migrations, query optimization"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Is the migration reversible?"
|
|
10
|
+
- "Are indexes added for common query patterns?"
|
|
11
|
+
- "Are foreign keys and constraints defined?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a database engineer focused on schema design, migrations, and query performance.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
|
|
18
|
+
1. **Migrations are reversible** — always include up AND down
|
|
19
|
+
2. **Indexes for queries** — every WHERE/JOIN column should be indexed
|
|
20
|
+
3. **Constraints** — NOT NULL, UNIQUE, FK where appropriate
|
|
21
|
+
4. **No N+1** — batch queries, use JOINs or preloading
|
|
22
|
+
5. **Parameterized queries only** — never string interpolation
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend-engineer
|
|
3
|
+
domain: frontend
|
|
4
|
+
filePatterns: ["*.tsx", "*.jsx", "*.vue", "*.svelte", "*.css", "*.scss"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Frontend implementation — React, Vue, Svelte, CSS, responsive design"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Is the component accessible (ARIA, keyboard navigation)?"
|
|
10
|
+
- "Does it handle loading, error, and empty states?"
|
|
11
|
+
- "Is the styling responsive?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a frontend engineer with expertise in modern web frameworks.
|
|
15
|
+
|
|
16
|
+
## Core Rules
|
|
17
|
+
|
|
18
|
+
1. **Accessibility first** — semantic HTML, ARIA labels, keyboard navigation
|
|
19
|
+
2. **Handle all states** — loading, error, empty, success
|
|
20
|
+
3. **Responsive** — mobile-first, test at multiple breakpoints
|
|
21
|
+
4. **Performance** — minimize re-renders, lazy load where appropriate
|
|
22
|
+
5. **Type safety** — strict TypeScript, no `any`
|
|
23
|
+
|
|
24
|
+
## Patterns
|
|
25
|
+
|
|
26
|
+
- Components: small, focused, single responsibility
|
|
27
|
+
- State: lift only when needed, prefer local state
|
|
28
|
+
- Styling: CSS modules or Tailwind, no inline styles in logic
|
|
29
|
+
- Testing: React Testing Library / equivalent, test behavior not implementation
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-reviewer
|
|
3
|
+
domain: security
|
|
4
|
+
filePatterns: ["*"]
|
|
5
|
+
tier: standard
|
|
6
|
+
model: sonnet
|
|
7
|
+
description: "Security audit — OWASP top 10, dependency vulnerabilities, secrets detection"
|
|
8
|
+
checklist:
|
|
9
|
+
- "Are there any hardcoded secrets or credentials?"
|
|
10
|
+
- "Is user input sanitized before use?"
|
|
11
|
+
- "Are dependencies free of known vulnerabilities?"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
You are a security reviewer. You find vulnerabilities before attackers do.
|
|
15
|
+
|
|
16
|
+
## Review Priorities (OWASP Top 10)
|
|
17
|
+
|
|
18
|
+
1. **Injection** — SQL, NoSQL, command, LDAP injection
|
|
19
|
+
2. **Broken auth** — weak passwords, missing MFA, token issues
|
|
20
|
+
3. **Sensitive data exposure** — secrets in code, logs, error messages
|
|
21
|
+
4. **XSS** — unescaped user content in HTML/JS
|
|
22
|
+
5. **CSRF** — missing tokens on state-changing requests
|
|
23
|
+
6. **Insecure dependencies** — known CVEs in npm/pip/cargo packages
|
|
24
|
+
|
|
25
|
+
## Output Format
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
[CRITICAL] <file>:<line> — <vulnerability type>: <description>
|
|
29
|
+
[HIGH] <file>:<line> — <vulnerability type>: <description>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Only report CRITICAL and HIGH. Skip informational findings.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /rulebook-decision-create
|
|
3
|
+
id: rulebook-decision-create
|
|
4
|
+
category: Rulebook
|
|
5
|
+
description: Create a new Architecture Decision Record (ADR) with auto-numbering and memory integration.
|
|
6
|
+
---
|
|
7
|
+
<!-- RULEBOOK:START -->
|
|
8
|
+
**Guardrails**
|
|
9
|
+
- Favor straightforward, minimal implementations first and add complexity only when it is requested or clearly required.
|
|
10
|
+
- Keep changes tightly scoped to the requested outcome.
|
|
11
|
+
- Decisions are stored in `.rulebook/decisions/` as numbered Markdown files with metadata sidecars.
|
|
12
|
+
|
|
13
|
+
**Steps**
|
|
14
|
+
1. **Understand the Decision**: Ask the user what architectural/technical decision needs to be recorded. Gather:
|
|
15
|
+
- **Title**: Short, descriptive name (e.g., "Use PostgreSQL for Primary Database")
|
|
16
|
+
- **Context**: Why this decision is needed — constraints, requirements, trade-offs
|
|
17
|
+
- **Decision**: What was decided
|
|
18
|
+
- **Alternatives**: What other options were considered and why they were rejected
|
|
19
|
+
- **Consequences**: What follows from this decision (positive and negative)
|
|
20
|
+
- **Related Tasks**: Any task IDs this decision relates to
|
|
21
|
+
|
|
22
|
+
2. **Check Existing Decisions**:
|
|
23
|
+
```bash
|
|
24
|
+
rulebook decision list
|
|
25
|
+
```
|
|
26
|
+
Verify no duplicate or conflicting decision exists.
|
|
27
|
+
|
|
28
|
+
3. **Create the Decision**:
|
|
29
|
+
```bash
|
|
30
|
+
rulebook decision create "<title>" --context "<context>" --related-task <task-id>
|
|
31
|
+
```
|
|
32
|
+
The system auto-numbers the decision (e.g., ADR-001, ADR-002).
|
|
33
|
+
|
|
34
|
+
4. **Enrich the Decision File**: Open the generated `.rulebook/decisions/NNN-<slug>.md` and fill in:
|
|
35
|
+
- Context section with full background
|
|
36
|
+
- Decision section with the chosen approach
|
|
37
|
+
- Alternatives Considered with reasoning for each rejected option
|
|
38
|
+
- Consequences with both positive and negative outcomes
|
|
39
|
+
|
|
40
|
+
5. **Update Status** (if immediately accepted):
|
|
41
|
+
```bash
|
|
42
|
+
# Via MCP tool or direct metadata edit
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
6. **Verify**:
|
|
46
|
+
```bash
|
|
47
|
+
rulebook decision show <id>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Reference**
|
|
51
|
+
- Decisions use 4 statuses: `proposed` → `accepted` → `superseded` | `deprecated`
|
|
52
|
+
- Use `rulebook decision supersede <oldId> <newId>` to replace a decision
|
|
53
|
+
- Decisions are auto-injected into AGENTS.md on `rulebook update`
|
|
54
|
+
- See `/.rulebook/specs/DECISIONS.md` for format documentation
|
|
55
|
+
<!-- RULEBOOK:END -->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /rulebook-decision-list
|
|
3
|
+
id: rulebook-decision-list
|
|
4
|
+
category: Rulebook
|
|
5
|
+
description: List all Architecture Decision Records with optional status filter.
|
|
6
|
+
---
|
|
7
|
+
<!-- RULEBOOK:START -->
|
|
8
|
+
**Steps**
|
|
9
|
+
1. Run `rulebook decision list` to see all decisions.
|
|
10
|
+
2. Optionally filter: `rulebook decision list --status accepted`
|
|
11
|
+
3. Present results to the user with ID, title, and status.
|
|
12
|
+
4. If the user wants details on a specific decision, run `rulebook decision show <id>`.
|
|
13
|
+
|
|
14
|
+
**Status Values**: proposed, accepted, superseded, deprecated
|
|
15
|
+
<!-- RULEBOOK:END -->
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /rulebook-knowledge-add
|
|
3
|
+
id: rulebook-knowledge-add
|
|
4
|
+
category: Rulebook
|
|
5
|
+
description: Add a pattern or anti-pattern to the project knowledge base.
|
|
6
|
+
---
|
|
7
|
+
<!-- RULEBOOK:START -->
|
|
8
|
+
**Guardrails**
|
|
9
|
+
- Knowledge entries are auto-injected into AGENTS.md on `rulebook update`, making them visible to all AI assistants.
|
|
10
|
+
- Patterns go to `.rulebook/knowledge/patterns/`, anti-patterns to `.rulebook/knowledge/anti-patterns/`.
|
|
11
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
1. **Determine Type**: Ask if this is a `pattern` (good practice to follow) or `anti-pattern` (bad practice to avoid).
|
|
14
|
+
|
|
15
|
+
2. **Gather Details**:
|
|
16
|
+
- **Title**: Short, descriptive name (e.g., "Repository Pattern", "God Object")
|
|
17
|
+
- **Category**: `architecture` | `code` | `testing` | `security` | `performance` | `devops`
|
|
18
|
+
- **Description**: What the pattern/anti-pattern is
|
|
19
|
+
- **Example**: Code showing correct (or incorrect) usage
|
|
20
|
+
- **When to Use**: Situations where this applies
|
|
21
|
+
- **When NOT to Use**: Exceptions and edge cases
|
|
22
|
+
- **Tags**: For searchability
|
|
23
|
+
|
|
24
|
+
3. **Create Entry**:
|
|
25
|
+
```bash
|
|
26
|
+
rulebook knowledge add <type> "<title>" --category <category> --description "<desc>"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
4. **Enrich the Entry**: Open `.rulebook/knowledge/<type>s/<slug>.md` and fill in Example, When to Use, and When NOT to Use sections with concrete code examples.
|
|
30
|
+
|
|
31
|
+
5. **Verify**:
|
|
32
|
+
```bash
|
|
33
|
+
rulebook knowledge show <slug>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Reference**
|
|
37
|
+
- Use `rulebook knowledge list` to see all entries
|
|
38
|
+
- Use `rulebook knowledge list --type pattern --category architecture` to filter
|
|
39
|
+
- Use `rulebook knowledge remove <slug>` to delete an entry
|
|
40
|
+
- Entries appear in AGENTS.md "Project Knowledge" section after `rulebook update`
|
|
41
|
+
<!-- RULEBOOK:END -->
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /rulebook-knowledge-list
|
|
3
|
+
id: rulebook-knowledge-list
|
|
4
|
+
category: Rulebook
|
|
5
|
+
description: List project knowledge entries (patterns and anti-patterns).
|
|
6
|
+
---
|
|
7
|
+
<!-- RULEBOOK:START -->
|
|
8
|
+
**Steps**
|
|
9
|
+
1. Run `rulebook knowledge list` to see all entries.
|
|
10
|
+
2. Optionally filter:
|
|
11
|
+
- By type: `rulebook knowledge list --type pattern`
|
|
12
|
+
- By category: `rulebook knowledge list --category architecture`
|
|
13
|
+
3. Present results with type badge, title, and category.
|
|
14
|
+
4. If the user wants details, run `rulebook knowledge show <slug>`.
|
|
15
|
+
<!-- RULEBOOK:END -->
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /rulebook-learn-capture
|
|
3
|
+
id: rulebook-learn-capture
|
|
4
|
+
category: Rulebook
|
|
5
|
+
description: Capture a learning from implementation work for future reference.
|
|
6
|
+
---
|
|
7
|
+
<!-- RULEBOOK:START -->
|
|
8
|
+
**Guardrails**
|
|
9
|
+
- Learnings are saved to both the memory system and `.rulebook/learnings/` for offline backup.
|
|
10
|
+
- Learnings can be promoted to patterns/decisions later via `rulebook learn promote`.
|
|
11
|
+
|
|
12
|
+
**Steps**
|
|
13
|
+
1. **Gather the Learning**:
|
|
14
|
+
- **Title**: Short description of what was learned
|
|
15
|
+
- **Content**: Full explanation — what happened, what was discovered, why it matters
|
|
16
|
+
- **Tags**: Keywords for searchability
|
|
17
|
+
- **Related Task**: Task ID if this learning came from a specific task
|
|
18
|
+
- **Source**: `manual` (default), `ralph`, or `task-archive`
|
|
19
|
+
|
|
20
|
+
2. **Capture**:
|
|
21
|
+
```bash
|
|
22
|
+
rulebook learn capture --title "<title>" --content "<content>" --tags "tag1,tag2" --related-task <task-id>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. **Verify**:
|
|
26
|
+
```bash
|
|
27
|
+
rulebook learn list --limit 5
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Promotion Flow**
|
|
31
|
+
If a learning is significant enough to become a team pattern or decision:
|
|
32
|
+
```bash
|
|
33
|
+
rulebook learn promote <id> knowledge # → creates a pattern
|
|
34
|
+
rulebook learn promote <id> decision # → creates an ADR
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Ralph Integration**
|
|
38
|
+
Extract learnings from Ralph autonomous loop history:
|
|
39
|
+
```bash
|
|
40
|
+
rulebook learn from-ralph
|
|
41
|
+
```
|
|
42
|
+
This reads `.rulebook/ralph/history/iteration-*.json` and captures entries with non-empty learnings.
|
|
43
|
+
|
|
44
|
+
**Reference**
|
|
45
|
+
- Learnings are searchable via `rulebook memory search`
|
|
46
|
+
- Use `rulebook learn list` to see all learnings
|
|
47
|
+
- Learnings captured during `rulebook task archive` have source `task-archive`
|
|
48
|
+
<!-- RULEBOOK:END -->
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: /rulebook-learn-list
|
|
3
|
+
id: rulebook-learn-list
|
|
4
|
+
category: Rulebook
|
|
5
|
+
description: List captured learnings with source and promotion status.
|
|
6
|
+
---
|
|
7
|
+
<!-- RULEBOOK:START -->
|
|
8
|
+
**Steps**
|
|
9
|
+
1. Run `rulebook learn list` to see all learnings (newest first).
|
|
10
|
+
2. Optionally limit: `rulebook learn list --limit 10`
|
|
11
|
+
3. Present results with source badge (manual/ralph/archive) and promotion status.
|
|
12
|
+
4. Suggest promotion for significant learnings: `rulebook learn promote <id> knowledge|decision`
|
|
13
|
+
<!-- RULEBOOK:END -->
|
|
@@ -125,6 +125,14 @@ rulebook task update <task-id> --status completed
|
|
|
125
125
|
rulebook task update <task-id> --status blocked --reason "explanation"
|
|
126
126
|
```
|
|
127
127
|
|
|
128
|
+
**⚠️ CRITICAL: Follow the task sequence**
|
|
129
|
+
|
|
130
|
+
When working through a `tasks.md` checklist:
|
|
131
|
+
- Execute items in the EXACT order listed — top to bottom
|
|
132
|
+
- NEVER skip ahead, reorder, or cherry-pick "easier" tasks
|
|
133
|
+
- NEVER start Phase N+1 before Phase N is 100% complete
|
|
134
|
+
- The task list is an ORDER, not a MENU
|
|
135
|
+
|
|
128
136
|
### Step 5: Update OpenSpec Tasks
|
|
129
137
|
|
|
130
138
|
If `openspec/` directory exists:
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Decision Records
|
|
2
|
+
|
|
3
|
+
This project uses Architecture Decision Records (ADRs) to track important technical decisions.
|
|
4
|
+
|
|
5
|
+
## Format
|
|
6
|
+
|
|
7
|
+
Decisions are stored in `.rulebook/decisions/` as numbered Markdown files:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
.rulebook/decisions/
|
|
11
|
+
├── 001-use-postgres.md
|
|
12
|
+
├── 001-use-postgres.metadata.json
|
|
13
|
+
├── 002-api-rest-over-graphql.md
|
|
14
|
+
└── 002-api-rest-over-graphql.metadata.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Status Lifecycle
|
|
18
|
+
|
|
19
|
+
- **proposed** → Initial state when a decision is recorded
|
|
20
|
+
- **accepted** → Team has agreed on this decision
|
|
21
|
+
- **superseded** → Replaced by a newer decision (links to replacement)
|
|
22
|
+
- **deprecated** → No longer applicable
|
|
23
|
+
|
|
24
|
+
## Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
rulebook decision create "Use PostgreSQL" # Create a new ADR
|
|
28
|
+
rulebook decision list # List all decisions
|
|
29
|
+
rulebook decision show 1 # Show full decision details
|
|
30
|
+
rulebook decision supersede 1 5 # Mark decision 1 as superseded by 5
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Rules
|
|
34
|
+
|
|
35
|
+
1. Every significant architectural choice SHOULD have a decision record
|
|
36
|
+
2. Decisions MUST include context, the decision itself, alternatives considered, and consequences
|
|
37
|
+
3. Never delete a decision — supersede or deprecate it instead
|
|
38
|
+
4. Reference related tasks when applicable
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Project Knowledge Base
|
|
2
|
+
|
|
3
|
+
This project maintains an explicit knowledge base of patterns and anti-patterns.
|
|
4
|
+
|
|
5
|
+
## Structure
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
.rulebook/knowledge/
|
|
9
|
+
├── patterns/ # Approved patterns to follow
|
|
10
|
+
│ ├── <slug>.md
|
|
11
|
+
│ └── <slug>.metadata.json
|
|
12
|
+
└── anti-patterns/ # Known anti-patterns to avoid
|
|
13
|
+
├── <slug>.md
|
|
14
|
+
└── <slug>.metadata.json
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Entry Format
|
|
18
|
+
|
|
19
|
+
Each knowledge entry includes:
|
|
20
|
+
- **Description**: What the pattern/anti-pattern is
|
|
21
|
+
- **Example**: Code showing correct (or incorrect) usage
|
|
22
|
+
- **When to Use**: Situations where this pattern applies
|
|
23
|
+
- **When NOT to Use**: Exceptions and edge cases
|
|
24
|
+
|
|
25
|
+
## Categories
|
|
26
|
+
|
|
27
|
+
- `architecture` — System-level design patterns
|
|
28
|
+
- `code` — Code-level patterns and idioms
|
|
29
|
+
- `testing` — Testing strategies and patterns
|
|
30
|
+
- `security` — Security patterns and practices
|
|
31
|
+
- `performance` — Performance optimization patterns
|
|
32
|
+
- `devops` — Infrastructure and deployment patterns
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
rulebook knowledge add pattern "Repository Pattern" --category architecture
|
|
38
|
+
rulebook knowledge add anti-pattern "God Object" --category code
|
|
39
|
+
rulebook knowledge list --type pattern
|
|
40
|
+
rulebook knowledge show repository-pattern
|
|
41
|
+
rulebook knowledge remove god-object
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Rules
|
|
45
|
+
|
|
46
|
+
1. Patterns added here are auto-injected into AGENTS.md on `rulebook update`
|
|
47
|
+
2. AI assistants should follow patterns and avoid anti-patterns
|
|
48
|
+
3. Include concrete examples — abstract descriptions are less useful
|
|
49
|
+
4. Tag entries for searchability
|
|
@@ -204,6 +204,18 @@ Detailed description of what will change:
|
|
|
204
204
|
- [ ] 3.2 Update CHANGELOG
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
+
**⚠️ CRITICAL: Sequential Execution Rule**
|
|
208
|
+
|
|
209
|
+
When implementing tasks from `tasks.md`, you MUST execute items **in the exact order listed**:
|
|
210
|
+
|
|
211
|
+
1. Find the FIRST unchecked item (`- [ ]`) — implement THAT one
|
|
212
|
+
2. Mark it `[x]` when done
|
|
213
|
+
3. Move to the NEXT unchecked item
|
|
214
|
+
4. **NEVER** skip ahead, reorder, or cherry-pick tasks
|
|
215
|
+
5. **NEVER** start a later phase before the current phase is 100% complete
|
|
216
|
+
|
|
217
|
+
**The task list is an ORDER, not a MENU.** The human defined the sequence deliberately. Follow it.
|
|
218
|
+
|
|
207
219
|
### Step 7: Write Spec Delta
|
|
208
220
|
|
|
209
221
|
**File**: `/.rulebook/tasks/<task-id>/specs/<module>/spec.md`
|