sync_from_daily_note
Extract tasks from your daily note and sync them into Coach AI's system to refresh task management and maintain current productivity tracking.
Instructions
Read today's (or specified) daily note and sync tasks.
Extracts tasks from your daily note and ensures they're in the system. Call this to refresh Coach AI's view of your daily note.
Args: date_str: Optional date in YYYY-MM-DD format (defaults to today)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date_str | No |
Implementation Reference
- src/coach_ai/server.py:699-709 (handler)Tool registration for sync_from_daily_note in server.py
async def sync_from_daily_note(date_str: str = None) -> str: """Read today's (or specified) daily note and sync tasks. Extracts tasks from your daily note and ensures they're in the system. Call this to refresh Coach AI's view of your daily note. Args: date_str: Optional date in YYYY-MM-DD format (defaults to today) """ return await daily_notes.sync_from_daily_note(date_str) - src/coach_ai/daily_notes.py:313-374 (handler)Core logic implementation for sync_from_daily_note in daily_notes.py
async def sync_from_daily_note(date_str: str = None) -> str: """Read today's (or specified) daily note and sync tasks. Args: date_str: Optional date in YYYY-MM-DD format (defaults to today) Returns: Summary of tasks and accomplishments """ vault = get_vault() if not vault: return "❌ Obsidian vault not configured. Set OBSIDIAN_VAULT_PATH environment variable." # Parse date if date_str: try: date = datetime.strptime(date_str, "%Y-%M-%d") except ValueError: return f"❌ Invalid date format. Use YYYY-MM-DD, got: {date_str}" else: date = datetime.now() # Read note note_data = vault.read_daily_note(date) if not note_data: return f"ℹ️ No daily note found for {date.strftime('%Y-%m-%d')}. Want me to create one?" # Extract data tasks = note_data["tasks"] accomplishments = note_data["accomplishments"] # Build response result = f"📖 Read daily note: {note_data['path']}\n\n" if tasks: active_tasks = [t for t in tasks if not t["completed"]] completed_tasks = [t for t in tasks if t["completed"]] result += f"**Active Tasks:** {len(active_tasks)}\n" for task in active_tasks[:5]: # Show first 5 priority_emoji = ( "🔴" if task["priority"] == "high" else "🟡" if task["priority"] == "medium" else "🔵" ) result += f"{priority_emoji} {task['text']}\n" if len(active_tasks) > 5: result += f"... and {len(active_tasks) - 5} more\n" result += f"\n**Completed Today:** {len(completed_tasks)}\n" else: result += "No tasks found in daily note.\n" if accomplishments: result += f"\n**Accomplishments:** {len(accomplishments)}\n" for acc in accomplishments[:3]: result += f"✅ {acc}\n" return result