@eskoubar95/spec 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/lib/copy-template.js +6 -6
  2. package/dist/lib/copy-template.js.map +1 -1
  3. package/package.json +2 -2
  4. package/template/.cursor/MCP-SETUP.md +16 -0
  5. package/template/.cursor/agents/batch-runner.md +52 -0
  6. package/template/.cursor/agents/verifier.md +40 -0
  7. package/template/.cursor/commands/_shared/branch-detection.md +78 -0
  8. package/template/.cursor/commands/_shared/git-workflow.md +3 -1
  9. package/template/.cursor/commands/_shared/github-workflows.md +7 -5
  10. package/template/.cursor/commands/_shared/helper-metadata.md +20 -0
  11. package/template/.cursor/commands/_shared/linear-automation.md +14 -6
  12. package/template/.cursor/commands/_shared/linear-helpers.md +26 -14
  13. package/template/.cursor/commands/_shared/pr-description.md +11 -2
  14. package/template/.cursor/commands/spec/init.md +249 -15
  15. package/template/.cursor/commands/spec/plan.md +302 -7
  16. package/template/.cursor/commands/spec/refine.md +80 -2
  17. package/template/.cursor/commands/task/batch.md +112 -0
  18. package/template/.cursor/commands/task/start.md +318 -5
  19. package/template/.cursor/commands/task/validate.md +396 -1
  20. package/template/.cursor/rules/02-work-mode.mdc +71 -0
  21. package/template/.cursor/rules/openmemory.mdc +1 -1
  22. package/template/.cursor/scripts/{validate-helpers.js → validate-helpers.cjs} +30 -32
  23. package/template/.cursor/skills/sdd-commit-unit/SKILL.md +42 -0
  24. package/template/.cursor/skills/sdd-design-system-bootstrap/SKILL.md +35 -0
  25. package/template/.cursor/skills/sdd-git-default-branch/SKILL.md +49 -0
  26. package/template/.cursor/skills/sdd-pr-create-or-update/SKILL.md +41 -0
  27. package/template/.cursor/skills/sdd-task-preflight/SKILL.md +47 -0
  28. package/template/.cursor/skills/sdd-validation-suite/SKILL.md +47 -0
  29. package/template/spec/00-root-spec.md +9 -0
  30. package/template/spec/templates/02-architecture.md +64 -0
  31. package/template/spec/templates/06-acceptance.md +59 -0
  32. package/template/spec/templates/07-design-system.md +145 -0
  33. package/template/spec/templates/08-infrastructure.md +76 -0
  34. package/template/spec/templates/09-sitemap.md +50 -0
  35. package/template/work/backlog/tasks.local.md +6 -0
  36. package/template/work/linear/FALLBACK-STRATEGY.md +84 -0
  37. package/template/work/linear/LABEL-MAPPING-GUIDE.md +72 -0
  38. package/template/work/linear/SETUP.md +75 -0
  39. package/template/work/linear/sync-config.md +86 -0
@@ -1,8 +1,51 @@
1
- You are validating the completion of a single task using Spec-Driven Development (SDD).
1
+ You are a **Quality Auditor** using Spec-Driven Development (SDD).
2
+
3
+ **Your role:** Quality Auditor
4
+ **Your job:** Validate task completion, ensure correctness and quality before integration
5
+ **Your context:** Task validation and quality assurance
2
6
 
3
7
  MODE: Validation / Quality Gate
4
8
  GOAL: Ensure the task is correct, complete, and safe to integrate before commit or PR.
5
9
 
