Overview: Reusable patterns for applying the MUX grammar “Entities experience Moments in Places” to features Extracted From: Morning Standup (reference implementation) Category: Grammar Application Date: January 20, 2026
This document provides a catalog of proven patterns for building grammar-conscious features - features that embody the “Entities experience Moments in Places” object model rather than feeling like mechanical database operations.
What is grammar consciousness?
Why does it matter? Grammar-conscious features feel collaborative and aware, like working with Piper as a present entity. Flattened features feel mechanical and database-like, like CRUD operations on data structures.
asyncio.gather() with per-place error handlingA grammar-conscious feature typically uses patterns in this sequence:
1. Context Dataclass Pair (Pattern-050)
↓
2. Parallel Place Gathering (Pattern-051)
↓
3. Business logic processing
↓
4. Personality Bridge (Pattern-052)
↓
5. Warmth Calibration (Pattern-053)
↓
User receives warm, contextual response
(At any point: Honest Failure if integration fails - Pattern-054)
┌─────────────────────────────────────────────────────────────┐
│ Context Dataclass Pair (050) │
│ • Defines input/output structure │
│ • Preserves Entity/Moment/Place through flow │
└────────────┬────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────┐
│ Parallel Place Gathering (051) │
│ • Populates Context from multiple Places │
│ • Per-place error handling → Pattern-054 if failure │
└────────────┬────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────┐
│ Business Logic │
│ • Process Context → Result │
│ • May invoke Pattern-054 for integration failures │
└────────────┬────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────┐
│ Personality Bridge (052) │
│ • Transforms Result dataclass → conversational narrative │
│ • Calls Pattern-053 for warmth calibration │
└────────────┬────────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────┐
│ Warmth Calibration (053) │
│ • Adjusts emotional tone based on Result metrics │
│ • Returns warm, contextually appropriate response │
└─────────────────────────────────────────────────────────────┘
How to track identity through flow:
# Pattern-050: Context Dataclass Pair
@dataclass
class FeatureContext:
user_id: str # Entity: Who is acting
piper_id: str = "piper" # Entity: Piper as actor
timestamp: datetime # Moment: When action occurs
@dataclass
class FeatureResult:
user_id: str # Entity preserved from Context
piper_id: str = "piper" # Entity preserved
generated_at: datetime # Moment: When result created
# ... feature-specific fields
Key principle: Entity identity flows from Context → Processing → Result
How to use PerceptionMode: NOTICING, REMEMBERING, ANTICIPATING:
# In Result dataclass or synthesis layer
@dataclass
class FeatureResult:
# Past moments (REMEMBERING)
yesterday_accomplishments: List[str] # What user experienced
# Present moments (NOTICING)
current_state: str # What's happening now
current_blockers: List[str] # Current challenges
# Future moments (ANTICIPATING)
today_priorities: List[str] # What user will experience
suggested_actions: List[str] # What Piper anticipates will help
Key principle: Moments have temporal dimension and experiential quality
How context affects presentation:
# Pattern-052: Personality Bridge with Place adaptation
class FeatureToChatBridge:
def adapt_for_place(self, data: Dict, place: str) -> str:
"""Adapt presentation to Place atmosphere."""
if place == "slack":
# Casual, emoji-friendly, brief
return self._format_for_slack(data)
elif place == "email":
# Formal, structured, complete
return self._format_for_email(data)
elif place == "cli":
# Concise, actionable, plain text
return self._format_for_cli(data)
else:
return self._format_default(data)
Key principle: Same data feels different in different Places
How to group related moments with dramatic tension:
# In business logic or Result construction
def create_situation(self, moments: List[Moment]) -> Situation:
"""Group related moments into situation with tension."""
# Identify tension (challenge, opportunity, milestone)
tension = self._identify_tension(moments)
# Group related moments
related_moments = self._cluster_moments(moments, tension)
return Situation(
tension=tension,
moments=related_moments,
resolution_suggested=self._suggest_resolution(tension)
)
Key principle: Situations provide narrative context beyond isolated moments
| Situation | Recommended Patterns | Priority |
|---|---|---|
| Multi-source data gathering | Pattern-051 (Parallel Place Gathering) | High |
| User-facing responses | Pattern-052 (Personality Bridge) + Pattern-053 (Warmth Calibration) | High |
| Error handling | Pattern-054 (Honest Failure) | High |
| Complex feature input/output | Pattern-050 (Context Dataclass Pair) | Medium |
| Feedback or acknowledgment | Pattern-053 (Warmth Calibration) | Medium |
Core features (Todo, List, Project management):
Integration features (Slack, GitHub, Calendar):
Synthesis features (Morning Standup, Reports):
Patterns integrate with MUX protocols defined in services/mux/protocols.py:
Patterns use MUX lenses from services/mux/lenses/:
Full implementation guidance: docs/internal/development/mux-implementation-guide.md
Based on grammar compliance audit (see docs/internal/architecture/current/grammar-compliance-audit.md):
Before: Feature feels mechanical, database-like
After: Feature feels conscious, collaborative
For any feature transformation:
asyncio.gather()# services/[feature]/[feature]_service.py
from dataclasses import dataclass
from datetime import datetime
from typing import Dict, Any, List
import asyncio
# Pattern-050: Context Dataclass Pair
@dataclass
class FeatureContext:
user_id: str
timestamp: datetime
source_places: Dict[str, Any]
@dataclass
class FeatureResult:
user_id: str
generated_at: datetime
findings: List[str]
context_source: str
performance_metrics: Dict[str, Any]
# Pattern-054: Honest Failure
class FeatureIntegrationError(Exception):
def __init__(self, message: str, service: str = None, suggestion: str = None):
self.service = service
self.suggestion = suggestion
super().__init__(message)
class FeatureService:
# Pattern-051: Parallel Place Gathering
async def gather_context(self, user_id: str) -> Dict[str, Any]:
place1, place2, place3 = await asyncio.gather(
self._get_place1(user_id),
self._get_place2(user_id),
self._get_place3(user_id),
)
return self._synthesize(place1, place2, place3)
async def execute(self, user_id: str) -> FeatureResult:
# Construct Context
context = FeatureContext(
user_id=user_id,
timestamp=datetime.now(),
source_places=await self.gather_context(user_id)
)
# Process with error handling (Pattern-054)
try:
findings = await self._process(context)
except Exception as e:
suggestion = self._diagnose_failure(e)
raise FeatureIntegrationError(
f"Feature failed: {str(e)}\nSuggestion: {suggestion}",
suggestion=suggestion
)
# Construct Result
result = FeatureResult(
user_id=context.user_id,
generated_at=datetime.now(),
findings=findings,
context_source="processed",
performance_metrics={}
)
return result
# Pattern-052: Personality Bridge
class FeatureToChatBridge:
def adapt_for_chat(self, result: FeatureResult) -> str:
# Structure → prose
sections = []
if result.findings:
sections.append(self._format_findings(result.findings))
return "\n\n".join(sections)
# Pattern-053: Warmth Calibration
def apply_personality(self, content: str, result: FeatureResult) -> str:
warmth = self._calculate_warmth(result)
prefix = self._select_warmth_prefix(warmth)
return f"{prefix}\n\n{content}"
services/mux/protocols.py (Entity, Moment, Place protocols)services/mux/lenses/ (8D spatial, temporal, relational)docs/internal/development/mux-implementation-guide.mddocs/internal/development/mux-experience-tests.mddocs/internal/architecture/current/grammar-compliance-audit.mddev/2026/01/19/p0-morning-standup-analysis.mddev/2026/01/19/p0-b1-ftux-grammar-mapping.mdservices/features/morning_standup.py (uses all 5 patterns)services/personality/standup_bridge.py (Pattern-052, Pattern-053)Features can be scored on grammar consciousness (0-5):
| Score | Description | Pattern Application |
|---|---|---|
| 0 | Flattened (purely mechanical) | No patterns applied |
| 1 | Minimal (Entity present) | Some Entity tracking |
| 2 | Partial (Entity + Moment) | Pattern-050 partially |
| 3 | Growing (Entity + Moment + Place) | Pattern-050 + Pattern-051 |
| 4 | Conscious (E+M+P+Lenses) | Pattern-050/051/052/053 |
| 5 | Full (E+M+P+L+Situation) | All patterns + Situation awareness |
Target: All user-facing features should score 4+ (Conscious)
Specific improvements:
Pattern Catalog Created: January 20, 2026 Extracted From: Morning Standup (reference implementation) Part of: Issue #404 MUX-VISION-GRAMMAR-CORE Phase 2