Skip to main content

Advanced productivity tracking and context optimization for AI-assisted development

Project description

Context Cleaner

PyPI version Python Support License: MIT

Advanced productivity tracking and context optimization for AI-assisted development

Context Cleaner is a comprehensive productivity tracking tool designed specifically for developers using AI coding assistants like Claude Code. It provides intelligent context health monitoring, performance analytics, and optimization recommendations to maximize development productivity.

๐ŸŽฏ Key Features

๐Ÿ“Š Productivity Tracking

  • Development session monitoring with automatic boundary detection
  • Context health scoring (0-100 scale) based on size, structure, and complexity
  • Performance correlation analysis between context optimization and productivity
  • Git integration for commit pattern analysis and productivity metrics

๐Ÿ” Advanced Analytics

  • Trend analysis across days, weeks, and months
  • Pattern recognition for optimal work schedules and session lengths
  • A/B testing framework for different context optimization strategies
  • Productivity forecasting based on historical data and patterns

๐Ÿ“ˆ Interactive Dashboard

  • Web-based visualization of productivity trends and session analytics
  • Real-time metrics with automatic refresh and live updates
  • Actionable insights with specific optimization recommendations
  • Mobile-responsive design for monitoring on any device

๐Ÿ›ก๏ธ Privacy-First Architecture

  • Local-only processing - all data stays on your machine
  • No external requests - zero network dependencies
  • Complete data ownership with easy export and deletion
  • Transparent operation with open-source codebase

๐Ÿ”ง Developer-Friendly CLI

  • Simple installation via pip with zero configuration required
  • Flexible commands for all productivity tracking and analysis needs
  • Multiple output formats (JSON, YAML, text) for integration
  • Comprehensive help and troubleshooting built-in

๐Ÿš€ Quick Start

Installation

# Install from PyPI
pip install context-cleaner

# Or install from source
git clone https://github.com/context-cleaner/context-cleaner.git
cd context-cleaner
pip install -e .

Basic Usage

# Start productivity tracking
context-cleaner start

# Launch interactive dashboard
context-cleaner dashboard

# Analyze recent productivity
context-cleaner analyze --days 7

# Export your data
context-cleaner export --output my-data.json

Dashboard Access

After running context-cleaner dashboard, visit http://localhost:8548 to access your productivity insights through an intuitive web interface.

๐Ÿ“Š Usage Examples

Development Workflow Integration

# Start tracking at beginning of work session
context-cleaner start

# View real-time productivity dashboard
context-cleaner dashboard --port 8080

# Get daily productivity summary
context-cleaner analyze --days 1 --format text

# Weekly productivity report in JSON
context-cleaner analyze --days 7 --format json --output weekly-report.json

Productivity Analysis

# Comprehensive 30-day analysis
context-cleaner analyze --days 30

# Example output:
# ๐Ÿ“Š PRODUCTIVITY ANALYSIS REPORT
# ================================
# ๐Ÿ“… Analysis Period: Last 30 days
# ๐ŸŽฏ Average Productivity Score: 87.3/100
# ๐Ÿ“ˆ Total Sessions: 156
# โšก Optimization Events: 45
# ๐ŸŒŸ Most Productive Day: Tuesday
# 
# ๐Ÿ’ก RECOMMENDATIONS:
#    1. Your productivity peaks at 3-4 PM - schedule complex tasks then
#    2. Context optimization events correlate with 18% productivity increase
#    3. Consider shorter sessions (< 90 minutes) for sustained performance

Data Management

# Export all data for backup
context-cleaner export --format json --output backup-$(date +%Y%m%d).json

# Show privacy information
context-cleaner privacy show-info

# Delete all collected data
context-cleaner privacy delete-all

๐Ÿ“ˆ Dashboard Features

Productivity Metrics Overview

  • Current productivity score with 7-day trend
  • Session statistics including count, duration, and quality
  • Optimization events tracking context improvements
  • Health trend indicators showing improvement/decline patterns

