iOS Skills System Implementation
This document describes the complete iOS implementation of the TrajectoryOS Skills System, achieving full parity with the Tauri desktop version while leveraging native Apple technologies.
Full Public Reader
iOS Skills System Implementation
Overview
This document describes the complete iOS implementation of the TrajectoryOS Skills System, achieving full parity with the Tauri desktop version while leveraging native Apple technologies.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ SkillsViewModel │
│ (@MainActor, @Observable) │
│ UI State | Loading States | Error Handling │
└────────────────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ SkillGraphService │
│ (Actor - Thread Safe) │
│ Unified facade coordinating all skill operations │
└────────────────────────────┬────────────────────────────────────┘
│
┌─────────────────────┼─────────────────────┐
│ │ │
▼ ▼ ▼
┌──────────────┐ ┌───────────────┐ ┌──────────────────┐
│SkillDecay │ │SkillRelation │ │SkillPractice │
│Service │ │shipService │ │Service │
├──────────────┤ ├───────────────┤ ├──────────────────┤
│• Decay calc │ │• Prerequisites│ │• Log practice │
│• Alerts │ │• Synergies │ │• Streaks │
│• Recovery │ │• Graph build │ │• Statistics │
└──────────────┘ └───────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────────────────────────────────────────────────────┐
│ SwiftData Layer │
│ SkillDecayConfigEntity | SkillRelationshipEntity | etc. │
└──────────────────────────────────────────────────────────────┘File Structure
TrajectoryOS/
├── Models/
│ └── Data/
│ ├── SkillDecayConfigEntity.swift # Decay configuration
│ ├── SkillRelationshipEntity.swift # Skill graph edges
│ ├── SkillTargetEntity.swift # Learning goals
│ ├── LearningPathEntity.swift # Active learning paths
│ ├── SkillPracticeLogEntity.swift # Practice history
│ ├── SkillAssessmentEntity.swift # Assessments & evidence
│ └── SkillDecayAlertEntity.swift # Decay notifications
│
├── Services/
│ └── Skills/
│ ├── SkillDecayService.swift # Decay calculations
│ ├── SkillRelationshipService.swift # Graph operations
│ ├── LearningPathService.swift # Target/path management
│ ├── SkillPracticeService.swift # Practice logging
│ ├── SkillAssessmentService.swift # Assessments
│ └── SkillGraphService.swift # Unified coordinator
│
└── ViewModels/
└── SkillsViewModel.swift # UI state managementKey Features Implemented
1. Skill Decay System
Half-life based exponential decay:
// Formula: C(t) = C_0 × 0.5^(t/T_half)
let decayFactor = pow(0.5, Double(daysSincePractice) / Double(halfLifeDays))
let adjustedConfidence = rawConfidence * decayFactorFeatures:
- Configurable half-life per skill (default: 90 days)
- Decay floor (never drops below minimum)
- Evergreen skills (no decay)
- Recovery rate when practicing
2. Skill Graph & Relationships
Relationship Types:
- `prerequisite` - Skill A must be learned before B
- `synergy` - Skills enhance each other
- `variant` - Skills are variations
- `enhances` - Skill A makes B more effective
Graph Operations:
- Build complete skill graph
- Find prerequisites/dependents
- Topological sort for learning order
- Calculate skill transfer
3. Learning Paths
Target Management:
- Define skill targets (e.g., "Senior iOS Developer")
- Set required skills with levels
- Track progress toward targets
Path Features:
- Active/paused/completed/abandoned states
- Gap analysis
- Recommended learning order
- Progress tracking
4. Practice Tracking
Activity Types:
- Project work (1.0x effectiveness)
- Teaching (0.9x)
- Interview (0.8x)
- Exercise (0.7x)
- Assessment (0.6x)
- Contribution (0.6x)
- Study (0.5x)
Features:
- Duration and intensity tracking
- Streak calculation
- Practice statistics
- Skill transfer on practice
5. Assessments
Assessment Types:
- Self-assessment
- AI interview
- Project review
- Peer review
- Certification
Competency Levels (1-5):
1. Beginner
2. Elementary
3. Intermediate
4. Advanced
5. Expert
6. Decay Alerts
Alert Types:
- `critical` - Severe decay (priority 1)
- `atRisk` - Warning level (priority 2)
- `stale` - Not practiced in 30+ days (priority 3)
- `recovered` - Skill recovered (priority 4)
Parity with Tauri Desktop
| Feature | Tauri (Rust/SQLite) | iOS (Swift/SwiftData) |
|---|---|---|
| Skill Decay | ✅ | ✅ |
| Decay Configs | ✅ | ✅ |
| Decay Alerts | ✅ | ✅ |
| Skill Graph | ✅ | ✅ |
| Prerequisites | ✅ | ✅ |
| Synergies | ✅ | ✅ |
| Skill Targets | ✅ | ✅ |
| Learning Paths | ✅ | ✅ |
| Gap Analysis | ✅ | ✅ |
| Practice Logs | ✅ | ✅ |
| Practice Streaks | ✅ | ✅ |
| Assessments | ✅ | ✅ |
| Competency Levels | ✅ | ✅ |
| Skill Evidence | ✅ | ✅ |
iOS Enhancements (Beyond Parity)
Native Apple Features (Planned)
1. HealthKit Integration
- Track sleep quality → learning effectiveness
- Activity data → energy levels for practice
2. Siri Shortcuts
- "Log 30 minutes of Swift practice"
- "What skills need practice?"
3. Widgets
- Practice streak widget
- Skills at risk widget
- Today's practice goal
4. Apple Watch
- Quick practice logging
- Streak notifications
- Complication for current streak
Usage Examples
Load Dashboard
@MainActor
class MyView: View {
@State private var viewModel = SkillsViewModel()
var body: some View {
VStack {
if let summary = viewModel.dashboardSummary {
Text("Skills: \(summary.totalSkills)")
Text("Health: \(summary.healthLevel.displayName)")
}
}
.task {
viewModel.configure(with: modelContainer)
await viewModel.loadDashboard()
}
}
}Log Practice
Task {
try await viewModel.logPractice(
skillId: skill.id,
activityType: .projectWork,
durationMinutes: 45,
intensity: 0.8,
notes: "Worked on new feature"
)
}Start Learning Path
Task {
let path = try await viewModel.startLearningPath(
targetId: seniorIOSDeveloperTargetId,
targetDate: Calendar.current.date(byAdding: .month, value: 6, to: Date())
)
}Next Steps
1. Create UI Views
- SkillsDashboardView
- SkillDetailView
- SkillGraphView (using SwiftUI Canvas/Charts)
- PracticeLogView
- LearningPathsView
2. Integrate with Main App
- Connect SkillsViewModel to app entry point
- Wire up navigation
3. Add Native Features
- Implement HealthKit integration
- Create Siri Shortcuts
- Build widgets
- Watch app companion
4. Testing
- Unit tests for services
- UI tests for views
- Integration tests
Dependencies
- SwiftData (iOS 17+)
- Swift Observation (@Observable)
- Swift Concurrency (async/await, actors)
Thread Safety
All services are implemented as Swift `actor`s, ensuring thread-safe concurrent access:
actor SkillDecayService {
private let modelContainer: ModelContainer
func calculateDecay(...) async throws -> SkillDecayInfo {
// Safe concurrent access
}
}The ViewModel is marked `@MainActor` for UI updates:
@MainActor
@Observable
final class SkillsViewModel {
// All state mutations happen on main thread
}Promotion Decision
Attach run IDs, datasets, metrics, and reproduction commands.
Source Anchor
projects/Documentation/02-projects/ios-app/SKILLS_SYSTEM_IMPLEMENTATION.md
Detected Structure
Method · Evaluation · Figures · Code Anchors · Architecture