PowerShell Modules
PowerShell Modules
Extend MSP with powerful PowerShell modules. From simple utilities to complex automation, these modules enhance your context engineering workflow.
Core MSP Modules
MSP.Core
The foundation module that all others build upon.
# Install
Install-Module -Name MSP.Core -Scope CurrentUser
# Import
Import-Module MSP.Core
# Core commands available
Get-Command -Module MSP.Core
Key cmdlets:
Start-MSPSession
- Begin trackingUpdate-MSPProgress
- Record progressStop-MSPSession
- End and summarizeGet-MSPContext
- Retrieve current contextExport-MSPData
- Export for sharing
MSP.Integration
Connects MSP with external tools.
# Install with dependencies
Install-Module -Name MSP.Integration -Scope CurrentUser
# Configure integrations
Set-MSPIntegration -Tool "Linear" -ApiKey $env:LINEAR_API_KEY
Set-MSPIntegration -Tool "Neo4j" -Uri "bolt://localhost:7687"
Integration cmdlets:
Sync-MSPToLinear
- Update Linear issuesExport-MSPToNeo4j
- Sync knowledge graphImport-MSPFromGit
- Extract from git historySend-MSPToSlack
- Share updates
MSP.Analytics
Analyze your productivity patterns.
# Install
Install-Module -Name MSP.Analytics -Scope CurrentUser
# Generate insights
Get-MSPProductivityReport -Period "LastMonth"
Get-MSPDecisionAnalysis -Project "e-commerce"
Show-MSPProgressChart -Visual
Utility Modules
MSP.GitIntegration
Seamless git workflow integration.
# Installation
Install-Module -Name MSP.GitIntegration
# Auto-commit with MSP context
Enable-MSPGitHooks -Repository "."
# Now git commits include:
# - Session ID
# - Progress percentage
# - Recent decisions
# - Active blockers
Usage:
# Enhanced git commands
Git-MSPCommit -Message "Implemented feature"
# Adds: [45%] Implemented feature (Session: msp-2025-07-15)
Git-MSPStatus
# Shows: Modified files + Current session context
Git-MSPLog
# Shows: Commit history with MSP session links
MSP.ProjectTemplates
Quick project scaffolding with MSP built-in.
# Install
Install-Module -Name MSP.ProjectTemplates
# Create new project
New-MSPProject -Type "WebAPI" -Name "UserService" -Stack "dotnet"
# Creates:
# - Project structure
# - MSP configuration
# - Git hooks
# - Linear integration
# - README with badges
Project types:
WebAPI
- REST API projectsReact
- React applicationsMicroservice
- Microservice architectureLibrary
- Shared librariesCLI
- Command-line tools
MSP.AIContext
Optimize context for AI assistants.
# Install
Install-Module -Name MSP.AIContext
# Generate AI-ready context
Get-MSPAIContext -For "Claude" -Depth 5 | Set-Clipboard
# Specialized exports
Export-MSPForChatGPT -TokenLimit 8000
Export-MSPForGitHubCopilot -IncludeCode
Export-MSPForCursor -Format "markdown"
Features:
- Token counting
- Context prioritization
- Format optimization
- History trimming
Advanced Modules
MSP.Automation
Automate repetitive MSP tasks.
# Install
Install-Module -Name MSP.Automation
# Set up automation rules
New-MSPAutomation -Trigger "ProgressReaches" -Value 50 `
-Action "CreateLinearComment" -Message "Halfway complete!"
New-MSPAutomation -Trigger "SessionStarts" `
-Action "LoadContext" -From "LastSession"
New-MSPAutomation -Trigger "BlockerCreated" `
-Action "NotifySlack" -Channel "#dev-blockers"
Automation triggers:
- Session events (start/end/pause)
- Progress milestones
- Time-based (every X minutes)
- Decision creation
- Blocker detection
MSP.Testing
Test automation with session tracking.
# Install
Install-Module -Name MSP.Testing
# Run tests with MSP tracking
Invoke-MSPTest -Path "./tests" -UpdateProgress
# Test results update MSP:
# ✅ Passed tests → Progress increase
# ❌ Failed tests → Create blockers
# ⏭️ Skipped tests → Add notes
Integration with:
- Pester (PowerShell)
- Jest (JavaScript)
- pytest (Python)
- xUnit (.NET)
MSP.Documentation
Auto-generate documentation from sessions.
# Install
Install-Module -Name MSP.Documentation
# Generate project docs
New-MSPDocumentation -Type "API" -FromSessions "Last30Days"
# Creates:
# - API documentation
# - Decision history
# - Architecture diagrams
# - Progress timeline
Creating Custom Modules
Module Template
Basic structure for an MSP module:
# MSP.YourModule.psd1
@{
RootModule = 'MSP.YourModule.psm1'
ModuleVersion = '1.0.0'
GUID = 'your-guid-here'
Author = 'Your Name'
Description = 'MSP module for...'
PowerShellVersion = '7.0'
RequiredModules = @('MSP.Core')
FunctionsToExport = @('*')
}
# MSP.YourModule.psm1
using module MSP.Core
function Start-YourFeature {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string]$ProjectName
)
# Get current MSP context
$context = Get-MSPContext
if (-not $context.SessionActive) {
Write-Warning "No active MSP session"
return
}
# Your functionality here
Update-MSPProgress -Message "Started your feature" -Progress 10
}
Export-ModuleMember -Function Start-YourFeature
Best Practices
- Always check for active session
function Invoke-MSPAction {
$context = Get-MSPContext
if (-not $context.SessionActive) {
throw "MSP session required. Run: Start-MSPSession"
}
# Proceed with action
}
- Use MSP logging
function Process-Data {
Write-MSPLog -Message "Processing started" -Level "Info"
try {
# Process
Write-MSPLog -Message "Process complete" -Level "Success"
}
catch {
Write-MSPLog -Message $_.Exception.Message -Level "Error"
Add-MSPBlocker -Description "Process failed: $_"
}
}
- Integrate with progress tracking
function Build-Component {
$steps = @(
@{Name="Setup"; Progress=10}
@{Name="Compile"; Progress=30}
@{Name="Test"; Progress=60}
@{Name="Package"; Progress=90}
@{Name="Deploy"; Progress=100}
)
foreach ($step in $steps) {
Write-Host "Executing: $($step.Name)"
# Do work
Update-MSPProgress -Message $step.Name -Progress $step.Progress
}
}
Module Collections
DevOps Collection
# Install DevOps modules
Install-MSPCollection -Name "DevOps"
# Includes:
# - MSP.Docker
# - MSP.Kubernetes
# - MSP.Terraform
# - MSP.CI
# - MSP.Monitoring
Example usage:
# Docker integration
Start-MSPDockerBuild -Dockerfile "." -Track
# Updates progress as layers build
# Kubernetes deployment
Deploy-MSPToK8s -Manifest "app.yaml" -Namespace "prod"
# Creates decision record for deployment
# Terraform planning
Plan-MSPTerraform -Module "infrastructure" -AutoDocument
# Captures plan as decision for review
DataScience Collection
# Install data science modules
Install-MSPCollection -Name "DataScience"
# Includes:
# - MSP.Jupyter
# - MSP.DataAnalysis
# - MSP.MLTracking
# - MSP.Visualization
Features:
# Jupyter notebook tracking
Start-MSPNotebook -Path "analysis.ipynb"
# Tracks cell execution as progress
# Experiment tracking
Start-MSPExperiment -Name "model-v2" -Parameters @{
learning_rate = 0.01
epochs = 100
}
# Links to MLflow/W&B
# Data pipeline monitoring
Watch-MSPPipeline -DAG "etl-daily" -UpdateProgress
WebDev Collection
# Install web development modules
Install-MSPCollection -Name "WebDev"
# Includes:
# - MSP.React
# - MSP.API
# - MSP.Database
# - MSP.Performance
Module Management
Installing Modules
# From PowerShell Gallery
Install-Module -Name MSP.Analytics
# From GitHub
Install-MSPModule -Source "github:user/msp-module"
# From local path
Install-MSPModule -Path "./my-module"
# Specific version
Install-Module -Name MSP.Core -RequiredVersion 2.1.0
Updating Modules
# Update single module
Update-Module -Name MSP.Core
# Update all MSP modules
Get-Module -Name "MSP.*" | Update-Module
# Check for updates
Get-MSPModuleUpdate
Module Configuration
# Global MSP module settings
Set-MSPModuleConfig -AutoUpdate $true -Channel "stable"
# Per-module settings
Set-MSPModuleConfig -Module "MSP.Analytics" -Setting @{
DefaultPeriod = "7days"
IncludeWeekends = $false
ExportFormat = "HTML"
}
Real-World Examples
Complete Workflow Module
# MSP.Workflow.psm1
function Start-FeatureDevelopment {
param(
[string]$FeatureName,
[string]$LinearIssue
)
# Start session
$session = Start-MSPSession -Name "Feature: $FeatureName" `
-Linear $LinearIssue
# Create branch
git checkout -b "feature/$FeatureName"
Update-MSPProgress -Message "Created feature branch" -Progress 5
# Scaffold
New-MSPProjectStructure -Type "Feature" -Name $FeatureName
Update-MSPProgress -Message "Scaffolded structure" -Progress 10
# Open in editor
code .
Write-Host "Feature development environment ready!" -ForegroundColor Green
Write-Host "Session: $($session.Id)" -ForegroundColor Cyan
}
function Complete-FeatureDevelopment {
param(
[string]$Summary
)
# Run tests
$testResult = Invoke-Pester -PassThru
if ($testResult.FailedCount -eq 0) {
Update-MSPProgress -Message "All tests passing" -Progress 90
} else {
Add-MSPBlocker -Description "$($testResult.FailedCount) tests failing"
return
}
# Create PR
$pr = New-GitHubPullRequest -Title (Get-MSPContext).SessionName `
-Body (Get-MSPSessionSummary)
Update-MSPProgress -Message "PR created: $($pr.Number)" -Progress 95
# End session
Stop-MSPSession -Summary $Summary
}
Team Productivity Module
# MSP.TeamProductivity.psm1
function Get-TeamProductivityDashboard {
param(
[string]$Team = "all",
[string]$Period = "week"
)
$data = Get-MSPTeamSessions -Team $Team -Period $Period
$dashboard = [PSCustomObject]@{
Team = $Team
Period = $Period
TotalSessions = $data.Count
TotalHours = ($data | Measure-Object -Property Duration -Sum).Sum
AverageProgress = ($data | Measure-Object -Property Progress -Average).Average
DecisionsCount = ($data | ForEach-Object { $_.Decisions.Count } | Measure-Object -Sum).Sum
BlockersResolved = ($data | ForEach-Object { $_.BlockersResolved } | Measure-Object -Sum).Sum
TopContributors = $data | Group-Object User | Sort-Object Count -Descending | Select-Object -First 5
}
# Generate visual report
$dashboard | ConvertTo-MSPReport -Type "HTML" | Out-File "team-dashboard.html"
# Open in browser
Start-Process "team-dashboard.html"
return $dashboard
}
Publishing Modules
Prepare for Publishing
# Test your module
Test-MSPModule -Path "./MSP.YourModule"
# Update manifest
Update-ModuleManifest -Path "./MSP.YourModule.psd1" `
-Version "1.0.1" `
-ReleaseNotes "Added new features"
# Generate documentation
New-MSPModuleDocumentation -Module "MSP.YourModule"
Publish to Gallery
# PowerShell Gallery
Publish-Module -Path "./MSP.YourModule" -NuGetApiKey $key
# MSP Community Registry
Publish-MSPModule -Path "./MSP.YourModule" -Tags "automation","productivity"
Troubleshooting
Common Issues
Module not loading
# Check if installed
Get-Module -ListAvailable -Name "MSP.*"
# Check version conflicts
Get-Module -Name "MSP.Core" -All
# Force reload
Remove-Module MSP.Core -Force
Import-Module MSP.Core -Force
Permission errors
# Install for current user only
Install-Module -Name MSP.Core -Scope CurrentUser
# Or with elevated permissions
Start-Process powershell -Verb RunAs
Dependency issues
# Check dependencies
Test-MSPModuleDependencies -Module "MSP.Analytics"
# Install missing dependencies
Install-MSPModuleDependencies -Module "MSP.Analytics"
Next Steps
- Install core modules to enhance MSP
- Browse community modules for your stack
- Create a custom module for your workflow
- Share your modules with the community
PowerShell modules turn MSP from a tool into a platform. Build what you need.
Neo4j Scripts
Essential Neo4j Cypher queries and scripts for MSP knowledge graph management. From basic session queries to advanced analytics, leverage the full power of your context graph.
MSP Resources Hub
Your comprehensive guide to mastering MSP and context engineering. Access tools, tutorials, research, case studies, and community resources for better development workflows.