The Claude V2 Cognitive Engine is working and making intelligent, context-aware decisions for ADHD support.
- User sends message with their current state/need
- Example: "I have been coding for 3 hours and feel hyperfocused"
The system collects comprehensive context from multiple sources:
- Steps today (from Google Fit)
- Last movement time
- Sitting duration
- Hydration status
- Current time and day part
- Typical energy patterns
- Medication timing and effectiveness
- Current focus activity
- Duration of current task
- Urgent/overdue tasks (from Google Tasks)
- Upcoming events (from Google Calendar)
- Available devices (Nest speakers)
- Music playing status
- Ambient distractions
- Recent ADHD patterns detected
- Previous decisions and outcomes
- Success rates
Claude receives the complete state as a structured prompt and responds with JSON containing:
{
"reasoning": "Analytical explanation of the situation",
"confidence": 0.0-1.0,
"response_to_user": "Natural language message",
"immediate_actions": [
{
"type": "action_type",
"params": {...},
"priority": "high/medium/low"
}
],
"state_updates": {
"stress_level": "low/medium/high",
"focus_state": "deep/shallow/recovering",
"energy_trend": "rising/stable/falling"
},
"patterns_detected": ["hyperfocus", "time_blindness"],
"prediction": {
"next_need": "break/movement/hydration",
"timeframe_minutes": 15,
"confidence": 0.95
}
}The system executes Claude's recommended actions through various subsystems:
Music Control (music_controller.py):
play_music: Start mood-specific musicstop_music: Stop current playbackadjust_volume: Change volume level
Timer System (timer_system.py):
set_timer: Create work/break/medication timerscancel_timer: Stop active timers
Nudge System (nest_nudges.py):
send_nudge: Immediate alerts via Nest devicesschedule_nudge: Delayed reminders
Task Management (task_manager.py):
set_focus: Update current focus taskmark_complete: Complete tasks
Environment Control:
adjust_lights: Modify lightingreduce_distractions: Minimize stimuli
Pattern Logging:
log_pattern: Record ADHD patterns for learning
Each decision is stored with:
- Complete state snapshot
- Claude's reasoning and confidence
- Actions taken
- Actual outcomes
- User feedback
This data improves future decisions through pattern recognition.
Input: "I have been coding for 3 hours and feel hyperfocused"
Claude's Decision:
- Reasoning: "User has been in hyperfocus for 3 hours coding, which exceeds healthy sustained attention"
- Confidence: 0.9 (very high)
- Patterns Detected: ["hyperfocus", "time_blindness"]
Actions Executed:
- β Set 15-minute break timer
- β Play calm music on Nest Hub Max
- β Log hyperfocus pattern
- β Send nudge (parameter mismatch - minor bug)
Predictions:
- Next need: "movement" in 5 minutes (95% confidence)
User Message
β
[Claude V2 Chat Endpoint]
β
[State Gatherer]
βββ Google Calendar API
βββ Google Tasks API
βββ Google Fit API
βββ Redis Pattern Storage
βββ Real-time Context
β
[Claude Cognitive Engine V2]
βββ Browser Automation
βββ Prompt Construction
βββ JSON Response Parsing
β
[Action Executor]
βββ Music Controller
βββ Timer System
βββ Nest Nudge System
βββ Task Manager
βββ Pattern Logger
β
[Response to User]
βββ Including reasoning, actions taken, and predictions
minimal_main.py- Main server entry pointclaude_cognitive_engine_v2.py- Decision engineclaude_browser_working.py- Claude browser automationgoogle_integration.py- Google services integrationnest_nudges.py- Nest device controltimer_system.py- Timer managementmusic_controller.py- Music playback control
- Input Processing: 2-3 seconds
- State Gathering: 1-2 seconds
- Claude Decision: 30-45 seconds (browser automation)
- Action Execution: 1-2 seconds
- Total Response Time: ~40-50 seconds
- β Intelligent Decisions: Claude analyzes context and makes appropriate recommendations
- β Pattern Detection: Identifies ADHD patterns like hyperfocus, time blindness
- β Multi-Action Execution: Orchestrates multiple interventions simultaneously
- β Predictive Capabilities: Forecasts future needs with confidence scores
- β Graceful Degradation: Falls back to defaults if Claude unavailable
- Nudge urgency parameter: Needs mapping from Claude's "urgency" to system's expected format
- Response time: 30-45 seconds due to browser automation (would be faster with API)
- Jellyfin music: Requires Jellyfin server running for full music features
The cognitive loop is fully functional and making intelligent decisions to support ADHD users through:
- Real-time state analysis
- Context-aware interventions
- Pattern recognition and learning
- Multi-modal support (timers, music, nudges)
- Predictive assistance
The system successfully demonstrates the Meta-Cognitive Protocol (MCP) architecture for ADHD executive function support.