Successfully integrated ToolCallTracker into all 10 ADW phases to enable comprehensive tool usage monitoring and analytics.
-
✅ Plan (
adw_plan_iso.py) - Already integrated (Session 22) -
✅ Validate (
adw_validate_iso.py) - NEW- Tracked calls:
baseline_build_check,git_rev_parse
- Tracked calls:
-
✅ Build (
adw_build_iso.py) - NEW- Tracked calls:
git_checkout_branch,external_build_check
- Tracked calls:
-
✅ Lint (
adw_lint_iso.py) - NEW- Tracked calls:
external_lint_check,git_status
- Tracked calls:
-
✅ Test (
adw_test_iso.py) - Already integrated (Session 22) -
✅ Review (
adw_review_iso.py) - NEW- Tracked calls:
git_diff_changed_files,tail_backend_logs
- Tracked calls:
-
✅ Document (
adw_document_iso.py) - NEW- Tracked calls:
git_diff_stat,git_diff_name_only,git_diff_numstat
- Tracked calls:
-
✅ Ship (
adw_ship_iso.py) - Already integrated (Session 22) -
✅ Cleanup (
adw_cleanup_iso.py) - NEW- Tracked calls:
git_worktree_remove
- Tracked calls:
-
✅ Verify (
adw_verify_iso.py) - NEW- Tracked calls:
backend_health_check,frontend_accessibility_check,create_followup_issue
- Tracked calls:
Across all 10 phases, we now track ~15+ distinct tool/command types:
- Git operations:
git_rev_parse,git_checkout_branch,git_diff,git_worktree_remove, etc. - Build/test tools:
external_build_check,external_lint_check,pytest,npm_build - System tools:
curl,tail, GitHub CLI (gh) - Validation tools:
baseline_build_check,health_check
All phases follow this consistent pattern:
# 1. Import at top
from adw_modules.tool_call_tracker import ToolCallTracker
# 2. Functions accept optional tracker parameter
def some_function(adw_id: str, logger, tracker=None):
if tracker:
result = tracker.track_bash("tool_name", cmd, cwd=path)
else:
result = subprocess.run(cmd, cwd=path, capture_output=True, text=True)
# 3. Main execution wrapped in context manager
def main():
# After idempotency check...
with ToolCallTracker(adw_id=adw_id, issue_number=int(issue_number), phase_name="PhaseName") as tracker:
# All phase execution logic here
some_function(adw_id, logger, tracker=tracker)
# Tracker automatically logs to observability on exitEach tracked tool call captures:
- Tool name (e.g., "git_diff", "npm_build")
- Start/end timestamps (ISO 8601 format)
- Duration in milliseconds
- Success/failure status
- Error messages (if any)
- Command parameters
- Result summary (for subprocess.CompletedProcess)
All tool calls are automatically logged to the backend observability system via:
log_task_completion()inadw_modules/observability.py- Tool calls stored in
tool_callsJSONB column inwork_logtable - Zero-overhead guarantee: logging failures don't block workflow execution
With tool tracking now in all 10 phases, we can build analytics dashboards showing:
-
Tool Usage Patterns:
- Most frequently used tools across workflows
- Tool usage by phase (Plan heavy on git, Test heavy on pytest, etc.)
-
Performance Metrics:
- Tool execution duration trends
- Slowest tools/commands
- Performance regression detection
-
Reliability Metrics:
- Tool failure rates
- Most error-prone commands
- Error correlation analysis
-
Cost Attribution:
- Time spent in external tools vs AI agent work
- Tool overhead per workflow
- Optimization opportunities
/Users/Warmonger0/tac/tac-webbuilder/adws/adw_validate_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_build_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_lint_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_review_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_document_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_cleanup_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_verify_iso.py/Users/Warmonger0/tac/tac-webbuilder/adws/adw_modules/worktree_ops.py(cleanup integration)
All 7 modified phase files pass Python syntax validation:
python3 -m py_compile adw_*.py # All ✅ PASSStatus: READY TO COMPLETE
- GitHub Issue: #236
- Plans Panel ID: 128
- Implementation: 100% complete (10/10 phases)
- Testing: Pending (need to run ADW workflow with tracking)
- Documentation: Complete (this file)
- Issue #236: Tool Call Tracking and Analytics (original)
- Issue #262: Expand Tool Call Tracking to All ADW Phases
- Issue #264: Expand Tool Call Tracking + Analytics Dashboard (possible duplicate)
Recommendation: Close #262 and #264 as duplicates of #236, mark #236 as complete after testing.