10
+ ---
11
+
12
+ ## State Assertion (REQUIRED)
13
+
14
+ **Before starting, output:**
15
+
16
+ **SDD MODE:** /task/validate
17
+ - **Mode:** Validation
18
+ - **Recommended Cursor Mode:** Debug
19
+ - **Why:** This command validates completion and can debug issues. Debug mode is optimal for runtime analysis and debugging.
20
+ - **Alternative:** Plan mode for validation only (without debugging)
21
+ - **Context:** [Will be populated after detection]
22
+ - **Active Rule Sets:** [Will be populated after activation]
23
+ - **Implementation:** BLOCKED (validation only, fixes allowed)
24
+ - **Boundaries:**
25
+ - WILL: Validate correctness, check scope, verify spec alignment, run automated checks, suggest fixes
26
+ - WILL NOT: Implement new features, expand scope, skip validation steps
27
+
28
+ ---
29
+
30
+ ## Step 0 — Project Detection and Rule Activation
31
+
32
+ **Before starting, run detection and activation:**
33
+
34
+ 1. **Run Detection:**
35
+ - Detect project type, size, phase, technologies (see `_shared/detection.md`)
36
+ - Read from `.sdd/detection-cache.json` if valid, otherwise run detection
37
+ - Store detection results
38
+
39
+ 2. **Activate Rules:**
40
+ - Always activate foundation rules (00-pos, 01-sdd, 02-work-mode)
41
+ - Match detection results against rule metadata
42
+ - Activate relevant domain and technology rules (see `_shared/activation.md`)
43
+ - Output active rule list
44
+
45
+ 3. **Update State Assertion:**
46
+ - Include detection results in Context
47
+ - Include active rule sets in Active Rule Sets
48
+
6
49
  Inputs (source of truth):
7
50
  - `spec/00-root-spec.md`
8
51
  - `spec/06-acceptance.md` (if it exists)
@@ -35,6 +78,95 @@ Ask what evidence exists:
35
78
  - Manual verification steps
36
79
  - Screenshots, logs, or other proof
37
80
 
81
+ ## Workspace scope (REQUIRED for monorepos)
82
+
83
+ **ONLY EXECUTE IF:** detection indicates `projectType=monorepo`
84
+
85
+ - Require an explicit workspace scope for the task (from `work/backlog/tasks.local.md` `**Workspace:**` or from the Linear issue description).
86
+ - Run validation commands scoped to that workspace only.
87
+ - If workspace scope is missing → **HARD STOP** and require the user to define it (do not run repo-wide validation).
88
+
89
+ **Documentation Lookup (if framework-specific issue found):**
90
+
91
+ **ONLY READ IF framework/tool detected or documentation needed:**
92
+ - Read `.cursor/commands/_shared/documentation-lookup.md` ONLY IF framework/tool detected in Step 0 OR debugging framework-specific issues
93
+ - Read sections: "Context7 Integration" (lines 10-80), "Documentation Lookup Logic" (lines 17-150)
94
+ - Skip if: No framework/tool detected and no documentation needed → skip documentation lookup entirely
95
+ - Check condition: Run detection first, then read helper only if condition met
96
+
97
+ If framework-specific issue found during validation:
98
+ 1. Identify framework/tool from tech stack (read from `spec/08-infrastructure.md` or `spec/02-architecture.md`)
99
+ 2. Try multiple documentation sources (in priority order):
100
+ - **Context7 MCP:** Query Context7: "[Framework/Tool Name] [issue topic]"
101
+ - **Cursor Documentation Indexing:** Search Cursor's indexed documentation
102
+ - **Web Search:** Search web for "[Framework] [issue] troubleshooting" if needed
103
+ - **General Patterns:** Use general engineering patterns from `10-engineering.mdc`
104
+ 3. Combine information from available sources when helpful
105
+ 4. Use documentation to verify correct usage
106
+ 5. Suggest fixes based on documentation from available sources
107
+
108
+ **Smart Thinking:**
109
+ - Be adaptive and flexible - use whatever sources are available
110
+ - Don't be rigid - if one source fails, try others
111
+ - Combine information from multiple sources when helpful
112
+ - Search for understanding if needed - use web search to understand framework better
113
+
114
+ **Error Handling:**
115
+ - If Context7 unavailable → try Cursor indexing, web search, or cached documentation
116
+ - Do NOT block workflow if documentation unavailable
117
+ - Continue with available information
118
+
119
+ **Automated validation (run before asking user):**
120
+ 1. Pre-commit checks:
121
+ - Run linter (if configured): use project's lint command
122
+ - Run build (if applicable): use project's build command
123
+ - Check type errors: use project's type checking command (if TypeScript/typed project)
124
+ - Verify no console errors (if possible)
125
+
126
+ 2. **Test Execution (if test framework detected):**
127
+
128
+ **ONLY READ IF test framework detected:**
129
+ - Read `.cursor/commands/_shared/test-automation.md` ONLY IF test framework detected in Step 0
130
+ - Read sections: "Test Framework Detection" (lines 14-67), "Test Execution" (lines 68-154)
131
+ - Skip if: No test framework found → skip test automation entirely
132
+ - Check condition: Run detection first, then read helper only if condition met
133
+
134
+ **Test Automation:**
135
+ - Detect test framework (Jest, Vitest, Playwright, Cypress, etc.)
136
+ - If framework detected → run tests automatically
137
+ - Parse test results (pass/fail count, failures)
138
+ - Collect test coverage (if enabled)
139
+ - Report test status:
140
+ - If tests pass → "✅ Tests passed (X tests)"
141
+ - If tests fail → "❌ Tests failed (X failed, Y passed)" + list failures
142
+ - If no framework detected → "⚠️ No test framework detected. Skipping test execution."
143
+
144
+ **Test Failure Handling:**
145
+ - If tests fail → report failures clearly
146
+ - Block validation if `REQUIRE_TESTS_PASS=true` (optional, default: false)
147
+ - If blocking disabled → warn but continue validation
148
+
149
+ **Test Coverage:**
150
+ - Collect coverage metrics (if enabled)
151
+ - Compare with previous coverage (if available)
152
+ - Report coverage percentage
153
+ - Flag significant coverage decrease (> 10%)
154
+
155
+ 3. Automated validation checklist:
156
+ - [ ] Linter passes
157
+ - [ ] Build succeeds
158
+ - [ ] Type checking passes (if applicable)
159
+ - [ ] Tests pass (if test framework detected)
160
+ - [ ] Test coverage acceptable (if coverage enabled)
161
+ - [ ] No console errors (if applicable)
162
+ - [ ] Manual testing completed (user confirms)
163
+
164
+ **Present validation checklist based on task type:**
165
+ - For UI tasks: "Test on mobile/tablet/desktop, verify responsive breakpoints, check accessibility"
166
+ - For API tasks: "Test endpoints, verify error handling, check response formats"
167
+ - For config tasks: "Verify functionality, check logs, test configuration changes"
168
+ - For design tasks: "Verify visual consistency, check accessibility, test on different devices"
169
+
38
170
  If testing is missing but appropriate, flag it explicitly.
