empathy-framework 4.6.6__py3-none-any.whl → 4.7.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.
- empathy_framework-4.7.1.dist-info/METADATA +690 -0
- empathy_framework-4.7.1.dist-info/RECORD +379 -0
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/top_level.txt +1 -2
- empathy_healthcare_plugin/monitors/monitoring/__init__.py +9 -9
- empathy_llm_toolkit/agent_factory/__init__.py +6 -6
- empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +7 -10
- empathy_llm_toolkit/agents_md/__init__.py +22 -0
- empathy_llm_toolkit/agents_md/loader.py +218 -0
- empathy_llm_toolkit/agents_md/parser.py +271 -0
- empathy_llm_toolkit/agents_md/registry.py +307 -0
- empathy_llm_toolkit/commands/__init__.py +51 -0
- empathy_llm_toolkit/commands/context.py +375 -0
- empathy_llm_toolkit/commands/loader.py +301 -0
- empathy_llm_toolkit/commands/models.py +231 -0
- empathy_llm_toolkit/commands/parser.py +371 -0
- empathy_llm_toolkit/commands/registry.py +429 -0
- empathy_llm_toolkit/config/__init__.py +8 -8
- empathy_llm_toolkit/config/unified.py +3 -7
- empathy_llm_toolkit/context/__init__.py +22 -0
- empathy_llm_toolkit/context/compaction.py +455 -0
- empathy_llm_toolkit/context/manager.py +434 -0
- empathy_llm_toolkit/hooks/__init__.py +24 -0
- empathy_llm_toolkit/hooks/config.py +306 -0
- empathy_llm_toolkit/hooks/executor.py +289 -0
- empathy_llm_toolkit/hooks/registry.py +302 -0
- empathy_llm_toolkit/hooks/scripts/__init__.py +39 -0
- empathy_llm_toolkit/hooks/scripts/evaluate_session.py +201 -0
- empathy_llm_toolkit/hooks/scripts/first_time_init.py +285 -0
- empathy_llm_toolkit/hooks/scripts/pre_compact.py +207 -0
- empathy_llm_toolkit/hooks/scripts/session_end.py +183 -0
- empathy_llm_toolkit/hooks/scripts/session_start.py +163 -0
- empathy_llm_toolkit/hooks/scripts/suggest_compact.py +225 -0
- empathy_llm_toolkit/learning/__init__.py +30 -0
- empathy_llm_toolkit/learning/evaluator.py +438 -0
- empathy_llm_toolkit/learning/extractor.py +514 -0
- empathy_llm_toolkit/learning/storage.py +560 -0
- empathy_llm_toolkit/providers.py +4 -11
- empathy_llm_toolkit/security/__init__.py +17 -17
- empathy_llm_toolkit/utils/tokens.py +2 -5
- empathy_os/__init__.py +202 -70
- empathy_os/cache_monitor.py +5 -3
- empathy_os/cli/__init__.py +11 -55
- empathy_os/cli/__main__.py +29 -15
- empathy_os/cli/commands/inspection.py +21 -12
- empathy_os/cli/commands/memory.py +4 -12
- empathy_os/cli/commands/profiling.py +198 -0
- empathy_os/cli/commands/utilities.py +27 -7
- empathy_os/cli.py +28 -57
- empathy_os/cli_unified.py +525 -1164
- empathy_os/cost_tracker.py +9 -3
- empathy_os/dashboard/server.py +200 -2
- empathy_os/hot_reload/__init__.py +7 -7
- empathy_os/hot_reload/config.py +6 -7
- empathy_os/hot_reload/integration.py +35 -35
- empathy_os/hot_reload/reloader.py +57 -57
- empathy_os/hot_reload/watcher.py +28 -28
- empathy_os/hot_reload/websocket.py +2 -2
- empathy_os/memory/__init__.py +11 -4
- empathy_os/memory/claude_memory.py +1 -1
- empathy_os/memory/cross_session.py +8 -12
- empathy_os/memory/edges.py +6 -6
- empathy_os/memory/file_session.py +770 -0
- empathy_os/memory/graph.py +30 -30
- empathy_os/memory/nodes.py +6 -6
- empathy_os/memory/short_term.py +15 -9
- empathy_os/memory/unified.py +606 -140
- empathy_os/meta_workflows/agent_creator.py +3 -9
- empathy_os/meta_workflows/cli_meta_workflows.py +113 -53
- empathy_os/meta_workflows/form_engine.py +6 -18
- empathy_os/meta_workflows/intent_detector.py +64 -24
- empathy_os/meta_workflows/models.py +3 -1
- empathy_os/meta_workflows/pattern_learner.py +13 -31
- empathy_os/meta_workflows/plan_generator.py +55 -47
- empathy_os/meta_workflows/session_context.py +2 -3
- empathy_os/meta_workflows/workflow.py +20 -51
- empathy_os/models/cli.py +2 -2
- empathy_os/models/tasks.py +1 -2
- empathy_os/models/telemetry.py +4 -1
- empathy_os/models/token_estimator.py +3 -1
- empathy_os/monitoring/alerts.py +938 -9
- empathy_os/monitoring/alerts_cli.py +346 -183
- empathy_os/orchestration/execution_strategies.py +12 -29
- empathy_os/orchestration/pattern_learner.py +20 -26
- empathy_os/orchestration/real_tools.py +6 -15
- empathy_os/platform_utils.py +2 -1
- empathy_os/plugins/__init__.py +2 -2
- empathy_os/plugins/base.py +64 -64
- empathy_os/plugins/registry.py +32 -32
- empathy_os/project_index/index.py +49 -15
- empathy_os/project_index/models.py +1 -2
- empathy_os/project_index/reports.py +1 -1
- empathy_os/project_index/scanner.py +1 -0
- empathy_os/redis_memory.py +10 -7
- empathy_os/resilience/__init__.py +1 -1
- empathy_os/resilience/health.py +10 -10
- empathy_os/routing/__init__.py +7 -7
- empathy_os/routing/chain_executor.py +37 -37
- empathy_os/routing/classifier.py +36 -36
- empathy_os/routing/smart_router.py +40 -40
- empathy_os/routing/{wizard_registry.py → workflow_registry.py} +47 -47
- empathy_os/scaffolding/__init__.py +8 -8
- empathy_os/scaffolding/__main__.py +1 -1
- empathy_os/scaffolding/cli.py +28 -28
- empathy_os/socratic/__init__.py +3 -19
- empathy_os/socratic/ab_testing.py +25 -36
- empathy_os/socratic/blueprint.py +38 -38
- empathy_os/socratic/cli.py +34 -20
- empathy_os/socratic/collaboration.py +30 -28
- empathy_os/socratic/domain_templates.py +9 -1
- empathy_os/socratic/embeddings.py +17 -13
- empathy_os/socratic/engine.py +135 -70
- empathy_os/socratic/explainer.py +70 -60
- empathy_os/socratic/feedback.py +24 -19
- empathy_os/socratic/forms.py +15 -10
- empathy_os/socratic/generator.py +51 -35
- empathy_os/socratic/llm_analyzer.py +25 -23
- empathy_os/socratic/mcp_server.py +99 -159
- empathy_os/socratic/session.py +19 -13
- empathy_os/socratic/storage.py +98 -67
- empathy_os/socratic/success.py +38 -27
- empathy_os/socratic/visual_editor.py +51 -39
- empathy_os/socratic/web_ui.py +99 -66
- empathy_os/telemetry/cli.py +3 -1
- empathy_os/telemetry/usage_tracker.py +1 -3
- empathy_os/test_generator/__init__.py +3 -3
- empathy_os/test_generator/cli.py +28 -28
- empathy_os/test_generator/generator.py +64 -66
- empathy_os/test_generator/risk_analyzer.py +11 -11
- empathy_os/vscode_bridge 2.py +173 -0
- empathy_os/vscode_bridge.py +173 -0
- empathy_os/workflows/__init__.py +212 -120
- empathy_os/workflows/batch_processing.py +8 -24
- empathy_os/workflows/bug_predict.py +1 -1
- empathy_os/workflows/code_review.py +20 -5
- empathy_os/workflows/code_review_pipeline.py +13 -8
- empathy_os/workflows/keyboard_shortcuts/workflow.py +6 -2
- empathy_os/workflows/manage_documentation.py +1 -0
- empathy_os/workflows/orchestrated_health_check.py +6 -11
- empathy_os/workflows/orchestrated_release_prep.py +3 -3
- empathy_os/workflows/pr_review.py +18 -10
- empathy_os/workflows/progressive/README 2.md +454 -0
- empathy_os/workflows/progressive/__init__ 2.py +92 -0
- empathy_os/workflows/progressive/__init__.py +2 -12
- empathy_os/workflows/progressive/cli 2.py +242 -0
- empathy_os/workflows/progressive/cli.py +14 -37
- empathy_os/workflows/progressive/core 2.py +488 -0
- empathy_os/workflows/progressive/core.py +12 -12
- empathy_os/workflows/progressive/orchestrator 2.py +701 -0
- empathy_os/workflows/progressive/orchestrator.py +166 -144
- empathy_os/workflows/progressive/reports 2.py +528 -0
- empathy_os/workflows/progressive/reports.py +22 -31
- empathy_os/workflows/progressive/telemetry 2.py +280 -0
- empathy_os/workflows/progressive/telemetry.py +8 -14
- empathy_os/workflows/progressive/test_gen 2.py +514 -0
- empathy_os/workflows/progressive/test_gen.py +29 -48
- empathy_os/workflows/progressive/workflow 2.py +628 -0
- empathy_os/workflows/progressive/workflow.py +31 -70
- empathy_os/workflows/release_prep.py +21 -6
- empathy_os/workflows/release_prep_crew.py +1 -0
- empathy_os/workflows/secure_release.py +13 -6
- empathy_os/workflows/security_audit.py +8 -3
- empathy_os/workflows/test_coverage_boost_crew.py +3 -2
- empathy_os/workflows/test_maintenance_crew.py +1 -0
- empathy_os/workflows/test_runner.py +16 -12
- empathy_software_plugin/SOFTWARE_PLUGIN_README.md +25 -703
- empathy_software_plugin/cli.py +0 -122
- patterns/README.md +119 -0
- patterns/__init__.py +95 -0
- patterns/behavior.py +298 -0
- patterns/code_review_memory.json +441 -0
- patterns/core.py +97 -0
- patterns/debugging.json +3763 -0
- patterns/empathy.py +268 -0
- patterns/health_check_memory.json +505 -0
- patterns/input.py +161 -0
- patterns/memory_graph.json +8 -0
- patterns/refactoring_memory.json +1113 -0
- patterns/registry.py +663 -0
- patterns/security_memory.json +8 -0
- patterns/structural.py +415 -0
- patterns/validation.py +194 -0
- coach_wizards/__init__.py +0 -45
- coach_wizards/accessibility_wizard.py +0 -91
- coach_wizards/api_wizard.py +0 -91
- coach_wizards/base_wizard.py +0 -209
- coach_wizards/cicd_wizard.py +0 -91
- coach_wizards/code_reviewer_README.md +0 -60
- coach_wizards/code_reviewer_wizard.py +0 -180
- coach_wizards/compliance_wizard.py +0 -91
- coach_wizards/database_wizard.py +0 -91
- coach_wizards/debugging_wizard.py +0 -91
- coach_wizards/documentation_wizard.py +0 -91
- coach_wizards/generate_wizards.py +0 -347
- coach_wizards/localization_wizard.py +0 -173
- coach_wizards/migration_wizard.py +0 -91
- coach_wizards/monitoring_wizard.py +0 -91
- coach_wizards/observability_wizard.py +0 -91
- coach_wizards/performance_wizard.py +0 -91
- coach_wizards/prompt_engineering_wizard.py +0 -661
- coach_wizards/refactoring_wizard.py +0 -91
- coach_wizards/scaling_wizard.py +0 -90
- coach_wizards/security_wizard.py +0 -92
- coach_wizards/testing_wizard.py +0 -91
- empathy_framework-4.6.6.dist-info/METADATA +0 -1597
- empathy_framework-4.6.6.dist-info/RECORD +0 -410
- empathy_llm_toolkit/wizards/__init__.py +0 -43
- empathy_llm_toolkit/wizards/base_wizard.py +0 -364
- empathy_llm_toolkit/wizards/customer_support_wizard.py +0 -190
- empathy_llm_toolkit/wizards/healthcare_wizard.py +0 -378
- empathy_llm_toolkit/wizards/patient_assessment_README.md +0 -64
- empathy_llm_toolkit/wizards/patient_assessment_wizard.py +0 -193
- empathy_llm_toolkit/wizards/technology_wizard.py +0 -209
- empathy_os/wizard_factory_cli.py +0 -170
- empathy_software_plugin/wizards/__init__.py +0 -42
- empathy_software_plugin/wizards/advanced_debugging_wizard.py +0 -395
- empathy_software_plugin/wizards/agent_orchestration_wizard.py +0 -511
- empathy_software_plugin/wizards/ai_collaboration_wizard.py +0 -503
- empathy_software_plugin/wizards/ai_context_wizard.py +0 -441
- empathy_software_plugin/wizards/ai_documentation_wizard.py +0 -503
- empathy_software_plugin/wizards/base_wizard.py +0 -288
- empathy_software_plugin/wizards/book_chapter_wizard.py +0 -519
- empathy_software_plugin/wizards/code_review_wizard.py +0 -604
- empathy_software_plugin/wizards/debugging/__init__.py +0 -50
- empathy_software_plugin/wizards/debugging/bug_risk_analyzer.py +0 -414
- empathy_software_plugin/wizards/debugging/config_loaders.py +0 -446
- empathy_software_plugin/wizards/debugging/fix_applier.py +0 -469
- empathy_software_plugin/wizards/debugging/language_patterns.py +0 -385
- empathy_software_plugin/wizards/debugging/linter_parsers.py +0 -470
- empathy_software_plugin/wizards/debugging/verification.py +0 -369
- empathy_software_plugin/wizards/enhanced_testing_wizard.py +0 -537
- empathy_software_plugin/wizards/memory_enhanced_debugging_wizard.py +0 -816
- empathy_software_plugin/wizards/multi_model_wizard.py +0 -501
- empathy_software_plugin/wizards/pattern_extraction_wizard.py +0 -422
- empathy_software_plugin/wizards/pattern_retriever_wizard.py +0 -400
- empathy_software_plugin/wizards/performance/__init__.py +0 -9
- empathy_software_plugin/wizards/performance/bottleneck_detector.py +0 -221
- empathy_software_plugin/wizards/performance/profiler_parsers.py +0 -278
- empathy_software_plugin/wizards/performance/trajectory_analyzer.py +0 -429
- empathy_software_plugin/wizards/performance_profiling_wizard.py +0 -305
- empathy_software_plugin/wizards/prompt_engineering_wizard.py +0 -425
- empathy_software_plugin/wizards/rag_pattern_wizard.py +0 -461
- empathy_software_plugin/wizards/security/__init__.py +0 -32
- empathy_software_plugin/wizards/security/exploit_analyzer.py +0 -290
- empathy_software_plugin/wizards/security/owasp_patterns.py +0 -241
- empathy_software_plugin/wizards/security/vulnerability_scanner.py +0 -604
- empathy_software_plugin/wizards/security_analysis_wizard.py +0 -322
- empathy_software_plugin/wizards/security_learning_wizard.py +0 -740
- empathy_software_plugin/wizards/tech_debt_wizard.py +0 -726
- empathy_software_plugin/wizards/testing/__init__.py +0 -27
- empathy_software_plugin/wizards/testing/coverage_analyzer.py +0 -459
- empathy_software_plugin/wizards/testing/quality_analyzer.py +0 -525
- empathy_software_plugin/wizards/testing/test_suggester.py +0 -533
- empathy_software_plugin/wizards/testing_wizard.py +0 -274
- wizards/__init__.py +0 -82
- wizards/admission_assessment_wizard.py +0 -644
- wizards/care_plan.py +0 -321
- wizards/clinical_assessment.py +0 -769
- wizards/discharge_planning.py +0 -77
- wizards/discharge_summary_wizard.py +0 -468
- wizards/dosage_calculation.py +0 -497
- wizards/incident_report_wizard.py +0 -454
- wizards/medication_reconciliation.py +0 -85
- wizards/nursing_assessment.py +0 -171
- wizards/patient_education.py +0 -654
- wizards/quality_improvement.py +0 -705
- wizards/sbar_report.py +0 -324
- wizards/sbar_wizard.py +0 -608
- wizards/shift_handoff_wizard.py +0 -535
- wizards/soap_note_wizard.py +0 -679
- wizards/treatment_plan.py +0 -15
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/WHEEL +0 -0
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/entry_points.txt +0 -0
- {empathy_framework-4.6.6.dist-info → empathy_framework-4.7.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -56,9 +56,7 @@ class PatternLearner:
|
|
|
56
56
|
If provided, insights will be stored in both files and memory
|
|
57
57
|
"""
|
|
58
58
|
if executions_dir is None:
|
|
59
|
-
executions_dir = str(
|
|
60
|
-
Path.home() / ".empathy" / "meta_workflows" / "executions"
|
|
61
|
-
)
|
|
59
|
+
executions_dir = str(Path.home() / ".empathy" / "meta_workflows" / "executions")
|
|
62
60
|
self.executions_dir = Path(executions_dir)
|
|
63
61
|
self.memory = memory
|
|
64
62
|
|
|
@@ -90,9 +88,7 @@ class PatternLearner:
|
|
|
90
88
|
results = []
|
|
91
89
|
for run_id in run_ids:
|
|
92
90
|
try:
|
|
93
|
-
result = load_execution_result(
|
|
94
|
-
run_id, storage_dir=str(self.executions_dir)
|
|
95
|
-
)
|
|
91
|
+
result = load_execution_result(run_id, storage_dir=str(self.executions_dir))
|
|
96
92
|
if template_id is None or result.template_id == template_id:
|
|
97
93
|
results.append(result)
|
|
98
94
|
except Exception as e:
|
|
@@ -312,9 +308,7 @@ class PatternLearner:
|
|
|
312
308
|
|
|
313
309
|
return insights
|
|
314
310
|
|
|
315
|
-
def get_recommendations(
|
|
316
|
-
self, template_id: str, min_confidence: float = 0.7
|
|
317
|
-
) -> list[str]:
|
|
311
|
+
def get_recommendations(self, template_id: str, min_confidence: float = 0.7) -> list[str]:
|
|
318
312
|
"""Get actionable recommendations for a template.
|
|
319
313
|
|
|
320
314
|
Args:
|
|
@@ -324,9 +318,7 @@ class PatternLearner:
|
|
|
324
318
|
Returns:
|
|
325
319
|
List of recommendation strings
|
|
326
320
|
"""
|
|
327
|
-
insights = self.analyze_patterns(
|
|
328
|
-
template_id=template_id, min_confidence=min_confidence
|
|
329
|
-
)
|
|
321
|
+
insights = self.analyze_patterns(template_id=template_id, min_confidence=min_confidence)
|
|
330
322
|
|
|
331
323
|
recommendations = []
|
|
332
324
|
|
|
@@ -347,9 +339,7 @@ class PatternLearner:
|
|
|
347
339
|
|
|
348
340
|
elif insight.insight_type == "cost_analysis":
|
|
349
341
|
avg_cost = insight.data["average"]
|
|
350
|
-
recommendations.append(
|
|
351
|
-
f"💰 Expected workflow cost: ${avg_cost:.2f}"
|
|
352
|
-
)
|
|
342
|
+
recommendations.append(f"💰 Expected workflow cost: ${avg_cost:.2f}")
|
|
353
343
|
|
|
354
344
|
elif insight.insight_type == "failure_analysis":
|
|
355
345
|
role = insight.data["role"]
|
|
@@ -361,9 +351,7 @@ class PatternLearner:
|
|
|
361
351
|
|
|
362
352
|
return recommendations
|
|
363
353
|
|
|
364
|
-
def generate_analytics_report(
|
|
365
|
-
self, template_id: str | None = None
|
|
366
|
-
) -> dict[str, Any]:
|
|
354
|
+
def generate_analytics_report(self, template_id: str | None = None) -> dict[str, Any]:
|
|
367
355
|
"""Generate comprehensive analytics report.
|
|
368
356
|
|
|
369
357
|
Args:
|
|
@@ -384,9 +372,7 @@ class PatternLearner:
|
|
|
384
372
|
results = []
|
|
385
373
|
for run_id in run_ids:
|
|
386
374
|
try:
|
|
387
|
-
result = load_execution_result(
|
|
388
|
-
run_id, storage_dir=str(self.executions_dir)
|
|
389
|
-
)
|
|
375
|
+
result = load_execution_result(run_id, storage_dir=str(self.executions_dir))
|
|
390
376
|
if template_id is None or result.template_id == template_id:
|
|
391
377
|
results.append(result)
|
|
392
378
|
except Exception:
|
|
@@ -412,9 +398,7 @@ class PatternLearner:
|
|
|
412
398
|
insight_type: [i.to_dict() for i in insights_list]
|
|
413
399
|
for insight_type, insights_list in insights_by_type.items()
|
|
414
400
|
},
|
|
415
|
-
"recommendations": self.get_recommendations(template_id)
|
|
416
|
-
if template_id
|
|
417
|
-
else [],
|
|
401
|
+
"recommendations": self.get_recommendations(template_id) if template_id else [],
|
|
418
402
|
}
|
|
419
403
|
|
|
420
404
|
return report
|
|
@@ -465,7 +449,7 @@ class PatternLearner:
|
|
|
465
449
|
# Create searchable content
|
|
466
450
|
content = f"""Meta-workflow execution: {result.template_id}
|
|
467
451
|
Run ID: {result.run_id}
|
|
468
|
-
Status: {
|
|
452
|
+
Status: {"SUCCESS" if result.success else "FAILED"}
|
|
469
453
|
Agents created: {len(result.agents_created)}
|
|
470
454
|
Total cost: ${result.total_cost:.2f}
|
|
471
455
|
Duration: {result.total_duration:.1f}s
|
|
@@ -574,9 +558,7 @@ Form Responses:
|
|
|
574
558
|
|
|
575
559
|
# Load full result from files
|
|
576
560
|
try:
|
|
577
|
-
result = load_execution_result(
|
|
578
|
-
run_id, storage_dir=str(self.executions_dir)
|
|
579
|
-
)
|
|
561
|
+
result = load_execution_result(run_id, storage_dir=str(self.executions_dir))
|
|
580
562
|
results.append(result)
|
|
581
563
|
except FileNotFoundError:
|
|
582
564
|
logger.warning(f"Result file not found for run_id: {run_id}")
|
|
@@ -670,9 +652,9 @@ Form Responses:
|
|
|
670
652
|
|
|
671
653
|
# Generate memory-enhanced recommendations
|
|
672
654
|
if similar_executions:
|
|
673
|
-
success_rate = sum(
|
|
674
|
-
|
|
675
|
-
)
|
|
655
|
+
success_rate = sum(1 for e in similar_executions if e.success) / len(
|
|
656
|
+
similar_executions
|
|
657
|
+
)
|
|
676
658
|
|
|
677
659
|
if success_rate >= 0.8:
|
|
678
660
|
base_recs.insert(
|
|
@@ -147,9 +147,7 @@ class PlanGenerator:
|
|
|
147
147
|
AgentStep(
|
|
148
148
|
order=order,
|
|
149
149
|
role=rule.role,
|
|
150
|
-
tier_recommendation=self.TIER_TO_MODEL.get(
|
|
151
|
-
rule.tier_strategy, "sonnet"
|
|
152
|
-
),
|
|
150
|
+
tier_recommendation=self.TIER_TO_MODEL.get(rule.tier_strategy, "sonnet"),
|
|
153
151
|
tools=rule.tools,
|
|
154
152
|
prompt=prompt,
|
|
155
153
|
success_criteria=rule.success_criteria,
|
|
@@ -204,7 +202,7 @@ Configuration:
|
|
|
204
202
|
Success Criteria:
|
|
205
203
|
{criteria}
|
|
206
204
|
|
|
207
|
-
Tools available: {
|
|
205
|
+
Tools available: {", ".join(rule.tools)}
|
|
208
206
|
|
|
209
207
|
Provide a structured report with findings, issues by severity, and recommendations.
|
|
210
208
|
"""
|
|
@@ -256,32 +254,36 @@ What risks exist? What's the recommended path forward?
|
|
|
256
254
|
lines.extend(["", "---", "", "## Execution Steps", ""])
|
|
257
255
|
|
|
258
256
|
for step in plan.steps:
|
|
259
|
-
lines.extend(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
257
|
+
lines.extend(
|
|
258
|
+
[
|
|
259
|
+
f"### Step {step.order}: {step.role}",
|
|
260
|
+
"",
|
|
261
|
+
f"**Tier Recommendation**: {step.tier_recommendation}",
|
|
262
|
+
f"**Tools**: {', '.join(step.tools)}",
|
|
263
|
+
"",
|
|
264
|
+
"**Prompt:**",
|
|
265
|
+
"```",
|
|
266
|
+
step.prompt,
|
|
267
|
+
"```",
|
|
268
|
+
"",
|
|
269
|
+
"**Success Criteria:**",
|
|
270
|
+
]
|
|
271
|
+
)
|
|
272
272
|
for criterion in step.success_criteria:
|
|
273
273
|
lines.append(f"- [ ] {criterion}")
|
|
274
274
|
lines.extend(["", "---", ""])
|
|
275
275
|
|
|
276
|
-
lines.extend(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
276
|
+
lines.extend(
|
|
277
|
+
[
|
|
278
|
+
"## Synthesis",
|
|
279
|
+
"",
|
|
280
|
+
"After all steps complete, run this synthesis:",
|
|
281
|
+
"",
|
|
282
|
+
"```",
|
|
283
|
+
plan.synthesis_prompt,
|
|
284
|
+
"```",
|
|
285
|
+
]
|
|
286
|
+
)
|
|
285
287
|
|
|
286
288
|
return "\n".join(lines)
|
|
287
289
|
|
|
@@ -292,11 +294,13 @@ What risks exist? What's the recommended path forward?
|
|
|
292
294
|
"""
|
|
293
295
|
steps_text = []
|
|
294
296
|
for step in plan.steps:
|
|
295
|
-
steps_text.append(
|
|
297
|
+
steps_text.append(
|
|
298
|
+
f"""
|
|
296
299
|
### {step.role}
|
|
297
300
|
Use the Task tool with subagent_type="Explore" to:
|
|
298
301
|
{step.prompt}
|
|
299
|
-
"""
|
|
302
|
+
"""
|
|
303
|
+
)
|
|
300
304
|
|
|
301
305
|
return f"""# {plan.template_name}
|
|
302
306
|
|
|
@@ -353,24 +357,28 @@ def generate_plan(
|
|
|
353
357
|
return generator.to_claude_code_skill(plan)
|
|
354
358
|
elif output_format == "json":
|
|
355
359
|
import json
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
360
|
+
|
|
361
|
+
return json.dumps(
|
|
362
|
+
{
|
|
363
|
+
"template_id": plan.template_id,
|
|
364
|
+
"template_name": plan.template_name,
|
|
365
|
+
"generated_at": plan.generated_at,
|
|
366
|
+
"form_responses": plan.form_responses,
|
|
367
|
+
"steps": [
|
|
368
|
+
{
|
|
369
|
+
"order": s.order,
|
|
370
|
+
"role": s.role,
|
|
371
|
+
"tier_recommendation": s.tier_recommendation,
|
|
372
|
+
"tools": s.tools,
|
|
373
|
+
"prompt": s.prompt,
|
|
374
|
+
"success_criteria": s.success_criteria,
|
|
375
|
+
"config": s.config,
|
|
376
|
+
}
|
|
377
|
+
for s in plan.steps
|
|
378
|
+
],
|
|
379
|
+
"synthesis_prompt": plan.synthesis_prompt,
|
|
380
|
+
},
|
|
381
|
+
indent=2,
|
|
382
|
+
)
|
|
375
383
|
else:
|
|
376
384
|
raise ValueError(f"Unknown format: {output_format}")
|
|
@@ -109,8 +109,7 @@ class SessionContext:
|
|
|
109
109
|
self.memory.stash(key, value, ttl_seconds=ttl or self.default_ttl)
|
|
110
110
|
|
|
111
111
|
logger.debug(
|
|
112
|
-
f"Recorded choice: template={template_id}, "
|
|
113
|
-
f"question={question_id}, choice={choice}"
|
|
112
|
+
f"Recorded choice: template={template_id}, question={question_id}, choice={choice}"
|
|
114
113
|
)
|
|
115
114
|
return True
|
|
116
115
|
|
|
@@ -336,7 +335,7 @@ class SessionContext:
|
|
|
336
335
|
"""
|
|
337
336
|
try:
|
|
338
337
|
# Basic validation - could be enhanced
|
|
339
|
-
if hasattr(question,
|
|
338
|
+
if hasattr(question, "options") and question.options:
|
|
340
339
|
# Check if choice is in options (only if options are defined)
|
|
341
340
|
if isinstance(choice, list):
|
|
342
341
|
# Multi-select - all choices must be in options
|
|
@@ -119,9 +119,7 @@ class MetaWorkflow:
|
|
|
119
119
|
|
|
120
120
|
# Set up storage
|
|
121
121
|
if storage_dir is None:
|
|
122
|
-
storage_dir = str(
|
|
123
|
-
Path.home() / ".empathy" / "meta_workflows" / "executions"
|
|
124
|
-
)
|
|
122
|
+
storage_dir = str(Path.home() / ".empathy" / "meta_workflows" / "executions")
|
|
125
123
|
self.storage_dir = Path(storage_dir)
|
|
126
124
|
self.storage_dir.mkdir(parents=True, exist_ok=True)
|
|
127
125
|
|
|
@@ -229,8 +227,7 @@ class MetaWorkflow:
|
|
|
229
227
|
run_id=run_id,
|
|
230
228
|
template_id=self.template.template_id,
|
|
231
229
|
timestamp=datetime.now().isoformat(),
|
|
232
|
-
form_responses=form_response
|
|
233
|
-
or FormResponse(template_id=self.template.template_id),
|
|
230
|
+
form_responses=form_response or FormResponse(template_id=self.template.template_id),
|
|
234
231
|
total_cost=0.0,
|
|
235
232
|
total_duration=time.time() - start_time,
|
|
236
233
|
success=False,
|
|
@@ -245,9 +242,7 @@ class MetaWorkflow:
|
|
|
245
242
|
|
|
246
243
|
raise ValueError(f"Meta-workflow execution failed: {e}") from e
|
|
247
244
|
|
|
248
|
-
def _execute_agents_mock(
|
|
249
|
-
self, agents: list[AgentSpec]
|
|
250
|
-
) -> list[AgentExecutionResult]:
|
|
245
|
+
def _execute_agents_mock(self, agents: list[AgentSpec]) -> list[AgentExecutionResult]:
|
|
251
246
|
"""Execute agents with mock execution (for MVP).
|
|
252
247
|
|
|
253
248
|
Args:
|
|
@@ -330,9 +325,7 @@ class MetaWorkflow:
|
|
|
330
325
|
logger.info(f"Executing agent: {agent.role} ({agent.tier_strategy.value})")
|
|
331
326
|
|
|
332
327
|
try:
|
|
333
|
-
result = self._execute_single_agent_with_escalation(
|
|
334
|
-
agent, router, tracker
|
|
335
|
-
)
|
|
328
|
+
result = self._execute_single_agent_with_escalation(agent, router, tracker)
|
|
336
329
|
results.append(result)
|
|
337
330
|
|
|
338
331
|
logger.info(
|
|
@@ -408,20 +401,14 @@ class MetaWorkflow:
|
|
|
408
401
|
return tier_result
|
|
409
402
|
|
|
410
403
|
# Failed - try next tier
|
|
411
|
-
logger.debug(
|
|
412
|
-
f"Tier {tier.value} did not meet success criteria, "
|
|
413
|
-
f"attempting escalation"
|
|
414
|
-
)
|
|
404
|
+
logger.debug(f"Tier {tier.value} did not meet success criteria, attempting escalation")
|
|
415
405
|
result = tier_result
|
|
416
406
|
|
|
417
407
|
# All tiers exhausted - return final result (failed)
|
|
418
408
|
if result:
|
|
419
409
|
result.cost = total_cost
|
|
420
410
|
result.duration = time.time() - start_time
|
|
421
|
-
logger.warning(
|
|
422
|
-
f"Agent {agent.role} failed at all tiers "
|
|
423
|
-
f"(cost: ${total_cost:.4f})"
|
|
424
|
-
)
|
|
411
|
+
logger.warning(f"Agent {agent.role} failed at all tiers (cost: ${total_cost:.4f})")
|
|
425
412
|
return result
|
|
426
413
|
|
|
427
414
|
# Should never reach here
|
|
@@ -587,9 +574,7 @@ class MetaWorkflow:
|
|
|
587
574
|
instructions = base_template.default_instructions
|
|
588
575
|
else:
|
|
589
576
|
# Fallback if template not found - use role-based generic prompt
|
|
590
|
-
logger.warning(
|
|
591
|
-
f"Template {agent.base_template} not found, using generic prompt"
|
|
592
|
-
)
|
|
577
|
+
logger.warning(f"Template {agent.base_template} not found, using generic prompt")
|
|
593
578
|
instructions = self._get_generic_instructions(agent.role)
|
|
594
579
|
|
|
595
580
|
# Build prompt
|
|
@@ -614,9 +599,7 @@ class MetaWorkflow:
|
|
|
614
599
|
|
|
615
600
|
return "\n".join(prompt_parts)
|
|
616
601
|
|
|
617
|
-
def _execute_llm_call(
|
|
618
|
-
self, prompt: str, model_config: Any, tier: ModelTier
|
|
619
|
-
) -> dict[str, Any]:
|
|
602
|
+
def _execute_llm_call(self, prompt: str, model_config: Any, tier: ModelTier) -> dict[str, Any]:
|
|
620
603
|
"""Execute real LLM call via Anthropic or other providers.
|
|
621
604
|
|
|
622
605
|
Uses the Anthropic client for Claude models, with fallback to
|
|
@@ -652,9 +635,7 @@ class MetaWorkflow:
|
|
|
652
635
|
response = client.messages.create(
|
|
653
636
|
model=model_config.model_id,
|
|
654
637
|
max_tokens=2048,
|
|
655
|
-
messages=[
|
|
656
|
-
{"role": "user", "content": prompt}
|
|
657
|
-
],
|
|
638
|
+
messages=[{"role": "user", "content": prompt}],
|
|
658
639
|
)
|
|
659
640
|
|
|
660
641
|
# Extract response data
|
|
@@ -663,10 +644,9 @@ class MetaWorkflow:
|
|
|
663
644
|
completion_tokens = response.usage.output_tokens
|
|
664
645
|
|
|
665
646
|
# Calculate cost
|
|
666
|
-
cost = (
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
)
|
|
647
|
+
cost = (prompt_tokens / 1000) * model_config.cost_per_1k_input + (
|
|
648
|
+
completion_tokens / 1000
|
|
649
|
+
) * model_config.cost_per_1k_output
|
|
670
650
|
|
|
671
651
|
return {
|
|
672
652
|
"cost": cost,
|
|
@@ -703,9 +683,7 @@ class MetaWorkflow:
|
|
|
703
683
|
},
|
|
704
684
|
}
|
|
705
685
|
|
|
706
|
-
def _simulate_llm_call(
|
|
707
|
-
self, prompt: str, model_config: Any, tier: ModelTier
|
|
708
|
-
) -> dict[str, Any]:
|
|
686
|
+
def _simulate_llm_call(self, prompt: str, model_config: Any, tier: ModelTier) -> dict[str, Any]:
|
|
709
687
|
"""Simulate LLM call with realistic cost/token estimates.
|
|
710
688
|
|
|
711
689
|
Used as fallback when real LLM execution is not available
|
|
@@ -726,10 +704,9 @@ class MetaWorkflow:
|
|
|
726
704
|
completion_tokens = 500 # Assume moderate response
|
|
727
705
|
|
|
728
706
|
# Calculate cost
|
|
729
|
-
cost = (
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
)
|
|
707
|
+
cost = (prompt_tokens / 1000) * model_config.cost_per_1k_input + (
|
|
708
|
+
completion_tokens / 1000
|
|
709
|
+
) * model_config.cost_per_1k_output
|
|
733
710
|
|
|
734
711
|
# Simulate success rate based on tier
|
|
735
712
|
# cheap: 80%, capable: 95%, premium: 99%
|
|
@@ -756,9 +733,7 @@ class MetaWorkflow:
|
|
|
756
733
|
},
|
|
757
734
|
}
|
|
758
735
|
|
|
759
|
-
def _evaluate_success_criteria(
|
|
760
|
-
self, result: AgentExecutionResult, agent: AgentSpec
|
|
761
|
-
) -> bool:
|
|
736
|
+
def _evaluate_success_criteria(self, result: AgentExecutionResult, agent: AgentSpec) -> bool:
|
|
762
737
|
"""Evaluate if agent result meets success criteria.
|
|
763
738
|
|
|
764
739
|
Args:
|
|
@@ -779,9 +754,7 @@ class MetaWorkflow:
|
|
|
779
754
|
# success_criteria is a list of descriptive strings (e.g., ["code reviewed", "tests pass"])
|
|
780
755
|
# These are informational criteria - if result.success is True, we consider the criteria met
|
|
781
756
|
# The criteria serve as documentation of what success means for this agent
|
|
782
|
-
logger.debug(
|
|
783
|
-
f"Agent succeeded with criteria: {agent.success_criteria}"
|
|
784
|
-
)
|
|
757
|
+
logger.debug(f"Agent succeeded with criteria: {agent.success_criteria}")
|
|
785
758
|
return True
|
|
786
759
|
|
|
787
760
|
def _save_execution(self, result: MetaWorkflowResult) -> Path:
|
|
@@ -883,9 +856,7 @@ class MetaWorkflow:
|
|
|
883
856
|
lines.append("## Summary")
|
|
884
857
|
lines.append("")
|
|
885
858
|
lines.append(f"- **Agents Created**: {len(result.agents_created)}")
|
|
886
|
-
lines.append(
|
|
887
|
-
f"- **Agents Executed**: {len(result.agent_results)}"
|
|
888
|
-
)
|
|
859
|
+
lines.append(f"- **Agents Executed**: {len(result.agent_results)}")
|
|
889
860
|
lines.append(f"- **Total Cost**: ${result.total_cost:.2f}")
|
|
890
861
|
lines.append(f"- **Total Duration**: {result.total_duration:.1f}s")
|
|
891
862
|
lines.append("")
|
|
@@ -918,9 +889,7 @@ class MetaWorkflow:
|
|
|
918
889
|
for i, agent_result in enumerate(result.agent_results, 1):
|
|
919
890
|
lines.append(f"### {i}. {agent_result.role}")
|
|
920
891
|
lines.append("")
|
|
921
|
-
lines.append(
|
|
922
|
-
f"- **Status**: {'✅ Success' if agent_result.success else '❌ Failed'}"
|
|
923
|
-
)
|
|
892
|
+
lines.append(f"- **Status**: {'✅ Success' if agent_result.success else '❌ Failed'}")
|
|
924
893
|
lines.append(f"- **Tier Used**: {agent_result.tier_used}")
|
|
925
894
|
lines.append(f"- **Cost**: ${agent_result.cost:.2f}")
|
|
926
895
|
lines.append(f"- **Duration**: {agent_result.duration:.1f}s")
|
empathy_os/models/cli.py
CHANGED
|
@@ -541,7 +541,7 @@ Examples:
|
|
|
541
541
|
%(prog)s provider Show current provider config
|
|
542
542
|
%(prog)s provider --set anthropic Set Anthropic as primary
|
|
543
543
|
%(prog)s provider --set hybrid Enable hybrid mode
|
|
544
|
-
%(prog)s provider --interactive Interactive setup
|
|
544
|
+
%(prog)s provider --interactive Interactive setup workflow
|
|
545
545
|
""",
|
|
546
546
|
)
|
|
547
547
|
|
|
@@ -600,7 +600,7 @@ Examples:
|
|
|
600
600
|
"--interactive",
|
|
601
601
|
"-i",
|
|
602
602
|
action="store_true",
|
|
603
|
-
help="Interactive configuration
|
|
603
|
+
help="Interactive configuration workflow",
|
|
604
604
|
)
|
|
605
605
|
prov_parser.add_argument("--format", "-f", choices=["table", "json"], default="table")
|
|
606
606
|
|
empathy_os/models/tasks.py
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Provides a unified vocabulary for task types across:
|
|
4
4
|
- empathy_llm_toolkit.routing.ModelRouter
|
|
5
5
|
- src/empathy_os/workflows.WorkflowBase
|
|
6
|
-
- empathy_software_plugin.wizards.MultiModelWizard
|
|
7
6
|
|
|
8
7
|
This module defines:
|
|
9
8
|
- TaskType enum with canonical task names
|
|
@@ -184,7 +183,7 @@ REALTIME_REQUIRED_TASKS: frozenset[str] = frozenset(
|
|
|
184
183
|
"interactive_debug",
|
|
185
184
|
"live_coding",
|
|
186
185
|
"user_query",
|
|
187
|
-
"
|
|
186
|
+
"workflow_step",
|
|
188
187
|
# Urgent Actions
|
|
189
188
|
"critical_fix",
|
|
190
189
|
"security_incident",
|
empathy_os/models/telemetry.py
CHANGED
|
@@ -1053,7 +1053,10 @@ class TelemetryStore:
|
|
|
1053
1053
|
continue
|
|
1054
1054
|
if not stale_only and not failed_only:
|
|
1055
1055
|
# Return all files needing attention (stale OR failed OR no_tests)
|
|
1056
|
-
if
|
|
1056
|
+
if (
|
|
1057
|
+
record.last_test_result not in ("failed", "error", "no_tests")
|
|
1058
|
+
and not record.is_stale
|
|
1059
|
+
):
|
|
1057
1060
|
continue
|
|
1058
1061
|
results.append(record)
|
|
1059
1062
|
|
|
@@ -210,7 +210,9 @@ def estimate_workflow_cost(
|
|
|
210
210
|
try:
|
|
211
211
|
filepath = os.path.join(root, file)
|
|
212
212
|
validated_filepath = _validate_file_path(filepath)
|
|
213
|
-
with open(
|
|
213
|
+
with open(
|
|
214
|
+
validated_filepath, encoding="utf-8", errors="ignore"
|
|
215
|
+
) as f:
|
|
214
216
|
total_chars += len(f.read())
|
|
215
217
|
except (ValueError, OSError):
|
|
216
218
|
pass
|