@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,154 @@
|
|
|
1
|
+
<!-- TIER1_PROHIBITIONS:START -->
|
|
2
|
+
# Absolute Prohibitions (Tier 1 — Highest Precedence)
|
|
3
|
+
|
|
4
|
+
**These rules override ALL other rules. Violation = output rejected.**
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## PROHIBITION 1: No Shortcuts, Stubs, or Simplified Logic
|
|
9
|
+
|
|
10
|
+
**NEVER** simplify logic, add TODO/FIXME/HACK, create stubs, use placeholders, alter existing logic to avoid complexity, reduce scope, skip edge cases, or deliver partial implementations.
|
|
11
|
+
|
|
12
|
+
**Response time is IRRELEVANT. Quality is everything.**
|
|
13
|
+
|
|
14
|
+
### Forbidden Patterns
|
|
15
|
+
- `// TODO` — unfinished work disguised as progress
|
|
16
|
+
- `// FIXME` — a known bug left for "later"
|
|
17
|
+
- `// HACK` — a shortcut that will haunt you
|
|
18
|
+
- `return 0; // placeholder` — a lie that compiles
|
|
19
|
+
- `/* stub */` — an empty promise
|
|
20
|
+
- Simplified algorithms where the correct one is known
|
|
21
|
+
- Partial implementations ("I'll add the rest later")
|
|
22
|
+
- Reduced scope without explicit approval
|
|
23
|
+
|
|
24
|
+
### Required Behavior
|
|
25
|
+
- **Research** the correct approach before writing code
|
|
26
|
+
- **Implement completely** — every function, every edge case, every error path
|
|
27
|
+
- **Take as long as needed** — correct implementation > fast delivery
|
|
28
|
+
- **Ask if unsure** — propose a plan, never silently simplify
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## PROHIBITION 2: No Destructive Git Operations Without Authorization
|
|
33
|
+
|
|
34
|
+
### Allowed (always safe)
|
|
35
|
+
- `git status`, `git diff`, `git log`, `git blame`
|
|
36
|
+
- `git add`, `git commit` (after quality checks)
|
|
37
|
+
|
|
38
|
+
### Forbidden (require explicit user authorization)
|
|
39
|
+
- `git stash` — can lose uncommitted work
|
|
40
|
+
- `git rebase` — rewrites history
|
|
41
|
+
- `git reset --hard` — destroys uncommitted changes
|
|
42
|
+
- `git checkout -- .` / `git restore .` — discards all changes
|
|
43
|
+
- `git revert` — creates new commits
|
|
44
|
+
- `git cherry-pick` — can cause conflicts
|
|
45
|
+
- `git merge` — can create conflicts
|
|
46
|
+
- `git branch -D` — deletes branch permanently
|
|
47
|
+
- `git push --force` — overwrites remote history
|
|
48
|
+
- `git clean -f` — deletes untracked files permanently
|
|
49
|
+
- `git checkout <branch>` / `git switch` — breaks concurrent sessions sharing the worktree
|
|
50
|
+
|
|
51
|
+
**Why**: Multiple AI sessions may share the same working tree. Destructive operations affect ALL concurrent sessions.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## PROHIBITION 3: No Deletion Without Authorization
|
|
56
|
+
|
|
57
|
+
**NEVER** run `rm`, `rm -rf`, `del`, or delete any file without explicit user authorization ("yes, delete it").
|
|
58
|
+
|
|
59
|
+
This includes:
|
|
60
|
+
- Cache files (they auto-invalidate — DO NOT manually delete)
|
|
61
|
+
- Backup files
|
|
62
|
+
- Temporary files (clean up YOUR temp files, never others')
|
|
63
|
+
- Build artifacts (use the build system's clean command)
|
|
64
|
+
- Lock files (investigate what holds the lock first)
|
|
65
|
+
|
|
66
|
+
**Why**: AI agents repeatedly delete important files during "cleanup." The cost of an unauthorized deletion (hours rebuilding caches, lost data) always exceeds the cost of asking first.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## PROHIBITION 4: Research Before Implementing — Never Guess
|
|
71
|
+
|
|
72
|
+
**NEVER** guess at:
|
|
73
|
+
- The cause of a bug
|
|
74
|
+
- How an API works
|
|
75
|
+
- What a function does based on its name
|
|
76
|
+
- What "correct" output looks like
|
|
77
|
+
|
|
78
|
+
### Required Process
|
|
79
|
+
1. **State what you KNOW** (from logs, debug output, code reading)
|
|
80
|
+
2. **State what you DON'T KNOW**
|
|
81
|
+
3. **Research** the unknown (read source, check docs, use diagnostic tools)
|
|
82
|
+
4. **Only then** implement the fix
|
|
83
|
+
|
|
84
|
+
**"I think this might be the problem" is NOT acceptable.**
|
|
85
|
+
**"Source X does Y at file:line, we do Z, the difference causes W" IS acceptable.**
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## PROHIBITION 5: Sequential File Editing
|
|
90
|
+
|
|
91
|
+
**ALWAYS** edit files one at a time in sequence: Read file1 → Edit file1 → Read file2 → Edit file2.
|
|
92
|
+
|
|
93
|
+
**NEVER** batch-read multiple files then batch-edit them. By the time you edit file 3, the context from file 1 may be stale.
|
|
94
|
+
|
|
95
|
+
When a task touches 3+ files across subsystems:
|
|
96
|
+
1. **STOP** — do not start implementing
|
|
97
|
+
2. **Plan** the changes (list files, dependency order)
|
|
98
|
+
3. **Decompose** into sub-tasks of 1-2 files each
|
|
99
|
+
4. **Execute** sub-tasks in dependency order
|
|
100
|
+
5. **Build/test** after each sub-task
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## PROHIBITION 6: No Deferred Tasks
|
|
105
|
+
|
|
106
|
+
If a task is in the checklist, **implement it**. No exceptions.
|
|
107
|
+
|
|
108
|
+
- **NEVER** mark tasks as "Deferred"
|
|
109
|
+
- **NEVER** write "Deferred — requires X"
|
|
110
|
+
- **NEVER** skip tasks with excuses
|
|
111
|
+
- **NEVER** deliver partial implementations with "will do later"
|
|
112
|
+
|
|
113
|
+
If a task has a genuine dependency:
|
|
114
|
+
1. Implement the dependency FIRST
|
|
115
|
+
2. Then implement the task
|
|
116
|
+
3. Mark BOTH as done
|
|
117
|
+
|
|
118
|
+
If you truly cannot implement something, explain WHY in concrete terms and propose an alternative — do NOT just write "Deferred."
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## PROHIBITION 7: Follow Task Sequence — No Reordering, No Cherry-Picking
|
|
123
|
+
|
|
124
|
+
When a `tasks.md` checklist defines a sequence of items, **execute them in EXACTLY that order**.
|
|
125
|
+
|
|
126
|
+
### Forbidden
|
|
127
|
+
|
|
128
|
+
- **NEVER** skip ahead to "easier" or "more interesting" tasks
|
|
129
|
+
- **NEVER** reorder tasks because you think a different order is better
|
|
130
|
+
- **NEVER** cherry-pick tasks from the middle of a list
|
|
131
|
+
- **NEVER** decide which tasks are "important enough" to do — do ALL of them, in order
|
|
132
|
+
- **NEVER** group or batch tasks in a different sequence than listed
|
|
133
|
+
- **NEVER** start Phase N+1 before Phase N is 100% complete
|
|
134
|
+
|
|
135
|
+
### Required Behavior
|
|
136
|
+
|
|
137
|
+
1. Read `tasks.md` from top to bottom
|
|
138
|
+
2. Find the FIRST unchecked item (`- [ ]`)
|
|
139
|
+
3. Implement THAT item — not the one you prefer
|
|
140
|
+
4. Mark it `[x]` with what was done
|
|
141
|
+
5. Move to the NEXT unchecked item
|
|
142
|
+
6. Repeat until all items are checked
|
|
143
|
+
|
|
144
|
+
### Why
|
|
145
|
+
|
|
146
|
+
The human spent time defining the task sequence for a reason. The order reflects dependencies, priorities, and a deliberate implementation strategy. When AI agents skip around:
|
|
147
|
+
- Dependencies break because upstream work wasn't done first
|
|
148
|
+
- The human loses track of what's actually complete
|
|
149
|
+
- Work has to be redone because it was built on missing foundations
|
|
150
|
+
- Trust erodes — the human defined a plan and the AI ignored it
|
|
151
|
+
|
|
152
|
+
**The task list is an ORDER, not a MENU. Execute sequentially.**
|
|
153
|
+
|
|
154
|
+
<!-- TIER1_PROHIBITIONS:END -->
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!-- TOKEN_OPTIMIZATION:START -->
|
|
2
|
+
# Token Optimization Rules
|
|
3
|
+
|
|
4
|
+
Output verbosity rules calibrated by model capability tier.
|
|
5
|
+
These rules ensure cost-efficient use of AI models without sacrificing quality.
|
|
6
|
+
|
|
7
|
+
## Model Tier Assignment
|
|
8
|
+
|
|
9
|
+
| Tier | Use For | Claude | Gemini | OpenAI |
|
|
10
|
+
|------|---------|--------|--------|--------|
|
|
11
|
+
| **Core** | Complex bugs, architecture, domain-critical code | opus | Pro | o3 |
|
|
12
|
+
| **Standard** | Tests, implementation, build system, medium tasks | sonnet | Flash | 4o |
|
|
13
|
+
| **Research** | Read-only exploration, docs, codebase search | haiku | Flash-Lite | 4o-mini |
|
|
14
|
+
|
|
15
|
+
## Output Rules by Tier
|
|
16
|
+
|
|
17
|
+
### Research Tier (cheapest — maximize context for work, not reports)
|
|
18
|
+
- Output code, not explanations
|
|
19
|
+
- Minimal reports: "Done" instead of detailed status
|
|
20
|
+
- No markdown tables, emoji, or status sections
|
|
21
|
+
- Combine outputs into one response
|
|
22
|
+
- No "Next Steps" sections
|
|
23
|
+
- No repeating back what was asked
|
|
24
|
+
|
|
25
|
+
### Standard Tier (balanced — brief summaries)
|
|
26
|
+
- Brief summaries (2-3 sentences max)
|
|
27
|
+
- Code with inline comments (no separate explanation blocks)
|
|
28
|
+
- Report only: what changed, what passed, what failed
|
|
29
|
+
- Skip preamble and transitions
|
|
30
|
+
|
|
31
|
+
### Core Tier (most capable — full reasoning when needed)
|
|
32
|
+
- Full explanations welcome for complex decisions
|
|
33
|
+
- Document reasoning for non-obvious choices
|
|
34
|
+
- Detailed analysis for bug investigations
|
|
35
|
+
- Still avoid unnecessary verbosity
|
|
36
|
+
|
|
37
|
+
## Token Savings Reference
|
|
38
|
+
|
|
39
|
+
| Pattern to Avoid | Tokens Wasted | Alternative |
|
|
40
|
+
|-------------------|---------------|-------------|
|
|
41
|
+
| Emoji status tables | ~500/task | Plain text "Done" |
|
|
42
|
+
| "Next Steps" sections | ~100/task | Omit entirely |
|
|
43
|
+
| Detailed quality reports | ~300/task | "Tests pass, coverage 95%" |
|
|
44
|
+
| Repeating the question | ~200/task | Jump to the answer |
|
|
45
|
+
| Markdown formatting abuse | ~200/task | Minimal formatting |
|
|
46
|
+
|
|
47
|
+
**Total savings**: ~850 tokens/task for research tier agents
|
|
48
|
+
|
|
49
|
+
<!-- TOKEN_OPTIMIZATION:END -->
|
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
|
|
4
4
|
**CRITICAL**: Specific rules and patterns for Git version control workflow.
|
|
5
5
|
|
|
6
|
+
## Git Command Allow-List (Quick Reference)
|
|
7
|
+
|
|
8
|
+
### ALLOWED (always safe — no authorization needed)
|
|
9
|
+
| Command | Purpose |
|
|
10
|
+
|---------|---------|
|
|
11
|
+
| `git status` | Check repository state |
|
|
12
|
+
| `git diff` | View changes |
|
|
13
|
+
| `git log` | View history |
|
|
14
|
+
| `git blame` | View line-by-line attribution |
|
|
15
|
+
| `git add <files>` | Stage specific files |
|
|
16
|
+
| `git commit` | Create commits (after quality checks) |
|
|
17
|
+
| `git branch` (list) | List branches |
|
|
18
|
+
| `git tag` (list) | List tags |
|
|
19
|
+
|
|
20
|
+
### FORBIDDEN (require explicit user authorization)
|
|
21
|
+
| Command | Risk | Why |
|
|
22
|
+
|---------|------|-----|
|
|
23
|
+
| `git stash` | Loses uncommitted work | Hidden state that gets forgotten |
|
|
24
|
+
| `git rebase` | Rewrites history | Breaks shared branch history |
|
|
25
|
+
| `git reset --hard` | Destroys changes | Irreversible data loss |
|
|
26
|
+
| `git checkout -- .` | Discards all changes | Irreversible data loss |
|
|
27
|
+
| `git restore .` | Discards all changes | Irreversible data loss |
|
|
28
|
+
| `git revert` | Creates revert commits | May cause unexpected conflicts |
|
|
29
|
+
| `git cherry-pick` | Duplicates commits | Can cause merge conflicts |
|
|
30
|
+
| `git merge` | Can create conflicts | Requires human judgment |
|
|
31
|
+
| `git branch -D` | Deletes branch | Permanent, may lose work |
|
|
32
|
+
| `git push --force` | Overwrites remote | NEVER on main/master |
|
|
33
|
+
| `git clean -f` | Deletes untracked files | Permanent file deletion |
|
|
34
|
+
| `git checkout <branch>` | Switches branch | Breaks concurrent AI sessions |
|
|
35
|
+
| `git switch <branch>` | Switches branch | Breaks concurrent AI sessions |
|
|
36
|
+
|
|
37
|
+
**Why**: Multiple AI sessions may share the same working tree. Branch switching or destructive operations affect ALL concurrent sessions.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
6
41
|
## Git Workflow Overview
|
|
7
42
|
|
|
8
43
|
This project follows a strict Git workflow to ensure code quality and proper version control.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: follow-task-sequence
|
|
3
|
+
tier: 1
|
|
4
|
+
description: "Execute tasks in the exact order defined — no reordering, no cherry-picking"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Follow Task Sequence — No Reordering, No Cherry-Picking
|
|
11
|
+
|
|
12
|
+
When a `tasks.md` checklist defines a sequence, execute items in EXACTLY that order.
|
|
13
|
+
|
|
14
|
+
## Forbidden
|
|
15
|
+
|
|
16
|
+
- Skipping ahead to "easier" or "more interesting" tasks
|
|
17
|
+
- Reordering tasks because you think a different order is better
|
|
18
|
+
- Cherry-picking tasks from the middle of a list
|
|
19
|
+
- Deciding which tasks are "important enough" to do
|
|
20
|
+
- Grouping or batching tasks in a different sequence
|
|
21
|
+
- Starting Phase N+1 before Phase N is 100% complete
|
|
22
|
+
|
|
23
|
+
## Required Behavior
|
|
24
|
+
|
|
25
|
+
1. Read `tasks.md` from top to bottom
|
|
26
|
+
2. Find the FIRST unchecked item (`- [ ]`)
|
|
27
|
+
3. Implement THAT item — not the one you prefer
|
|
28
|
+
4. Mark it `[x]` with what was done
|
|
29
|
+
5. Move to the NEXT unchecked item
|
|
30
|
+
6. Repeat until all items are checked
|
|
31
|
+
|
|
32
|
+
## Why
|
|
33
|
+
|
|
34
|
+
The human spent time defining the task sequence for a reason. The order reflects dependencies, priorities, and a deliberate implementation strategy. When AI agents skip around, dependencies break, progress tracking becomes unreliable, and work has to be redone.
|
|
35
|
+
|
|
36
|
+
**The task list is an ORDER, not a MENU.**
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-safety
|
|
3
|
+
tier: 1
|
|
4
|
+
description: "Git safety — explicit allow-list, forbidden destructive operations"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Git Safety Rules
|
|
11
|
+
|
|
12
|
+
## Allowed (always safe)
|
|
13
|
+
- `git status`, `git diff`, `git log`, `git blame`
|
|
14
|
+
- `git add <files>`, `git commit` (after quality checks)
|
|
15
|
+
|
|
16
|
+
## Forbidden (require explicit user authorization)
|
|
17
|
+
- `git stash` — hidden state gets forgotten
|
|
18
|
+
- `git rebase` — rewrites history
|
|
19
|
+
- `git reset --hard` — destroys uncommitted changes
|
|
20
|
+
- `git checkout -- .` / `git restore .` — discards all changes
|
|
21
|
+
- `git revert` — creates unexpected commits
|
|
22
|
+
- `git cherry-pick` — can cause conflicts
|
|
23
|
+
- `git merge` — requires human judgment
|
|
24
|
+
- `git branch -D` — permanent branch deletion
|
|
25
|
+
- `git push --force` — NEVER on main/master
|
|
26
|
+
- `git clean -f` — permanently deletes untracked files
|
|
27
|
+
- `git checkout <branch>` / `git switch` — breaks concurrent AI sessions
|
|
28
|
+
|
|
29
|
+
Multiple AI sessions may share the same working tree. Branch switching or destructive operations affect ALL concurrent sessions.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: incremental-tests
|
|
3
|
+
tier: 2
|
|
4
|
+
description: "Write tests in small batches, verify immediately"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*.test.*", "*.spec.*", "*_test.*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Incremental Test Development
|
|
11
|
+
|
|
12
|
+
Write tests 1-3 at a time. Test immediately after writing. Fix errors before proceeding.
|
|
13
|
+
|
|
14
|
+
## Rules
|
|
15
|
+
|
|
16
|
+
1. **Write 1-3 tests** at a time, NOT entire test files at once
|
|
17
|
+
2. **Run immediately** after writing — use single-file test execution
|
|
18
|
+
3. **Fix errors** before writing more tests
|
|
19
|
+
4. **Never run full suite** while developing tests — use individual file execution
|
|
20
|
+
5. **Coverage updates** only after completing a block of tests
|
|
21
|
+
|
|
22
|
+
## Why
|
|
23
|
+
|
|
24
|
+
Writing full test files at once leads to cascading failures. One early error invalidates all subsequent tests, creating debug fatigue and wasted time.
|
|
25
|
+
|
|
26
|
+
## Development Testing vs Validation Testing
|
|
27
|
+
|
|
28
|
+
- **Development**: Run single test file (`vitest run tests/my.test.ts`)
|
|
29
|
+
- **Validation**: Run full suite only when a batch of tests is complete
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: no-deferred
|
|
3
|
+
tier: 2
|
|
4
|
+
description: "Never defer tasks — implement or explain why impossible"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# No Deferred Tasks
|
|
11
|
+
|
|
12
|
+
If a task is in the checklist, **implement it**. No exceptions.
|
|
13
|
+
|
|
14
|
+
## Forbidden
|
|
15
|
+
|
|
16
|
+
- Marking tasks as "Deferred"
|
|
17
|
+
- Writing "Deferred — requires X"
|
|
18
|
+
- Skipping tasks with excuses
|
|
19
|
+
- Partial implementations with "will do later"
|
|
20
|
+
|
|
21
|
+
## Required Behavior
|
|
22
|
+
|
|
23
|
+
If a task has a genuine dependency:
|
|
24
|
+
1. Implement the dependency FIRST
|
|
25
|
+
2. Then implement the task
|
|
26
|
+
3. Mark BOTH as done
|
|
27
|
+
|
|
28
|
+
If you truly cannot implement something:
|
|
29
|
+
1. Explain WHY in concrete terms
|
|
30
|
+
2. Propose an alternative solution
|
|
31
|
+
3. Do NOT just write "Deferred"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: no-shortcuts
|
|
3
|
+
tier: 1
|
|
4
|
+
description: "Never use stubs, TODOs, placeholders, or approximations"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# No Shortcuts — Quality Over Speed
|
|
11
|
+
|
|
12
|
+
Response time is IRRELEVANT. The ONLY thing that matters is quality.
|
|
13
|
+
|
|
14
|
+
## Absolutely Forbidden
|
|
15
|
+
|
|
16
|
+
1. **NEVER simplify logic** to deliver faster — implement the correct algorithm
|
|
17
|
+
2. **NEVER add TODOs** — if it needs to be done, do it NOW
|
|
18
|
+
3. **NEVER use stubs** — every function must have its real implementation
|
|
19
|
+
4. **NEVER use placeholders** — no `// placeholder`, no `return 0; // fixme`
|
|
20
|
+
5. **NEVER cut corners** to reduce output size
|
|
21
|
+
6. **NEVER skip edge cases** — handle all of them
|
|
22
|
+
7. **NEVER deliver partial implementations** — complete or explain why not
|
|
23
|
+
8. **NEVER alter existing logic** to make your task easier
|
|
24
|
+
|
|
25
|
+
## Required Behavior
|
|
26
|
+
|
|
27
|
+
- **Research** the correct approach before writing code
|
|
28
|
+
- **Implement completely** — every function, every edge case, every error path
|
|
29
|
+
- **Take as long as needed** — correct > fast
|
|
30
|
+
- **Ask if unsure** — propose a plan, never silently simplify
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: research-first
|
|
3
|
+
tier: 1
|
|
4
|
+
description: "Always research before implementing — never guess"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Research Before Implementing
|
|
11
|
+
|
|
12
|
+
NEVER guess at bug causes, API behavior, or algorithm correctness.
|
|
13
|
+
|
|
14
|
+
## Required Process
|
|
15
|
+
|
|
16
|
+
1. **State what you KNOW** (from logs, debug output, code reading)
|
|
17
|
+
2. **State what you DON'T KNOW**
|
|
18
|
+
3. **Research** the unknown (read source, check docs, use diagnostic tools)
|
|
19
|
+
4. **Only then** implement the fix
|
|
20
|
+
|
|
21
|
+
## Forbidden
|
|
22
|
+
|
|
23
|
+
- Guessing at the cause of a bug
|
|
24
|
+
- "Trying things" to see if they work
|
|
25
|
+
- Hypothesizing without reading code
|
|
26
|
+
- Assuming how an API works without checking docs
|
|
27
|
+
- Iterating blindly — each attempt must be informed by new data
|
|
28
|
+
|
|
29
|
+
**"I think this might be the problem" is NOT acceptable.**
|
|
30
|
+
**"Source X does Y at file:line, we do Z, the difference causes W" IS acceptable.**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sequential-editing
|
|
3
|
+
tier: 1
|
|
4
|
+
description: "Edit files one at a time, never batch-edit"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Sequential File Editing
|
|
11
|
+
|
|
12
|
+
ALWAYS edit files one at a time: Read file1 → Edit file1 → Read file2 → Edit file2.
|
|
13
|
+
|
|
14
|
+
NEVER batch-read multiple files then batch-edit them. By the time you edit file 3, context from file 1 may be stale.
|
|
15
|
+
|
|
16
|
+
When a task touches 3+ files across subsystems:
|
|
17
|
+
1. **STOP** — do not start implementing
|
|
18
|
+
2. **Plan** the changes (list files, dependency order)
|
|
19
|
+
3. **Decompose** into sub-tasks of 1-2 files each
|
|
20
|
+
4. **Execute** sub-tasks in dependency order (upstream first)
|
|
21
|
+
5. **Build/test** after each sub-task
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: session-workflow
|
|
3
|
+
tier: 2
|
|
4
|
+
description: "Read PLANS.md at session start, save summary at session end"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Session Workflow — Preserve Context Across Sessions
|
|
11
|
+
|
|
12
|
+
## At Session Start
|
|
13
|
+
1. Read `.rulebook/PLANS.md` for current context and active task
|
|
14
|
+
2. Search memory for relevant past work: `rulebook_memory_search` or `rulebook_session_start`
|
|
15
|
+
3. Check `.rulebook/tasks/` for pending work
|
|
16
|
+
|
|
17
|
+
## During Session
|
|
18
|
+
- Update PLANS.md when making key decisions or discoveries
|
|
19
|
+
- Save important context to memory as you go
|
|
20
|
+
|
|
21
|
+
## At Session End
|
|
22
|
+
1. Save session summary to PLANS.md: `rulebook_session_end`
|
|
23
|
+
2. Summary should include: what was accomplished, key decisions, next steps
|
|
24
|
+
3. Update tasks.md with completed items
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task-decomposition
|
|
3
|
+
tier: 2
|
|
4
|
+
description: "Decompose multi-file tasks into 1-2 file sub-tasks"
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
filePatterns: ["*"]
|
|
7
|
+
tools: ["all"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Task Decomposition
|
|
11
|
+
|
|
12
|
+
When a task touches multiple subsystems, decompose into sub-tasks where each modifies **at most 1-2 files**.
|
|
13
|
+
|
|
14
|
+
## Why
|
|
15
|
+
|
|
16
|
+
AI agents lose accuracy when editing 3+ files in one pass. Context from earlier files gets compressed away.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
|
|
20
|
+
1. **Each sub-task modifies 1-2 files** — never more
|
|
21
|
+
2. **Each sub-task is independently verifiable** — it compiles, it doesn't break existing behavior
|
|
22
|
+
3. **Sub-tasks follow data flow order** — upstream first (component → buffer → renderer → shader)
|
|
23
|
+
4. **Each sub-task has a clear "done when"** — not "implement X", but "field Y exists with default Z"
|
|
24
|
+
5. **Build after each sub-task** — verify compilation before proceeding
|
|
25
|
+
|
|
26
|
+
## When an Agent Receives a Multi-File Task
|
|
27
|
+
|
|
28
|
+
1. **STOP** — do not start implementing
|
|
29
|
+
2. **Create a change plan** listing all files and dependency order
|
|
30
|
+
3. **Decompose** into sub-tasks following this rule
|
|
31
|
+
4. **Report back** with the decomposition
|
|
32
|
+
5. **Implement** one sub-task at a time
|