39
171
  Do not write tests unless asked.
40
172
 
@@ -49,6 +181,28 @@ Assess whether the task is:
49
181
  - Ready for PR
50
182
  - Requires follow-up work
51
183
 
184
+ **Automated merge workflow (if user prefers):**
185
+ 1. Pre-merge checks:
186
+ - Verify all changes are committed
187
+ - Run build/test (if applicable)
188
+ - Resolve `defaultBranch` (do not assume `main`) using `/sdd-git-default-branch` or `branch-detection.md`
189
+ - Check for merge conflicts with base: `git fetch origin <default-branch> && git merge-base HEAD origin/<default-branch>`
190
+
191
+ 2. Merge to base branch:
192
+ - Checkout base (default branch): `git checkout <default-branch>`
193
+ - Pull latest (if remote exists): `git pull origin <default-branch>`
194
+ - Merge task branch: `git merge task/{task-id}-{short-description}`
195
+ - Push to remote (if configured): `git push origin <default-branch>`
196
+
197
+ 3. Post-merge cleanup:
198
+ - Delete local task branch (optional, ask first): `git branch -d task/{task-id}-{short-description}`
199
+ - Verify base branch is clean
200
+
201
+ **Ask user preference:**
202
+ - "Should I auto-commit on task completion?" (if not already committed)
203
+ - "Should I auto-merge to the base branch on validation?" (if validated)
204
+ - "Should I delete task branch after merge?" (optional)
205
+
52
206
  If follow-up is required:
53
207
  - Propose new tasks and add them to `tasks.local.md`
54
208
 
@@ -58,6 +212,247 @@ Conclude with one of the following outcomes:
58
212
  - Requires fixes (clearly listed)
59
213
  - Requires spec refinement (`/spec/refine`)
60
214
 
