Skip to content

Commit eee2440

Browse files
ChrisEdwardsclaude
andcommitted
Add time tracking workflow for AI cost optimization (AIML-231)
Added comprehensive "Time Tracking for AI Cost Optimization" section to CLAUDE.md documenting the complete workflow for tracking time spent on beads to optimize AI development spend. Key features: - Comment-based time tracking with ⏱️ START/END markers - Label-based categorization for duration buckets and AI effectiveness - Parent vs child bead tracking strategies - Rating workflow with AI calculation and user confirmation - Analysis framework for identifying AI value patterns Workflow tracks: - Duration buckets: 0-15min, 15-30min, 30-60min, 1-2hr, 2hr+ - AI effectiveness: ai-multiplier, ai-helpful, ai-neutral, ai-friction - When to track: Parent beads (in_progress → PR), Child beads (start → close) Purpose: Identify which code change types benefit most from AI assistance and where AI adds friction vs value to optimize AI spend decisions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ed271c5 commit eee2440

File tree

1 file changed

+108
-5
lines changed

1 file changed

+108
-5
lines changed

CLAUDE.md

Lines changed: 108 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,95 @@ Example: If B must be done after A completes, use `bd dep add B A` (not `bd dep
131131

132132
Verify with `bd show <task-id>` - dependent tasks show "Depends on", prerequisites show "Blocks".
133133

134+
### Time Tracking for AI Cost Optimization
135+
136+
This project tracks development time and AI effectiveness to optimize AI spend on code changes. Time tracking uses comments for precise timestamps and labels for categorization.
137+
138+
**Time Tracking Rules:**
139+
140+
**Parent Beads (Jira-linked, generate PR):**
141+
- **START:** When parent bead is set to `in_progress` (when coding work begins)
142+
- **END:** When PR is created (after all children complete and branch is ready for review)
143+
- **Duration:** Captures full end-to-end timeline from first work to PR creation
144+
- **Rating:** Asked once when PR is created
145+
146+
**Child Beads (use parent's branch, no PR):**
147+
- **START:** When child bead is set to `in_progress` (when work on that subtask begins)
148+
- **END:** When child bead is closed (when that specific subtask completes)
149+
- **Duration:** Captures time spent on that specific child
150+
- **Rating:** Asked when each child is closed
151+
152+
**Comment Format:**
153+
```bash
154+
# Starting work
155+
bd comments add <bead-id> "⏱️ START: 2025-11-13T14:00:00Z - Implementing authentication refactor"
156+
157+
# Ending work
158+
bd comments add <bead-id> "⏱️ END: 2025-11-13T16:30:00Z - Refactor complete, tests passing"
159+
```
160+
161+
**Duration Labels:**
162+
- `duration-0to15min` - Under 15 minutes
163+
- `duration-15to30min` - 15-30 minutes
164+
- `duration-30to60min` - 30-60 minutes
165+
- `duration-60to120min` - 1-2 hours
166+
- `duration-over120min` - Over 2 hours (indicates task should have been broken down)
167+
168+
**AI Effectiveness Labels:**
169+
- `ai-multiplier` - AI was a force multiplier (saved significant time/effort)
170+
- `ai-helpful` - AI was helpful (saved some time)
171+
- `ai-neutral` - AI was neutral (could have done manually in similar time)
172+
- `ai-friction` - AI added friction (slowed me down, had to correct/redirect)
173+
174+
**Completing Time Tracking:**
175+
176+
When ending work on a bead, follow this process to complete time tracking:
177+
178+
1. **Record END timestamp:**
179+
```bash
180+
bd comments add <bead-id> "⏱️ END: $(date -u +%Y-%m-%dT%H:%M:%SZ) - [Brief description of what was completed]"
181+
```
182+
183+
2. **Calculate duration estimate** from START/END timestamps in comments
184+
- Parse all START/END timestamps from the bead's comments
185+
- Calculate total elapsed time
186+
- Present estimate to user in human-readable format
187+
188+
3. **Ask user to confirm duration** using AskUserQuestion tool:
189+
- Show calculated estimate: "Based on timestamps, you worked approximately X minutes/hours"
190+
- Prompt: "Please confirm your active coding time (excluding breaks/interruptions):"
191+
- Options:
192+
1. Under 15 minutes
193+
2. 15-30 minutes
194+
3. 30-60 minutes
195+
4. 1-2 hours
196+
5. Over 2 hours
197+
198+
4. **Ask user about AI effectiveness** using AskUserQuestion tool:
199+
- Prompt: "How effective was AI assistance on this task?"
200+
- Options:
201+
1. Force multiplier - AI saved significant time/effort
202+
2. Helpful - AI saved some time
203+
3. Neutral - Could have done manually in similar time
204+
4. Added friction - AI slowed me down
205+
206+
5. **Apply labels** based on user responses:
207+
- Duration label: `duration-0to15min`, `duration-15to30min`, `duration-30to60min`, `duration-60to120min`, or `duration-over120min`
208+
- Effectiveness label: `ai-multiplier`, `ai-helpful`, `ai-neutral`, or `ai-friction`
209+
210+
**When to complete time tracking:**
211+
- **Parent beads:** When PR is created (after all children complete)
212+
- **Child beads:** When bead is closed (when that specific subtask completes)
213+
- **Note:** Child beads are rated individually when closed; parent bead is rated once when PR is created
214+
215+
**Data Analysis:**
216+
217+
Time tracking enables analysis of:
218+
- Which types of code changes benefit most from AI
219+
- Where AI adds friction vs value
220+
- Task breakdown patterns (tasks >2hr indicate insufficient decomposition)
221+
- Actual vs estimated coding time
222+
134223
## Project Management
135224

136225
### Jira Issue Tracking
@@ -201,6 +290,10 @@ Promoting Stacked PR (after base PR merges):
201290

202291
**2. Update bead status and labels:**
203292
- Set bead status to `in_progress`
293+
- **Record START timestamp for time tracking:**
294+
```bash
295+
bd comments add <bead-id> "⏱️ START: $(date -u +%Y-%m-%dT%H:%M:%SZ) - [Brief description of what you're starting]"
296+
```
204297
- Record the branch name in the bead (so it's easily found later)
205298
- **If this is a stacked branch** (based on another PR branch):
206299
- Label the bead with `stacked-branch`
@@ -311,12 +404,16 @@ This workflow creates a standard PR ready for immediate review, targeting the `m
311404
**2. Push to remote:**
312405
- Push the feature branch to remote repository
313406
314-
**3. Create or update Pull Request:**
407+
**3. Complete time tracking:**
408+
- Follow the **"Completing Time Tracking"** process in the Time Tracking section
409+
- This is for parent beads only (child beads were already rated when closed)
410+
411+
**4. Create or update Pull Request:**
315412
- If PR doesn't exist, create it with base branch `main`
316413
- If PR exists, update the description
317414
- PR should be ready for review (NOT draft)
318415

319-
**4. Generate comprehensive PR description:**
416+
**5. Generate comprehensive PR description:**
320417
- Follow the **"Creating High-Quality PR Descriptions"** section above
321418
- Use the standard structure: Why / What / How / Walkthrough / Testing
322419
- No special warnings or dependency context needed
@@ -339,7 +436,11 @@ This workflow creates a draft PR that depends on another unmerged PR (stacked br
339436
**3. Push to remote:**
340437
- Push the feature branch: `git push -u origin <branch-name>`
341438

342-
**4. Create DRAFT Pull Request:**
439+
**4. Complete time tracking:**
440+
- Follow the **"Completing Time Tracking"** process in the Time Tracking section
441+
- This is for parent beads only (child beads were already rated when closed)
442+
443+
**5. Create DRAFT Pull Request:**
343444
- **Base branch**: Set to the parent PR's branch (NOT main)
344445
- **Status**: MUST be draft
345446
- **Title**: Include `[STACKED]` indicator
@@ -362,7 +463,7 @@ This workflow creates a draft PR that depends on another unmerged PR (stacked br
362463
- After the warning and dependency context, follow the **"Creating High-Quality PR Descriptions"** section
363464
- Use the standard structure: Why / What / How / Walkthrough / Testing
364465
365-
**5. Verify configuration:**
466+
**6. Verify configuration:**
366467
- Confirm PR is in draft status
367468
- Confirm base branch is the parent PR's branch
368469
- Confirm warning and dependency context are prominently displayed
@@ -561,4 +662,6 @@ This workflow is for ending the current session while preserving all state so wo
561662
562663
**Cannot close parent beads** if they still have open children. Ensure all child beads are closed first.
563664
564-
Beads typically remain `in_progress` (with `in-review` label) until the PR review is complete and merged. Only close beads when explicitly instructed by the user.
665+
**For child beads:** When closing a child bead, complete time tracking using the **"Completing Time Tracking"** process in the Time Tracking section. This captures the time spent on that specific subtask.
666+
667+
**For parent beads:** Time tracking is completed when the PR is created, not when the bead is closed. Beads typically remain `in_progress` (with `in-review` label) until the PR review is complete and merged. Only close beads when explicitly instructed by the user.

0 commit comments

Comments
 (0)