Implementation Guides
Implementation Guides
A comprehensive collection of practical guides for implementing MSP in various development scenarios. Master context engineering through real-world patterns and proven workflows.
Overview
These guides provide step-by-step instructions for implementing MSP across different project types, team sizes, and development methodologies. Each guide is battle-tested and optimized for context persistence.
Low-Code Vibe Coder Guide
The Context Engineering Mindset for those Learning to Code
Transform your development workflow from chaotic context loss to structured knowledge persistence.
Prerequisites
- 15 minutes for initial setup
- Basic familiarity with command line
Step 1: Establish Your R³ Rhythm
# Morning Routine
.\msp.ps1 start
# MSP automatically loads yesterday's context
# You instantly know where you left off
# Work Pattern
.\msp.ps1 update "Implemented user auth" 25
.\msp.ps1 decide "Using JWT over sessions - stateless"
# Evening Wrap
.\msp.ps1 end
# Context preserved for tomorrow
Best Practices
-
Daily Sessions Are Sacred
- Always start and end sessions
- Even 5-minute fixes get tracked
- Weekend work counts too
-
Decision Documentation
.\msp.ps1 decide "Choosing PostgreSQL over MongoDB" \ --rationale "Need ACID compliance for payments" \ --alternatives "MongoDB, DynamoDB"
-
Progress Increments
- Track even 1% progress
- Small wins compound
- Motivation through measurement
-
Context Exports for AI
# Before asking AI for help .\msp.ps1 context --format ai | clip # Paste into Claude/GPT for instant understanding
Common Patterns
The Monday Morning Recovery
.\msp.ps1 recall --depth 5
# Shows last 5 sessions with decisions and progress
# No more "where was I?" moments
The Feature Sprint
.\msp.ps1 route --milestone "User Authentication" --target 100
# Sets clear destination
# Tracks progress automatically
The Debug Session
.\msp.ps1 start --type debug
.\msp.ps1 note "Stripe webhook failing - 400 error"
.\msp.ps1 note "Issue: Raw body needed for signature"
.\msp.ps1 decide "Add express.raw() middleware"
.\msp.ps1 end --summary "Fixed webhook signature validation"
Standard Implementation
Complete Implementation Stack
For developers ready to implement the full context engineering stack, we recommend the NOL Framework - a battle-tested implementation using Neo4j, Obsidian, and Linear:
📚 NOL Framework Implementation Guide
- Complete setup instructions for all three tools
- Real-world configuration examples
- Integration patterns from production projects
- Advanced multi-project workflows
Quick Links:
- 🧠 Neo4j Setup - Knowledge graph configuration
- 📝 Obsidian Setup - Documentation structure
- 📋 Linear Setup - Project management integration
- 🚀 Advanced Patterns - Enterprise features
Core Implementation
Basic File Structure
your-project/
├── .msp/ # MSP data directory
│ ├── config.json # Configuration
│ ├── state.json # Current state
│ ├── sessions/ # Session history
│ └── cache/ # Temporary data
├── msp.ps1 # MSP entry point
└── msp-config.json # Project config
Minimal Implementation
Create a minimal MSP implementation in any language:
PowerShell Implementation
# msp-minimal.ps1
$MSPDir = ".\.msp"
$StateFile = "$MSPDir\state.json"
function Start-MSPSession {
if (Test-Path $StateFile) {
$state = Get-Content $StateFile | ConvertFrom-Json
if ($state.status -eq "active") {
Write-Error "Session already active!"
return
}
}
$session = @{
id = "msp-$(Get-Date -Format 'yyyy-MM-dd-HHmmss')"
status = "active"
startTime = (Get-Date).ToString('o')
updates = @()
}
New-Item -ItemType Directory -Force -Path $MSPDir | Out-Null
$session | ConvertTo-Json | Out-File $StateFile
Write-Host "✅ Session started: $($session.id)"
}
function Update-MSPSession {
param([string]$Message, [int]$Progress = -1)
$state = Get-Content $StateFile | ConvertFrom-Json
$update = @{
time = (Get-Date).ToString('HH:mm')
message = $Message
progress = $Progress
}
$state.updates += $update
$state | ConvertTo-Json -Depth 10 | Out-File $StateFile
Write-Host "📝 Recorded: $Message $(if($Progress -ge 0){"($Progress%)"})"
}
function End-MSPSession {
$state = Get-Content $StateFile | ConvertFrom-Json
$state.status = "complete"
$state.endTime = (Get-Date).ToString('o')
$sessionFile = "$MSPDir\sessions\$($state.id).json"
New-Item -ItemType Directory -Force -Path (Split-Path $sessionFile) | Out-Null
$state | ConvertTo-Json -Depth 10 | Out-File $sessionFile
Remove-Item $StateFile
Write-Host "✅ Session ended and saved"
}
Python Implementation
# msp_minimal.py
import json
import os
from datetime import datetime
from pathlib import Path
class MSPSession:
def __init__(self, msp_dir=".msp"):
self.msp_dir = Path(msp_dir)
self.state_file = self.msp_dir / "state.json"
self.msp_dir.mkdir(exist_ok=True)
def start(self, project="default"):
if self.state_file.exists():
with open(self.state_file) as f:
state = json.load(f)
if state["status"] == "active":
raise Exception("Session already active!")
session = {
"id": f"msp-{datetime.now().strftime('%Y-%m-%d-%H%M%S')}",
"status": "active",
"project": project,
"startTime": datetime.now().isoformat(),
"updates": []
}
with open(self.state_file, 'w') as f:
json.dump(session, f, indent=2)
print(f"✅ Session started: {session['id']}")
return session['id']
def update(self, message, progress=None):
with open(self.state_file) as f:
state = json.load(f)
update = {
"time": datetime.now().strftime('%H:%M'),
"message": message,
"progress": progress
}
state["updates"].append(update)
with open(self.state_file, 'w') as f:
json.dump(state, f, indent=2)
progress_str = f" ({progress}%)" if progress else ""
print(f"📝 Recorded: {message}{progress_str}")
def end(self, summary=None):
with open(self.state_file) as f:
state = json.load(f)
state["status"] = "complete"
state["endTime"] = datetime.now().isoformat()
if summary:
state["summary"] = summary
# Save to history
sessions_dir = self.msp_dir / "sessions"
sessions_dir.mkdir(exist_ok=True)
session_file = sessions_dir / f"{state['id']}.json"
with open(session_file, 'w') as f:
json.dump(state, f, indent=2)
# Clear active state
self.state_file.unlink()
print("✅ Session ended and saved")
return state['id']
# Usage
if __name__ == "__main__":
msp = MSPSession()
msp.start("my-project")
msp.update("Created user model", 25)
msp.update("Added validation", 40)
msp.end("Basic user system complete")
Full Stack Implementation
System Architecture
graph TB
CLI[MSP CLI] --> Core[Core Engine]
Core --> State[State Manager]
Core --> Integration[Integration Layer]
Integration --> Neo4j[Neo4j Driver]
Integration --> Obsidian[Obsidian API]
Integration --> Linear[Linear GraphQL]
State --> Local[Local Storage]
State --> Cache[Redis Cache]
Core --> Export[Context Export]
Export --> AI[AI Tools]
Component Implementation
1. State Manager
// state-manager.ts
interface IStateManager {
getCurrentSession(): Session | null;
startSession(params: StartParams): Session;
updateSession(update: Update): void;
endSession(summary?: string): void;
recoverSession(sessionId: string): Session;
}
class StateManager implements IStateManager {
private state: MSPState;
private storage: IStorage;
constructor(storage: IStorage) {
this.storage = storage;
this.state = this.loadState();
}
private loadState(): MSPState {
try {
return this.storage.load('state') || this.getDefaultState();
} catch (error) {
console.warn('State corrupted, creating new');
return this.getDefaultState();
}
}
private saveState(): void {
this.storage.save('state', this.state);
this.notifyIntegrations('stateChanged', this.state);
}
startSession(params: StartParams): Session {
if (this.state.session?.status === 'active') {
throw new Error('Session already active');
}
const session = {
id: this.generateSessionId(),
status: 'active' as const,
startTime: new Date(),
project: params.project || 'default',
user: params.user || process.env.USER,
updates: [],
decisions: [],
progress: { start: params.progress || 0, current: params.progress || 0 }
};
this.state.session = session;
this.saveState();
return session;
}
// ... additional methods
}
2. Integration Layer
// integration-manager.ts
interface IIntegration {
name: string;
initialize(): Promise<void>;
onSessionStart(session: Session): Promise<void>;
onSessionUpdate(update: Update): Promise<void>;
onSessionEnd(session: Session): Promise<void>;
}
class IntegrationManager {
private integrations: Map<string, IIntegration> = new Map();
register(integration: IIntegration): void {
this.integrations.set(integration.name, integration);
}
async notifyAll(event: string, data: any): Promise<void> {
const promises = Array.from(this.integrations.values())
.map(integration => {
const method = `on${event.charAt(0).toUpperCase() + event.slice(1)}`;
if (typeof integration[method] === 'function') {
return integration[method](data);
}
})
.filter(Boolean);
await Promise.allSettled(promises);
}
}
3. Neo4j Integration
// neo4j-integration.ts
class Neo4jIntegration implements IIntegration {
name = 'neo4j';
private driver: Driver;
async initialize(): Promise<void> {
this.driver = neo4j.driver(
process.env.NEO4J_URI || 'bolt://localhost:7687',
neo4j.auth.basic(
process.env.NEO4J_USER || 'neo4j',
process.env.NEO4J_PASSWORD || 'password'
)
);
}
async onSessionStart(session: Session): Promise<void> {
const query = `
CREATE (s:Session {
id: $id,
user: $user,
project: $project,
startTime: datetime($startTime),
status: 'active'
})
RETURN s
`;
await this.runQuery(query, {
id: session.id,
user: session.user,
project: session.project,
startTime: session.startTime.toISOString()
});
}
async onSessionUpdate(update: Update): Promise<void> {
// Detect decision patterns
if (this.isDecision(update.message)) {
await this.createDecisionNode(update);
}
// Create update relationship
const query = `
MATCH (s:Session {id: $sessionId, status: 'active'})
CREATE (u:Update {
message: $message,
timestamp: datetime($timestamp),
progress: $progress
})
CREATE (s)-[:HAS_UPDATE {order: size((s)-[:HAS_UPDATE]->())}]->(u)
`;
await this.runQuery(query, {
sessionId: update.sessionId,
message: update.message,
timestamp: update.timestamp.toISOString(),
progress: update.progress
});
}
private isDecision(message: string): boolean {
const decisionPatterns = [
/decided?/i,
/choos(e|ing)/i,
/going with/i,
/selected/i
];
return decisionPatterns.some(pattern => pattern.test(message));
}
}
Team Implementation
Scaling Context Engineering Across Your Team
Implement MSP for teams of 2-50 developers with shared context and collective intelligence.
Phase 1: Pilot Program (Week 1-2)
-
Select Champions
- Choose 2-3 enthusiastic developers
- Preferably working on same feature
- Document their experience
-
Shared Infrastructure
# Team setup script .\scripts\team-setup.ps1 ` --neo4j "neo4j://team-server:7687" ` --team "backend-team" ` --project "api-v2"
-
Daily Standups Enhanced
# Each developer before standup .\msp.ps1 summary --yesterday # Generates standup notes automatically # What I did: [from session data] # Blockers: [from tracked issues] # Today: [from active tasks]
Phase 2: Team Rollout (Week 3-4)
-
Establish Team Protocols
Team MSP Rules: - Sessions required for all feature work - Decisions need team- prefix - Progress updates at PR time - Context export in PR description
-
Integration with Existing Tools
# Git hooks for automatic session tracking cp .\templates\git-hooks\* .git\hooks\ # Now git commits trigger MSP updates git commit -m "feat: Add user profile endpoint" # MSP automatically tracks the commit
-
Shared Knowledge Graph
// Team can query collective knowledge MATCH (d:Decision)-[:MADE_BY]->(dev:Developer) WHERE d.timestamp > datetime() - duration('P7D') RETURN dev.name, d.content, d.rationale ORDER BY d.timestamp DESC
Phase 3: Process Integration (Week 5+)
-
Sprint Planning
# Start of sprint .\msp.ps1 sprint start --name "Sprint 23" --goals 5 # Each developer routes their sprint work .\msp.ps1 route --epic "Payment Integration" --tasks 8
-
Code Review Enhancement
## PR Description ### Context (from MSP) - Session: msp-2024-03-15-084523 - Progress: 45% → 67% (+22%) - Decisions: - Used Strategy pattern for payment providers - Async processing for webhook events - Architecture: [Link to Neo4j visualization]
-
Knowledge Sharing
# Weekly knowledge sync .\msp.ps1 team-insights --week # Shows: # - Top decisions made # - Common blockers # - Progress trends # - Knowledge gaps
Team Success Metrics
Track these KPIs after MSP implementation:
- Context Recovery Time: XX% reduction
- Onboarding Speed: Xx faster for new devs
- Decision Consistency: XX% improvement
- Knowledge Retention: 100% vs XX% baseline
Integration Patterns
Connecting MSP with Your Development Ecosystem
Common patterns for integrating MSP with existing tools and workflows.
CI/CD Integration
GitHub Actions
name: MSP Context Check
on: [pull_request]
jobs:
context-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify MSP Context
run: |
msp context --verify
msp decisions --since last-pr
msp progress --assert ">0"
Jenkins Pipeline
pipeline {
agent any
stages {
stage('MSP Context') {
steps {
script {
sh 'msp context --export > context.json'
archiveArtifacts artifacts: 'context.json'
}
}
}
}
post {
always {
sh 'msp session end --ci'
}
}
}
Summary
These implementation guides provide practical, tested approaches for adopting MSP at any scale. Remember:
- Start Small: Even solo developers see immediate benefits
- Scale Gradually: Team adoption follows proven patterns
- Integrate Deeply: MSP enhances existing tools
- Measure Success: Track metrics that matter
The key to successful MSP implementation is consistency. The R³ protocol only works when followed religiously. Make it a habit, and context engineering becomes second nature.
Next Steps
- Installation Guide - Technical setup instructions
- Configuration Guide - Customization options
- Templates & Tools - Ready-to-use resources
Remember: Context engineering isn't just a methodology—it's a competitive advantage in the AI era.
Quickstart Guide
Start using MSP (Mandatory Session Protocol) in under 5 minutes. Choose between MSP Lite (2 min), Full Stack (15 min), or Custom Build paths.
MSP Project Structure
Understand MSP's project structure, file organization, and architectural patterns. Complete guide to directories, modules, and component architecture.