Advanced Visualizations

  • Time-series charts showing productivity trends over time
  • Heatmaps indicating peak performance hours and days
  • Session type analysis (debugging, coding, exploration, optimization)
  • Correlation charts between context health and productivity

Actionable Insights

  • Personalized recommendations based on individual productivity patterns
  • Optimal scheduling suggestions for different types of development tasks
  • Context optimization timing recommendations for maximum impact
  • Performance alerts when productivity patterns change significantly

๐Ÿ”ง Configuration

Default Configuration

Context Cleaner works out-of-the-box with sensible defaults, but can be customized via configuration files.

Configuration File (Optional)

Create ~/.context_cleaner/config.yaml:

dashboard:
  port: 8548
  host: localhost
  auto_refresh: true
  cache_duration: 300

tracking:
  enabled: true
  sampling_rate: 1.0
  session_timeout_minutes: 30
  data_retention_days: 90

privacy:
  local_only: true
  encrypt_storage: true
  require_consent: true

analysis:
  health_thresholds:
    excellent: 90
    good: 70
    fair: 50
  max_context_size: 100000

Environment Variables

export CONTEXT_CLEANER_PORT=8080
export CONTEXT_CLEANER_DATA_DIR=~/my-productivity-data
export CONTEXT_CLEANER_LOG_LEVEL=DEBUG

๐Ÿงช Advanced Features

Custom Analytics

from context_cleaner import ProductivityAnalyzer, ContextCleanerConfig

# Initialize with custom configuration
config = ContextCleanerConfig.default()
analyzer = ProductivityAnalyzer(config)

# Analyze context health
result = await analyzer.analyze_context_health(context_data)
print(f"Health Score: {result.health_score}/100")

# Analyze productivity session
metrics = analyzer.analyze_productivity_session(session_data)
print(f"Productivity Score: {metrics.productivity_score}/100")

Integration with Development Tools

# Git hook integration (post-commit)
#!/bin/bash
context-cleaner analyze --days 1 --format json | jq '.avg_productivity_score'

# CI/CD integration
context-cleaner analyze --days 7 --format json > productivity-report.json

Custom Dashboard Themes

The dashboard supports custom CSS themes and can be extended with additional charts and metrics.

๐Ÿ”’ Privacy & Security

Data Protection

  • Local Storage: All data is stored locally in ~/.context_cleaner/data/
  • No Telemetry: Zero external network requests or data transmission
  • Encryption: Optional at-rest encryption for sensitive productivity data
  • Data Retention: Configurable automatic cleanup after specified period

Privacy Controls

  • Granular Tracking: Choose exactly what metrics to collect
  • Easy Deletion: One-command complete data removal
  • Data Export: Full data portability in standard formats
  • Transparent Operation: Open-source code for complete auditability

Security Features

  • Input Validation: Comprehensive sanitization of all data
  • Resource Limits: Built-in protection against resource exhaustion
  • Safe Defaults: Conservative configuration prioritizing privacy
  • Error Isolation: System continues working even with component failures

๐Ÿ—๏ธ Architecture

Core Components

Context Cleaner Architecture
โ”œโ”€โ”€ ๐Ÿ“Š Analytics Engine
โ”‚   โ”œโ”€โ”€ ProductivityAnalyzer - Core analysis algorithms
โ”‚   โ”œโ”€โ”€ TrendCalculator - Time-series analysis  
โ”‚   โ””โ”€โ”€ ImpactEvaluator - Optimization effectiveness
โ”œโ”€โ”€ ๐Ÿ“ˆ Dashboard System
โ”‚   โ”œโ”€โ”€ Web Server - FastAPI-based interface
โ”‚   โ”œโ”€โ”€ Data Visualization - Interactive charts
โ”‚   โ””โ”€โ”€ Real-time Updates - Live metric streaming
โ”œโ”€โ”€ ๐Ÿ—ƒ๏ธ Data Management
โ”‚   โ”œโ”€โ”€ Session Tracking - Development session boundaries
โ”‚   โ”œโ”€โ”€ Storage System - Local SQLite database
โ”‚   โ””โ”€โ”€ Privacy Controls - Data export/deletion
โ””โ”€โ”€ ๐Ÿ”ง CLI Interface
    โ”œโ”€โ”€ Command Processing - Argument parsing and validation
    โ”œโ”€โ”€ Output Formatting - Text/JSON/YAML formats
    โ””โ”€โ”€ Configuration - Settings and preferences