215
+ **Step 7.1) Linear Issue Update (if Linear task and Linear mode enabled):**
216
+
217
+ **ONLY READ IF Linear mode enabled AND task is Linear issue:**
218
+ - Read `.cursor/commands/_shared/linear-automation.md` ONLY IF `work/linear/sync-config.md` exists AND `MODE=linear` AND task ID is Linear format (e.g., `LIN-123`)
219
+ - Auto-loads: `linear-helpers.md` (dependency)
220
+ - Read sections: "Detection Logic" (lines 9-32), "Issues" (lines 82-130) from linear-automation.md
221
+ - Read sections from linear-helpers.md (auto-loaded): "Status Mapping" (lines 1-50)
222
+ - Skip if: Linear mode not enabled OR task is local only → skip Linear update entirely
223
+ - Check condition: Verify Linear mode and task format before reading helpers
224
+
225
+ 1. **Check if task is Linear issue:**
226
+ - If task ID is Linear format (e.g., `LIN-123`) → proceed with Linear update
227
+ - If task is local only → skip Linear update
228
+
229
+ 2. **Update Linear issue status:**
230
+ - Map validation result to Linear status (use status mapping from linear-helpers.md):
231
+ - **Approved:** "Done" (or `STATUS_DONE` from config)
232
+ - **Requires fixes:** "In Progress" (or `STATUS_IN_PROGRESS` from config)
233
+ - **Requires spec refinement:** "Blocked" (or `STATUS_BLOCKED` from config)
234
+ - Update issue status using Linear MCP
235
+ - If status not found → guide user to create custom status
236
+
237
+ 3. **Create Linear comment with validation summary:**
238
+ - Add a structured comment to Linear issue (recommended format):
239
+ - “Validated `<task-id>` via SDD: `<pass/fail>`. Evidence: `<lint/tests/build>`. PR: `<url>` (if any).”
240
+ - Include acceptance summary (1–3 bullets) and any follow-up actions (if any)
241
+
242
+ **Error Handling:**
243
+ - If Linear MCP unavailable → continue without Linear update
244
+ - If Linear operation fails → log error, continue without Linear update
245
+ - Never block workflow due to Linear errors
246
+
247
+ **Step 7.2) Linear Document Update (if task-level spec exists and Linear mode enabled):**
248
+
249
+ **ONLY READ IF Linear mode enabled AND task-level spec exists AND AUTO_CREATE_DOCUMENTS=true:**
250
+ - Read `.cursor/commands/_shared/linear-automation.md` ONLY IF Linear mode enabled AND `spec/tasks/[task-id]/spec.md` exists AND `AUTO_CREATE_DOCUMENTS=true`
251
+ - Auto-loads: `linear-helpers.md` (dependency)
252
+ - Read sections: "Documents" (lines 35-80) from linear-automation.md
253
+ - Skip if: Linear mode not enabled OR no task-level spec OR AUTO_CREATE_DOCUMENTS=false → skip Linear document update entirely
254
+ - Check condition: Verify all conditions before reading helper
255
+
256
+ 1. **Check if task-level spec exists:**
257
+ - If `spec/tasks/[task-id]/spec.md` exists → proceed with document update
258
+ - If not exists → skip document update
259
+
260
+ 2. **Check if Linear mode enabled and AUTO_CREATE_DOCUMENTS=true:**
261
+ - If not enabled → skip Linear document update
262
+ - If enabled → proceed with document update
263
+
264
+ 3. **Update Linear document:**
265
+ - Check if Linear document exists (use idempotency check from linear-helpers.md)
266
+ - If exists → update with task-level spec content
267
+ - If not exists → create Linear document (same as Step 1.6 in `/task/start`)
268
+
269
+ **Error Handling:**
270
+ - If Linear MCP unavailable → continue without Linear document update
271
+ - If Linear operation fails → log error, continue without Linear document update
272
+ - Never block workflow due to Linear errors
273
+
274
+ **Step 7.3) CodeRabbit Integration (if PR exists):**
275
+
276
+ **ONLY READ IF PR exists:**
277
+ - Read `.cursor/commands/_shared/coderabbit-integration.md` ONLY IF PR exists for current branch
278
+ - Auto-loads: `github-helpers.md` (dependency)
279
+ - Read sections: "CodeRabbit Detection" (lines 14-60), "Conversation Resolution" (lines 121-180) from coderabbit-integration.md
280
+ - Read sections from github-helpers.md (auto-loaded): "Read PR Conversations" (lines 51-100), "Resolve Conversations" (lines 101-150)
281
+ - Skip if: No PR exists → skip CodeRabbit integration entirely
282
+ - Check condition: Verify PR exists via GitHub MCP/CLI before reading helpers
283
+
284
+ 1. **Check if PR exists:**
285
+ - Get current branch name
286
+ - Check if PR exists for current branch (via GitHub MCP or CLI)
287
+ - If no PR exists → skip CodeRabbit integration
288
+ - If PR exists → proceed with CodeRabbit handling
289
+
290
+ 2. **Read CodeRabbit comments:**
291
+ - Use GitHub helpers to read PR comments (MCP → CLI → Local fallback)
292
+ - Detect CodeRabbit comments (pattern search + author check)
293
+ - Filter to only CodeRabbit comments
294
+
295
+ 3. **For each CodeRabbit comment:**
296
+ - **Check if already resolved:**
297
+ - Read tracking file (`.sdd/github-resolved-issues.json`)
298
+ - If comment already resolved → skip
299
+
300
+ - **Check if issue is fixed in code:**
301
+ - Read file mentioned in comment
302
+ - Compare comment suggestion with current code
303
+ - If issue already fixed → mark for resolution
304
+
305
+ - **If issue fixed:**
306
+ - Resolve conversation via GitHub helpers
307
+ - Update tracking file with resolution
308
+ - Add comment: "Issue resolved in code"
309
+
310
+ - **If issue not fixed:**
311
+ - Evaluate if issue should be resolved (check importance, refactoring rules)
312
+ - If should be resolved → create task in backlog
313
+ - If shouldn't be resolved → provide argumentation (log to Linear/GitHub/local)
314
+
315
+ 4. **Report CodeRabbit handling:**
316
+ - Summarize: "X CodeRabbit comments processed, Y resolved, Z deferred"
317
+ - List any deferred issues with reasoning
318
+
319
+ **Error Handling:**
320
+ - If GitHub MCP/CLI unavailable → skip CodeRabbit integration, continue workflow
321
+ - If PR not found → skip CodeRabbit integration, continue workflow
322
+ - If comment parsing fails → log error, continue with next comment
323
+ - Never block workflow due to CodeRabbit integration failures
324
+
325
+ **ONLY READ IF validated and ready for PR:**
326
+ - Read `.cursor/commands/_shared/git-workflow.md` ONLY IF task validated AND ready for PR
327
+ - Read `.cursor/commands/_shared/pr-description.md` ONLY IF PR creation/update needed
328
+ - Read `.cursor/commands/_shared/deployment-detection.md` ONLY IF deployment provider detected
329
+ - Read sections: "State Detection" (lines 81-150), "Next Step Logic" (lines 151-220) from git-workflow.md; "PR Description Template" (lines 1-100) from pr-description.md; "Provider Detection" (lines 13-91), "Preview Deployment Logic" (lines 92-194) from deployment-detection.md
330
+ - Skip if: Task not validated OR not ready for PR → skip Git workflow automation entirely
331
+ - Check condition: Verify validation status and PR readiness before reading helpers
332
+
333
+ 1. **Update State Tracking:**
334
+ - Read current state from `.sdd/git-state.json`
335
+ - Update state: `validated: true`
336
+ - Update commit count if commits were made
337
+ - Update last commit hash
338
+ - Save updated state
339
+
340
+ 2. **Check if PR Already Exists:**
341
+ - Get current branch name
342
+ - Check if PR exists for branch (via GitHub MCP or CLI)
343
+ - If PR exists → skip to Step 3 (update PR if needed)
344
+ - If no PR → proceed to Step 2.1 (create PR)
345
+
346
+ 3. **Generate Commit Message (if changes not committed):**
347
+ - If uncommitted changes exist → generate commit message
348
+ - Use git-workflow.md helper:
349
+ - Analyze git diff for changed files
350
+ - Determine commit type (feat/fix/refactor/etc.)
351
+ - Generate description from task/changes
352
+ - Format: `[task-id] type: description`
353
+ - Ask user: "Should I commit these changes with message: '[generated message]'?"
354
+ - If yes → commit with generated message
355
+ - Update state: increment commit count
356
+
357
+ 4. **Create PR (if no PR exists and validated):**
358
+
359
+ **4.1) Generate PR Description:**
360
+ - Use pr-description.md helper:
361
+ - Read task spec (from `work/backlog/tasks.local.md` or task-level spec)
362
+ - Generate changes summary from git diff and commit history
363
+ - Extract acceptance criteria from task
364
+ - Include testing notes
365
+ - Reference related Linear issues (if Linear enabled)
366
+ - Generate PR description using template
367
+
368
+ **4.2) Push Branch (if not pushed):**
369
+ - Check if branch is pushed to remote
370
+ - If not pushed → push branch: `git push -u origin <branch-name>`
371
+ - Update state: `branch.pushed: true`
372
+
373
+ **4.3) Create PR:**
374
+ - Use GitHub helpers (MCP → CLI → Local fallback)
375
+ - Create PR with generated description
376
+ - Set PR title: `[task-id] [task description]`
377
+ - Link to Linear issue (if Linear enabled and task is Linear issue)
378
+ - Get PR number and URL
379
+ - Update state: `pr: {exists: true, number: X, url: Y, status: 'open'}`
380
+
381
+ 5. **Handle Deployment (if PR created):**
382
+
383
+ **5.1) Detect Deployment Provider:**
384
+ - Use deployment-detection.md helper:
385
+ - Check for provider config files (vercel.json, railway.json, netlify.toml)
386
+ - Read spec/08-infrastructure.md for deployment config
387
+ - Detect provider (Vercel, Railway, Netlify, etc.)
388
+
389
+ **5.2) Trigger Preview Deployment (if provider detected):**
390
+ - If provider supports auto-deployment → wait for deployment
391
+ - If manual deployment needed → trigger deployment (if possible)
392
+ - Check deployment status (with timeout)
393
+ - Get preview URL when deployment completes
394
+
395
+ **5.3) Update PR with Preview URL:**
396
+ - If preview URL available → add to PR description
397
+ - Format: `### Preview\n[Preview URL](url)`
398
+ - Update PR via GitHub helpers
399
+ - Update state: `deployment: {provider: X, preview_url: Y, status: 'success'}`
400
+
401
+ 6. **Determine Next Step:**
402
+ - Based on current state, determine next action:
403
+ - "PR created, deployed → Ready for review"
404
+ - "PR created, deployment pending → Waiting for deployment"
405
+ - "PR created, no deployment → PR ready (no preview available)"
406
+ - Report next step to user
407
+
408
+ **ONLY READ IF preview URL available OR performance enabled:**
409
+ - Read `.cursor/commands/_shared/performance-monitoring.md` ONLY IF preview URL available OR performance monitoring enabled
410
+ - Read sections: "Performance Metrics Collection" (lines 14-80), "Lighthouse Integration" (lines 199-250)
411
+ - Skip if: No preview URL AND performance not enabled → skip performance monitoring entirely
412
+ - Check condition: Verify preview URL availability or performance config before reading helper
413
+
414
+ 1. **Collect Performance Metrics (if enabled):**
415
+ - Measure bundle size (if build output available)
416
+ - Track load time metrics (if preview URL available)
417
+ - Monitor API response times (if applicable)
418
+ - Store metrics in `.sdd/performance-metrics.json`
419
+
420
+ 2. **Run Lighthouse Audit (if preview URL available):**
421
+ - Run Lighthouse audit on preview URL
422
+ - Collect performance, accessibility, SEO, best practices scores
423
+ - Parse Lighthouse JSON output
424
+ - Compare scores with baseline (if available)
425
+
426
+ 3. **Detect Performance Regressions:**
427
+ - Compare current metrics with previous build/commit
428
+ - Flag significant regressions (> 20% degradation)
429
+ - Check performance budgets (if configured)
430
+ - Report performance status
431
+
432
+ 4. **Add Performance Report to PR (if PR exists):**
433
+ - Add performance metrics to PR comment
434
+ - Show Lighthouse scores
435
+ - Highlight regressions
436
+ - Suggest optimizations (if needed)
437
+
438
+ **Error Handling:**
439
+ - If performance monitoring unavailable → skip monitoring, continue workflow
440
+ - If Lighthouse audit fails → skip Lighthouse, continue workflow
441
+ - If metrics collection fails → skip metrics, continue workflow
442
+ - Never block workflow due to performance monitoring failures
443
+
444
+ **Error Handling:**
445
+ - If state file not writable → continue without state tracking (degraded mode)
446
+ - If PR creation fails → report error, allow manual PR creation
447
+ - If deployment fails → report error, continue without preview URL
448
+ - If GitHub MCP/CLI unavailable → skip PR creation, continue workflow
449
+ - Never block workflow due to automation failures
450
+
451
+ **User Preferences:**
452
+ - Ask user: "Should I auto-create PR after validation?" (if not already configured)
453
+ - Ask user: "Should I auto-deploy to preview?" (if deployment available)
454
+ - Respect user preferences for automation level
455
+
61
456
  PRINCIPLES:
