sublation-os 1.0.1 → 1.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.
Files changed (31) hide show
  1. package/.claude/agents/sublation-os/implementation-verifier.md +16 -0
  2. package/.claude/agents/sublation-os/implementer.md +16 -0
  3. package/.claude/commands/sublation-os/address-comments.md +13 -0
  4. package/.claude/commands/sublation-os/consolidate-learnings.md +553 -0
  5. package/.claude/commands/sublation-os/implement-tasks.md +10 -0
  6. package/.claude/commands/sublation-os/investigate.md +14 -4
  7. package/.claude/commands/sublation-os/optimise.md +14 -0
  8. package/.claude/commands/sublation-os/review.md +18 -1
  9. package/.claude/commands/sublation-os/test-plan.md +19 -2
  10. package/.claude/skills/README.md +274 -0
  11. package/.claude/skills/auto-learn/SKILL.md +233 -0
  12. package/.cursor/commands/sublation-os/address-comments.md +74 -0
  13. package/.cursor/commands/sublation-os/commit-message.md +84 -0
  14. package/.cursor/commands/sublation-os/consolidate-learnings.md +553 -0
  15. package/.cursor/commands/sublation-os/create-tasks.md +254 -0
  16. package/.cursor/commands/sublation-os/implement-tasks.md +207 -0
  17. package/.cursor/commands/sublation-os/investigate.md +164 -0
  18. package/.cursor/commands/sublation-os/learn.md +131 -0
  19. package/.cursor/commands/sublation-os/optimise.md +108 -0
  20. package/.cursor/commands/sublation-os/plan-product.md +241 -0
  21. package/.cursor/commands/sublation-os/pr-description.md +15 -0
  22. package/.cursor/commands/sublation-os/recall.md +114 -0
  23. package/.cursor/commands/sublation-os/review.md +12 -0
  24. package/.cursor/commands/sublation-os/shape-spec.md +395 -0
  25. package/.cursor/commands/sublation-os/test-plan.md +12 -0
  26. package/.cursor/commands/sublation-os/write-spec.md +134 -0
  27. package/README.md +50 -13
  28. package/bin/install.js +103 -24
  29. package/package.json +4 -10
  30. package/.claude/agents/sublation-os/implementer-v2.md +0 -542
  31. /package/{.claude → .cursor}/commands/sublation-os/review-v2.md +0 -0
