attune-ai 2.0.2__py3-none-any.whl → 2.1.1__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.
- attune/workflows/perf_audit.py +11 -15
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/METADATA +41 -80
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/RECORD +8 -9
- attune/workflows/progressive/README 2.md +0 -454
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/WHEEL +0 -0
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/entry_points.txt +0 -0
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/licenses/LICENSE +0 -0
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md +0 -0
- {attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/top_level.txt +0 -0
attune/workflows/perf_audit.py
CHANGED
|
@@ -77,14 +77,11 @@ PERF_PATTERNS = {
|
|
|
77
77
|
"description": "Wildcard import may slow startup",
|
|
78
78
|
"impact": "low",
|
|
79
79
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
#
|
|
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:
|
|
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
|
-
|
|
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.
|
|
3
|
+
Version: 2.1.1
|
|
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,17 +421,16 @@ 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
|
-
#
|
|
424
|
+
# attune-ai
|
|
425
425
|
|
|
426
|
-
**AI-powered developer workflows with
|
|
426
|
+
**AI-powered developer workflows with Socratic discovery.**
|
|
427
427
|
|
|
428
|
-
Run code review, debugging, testing, and release workflows from
|
|
428
|
+
Run code review, debugging, testing, and release workflows from Claude Code. One command guides you to the right workflow.
|
|
429
429
|
|
|
430
430
|
[](https://pypi.org/project/attune-ai/)
|
|
431
|
-
[-brightgreen)](https://github.com/Smart-AI-Memory/attune-ai/actions)
|
|
432
432
|
[](https://www.python.org)
|
|
433
433
|
[](LICENSE)
|
|
434
|
-
[](https://github.com/Smart-AI-Memory/attune-ai/blob/main/CHANGELOG.md)
|
|
435
434
|
|
|
436
435
|
```bash
|
|
437
436
|
pip install attune-ai[developer]
|
|
@@ -439,64 +438,26 @@ pip install attune-ai[developer]
|
|
|
439
438
|
|
|
440
439
|
---
|
|
441
440
|
|
|
442
|
-
## What's New in v2.
|
|
441
|
+
## What's New in v2.1.0
|
|
443
442
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
**Package Rebrand**: `empathy-framework` is now `attune-ai`
|
|
447
|
-
|
|
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
|
-
|
|
452
|
-
**🤖 Multi-Agent Orchestration** - Build and coordinate specialized AI agents:
|
|
453
|
-
|
|
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)
|
|
458
|
-
|
|
459
|
-
**💰 Intelligent Cost Optimization**:
|
|
460
|
-
|
|
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
|
|
465
|
-
|
|
466
|
-
**⚡ Performance & Scale**:
|
|
467
|
-
|
|
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)
|
|
472
|
-
|
|
473
|
-
**🔐 Security & Quality**:
|
|
474
|
-
|
|
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
|
|
478
|
-
|
|
479
|
-
**🧭 Developer Experience**:
|
|
480
|
-
|
|
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.
|
|
485
|
-
|
|
486
|
-
**Migration from Empathy Framework**:
|
|
443
|
+
**🎯 Unified `/attune` Command** - One entry point for all workflows:
|
|
487
444
|
|
|
488
445
|
```bash
|
|
489
|
-
#
|
|
490
|
-
|
|
446
|
+
/attune # Start Socratic discovery
|
|
447
|
+
/attune "fix a bug" # Natural language
|
|
448
|
+
/attune debug # Direct shortcut
|
|
449
|
+
```
|
|
491
450
|
|
|
492
|
-
|
|
493
|
-
pip install attune-ai[developer]
|
|
451
|
+
**Socratic Discovery** - Ask what you're trying to accomplish, not which tool to use:
|
|
494
452
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
453
|
+
- 🔧 **Fix or improve** → Debug, review, refactor
|
|
454
|
+
- ✅ **Validate work** → Tests, coverage, security audit
|
|
455
|
+
- 🚀 **Ship changes** → Commit, PR, release
|
|
456
|
+
- 📚 **Understand** → Explain code, generate docs
|
|
457
|
+
|
|
458
|
+
**Performance Audit Improvements** - Removed false positive detection for intentional patterns like `dirs[:]` and defensive list copies.
|
|
498
459
|
|
|
499
|
-
[See Full Changelog](CHANGELOG.md)
|
|
460
|
+
[See Full Changelog](CHANGELOG.md)
|
|
500
461
|
|
|
501
462
|
---
|
|
502
463
|
|
|
@@ -535,7 +496,7 @@ python -m attune.models.cli provider --set anthropic
|
|
|
535
496
|
/plan "review my code"
|
|
536
497
|
|
|
537
498
|
# Direct tool access via MCP (v5.1.1+):
|
|
538
|
-
# Claude Code automatically discovers
|
|
499
|
+
# Claude Code automatically discovers Empathy tools through the MCP server
|
|
539
500
|
# Just describe what you need in natural language:
|
|
540
501
|
"Run a security audit on src/" → Invokes security_audit tool
|
|
541
502
|
"Generate tests for config.py" → Invokes test_generation tool
|
|
@@ -545,7 +506,7 @@ python -m attune.models.cli provider --set anthropic
|
|
|
545
506
|
|
|
546
507
|
**MCP Server Integration (v5.1.1+):**
|
|
547
508
|
|
|
548
|
-
|
|
509
|
+
Empathy Framework now includes a Model Context Protocol (MCP) server that exposes all workflows as native Claude Code tools:
|
|
549
510
|
|
|
550
511
|
- **10 Tools Available:** security_audit, bug_predict, code_review, test_generation, performance_audit, release_prep, auth_status, auth_recommend, telemetry_stats, dashboard_status
|
|
551
512
|
- **Automatic Discovery:** No manual configuration needed - Claude Code finds tools via `.claude/mcp.json`
|
|
@@ -567,9 +528,9 @@ See [.claude/MCP_TEST_RESULTS.md](.claude/MCP_TEST_RESULTS.md) for full integrat
|
|
|
567
528
|
**CLI:**
|
|
568
529
|
|
|
569
530
|
```bash
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
531
|
+
empathy workflow run security-audit --path ./src
|
|
532
|
+
empathy workflow run test-coverage --target 90
|
|
533
|
+
empathy telemetry show # View cost savings
|
|
573
534
|
```
|
|
574
535
|
|
|
575
536
|
**Python:**
|
|
@@ -577,8 +538,8 @@ attune telemetry show # View cost savings
|
|
|
577
538
|
```python
|
|
578
539
|
from attune import EmpathyOS
|
|
579
540
|
|
|
580
|
-
async with EmpathyOS() as
|
|
581
|
-
result = await
|
|
541
|
+
async with EmpathyOS() as empathy:
|
|
542
|
+
result = await empathy.level_2_guided(
|
|
582
543
|
"Review this code for security issues"
|
|
583
544
|
)
|
|
584
545
|
print(result["response"])
|
|
@@ -688,7 +649,7 @@ For programmatic use, smart tier routing saves 34-86%:
|
|
|
688
649
|
|
|
689
650
|
```bash
|
|
690
651
|
# Track API usage and savings
|
|
691
|
-
|
|
652
|
+
empathy telemetry savings --days 30
|
|
692
653
|
```
|
|
693
654
|
|
|
694
655
|
---
|
|
@@ -699,10 +660,10 @@ attune telemetry savings --days 30
|
|
|
699
660
|
|
|
700
661
|
```bash
|
|
701
662
|
# 4 parallel agents check release readiness
|
|
702
|
-
|
|
663
|
+
empathy orchestrate release-prep
|
|
703
664
|
|
|
704
665
|
# Sequential coverage improvement
|
|
705
|
-
|
|
666
|
+
empathy orchestrate test-coverage --target 90
|
|
706
667
|
```
|
|
707
668
|
|
|
708
669
|
### Response Caching
|
|
@@ -750,21 +711,21 @@ python -m attune.models.cli provider
|
|
|
750
711
|
python -m attune.models.cli provider --set hybrid
|
|
751
712
|
|
|
752
713
|
# Workflows
|
|
753
|
-
|
|
754
|
-
|
|
714
|
+
empathy workflow list
|
|
715
|
+
empathy workflow run <workflow-name>
|
|
755
716
|
|
|
756
717
|
# Cost tracking
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
718
|
+
empathy telemetry show
|
|
719
|
+
empathy telemetry savings --days 30
|
|
720
|
+
empathy telemetry export --format csv
|
|
760
721
|
|
|
761
722
|
# Orchestration
|
|
762
|
-
|
|
763
|
-
|
|
723
|
+
empathy orchestrate release-prep
|
|
724
|
+
empathy orchestrate test-coverage --target 90
|
|
764
725
|
|
|
765
726
|
# Meta-workflows
|
|
766
|
-
|
|
767
|
-
|
|
727
|
+
empathy meta-workflow list
|
|
728
|
+
empathy meta-workflow run release-prep --real
|
|
768
729
|
```
|
|
769
730
|
|
|
770
731
|
---
|
|
@@ -810,7 +771,7 @@ export REDIS_URL="redis://localhost:6379"
|
|
|
810
771
|
|
|
811
772
|
## VSCode Extension
|
|
812
773
|
|
|
813
|
-
Install the
|
|
774
|
+
Install the Empathy VSCode extension for:
|
|
814
775
|
|
|
815
776
|
- **Dashboard** - Health score, costs, patterns
|
|
816
777
|
- **One-Click Workflows** - Run from command palette
|
|
@@ -845,10 +806,10 @@ See [SECURITY.md](SECURITY.md) for vulnerability reporting.
|
|
|
845
806
|
|
|
846
807
|
```bash
|
|
847
808
|
# Run security audit locally
|
|
848
|
-
|
|
809
|
+
empathy workflow run security-audit
|
|
849
810
|
|
|
850
811
|
# Scan specific directory
|
|
851
|
-
|
|
812
|
+
empathy workflow run security-audit --input '{"path":"./src"}'
|
|
852
813
|
```
|
|
853
814
|
|
|
854
815
|
**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=
|
|
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.
|
|
351
|
-
attune_ai-2.
|
|
349
|
+
attune_ai-2.1.1.dist-info/licenses/LICENSE,sha256=kqe3EeGatNB79lUTHxjLnxDe7VJr0iYetThOr4_Fx7A,11348
|
|
350
|
+
attune_ai-2.1.1.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.
|
|
454
|
-
attune_ai-2.
|
|
455
|
-
attune_ai-2.
|
|
456
|
-
attune_ai-2.
|
|
457
|
-
attune_ai-2.
|
|
452
|
+
attune_ai-2.1.1.dist-info/METADATA,sha256=EI1tND_AQuj_XW98SejMJ2p0UFRnfrjDQu1KL26jK3k,38450
|
|
453
|
+
attune_ai-2.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
454
|
+
attune_ai-2.1.1.dist-info/entry_points.txt,sha256=GVlb04zFlpkaPtaL7X3JCZI8R0AEOZRsZjJ-wIDQvdo,1458
|
|
455
|
+
attune_ai-2.1.1.dist-info/top_level.txt,sha256=iLyjKpuOzWtwmIOZqzeBh8_SVztY2vFvhHcyo1WPtTY,73
|
|
456
|
+
attune_ai-2.1.1.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)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{attune_ai-2.0.2.dist-info → attune_ai-2.1.1.dist-info}/licenses/LICENSE_CHANGE_ANNOUNCEMENT.md
RENAMED
|
File without changes
|
|
File without changes
|