opencode-goopspec 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +650 -0
- package/agents/goop-debugger.md +265 -0
- package/agents/goop-designer.md +244 -0
- package/agents/goop-executor.md +217 -0
- package/agents/goop-explorer.md +252 -0
- package/agents/goop-librarian.md +197 -0
- package/agents/goop-orchestrator.md +224 -0
- package/agents/goop-planner.md +231 -0
- package/agents/goop-researcher.md +246 -0
- package/agents/goop-tester.md +245 -0
- package/agents/goop-verifier.md +266 -0
- package/agents/goop-writer.md +293 -0
- package/agents/memory-distiller.md +226 -0
- package/commands/goop-accept.md +183 -0
- package/commands/goop-amend.md +175 -0
- package/commands/goop-complete.md +206 -0
- package/commands/goop-debug.md +318 -0
- package/commands/goop-discuss.md +138 -0
- package/commands/goop-execute.md +137 -0
- package/commands/goop-help.md +82 -0
- package/commands/goop-map-codebase.md +501 -0
- package/commands/goop-memory.md +66 -0
- package/commands/goop-milestone.md +213 -0
- package/commands/goop-pause.md +61 -0
- package/commands/goop-plan.md +78 -0
- package/commands/goop-quick.md +165 -0
- package/commands/goop-recall.md +48 -0
- package/commands/goop-remember.md +71 -0
- package/commands/goop-research.md +98 -0
- package/commands/goop-resume.md +57 -0
- package/commands/goop-setup.md +208 -0
- package/commands/goop-specify.md +145 -0
- package/commands/goop-status.md +153 -0
- package/dist/index.js +31017 -0
- package/dist/memory/index.js +48752 -0
- package/package.json +73 -0
- package/references/agent-patterns.md +334 -0
- package/references/boundary-system.md +141 -0
- package/references/deviation-rules.md +80 -0
- package/references/dispatch-patterns.md +176 -0
- package/references/model-profiles.md +109 -0
- package/references/orchestrator-philosophy.md +280 -0
- package/references/security-checklist.md +163 -0
- package/references/subagent-protocol.md +393 -0
- package/references/tdd.md +231 -0
- package/references/ui-brand.md +261 -0
- package/references/workflow-accept.md +325 -0
- package/references/workflow-execute.md +315 -0
- package/references/workflow-plan.md +179 -0
- package/references/workflow-research.md +234 -0
- package/references/workflow-specify.md +278 -0
- package/skills/README.md +362 -0
- package/skills/accessibility/skill.md +41 -0
- package/skills/accessibility-testing/skill.md +47 -0
- package/skills/api-docs/skill.md +50 -0
- package/skills/architecture-design/skill.md +168 -0
- package/skills/atomic-commits/skill.md +53 -0
- package/skills/code-review/skill.md +59 -0
- package/skills/codebase-mapping/skill.md +54 -0
- package/skills/convention-detection/skill.md +68 -0
- package/skills/debugging/skill.md +59 -0
- package/skills/deviation-handling/skill.md +187 -0
- package/skills/documentation/skill.md +213 -0
- package/skills/goop-core/skill.md +383 -0
- package/skills/memory-usage/skill.md +208 -0
- package/skills/parallel-planning/skill.md +170 -0
- package/skills/pattern-extraction/skill.md +73 -0
- package/skills/performance-optimization/skill.md +188 -0
- package/skills/playwright/skill.md +69 -0
- package/skills/playwright-testing/skill.md +93 -0
- package/skills/progress-tracking/skill.md +155 -0
- package/skills/readme-generation/skill.md +87 -0
- package/skills/research/skill.md +161 -0
- package/skills/responsive-design/skill.md +76 -0
- package/skills/scientific-method/skill.md +67 -0
- package/skills/security-audit/skill.md +152 -0
- package/skills/task-decomposition/skill.md +153 -0
- package/skills/task-delegation/skill.md +127 -0
- package/skills/technical-writing/skill.md +69 -0
- package/skills/testing/skill.md +202 -0
- package/skills/ui-design/skill.md +73 -0
- package/skills/ux-patterns/skill.md +82 -0
- package/skills/verification/skill.md +178 -0
- package/skills/visual-regression/skill.md +86 -0
- package/templates/blueprint.md +141 -0
- package/templates/chronicle.md +156 -0
- package/templates/milestone.md +131 -0
- package/templates/research.md +117 -0
- package/templates/retrospective.md +188 -0
- package/templates/spec.md +103 -0
- package/templates/summary.md +202 -0
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-goopspec",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A spec-driven development plugin for OpenCode with user-guided planning, wave execution, and verification",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"commands",
|
|
17
|
+
"agents",
|
|
18
|
+
"references",
|
|
19
|
+
"templates",
|
|
20
|
+
"skills",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target bun",
|
|
25
|
+
"dev": "bun build ./src/index.ts --outdir ./dist --target bun --watch",
|
|
26
|
+
"typecheck": "bunx tsc --noEmit",
|
|
27
|
+
"clean": "rm -rf dist",
|
|
28
|
+
"test": "bun test",
|
|
29
|
+
"prepublishOnly": "bun run build"
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"opencode",
|
|
33
|
+
"plugin",
|
|
34
|
+
"spec-driven",
|
|
35
|
+
"task-management",
|
|
36
|
+
"agent-orchestration",
|
|
37
|
+
"gsd",
|
|
38
|
+
"productivity",
|
|
39
|
+
"task-continuation",
|
|
40
|
+
"enforced-continuation"
|
|
41
|
+
],
|
|
42
|
+
"author": "James (opencode-goopspec)",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@clack/prompts": "^0.8.2",
|
|
46
|
+
"@huggingface/transformers": "^3.8.1",
|
|
47
|
+
"@opencode-ai/plugin": "^1.1.44",
|
|
48
|
+
"@opencode-ai/sdk": "^1.1.44",
|
|
49
|
+
"hono": "^4.11.7",
|
|
50
|
+
"picocolors": "^1.1.1",
|
|
51
|
+
"sqlite-vec": "^0.1.7-alpha.2",
|
|
52
|
+
"zod": "^4.1.8"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/node": "^22.13.9",
|
|
56
|
+
"typescript": "^5.8.2",
|
|
57
|
+
"bun-types": "latest"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"@opencode-ai/plugin": "^1.1.0"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"bun": ">=1.0.0"
|
|
64
|
+
},
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "https://github.com/james/opencode-goopspec.git"
|
|
68
|
+
},
|
|
69
|
+
"bugs": {
|
|
70
|
+
"url": "https://github.com/james/opencode-goopspec/issues"
|
|
71
|
+
},
|
|
72
|
+
"homepage": "https://github.com/james/opencode-goopspec#readme"
|
|
73
|
+
}
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# Agent Patterns
|
|
2
|
+
|
|
3
|
+
Common patterns for GoopSpec agent behavior and orchestration.
|
|
4
|
+
|
|
5
|
+
## Sub-Agent Orchestration
|
|
6
|
+
|
|
7
|
+
### Thin Orchestrator Pattern
|
|
8
|
+
The main orchestrator (goop-orchestrator) spawns specialized sub-agents for specific tasks, keeping its own context window clean.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Orchestrator Context: ~15% usage
|
|
12
|
+
├── Spawn Planner → Plan created → Return
|
|
13
|
+
├── Spawn Executor → Tasks done → Return
|
|
14
|
+
├── Spawn Verifier → Verification done → Return
|
|
15
|
+
└── Orchestrator aggregates results
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Fresh Context Per Agent
|
|
19
|
+
Each sub-agent gets a fresh 200K context window:
|
|
20
|
+
- Prevents context contamination
|
|
21
|
+
- Maintains peak output quality
|
|
22
|
+
- Allows parallel execution
|
|
23
|
+
- Enables longer task sequences
|
|
24
|
+
|
|
25
|
+
### Context Handoff Protocol
|
|
26
|
+
When spawning sub-agents, provide:
|
|
27
|
+
1. **Complete context** - All files needed for the task
|
|
28
|
+
2. **Explicit instructions** - What to do, how to verify
|
|
29
|
+
3. **Success criteria** - How to know it's done
|
|
30
|
+
4. **Return format** - Expected output structure
|
|
31
|
+
|
|
32
|
+
## Dispatch Routing
|
|
33
|
+
|
|
34
|
+
### Parallel Dispatch
|
|
35
|
+
Use when ALL conditions met:
|
|
36
|
+
- 3+ unrelated tasks or independent domains
|
|
37
|
+
- No shared state between tasks
|
|
38
|
+
- Clear file boundaries with no overlap
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
```typescript
|
|
42
|
+
// Parallel - different domains, no overlap
|
|
43
|
+
Spawn Frontend Agent: React components
|
|
44
|
+
Spawn Backend Agent: API routes
|
|
45
|
+
Spawn Database Agent: Schema changes
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Sequential Dispatch
|
|
49
|
+
Use when ANY condition true:
|
|
50
|
+
- Tasks have dependencies (B needs output from A)
|
|
51
|
+
- Shared files or state (merge conflict risk)
|
|
52
|
+
- Unclear scope (need to understand before proceeding)
|
|
53
|
+
|
|
54
|
+
Example:
|
|
55
|
+
```typescript
|
|
56
|
+
// Sequential - dependencies exist
|
|
57
|
+
1. Schema → 2. API → 3. Frontend
|
|
58
|
+
(Task 2 needs types from Task 1)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Background Dispatch
|
|
62
|
+
Use for:
|
|
63
|
+
- Research or analysis tasks
|
|
64
|
+
- Results aren't blocking current work
|
|
65
|
+
- Long-running documentation generation
|
|
66
|
+
|
|
67
|
+
Example:
|
|
68
|
+
```typescript
|
|
69
|
+
// Background - non-blocking
|
|
70
|
+
Spawn Background Agent: Research Context7 docs
|
|
71
|
+
Continue main work...
|
|
72
|
+
Receive results when complete
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Deviation Handling
|
|
76
|
+
|
|
77
|
+
### The 4 Deviation Rules
|
|
78
|
+
|
|
79
|
+
**Rule 1: Auto-fix bugs**
|
|
80
|
+
- Wrong logic, type errors, infinite loops
|
|
81
|
+
- Security vulnerabilities (SQL injection, XSS)
|
|
82
|
+
- Broken validation, race conditions
|
|
83
|
+
- Memory/resource leaks
|
|
84
|
+
|
|
85
|
+
**Rule 2: Auto-add missing critical functionality**
|
|
86
|
+
- Error handling (try-catch, promise rejection)
|
|
87
|
+
- Input validation and sanitization
|
|
88
|
+
- Null/undefined checks
|
|
89
|
+
- Authentication/authorization checks
|
|
90
|
+
- Rate limiting
|
|
91
|
+
|
|
92
|
+
**Rule 3: Auto-fix blocking issues**
|
|
93
|
+
- Missing dependencies
|
|
94
|
+
- Broken import paths
|
|
95
|
+
- Missing environment variables
|
|
96
|
+
- Config errors
|
|
97
|
+
- Circular dependencies
|
|
98
|
+
|
|
99
|
+
**Rule 4: Ask about architectural changes**
|
|
100
|
+
- New database tables (not just columns)
|
|
101
|
+
- Schema changes (primary keys, table splits)
|
|
102
|
+
- Framework/library switches
|
|
103
|
+
- New infrastructure (queues, caches)
|
|
104
|
+
- Breaking API changes
|
|
105
|
+
|
|
106
|
+
### Deviation Documentation
|
|
107
|
+
All deviations must be documented:
|
|
108
|
+
```markdown
|
|
109
|
+
## Deviations from Plan
|
|
110
|
+
|
|
111
|
+
### Auto-fixed Issues
|
|
112
|
+
|
|
113
|
+
**1. [Rule 1 - Bug] Fixed email validation regex**
|
|
114
|
+
- **Found during:** Task 3 (User registration)
|
|
115
|
+
- **Issue:** Regex didn't accept plus-addressing
|
|
116
|
+
- **Fix:** Updated pattern to accept + in local part
|
|
117
|
+
- **Files modified:** src/validation/email.ts
|
|
118
|
+
- **Verification:** Tests pass for user+tag@domain.com
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Checkpoint Patterns
|
|
122
|
+
|
|
123
|
+
### Verification Checkpoint
|
|
124
|
+
Used after building something testable:
|
|
125
|
+
```
|
|
126
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
127
|
+
║ CHECKPOINT: Verification Required ║
|
|
128
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
129
|
+
|
|
130
|
+
Progress: 3/8 tasks
|
|
131
|
+
Task: Verify user authentication
|
|
132
|
+
|
|
133
|
+
Built: Login form with email/password validation
|
|
134
|
+
|
|
135
|
+
How to verify:
|
|
136
|
+
1. Visit http://localhost:3000/login
|
|
137
|
+
2. Try valid credentials → should redirect to /dashboard
|
|
138
|
+
3. Try invalid credentials → should show error
|
|
139
|
+
4. Check form validation on blur
|
|
140
|
+
|
|
141
|
+
──────────────────────────────────────────────────────────────
|
|
142
|
+
→ Type "approved" or describe issues
|
|
143
|
+
──────────────────────────────────────────────────────────────
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Decision Checkpoint
|
|
147
|
+
Used when architectural choice needed:
|
|
148
|
+
```
|
|
149
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
150
|
+
║ CHECKPOINT: Decision Required ║
|
|
151
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
152
|
+
|
|
153
|
+
Decision needed: Database for user sessions
|
|
154
|
+
|
|
155
|
+
Options:
|
|
156
|
+
1. PostgreSQL (existing)
|
|
157
|
+
Pros: Consistency, existing infra
|
|
158
|
+
Cons: Harder to scale reads
|
|
159
|
+
|
|
160
|
+
2. Redis (new)
|
|
161
|
+
Pros: Fast, TTL support
|
|
162
|
+
Cons: New dependency, eventual consistency
|
|
163
|
+
|
|
164
|
+
──────────────────────────────────────────────────────────────
|
|
165
|
+
→ Select: postgres or redis
|
|
166
|
+
──────────────────────────────────────────────────────────────
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Action Checkpoint
|
|
170
|
+
Used for manual steps (rare):
|
|
171
|
+
```
|
|
172
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
173
|
+
║ CHECKPOINT: Action Required ║
|
|
174
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
175
|
+
|
|
176
|
+
I automated: Created webhook endpoint code
|
|
177
|
+
|
|
178
|
+
Need your help with: Stripe Dashboard configuration
|
|
179
|
+
|
|
180
|
+
Instructions:
|
|
181
|
+
1. Visit Stripe Dashboard → Developers → Webhooks
|
|
182
|
+
2. Add endpoint: https://your-domain.com/api/webhooks/stripe
|
|
183
|
+
3. Select events: checkout.session.completed
|
|
184
|
+
|
|
185
|
+
I'll verify after: Webhook appears in Stripe Dashboard
|
|
186
|
+
|
|
187
|
+
──────────────────────────────────────────────────────────────
|
|
188
|
+
→ Type "done" when complete
|
|
189
|
+
──────────────────────────────────────────────────────────────
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
## Task Breakdown Patterns
|
|
193
|
+
|
|
194
|
+
### Vertical Slices (Preferred)
|
|
195
|
+
Group by feature, not by layer:
|
|
196
|
+
```
|
|
197
|
+
Plan 01: User Feature
|
|
198
|
+
├── User model
|
|
199
|
+
├── User API
|
|
200
|
+
├── User UI
|
|
201
|
+
└── User tests
|
|
202
|
+
|
|
203
|
+
Plan 02: Product Feature
|
|
204
|
+
├── Product model
|
|
205
|
+
├── Product API
|
|
206
|
+
├── Product UI
|
|
207
|
+
└── Product tests
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Horizontal Layers (Avoid)
|
|
211
|
+
Don't group by technical layer:
|
|
212
|
+
```
|
|
213
|
+
AVOID:
|
|
214
|
+
Plan 01: All Models
|
|
215
|
+
Plan 02: All APIs
|
|
216
|
+
Plan 03: All UIs
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Plan Sizing
|
|
220
|
+
- 2-4 tasks per plan
|
|
221
|
+
- ~50% context usage for standard plans
|
|
222
|
+
- ~40% context usage for TDD plans
|
|
223
|
+
- Complex work → multiple focused plans
|
|
224
|
+
|
|
225
|
+
## TDD Pattern
|
|
226
|
+
|
|
227
|
+
### RED-GREEN-REFACTOR Cycle
|
|
228
|
+
```
|
|
229
|
+
RED (Write failing test):
|
|
230
|
+
1. Create test describing expected behavior
|
|
231
|
+
2. Run test - must fail
|
|
232
|
+
3. Commit: test(phase-plan): add failing test for X
|
|
233
|
+
|
|
234
|
+
GREEN (Implement to pass):
|
|
235
|
+
1. Write minimal code to make test pass
|
|
236
|
+
2. Run test - must pass
|
|
237
|
+
3. Commit: feat(phase-plan): implement X
|
|
238
|
+
|
|
239
|
+
REFACTOR (if needed):
|
|
240
|
+
1. Clean up implementation
|
|
241
|
+
2. Run tests - must still pass
|
|
242
|
+
3. Commit: refactor(phase-plan): clean up X
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Commit Patterns
|
|
246
|
+
|
|
247
|
+
### Atomic Commits
|
|
248
|
+
One commit per task, clearly scoped:
|
|
249
|
+
```bash
|
|
250
|
+
# Task 1
|
|
251
|
+
git add src/models/user.ts
|
|
252
|
+
git commit -m "feat(01-01): create User model
|
|
253
|
+
|
|
254
|
+
- Add User interface with id, email, name
|
|
255
|
+
- Add validation methods
|
|
256
|
+
- Export from models/index.ts"
|
|
257
|
+
|
|
258
|
+
# Task 2
|
|
259
|
+
git add src/api/users.ts
|
|
260
|
+
git commit -m "feat(01-01): create user API endpoints
|
|
261
|
+
|
|
262
|
+
- GET /users - list all users
|
|
263
|
+
- GET /users/:id - get single user
|
|
264
|
+
- POST /users - create user
|
|
265
|
+
- Add authentication middleware"
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### Conventional Commit Format
|
|
269
|
+
```
|
|
270
|
+
type(scope): subject
|
|
271
|
+
|
|
272
|
+
body (optional)
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Types:
|
|
276
|
+
- `feat` - New feature
|
|
277
|
+
- `fix` - Bug fix
|
|
278
|
+
- `test` - Test-only changes
|
|
279
|
+
- `refactor` - Code cleanup
|
|
280
|
+
- `docs` - Documentation
|
|
281
|
+
- `perf` - Performance improvement
|
|
282
|
+
- `chore` - Config/tooling
|
|
283
|
+
|
|
284
|
+
## Skills Integration
|
|
285
|
+
|
|
286
|
+
### Skill Loading Levels
|
|
287
|
+
|
|
288
|
+
**Level 1: Metadata (Always)**
|
|
289
|
+
- Load skill name, description, triggers
|
|
290
|
+
- Low token cost
|
|
291
|
+
- Used for skill discovery
|
|
292
|
+
|
|
293
|
+
**Level 2: Instructions (On Use)**
|
|
294
|
+
- Load full skill instructions when triggered
|
|
295
|
+
- Applied to system prompt
|
|
296
|
+
- Enables specialized behavior
|
|
297
|
+
|
|
298
|
+
**Level 3: Resources (On Demand)**
|
|
299
|
+
- Load large resources (docs, examples) only when referenced
|
|
300
|
+
- Prevents context bloat
|
|
301
|
+
- Progressive disclosure
|
|
302
|
+
|
|
303
|
+
### Skill Composition
|
|
304
|
+
Skills can require other skills:
|
|
305
|
+
```yaml
|
|
306
|
+
---
|
|
307
|
+
name: security-audit
|
|
308
|
+
requires:
|
|
309
|
+
- owasp-checklist
|
|
310
|
+
- vulnerability-database
|
|
311
|
+
---
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
## Error Recovery
|
|
315
|
+
|
|
316
|
+
### Context Overflow Recovery
|
|
317
|
+
When context usage > 70%:
|
|
318
|
+
1. Save current state to checkpoint
|
|
319
|
+
2. Summarize completed work
|
|
320
|
+
3. Return to orchestrator
|
|
321
|
+
4. Spawn fresh agent with summary
|
|
322
|
+
|
|
323
|
+
### Failed Task Recovery
|
|
324
|
+
When task verification fails:
|
|
325
|
+
1. Analyze failure cause
|
|
326
|
+
2. Attempt auto-fix (Rules 1-3)
|
|
327
|
+
3. If unfixable, create checkpoint for user
|
|
328
|
+
4. Document in SUMMARY.md
|
|
329
|
+
|
|
330
|
+
### Agent Timeout Recovery
|
|
331
|
+
When agent doesn't complete:
|
|
332
|
+
1. Check if checkpoint saved
|
|
333
|
+
2. Resume from checkpoint if available
|
|
334
|
+
3. Otherwise, restart with reduced scope
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Three-Tier Boundary System
|
|
2
|
+
|
|
3
|
+
GoopSpec enforces a three-tier boundary system to control agent behavior. These boundaries are defined in the project configuration and respected by all agents.
|
|
4
|
+
|
|
5
|
+
## Tiers
|
|
6
|
+
|
|
7
|
+
### Tier 1: Always
|
|
8
|
+
|
|
9
|
+
Actions the agent MUST perform without asking. These are non-negotiable quality gates.
|
|
10
|
+
|
|
11
|
+
**Default Always Actions:**
|
|
12
|
+
- Run tests before committing
|
|
13
|
+
- Run linter before committing
|
|
14
|
+
- Update ADL.md when making architectural decisions
|
|
15
|
+
- Follow code style conventions
|
|
16
|
+
- Commit atomically after each task
|
|
17
|
+
- Run audit after execution phase
|
|
18
|
+
- Confirm outcomes with user before planning next phase
|
|
19
|
+
|
|
20
|
+
**Configuration:**
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"boundaries": {
|
|
24
|
+
"always": [
|
|
25
|
+
"run_tests_before_commit",
|
|
26
|
+
"update_adl_on_decisions",
|
|
27
|
+
"follow_conventions",
|
|
28
|
+
"atomic_commits"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Tier 2: Ask First
|
|
35
|
+
|
|
36
|
+
Actions that require user confirmation before proceeding. These have significant impact and deserve human review.
|
|
37
|
+
|
|
38
|
+
**Default Ask First Actions:**
|
|
39
|
+
- Database schema changes
|
|
40
|
+
- Adding new dependencies
|
|
41
|
+
- Changing authentication mechanisms
|
|
42
|
+
- Modifying CI/CD configuration
|
|
43
|
+
- Deleting files
|
|
44
|
+
- Changes to production configuration
|
|
45
|
+
- External service integrations
|
|
46
|
+
|
|
47
|
+
**Configuration:**
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"boundaries": {
|
|
51
|
+
"ask_first": [
|
|
52
|
+
"schema_changes",
|
|
53
|
+
"new_dependencies",
|
|
54
|
+
"auth_changes",
|
|
55
|
+
"delete_files",
|
|
56
|
+
"production_config"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Tier 3: Never
|
|
63
|
+
|
|
64
|
+
Actions the agent is PROHIBITED from performing. These are hard stops.
|
|
65
|
+
|
|
66
|
+
**Default Never Actions:**
|
|
67
|
+
- Commit secrets or credentials
|
|
68
|
+
- Ignore test failures
|
|
69
|
+
- Modify files outside spec scope (in strict mode)
|
|
70
|
+
- Push to protected branches without PR
|
|
71
|
+
- Delete production data
|
|
72
|
+
- Disable security features
|
|
73
|
+
- Skip code review for critical changes
|
|
74
|
+
|
|
75
|
+
**Configuration:**
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"boundaries": {
|
|
79
|
+
"never": [
|
|
80
|
+
"commit_secrets",
|
|
81
|
+
"ignore_test_failures",
|
|
82
|
+
"modify_outside_scope",
|
|
83
|
+
"push_to_protected",
|
|
84
|
+
"delete_production_data"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Enforcement
|
|
91
|
+
|
|
92
|
+
### Spec Enforcer Hook
|
|
93
|
+
|
|
94
|
+
The `spec-enforcer` hook monitors `write` and `edit` tool calls:
|
|
95
|
+
- Checks if target file is in spec scope
|
|
96
|
+
- Warns or blocks based on `strict_mode` setting
|
|
97
|
+
- Logs violations for audit
|
|
98
|
+
|
|
99
|
+
### Stop Enforcer Hook
|
|
100
|
+
|
|
101
|
+
The `stop-enforcer` hook prevents premature exits:
|
|
102
|
+
- Blocks stop if incomplete todos remain
|
|
103
|
+
- Requires all "Always" checks to pass
|
|
104
|
+
- Enforces commit before stop if files modified
|
|
105
|
+
|
|
106
|
+
### Permission Hook
|
|
107
|
+
|
|
108
|
+
The `permission.ask` hook intercepts permission requests:
|
|
109
|
+
- Auto-allows "Always" actions
|
|
110
|
+
- Prompts user for "Ask First" actions
|
|
111
|
+
- Denies "Never" actions with explanation
|
|
112
|
+
|
|
113
|
+
## Custom Boundaries
|
|
114
|
+
|
|
115
|
+
Projects can customize boundaries in `.goopspec/config.json`:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"boundaries": {
|
|
120
|
+
"always": [
|
|
121
|
+
"run_tests_before_commit",
|
|
122
|
+
"update_changelog"
|
|
123
|
+
],
|
|
124
|
+
"ask_first": [
|
|
125
|
+
"modify_api_contracts",
|
|
126
|
+
"change_error_codes"
|
|
127
|
+
],
|
|
128
|
+
"never": [
|
|
129
|
+
"use_deprecated_apis",
|
|
130
|
+
"hardcode_credentials"
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Best Practices
|
|
137
|
+
|
|
138
|
+
1. **Start conservative:** Begin with strict boundaries, relax as trust builds.
|
|
139
|
+
2. **Document exceptions:** If bypassing a boundary, log to ADL with rationale.
|
|
140
|
+
3. **Review regularly:** Audit boundary violations to refine rules.
|
|
141
|
+
4. **Team alignment:** Ensure all team members understand the boundaries.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Deviation Rules
|
|
2
|
+
|
|
3
|
+
GoopSpec uses a 4-rule deviation system to handle unexpected situations during execution. These rules determine when the agent can auto-fix issues vs when to stop and ask the user.
|
|
4
|
+
|
|
5
|
+
## Rule 1: Bug Fixes (Auto-Fix)
|
|
6
|
+
|
|
7
|
+
**Trigger:** Wrong logic, type errors, runtime errors, security vulnerabilities in existing code.
|
|
8
|
+
|
|
9
|
+
**Action:** Fix immediately without asking.
|
|
10
|
+
|
|
11
|
+
**Examples:**
|
|
12
|
+
- Type mismatch causing compilation error
|
|
13
|
+
- Null pointer dereference
|
|
14
|
+
- SQL injection vulnerability
|
|
15
|
+
- Off-by-one errors
|
|
16
|
+
- Missing error handling causing crashes
|
|
17
|
+
|
|
18
|
+
**Rationale:** Bugs are unambiguously wrong. Fixing them improves quality without changing intent.
|
|
19
|
+
|
|
20
|
+
## Rule 2: Missing Critical Functionality (Auto-Fix)
|
|
21
|
+
|
|
22
|
+
**Trigger:** Implementation lacks essential error handling, validation, or security checks that any professional implementation would include.
|
|
23
|
+
|
|
24
|
+
**Action:** Add the missing functionality without asking.
|
|
25
|
+
|
|
26
|
+
**Examples:**
|
|
27
|
+
- Missing input validation on user data
|
|
28
|
+
- Missing authentication checks on protected routes
|
|
29
|
+
- Missing error boundaries in React components
|
|
30
|
+
- Missing transaction rollback on failure
|
|
31
|
+
- Missing rate limiting on API endpoints
|
|
32
|
+
|
|
33
|
+
**Rationale:** These are implicit requirements that experienced developers always include.
|
|
34
|
+
|
|
35
|
+
## Rule 3: Blocking Issues (Auto-Fix)
|
|
36
|
+
|
|
37
|
+
**Trigger:** Missing dependencies, broken imports, configuration errors, environment issues that prevent execution.
|
|
38
|
+
|
|
39
|
+
**Action:** Fix to unblock progress without asking.
|
|
40
|
+
|
|
41
|
+
**Examples:**
|
|
42
|
+
- Missing npm package in dependencies
|
|
43
|
+
- Broken import path
|
|
44
|
+
- Missing environment variable with obvious default
|
|
45
|
+
- TypeScript config preventing compilation
|
|
46
|
+
- Missing build script
|
|
47
|
+
|
|
48
|
+
**Rationale:** These are technical blockers, not design decisions.
|
|
49
|
+
|
|
50
|
+
## Rule 4: Architectural Decisions (STOP and Ask)
|
|
51
|
+
|
|
52
|
+
**Trigger:** Schema changes, framework switches, new technology introduction, significant structural changes.
|
|
53
|
+
|
|
54
|
+
**Action:** STOP execution and ask the user for a decision.
|
|
55
|
+
|
|
56
|
+
**Examples:**
|
|
57
|
+
- Database schema modification
|
|
58
|
+
- Switching from REST to GraphQL
|
|
59
|
+
- Adding a new major dependency (ORM, state management)
|
|
60
|
+
- Changing authentication mechanism
|
|
61
|
+
- Restructuring project layout
|
|
62
|
+
- Changing data models
|
|
63
|
+
|
|
64
|
+
**Rationale:** These decisions have long-term consequences and require human judgment.
|
|
65
|
+
|
|
66
|
+
## Deviation Log
|
|
67
|
+
|
|
68
|
+
When a deviation occurs, log it to the ADL (Automated Decision Log) with:
|
|
69
|
+
- Rule number triggered
|
|
70
|
+
- Description of the issue
|
|
71
|
+
- Action taken (auto-fix or user decision)
|
|
72
|
+
- Files modified
|
|
73
|
+
- Commit hash (if applicable)
|
|
74
|
+
|
|
75
|
+
## Implementation Notes
|
|
76
|
+
|
|
77
|
+
1. **Confidence threshold:** If uncertain which rule applies, default to Rule 4 (ask user).
|
|
78
|
+
2. **Scope check:** Deviations should not modify files outside the active spec scope.
|
|
79
|
+
3. **Commit atomically:** Each deviation fix should be a separate atomic commit.
|
|
80
|
+
4. **Document rationale:** Always explain WHY in the commit message and ADL entry.
|