# Context Provider Workflow Automation **Automate development workflows with intelligent pattern-based triggers** ## Overview The MCP Context Provider enables **workflow automation** through intelligent pattern matching. By defining auto-retrieve patterns, you can create **automatic reminders** and **context-aware triggers** that prevent common development workflow mistakes. This guide demonstrates how to use context provider patterns to automate complex workflows, using the **release workflow automation** as a practical example. ## The Problem: Forgotten Release Procedures A common development workflow issue: You implement a feature, write tests, update documentation... but **forget the release procedure**. No version bumps, no CHANGELOG updates, no git tags. **Traditional approach**: Manual checklists, hoping you remember every step. **Context provider solution**: Automatic pattern-based reminders that trigger when specific conditions are detected. ## Solution: Auto-Retrieve Workflow Patterns ### Pattern Structure Context provider patterns can detect specific development activities and trigger automatic memory retrieval with reminders: ```json { "auto_retrieve_triggers": { "release_procedure_reminder": { "patterns": [ "added.*CLAUDE.md", "documented.*v\\d+\\.\\d+\\.\\d+", "implemented.*feature", "feature complete", "all tests passing", "ready to ship", "production ready" ], "action": "memory_search", "tags": ["release-workflow", "procedure"], "reminder_message": "⚠️ REMINDER: Complete release procedure!\n1. Bump version (__init__.py, pyproject.toml, uv lock)\n2. Update CHANGELOG.md\n3. Commit with semantic message\n4. Create annotated tag\n5. Push commit and tag\n6. Verify workflows\n7. Close related issues" } } } ``` ### How It Works 1. **Pattern Detection**: Context provider monitors conversation for specific phrases 2. **Automatic Trigger**: When patterns match (e.g., "feature complete"), memory retrieval activates 3. **Contextual Reminder**: Displays checklist with all required steps 4. **Workflow Guidance**: Prevents skipping critical procedures ### Real-World Example **Scenario**: Developer implements semtools document ingestion feature ``` Developer: "Semtools integration complete, all tests passing" ↓ Context Provider: Detects "all tests passing" pattern ↓ System: Retrieves release workflow memory ↓ Display: "⚠️ REMINDER: Complete release procedure! 1. Bump version (__init__.py, pyproject.toml, uv lock) 2. Update CHANGELOG.md ..." ``` **Result**: Developer follows complete release procedure instead of skipping steps. ## Implementation Guide ### Step 1: Define Your Workflow Identify a workflow that has multiple steps and is easy to forget: - Release procedures (version bumps, changelogs, tags) - PR review cycles (fix → comment → review → wait → repeat) - Deployment checklists (build → test → deploy → verify) - Documentation updates (code → docs → wiki → changelog) ### Step 2: Identify Trigger Patterns List phrases that indicate the workflow should start: **For Release Workflow**: - `"feature complete"` - `"all tests passing"` - `"documented.*v\d+\.\d+\.\d+"` - `"ready to ship"` **For PR Review Workflow**: - `"commented on PR"` - `"gemini review complete"` - `"PR updated"` ### Step 3: Create Context File Create a context file in `MCP-Context-Provider/contexts/`: ```json { "context_metadata": { "name": "My Workflow Automation", "version": "1.0.0", "description": "Automates my development workflow", "tool_category": "workflow", "priority": "high" }, "applies_to_tools": ["all"], "auto_retrieve_triggers": { "workflow_reminder": { "patterns": [ "your pattern 1", "your pattern 2" ], "action": "memory_search", "tags": ["workflow-tag"], "reminder_message": "Your checklist here" } } } ``` ### Step 4: Store Reference Memory Store the complete procedure in memory: ```bash claude /memory-store "Release Procedure: 1. Bump version in __init__.py 2. Bump version in pyproject.toml 3. Run uv lock 4. Update CHANGELOG.md 5. Commit with semantic message 6. Create annotated tag 7. Push commit and tag 8. Verify GitHub Actions" --tags release-workflow,procedure ``` ### Step 5: Test Your Pattern 1. Use a phrase that matches your pattern 2. Verify the reminder appears 3. Adjust patterns if needed ## Available Workflow Automations ### Release Workflow (Built-in) **Location**: `contexts/mcp_memory_release_workflow_context.json` **Triggers**: - Feature completion indicators - Documentation updates - Test completion phrases **Provides**: - Version bump checklist - CHANGELOG reminder - Git tag creation - Workflow verification ### Issue Management (Built-in) **Location**: `contexts/mcp_memory_release_workflow_context.json` **Triggers**: - `"fixes #\d+"` - `"closes #\d+"` - `"merged PR"` **Provides**: - Issue closure reminders - PR-issue relationship tracking - Smart closing comments ### Custom Workflows Create your own patterns for: - Deployment procedures - Security review checklists - Performance testing workflows - Documentation update cycles ## Best Practices ### Pattern Design ✅ **DO**: - Use specific, unique phrases that clearly indicate workflow state - Include regex patterns for version numbers, issue IDs - Test patterns with actual conversation phrases - Keep reminder messages concise but complete ❌ **DON'T**: - Use overly generic patterns that trigger too often - Create patterns that overlap with other contexts - Make reminder messages too long (keep under 10 lines) ### Memory Storage ✅ **DO**: - Store complete procedures with step-by-step instructions - Use consistent tags for easy retrieval - Include context-specific examples - Update memories when procedures change ❌ **DON'T**: - Store incomplete or outdated procedures - Use vague tags that overlap with other content - Forget to version your workflow memories ### Performance Considerations - **Pattern Complexity**: Simple regex patterns have minimal overhead - **Trigger Frequency**: Patterns should trigger only when needed - **Memory Size**: Keep workflow memories focused and concise - **Context Priority**: Set appropriate priority levels to avoid conflicts ## Benefits ### Workflow Consistency - ✅ Never forget critical steps - ✅ Consistent execution across team members - ✅ Reduced human error ### Knowledge Retention - ✅ Capture what works (and what doesn't) - ✅ Build institutional knowledge - ✅ Onboard new team members faster ### Productivity Gains - ✅ Automated reminders save mental overhead - ✅ Context-aware suggestions reduce context switching - ✅ Faster task completion with guided workflows ### Integration Benefits - ✅ Works seamlessly with Natural Memory Triggers - ✅ Complements Claude Code's git awareness - ✅ Zero performance impact with lightweight rule processing ## Advanced Techniques ### Multi-Step Workflow Chains Create patterns that trigger at different workflow stages: ```json { "step_1_complete": { "patterns": ["implemented feature"], "reminder_message": "✅ Step 1 done. Next: Write tests" }, "step_2_complete": { "patterns": ["all tests passing"], "reminder_message": "✅ Step 2 done. Next: Update docs" }, "step_3_complete": { "patterns": ["updated documentation"], "reminder_message": "✅ Step 3 done. Next: Release procedure" } } ``` ### Conditional Workflow Triggers Use specific patterns for different scenarios: ```json { "hotfix_release": { "patterns": ["hotfix.*complete", "critical.*bug.*fixed"], "reminder_message": "🔥 HOTFIX: Skip feature freeze, deploy immediately" }, "standard_release": { "patterns": ["feature.*complete", "sprint.*done"], "reminder_message": "📦 RELEASE: Follow standard procedure" } } ``` ### Cross-Tool Integration Combine with git hooks and CI/CD: 1. **Pattern triggers** context provider reminder 2. **Git hook** validates version bump before commit 3. **CI/CD** runs tests and deployment 4. **Context provider** confirms completion ## Troubleshooting ### Pattern Not Triggering **Check**: 1. Pattern syntax (valid regex) 2. Conversation contains exact phrase 3. Context provider is active (`mcp context status`) 4. Pattern doesn't conflict with other contexts ### Reminder Not Showing **Check**: 1. Memory exists with correct tags 2. Tags match pattern configuration 3. Memory retrieval is enabled 4. MCP memory service is running ### Too Many False Triggers **Solution**: - Make patterns more specific - Add word boundaries (`\b`) - Use negative lookaheads - Increase pattern complexity ## Related Resources - [Memory Hooks Complete Guide](Memory-Hooks-Complete-Guide) - Comprehensive memory integration reference - [Natural Memory Triggers](Memory-Hooks-Complete-Guide#natural-memory-triggers-v710) - AI-based automatic memory retrieval - [Context Provider Documentation](https://github.com/doobidoo/MCP-Context-Provider) - Full context provider features ## Example: Complete Release Workflow Automation Here's the complete setup used in MCP Memory Service for automated release procedures: ### Context File ```json { "context_metadata": { "name": "MCP Memory Release Workflow", "version": "1.0.0", "description": "Automated release procedure reminders", "tool_category": "workflow", "priority": "high" }, "applies_to_tools": ["all"], "auto_retrieve_triggers": { "release_procedure_reminder": { "patterns": [ "added.*CLAUDE.md", "documented.*v\\d+\\.\\d+\\.\\d+", "implemented.*feature", "feature complete", "all tests passing", "ready to ship", "production ready" ], "action": "memory_search", "tags": ["release-workflow", "procedure"], "reminder_message": "⚠️ REMINDER: Complete release procedure!\n1. Bump version (__init__.py, pyproject.toml, uv lock)\n2. Update CHANGELOG.md\n3. Commit with semantic message\n4. Create annotated tag\n5. Push commit and tag\n6. Verify workflows\n7. Close related issues" } } } ``` ### Stored Memory ```bash claude /memory-store "MCP Memory Service Release Procedure: **Version Bump (3 files)**: 1. src/mcp_memory_service/__init__.py - Update __version__ 2. pyproject.toml - Update version field 3. Run: uv lock (sync dependencies) **CHANGELOG Update**: - Add new version section with date - Document features, fixes, breaking changes - Include performance metrics if applicable **Git Workflow**: 1. Commit: git commit -m 'chore(release): bump version to vX.Y.Z' 2. Tag: git tag -a vX.Y.Z -m 'Release vX.Y.Z: description' 3. Push: git push && git push --tags **Verification**: - Check GitHub Actions: Docker Publish, Publish and Test, HTTP-MCP Bridge - Close related issues with resolution comments - Update project board if applicable" \ --tags release-workflow,procedure,mcp-memory-service ``` ### Result When a developer says **"Feature complete, all tests passing"**, the system automatically: 1. Detects the trigger phrase 2. Retrieves the release procedure memory 3. Displays the complete checklist 4. Prevents accidental procedure skipping --- **Start automating your workflows today!** Create your first context pattern and experience intelligent workflow guidance. --- **[MCP Memory Service](https://github.com/doobidoo/mcp-memory-service)** • [🏠 Home](./Home) • [📚 Docs](./01-Installation-Guide) • [🔧 Troubleshooting](./07-TROUBLESHOOTING) • [💬 Discussions](https://github.com/doobidoo/mcp-memory-service/discussions) • [⭐ Star](https://github.com/doobidoo/mcp-memory-service)