Document Status: Operational Guide Last Updated: September 30, 2025 Source: CORE-GREAT-2C Verification (Phases 1-2)
Piper Morgan implements domain-optimized spatial intelligence patterns to provide spatial coordination capabilities across different integration types. This document describes the two validated patterns and guidance for choosing between them.
Based on comprehensive verification work in CORE-GREAT-2C, we discovered that Piper Morgan successfully operates two fundamentally different spatial architecture patterns simultaneously, each optimized for its specific domain.
Architecture:
services/integrations/slack/spatial_*.pyRouter → get_spatial_adapter() → SlackSpatialAdapterBaseSpatialAdapterComponents:
spatial_types.py - 14 classes (Territory, Room, Path types)spatial_adapter.py - SlackSpatialAdapter with 9 async methodsspatial_agent.py - 6 classes for navigation and awarenessspatial_intent_classifier.py - 3 classes for intent classificationspatial_mapper.py - 30 functions for workspace/channel/message mappingspatial_memory.py - 4 classes for spatial memory storage/retrievalTest Coverage: 5 comprehensive test files with 66 test functions
Characteristics:
BaseSpatialAdapter for standardizationWhen To Use:
Example Implementation:
from services.integrations.slack.slack_integration_router import SlackIntegrationRouter
# Router provides access to spatial capabilities
router = SlackIntegrationRouter()
spatial_adapter = router.get_spatial_adapter()
if spatial_adapter:
# Access any of 9 spatial methods
spatial_event = await spatial_adapter.create_spatial_event_from_slack(event_data)
spatial_object = await spatial_adapter.create_spatial_object_from_slack(object_data)
position = await spatial_adapter.map_to_position(context)
context = await spatial_adapter.get_context(position)
# Additional capabilities
stats = await spatial_adapter.get_mapping_stats()
await spatial_adapter.cleanup_old_mappings()
Performance Profile:
Architecture:
services/intelligence/spatial/notion_spatial.pyNotionSpatialIntelligence class that uses router internallyComponents:
NotionSpatialIntelligence - Single comprehensive classTest Coverage: 1 feature-level integration test file
Characteristics:
When To Use:
Example Implementation:
from services.intelligence.spatial.notion_spatial import NotionSpatialIntelligence
# Create spatial intelligence instance
spatial = NotionSpatialIntelligence()
# Connect to workspace
await spatial.connect()
# Perform 8-dimensional analysis
analysis = await spatial.get_comprehensive_spatial_analysis(page_id)
# Access individual dimensions
hierarchy = await spatial.analyze_page_structure(page_id) # HIERARCHY
temporal = await spatial.analyze_timestamps(page_id) # TEMPORAL
priority = await spatial.analyze_tags_status(page_id) # PRIORITY
collaborative = await spatial.analyze_authors(page_id) # COLLABORATIVE
flow = await spatial.analyze_workflow_props(page_id) # FLOW
quantitative = await spatial.analyze_metrics(page_id) # QUANTITATIVE
causal = await spatial.analyze_relations(page_id) # CAUSAL
contextual = await spatial.analyze_workspace(workspace_id) # CONTEXTUAL
# Get analytics
analytics = spatial.get_spatial_analytics()
# Returns: workspaces_analyzed, databases_mapped, pages_processed, etc.
# Cleanup when done
await spatial.close()
Performance Profile:
| Aspect | Granular Adapter Pattern | Embedded Intelligence Pattern |
|---|---|---|
| Complexity | High (11 files, 6 components) | Low (1 file, 1 class) |
| Lines of Code | ~81 functions across 6 files | 632 lines, 22 methods |
| Flexibility | Very High (component-based) | Moderate (monolithic) |
| Performance | Good (async I/O optimized) | Excellent (direct access) |
| Testability | Excellent (66 test functions) | Good (integration tests) |
| Maintenance | Higher overhead (11 files) | Lower overhead (1 file) |
| Use Case | Coordination/Messaging | Knowledge/Semantic Analysis |
| Location | services/integrations/ |
services/intelligence/ |
| Base Class | Inherits BaseSpatialAdapter | Standalone class |
| Access | router.get_spatial_adapter() |
Separate class instantiation |
| Composition | Router has adapter | Intelligence has router |
| Focus | Reactive coordination | Analytical intelligence |
Both patterns support the same 8-dimensional spatial analysis framework:
This consistent metaphor enables interoperability between different spatial systems while allowing implementation flexibility.
Both patterns support feature flag control for graceful enablement/disablement:
Slack (Granular Pattern):
from services.infrastructure.config.feature_flags import FeatureFlags
# Check if spatial should be used
if FeatureFlags.should_use_spatial_slack():
# Use SlackSpatialAdapter
spatial_adapter = router.get_spatial_adapter()
else:
# Use legacy mode or basic functionality
pass
Notion (Embedded Pattern):
from services.infrastructure.config.feature_flags import FeatureFlags
# Check if spatial should be used
if FeatureFlags.should_use_spatial_notion():
# Use NotionSpatialIntelligence
spatial = NotionSpatialIntelligence()
await spatial.connect()
else:
# Use basic Notion router without spatial intelligence
pass
Environment Variables:
# Enable spatial systems (default: true)
export USE_SPATIAL_SLACK=true
export USE_SPATIAL_NOTION=true
# Disable for legacy mode
export USE_SPATIAL_SLACK=false
export USE_SPATIAL_NOTION=false
All spatial patterns must:
✅ Domain is complex with multiple interaction types ✅ Requirements are evolving or uncertain ✅ Need extensive customization and extension points ✅ Multiple developers working on spatial features ✅ Comprehensive test coverage is critical ✅ Real-time coordination is primary use case ✅ Component-based architecture preferred
Examples: Messaging platforms, real-time collaboration tools, event-driven systems
✅ Domain is well-defined and stable ✅ Analytical processing is primary use case ✅ Performance optimization is critical ✅ Single comprehensive class provides sufficient structure ✅ Lower maintenance overhead preferred ✅ Knowledge management is primary focus ✅ Monolithic design acceptable for domain
Examples: Knowledge bases, content management systems, semantic analysis tools
Ask these questions:
If you need to migrate from one pattern to another:
BaseSpatialAdapter interfaceget_spatial_adapter() to routerget_spatial_adapter()Note: Migration is a significant undertaking. Choose the right pattern initially based on expected long-term needs.
When implementing spatial intelligence for new integrations:
Both patterns are production-proven and fully operational:
Slack (Granular):
Notion (Embedded):
Both patterns coexist successfully with zero conflicts and 100% compatibility.
Piper Morgan’s dual spatial intelligence patterns represent a mature architectural approach that optimizes for different domains rather than forcing a one-size-fits-all solution.
Key Insights:
Choose wisely: The right pattern makes development easier, maintenance simpler, and performance better. The wrong pattern creates unnecessary complexity or insufficient flexibility.
See Also:
Maintained by: Piper Morgan Core Team
Questions: Create a GitHub issue with label architecture