Files
claude-task-master/tasks/task_043.txt
Eyal Toledano 245c3cb398 feat(telemetry): Implement AI usage telemetry pattern and apply to add-task
This commit introduces a standardized pattern for capturing and propagating AI usage telemetry (cost, tokens, model used) across the Task Master stack and applies it to the 'add-task' functionality.

Key changes include:

- **Telemetry Pattern Definition:**
  - Added  defining the integration pattern for core logic, direct functions, MCP tools, and CLI commands.
  - Updated related rules (, ,
 Usage: mcp [OPTIONS] COMMAND [ARGS]...

 MCP development tools

╭─ Options ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ version   Show the MCP version.                                                                                                            │
│ dev       Run a MCP server with the MCP Inspector.                                                                                         │
│ run       Run a MCP server.                                                                                                                │
│ install   Install a MCP server in the Claude desktop app.                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯, , ) to reference the new telemetry rule.

- **Core Telemetry Implementation ():**
  - Refactored the unified AI service to generate and return a  object alongside the main AI result.
  - Fixed an MCP server startup crash by removing redundant local loading of  and instead using the  imported from  for cost calculations.
  - Added  to the  object.

- ** Integration:**
  - Modified  (core) to receive  from the AI service, return it, and call the new UI display function for CLI output.
  - Updated  to receive  from the core function and include it in the  payload of its response.
  - Ensured  (MCP tool) correctly passes the  through via .
  - Updated  to correctly pass context (, ) to the core  function and rely on it for CLI telemetry display.

- **UI Enhancement:**
  - Added  function to  to show telemetry details in the CLI.

- **Project Management:**
  - Added subtasks 77.6 through 77.12 to track the rollout of this telemetry pattern to other AI-powered commands (, , , , , , ).

This establishes the foundation for tracking AI usage across the application.
2025-05-07 13:41:25 -04:00

47 lines
2.5 KiB
Plaintext

# Task ID: 43
# Title: Add Research Flag to Add-Task Command
# Status: done
# Dependencies: None
# Priority: medium
# Description: Implement a '--research' flag for the add-task command that enables users to automatically generate research-related subtasks when creating a new task.
# Details:
Modify the add-task command to accept a new optional flag '--research'. When this flag is provided, the system should automatically generate and attach a set of research-oriented subtasks to the newly created task. These subtasks should follow a standard research methodology structure:
1. Background Investigation: Research existing solutions and approaches
2. Requirements Analysis: Define specific requirements and constraints
3. Technology/Tool Evaluation: Compare potential technologies or tools for implementation
4. Proof of Concept: Create a minimal implementation to validate approach
5. Documentation: Document findings and recommendations
The implementation should:
- Update the command-line argument parser to recognize the new flag
- Create a dedicated function to generate the research subtasks with appropriate descriptions
- Ensure subtasks are properly linked to the parent task
- Update help documentation to explain the new flag
- Maintain backward compatibility with existing add-task functionality
The research subtasks should be customized based on the main task's title and description when possible, rather than using generic templates.
# Test Strategy:
Testing should verify both the functionality and usability of the new feature:
1. Unit tests:
- Test that the '--research' flag is properly parsed
- Verify the correct number and structure of subtasks are generated
- Ensure subtask IDs are correctly assigned and linked to the parent task
2. Integration tests:
- Create a task with the research flag and verify all subtasks appear in the task list
- Test that the research flag works with other existing flags (e.g., --priority, --depends-on)
- Verify the task and subtasks are properly saved to the storage backend
3. Manual testing:
- Run 'taskmaster add-task "Test task" --research' and verify the output
- Check that the help documentation correctly describes the new flag
- Verify the research subtasks have meaningful descriptions
- Test the command with and without the flag to ensure backward compatibility
4. Edge cases:
- Test with very short or very long task descriptions
- Verify behavior when maximum task/subtask limits are reached