attune-ai 2.0.2__py3-none-any.whl → 2.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -77,14 +77,11 @@ PERF_PATTERNS = {
77
77
  "description": "Wildcard import may slow startup",
78
78
  "impact": "low",
79
79
  },
80
- "large_list_copy": {
81
- "patterns": [
82
- r"list\(\w+\)",
83
- r"\w+\[:\]",
84
- ],
85
- "description": "Full list copy (may be inefficient for large lists)",
86
- "impact": "low",
87
- },
80
+ # REMOVED: large_list_copy - too many false positives
81
+ # - list(x) is often intentional defensive copying or type conversion
82
+ # - dirs[:] is REQUIRED for os.walk directory filtering (see os-walk-dirs-pattern.md)
83
+ # - Low impact even when not intentional
84
+ # See: .claude/rules/attune/list-copy-guidelines.md
88
85
  "repeated_regex": {
89
86
  "patterns": [
90
87
  r're\.(search|match|findall)\s*\(["\'][^"\']+["\']',
@@ -110,10 +107,13 @@ PERF_PATTERNS = {
110
107
  # - Now correctly excludes: generator expressions inside any(), all(), etc.
111
108
  # - Sequential string building (code += "line1"; code += "line2") correctly ignored
112
109
  #
113
- # FALSE POSITIVE: large_list_copy
110
+ # REMOVED: large_list_copy (v2.1.0)
114
111
  # - list(x) or x[:] used for defensive copying or type conversion
112
+ # - dirs[:] is REQUIRED for os.walk directory filtering
115
113
  # - Often intentional to avoid mutating original data
116
- # - Verdict: OK - usually intentional, low impact
114
+ # - Verdict: REMOVED - too many false positives, low impact even when real
115
+ # - See: .claude/rules/attune/list-copy-guidelines.md
116
+ # - See: .claude/rules/attune/os-walk-dirs-pattern.md
117
117
  #
118
118
  # FALSE POSITIVE: repeated_regex (edge cases)
119
119
  # - Single-use regex in rarely-called functions
@@ -591,11 +591,7 @@ Provide detailed optimization strategies."""
591
591
  "description": "Create the list once before the loop",
592
592
  "estimated_impact": "medium",
593
593
  },
594
- "large_list_copy": {
595
- "action": "Use iterators",
596
- "description": "Consider using iterators instead of copying entire lists",
597
- "estimated_impact": "low",
598
- },
594
+ # large_list_copy removed - too many false positives
599
595
  "global_import": {
600
596
  "action": "Use specific imports",
601
597
  "description": "Import only needed names to reduce memory and startup time",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: attune-ai
3
- Version: 2.0.2
3
+ Version: 2.1.0
4
4
  Summary: AI collaboration framework with real LLM agent execution, AskUserQuestion tool integration, Socratic agent generation, progressive tier escalation (70-85% cost savings), meta-orchestration, dynamic agent composition (10 patterns including Anthropic-inspired), intelligent caching (85% hit rate), semantic workflow discovery, visual workflow editor, MCP integration for Claude Code, and multi-agent orchestration.
5
5
  Author-email: Patrick Roebuck <admin@smartaimemory.com>
6
6
  Maintainer-email: Smart-AI-Memory <admin@smartaimemory.com>
@@ -421,14 +421,14 @@ Requires-Dist: aiohttp<4.0.0,>=3.10.0; extra == "all"
421
421
  Requires-Dist: filelock<4.0.0,>=3.16.0; extra == "all"
422
422
  Dynamic: license-file
423
423
 
424
- # Attune AI
424
+ # Empathy Framework
425
425
 
426
426
  **AI-powered developer workflows with cost optimization and pattern learning.**
427
427
 
428
428
  Run code review, debugging, testing, and release workflows from your terminal or Claude Code. Smart tier routing saves 34-86% on LLM costs.
429
429
 
430
430
  [![PyPI](https://img.shields.io/pypi/v/attune-ai?color=blue)](https://pypi.org/project/attune-ai/)
431
- [![Tests](https://img.shields.io/badge/tests-13%2C489%20collected-brightgreen)](https://github.com/Smart-AI-Memory/attune-ai/actions)
431
+ [![Tests](https://img.shields.io/badge/tests-7%2C168%20passing%20(99.9%25)-brightgreen)](https://github.com/Smart-AI-Memory/attune-ai/actions)
432
432
  [![Python](https://img.shields.io/badge/python-3.10+-blue)](https://www.python.org)
433
433
  [![License](https://img.shields.io/badge/license-Apache%202.0-blue)](LICENSE)
434
434
  [![Performance](https://img.shields.io/badge/performance-18x%20faster-success)](https://github.com/Smart-AI-Memory/attune-ai/blob/main/CHANGELOG.md)
@@ -439,64 +439,188 @@ pip install attune-ai[developer]
439
439
 
440
440
  ---
441
441
 
442
- ## What's New in v2.0.0
442
+ ## 🎯 Transitioning to Claude-Native Architecture
443
443
 
444
- **🎉 Introducing Attune AI** - A fresh start with a new name and renewed focus:
444
+ **Empathy Framework is evolving to focus exclusively on Anthropic/Claude** to unlock features impossible with multi-provider abstraction:
445
445
 
446
- **Package Rebrand**: `empathy-framework` is now `attune-ai`
446
+ - **📦 Prompt Caching:** 90% cost reduction on repeated prompts
447
+ - **📖 Flexible Context:** 200K via subscription for most tasks, up to 1M via API for large codebases
448
+ - **🧠 Extended Thinking:** See Claude's internal reasoning process
449
+ - **🔧 Advanced Tool Use:** Optimized for agentic workflows
447
450
 
448
- - New package name, same powerful features
449
- - All capabilities from v5.x preserved
450
- - Starting fresh at v2.0.0 to mark the new brand
451
+ **Timeline:**
451
452
 
452
- **🤖 Multi-Agent Orchestration** - Build and coordinate specialized AI agents:
453
+ - **v4.8.0 (Jan 2026):** Deprecation warnings for OpenAI/Google/Ollama providers
454
+ - ✅ **v5.0.0 (Jan 26, 2026):** Non-Anthropic providers removed (BREAKING - COMPLETE)
455
+ - ✅ **v5.0.2 (Jan 28, 2026):** Cost optimization suite with batch processing and caching monitoring
453
456
 
454
- - **Agent Coordination Dashboard** - Real-time monitoring with 6 coordination patterns
455
- - **Custom Agents** - Create specialized agents for your workflow needs
456
- - **LLM Agents** - Leverage Claude's advanced capabilities
457
- - Dashboard at `http://localhost:8000` with `python examples/dashboard_demo.py` (requires Redis)
457
+ **Migration Guide:** [docs/CLAUDE_NATIVE.md](docs/CLAUDE_NATIVE.md)
458
458
 
459
- **💰 Intelligent Cost Optimization**:
459
+ ---
460
+
461
+ ## What's New in v5.3.0
462
+
463
+ **🎨 Dashboard Enhancements** - Improved usability and clarity:
464
+
465
+ - **Agent Display Names** - Human-readable labels for agents in dashboard (e.g., "Code Analyzer" instead of UUID)
466
+ - **Comprehensive Help Panel** - 5-section accordion explaining dashboard features, use cases, and Redis setup
467
+ - **UX Improvements** - "Source Agent:" label clarity, "Redis Requires Enabling" status message
468
+ - **Browser Cache Busting** - Date-based versioning ensures updates appear immediately
460
469
 
461
- - **Authentication Strategy** - Smart routing between Claude subscription (free) and Anthropic API
462
- - **Batch API** - 50% cost savings for non-urgent tasks
463
- - **Smart Tier Routing** - Automatic model selection saves 34-86% on costs
464
- - **Precise Token Counting** - >98% accurate cost tracking
470
+ **📚 Documentation Improvements**:
465
471
 
466
- **⚡ Performance & Scale**:
472
+ - Clarified flexible context strategy (200K subscription + 1M API routing)
473
+ - Added Redis requirement documentation for dashboard
474
+ - Root directory cleanup (8 archived files)
467
475
 
468
- - **18x Faster** - Redis caching, parallel scanning, incremental updates
469
- - **99.9% Memory Reduction** - Generator expressions across 27 optimizations
470
- - **Natural Language** - Use plain English for workflow commands
471
- - **13,489 Tests** - Comprehensive test coverage (99.9% passing)
476
+ **🧪 Test Infrastructure**:
477
+
478
+ - Sequential test execution to fix import timing issues
479
+ - All agent tracking tests passing (19/19)
480
+
481
+ [See Full Changelog](CHANGELOG.md#530---2026-01-31)
482
+
483
+ ---
472
484
 
473
- **🔐 Security & Quality**:
485
+ ## What's New in v5.1.0
474
486
 
475
- - **Automated Security Scanning** - 82% accuracy, blocks critical issues
476
- - **Path Traversal Protection** - All file operations validated
477
- - **HIPAA/GDPR Compliance** - Enterprise-ready security options
487
+ **🤖 Multi-Agent Orchestration** - Full support for custom agents and Anthropic LLM agents:
478
488
 
479
- **🧭 Developer Experience**:
489
+ - **Agent Coordination Dashboard** - Real-time monitoring with 6 coordination patterns:
490
+ - Agent heartbeats and status tracking
491
+ - Inter-agent coordination signals
492
+ - Event streaming across agent workflows
493
+ - Approval gates for human-in-the-loop
494
+ - Quality feedback and performance metrics
495
+ - Demo mode with test data generation
480
496
 
481
- - **MCP Integration** - 10 tools auto-discovered by Claude Code
482
- - **Hub-Based Commands** - Organized workflows (`/dev`, `/testing`, `/release`, etc.)
483
- - **Socratic Workflows** - Interactive discovery through guided questions
484
- - **$0 Workflows** - Run via Claude Code with no API costs, unless a 1 million API context is required.
497
+ - **Custom Agents** - Build specialized agents for your workflow needs
498
+ - **LLM Agents from Anthropic** - Leverage Claude's advanced capabilities
499
+ - Dashboard accessible at `http://localhost:8000` with `python examples/dashboard_demo.py` **(Requires Redis)**
485
500
 
486
- **Migration from Empathy Framework**:
501
+ **🔐 Authentication Strategy System** - Intelligent routing between Claude subscriptions and Anthropic API:
487
502
 
488
503
  ```bash
489
- # Old package
490
- pip uninstall empathy-framework
504
+ # Interactive setup
505
+ python -m attune.models.auth_cli setup
491
506
 
492
- # New package
493
- pip install attune-ai[developer]
507
+ # View current configuration
508
+ python -m attune.models.auth_cli status
509
+
510
+ # Get recommendation for a file
511
+ python -m attune.models.auth_cli recommend src/module.py
512
+ ```
513
+
514
+ **💰 Automatic Cost Optimization** - Workflows choose the best auth method:
515
+
516
+ - Small/medium modules (<2000 LOC) → Claude subscription (free)
517
+ - Large modules (>2000 LOC) → Anthropic API (pay for what you need)
518
+ - 7 workflows integrated: document-gen, test-gen, code-review, bug-predict, security-audit, perf-audit, release-prep
519
+ - Auth mode tracking in all workflow outputs for telemetry
520
+
521
+ **🧪 Comprehensive Testing** - 7 new integration tests for auth strategy:
522
+
523
+ - All workflows tested with auth enabled/disabled
524
+ - API and subscription mode verification
525
+ - Cost tracking validation
526
+
527
+ **📖 Documentation** - 950+ lines across 3 guides:
528
+
529
+ - [AUTH_STRATEGY_GUIDE.md](docs/AUTH_STRATEGY_GUIDE.md) - User guide for configuration
530
+ - [AUTH_CLI_IMPLEMENTATION.md](docs/AUTH_CLI_IMPLEMENTATION.md) - CLI command reference
531
+ - [AUTH_WORKFLOW_INTEGRATIONS.md](docs/AUTH_WORKFLOW_INTEGRATIONS.md) - Integration patterns
532
+
533
+ [See Full Changelog](CHANGELOG.md#510---2026-01-29)
534
+
535
+ ---
536
+
537
+ ## What's New in v5.0.2
538
+
539
+ **💰 50% Cost Savings with Batch API** - Process non-urgent tasks asynchronously:
540
+
541
+ ```bash
542
+ empathy batch submit batch_requests.json # Submit batch job
543
+ empathy batch status msgbatch_abc123 # Check progress
544
+ empathy batch results msgbatch_abc123 output.json # Download results
545
+ ```
546
+
547
+ Perfect for: log analysis, report generation, bulk classification, test generation
548
+
549
+ **📊 Precise Token Counting** - >98% accurate cost tracking:
550
+
551
+ - Integrated Anthropic's `count_tokens()` API for billing-accurate measurements
552
+ - 3-tier fallback: API → tiktoken (local) → heuristic
553
+ - Cache-aware cost calculation (25% write markup, 90% read discount)
554
+
555
+ **📈 Cache Performance Monitoring** - Track your 20-30% caching savings:
556
+
557
+ ```bash
558
+ empathy cache stats # Show hit rates and cost savings
559
+ empathy cache stats --verbose # Detailed token metrics
560
+ empathy cache stats --format json # Machine-readable output
561
+ ```
562
+
563
+ **🧭 Adaptive Routing Analytics** - Intelligent tier recommendations:
564
+
565
+ ```bash
566
+ empathy routing stats <workflow> # Performance metrics
567
+ empathy routing check --all # Tier upgrade recommendations
568
+ empathy routing models --provider anthropic # Compare models
569
+ ```
570
+
571
+ **🔧 Dashboard Fixes** - All 6 agent coordination patterns now operational:
572
+ - Agent heartbeats displaying correctly
573
+ - Event streaming functional
574
+ - Coordination signals working
575
+ - Approval gates operational
576
+
577
+ [See Full Changelog](CHANGELOG.md#502---2026-01-28) | [Batch API Guide](docs/BATCH_API_GUIDE.md) | [User API Docs](docs/USER_API_DOCUMENTATION.md)
494
578
 
495
- # Update imports in your code
496
- # from empathy_os → from attune
579
+ ---
580
+
581
+ ## What's New in v4.9.0
582
+
583
+ **⚡ 18x Faster Performance** - Massive performance gains through Phase 2 optimizations:
584
+
585
+ - **Redis Two-Tier Caching:** 2x faster memory operations (37,000x for cached keys)
586
+ - **Generator Expressions:** 99.9% memory reduction across 27 optimizations
587
+ - **Parallel Scanning:** Multi-core processing enabled by default (2-4x faster)
588
+ - **Incremental Scanning:** Git diff-based updates (10x faster)
589
+
590
+ **🧭 Natural Language Workflows** - Use plain English instead of workflow names:
591
+
592
+ ```bash
593
+ /workflows "find security vulnerabilities" # → security-audit
594
+ /workflows "check code performance" # → perf-audit
595
+ /workflows "predict bugs" # → bug-predict
596
+ /plan "review my code" # → code-review
497
597
  ```
498
598
 
499
- [See Full Changelog](CHANGELOG.md) | [Migration Guide](docs/MIGRATION_GUIDE.md)
599
+ **📊 Real-World Performance:**
600
+
601
+ - Combined workflow: 3.59s → 0.2s (**18x faster**)
602
+ - Full scan: 3,472 files in 0.98s (was 3.59s)
603
+ - Redis cached operations: 37ms → 0.001ms
604
+
605
+ **🎯 Improved Navigation:**
606
+
607
+ - Split `/workflow` into `/workflows` (automated analysis) and `/plan` (planning/review)
608
+ - Clearer hub organization with better categorization
609
+ - Natural language routing matches intent to workflow
610
+
611
+ [See CHANGELOG.md](CHANGELOG.md) | [Performance Docs](docs/REDIS_OPTIMIZATION_SUMMARY.md)
612
+
613
+ ---
614
+
615
+ ## What's New in v4.7.0
616
+
617
+ **$0 Workflows via Skills** - Multi-agent workflows run through Claude Code's Task tool instead of API calls. No additional cost with your Claude subscription.
618
+
619
+ **Socratic Workflows** - Interactive discovery through guided questions. Workflows ask what you need rather than requiring upfront configuration.
620
+
621
+ **Security Hardened** - Fixed critical vulnerabilities (path traversal, JWT, SSRF).
622
+
623
+ **Hub-Based Commands** - Organized workflows into intuitive command hubs.
500
624
 
501
625
  ---
502
626
 
@@ -535,7 +659,7 @@ python -m attune.models.cli provider --set anthropic
535
659
  /plan "review my code"
536
660
 
537
661
  # Direct tool access via MCP (v5.1.1+):
538
- # Claude Code automatically discovers Attune AI tools through the MCP server
662
+ # Claude Code automatically discovers Empathy tools through the MCP server
539
663
  # Just describe what you need in natural language:
540
664
  "Run a security audit on src/" → Invokes security_audit tool
541
665
  "Generate tests for config.py" → Invokes test_generation tool
@@ -545,7 +669,7 @@ python -m attune.models.cli provider --set anthropic
545
669
 
546
670
  **MCP Server Integration (v5.1.1+):**
547
671
 
548
- Attune AI now includes a Model Context Protocol (MCP) server that exposes all workflows as native Claude Code tools:
672
+ Empathy Framework now includes a Model Context Protocol (MCP) server that exposes all workflows as native Claude Code tools:
549
673
 
550
674
  - **10 Tools Available:** security_audit, bug_predict, code_review, test_generation, performance_audit, release_prep, auth_status, auth_recommend, telemetry_stats, dashboard_status
551
675
  - **Automatic Discovery:** No manual configuration needed - Claude Code finds tools via `.claude/mcp.json`
@@ -567,9 +691,9 @@ See [.claude/MCP_TEST_RESULTS.md](.claude/MCP_TEST_RESULTS.md) for full integrat
567
691
  **CLI:**
568
692
 
569
693
  ```bash
570
- attune workflow run security-audit --path ./src
571
- attune workflow run test-coverage --target 90
572
- attune telemetry show # View cost savings
694
+ empathy workflow run security-audit --path ./src
695
+ empathy workflow run test-coverage --target 90
696
+ empathy telemetry show # View cost savings
573
697
  ```
574
698
 
575
699
  **Python:**
@@ -577,8 +701,8 @@ attune telemetry show # View cost savings
577
701
  ```python
578
702
  from attune import EmpathyOS
579
703
 
580
- async with EmpathyOS() as attune:
581
- result = await attune.level_2_guided(
704
+ async with EmpathyOS() as empathy:
705
+ result = await empathy.level_2_guided(
582
706
  "Review this code for security issues"
583
707
  )
584
708
  print(result["response"])
@@ -688,7 +812,7 @@ For programmatic use, smart tier routing saves 34-86%:
688
812
 
689
813
  ```bash
690
814
  # Track API usage and savings
691
- attune telemetry savings --days 30
815
+ empathy telemetry savings --days 30
692
816
  ```
693
817
 
694
818
  ---
@@ -699,10 +823,10 @@ attune telemetry savings --days 30
699
823
 
700
824
  ```bash
701
825
  # 4 parallel agents check release readiness
702
- attune orchestrate release-prep
826
+ empathy orchestrate release-prep
703
827
 
704
828
  # Sequential coverage improvement
705
- attune orchestrate test-coverage --target 90
829
+ empathy orchestrate test-coverage --target 90
706
830
  ```
707
831
 
708
832
  ### Response Caching
@@ -750,21 +874,21 @@ python -m attune.models.cli provider
750
874
  python -m attune.models.cli provider --set hybrid
751
875
 
752
876
  # Workflows
753
- attune workflow list
754
- attune workflow run <workflow-name>
877
+ empathy workflow list
878
+ empathy workflow run <workflow-name>
755
879
 
756
880
  # Cost tracking
757
- attune telemetry show
758
- attune telemetry savings --days 30
759
- attune telemetry export --format csv
881
+ empathy telemetry show
882
+ empathy telemetry savings --days 30
883
+ empathy telemetry export --format csv
760
884
 
761
885
  # Orchestration
762
- attune orchestrate release-prep
763
- attune orchestrate test-coverage --target 90
886
+ empathy orchestrate release-prep
887
+ empathy orchestrate test-coverage --target 90
764
888
 
765
889
  # Meta-workflows
766
- attune meta-workflow list
767
- attune meta-workflow run release-prep --real
890
+ empathy meta-workflow list
891
+ empathy meta-workflow run release-prep --real
768
892
  ```
769
893
 
770
894
  ---
@@ -810,7 +934,7 @@ export REDIS_URL="redis://localhost:6379"
810
934
 
811
935
  ## VSCode Extension
812
936
 
813
- Install the Attune AI VSCode extension for:
937
+ Install the Empathy VSCode extension for:
814
938
 
815
939
  - **Dashboard** - Health score, costs, patterns
816
940
  - **One-Click Workflows** - Run from command palette
@@ -845,10 +969,10 @@ See [SECURITY.md](SECURITY.md) for vulnerability reporting.
845
969
 
846
970
  ```bash
847
971
  # Run security audit locally
848
- attune workflow run security-audit
972
+ empathy workflow run security-audit
849
973
 
850
974
  # Scan specific directory
851
- attune workflow run security-audit --input '{"path":"./src"}'
975
+ empathy workflow run security-audit --input '{"path":"./src"}'
852
976
  ```
853
977
 
854
978
  **Documentation:**
@@ -291,7 +291,7 @@ attune/workflows/new_sample_workflow1_README.md,sha256=1pd--DASCiZlqMmcaq-FI_zIa
291
291
  attune/workflows/orchestrated_health_check.py,sha256=d4R8iOvw4kQ_EfRdvNYDNrjjR6hzPow55fWSuLHkhPs,30486
292
292
  attune/workflows/orchestrated_release_prep.py,sha256=Erp2rw-EBNOfIwyT0nJhGqpYPg2v-YL_h06aMtaALlA,20224
293
293
  attune/workflows/output.py,sha256=BJHDdaYB7ptemZy8KHbuLkSmrEAiFCArjOfvQfRMnCU,12829
294
- attune/workflows/perf_audit.py,sha256=KVSPJBgZJGlrTQtLQ71enUBHp7yr_Trgnf9yGlNZPQE,32064
294
+ attune/workflows/perf_audit.py,sha256=Xjom8vg4W9vQ4DKQTVTnhNzsccOD0RyIcAN2YwPocdI,32203
295
295
  attune/workflows/pr_review.py,sha256=lR7TxvGjBj1fIMxYgBtgxuSvWFTGqQHTsVpL5zKLUB8,26796
296
296
  attune/workflows/progress.py,sha256=z_0UV2uH4Xu9fG85VYtcqJwJWQhTfa7WvFqrtIe-ISE,26588
297
297
  attune/workflows/progress_server.py,sha256=3UmIW8j-Hxayod4kV9BoWPvJO8lNX38YVCq6UDEnYlQ,10229
@@ -330,7 +330,6 @@ attune/workflows/keyboard_shortcuts/parsers.py,sha256=aws4HSjqBOrl-DQEOV9WeJX6dy
330
330
  attune/workflows/keyboard_shortcuts/prompts.py,sha256=gcV2F2bAMjZUrbB13lOI4ixXzXm2TNWEZ4VbPhC7ITw,9164
331
331
  attune/workflows/keyboard_shortcuts/schema.py,sha256=MwvM63J9WTO6nqtwes5A04HH1dTa9XhJlD0SbFhsS5E,5806
332
332
  attune/workflows/keyboard_shortcuts/workflow.py,sha256=EGEyZ3azXnmyu24ycTDgHDulwXPU7FaIWn2GDpixsG0,17674
333
- attune/workflows/progressive/README 2.md,sha256=zZNzVWK56hQdzFNePArefG0n_mL3v_LEGv3jfltVrmQ,13745
334
333
  attune/workflows/progressive/README.md,sha256=zZNzVWK56hQdzFNePArefG0n_mL3v_LEGv3jfltVrmQ,13745
335
334
  attune/workflows/progressive/__init__.py,sha256=e1lacdjDlc58evGbrpWK83Nl7_-PW1zwsiaYbdxaPug,2155
336
335
  attune/workflows/progressive/cli.py,sha256=2XAEqh9O8_8iT69cykx6OhnZ-YbnLIXrU1ySil3Wt5g,6113
@@ -347,8 +346,8 @@ attune/workflows/test_gen/data_models.py,sha256=wXfef60ptiG6AvygayTxWqlL5FVOss19
347
346
  attune/workflows/test_gen/report_formatter.py,sha256=RaxbDp6-9iQRfJmVwrrIReVkOkrnb668NgHrNaS-SPY,10705
348
347
  attune/workflows/test_gen/test_templates.py,sha256=4ywqGYYaSoZxOU6Y1_E-27KEgMI5-v2a1ndia406E9c,13180
349
348
  attune/workflows/test_gen/workflow.py,sha256=U0dhAcCKmlltPIvCSXUeFzt_Q4TodQI4tXtR6cz19MQ,25729
350
- attune_ai-2.0.2.dist-info/licenses/LICENSE,sha256=kqe3EeGatNB79lUTHxjLnxDe7VJr0iYetThOr4_Fx7A,11348
351
- attune_ai-2.0.2.dist-info/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md,sha256=JH9yAQGv_lQej5YlztI_kawbVQ2H8uVLhPGlrWnR_34,3844
349
+ attune_ai-2.1.0.dist-info/licenses/LICENSE,sha256=kqe3EeGatNB79lUTHxjLnxDe7VJr0iYetThOr4_Fx7A,11348
350
+ attune_ai-2.1.0.dist-info/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md,sha256=JH9yAQGv_lQej5YlztI_kawbVQ2H8uVLhPGlrWnR_34,3844
352
351
  attune_healthcare/__init__.py,sha256=4NioL1_86UXzkd-QNkQZUSZ8rKTQGSP0TC9VXP32kQs,295
353
352
  attune_healthcare/monitors/__init__.py,sha256=Udp8qfZR504QAq5_eQjvtIaE7v06Yguc7nuF40KllQc,196
354
353
  attune_healthcare/monitors/clinical_protocol_monitor.py,sha256=MWE5t8tW9HWZn_SNo-inx8-0nhdTNGhbcB8ZeDWyXa0,11648
@@ -450,8 +449,8 @@ workflow_scaffolding/__init__.py,sha256=UpX5vjjjPjIaAKyIV1D4GxJzLUZy5DzdzgSkePYM
450
449
  workflow_scaffolding/__main__.py,sha256=0qspuNoadTDqyskXTlT8Sahqau-XIxN35NHTSGVW6z4,236
451
450
  workflow_scaffolding/cli.py,sha256=RUVqU9SeAgm7YkM0YNd-quh8u6BNzmX8xM2y9K_p68Y,6759
452
451
  workflow_scaffolding/generator.py,sha256=2WC02A10lzF2NQgOn66ksV17Oe72kKlU2qCQs39LIlw,8861
453
- attune_ai-2.0.2.dist-info/METADATA,sha256=kAyR6yCwivlRaPgLaKV_Uv6kiSIEwuJM5MJz44qtIyY,40096
454
- attune_ai-2.0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
455
- attune_ai-2.0.2.dist-info/entry_points.txt,sha256=GVlb04zFlpkaPtaL7X3JCZI8R0AEOZRsZjJ-wIDQvdo,1458
456
- attune_ai-2.0.2.dist-info/top_level.txt,sha256=iLyjKpuOzWtwmIOZqzeBh8_SVztY2vFvhHcyo1WPtTY,73
457
- attune_ai-2.0.2.dist-info/RECORD,,
452
+ attune_ai-2.1.0.dist-info/METADATA,sha256=86GO_8mUvQMAl6W1vd4BKqnN8jzx2zJcgj8aNkr5BCM,45033
453
+ attune_ai-2.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
454
+ attune_ai-2.1.0.dist-info/entry_points.txt,sha256=GVlb04zFlpkaPtaL7X3JCZI8R0AEOZRsZjJ-wIDQvdo,1458
455
+ attune_ai-2.1.0.dist-info/top_level.txt,sha256=iLyjKpuOzWtwmIOZqzeBh8_SVztY2vFvhHcyo1WPtTY,73
456
+ attune_ai-2.1.0.dist-info/RECORD,,
@@ -1,454 +0,0 @@
1
- # Progressive Tier Escalation System
2
-
3
- **Version:** 4.1.0
4
- **Status:** Production Ready
5
- **Test Coverage:** 86.58% (123 tests)
6
-
7
- ## Overview
8
-
9
- The Progressive Tier Escalation System is an intelligent cost optimization framework that automatically routes tasks through multiple AI model tiers (cheap → capable → premium) based on quality metrics, providing 70-85% cost savings compared to using premium models for all tasks.
10
-
11
- ## Key Features
12
-
13
- - ✅ **Multi-tier execution**: Automatic progression from cheap to premium models
14
- - ✅ **Composite Quality Score (CQS)**: Multi-signal failure detection
15
- - ✅ **Smart escalation**: Only failed items escalate, successful ones stay at current tier
16
- - ✅ **Cost management**: Budget controls with approval prompts
17
- - ✅ **Privacy-preserving telemetry**: Local tracking with hashed user IDs
18
- - ✅ **Comprehensive analytics**: Historical cost savings analysis
19
- - ✅ **CLI tools**: Manage and analyze workflow results
20
-
21
- ## Quick Start
22
-
23
- ```python
24
- from attune.workflows.progressive import (
25
- ProgressiveTestGenWorkflow,
26
- EscalationConfig,
27
- Tier
28
- )
29
-
30
- # Configure escalation
31
- config = EscalationConfig(
32
- enabled=True,
33
- tiers=[Tier.CHEAP, Tier.CAPABLE, Tier.PREMIUM],
34
- max_cost=10.00,
35
- auto_approve_under=1.00,
36
- abort_on_budget_exceeded=True
37
- )
38
-
39
- # Create workflow
40
- workflow = ProgressiveTestGenWorkflow(config)
41
-
42
- # Execute with automatic tier progression
43
- result = workflow.execute(target_file="src/myapp/calculator.py")
44
-
45
- # View results
46
- print(result.generate_report())
47
- print(f"Cost: ${result.total_cost:.2f}")
48
- print(f"Savings: ${result.cost_savings:.2f} ({result.cost_savings_percent:.0f}%)")
49
-
50
- # Save results for analytics
51
- result.save_to_disk()
52
- ```
53
-
54
- ## Architecture
55
-
56
- ### Tier Progression
57
-
58
- ```
59
- ┌─────────────────────────────────────────────────────────────┐
60
- │ PROGRESSIVE ESCALATION │
61
- └─────────────────────────────────────────────────────────────┘
62
-
63
-
64
- ┌─────────────────┐
65
- │ CHEAP TIER │
66
- │ (gpt-4o-mini) │
67
- │ $0.003/item │
68
- │ 1 agent │
69
- └────────┬────────┘
70
-
71
- CQS < 75? ───No──> SUCCESS
72
-
73
- Yes
74
-
75
-
76
- ┌─────────────────┐
77
- │ CAPABLE TIER │
78
- │ (claude-3-5-s) │
79
- │ $0.015/item │
80
- │ 2 agents │
81
- └────────┬────────┘
82
-
83
- CQS < 85? ───No──> SUCCESS
84
-
85
- Yes
86
-
87
-
88
- ┌─────────────────┐
89
- │ PREMIUM TIER │
90
- │ (claude-opus-4) │
91
- │ $0.05/item │
92
- │ 3 agents │
93
- └────────┬────────┘
94
-
95
-
96
- FINAL RESULT
97
- ```
98
-
99
- ### Composite Quality Score (CQS)
100
-
101
- Quality is measured using a weighted multi-signal metric:
102
-
103
- ```
104
- CQS = (0.40 × test_pass_rate +
105
- 0.25 × code_coverage +
106
- 0.20 × assertion_quality +
107
- 0.15 × llm_confidence) × syntax_penalty
108
- ```
109
-
110
- **Thresholds:**
111
- - **CHEAP tier**: CQS ≥ 75 (pass), < 75 (escalate)
112
- - **CAPABLE tier**: CQS ≥ 85 (pass), < 85 (escalate)
113
- - **PREMIUM tier**: CQS ≥ 90 (target), no escalation
114
-
115
- **Syntax Penalty:** 50% reduction if syntax errors detected
116
-
117
- ## Core Components
118
-
119
- ### 1. EscalationConfig
120
-
121
- Configuration for tier escalation behavior:
122
-
123
- ```python
124
- config = EscalationConfig(
125
- enabled=True, # Enable progressive escalation
126
- tiers=[Tier.CHEAP, Tier.CAPABLE, Tier.PREMIUM],
127
- cheap_min_attempts=2, # Try cheap tier 2× before escalating
128
- capable_min_attempts=1, # Try capable tier 1× before escalating
129
- max_cost=10.00, # Abort if cost exceeds $10
130
- auto_approve_under=1.00, # Auto-approve costs < $1
131
- abort_on_budget_exceeded=True, # Abort vs warn on budget exceeded
132
- warn_on_budget_exceeded=False,
133
- stagnation_threshold=0.05, # 5% improvement threshold
134
- stagnation_window=2, # Over 2 consecutive runs
135
- )
136
- ```
137
-
138
- ### 2. Meta-Orchestration
139
-
140
- Dynamic agent team creation based on tier:
141
-
142
- | Tier | Agents | Strategy |
143
- |----------|--------|---------------------------------------|
144
- | CHEAP | 1 | Single agent, fast iteration |
145
- | CAPABLE | 2 | Planner + executor, collaborative |
146
- | PREMIUM | 3 | Architect + executor + reviewer, deep |
147
-
148
- ### 3. Telemetry
149
-
150
- Privacy-preserving usage tracking:
151
-
152
- ```python
153
- from attune.workflows.progressive import ProgressiveTelemetry
154
-
155
- # Initialize telemetry
156
- telemetry = ProgressiveTelemetry(
157
- workflow_name="test-gen",
158
- user_id="user@example.com" # SHA256 hashed for privacy
159
- )
160
-
161
- # Track tier execution
162
- telemetry.track_tier_execution(tier_result, attempt=1, escalated=False)
163
-
164
- # Track escalation
165
- telemetry.track_escalation(
166
- from_tier=Tier.CHEAP,
167
- to_tier=Tier.CAPABLE,
168
- reason="Low CQS (65)",
169
- item_count=10,
170
- current_cost=0.30
171
- )
172
-
173
- # Track workflow completion
174
- telemetry.track_workflow_completion(result)
175
- ```
176
-
177
- **Data Stored:**
178
- - Workflow name, tier, model, cost, tokens
179
- - Quality metrics (CQS, test pass rate, coverage)
180
- - Escalation reasons and patterns
181
- - Timestamps and durations
182
-
183
- **Privacy:**
184
- - User IDs are SHA256 hashed
185
- - No prompts, responses, or PII stored
186
- - Local-only storage (~/.empathy/telemetry/)
187
-
188
- ### 4. CLI Tools
189
-
190
- Manage and analyze saved results:
191
-
192
- ```bash
193
- # List all workflow results
194
- empathy progressive list
195
-
196
- # Show detailed report for specific run
197
- empathy progressive show test-gen-20260117-120000
198
-
199
- # Show JSON output
200
- empathy progressive show test-gen-20260117-120000 --json
201
-
202
- # Generate cost analytics
203
- empathy progressive analytics
204
-
205
- # Cleanup old results (30 day retention)
206
- empathy progressive cleanup --retention-days 30
207
-
208
- # Dry run cleanup (preview)
209
- empathy progressive cleanup --retention-days 30 --dry-run
210
-
211
- # Custom storage path
212
- empathy progressive list --storage-path ./my-results
213
- ```
214
-
215
- ## Usage Examples
216
-
217
- ### Example 1: Test Generation with Escalation
218
-
219
- ```python
220
- from attune.workflows.progressive import ProgressiveTestGenWorkflow
221
-
222
- workflow = ProgressiveTestGenWorkflow()
223
- result = workflow.execute(target_file="src/auth.py")
224
-
225
- # View tier progression
226
- for tier_result in result.tier_results:
227
- print(f"{tier_result.tier.value}: CQS={tier_result.failure_analysis.calculate_quality_score():.1f}")
228
- if tier_result.escalated:
229
- print(f" → Escalated: {tier_result.escalation_reason}")
230
-
231
- # Output:
232
- # cheap: CQS=68.5
233
- # → Escalated: Low CQS (68.5)
234
- # capable: CQS=92.0
235
- ```
236
-
237
- ### Example 2: Cost Analysis
238
-
239
- ```python
240
- from attune.workflows.progressive.reports import generate_cost_analytics
241
-
242
- analytics = generate_cost_analytics()
243
-
244
- print(f"Total runs: {analytics['total_runs']}")
245
- print(f"Total cost: ${analytics['total_cost']:.2f}")
246
- print(f"Total savings: ${analytics['total_savings']:.2f}")
247
- print(f"Avg savings: {analytics['avg_savings_percent']:.1f}%")
248
- print(f"Escalation rate: {analytics['escalation_rate']:.1%}")
249
- print(f"Success rate: {analytics['success_rate']:.1%}")
250
-
251
- # Per-workflow breakdown
252
- for workflow, stats in analytics['workflow_stats'].items():
253
- print(f"\n{workflow}:")
254
- print(f" Runs: {stats['runs']}")
255
- print(f" Avg cost: ${stats['avg_cost']:.2f}")
256
- print(f" Success rate: {stats['success_rate']:.1%}")
257
- ```
258
-
259
- ### Example 3: Custom Escalation Logic
260
-
261
- ```python
262
- from attune.workflows.progressive import ProgressiveWorkflow, Tier
263
-
264
- class CustomWorkflow(ProgressiveWorkflow):
265
- def _should_escalate_custom(self, tier_result):
266
- """Custom escalation logic."""
267
- # Example: Escalate if any syntax errors
268
- if tier_result.failure_analysis.syntax_errors:
269
- return True, "Syntax errors detected"
270
-
271
- # Example: Escalate if test pass rate < 90%
272
- if tier_result.failure_analysis.test_pass_rate < 0.90:
273
- return True, f"Low test pass rate ({tier_result.failure_analysis.test_pass_rate:.1%})"
274
-
275
- return False, None
276
-
277
- def _execute_tier_impl(self, tier, items, context):
278
- """Implement tier execution logic."""
279
- # Your custom implementation
280
- pass
281
-
282
- workflow = CustomWorkflow()
283
- result = workflow.execute(items=my_items)
284
- ```
285
-
286
- ## Performance Characteristics
287
-
288
- ### Cost Savings
289
-
290
- Based on production usage:
291
-
292
- | Scenario | Cheap % | Capable % | Premium % | Savings |
293
- |-----------------------|---------|-----------|-----------|---------|
294
- | Simple tasks | 80% | 15% | 5% | 85% |
295
- | Medium complexity | 60% | 30% | 10% | 72% |
296
- | High complexity | 40% | 40% | 20% | 60% |
297
- | **Average** | **60%** | **28%** | **12%** | **72%** |
298
-
299
- ### Execution Time
300
-
301
- Progressive execution adds minimal latency:
302
-
303
- - **Cheap tier**: ~5-10s per item (baseline)
304
- - **Capable tier**: ~10-20s per item (+5-10s overhead)
305
- - **Premium tier**: ~20-40s per item (+10-20s overhead)
306
-
307
- **Parallel escalation**: Failed items escalate in parallel, reducing total time.
308
-
309
- ## Troubleshooting
310
-
311
- ### Issue: Excessive Escalation
312
-
313
- **Symptoms:** Most items escalate to premium tier
314
-
315
- **Causes:**
316
- - CQS thresholds too strict
317
- - Input items too complex for cheap/capable tiers
318
- - Stagnation detection too sensitive
319
-
320
- **Solutions:**
321
- ```python
322
- # Lower CQS thresholds
323
- config = EscalationConfig(
324
- cheap_cqs_threshold=70, # Down from 75
325
- capable_cqs_threshold=80 # Down from 85
326
- )
327
-
328
- # Increase stagnation threshold
329
- config = EscalationConfig(
330
- stagnation_threshold=0.10, # 10% improvement required
331
- stagnation_window=3 # Over 3 runs
332
- )
333
-
334
- # Increase min attempts
335
- config = EscalationConfig(
336
- cheap_min_attempts=3, # Try 3× before escalating
337
- capable_min_attempts=2
338
- )
339
- ```
340
-
341
- ### Issue: Budget Exceeded Errors
342
-
343
- **Symptoms:** `BudgetExceededError` raised frequently
344
-
345
- **Solutions:**
346
- ```python
347
- # Increase budget
348
- config = EscalationConfig(max_cost=20.00)
349
-
350
- # Warn instead of abort
351
- config = EscalationConfig(
352
- abort_on_budget_exceeded=False,
353
- warn_on_budget_exceeded=True
354
- )
355
-
356
- # Increase auto-approve threshold
357
- config = EscalationConfig(auto_approve_under=5.00)
358
- ```
359
-
360
- ### Issue: Poor Quality Results
361
-
362
- **Symptoms:** Final CQS < 85
363
-
364
- **Causes:**
365
- - Insufficient premium tier attempts
366
- - Input quality issues
367
- - Test assertion depth too low
368
-
369
- **Solutions:**
370
- ```python
371
- # Force premium tier for critical tasks
372
- config = EscalationConfig(
373
- tiers=[Tier.PREMIUM], # Skip cheap/capable
374
- enabled=False # Disable escalation
375
- )
376
-
377
- # Increase premium min attempts
378
- config = EscalationConfig(
379
- premium_min_attempts=2
380
- )
381
- ```
382
-
383
- ## API Reference
384
-
385
- ### Core Classes
386
-
387
- - `Tier`: Enum defining tier levels (CHEAP, CAPABLE, PREMIUM)
388
- - `EscalationConfig`: Configuration for tier escalation
389
- - `FailureAnalysis`: Quality metrics and failure signals
390
- - `TierResult`: Results from a single tier execution
391
- - `ProgressiveWorkflowResult`: Complete multi-tier execution results
392
-
393
- ### Base Classes
394
-
395
- - `ProgressiveWorkflow`: Abstract base for progressive workflows
396
- - `MetaOrchestrator`: Tier escalation decision logic
397
-
398
- ### Workflows
399
-
400
- - `ProgressiveTestGenWorkflow`: Test generation with progressive escalation
401
-
402
- ### Utilities
403
-
404
- - `ProgressiveTelemetry`: Usage tracking and analytics
405
- - `generate_cost_analytics()`: Analyze historical cost savings
406
- - `cleanup_old_results()`: Retention policy enforcement
407
-
408
- ## Testing
409
-
410
- Run progressive workflow tests:
411
-
412
- ```bash
413
- # All progressive tests
414
- pytest tests/unit/workflows/progressive/ -v
415
-
416
- # Specific test modules
417
- pytest tests/unit/workflows/progressive/test_core.py -v
418
- pytest tests/unit/workflows/progressive/test_orchestrator.py -v
419
- pytest tests/unit/workflows/progressive/test_cost_telemetry.py -v
420
- pytest tests/unit/workflows/progressive/test_reports_analytics.py -v
421
- pytest tests/unit/workflows/progressive/test_test_gen.py -v
422
-
423
- # With coverage
424
- pytest tests/unit/workflows/progressive/ --cov=src/attune/workflows/progressive --cov-report=term-missing
425
- ```
426
-
427
- **Test Coverage:** 86.58% (123 tests)
428
-
429
- ## Contributing
430
-
431
- When adding new progressive workflows:
432
-
433
- 1. **Inherit from `ProgressiveWorkflow`**
434
- 2. **Implement `_execute_tier_impl()`** for tier-specific execution logic
435
- 3. **Define quality metrics** in `_analyze_quality()`
436
- 4. **Add comprehensive tests** (aim for 85%+ coverage)
437
- 5. **Document usage** with examples
438
-
439
- See `ProgressiveTestGenWorkflow` for a complete implementation example.
440
-
441
- ## License
442
-
443
- Fair Source License 0.9
444
-
445
- ## Version History
446
-
447
- - **4.1.0** (2026-01-17): Initial release with test generation workflow
448
- - **4.1.0-alpha**: Development version
449
-
450
- ## Support
451
-
452
- - **Documentation**: [Empathy Framework Docs](https://attune-ai.readthedocs.io)
453
- - **Issues**: [GitHub Issues](https://github.com/Smart-AI-Memory/attune-ai/issues)
454
- - **Discussions**: [GitHub Discussions](https://github.com/Smart-AI-Memory/attune-ai/discussions)