avaliev commited on
Commit
a8072e2
·
verified ·
1 Parent(s): 361a507

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +172 -634
README.md CHANGED
@@ -6,80 +6,104 @@ emoji: 📊
6
  colorFrom: indigo
7
  colorTo: blue
8
  short_description: FocusFlow is AI productivity helper + task tracker MCP
 
 
 
 
 
9
  ---
 
10
  # 🦉 FocusFlow - AI Productivity Accountability Agent
11
 
12
- **Your Duolingo-style AI buddy that keeps you focused while coding**
13
 
14
  [![Gradio](https://img.shields.io/badge/Built%20with-Gradio-orange)](https://gradio.app)
15
  [![MCP](https://img.shields.io/badge/MCP-Enabled-blue)](https://modelcontextprotocol.io)
16
  [![Python](https://img.shields.io/badge/Python-3.11+-green)](https://python.org)
 
 
 
 
 
 
17
 
18
  ## 🎯 The Problem
19
 
20
- Developers with ADHD and procrastination tendencies struggle with:
21
- - **Task paralysis**: Breaking projects into manageable pieces
22
- - **Context switching**: Getting distracted by unrelated files/tasks
23
- - **Accountability**: No one keeping them on track during work sessions
24
- - **Progress tracking**: Not knowing if they're making real progress
 
 
25
 
26
  ## ✨ The Solution
27
 
28
- FocusFlow is an AI-powered productivity partner that:
 
29
  1. **Breaks down projects** into 5-8 micro-tasks (15-30 min each)
30
  2. **Monitors your workspace** in real-time (file changes or text input)
31
  3. **Provides Duolingo-style nudges** when you get distracted or idle
32
  4. **Tracks focus metrics** with streaks, scores, and visualizations
33
  5. **Integrates with LLMs** via MCP (Model Context Protocol) for natural language task management
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- ## 🚀 Key Features
36
-
37
- ### 🎯 AI-Powered Project Onboarding
38
- - Describe your project in plain English
39
- - Get actionable micro-tasks instantly
40
- - Smart task generation based on project type (web, API, etc.)
41
-
42
- ### 👁️ Real-Time Focus Monitoring
43
- - **Local Mode**: Watches your project directory for file changes
44
- - **Demo Mode**: Simulates workspace with text area (perfect for HuggingFace Spaces)
45
- - Content-aware analysis (reads code changes, not just filenames)
46
-
47
- ### 🦉 Duolingo-Style Personality
48
- - **On Track**: "Great work! You're making solid progress! 🎯"
49
- - **Distracted**: "Wait, what are you working on? That doesn't look like the task! 🤨"
50
- - **Idle**: "Files won't write themselves. *Hoot hoot.* 🦉"
51
-
52
- ### 📊 Productivity Dashboard
53
- - **Focus Score**: 0-100 rating based on on-track percentage
54
- - **Streaks**: Consecutive "On Track" checks 🔥
55
- - **Weekly Trends**: Visualize your focus patterns
56
- - **State Distribution**: See where your time goes
57
-
58
- ### 🍅 Built-in Pomodoro Timer
59
- - 25-minute work sessions
60
- - 5-minute break reminders
61
- - Audio alerts + browser notifications
62
- - Auto-switching between work and break modes
63
 
64
- ### 🔗 MCP Integration (Game Changer!)
65
- Connect FocusFlow to Claude Desktop, Cursor, or any MCP-compatible client!
66
 
67
- **Available MCP Tools:**
68
- - `add_task(title, description, duration)` - Create tasks via conversation
69
- - `get_current_task()` - Check what you should be working on
70
- - `start_task(task_id)` - Begin a focus session
71
- - `mark_task_done(task_id)` - Complete tasks
72
- - `get_all_tasks()` - List all tasks
73
- - `get_productivity_stats()` - View your metrics
74
 
75
- **MCP Resources:**
76
- - `focusflow://tasks/all` - Full task list
77
- - `focusflow://tasks/active` - Current active task
78
- - `focusflow://stats` - Productivity statistics
79
 
80
- ## 📦 Installation
 
81
 
82
- ### Quick Start (Demo Mode)
83
 
84
  ```bash
85
  # Clone the repository
@@ -89,646 +113,162 @@ cd FocusFlow
89
  # Install dependencies
90
  pip install -r requirements.txt
91
 
92
- # Run in demo mode (no API keys needed!)
93
- python app.py
94
- ```
95
-
96
- Open `http://localhost:5000` in your browser.
97
-
98
- ### With AI Provider (Optional)
99
-
100
- FocusFlow supports multiple AI providers:
101
-
102
- ```bash
103
- # Option 1: OpenAI
104
- export AI_PROVIDER=openai
105
- export OPENAI_API_KEY=your_key_here
106
-
107
- # Option 2: Anthropic Claude
108
- export AI_PROVIDER=anthropic
109
- export ANTHROPIC_API_KEY=your_key_here
110
-
111
- # Option 3: Google Gemini
112
- export AI_PROVIDER=gemini
113
- export GEMINI_API_KEY=your_key_here
114
-
115
- # Option 4: vLLM (local inference)
116
- export AI_PROVIDER=vllm
117
- export VLLM_BASE_URL=http://localhost:8000/v1
118
- export VLLM_MODEL=ibm-granite/granite-4.0-h-1b
119
-
120
- # Then run
121
- python app.py
122
- ```
123
-
124
- **No API keys? No problem!** FocusFlow automatically uses a **Mock AI** agent with predefined responses for testing.
125
-
126
- ### For Hackathon Organizers (HuggingFace Spaces)
127
-
128
- To enable AI features on demo deployments, set **demo API keys** as environment variables:
129
-
130
- ```bash
131
- DEMO_ANTHROPIC_API_KEY=sk-ant-xxx # Checked first, falls back to user keys
132
- DEMO_OPENAI_API_KEY=sk-xxx # Same fallback logic
133
- DEMO_GEMINI_API_KEY=xxx # Same fallback logic
134
- ```
135
-
136
- If demo keys run out of credits, FocusFlow gracefully falls back to Mock AI mode automatically.
137
-
138
- ## 🔌 Connecting to Claude Desktop (MCP)
139
-
140
- ### Step 1: Start FocusFlow
141
-
142
- ```bash
143
  python app.py
144
  ```
145
 
146
- You'll see:
147
- ```
148
- 🔗 MCP Server enabled! Connect via Claude Desktop or other MCP clients.
149
- * Streamable HTTP URL: http://localhost:5000/gradio_api/mcp/
150
- ```
151
 
152
- ### 🔌 Connecting via MCP (Claude Desktop / Windows)
 
 
 
 
153
 
154
- FocusFlow runs an MCP server that you can connect to from external tools like Claude Desktop or LM Studio.
155
 
156
- **If running on WSL and connecting from Windows:**
157
 
158
- 1. **Ensure the app is running**: `python app.py` (it listens on `0.0.0.0` by default).
159
- 2. **Find your WSL IP address**: Run `wsl hostname -I` in your terminal.
160
- 3. **Configure your MCP Client**:
161
- * **Type**: SSE (Server-Sent Events)
162
- * **URL**: `http://<YOUR_WSL_IP>:5000/gradio_api/mcp/sse`
163
- * *(Or try `http://localhost:5000/gradio_api/mcp/sse` if localhost forwarding is working)*
164
 
165
- **Available MCP Tools:**
166
- * `get_active_task`: Get the currently active task.
167
- * `add_task`: Create a new task.
168
- * `update_task`: Update task status or details.
169
- * `get_productivity_stats`: Get focus scores and metrics.
170
 
171
- **Configuration (mcp.json / claude_desktop_config.json):**
172
 
173
- ```json
174
- {
175
- "mcpServers": {
176
- "focusflow": {
177
- "command": "npx",
178
- "args": [
179
- "mcp-remote",
180
- "http://YOUR_WSL_IP:5000/gradio_api/mcp",
181
- "--allow-http"
182
- ]
183
- }
184
- }
185
- }
186
- ```
187
- *Replace `<YOUR_WSL_IP>` with the IP address from step 2 (e.g., `172.x.x.x`).*
188
 
189
- ### Step 2: Configure Claude Desktop
190
 
191
- #### macOS
192
- Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
 
 
 
193
 
194
  ```json
195
  {
196
  "mcpServers": {
197
  "focusflow": {
198
- "command": "python",
199
- "args": ["/absolute/path/to/your/focusflow/app.py"]
200
  }
201
  }
202
  }
203
- ```
204
-
205
- #### Windows
206
- Edit `%APPDATA%\Claude\claude_desktop_config.json` with the same JSON format.
207
-
208
- ### Step 3: Restart Claude Desktop
209
-
210
- Close and reopen Claude Desktop. You should see FocusFlow tools available!
211
-
212
- ### Step 4: Test It Out
213
-
214
- In Claude Desktop, try:
215
- ```
216
- "Add a task to build a REST API with authentication"
217
- "What task should I work on now?"
218
- "Mark task 1 as done"
219
- "Show me my productivity stats"
220
- ```
221
-
222
- ## 🆕 Recent Updates
223
-
224
- ### Version 1.0 (Hackathon Release)
225
- - ✅ **MCP Integration** - Full Model Context Protocol support with 8 tools and 3 resources
226
- - ✅ **Voice Feedback** - ElevenLabs integration for Duolingo-style audio nudges
227
- - ✅ **Demo API Keys** - Support for `DEMO_ANTHROPIC_API_KEY`, `DEMO_OPENAI_API_KEY`, and `DEMO_ELEVEN_API_KEY` for hackathon deployments
228
- - ✅ **Productivity Dashboard** - Focus scores, streaks, weekly trends, and state distribution charts
229
- - ✅ **Mock AI Mode** - Works without API keys for testing and demos
230
- - ✅ **Graceful Degradation** - Automatically falls back to Mock AI if API keys are invalid or out of credits
231
- - ✅ **Dual Launch Modes** - Demo mode (text area) and Local mode (file monitoring)
232
- - ✅ **Comprehensive Testing** - Full testing checklist in `TESTING_CHECKLIST.md`
233
- - ✅ **Error Handling** - Invalid task IDs return helpful error messages in MCP tools
234
- - ✅ **Metrics Integration** - MCP `get_productivity_stats()` includes focus scores and streaks
235
-
236
- ## ⚙️ Configuration & Environment Variables
237
-
238
- ### Core Settings
239
-
240
- | Variable | Default | Options | Description |
241
- |----------|---------|---------|-------------|
242
- | `LAUNCH_MODE` | `demo` | `demo`, `local` | Workspace monitoring mode (see Launch Modes below) |
243
- | `AI_PROVIDER` | `anthropic` | `openai`, `anthropic`, `vllm`, `mock` | AI provider to use |
244
- | `MONITOR_INTERVAL` | `30` | Any integer | Seconds between automatic focus checks |
245
- | `ENABLE_MCP` | `true` | `true`, `false` | Enable/disable MCP server |
246
-
247
- ### AI Provider API Keys
248
-
249
- **Priority Order:** Demo keys are checked first, then user keys, then falls back to Mock AI.
250
-
251
- #### User API Keys
252
- | Variable | Description | Get Key From |
253
- |----------|-------------|--------------|
254
- | `OPENAI_API_KEY` | Your personal OpenAI API key | https://platform.openai.com/api-keys |
255
- | `ANTHROPIC_API_KEY` | Your personal Anthropic API key | https://console.anthropic.com/ |
256
- | `ELEVEN_API_KEY` | Your personal ElevenLabs API key (optional) | https://elevenlabs.io/api |
257
- | `LINEAR_API_KEY` | Your personal Linear API key (optional) | https://linear.app/settings/api |
258
-
259
- #### Demo API Keys (For Hackathon Organizers)
260
- | Variable | Description | Use Case |
261
- |----------|-------------|----------|
262
- | `DEMO_ANTHROPIC_API_KEY` | Shared Anthropic key for demos | Set on HuggingFace Spaces for judges/testers |
263
- | `DEMO_OPENAI_API_KEY` | Shared OpenAI key for demos | Set on HuggingFace Spaces for judges/testers |
264
- | `DEMO_ELEVEN_API_KEY` | Shared ElevenLabs key for voice | Set on HuggingFace Spaces for voice feedback |
265
-
266
- **How It Works:**
267
- ```python
268
- # Priority chain (Anthropic example):
269
- 1. Check DEMO_ANTHROPIC_API_KEY (hackathon demo key)
270
- 2. If not found, check ANTHROPIC_API_KEY (user's personal key)
271
- 3. If not found or invalid, fall back to Mock AI (no errors!)
272
-
273
- # Voice integration (optional):
274
- 1. Check DEMO_ELEVEN_API_KEY (hackathon demo key)
275
- 2. If not found, check ELEVEN_API_KEY (user's personal key)
276
- 3. If not found, gracefully disable voice (text-only mode)
277
- ```
278
-
279
- #### vLLM Settings (Local Inference)
280
- | Variable | Default | Description |
281
- |----------|---------|-------------|
282
- | `VLLM_BASE_URL` | `http://localhost:8000/v1` | vLLM server endpoint |
283
- | `VLLM_MODEL` | `ibm-granite/granite-4.0-h-1b` | Model name |
284
- | `VLLM_API_KEY` | `EMPTY` | API key (usually not needed for local) |
285
-
286
- ### API Key Management Best Practices
287
-
288
- **For Local Development:**
289
- ```bash
290
- # Copy the example file
291
- cp .env.example .env
292
-
293
- # Edit .env and add your personal keys
294
- nano .env # or your preferred editor
295
- ```
296
-
297
- **For HuggingFace Spaces Deployment:**
298
- ```bash
299
- # In Space Settings > Variables, add:
300
- LAUNCH_MODE=demo
301
- AI_PROVIDER=anthropic
302
- DEMO_ANTHROPIC_API_KEY=sk-ant-your-hackathon-key
303
- ```
304
-
305
- **For Testing Without API Keys:**
306
- ```bash
307
- # Just run - Mock AI activates automatically!
308
- python app.py
309
- # Status: "ℹ️ Running in DEMO MODE with Mock AI (no API keys needed). Perfect for testing! 🎭"
310
- ```
311
-
312
- ### Graceful Degradation
313
-
314
- FocusFlow **never crashes** due to missing or invalid API keys:
315
-
316
- | Scenario | Behavior | User Experience |
317
- |----------|----------|-----------------|
318
- | No API keys set | Uses Mock AI | ✅ Full demo functionality |
319
- | Invalid API key | Falls back to Mock AI | ✅ App continues working |
320
- | API out of credits | Falls back to Mock AI | ✅ Seamless transition |
321
- | API rate limited | Retries, then Mock AI | ✅ No interruption |
322
 
323
- **Status Messages:**
324
- - `✅ Anthropic Claude initialized successfully (demo key)` - Demo key working
325
- - `✅ OpenAI GPT-4 initialized successfully (user key)` - User key working
326
- - `ℹ️ Running in DEMO MODE with Mock AI (no API keys needed)` - Fallback active
327
 
328
- ## 🎮 Launch Modes Explained
 
 
 
 
 
 
 
329
 
330
- FocusFlow supports two workspace monitoring modes:
331
 
332
- ### Demo Mode (`LAUNCH_MODE=demo`)
 
 
333
 
334
- **Best for:**
335
- - HuggingFace Spaces deployments
336
- - Replit deployments
337
- - Testing without file system access
338
- - Hackathon demos for judges
339
 
340
- **How it works:**
341
- - Provides a text area for simulating workspace activity
342
- - Users type what they're working on
343
- - AI analyzes text content for focus checks
344
- - No file system permissions needed
345
 
346
- **Example:**
347
- ```bash
348
- export LAUNCH_MODE=demo
349
- python app.py
350
- # Monitor tab shows: "Demo Workspace" text area
351
- ```
352
-
353
- **User Workflow:**
354
- 1. Type: "Working on authentication API, creating login endpoint"
355
- 2. Click "Check Focus Now"
356
- 3. Result: "On Track! Great work! 🎯"
357
-
358
- ### Local Mode (`LAUNCH_MODE=local`)
359
-
360
- **Best for:**
361
- - Local development environments
362
- - Real-time file monitoring
363
- - Production use cases
364
- - Personal productivity tracking
365
-
366
- **How it works:**
367
- - Uses `watchdog` library to monitor file system changes
368
- - Automatically detects file modifications in project directory
369
- - Reads actual file diffs for intelligent analysis
370
- - Triggers focus checks automatically when files change
371
-
372
- **Example:**
373
- ```bash
374
- export LAUNCH_MODE=local
375
- python app.py
376
- # Monitor tab shows: "Watching directory: /your/project/path"
377
  ```
378
 
379
- **User Workflow:**
380
- 1. Start a task in Task Manager
381
- 2. Edit files in your project
382
- 3. FocusFlow automatically detects changes and runs focus checks
383
- 4. Receive real-time feedback
384
-
385
- ### Choosing the Right Mode
386
-
387
- | Use Case | Recommended Mode | Reason |
388
- |----------|------------------|--------|
389
- | HuggingFace Spaces | `demo` | No file system access in web deployments |
390
- | Hackathon demo | `demo` | Easy for judges to test without setup |
391
- | Local development | `local` | Real-time file monitoring is more natural |
392
- | Replit | `demo` | Simpler, no file permissions issues |
393
- | Personal productivity | `local` | Authentic workspace monitoring |
394
-
395
- ## 📁 Project Structure
396
-
397
- ```
398
- focusflow/
399
- ├── app.py # Main Gradio application
400
- ├── agent.py # AI focus agent (OpenAI/Anthropic/Mock)
401
- ├── storage.py # Task manager with SQLite
402
- ├── monitor.py # File monitoring with watchdog
403
- ├── metrics.py # Productivity tracking
404
- ├── mcp_tools.py # MCP tools and resources
405
- ├── requirements.txt # Python dependencies
406
- ├── .env.example # Environment template
407
- └── README.md # This file
408
  ```
409
 
410
- ## 🎥 Demo & Screenshots
411
-
412
- ### Home Screen
413
- Clean interface with feature overview and configuration status.
414
-
415
- ### Onboarding
416
- AI generates micro-tasks from project descriptions.
417
 
418
- ### Task Manager
419
- Kanban-style task board with drag-and-drop (coming soon).
420
 
421
- ### Dashboard
422
- Visualize focus scores, streaks, and productivity trends.
 
423
 
424
- ### Monitor
425
- Real-time focus checks with Duolingo-style feedback.
426
 
427
- ## 🏆 Why This is Perfect for the Gradio MCP Hackathon
 
 
428
 
429
- 1. **Novel MCP Use Case**: First MCP-powered productivity/accountability tool
430
- 2. **Deep Integration**: Natural language task management through Claude Desktop
431
- 3. **Real Problem**: Solves actual pain points for developers with ADHD
432
- 4. **Gradio Showcase**: Uses tabs, plots, timers, state management, custom JS
433
- 5. **Demo-Friendly**: Works without API keys, deployable to HF Spaces
434
- 6. **Production-Ready**: SQLite persistence, metrics tracking, error handling
435
 
436
- ## 🧪 Testing
437
 
438
- ### Quick Feature Test (5 minutes)
439
 
440
- Use the comprehensive **`TESTING_CHECKLIST.md`** file for detailed testing instructions. Here's a quick verification:
441
-
442
- ```bash
443
- # 1. Start the app
444
- python app.py
445
-
446
- # 2. Open browser
447
- open http://localhost:5000
448
-
449
- # 3. Test each tab:
450
- # ✅ Home: Check status message shows AI provider
451
- # ✅ Onboarding: Generate tasks from project description
452
- # ✅ Task Manager: Create/edit/delete/start tasks
453
- # ✅ Monitor: Perform focus checks (demo workspace or file changes)
454
- # ✅ Dashboard: View metrics after focus checks
455
- # ✅ Pomodoro: Start/pause/reset timer
456
- ```
457
 
458
- ### Test Scenarios
 
459
 
460
- **Scenario 1: Demo Mode (No API Keys)**
461
- ```bash
462
- # No .env file needed
463
- python app.py
464
- # Expected: "ℹ️ Running in DEMO MODE with Mock AI"
465
- # Test: All features work with predefined responses
466
- ```
467
 
468
- **Scenario 2: With Anthropic API Key**
469
- ```bash
470
- export AI_PROVIDER=anthropic
471
- export ANTHROPIC_API_KEY=sk-ant-your-key
472
- python app.py
473
- # Expected: "✅ Anthropic Claude initialized successfully (user key)"
474
- # Test: Intelligent task generation and focus analysis
475
- ```
476
 
477
- **Scenario 3: Demo Key (Hackathon Deployment)**
478
- ```bash
479
- export AI_PROVIDER=anthropic
480
- export DEMO_ANTHROPIC_API_KEY=sk-ant-demo-key
481
- python app.py
482
- # Expected: "✅ Anthropic Claude initialized successfully (demo key)"
483
- # Test: Uses demo key, falls back to Mock if exhausted
484
- ```
485
 
486
- **Scenario 4: MCP Integration**
487
- ```bash
488
- # 1. Configure Claude Desktop (see MCP section above)
489
- # 2. Start FocusFlow
490
- python app.py
491
- # 3. In Claude Desktop, test tools:
492
- # - "Add a task to implement OAuth2"
493
- # - "What's my current task?"
494
- # - "Show my productivity stats"
495
- ```
496
 
497
- ### Automated Testing
498
 
499
- Run the full test suite:
500
  ```bash
501
- # Follow TESTING_CHECKLIST.md step-by-step
502
- # Expected: All features pass without errors
503
- # Time: ~15 minutes for comprehensive test
504
- ```
505
-
506
- ### Common Issues & Solutions
507
-
508
- | Issue | Solution |
509
- |-------|----------|
510
- | "No API key" error | Set `AI_PROVIDER=mock` or leave keys empty - Mock AI activates automatically |
511
- | Charts show "Infinite extent" warning | Normal on first load with no data - warnings disappear after focus checks |
512
- | MCP tools not visible in Claude | Restart Claude Desktop after config changes |
513
- | File monitoring not working | Check `LAUNCH_MODE=local` and file permissions |
514
- | Tasks not persisting | Check `focusflow.db` file exists and is writable |
515
-
516
- ## 🚀 Deployment
517
-
518
- ### Deployment Option 1: HuggingFace Spaces (Recommended for Hackathon)
519
-
520
- **Step 1: Create Space**
521
- 1. Go to https://huggingface.co/spaces
522
- 2. Click "Create new Space"
523
- 3. Select "Gradio" as SDK
524
- 4. Choose a name (e.g., `focusflow-demo`)
525
 
526
- **Step 2: Upload Files**
527
- Upload these files to your Space:
528
- - `app.py`
529
- - `agent.py`
530
- - `storage.py`
531
- - `monitor.py`
532
- - `metrics.py`
533
- - `mcp_tools.py`
534
- - `requirements.txt`
535
- - `README.md`
536
- - `.env.example` (optional, for documentation)
537
 
538
- **Step 3: Configure Environment Variables**
539
-
540
- In Space Settings → Variables, add:
541
-
542
- **Option A: With Demo AI (Recommended for Judges)**
543
- ```bash
544
- LAUNCH_MODE=demo
545
  AI_PROVIDER=anthropic
546
- DEMO_ANTHROPIC_API_KEY=sk-ant-your-hackathon-shared-key
547
- MONITOR_INTERVAL=30
548
- ENABLE_MCP=true
549
- ```
550
 
551
- **Option B: Mock AI Only (No API Keys Needed)**
552
- ```bash
553
- LAUNCH_MODE=demo
554
- AI_PROVIDER=mock
555
- MONITOR_INTERVAL=30
556
- ENABLE_MCP=true
557
- ```
558
-
559
- **Step 4: Deploy**
560
- - Click "Save" - Space will automatically rebuild and deploy
561
- - Your app will be live at: `https://huggingface.co/spaces/yourusername/focusflow-demo`
562
- - MCP server endpoint: `https://yourusername-focusflow-demo.hf.space/gradio_api/mcp/`
563
-
564
- **Step 5: Test Deployment**
565
- 1. Open the Space URL
566
- 2. Test onboarding → Generate tasks
567
- 3. Test task manager → CRUD operations
568
- 4. Test monitor → Focus checks
569
- 5. Test dashboard → View metrics
570
- 6. Test MCP (optional) → Connect from Claude Desktop
571
-
572
- ### Deployment Option 2: Replit
573
-
574
- **Step 1: Import Repository**
575
- 1. Go to https://replit.com
576
- 2. Click "Create Repl" → "Import from GitHub"
577
- 3. Paste your FocusFlow repository URL
578
-
579
- **Step 2: Configure Secrets**
580
- In Replit Secrets (Tools → Secrets):
581
- ```bash
582
- AI_PROVIDER=anthropic
583
- ANTHROPIC_API_KEY=your_key_here
584
- LAUNCH_MODE=demo
585
- ```
586
-
587
- **Step 3: Run**
588
- ```bash
589
- python app.py
590
- ```
591
-
592
- **Step 4: Share**
593
- - Click "Share" button
594
- - Copy the public URL
595
- - MCP endpoint: `https://yourrepl.repl.co/gradio_api/mcp/`
596
-
597
- ### Deployment Option 3: Local Development
598
-
599
- **Step 1: Clone Repository**
600
- ```bash
601
- git clone https://github.com/yourusername/focusflow.git
602
- cd focusflow
603
- ```
604
-
605
- **Step 2: Install Dependencies**
606
- ```bash
607
- pip install -r requirements.txt
608
- ```
609
 
610
- **Step 3: Configure Environment**
611
- ```bash
612
- # Copy example
613
- cp .env.example .env
614
-
615
- # Edit .env with your settings
616
- nano .env # or code .env, vim .env, etc.
617
- ```
618
-
619
- **Step 4: Run**
620
- ```bash
621
- # For local file monitoring
622
- export LAUNCH_MODE=local
623
- python app.py
624
-
625
- # For demo mode (text area)
626
- export LAUNCH_MODE=demo
627
- python app.py
628
- ```
629
-
630
- **Step 5: Access**
631
- - Web UI: http://localhost:5000
632
- - MCP endpoint: http://localhost:5000/gradio_api/mcp/
633
-
634
- ### Deployment Option 4: Docker (Advanced)
635
-
636
- Create `Dockerfile`:
637
- ```dockerfile
638
- FROM python:3.11-slim
639
-
640
- WORKDIR /app
641
- COPY requirements.txt .
642
- RUN pip install --no-cache-dir -r requirements.txt
643
-
644
- COPY . .
645
-
646
- ENV LAUNCH_MODE=demo
647
- ENV AI_PROVIDER=mock
648
- ENV ENABLE_MCP=true
649
-
650
- EXPOSE 5000
651
-
652
- CMD ["python", "app.py"]
653
- ```
654
-
655
- Build and run:
656
- ```bash
657
- docker build -t focusflow .
658
- docker run -p 5000:5000 -e ANTHROPIC_API_KEY=your_key focusflow
659
  ```
660
 
661
- ### Post-Deployment Checklist
662
-
663
- After deploying to any platform:
664
-
665
- - [ ] App loads without errors
666
- - [ ] Home tab shows correct AI provider status
667
- - [ ] Onboarding generates tasks
668
- - [ ] Task Manager CRUD operations work
669
- - [ ] Monitor tab performs focus checks
670
- - [ ] Dashboard displays metrics (after checks)
671
- - [ ] Pomodoro timer functions
672
- - [ ] MCP endpoint accessible (optional)
673
- - [ ] No sensitive data exposed in logs
674
- - [ ] Database file (`focusflow.db`) created successfully
675
-
676
- ### Environment Variables Reference (Deployment)
677
-
678
- **Required:**
679
- - `LAUNCH_MODE` - Always set to `demo` for web deployments
680
-
681
- **Optional:**
682
- - `AI_PROVIDER` - `anthropic`, `openai`, `vllm`, or `mock` (default: `anthropic`)
683
- - `DEMO_ANTHROPIC_API_KEY` - For hackathon/shared deployments
684
- - `DEMO_OPENAI_API_KEY` - Alternative demo provider
685
- - `ANTHROPIC_API_KEY` - User's personal key
686
- - `OPENAI_API_KEY` - User's personal key
687
- - `MONITOR_INTERVAL` - Seconds between checks (default: 30)
688
- - `ENABLE_MCP` - Enable MCP server (default: true)
689
-
690
- ### Deployment Troubleshooting
691
-
692
- | Issue | Platform | Solution |
693
- |-------|----------|----------|
694
- | Import errors | HF Spaces | Check `requirements.txt` includes all dependencies |
695
- | "Port already in use" | Local | Change port in `app.py` or kill process using port 5000 |
696
- | MCP not accessible | All | Ensure `ENABLE_MCP=true` and check firewall settings |
697
- | Database errors | HF Spaces | Ensure space has write permissions (SQLite needs filesystem) |
698
- | Mock AI always active | All | Check environment variables are set correctly |
699
- | Slow performance | HF Spaces | Free tier has limited resources - consider upgrading |
700
-
701
- ## 🛠️ Tech Stack
702
-
703
- - **Frontend**: Gradio 5.0+ (Python UI framework)
704
- - **Backend**: Python 3.11+
705
- - **Database**: SQLite (zero-config persistence)
706
- - **AI Providers**: OpenAI GPT-4, Anthropic Claude, Google Gemini, vLLM, or Mock
707
- - **Voice**: ElevenLabs text-to-speech (optional)
708
- - **File Monitoring**: Watchdog (real-time filesystem events)
709
- - **MCP Integration**: Model Context Protocol for LLM interoperability
710
- - **Charts**: Gradio native plots (pandas DataFrames)
711
-
712
- ## 📈 Roadmap
713
-
714
- - [ ] Mobile app (React Native + Gradio backend)
715
- - [ ] GitHub integration (auto-detect tasks from issues)
716
- - [ ] Slack/Discord notifications
717
- - [ ] Team mode (shared accountability)
718
- - [ ] Voice commands (Whisper integration)
719
- - [ ] VS Code extension
720
-
721
  ## 🤝 Contributing
722
 
723
- Contributions welcome! Please:
724
- 1. Fork the repository
725
- 2. Create a feature branch
726
- 3. Make your changes
727
- 4. Submit a pull request
728
 
729
  ## 📄 License
730
 
731
- MIT License - feel free to use this for personal or commercial projects!
732
 
733
  ## 🙏 Acknowledgments
734
 
@@ -738,7 +278,5 @@ MIT License - feel free to use this for personal or commercial projects!
738
  - Uses [Model Context Protocol](https://modelcontextprotocol.io) for LLM integration
739
 
740
  ---
741
-
742
- **Made with ❤️ for developers with ADHD who just need a little nudge to stay focused.**
743
-
744
  *Hoot hoot!* 🦉
 
6
  colorFrom: indigo
7
  colorTo: blue
8
  short_description: FocusFlow is AI productivity helper + task tracker MCP
9
+ tags:
10
+ - mcp-in-action-track-consumer
11
+ - mcp-in-action-track-creative
12
+ - building-mcp-track-consumer
13
+ - building-mcp-track-creative
14
  ---
15
+
16
  # 🦉 FocusFlow - AI Productivity Accountability Agent
17
 
18
+ **Your Duolingo-style AI buddy that keeps you focused while coding.**
19
 
20
  [![Gradio](https://img.shields.io/badge/Built%20with-Gradio-orange)](https://gradio.app)
21
  [![MCP](https://img.shields.io/badge/MCP-Enabled-blue)](https://modelcontextprotocol.io)
22
  [![Python](https://img.shields.io/badge/Python-3.11+-green)](https://python.org)
23
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
24
+
25
+ [![](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue)](https://huggingface.co/spaces/MCP-1st-Birthday/FocusFlowAI)
26
+
27
+ Link to demo : TBD
28
+ Link to Social Media posts: TBD
29
 
30
  ## 🎯 The Problem
31
 
32
+ **"I'll just check Reddit for 5 minutes while wait for inspiration..." -> 3 hours later.**
33
+
34
+ Developers and creators often struggle with:
35
+ - **Task Paralysis**: Overwhelmed by big projects.
36
+ - **Context Switching**: Getting lost in unrelated rabbit holes.
37
+ - **Lack of Accountability**: No one to gently nudge you back to work.
38
+ - **"Busy" vs. Productive**: Doing work that doesn't actually move the needle.
39
 
40
  ## ✨ The Solution
41
 
42
+ **FocusFlow** is an AI-powered productivity partner that monitors your **actual work** (file changes, git commits) and gently nudges you when you drift off track. It's not a micromanager; it's a friendly companion that helps you maintain momentum.
43
+
44
  1. **Breaks down projects** into 5-8 micro-tasks (15-30 min each)
45
  2. **Monitors your workspace** in real-time (file changes or text input)
46
  3. **Provides Duolingo-style nudges** when you get distracted or idle
47
  4. **Tracks focus metrics** with streaks, scores, and visualizations
48
  5. **Integrates with LLMs** via MCP (Model Context Protocol) for natural language task management
49
+ 6. **Integrates with Linear MCP** for project management
50
+
51
+ ## 🚀 Features
52
+
53
+ | Feature | Description |
54
+ | :--- | :--- |
55
+ | 🦉 **Duolingo-style Nudges** | Friendly, personality-driven reminders to stay on track. |
56
+ | 🔗 **MCP Integration** | Connects with tools like Claude Desktop for natural language task execution and management. |
57
+ | 📋 **Linear Sync** | Import projects and tasks directly from Linear (via API). |
58
+ | 👁️ **Focus Monitoring** | Real-time file system monitoring to detect actual work. |
59
+ | 🛡️ **Privacy First** | Support for local LLMs (Ollama) or private API keys. |
60
+ | 🍅 **Pomodoro Timer** | Built-in timer with break reminders and audio alerts. |
61
+ | 📊 **Productivity Stats** | Track streaks, focus scores, and daily progress. |
62
+ | 🗣️ **Voice Feedback** | (Optional) ElevenLabs integration for spoken encouragement. |
63
+
64
+ ## 🏗️ Architecture
65
+
66
+ ```ascii
67
+ +----------------+ +------------------+ +----------------+
68
+ | Claude Desktop | <--> | FocusFlow (MCP) | <--> | Linear API |
69
+ | (MCP Client) | | (Gradio App) | | (Task Source) |
70
+ +----------------+ +------------------+ +----------------+
71
+ ^ |
72
+ | v
73
+ | +------------------+
74
+ | | Local File Sys |
75
+ | | (Watchdog) |
76
+ | +------------------+
77
+ | |
78
+ | v
79
+ +----------------+ +------------------+
80
+ | User Workspace | <--> | AI Agent Logic |
81
+ | (Code/Docs) | | (LLM / Mock) |
82
+ +----------------+ +------------------+
83
+ ```
84
 
85
+ ```
86
+ focusflow/
87
+ ├── app.py # Main Gradio application
88
+ ├── agent.py # AI focus agent (OpenAI/Anthropic/Mock)
89
+ ├── storage.py # Task manager with SQLite
90
+ ├── monitor.py # File monitoring with watchdog
91
+ ├── metrics.py # Productivity tracking
92
+ ├── mcp_tools.py # MCP tools and resources
93
+ ├── requirements.txt # Python dependencies
94
+ ├── .env.example # Environment template
95
+ └── README.md # This file
96
+ ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
 
 
98
 
99
+ ## Quick Start
 
 
 
 
 
 
100
 
101
+ ### 1. Installation
 
 
 
102
 
103
+ **Option A: Hugging Face Spaces (Try it now!)**
104
+ Click the "Try It" button above to run the demo version in your browser.
105
 
106
+ **Option B: Local Setup (Recommended for full features)**
107
 
108
  ```bash
109
  # Clone the repository
 
113
  # Install dependencies
114
  pip install -r requirements.txt
115
 
116
+ # Run the app
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  python app.py
118
  ```
119
 
120
+ ### 2. Onboarding
 
 
 
 
121
 
122
+ 1. Open `http://localhost:5000`.
123
+ 2. **Home Tab**: Check your AI provider status.
124
+ 3. **Onboarding Tab**: Describe your project (e.g., "Build a React Native weather app") or import from Linear.
125
+ 4. **Task Manager**: See your decomposed micro-tasks.
126
+ 5. **Monitor**: Start working! FocusFlow will watch your file changes and update your status.
127
 
128
+ ## 🛡️ Privacy & AI Providers
129
 
130
+ FocusFlow gives you full control over your data.
131
 
132
+ | Mode | Description | Best For |
133
+ | :--- | :--- | :--- |
134
+ | **Local (Ollama/vLLM)** | Runs 100% on your machine. No data leaves your network. | 🔒 Maximum Privacy |
135
+ | **Cloud (OpenAI/Anthropic/Gemini)** | Uses external APIs for smarter reasoning. | 🧠 Best Performance |
136
+ | **Mock AI** | Uses predefined responses. No API keys needed. | 🧪 Testing / Demos |
 
137
 
138
+ To configure, set `AI_PROVIDER` in your `.env` file (see below).
 
 
 
 
139
 
140
+ ## 🔌 MCP Server Documentation
141
 
142
+ FocusFlow implements the **Model Context Protocol (MCP)**, allowing you to control it directly from Claude Desktop or other MCP clients.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
 
144
+ ### Connection Guide (Claude Desktop)
145
 
146
+ 1. **Prerequisite**: Ensure FocusFlow is running (`python app.py`).
147
+ 2. **Locate Config**:
148
+ * **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
149
+ * **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
150
+ 3. **Add Server**:
151
 
152
  ```json
153
  {
154
  "mcpServers": {
155
  "focusflow": {
156
+ "url": "http://<YOUR_LOCAL_IP>:5000/gradio_api/mcp"
 
157
  }
158
  }
159
  }
160
+ *Note: If running on WSL, you may need to use the SSE endpoint URL instead.*
161
+ *Replace `<YOUR_LOCAL_IP>` with the IP address of your local machine or WSL (e.g., `172.x.x.x`).*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
+ ### Exposed Tools
 
 
 
164
 
165
+ | Tool | Signature | Description |
166
+ | :--- | :--- | :--- |
167
+ | `add_task` | `(title: str, description: str, duration: int)` | Create a new task. |
168
+ | `get_current_task` | `()` | Get the currently active task details. |
169
+ | `start_task` | `(task_id: int)` | Mark a task as 'In Progress'. |
170
+ | `mark_task_done` | `(task_id: int)` | Complete a task. |
171
+ | `get_all_tasks` | `()` | List all tasks and statuses. |
172
+ | `get_productivity_stats` | `()` | Get focus scores and streaks. |
173
 
174
+ ### Exposed Resources
175
 
176
+ - `focusflow://tasks/all`: JSON list of all tasks.
177
+ - `focusflow://tasks/active`: JSON details of active task.
178
+ - `focusflow://stats`: Current productivity metrics.
179
 
180
+ ### API Response Format
 
 
 
 
181
 
182
+ Tools return strings that are formatted for human/LLM reading, but resources return JSON.
 
 
 
 
183
 
184
+ **Example `get_current_task` response:**
185
+ ```text
186
+ 📋 Current Active Task:
187
+ - ID: 12
188
+ - Title: Implement Auth
189
+ - Status: In Progress
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  ```
191
 
192
+ **Example `focusflow://tasks/active` resource:**
193
+ ```json
194
+ {
195
+ "id": 12,
196
+ "title": "Implement Auth",
197
+ "status": "In Progress",
198
+ "estimated_duration": "30 min"
199
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  ```
201
 
202
+ ### Error Handling
 
 
 
 
 
 
203
 
204
+ All tools return descriptive error messages starting with `❌` if something goes wrong.
 
205
 
206
+ - **Task Not Found**: `❌ Task 99 not found. Use get_all_tasks() to see available tasks.`
207
+ - **Invalid Status**: `❌ Failed to start task. Task is already marked as Done.`
208
+ - **System Error**: `❌ Error creating task: [Error Details]`
209
 
210
+ ### Example Usage (Claude)
 
211
 
212
+ > **User**: "What should I be working on?"
213
+ >
214
+ > **Claude**: (Calls `get_current_task`) "You are currently working on 'Implement Auth Middleware'. You've been focused for 15 minutes."
215
 
216
+ > **User**: "Add a task to fix the login bug."
217
+ >
218
+ > **Claude**: (Calls `add_task`) "Added 'Fix login bug' to your list."
 
 
 
219
 
220
+ ## 📋 Linear Integration
221
 
222
+ FocusFlow integrates with Linear via their **GraphQL API** to sync your projects and tasks.
223
 
224
+ ### Setup
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
 
226
+ 1. Get your **Linear API Key**: [https://linear.app/settings/api](https://linear.app/settings/api)
227
+ 2. Add it to your `.env` file: `LINEAR_API_KEY=lin_api_...`
228
 
229
+ ### How it Works
 
 
 
 
 
 
230
 
231
+ 1. **Import**: In the "Onboarding" tab, FocusFlow fetches your Linear projects using `viewer { projects }`.
232
+ 2. **Sync**: It pulls active issues using `project { issues }`.
233
+ 3. **Create**: You can create new tasks in FocusFlow, which pushes them to Linear via `issueCreate`.
 
 
 
 
 
234
 
235
+ *(Screenshots of Linear import flow would go here)*
 
 
 
 
 
 
 
236
 
237
+ ## ⚙️ Configuration
 
 
 
 
 
 
 
 
 
238
 
239
+ Copy `.env.example` to `.env` and configure your preferences:
240
 
 
241
  ```bash
242
+ # .env example
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
244
+ # --- Launch Mode ---
245
+ # 'local': Monitors file system changes (Best for personal use)
246
+ # 'demo': Text-area simulation (Best for Hugging Face Spaces)
247
+ LAUNCH_MODE=local
 
 
 
 
 
 
 
248
 
249
+ # --- AI Provider ---
250
+ # Options: openai, anthropic, gemini, vllm, mock
 
 
 
 
 
251
  AI_PROVIDER=anthropic
 
 
 
 
252
 
253
+ # --- API Keys ---
254
+ ANTHROPIC_API_KEY=sk-ant-...
255
+ OPENAI_API_KEY=sk-...
256
+ LINEAR_API_KEY=lin_api_...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
 
258
+ # --- MCP ---
259
+ ENABLE_MCP=true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
260
  ```
261
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
262
  ## 🤝 Contributing
263
 
264
+ Contributions are welcome!
265
+ 1. Fork the repo.
266
+ 2. Create a feature branch.
267
+ 3. Submit a Pull Request.
 
268
 
269
  ## 📄 License
270
 
271
+ MIT License. See [LICENSE](LICENSE) for details.
272
 
273
  ## 🙏 Acknowledgments
274
 
 
278
  - Uses [Model Context Protocol](https://modelcontextprotocol.io) for LLM integration
279
 
280
  ---
281
+ **Made with ❤️ for the Gradio MCP Hackathon.**
 
 
282
  *Hoot hoot!* 🦉