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.
- package/.claude/agents/sublation-os/implementation-verifier.md +16 -0
- package/.claude/agents/sublation-os/implementer.md +16 -0
- package/.claude/commands/sublation-os/address-comments.md +13 -0
- package/.claude/commands/sublation-os/consolidate-learnings.md +553 -0
- package/.claude/commands/sublation-os/implement-tasks.md +10 -0
- package/.claude/commands/sublation-os/investigate.md +14 -4
- package/.claude/commands/sublation-os/optimise.md +14 -0
- package/.claude/commands/sublation-os/review.md +18 -1
- package/.claude/commands/sublation-os/test-plan.md +19 -2
- package/.claude/skills/README.md +274 -0
- package/.claude/skills/auto-learn/SKILL.md +233 -0
- package/.cursor/commands/sublation-os/address-comments.md +74 -0
- package/.cursor/commands/sublation-os/commit-message.md +84 -0
- package/.cursor/commands/sublation-os/consolidate-learnings.md +553 -0
- package/.cursor/commands/sublation-os/create-tasks.md +254 -0
- package/.cursor/commands/sublation-os/implement-tasks.md +207 -0
- package/.cursor/commands/sublation-os/investigate.md +164 -0
- package/.cursor/commands/sublation-os/learn.md +131 -0
- package/.cursor/commands/sublation-os/optimise.md +108 -0
- package/.cursor/commands/sublation-os/plan-product.md +241 -0
- package/.cursor/commands/sublation-os/pr-description.md +15 -0
- package/.cursor/commands/sublation-os/recall.md +114 -0
- package/.cursor/commands/sublation-os/review.md +12 -0
- package/.cursor/commands/sublation-os/shape-spec.md +395 -0
- package/.cursor/commands/sublation-os/test-plan.md +12 -0
- package/.cursor/commands/sublation-os/write-spec.md +134 -0
- package/README.md +50 -13
- package/bin/install.js +103 -24
- package/package.json +4 -10
- package/.claude/agents/sublation-os/implementer-v2.md +0 -542
- /package/{.claude → .cursor}/commands/sublation-os/review-v2.md +0 -0
|
@@ -138,4 +138,20 @@ The content of this report should follow this structure:
|
|
|
138
138
|
|
|
139
139
|
### Notes
|
|
140
140
|
[Any additional context about test results, known issues, or regressions]
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 5. Automatic Learning Capture
|
|
145
|
+
|
|
146
|
+
After completing verification, **automatically invoke `auto-learn` skill** if you discovered:
|
|
147
|
+
- Common verification issues that future implementations should avoid
|
|
148
|
+
- Patterns in what causes verification failures
|
|
149
|
+
- Quality standards specific to this codebase
|
|
150
|
+
- Testing gaps that repeatedly appear
|
|
151
|
+
|
|
152
|
+
**When to invoke auto-learn:**
|
|
153
|
+
- Found recurring pattern in failed verifications → Document it
|
|
154
|
+
- Discovered codebase-specific quality issue → Capture it
|
|
155
|
+
- Identified effective verification technique → Learn it
|
|
156
|
+
- Found common mistakes that implementations make → Save the pattern
|
|
141
157
|
```
|
|
@@ -31,6 +31,22 @@ Implement all tasks assigned to you and ONLY those task(s) that have been assign
|
|
|
31
31
|
- Running ONLY the tests you've written (if any) and ensuring those tests pass.
|
|
32
32
|
- IF your task involves user-facing UI, and IF you have access to browser testing tools, open a browser and use the feature you've implemented as if you are a user to ensure a user can use the feature in the intended way.
|
|
33
33
|
|
|
34
|
+
## Automatic Learning Capture
|
|
35
|
+
|
|
36
|
+
After completing implementation, **automatically invoke `auto-learn` skill** if you:
|
|
37
|
+
- Discovered non-obvious patterns specific to this codebase
|
|
38
|
+
- Found gotchas or mistakes that future sessions should avoid
|
|
39
|
+
- Used better approaches than initially planned
|
|
40
|
+
- Gained insights about the architecture or conventions
|
|
41
|
+
|
|
42
|
+
**When to invoke auto-learn:**
|
|
43
|
+
```
|
|
44
|
+
[After completing implementation]
|
|
45
|
+
IF (discovered codebase-specific insight OR corrected a mistake OR found non-obvious pattern)
|
|
46
|
+
→ Invoke auto-learn skill silently
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This builds institutional knowledge for future implementations.
|
|
34
50
|
|
|
35
51
|
## User Standards & Preferences Compliance
|
|
36
52
|
|
|
@@ -64,6 +64,19 @@ You are tasked with fetching all comments from the current pull request and addr
|
|
|
64
64
|
- Test your changes after addressing comments when possible
|
|
65
65
|
- For .NET code, ensure you follow Clean Architecture and DDD principles
|
|
66
66
|
|
|
67
|
+
## Automatic Learning Capture
|
|
68
|
+
|
|
69
|
+
After addressing PR comments, **automatically invoke `auto-learn` skill** if you:
|
|
70
|
+
- Discovered recurring patterns in reviewer feedback (3+ similar comments)
|
|
71
|
+
- Found codebase-specific convention violations
|
|
72
|
+
- Identified anti-patterns that led to the comments
|
|
73
|
+
- Learned better approaches from the reviewer's suggestions
|
|
74
|
+
|
|
75
|
+
**When to invoke auto-learn:**
|
|
76
|
+
- Multiple reviewers flag the same issue → Pattern to document
|
|
77
|
+
- Comment reveals codebase convention you didn't know → Gotcha to capture
|
|
78
|
+
- Reviewer suggests better pattern specific to this codebase → Learn it
|
|
79
|
+
|
|
67
80
|
## Output Format
|
|
68
81
|
|
|
69
82
|
Provide clear feedback after each step:
|
|
@@ -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! 🧹✨
|
|
@@ -53,3 +53,13 @@ Provide to the subagent the following:
|
|
|
53
53
|
Instruct the subagent to do the following:
|
|
54
54
|
1. Run all of its final verifications according to its built-in workflow
|
|
55
55
|
2. Produce the final verification report in `.sublation-os/specs/[this-spec]/verifications/final-verification.md`.
|
|
56
|
+
|
|
57
|
+
## Automatic Learning Capture
|
|
58
|
+
|
|
59
|
+
Throughout the implementation process, **automatically invoke `auto-learn` skill** when:
|
|
60
|
+
- Implementer agents discover codebase-specific patterns
|
|
61
|
+
- Non-obvious solutions are found during implementation
|
|
62
|
+
- Mistakes are corrected that future sessions should avoid
|
|
63
|
+
- Architecture insights are revealed while building features
|
|
64
|
+
|
|
65
|
+
The implementer agents will handle this automatically based on their internal workflows.
|
|
@@ -156,9 +156,19 @@ Use this format for the filename:
|
|
|
156
156
|
|
|
157
157
|
## Integration with Memory System
|
|
158
158
|
|
|
159
|
-
After resolving the issue,
|
|
160
|
-
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
159
|
+
After resolving the issue, **automatically invoke `auto-learn` skill** if you discovered:
|
|
160
|
+
- A mistake or pattern that caused the issue (codebase-specific)
|
|
161
|
+
- A gotcha or trap that could catch future sessions
|
|
162
|
+
- A debugging technique that worked particularly well
|
|
163
|
+
- An architectural insight revealed by the investigation
|
|
164
|
+
|
|
165
|
+
**When to invoke auto-learn:**
|
|
166
|
+
```
|
|
167
|
+
[After identifying root cause and solution]
|
|
168
|
+
IF (root cause reveals codebase-specific gotcha OR non-obvious pattern OR recurring issue)
|
|
169
|
+
→ Invoke auto-learn skill to capture the lesson
|
|
170
|
+
```
|
|
163
171
|
|
|
164
172
|
This helps future debugging sessions by building institutional knowledge.
|
|
173
|
+
|
|
174
|
+
**User-invoked alternative:** Users can also explicitly run `/sublation-os:learn` to capture learnings at any time.
|
|
@@ -105,4 +105,18 @@ Structure your analysis as:
|
|
|
105
105
|
4. Estimated performance impact
|
|
106
106
|
5. Implementation difficulty assessment
|
|
107
107
|
|
|
108
|
+
## Automatic Learning Capture
|
|
109
|
+
|
|
110
|
+
After performance analysis, **automatically invoke `auto-learn` skill** if you discovered:
|
|
111
|
+
- Codebase-specific performance anti-patterns (not generic advice)
|
|
112
|
+
- Performance gotchas unique to this stack or architecture
|
|
113
|
+
- Optimization techniques that worked particularly well in this codebase
|
|
114
|
+
- Recurring performance issues across multiple files/services
|
|
115
|
+
|
|
116
|
+
**When to invoke auto-learn:**
|
|
117
|
+
- Found same performance issue in 3+ locations → Document the pattern
|
|
118
|
+
- Discovered stack-specific optimization (e.g., NHibernate query pattern) → Capture it
|
|
119
|
+
- Identified architectural bottleneck specific to this system → Save the insight
|
|
120
|
+
- Found effective optimization technique for this codebase → Learn it
|
|
121
|
+
|
|
108
122
|
Begin your analysis now with the selected code or current file context.
|
|
@@ -2,11 +2,28 @@
|
|
|
2
2
|
description: Review code for correctness, maintainability, and clarity
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
+
You are conducting a code review to assess correctness, maintainability, and clarity.
|
|
6
|
+
|
|
7
|
+
## Review Output Format
|
|
8
|
+
|
|
5
9
|
## 🧠 Summary
|
|
6
10
|
{Brief overview of what the code does}
|
|
7
11
|
|
|
8
12
|
## ⚠️ Issues Found
|
|
9
|
-
- {List of bugs, anti-patterns, or risks}
|
|
13
|
+
- {List of bugs, anti-patterns, or risks with file:line references}
|
|
10
14
|
|
|
11
15
|
## ✅ Suggestions
|
|
12
16
|
- {Recommended refactors or improvements}
|
|
17
|
+
|
|
18
|
+
## Automatic Learning Capture
|
|
19
|
+
|
|
20
|
+
After completing the review, **automatically invoke `auto-learn` skill** if you found:
|
|
21
|
+
- Recurring anti-patterns across multiple files (3+ occurrences)
|
|
22
|
+
- Codebase-specific bugs or gotchas
|
|
23
|
+
- Security vulnerabilities specific to this project
|
|
24
|
+
- Architectural issues worth documenting
|
|
25
|
+
|
|
26
|
+
**When to invoke auto-learn:**
|
|
27
|
+
- Same mistake appears in multiple places → Document the pattern
|
|
28
|
+
- Found codebase-specific gotcha → Capture it
|
|
29
|
+
- Discovered better approach for this stack → Learn it
|