Data Flow

  1. Data Collection - Monitor development sessions and context changes
  2. Analysis Processing - Calculate health scores and productivity metrics
  3. Pattern Recognition - Identify trends and optimization opportunities
  4. Insight Generation - Create actionable recommendations
  5. Visualization - Present insights through dashboard or CLI

๐Ÿ“š API Reference

Command Line Interface

context-cleaner [OPTIONS] COMMAND [ARGS]...

Commands:
  start              Start productivity tracking
  dashboard          Launch web dashboard
  analyze            Analyze productivity trends  
  export             Export all data
  privacy            Privacy and data management
  config-show        Show current configuration

Python API

from context_cleaner import ContextCleanerConfig, ProductivityAnalyzer

# Configuration
config = ContextCleanerConfig.from_file('config.yaml')
config = ContextCleanerConfig.from_env()  # Environment variables
config = ContextCleanerConfig.default()   # Sensible defaults

# Analytics
analyzer = ProductivityAnalyzer(config)
result = await analyzer.analyze_context_health(data)
metrics = analyzer.analyze_productivity_session(session_data)

# Dashboard
from context_cleaner import ProductivityDashboard
dashboard = ProductivityDashboard(config)
dashboard.start_server(host="localhost", port=8548)

๐Ÿงช Development

Development Setup

# Clone repository
git clone https://github.com/context-cleaner/context-cleaner.git
cd context-cleaner

# Install development dependencies
pip install -e .[dev]

# Run tests
pytest

# Code formatting
black src/
flake8 src/

# Type checking
mypy src/

Testing

# Run all tests
pytest

# Run specific test categories  
pytest -m unit      # Unit tests only
pytest -m integration  # Integration tests only

# Coverage report
pytest --cov=context_cleaner --cov-report=html

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/awesome-feature
  3. Make changes and add tests
  4. Run test suite: pytest
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿค Support

Documentation

Community

Commercial Support

For enterprise support, custom integrations, and consulting services, please contact us at team@context-cleaner.dev.

๐ŸŽฏ Roadmap

Version 0.2.0 (Next Release)

  • Advanced ML Analytics: Machine learning-powered productivity insights
  • Team Features: Aggregated (anonymized) team productivity metrics
  • IDE Integration: Direct integration with popular development environments
  • Extended Git Integration: Branch-based productivity tracking

Version 0.3.0 (Future)

  • Cross-Project Analytics: Multi-repository productivity tracking
  • Advanced Forecasting: Predictive productivity modeling
  • Custom Metrics: User-defined productivity indicators
  • API Integration: Webhooks and external service integration

Long-term Vision

  • AI-Powered Coaching: Personalized productivity improvement recommendations
  • Collaboration Analytics: Pair programming and code review productivity
  • Performance Benchmarking: Industry-wide anonymous productivity comparisons
  • Ecosystem Integration: Seamless integration with development tool ecosystems

Context Cleaner - Transforming AI-assisted development through intelligent productivity tracking and optimization.

Built with โค๏ธ for developers who want to understand and improve their coding productivity.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

context_cleaner-0.1.0-py3-none-any.whl (199.6 kB view details)

Uploaded Python 3

File details

Details for the file context_cleaner-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for context_cleaner-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de98f5a01efc5a519bf55d43f593b71cab7d0326b77d53d5d2f45b388ff88174
MD5 f99f1273b1ffec1a3a50f3a4659b3fab
BLAKE2b-256 be70646ed4fdd2c7e7ce9ccc51e5592b8cf46eb3897e9fd4850e0f2d7e0f924e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page