mlflow/claude_code/README.md
This module provides automatic tracing integration between Claude Code and MLflow.
config.py - Configuration management (settings files, environment variables)hooks.py - Claude Code hook setup and managementcli.py - MLflow CLI commands (mlflow autolog claude)tracing.py - Core tracing logic and processorshooks/ - Hook implementation handlerspip install mlflow
Set up Claude Code tracing in any project directory:
# Set up tracing in current directory
mlflow autolog claude
# Set up tracing in specific directory
mlflow autolog claude -d ~/my-project
# Set up with custom tracking URI
mlflow autolog claude -u file://./custom-mlruns
mlflow autolog claude -u sqlite:///mlflow.db
# Set up with Databricks
mlflow autolog claude -u databricks -e 123456789
# Check status
mlflow autolog claude --status
# Disable tracing
mlflow autolog claude --disable
mlflow autolog claude command configures Claude Code hooks in a .claude/settings.json fileclaude command in the configured directory, your conversations are automatically traced to MLflowmlflow server to view your conversation tracesThe setup creates two types of configuration:
MLFLOW_CLAUDE_TRACING_ENABLED=true: Enables tracingMLFLOW_TRACKING_URI: Where to store traces (defaults to local .claude/mlflow/runs)MLFLOW_EXPERIMENT_ID or MLFLOW_EXPERIMENT_NAME: Which experiment to usemlflow autolog claude
cd .
claude "help me write a function"
mlflow server --backend-store-uri sqlite:///mlflow.db
mlflow autolog claude -u databricks -e 123456789
claude "analyze this data"
# View traces in Databricks
mlflow autolog claude -d ~/my-ai-project -u sqlite:///mlflow.db -n "My AI Project"
cd ~/my-ai-project
claude "refactor this code"
mlflow server --backend-store-uri sqlite:///mlflow.db
mlflow autolog claude --status
mlflow autolog claude --disable
The configuration is stored in .claude/settings.json:
cat .claude/settings.json
pip install mlflow)