62
457
  - Validation is about confidence, not perfection
63
458
  - Evidence beats assumptions
@@ -63,3 +63,74 @@ A task is only considered complete when:
63
63
 
64
64
  ## Goal
65
65
  Enable focused, professional execution that aligns implementation with intent.
66
+
67
+ ## Error recovery automation
68
+ **Common error patterns and automatic recovery:**
69
+ - If build fails with undefined property errors → automatically suggest: "Try cleaning build cache and rebuilding"
70
+ - If lockfile outdated → automatically suggest: "Run package manager install to sync lockfile"
71
+ - If dependency missing → automatically suggest: "Add to package.json (or equivalent) and run install"
72
+ - If config error → check against known patterns for the framework/library and suggest fix
73
+ - Document solutions in openmemory.md for future reference
74
+
75
+ **Error recovery workflow:**
76
+ 1. Identify error type (build, dependency, config, runtime)
77
+ 2. Check openmemory.md for known solutions
78
+ 3. If known solution exists → apply automatically (with user confirmation)
79
+ 4. If unknown → document in openmemory.md after solving
80
+
81
+ ## Memory storage automation
82
+ **Automatic memory storage triggers:**
83
+ - Before task completion → automatically check if memory should be stored
84
+ - If 3+ files changed OR new component created → store memory
85
+ - If design pattern emerges → store in spec/05-decisions.md AND memory
86
+ - If infrastructure decision made → store in spec/05-decisions.md AND memory
87
+
88
+ **Memory storage checklist (before task completion):**
89
+ - [ ] Memory stored? (if applicable)
90
+ - [ ] openmemory.md updated? (if memory stored)
91
+ - [ ] Spec updated? (if decision/pattern emerged)
92
+ - [ ] Decisions documented in spec/05-decisions.md? (if applicable)
93
+
94
+ **Always update openmemory.md before storing memory:**
95
+ - Review content → check namespaces → assign namespace if applicable
96
+ - Update Components section if new component
97
+ - Update Patterns section if new pattern
98
+ - Update Architecture section if architecture change
99
+
100
+ ## Spec update automation
101
+ **Automatic spec update triggers:**
102
+ - If design pattern emerges → update spec/05-decisions.md
103
+ - If infrastructure decision made → update spec/05-decisions.md
104
+ - If new risk discovered → update spec/03-risks.md
105
+ - If new question emerges → update spec/04-open-questions.md
106
+
107
+ **Spec update checklist (before task completion):**
108
+ - [ ] Design pattern documented? (if applicable)
109
+ - [ ] Infrastructure decision documented? (if applicable)
110
+ - [ ] New risk added? (if applicable)
111
+ - [ ] New question added? (if applicable)
112
+ - [ ] Spec still accurate? (verify and update if needed)
113
+
114
+ ## Spec health checks
115
+ **Automatic spec health monitoring:**
116
+ - Detect spec-code divergence (features in code not in spec, features in spec not in code)
117
+ - Warn when spec is outdated (spec not updated recently, implementation changed significantly)
118
+ - Suggest spec updates when discrepancies found
119
+ - Track spec evolution (spec age, update frequency, completeness)
120
+
121
+ **Spec health check triggers:**
122
+ - Before task start → check if spec is up-to-date
123
+ - After task completion → check if spec needs update
124
+ - Periodically → suggest spec sync if divergence detected
125
+
126
+ **Spec health indicators:**
127
+ - Spec age: How long since last update
128
+ - Spec completeness: Are all features documented?
129
+ - Spec accuracy: Does spec match implementation?
130
+ - Spec traceability: Can requirements be traced to code?
131
+
132
+ **When spec health issues detected:**
133
+ - Suggest `/spec/sync` if divergence found
134
+ - Suggest `/spec/evolve` if spec needs updating
135
+ - Suggest `/spec/audit` if compliance check needed
136
+ - Warn user about outdated spec
@@ -14,7 +14,7 @@ entire session.
14
14
 
15
15
  Memory = accumulated understanding of codebase + user preferences. Like a colleague who's worked here months.
16
16
 
17
- **project_id:** spec-driven-development
17
+ **project_id:** eskoubar95/spec
18
18
 
19
19
  ## NON-NEGOTIABLE: Memory-First Development
20
20