add_task_context
Add context notes to tasks to track progress, reasons, blockers, or links. Helps maintain task clarity and continuity in productivity systems.
Instructions
Add context note to task (where left off, why doing it, etc).
Args: todo_id: ID of the todo context: Context note to add context_type: Type of context (progress, why, blocker, link)
Returns: Confirmation message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| todo_id | Yes | ||
| context | Yes | ||
| context_type | No | progress |
Implementation Reference
- src/coach_ai/server.py:461-497 (handler)The implementation of the 'add_task_context' tool, which updates the task_context column in the database with a timestamped note.
async def add_task_context( todo_id: int, context: str, context_type: str = "progress", ) -> str: """Add context note to task (where left off, why doing it, etc). Args: todo_id: ID of the todo context: Context note to add context_type: Type of context (progress, why, blocker, link) Returns: Confirmation message """ db = await storage.get_db() # Get todo cursor = await db.execute("SELECT title FROM todos WHERE id = ?", (todo_id,)) row = await cursor.fetchone() if not row: return f"Error: Todo #{todo_id} not found" # Add timestamped context context_note = f"[{datetime.now().isoformat()}] [{context_type}] {context}" await db.execute( """ UPDATE todos SET task_context = COALESCE(task_context || '\\n' || ?, ?) WHERE id = ? """, (context_note, context_note, todo_id), ) await db.commit() return f"✓ Added {context_type} context to #{todo_id} '{row['title']}'"