@@ -0,0 +1,553 @@
1
+ ---
2
+ description: Consolidate learnings by identifying patterns and organizing them into generalized rules while maintaining examples for few-shot learning
3
+ model: sonnet
4
+ ---
5
+
6
+ You are consolidating the Sublation-OS memory system to keep learnings manageable and organized as they grow.
7
+
8
+ ## Your Task
9
+
10
+ Analyze existing learnings across all memory files to:
11
+ 1. **Identify patterns** - Find similar learnings that can be consolidated
12
+ 2. **Create generalized rules** - Extract common principles from specific examples
13
+ 3. **Maintain examples** - Keep concrete examples for few-shot learning
14
+ 4. **Organize by pillars** - Split domain-specific learnings into pillar-based files (e.g., work, HR, finance)
15
+
16
+ ---
17
+
18
+ ## Step 1: Analyze Existing Learnings
19
+
20
+ Read all memory files to understand current learnings:
21
+
22
+ ```
23
+ .sublation-os/memory/
24
+ ├── backend-lessons.md
25
+ ├── frontend-lessons.md
26
+ ├── testing-lessons.md
27
+ ├── architecture-lessons.md
28
+ ├── general-lessons.md
29
+ └── learned-lessons.md (legacy)
30
+ ```
31
+
32
+ For each file:
33
+ 1. Read all entries
34
+ 2. Extract key themes and patterns
35
+ 3. Identify similar or overlapping learnings
36
+ 4. Note domain-specific learnings (e.g., "Work service", "HR module", "Finance API")
37
+
38
+ ---
39
+
40
+ ## Step 2: Identify Consolidation Opportunities
41
+
42
+ Look for learnings that:
43
+
44
+ ### Can Be Generalized
45
+ - **Multiple specific examples** of the same pattern
46
+ - **Similar lessons** with different contexts
47
+ - **Repeated tags** across multiple entries
48
+
49
+ **Example:**
50
+ ```
51
+ Entry 1: Work service bulk operations use BulkUpdateAsync
52
+ Entry 2: HR service bulk imports use BulkUpdateAsync
53
+ Entry 3: Finance reconciliation uses BulkUpdateAsync
54
+
55
+ → Consolidate to: "For bulk operations across services, use BulkUpdateAsync pattern"
56
+ ```
57
+
58
+ ### Should Be Split by domain
59
+ Domain-specific learnings that belong to domain /business rules should be split accordingly.
60
+
61
+
62
+ **Example:**
63
+ ```
64
+ Entry: "Work service validates assignees before creating work items"
65
+ → Move to: .sublation-os/memory/pillars/work-lessons.md
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Step 3: Create Consolidation Plan
71
+
72
+ Before making changes, present a consolidation plan to the user:
73
+
74
+ ```markdown
75
+ # Consolidation Plan
76
+
77
+ ## 📊 Analysis Summary
78
+ - Total learnings analyzed: {N}
79
+ - Consolidation opportunities found: {M}
80
+ - Pillar-specific learnings identified: {P}
81
+
82
+ ## 🔄 Proposed Consolidations
83
+
84
+ ### Pattern 1: {Pattern Name}
85
+ **Combining entries:** #{entry_ids}
86
+ **Generalized rule:** {description}
87
+ **Examples to keep:** {count} from different domains
88
+ **Target file:** {file}
89
+
90
+ ### Pattern 2: {Pattern Name}
91
+ ...
92
+
93
+ ## 🏛️ Proposed Pillar Organization
94
+
95
+ ### x Pillar ({N} learnings)
96
+ - Entry #5: Work item validation patterns
97
+ - Entry #12: Work service bulk operations
98
+ - Entry #18: Work assignment logic
99
+
100
+ **Action:** Create `.sublation-os/memory/pillars/x-lessons.md`
101
+
102
+ ### y Pillar ({N} learnings)
103
+ ...
104
+
105
+ ## ⚠️ Risks
106
+ - {List any potential issues with consolidation}
107
+
108
+ ## ✅ Benefits
109
+ - Reduced duplication: {percentage}
110
+ - Improved organization: {description}
111
+ - Better searchability: {description}
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Step 4: Execute Consolidation
117
+
118
+ After user approval, perform the consolidation:
119
+
120
+ ### For Generalized Rules
121
+
122
+ Create consolidated entries that:
123
+ 1. **Combine similar learnings** into one comprehensive entry
124
+ 2. **Extract the general principle**
125
+ 3. **Keep multiple examples** from different contexts
126
+ 4. **Preserve all tags** from source entries
127
+ 5. **Reference original entry numbers** for traceability
128
+
129
+ **Consolidated Entry Template:**
130
+ ```markdown
131
+ ## Entry {N} - {YYYY-MM-DD HH:mm} [CONSOLIDATED]
132
+
133
+ ### 🧠 Context
134
+ Consolidated from entries #{source_entry_ids}. {General context of the pattern}
135
+
136
+ ### 📘 Lesson
137
+ {Generalized principle that applies across multiple scenarios}
138
+
139
+ ### ⚙️ Application
140
+ {General guidelines for applying this lesson}
141
+
142
+ **Specific Applications:**
143
+ - **{Domain 1}:** {Specific application}
144
+ - **{Domain 2}:** {Specific application}
145
+ - **{Domain 3}:** {Specific application}
146
+
147
+ ### 🧩 Examples
148
+
149
+ **Example 1: {Domain 1 context}**
150
+
151
+ ❌ **Anti-pattern:**
152
+ ```{language}
153
+ {code}
154
+ ```
155
+
156
+ ✅ **Correct approach:**
157
+ ```{language}
158
+ {code}
159
+ ```
160
+
161
+ **Example 2: {Domain 2 context}**
162
+
163
+ ❌ **Anti-pattern:**
164
+ ```{language}
165
+ {code}
166
+ ```
167
+
168
+ ✅ **Correct approach:**
169
+ ```{language}
170
+ {code}
171
+ ```
172
+
173
+ ### 🏷️ Tags
174
+ `#consolidated` `{all_original_tags}`
175
+
176
+ ### 📎 Source Entries
177
+ - Entry #{id1} from {file1}
178
+ - Entry #{id2} from {file2}
179
+ - Entry #{id3} from {file3}
180
+
181
+ ---
182
+ ```
183
+
184
+ ### For Pillar Organization
185
+
186
+ 1. **Create pillar directory** if it doesn't exist:
187
+ ```
188
+ mkdir -p .sublation-os/memory/pillars/
189
+ ```
190
+
191
+ 2. **Create pillar-specific files:**
192
+ ```
193
+ .sublation-os/memory/pillars/
194
+ ├── work-lessons.md
195
+ ├── hr-lessons.md
196
+ ├── finance-lessons.md
197
+ ├── customer-lessons.md
198
+ └── auth-lessons.md
199
+ ```
200
+
201
+ 3. **Move domain-specific learnings** to appropriate pillar files
202
+
203
+ 4. **Add pillar header** to new files:
204
+ ```markdown
205
+ # {Pillar Name} Pillar Lessons
206
+
207
+ This file contains learnings specific to the {pillar name} domain and its services.
208
+
209
+ **Pillar Components:**
210
+ - {List main services/components in this pillar}
211
+
212
+ **Related Categories:**
213
+ - See [Backend Lessons](../backend-lessons.md) for general backend patterns
214
+ - See [Architecture Lessons](../architecture-lessons.md) for system design
215
+
216
+ ---
217
+ ```
218
+
219
+ 5. **Update source files** with references to moved entries:
220
+ ```markdown
221
+ ## Entry {N} - {date} [MOVED]
222
+
223
+ This entry has been moved to `.sublation-os/memory/pillars/{pillar}-lessons.md` as Entry {M}.
224
+
225
+ **Quick link:** See Pillar-specific lessons for {pillar} domain.
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Step 5: Update Index
231
+
232
+ Update `.sublation-os/memory/index.md` to reflect changes:
233
+
234
+ 1. **Add Pillar section:**
235
+ ```markdown
236
+ ### Pillar-Specific Lessons
237
+
238
+ 1. **[Work Pillar](pillars/work-lessons.md)** - Work items, assignments, tracking
239
+ 2. **[HR Pillar](pillars/hr-lessons.md)** - Employee management, payroll
240
+ 3. **[Finance Pillar](pillars/finance-lessons.md)** - Invoicing, payments, reconciliation
241
+ ```
242
+
243
+ 2. **Update statistics:**
244
+ - Total learnings count
245
+ - Consolidated entries count
246
+ - Pillar distribution
247
+
248
+ 3. **Add consolidation tags:**
249
+ - `#consolidated` - For generalized rules
250
+ - `#pillar:{name}` - For pillar-specific learnings
251
+
252
+ ---
253
+
254
+ ## Step 6: Archive Originals
255
+
256
+ Don't delete original entries immediately:
257
+
258
+ 1. **Create archive directory:**
259
+ ```
260
+ .sublation-os/memory/archive/{YYYY-MM-DD}/
261
+ ```
262
+
263
+ 2. **Copy original files** before consolidation:
264
+ ```
265
+ cp backend-lessons.md archive/{date}/backend-lessons.md.bak
266
+ ```
267
+
268
+ 3. **Keep for 30 days** to allow rollback if needed
269
+
270
+ ---
271
+
272
+ ## Quality Standards
273
+
274
+ ### When Consolidating
275
+
276
+ ✅ **Do:**
277
+ - Keep all unique examples from source entries
278
+ - Preserve file references and line numbers
279
+ - Maintain or improve specificity
280
+ - Add cross-references between related entries
281
+ - Include all tags from source entries
282
+
283
+ ❌ **Don't:**
284
+ - Lose valuable context or examples
285
+ - Over-generalize to the point of being vague
286
+ - Remove domain-specific details
287
+ - Break file references
288
+
289
+ ### When Organizing by Pillars
290
+
291
+ ✅ **Do:**
292
+ - Group by business domain/pillar
293
+ - Keep related learnings together
294
+ - Maintain category files for general patterns
295
+ - Add clear navigation between files
296
+
297
+ ❌ **Don't:**
298
+ - Create too many small pillar files (< 3 entries)
299
+ - Duplicate entries across pillars and categories
300
+ - Break existing cross-references
301
+
302
+ ---
303
+
304
+ ## User Confirmation
305
+
306
+ After consolidation, show the user:
307
+
308
+ ```markdown
309
+ ✅ Consolidation Complete!
310
+
311
+ ## Summary
312
+ - **Learnings analyzed:** {N}
313
+ - **Entries consolidated:** {M} → {K} generalized rules
314
+ - **Pillars created:** {P}
315
+ - **Total learnings:** {before} → {after}
316
+ - **Reduction:** {percentage}%
317
+
318
+ ## Changes Made
319
+
320
+ ### Consolidated Patterns
321
+ 1. **{Pattern name}** - Combined {N} entries into 1 comprehensive rule
322
+ - File: `.sublation-os/memory/{category}-lessons.md`
323
+ - Entry: #{entry_number}
324
+
325
+ ### Pillar Organization
326
+ 1. **Work Pillar** - {N} learnings moved to `pillars/work-lessons.md`
327
+ 2. **HR Pillar** - {N} learnings moved to `pillars/hr-lessons.md`
328
+
329
+ ### Files Updated
330
+ - `backend-lessons.md` - {N} entries consolidated, {M} moved
331
+ - `frontend-lessons.md` - {N} entries consolidated
332
+ - `index.md` - Updated with pillar links
333
+ - Created: {N} new pillar files
334
+
335
+ ## Next Steps
336
+ - Review consolidated entries for accuracy
337
+ - Use `/sublation-os:recall {pattern}` to test searchability
338
+ - Archive backups kept in `.sublation-os/memory/archive/{date}/`
339
+
340
+ ## Rollback
341
+ If needed, restore from archives:
342
+ ```bash
343
+ cp .sublation-os/memory/archive/{date}/*.bak .sublation-os/memory/
344
+ ```
345
+ ```
346
+
347
+ ---
348
+
349
+ ## Examples
350
+
351
+ ### Example: Consolidating Pagination Pattern
352
+
353
+ **Before:**
354
+ ```markdown
355
+ ## Entry 5 - Backend
356
+ Work service pagination uses Skip/Take at DB level
357
+
358
+ ## Entry 12 - Backend
359
+ HR employee list uses IQueryable pagination
360
+
361
+ ## Entry 18 - Backend
362
+ Finance reports paginate at query level
363
+ ```
364
+
365
+ **After:**
366
+ ```markdown
367
+ ## Entry 25 - 2025-11-07 14:30 [CONSOLIDATED]
368
+
369
+ ### 🧠 Context
370
+ Consolidated from entries #5, #12, #18. Multiple services implemented pagination patterns with similar approaches.
371
+
372
+ ### 📘 Lesson
373
+ Always apply pagination at the database query level using IQueryable before materialization. This ensures only the required page is fetched, preventing memory issues with large datasets.
374
+
375
+ ### ⚙️ Application
376
+ **General Guidelines:**
377
+ 1. Use IQueryable<T> in repository methods
378
+ 2. Apply Skip() and Take() before ToList()/ToArrayAsync()
379
+ 3. Add indexes on sorting columns
380
+ 4. Test with realistic data volumes (1000+ records)
381
+
382
+ **Specific Applications:**
383
+ - **Work Service:** WorkRepository.GetPagedWorkItems (line 145)
384
+ - **HR Service:** EmployeeRepository.GetPagedEmployees (line 203)
385
+ - **Finance Service:** ReportRepository.GetPagedReports (line 87)
386
+
387
+ ### 🧩 Examples
388
+
389
+ **Example 1: Work Service**
390
+
391
+ ❌ **Anti-pattern:**
392
+ ```csharp
393
+ var allWork = await _context.WorkItems.ToListAsync();
394
+ return allWork.Skip(page * size).Take(size);
395
+ ```
396
+
397
+ ✅ **Correct:**
398
+ ```csharp
399
+ return await _context.WorkItems
400
+ .OrderBy(w => w.CreatedAt)
401
+ .Skip(page * size)
402
+ .Take(size)
403
+ .ToListAsync();
404
+ ```
405
+
406
+ **Example 2: HR Service**
407
+
408
+ ❌ **Anti-pattern:**
409
+ ```csharp
410
+ var allEmployees = await _db.Employees.ToListAsync();
411
+ return allEmployees.Skip(offset).Take(limit);
412
+ ```
413
+
414
+ ✅ **Correct:**
415
+ ```csharp
416
+ return await _db.Employees
417
+ .Where(e => e.IsActive)
418
+ .OrderBy(e => e.LastName)
419
+ .Skip(offset)
420
+ .Take(limit)
421
+ .ToListAsync();
422
+ ```
423
+
424
+ ### 🏷️ Tags
425
+ `#consolidated` `#performance` `#database` `#pagination` `#repository-pattern` `#WorkService` `#HRService` `#FinanceService`
426
+
427
+ ### 📎 Source Entries
428
+ - Entry #5 from backend-lessons.md
429
+ - Entry #12 from backend-lessons.md
430
+ - Entry #18 from backend-lessons.md
431
+ ```
432
+
433
+ ### Example: Pillar Organization
434
+
435
+ **Moving Work Service learnings to Work Pillar:**
436
+
437
+ Create `.sublation-os/memory/pillars/work-lessons.md`:
438
+
439
+ ```markdown
440
+ # Work Pillar Lessons
441
+
442
+ This file contains learnings specific to the Work domain, including work items, assignments, tracking, and work service operations.
443
+
444
+ **Pillar Components:**
445
+ - Work Service
446
+ - Work Repository
447
+ - Work Item Domain Entities
448
+ - Work Assignment Logic
449
+ - Work Progress Tracking
450
+
451
+ **Related Categories:**
452
+ - See [Backend Lessons](../backend-lessons.md) for general backend patterns
453
+ - See [Architecture Lessons](../architecture-lessons.md) for system design
454
+ - See [Testing Lessons](../testing-lessons.md) for work service testing
455
+
456
+ ---
457
+
458
+ ## Entry 1 - 2025-11-07 14:35
459
+
460
+ ### 🧠 Context
461
+ Work items require assignee validation before creation to prevent orphaned assignments.
462
+
463
+ ### 📘 Lesson
464
+ Always validate that assignees exist and have proper permissions before creating work items in Work Service.
465
+
466
+ ### ⚙️ Application
467
+ 1. Check WorkService.CreateWorkItem (line 87) for validation pattern
468
+ 2. Use IUserRepository.ValidateAssignees() before work item creation
469
+ 3. Return specific error if assignee validation fails
470
+ 4. Log validation failures for audit trail
471
+
472
+ ### 🧩 Example
473
+
474
+ ❌ **Anti-pattern:**
475
+ ```csharp
476
+ public async Task<WorkItem> CreateWorkItem(CreateWorkItemDto dto)
477
+ {
478
+ var workItem = new WorkItem
479
+ {
480
+ AssigneeId = dto.AssigneeId // No validation!
481
+ };
482
+ return await _repo.CreateAsync(workItem);
483
+ }
484
+ ```
485
+
486
+ ✅ **Correct:**
487
+ ```csharp
488
+ public async Task<WorkItem> CreateWorkItem(CreateWorkItemDto dto)
489
+ {
490
+ var assigneeValid = await _userRepo.ValidateAssignees(dto.AssigneeId);
491
+ if (!assigneeValid)
492
+ {
493
+ throw new ValidationException("Invalid assignee");
494
+ }
495
+
496
+ var workItem = new WorkItem
497
+ {
498
+ AssigneeId = dto.AssigneeId
499
+ };
500
+ return await _repo.CreateAsync(workItem);
501
+ }
502
+ ```
503
+
504
+ ### 🏷️ Tags
505
+ `#WorkService` `#validation` `#assignments` `#work-pillar`
506
+
507
+ ---
508
+ ```
509
+
510
+ ---
511
+
512
+ ## Advanced Features
513
+
514
+ ### Automatic Pattern Detection
515
+
516
+ When analyzing learnings, look for:
517
+
518
+ 1. **Repeated service names** across multiple entries
519
+ 2. **Similar code patterns** in examples
520
+ 3. **Common tags** appearing together frequently
521
+ 4. **Related file references** in the same codebase area
522
+ 5. **Sequential learnings** about the same topic
523
+
524
+ ### Consolidation Metrics
525
+
526
+ Track and report:
527
+ - **Consolidation ratio:** entries before/after
528
+ - **Pattern coverage:** how many examples per pattern
529
+ - **Tag density:** average tags per entry
530
+ - **Pillar distribution:** learnings per pillar
531
+ - **File size reduction:** KB saved
532
+
533
+ ### Smart Suggestions
534
+
535
+ Suggest consolidation when:
536
+ - 3+ entries share 80%+ similar tags
537
+ - Same file/class referenced in multiple entries
538
+ - Similar anti-patterns appear in examples
539
+ - Related lessons appear within 7 days of each other
540
+
541
+ ---
542
+
543
+ ## Notes
544
+
545
+ - **Run monthly** or when memory files exceed 50 entries per category
546
+ - **Backup first** - always create archives before consolidation
547
+ - **User approval required** - show plan before executing
548
+ - **Preserve traceability** - keep source entry references
549
+ - **Maintain searchability** - consolidate tags, don't remove them
550
+
551
+ ---
552
+
553
+ Happy consolidating! 🧹✨