oden-forge 2.4.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/oden/adr.md +241 -0
- package/.claude/commands/oden/architect.md +332 -8
- package/.claude/commands/oden/context.md +573 -0
- package/.claude/commands/oden/test.md +858 -0
- package/.claude/commands/oden/work.md +131 -0
- package/.claude/epics/living-quality-gates-implementation/work-session.md +54 -0
- package/.claude/memory/compliance-rules.yaml +140 -0
- package/.claude/memory/index.md +96 -0
- package/.claude/memory/knowledge/context-preservation-design.md +249 -0
- package/.claude/memory/knowledge/stream-d-completion-report.md +219 -0
- package/.claude/memory/patterns/README.md +159 -0
- package/.claude/memory/patterns/common-functions.md +121 -0
- package/.claude/memory/patterns/duplicate-report.md +14 -0
- package/.claude/memory/sessions/20260327-snapshot.md +64 -0
- package/.claude/scripts/context-preservation.sh +447 -0
- package/README.md +156 -145
- package/package.json +14 -11
- package/MIGRATION.md +0 -410
- package/install.sh +0 -231
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: Bash, Read, Write, Edit, LS, Glob, Grep, Task
|
|
3
|
+
description: Context preservation system - solve "context amnesia" in AI-first development
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Oden Forge - Context Preservation System
|
|
7
|
+
|
|
8
|
+
Sistema para preservar conocimiento arquitectónico entre sesiones de Claude y detectar patrones duplicados.
|
|
9
|
+
|
|
10
|
+
## Problem Statement
|
|
11
|
+
|
|
12
|
+
**Critical Gap Identified:** Context amnesia en desarrollo AI-first
|
|
13
|
+
- Cada sesión Claude = contexto nuevo
|
|
14
|
+
- Result: 10 implementaciones de formatCurrency
|
|
15
|
+
- Architectural decisions perdidas entre sesiones
|
|
16
|
+
- No pattern reuse detection
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
/oden:context snapshot [description] # Capture current context
|
|
22
|
+
/oden:context restore # Restore context for new session
|
|
23
|
+
/oden:context detect # Find duplicate patterns
|
|
24
|
+
/oden:context drift # Check architecture compliance
|
|
25
|
+
/oden:context patterns # Show reusable patterns
|
|
26
|
+
/oden:context memory [add/show/clean] # Manage project memory
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
### Core Components
|
|
32
|
+
|
|
33
|
+
1. **Session Context Snapshots**
|
|
34
|
+
2. **Pattern Library with Duplicate Detection**
|
|
35
|
+
3. **Architecture Drift Detection**
|
|
36
|
+
4. **Cross-Session Memory System**
|
|
37
|
+
5. **Smart Context Handoff**
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Component 1: Session Context Snapshots
|
|
42
|
+
|
|
43
|
+
### Purpose
|
|
44
|
+
Capture current session state, decisions, and context for next session restoration.
|
|
45
|
+
|
|
46
|
+
### Implementation
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
/oden:context snapshot "completed auth implementation"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Creates: `.claude/memory/sessions/{timestamp}-snapshot.md`
|
|
53
|
+
|
|
54
|
+
### Snapshot Content Structure
|
|
55
|
+
|
|
56
|
+
```markdown
|
|
57
|
+
---
|
|
58
|
+
created: {current_datetime}
|
|
59
|
+
session_type: implementation|debugging|architecture|review
|
|
60
|
+
branch: {current_branch}
|
|
61
|
+
status: active|completed|interrupted
|
|
62
|
+
context_size: estimated_tokens
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
# Session Snapshot: {description}
|
|
66
|
+
|
|
67
|
+
## Quick Summary
|
|
68
|
+
- **What:** {1-line description}
|
|
69
|
+
- **Files changed:** {list of modified files}
|
|
70
|
+
- **Decisions made:** {key architectural decisions}
|
|
71
|
+
- **Current state:** {what's working/broken}
|
|
72
|
+
|
|
73
|
+
## Context for Next Session
|
|
74
|
+
|
|
75
|
+
### Architectural Decisions Made
|
|
76
|
+
{decisions that should persist}
|
|
77
|
+
|
|
78
|
+
### Patterns Established
|
|
79
|
+
{reusable patterns created this session}
|
|
80
|
+
|
|
81
|
+
### Known Issues
|
|
82
|
+
{technical debt or problems to remember}
|
|
83
|
+
|
|
84
|
+
### Next Steps
|
|
85
|
+
{what the next session should focus on}
|
|
86
|
+
|
|
87
|
+
## Files Modified
|
|
88
|
+
{git diff --name-only summary}
|
|
89
|
+
|
|
90
|
+
## Key Functions/Components Created
|
|
91
|
+
{exportable patterns for reuse}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Component 2: Pattern Library with Duplicate Detection
|
|
97
|
+
|
|
98
|
+
### Purpose
|
|
99
|
+
Automatically detect code duplication and suggest existing implementations.
|
|
100
|
+
|
|
101
|
+
### Implementation
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
/oden:context detect
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Pattern Detection Algorithm
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# 1. Scan codebase for function definitions
|
|
111
|
+
find src -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" |
|
|
112
|
+
xargs grep -l "function\|const.*=.*=>.*function" |
|
|
113
|
+
while read file; do
|
|
114
|
+
# Extract function signatures and patterns
|
|
115
|
+
grep -n "export\|function\|const.*=" "$file" |
|
|
116
|
+
sed 's/^/'"${file}"':/g' >> /tmp/functions.txt
|
|
117
|
+
done
|
|
118
|
+
|
|
119
|
+
# 2. Detect similar patterns
|
|
120
|
+
sort /tmp/functions.txt |
|
|
121
|
+
awk '{
|
|
122
|
+
# Simple similarity detection
|
|
123
|
+
gsub(/[a-zA-Z]+/, "X", $0) # Replace names with X
|
|
124
|
+
if (seen[$0]) {
|
|
125
|
+
print "DUPLICATE PATTERN:", $0
|
|
126
|
+
print " Files:", seen[$0], $1
|
|
127
|
+
} else {
|
|
128
|
+
seen[$0] = $1
|
|
129
|
+
}
|
|
130
|
+
}'
|
|
131
|
+
|
|
132
|
+
# 3. Store in pattern library
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Pattern Library Structure
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
.claude/memory/patterns/
|
|
139
|
+
├── common-functions.md # formatCurrency, dateHelpers, etc.
|
|
140
|
+
├── ui-patterns.md # Button variants, Modal patterns
|
|
141
|
+
├── api-patterns.md # Fetch patterns, error handling
|
|
142
|
+
├── state-patterns.md # Redux/Zustand patterns
|
|
143
|
+
└── duplicate-report.md # Current duplications found
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Pattern Entry Format
|
|
147
|
+
|
|
148
|
+
```markdown
|
|
149
|
+
## Pattern: formatCurrency
|
|
150
|
+
|
|
151
|
+
### Usage Count: 3 implementations found
|
|
152
|
+
|
|
153
|
+
### Canonical Implementation
|
|
154
|
+
```typescript
|
|
155
|
+
// src/utils/currency.ts (recommended)
|
|
156
|
+
export const formatCurrency = (amount: number, currency = 'MXN') => {
|
|
157
|
+
return new Intl.NumberFormat('es-MX', {
|
|
158
|
+
style: 'currency',
|
|
159
|
+
currency,
|
|
160
|
+
}).format(amount);
|
|
161
|
+
};
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Duplicate Locations
|
|
165
|
+
- `src/components/PriceDisplay.tsx:15` (inline)
|
|
166
|
+
- `src/hooks/useOrderTotal.ts:23` (slightly different)
|
|
167
|
+
- `src/pages/checkout.tsx:67` (different format)
|
|
168
|
+
|
|
169
|
+
### Suggested Action
|
|
170
|
+
Replace all with import from `src/utils/currency.ts`
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Component 3: Architecture Drift Detection
|
|
176
|
+
|
|
177
|
+
### Purpose
|
|
178
|
+
Monitor compliance with architectural decisions from technical-decisions.md.
|
|
179
|
+
|
|
180
|
+
### Implementation
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
/oden:context drift
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Drift Detection Rules
|
|
187
|
+
|
|
188
|
+
```yaml
|
|
189
|
+
# .claude/memory/compliance-rules.yaml
|
|
190
|
+
rules:
|
|
191
|
+
file_size_limit:
|
|
192
|
+
max_lines: 500
|
|
193
|
+
scan_patterns: ["src/**/*.ts", "src/**/*.tsx"]
|
|
194
|
+
exceptions: ["src/types/index.ts"]
|
|
195
|
+
|
|
196
|
+
import_patterns:
|
|
197
|
+
forbidden_imports:
|
|
198
|
+
- pattern: "import.*from 'axios'"
|
|
199
|
+
message: "Use fetch wrapper from src/lib/api.ts"
|
|
200
|
+
- pattern: "import.*direct.*'../../../"
|
|
201
|
+
message: "Deep relative imports not allowed. Use absolute imports."
|
|
202
|
+
|
|
203
|
+
architecture_layers:
|
|
204
|
+
src/pages:
|
|
205
|
+
can_import: ["src/components", "src/hooks", "src/services"]
|
|
206
|
+
cannot_import: ["src/lib/database", "src/utils/server"]
|
|
207
|
+
src/components:
|
|
208
|
+
can_import: ["src/hooks", "src/utils", "src/types"]
|
|
209
|
+
cannot_import: ["src/services", "src/pages"]
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Drift Report Format
|
|
213
|
+
|
|
214
|
+
```markdown
|
|
215
|
+
# Architecture Drift Report
|
|
216
|
+
|
|
217
|
+
## Violations Found: 3
|
|
218
|
+
|
|
219
|
+
### 🚨 CRITICAL: File Size Violations
|
|
220
|
+
- `src/store/index.ts`: 2,392 lines (limit: 500)
|
|
221
|
+
- **Action:** Split into modules using pattern from technical-decisions.md
|
|
222
|
+
|
|
223
|
+
### ⚠️ WARNING: Import Violations
|
|
224
|
+
- `src/pages/dashboard.tsx:5`: Direct database import
|
|
225
|
+
- **Action:** Use service layer pattern instead
|
|
226
|
+
|
|
227
|
+
### ✅ COMPLIANT: 47 files following patterns
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Component 4: Cross-Session Memory System
|
|
233
|
+
|
|
234
|
+
### Purpose
|
|
235
|
+
Persistent knowledge base that grows with each session.
|
|
236
|
+
|
|
237
|
+
### Memory Structure
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
.claude/memory/
|
|
241
|
+
├── sessions/ # Session snapshots
|
|
242
|
+
├── patterns/ # Pattern library
|
|
243
|
+
├── decisions/ # Architectural decisions log
|
|
244
|
+
├── knowledge/ # Accumulated learnings
|
|
245
|
+
└── index.md # Quick reference
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Knowledge Accumulation
|
|
249
|
+
|
|
250
|
+
```markdown
|
|
251
|
+
# .claude/memory/knowledge/auth-patterns.md
|
|
252
|
+
|
|
253
|
+
## Authentication Implementation Learnings
|
|
254
|
+
|
|
255
|
+
### Session 2026-03-15: JWT Implementation
|
|
256
|
+
- **Decision:** Use httpOnly cookies instead of localStorage
|
|
257
|
+
- **Reason:** XSS protection
|
|
258
|
+
- **Pattern:** AuthContext + useAuth hook
|
|
259
|
+
- **Files:** src/contexts/AuthContext.tsx
|
|
260
|
+
|
|
261
|
+
### Session 2026-03-20: Refresh Token Logic
|
|
262
|
+
- **Issue:** Token refresh race condition
|
|
263
|
+
- **Solution:** Axios interceptor with queue pattern
|
|
264
|
+
- **Files:** src/lib/api.ts:45-78
|
|
265
|
+
|
|
266
|
+
### Session 2026-03-25: Role-Based Access
|
|
267
|
+
- **Pattern:** HOC + hook combo for route protection
|
|
268
|
+
- **Files:** src/components/ProtectedRoute.tsx
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Component 5: Smart Context Handoff
|
|
274
|
+
|
|
275
|
+
### Purpose
|
|
276
|
+
Intelligently restore relevant context when starting new sessions.
|
|
277
|
+
|
|
278
|
+
### Handoff Process
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
# When starting new session
|
|
282
|
+
/oden:context restore
|
|
283
|
+
|
|
284
|
+
# 1. Detect current work context
|
|
285
|
+
current_branch=$(git branch --show-current)
|
|
286
|
+
changed_files=$(git diff main --name-only)
|
|
287
|
+
open_issues=$(gh issue list --state open --limit 5 --json number,title)
|
|
288
|
+
|
|
289
|
+
# 2. Find relevant snapshots
|
|
290
|
+
grep -l "$current_branch" .claude/memory/sessions/*.md | head -3
|
|
291
|
+
|
|
292
|
+
# 3. Build context briefing
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Context Briefing Format
|
|
296
|
+
|
|
297
|
+
```markdown
|
|
298
|
+
# Context Briefing for New Session
|
|
299
|
+
|
|
300
|
+
## Current Situation
|
|
301
|
+
- **Branch:** epic/authentication-system
|
|
302
|
+
- **Last session:** 2026-03-25T14:30:45Z
|
|
303
|
+
- **Files changed:** src/auth/*, src/components/LoginForm.tsx
|
|
304
|
+
|
|
305
|
+
## Relevant History
|
|
306
|
+
- **Authentication patterns established:** JWT + httpOnly cookies
|
|
307
|
+
- **Known issues:** Refresh token race condition (solved)
|
|
308
|
+
- **Reusable patterns:** AuthContext, ProtectedRoute HOC
|
|
309
|
+
|
|
310
|
+
## Current Architecture State
|
|
311
|
+
- **Compliance:** 94% (3 minor violations)
|
|
312
|
+
- **Patterns available:** 15 reusable components
|
|
313
|
+
- **Duplicates detected:** 0 (cleaned last session)
|
|
314
|
+
|
|
315
|
+
## Recommended Next Actions
|
|
316
|
+
1. Complete registration flow (50% done)
|
|
317
|
+
2. Add email verification
|
|
318
|
+
3. Update tests for new auth patterns
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Commands Implementation
|
|
324
|
+
|
|
325
|
+
### /oden:context snapshot [description]
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
#!/bin/bash
|
|
329
|
+
description="${1:-"Work session snapshot"}"
|
|
330
|
+
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
331
|
+
branch=$(git branch --show-current)
|
|
332
|
+
session_file=".claude/memory/sessions/${timestamp//[:T-]/}-snapshot.md"
|
|
333
|
+
|
|
334
|
+
# Create snapshot
|
|
335
|
+
cat > "$session_file" << EOF
|
|
336
|
+
---
|
|
337
|
+
created: $timestamp
|
|
338
|
+
session_type: implementation
|
|
339
|
+
branch: $branch
|
|
340
|
+
status: active
|
|
341
|
+
context_size: medium
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
# Session Snapshot: $description
|
|
345
|
+
|
|
346
|
+
## Quick Summary
|
|
347
|
+
- **What:** $description
|
|
348
|
+
- **Files changed:** $(git diff --name-only | tr '\n' ', ')
|
|
349
|
+
- **Current state:** In progress
|
|
350
|
+
|
|
351
|
+
## Context for Next Session
|
|
352
|
+
|
|
353
|
+
### Architectural Decisions Made
|
|
354
|
+
$(git log -1 --oneline)
|
|
355
|
+
|
|
356
|
+
### Files Modified
|
|
357
|
+
\`\`\`
|
|
358
|
+
$(git status --porcelain)
|
|
359
|
+
\`\`\`
|
|
360
|
+
|
|
361
|
+
## Next Steps
|
|
362
|
+
- Continue current implementation
|
|
363
|
+
- Run tests when ready
|
|
364
|
+
EOF
|
|
365
|
+
|
|
366
|
+
echo "✅ Context snapshot saved: $session_file"
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### /oden:context detect
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
#!/bin/bash
|
|
373
|
+
echo "🔍 Scanning for duplicate patterns..."
|
|
374
|
+
|
|
375
|
+
# Create temp analysis
|
|
376
|
+
mkdir -p .claude/memory/patterns
|
|
377
|
+
report_file=".claude/memory/patterns/duplicate-report.md"
|
|
378
|
+
|
|
379
|
+
# Function to detect patterns
|
|
380
|
+
detect_functions() {
|
|
381
|
+
find src -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" |
|
|
382
|
+
xargs grep -n "function\|const.*=.*=>" |
|
|
383
|
+
grep -v "test\|spec" > /tmp/all-functions.txt
|
|
384
|
+
|
|
385
|
+
# Simple duplicate detection
|
|
386
|
+
echo "# Duplicate Pattern Report" > "$report_file"
|
|
387
|
+
echo "Generated: $(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$report_file"
|
|
388
|
+
echo "" >> "$report_file"
|
|
389
|
+
|
|
390
|
+
# Group by similar function names
|
|
391
|
+
cat /tmp/all-functions.txt |
|
|
392
|
+
sed 's/.*function \([^(]*\).*/\1/' |
|
|
393
|
+
sed 's/.*const \([^=]*\) *=.*/\1/' |
|
|
394
|
+
sort | uniq -c | sort -nr |
|
|
395
|
+
awk '$1 > 1 {print "## Potential duplicate: " $2 " (" $1 " occurrences)"}' >> "$report_file"
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
detect_functions
|
|
399
|
+
echo "✅ Duplicate patterns report: $report_file"
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### /oden:context drift
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
#!/bin/bash
|
|
406
|
+
echo "🎯 Checking architecture compliance..."
|
|
407
|
+
|
|
408
|
+
# Check file sizes
|
|
409
|
+
echo "## File Size Check"
|
|
410
|
+
find src -name "*.ts" -o -name "*.tsx" | while read file; do
|
|
411
|
+
lines=$(wc -l < "$file")
|
|
412
|
+
if [ "$lines" -gt 500 ]; then
|
|
413
|
+
echo "❌ $file: $lines lines (limit: 500)"
|
|
414
|
+
fi
|
|
415
|
+
done
|
|
416
|
+
|
|
417
|
+
# Check import patterns
|
|
418
|
+
echo "## Import Pattern Check"
|
|
419
|
+
grep -r "from 'axios'" src/ && echo "❌ Direct axios imports found" || echo "✅ No direct axios imports"
|
|
420
|
+
|
|
421
|
+
echo "✅ Architecture drift report completed"
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
### /oden:context memory
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
#!/bin/bash
|
|
428
|
+
action="${1:-show}"
|
|
429
|
+
|
|
430
|
+
case "$action" in
|
|
431
|
+
"add")
|
|
432
|
+
echo "Adding to project memory..."
|
|
433
|
+
# Implementation for adding knowledge
|
|
434
|
+
;;
|
|
435
|
+
"show")
|
|
436
|
+
echo "📚 Project Memory Summary"
|
|
437
|
+
echo "Sessions: $(ls .claude/memory/sessions/ 2>/dev/null | wc -l)"
|
|
438
|
+
echo "Patterns: $(find .claude/memory/patterns/ -name "*.md" 2>/dev/null | wc -l)"
|
|
439
|
+
echo "Last update: $(ls -t .claude/memory/sessions/ 2>/dev/null | head -1)"
|
|
440
|
+
;;
|
|
441
|
+
"clean")
|
|
442
|
+
echo "Cleaning old memory..."
|
|
443
|
+
find .claude/memory/sessions/ -name "*.md" -mtime +30 -delete 2>/dev/null || true
|
|
444
|
+
echo "✅ Old sessions cleaned"
|
|
445
|
+
;;
|
|
446
|
+
esac
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## Integration with Existing Commands
|
|
452
|
+
|
|
453
|
+
### Enhanced /oden:work Integration
|
|
454
|
+
|
|
455
|
+
```yaml
|
|
456
|
+
# When /oden:work starts
|
|
457
|
+
pre_work_hooks:
|
|
458
|
+
- /oden:context restore # Load relevant context
|
|
459
|
+
- /oden:context detect # Check for patterns before coding
|
|
460
|
+
|
|
461
|
+
# During work
|
|
462
|
+
session_hooks:
|
|
463
|
+
- /oden:context drift # Monitor compliance
|
|
464
|
+
|
|
465
|
+
# After work
|
|
466
|
+
post_work_hooks:
|
|
467
|
+
- /oden:context snapshot # Save session state
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Enhanced /oden:architect Integration
|
|
471
|
+
|
|
472
|
+
```yaml
|
|
473
|
+
# When creating technical decisions
|
|
474
|
+
pattern_awareness:
|
|
475
|
+
- Scan existing patterns before defining new ones
|
|
476
|
+
- Reference established architectural decisions
|
|
477
|
+
- Update compliance rules automatically
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
---
|
|
481
|
+
|
|
482
|
+
## Installation & Setup
|
|
483
|
+
|
|
484
|
+
### Automatic Setup
|
|
485
|
+
|
|
486
|
+
```bash
|
|
487
|
+
# Create memory structure
|
|
488
|
+
mkdir -p .claude/memory/{sessions,patterns,decisions,knowledge}
|
|
489
|
+
|
|
490
|
+
# Initialize index
|
|
491
|
+
cat > .claude/memory/index.md << 'EOF'
|
|
492
|
+
# Project Memory Index
|
|
493
|
+
|
|
494
|
+
## Quick Access
|
|
495
|
+
- [Latest Session](sessions/)
|
|
496
|
+
- [Common Patterns](patterns/common-functions.md)
|
|
497
|
+
- [Architecture Decisions](decisions/)
|
|
498
|
+
|
|
499
|
+
## Stats
|
|
500
|
+
- Sessions: 0
|
|
501
|
+
- Patterns: 0
|
|
502
|
+
- Last Update: Never
|
|
503
|
+
EOF
|
|
504
|
+
|
|
505
|
+
# Create compliance rules template
|
|
506
|
+
cat > .claude/memory/compliance-rules.yaml << 'EOF'
|
|
507
|
+
rules:
|
|
508
|
+
file_size_limit:
|
|
509
|
+
max_lines: 500
|
|
510
|
+
scan_patterns: ["src/**/*.ts", "src/**/*.tsx"]
|
|
511
|
+
EOF
|
|
512
|
+
|
|
513
|
+
echo "✅ Context preservation system initialized"
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
---
|
|
517
|
+
|
|
518
|
+
## Expected Outcomes
|
|
519
|
+
|
|
520
|
+
### Metrics to Track
|
|
521
|
+
|
|
522
|
+
1. **Context Continuity**
|
|
523
|
+
- Sessions starting with relevant context: >90%
|
|
524
|
+
- Time to context restoration: <30 seconds
|
|
525
|
+
|
|
526
|
+
2. **Pattern Reuse**
|
|
527
|
+
- Duplicate functions detected: All
|
|
528
|
+
- Pattern reuse rate: >80%
|
|
529
|
+
|
|
530
|
+
3. **Architecture Compliance**
|
|
531
|
+
- Files exceeding size limits: 0
|
|
532
|
+
- Import violations: 0
|
|
533
|
+
- Decision compliance: >95%
|
|
534
|
+
|
|
535
|
+
### Success Indicators
|
|
536
|
+
|
|
537
|
+
- **No more 10 formatCurrency implementations**
|
|
538
|
+
- **No 2,392 line God files**
|
|
539
|
+
- **Consistent patterns across entire codebase**
|
|
540
|
+
- **New sessions start with full context awareness**
|
|
541
|
+
|
|
542
|
+
---
|
|
543
|
+
|
|
544
|
+
## Integration with Living Quality Gates
|
|
545
|
+
|
|
546
|
+
This context preservation system is **foundational** for other Stream work:
|
|
547
|
+
|
|
548
|
+
- **Stream A (Quality Gates):** Uses pattern detection for compliance
|
|
549
|
+
- **Stream B (Enhanced Architecture):** Uses memory for decision tracking
|
|
550
|
+
- **Stream C (Testing Integration):** Uses context for test pattern reuse
|
|
551
|
+
|
|
552
|
+
**The context amnesia problem solved = All other quality improvements become possible.**
|
|
553
|
+
|
|
554
|
+
---
|
|
555
|
+
|
|
556
|
+
## Implementation Timeline
|
|
557
|
+
|
|
558
|
+
### Phase 1: Core Memory (Today)
|
|
559
|
+
- Session snapshots
|
|
560
|
+
- Basic pattern detection
|
|
561
|
+
- Memory directory structure
|
|
562
|
+
|
|
563
|
+
### Phase 2: Smart Detection (Week 1)
|
|
564
|
+
- Advanced duplicate detection
|
|
565
|
+
- Architecture drift monitoring
|
|
566
|
+
- Pattern library building
|
|
567
|
+
|
|
568
|
+
### Phase 3: Integration (Week 2)
|
|
569
|
+
- /oden:work integration
|
|
570
|
+
- Automatic context restoration
|
|
571
|
+
- Cross-session learning accumulation
|
|
572
|
+
|
|
573
|
+
**Ready to begin implementation with other streams coordinating.**
|