empathy-framework 3.5.6__py3-none-any.whl → 3.7.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.
- agents/compliance_anticipation_agent.py +113 -118
- agents/compliance_db.py +339 -0
- agents/epic_integration_wizard.py +37 -48
- agents/notifications.py +291 -0
- agents/trust_building_behaviors.py +66 -85
- coach_wizards/__init__.py +11 -12
- coach_wizards/accessibility_wizard.py +12 -12
- coach_wizards/api_wizard.py +12 -12
- coach_wizards/base_wizard.py +26 -20
- coach_wizards/cicd_wizard.py +15 -13
- coach_wizards/compliance_wizard.py +12 -12
- coach_wizards/database_wizard.py +12 -12
- coach_wizards/debugging_wizard.py +12 -12
- coach_wizards/documentation_wizard.py +12 -12
- coach_wizards/generate_wizards.py +1 -2
- coach_wizards/localization_wizard.py +21 -14
- coach_wizards/migration_wizard.py +12 -12
- coach_wizards/monitoring_wizard.py +12 -12
- coach_wizards/observability_wizard.py +12 -12
- coach_wizards/performance_wizard.py +12 -12
- coach_wizards/prompt_engineering_wizard.py +22 -25
- coach_wizards/refactoring_wizard.py +12 -12
- coach_wizards/scaling_wizard.py +12 -12
- coach_wizards/security_wizard.py +12 -12
- coach_wizards/testing_wizard.py +12 -12
- {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/METADATA +234 -30
- empathy_framework-3.7.0.dist-info/RECORD +105 -0
- empathy_healthcare_plugin/__init__.py +1 -2
- empathy_llm_toolkit/__init__.py +5 -6
- empathy_llm_toolkit/claude_memory.py +14 -15
- empathy_llm_toolkit/code_health.py +27 -19
- empathy_llm_toolkit/contextual_patterns.py +11 -12
- empathy_llm_toolkit/core.py +43 -49
- empathy_llm_toolkit/git_pattern_extractor.py +16 -12
- empathy_llm_toolkit/levels.py +6 -13
- empathy_llm_toolkit/pattern_confidence.py +14 -18
- empathy_llm_toolkit/pattern_resolver.py +10 -12
- empathy_llm_toolkit/pattern_summary.py +13 -11
- empathy_llm_toolkit/providers.py +27 -38
- empathy_llm_toolkit/session_status.py +18 -20
- empathy_llm_toolkit/state.py +20 -21
- empathy_os/__init__.py +72 -73
- empathy_os/cli.py +193 -98
- empathy_os/cli_unified.py +68 -41
- empathy_os/config.py +31 -31
- empathy_os/coordination.py +48 -54
- empathy_os/core.py +90 -99
- empathy_os/cost_tracker.py +20 -23
- empathy_os/discovery.py +9 -11
- empathy_os/emergence.py +20 -21
- empathy_os/exceptions.py +18 -30
- empathy_os/feedback_loops.py +27 -30
- empathy_os/levels.py +31 -34
- empathy_os/leverage_points.py +27 -28
- empathy_os/logging_config.py +11 -12
- empathy_os/monitoring.py +27 -27
- empathy_os/pattern_library.py +29 -28
- empathy_os/persistence.py +30 -34
- empathy_os/platform_utils.py +46 -47
- empathy_os/redis_config.py +14 -15
- empathy_os/redis_memory.py +53 -56
- empathy_os/templates.py +12 -11
- empathy_os/trust_building.py +44 -36
- empathy_os/workflow_commands.py +123 -31
- empathy_software_plugin/__init__.py +1 -2
- empathy_software_plugin/cli.py +32 -25
- empathy_software_plugin/plugin.py +4 -8
- empathy_framework-3.5.6.dist-info/RECORD +0 -103
- {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/WHEEL +0 -0
- {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/entry_points.txt +0 -0
- {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/licenses/LICENSE +0 -0
- {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Trust-Building Behaviors for Level 4 Anticipatory Agents
|
|
1
|
+
"""Trust-Building Behaviors for Level 4 Anticipatory Agents
|
|
3
2
|
|
|
4
3
|
Implements team dynamics that build trust through anticipatory actions:
|
|
5
4
|
- Pre-format data for handoffs (reduce cognitive load for next person)
|
|
@@ -24,8 +23,7 @@ logger = logging.getLogger(__name__)
|
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
class TrustBuildingBehaviors:
|
|
27
|
-
"""
|
|
28
|
-
Level 4 Anticipatory trust-building behaviors
|
|
26
|
+
"""Level 4 Anticipatory trust-building behaviors
|
|
29
27
|
|
|
30
28
|
Philosophy: Trust is earned through consistent, helpful actions that
|
|
31
29
|
demonstrate understanding of team dynamics and proactive problem-solving.
|
|
@@ -33,8 +31,7 @@ class TrustBuildingBehaviors:
|
|
|
33
31
|
|
|
34
32
|
@staticmethod
|
|
35
33
|
def pre_format_for_handoff(data: dict, next_person_role: str, context: str) -> dict:
|
|
36
|
-
"""
|
|
37
|
-
Scenario: Handoff Risk
|
|
34
|
+
"""Scenario: Handoff Risk
|
|
38
35
|
Anticipatory Response: Pre-format the data so next person doesn't waste time
|
|
39
36
|
|
|
40
37
|
Example:
|
|
@@ -46,8 +43,8 @@ class TrustBuildingBehaviors:
|
|
|
46
43
|
- "This AI understands my workflow"
|
|
47
44
|
- "I don't have to translate data myself"
|
|
48
45
|
- "My time is valued"
|
|
49
|
-
"""
|
|
50
46
|
|
|
47
|
+
"""
|
|
51
48
|
logger.info(f"Pre-formatting data for handoff to {next_person_role}")
|
|
52
49
|
|
|
53
50
|
# Determine format based on recipient role
|
|
@@ -71,7 +68,7 @@ class TrustBuildingBehaviors:
|
|
|
71
68
|
pid
|
|
72
69
|
for gap in data.get("compliance_gaps", [])
|
|
73
70
|
for pid in gap.get("patient_ids", [])
|
|
74
|
-
}
|
|
71
|
+
},
|
|
75
72
|
),
|
|
76
73
|
"estimated_total_time": sum(
|
|
77
74
|
int(item.get("estimated_time", "0 minutes").split()[0])
|
|
@@ -112,7 +109,7 @@ class TrustBuildingBehaviors:
|
|
|
112
109
|
for item in data.get("action_items", [])
|
|
113
110
|
)
|
|
114
111
|
else None
|
|
115
|
-
)
|
|
112
|
+
),
|
|
116
113
|
],
|
|
117
114
|
},
|
|
118
115
|
"escalation_needed": len(
|
|
@@ -120,7 +117,7 @@ class TrustBuildingBehaviors:
|
|
|
120
117
|
g
|
|
121
118
|
for g in data.get("compliance_gaps", [])
|
|
122
119
|
if g.get("severity") == "critical"
|
|
123
|
-
]
|
|
120
|
+
],
|
|
124
121
|
)
|
|
125
122
|
> 2,
|
|
126
123
|
},
|
|
@@ -149,7 +146,7 @@ class TrustBuildingBehaviors:
|
|
|
149
146
|
g
|
|
150
147
|
for g in data.get("compliance_gaps", [])
|
|
151
148
|
if g.get("legal_risk") == "high"
|
|
152
|
-
]
|
|
149
|
+
],
|
|
153
150
|
),
|
|
154
151
|
"can_fix_before_audit": all(
|
|
155
152
|
g.get("can_fix_retroactively", True)
|
|
@@ -185,10 +182,11 @@ class TrustBuildingBehaviors:
|
|
|
185
182
|
|
|
186
183
|
@staticmethod
|
|
187
184
|
def clarify_before_execution(
|
|
188
|
-
instruction: str,
|
|
185
|
+
instruction: str,
|
|
186
|
+
context: dict,
|
|
187
|
+
confidence_threshold: float = 0.8,
|
|
189
188
|
) -> dict:
|
|
190
|
-
"""
|
|
191
|
-
Scenario: Confusing Instructions
|
|
189
|
+
"""Scenario: Confusing Instructions
|
|
192
190
|
Anticipatory Response: Clarify and summarize before execution
|
|
193
191
|
|
|
194
192
|
Example:
|
|
@@ -200,8 +198,8 @@ class TrustBuildingBehaviors:
|
|
|
200
198
|
- "This AI doesn't waste my time on wrong implementations"
|
|
201
199
|
- "It's safe to give rough instructions"
|
|
202
200
|
- "We're collaborating, not just transacting"
|
|
203
|
-
"""
|
|
204
201
|
|
|
202
|
+
"""
|
|
205
203
|
logger.info(f"Analyzing instruction clarity: '{instruction[:50]}...'")
|
|
206
204
|
|
|
207
205
|
# Analyze instruction for ambiguity
|
|
@@ -217,28 +215,26 @@ class TrustBuildingBehaviors:
|
|
|
217
215
|
"reasoning": "Instruction is clear, proceeding with execution",
|
|
218
216
|
}
|
|
219
217
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
"
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
218
|
+
# Ambiguous instruction, clarify first
|
|
219
|
+
return {
|
|
220
|
+
"action": "clarify_first",
|
|
221
|
+
"clarification_needed": True,
|
|
222
|
+
"ambiguities_detected": ambiguity_signals["ambiguities"],
|
|
223
|
+
"proposed_interpretation": ambiguity_signals["best_guess"],
|
|
224
|
+
"clarifying_questions": ambiguity_signals["questions"],
|
|
225
|
+
"confidence": ambiguity_signals["clarity_score"],
|
|
226
|
+
"reasoning": (
|
|
227
|
+
f"Instruction clarity score: {ambiguity_signals['clarity_score']:.0%} "
|
|
228
|
+
f"(threshold: {confidence_threshold:.0%}). "
|
|
229
|
+
"Clarifying before execution to prevent wasted effort."
|
|
230
|
+
),
|
|
231
|
+
"message_to_user": compose_clarification_request(instruction, ambiguity_signals),
|
|
232
|
+
"trust_building_behavior": "clarify_before_execution",
|
|
233
|
+
}
|
|
237
234
|
|
|
238
235
|
@staticmethod
|
|
239
236
|
def volunteer_structure_during_stress(team_state: dict, stress_indicators: dict) -> dict | None:
|
|
240
|
-
"""
|
|
241
|
-
Scenario: Team Stress Rising
|
|
237
|
+
"""Scenario: Team Stress Rising
|
|
242
238
|
Anticipatory Response: Volunteer structure, not pep talks
|
|
243
239
|
|
|
244
240
|
Example:
|
|
@@ -250,8 +246,8 @@ class TrustBuildingBehaviors:
|
|
|
250
246
|
- "This AI understands real problems"
|
|
251
247
|
- "Structure relieves stress more than encouragement"
|
|
252
248
|
- "Practical help, not performative support"
|
|
253
|
-
"""
|
|
254
249
|
|
|
250
|
+
"""
|
|
255
251
|
logger.info("Analyzing team stress indicators")
|
|
256
252
|
|
|
257
253
|
# Detect stress level
|
|
@@ -276,7 +272,7 @@ class TrustBuildingBehaviors:
|
|
|
276
272
|
"structure": create_prioritized_timeline(team_state, source),
|
|
277
273
|
"benefit": "Clarifies what must be done when → reduces decision paralysis",
|
|
278
274
|
"not_this": "⛔ Pep talk: 'You can do this! Stay positive!'",
|
|
279
|
-
}
|
|
275
|
+
},
|
|
280
276
|
)
|
|
281
277
|
|
|
282
278
|
elif source["type"] == "task_overload":
|
|
@@ -287,7 +283,7 @@ class TrustBuildingBehaviors:
|
|
|
287
283
|
"structure": create_delegation_framework(team_state, source),
|
|
288
284
|
"benefit": "Distributes workload clearly → prevents burnout",
|
|
289
285
|
"not_this": "⛔ Pep talk: 'Just push through!'",
|
|
290
|
-
}
|
|
286
|
+
},
|
|
291
287
|
)
|
|
292
288
|
|
|
293
289
|
elif source["type"] == "information_overload":
|
|
@@ -298,7 +294,7 @@ class TrustBuildingBehaviors:
|
|
|
298
294
|
"structure": create_decision_dashboard(team_state, source),
|
|
299
295
|
"benefit": "Surfaces critical info only → reduces cognitive load",
|
|
300
296
|
"not_this": "⛔ Pep talk: 'Focus on what matters!'",
|
|
301
|
-
}
|
|
297
|
+
},
|
|
302
298
|
)
|
|
303
299
|
|
|
304
300
|
elif source["type"] == "unclear_priorities":
|
|
@@ -309,7 +305,7 @@ class TrustBuildingBehaviors:
|
|
|
309
305
|
"structure": create_priority_matrix(team_state, source),
|
|
310
306
|
"benefit": "Makes trade-offs explicit → enables confident decisions",
|
|
311
307
|
"not_this": "⛔ Pep talk: 'Trust your gut!'",
|
|
312
|
-
}
|
|
308
|
+
},
|
|
313
309
|
)
|
|
314
310
|
|
|
315
311
|
if not structural_interventions:
|
|
@@ -330,10 +326,10 @@ class TrustBuildingBehaviors:
|
|
|
330
326
|
|
|
331
327
|
@staticmethod
|
|
332
328
|
def offer_help_to_struggling_teammate(
|
|
333
|
-
teammate_state: dict,
|
|
329
|
+
teammate_state: dict,
|
|
330
|
+
my_bandwidth: float = 0.7,
|
|
334
331
|
) -> dict | None:
|
|
335
|
-
"""
|
|
336
|
-
Scenario: Silent Teammate Struggling
|
|
332
|
+
"""Scenario: Silent Teammate Struggling
|
|
337
333
|
Anticipatory Response: "I've got bandwidth—want me to take a slice of this?"
|
|
338
334
|
|
|
339
335
|
Example:
|
|
@@ -345,8 +341,8 @@ class TrustBuildingBehaviors:
|
|
|
345
341
|
- "This AI notices when I'm underwater"
|
|
346
342
|
- "Offers concrete help, not vague support"
|
|
347
343
|
- "Respects my autonomy (asks, doesn't assume)"
|
|
348
|
-
"""
|
|
349
344
|
|
|
345
|
+
"""
|
|
350
346
|
logger.info(f"Checking if teammate needs help (my bandwidth: {my_bandwidth:.0%})")
|
|
351
347
|
|
|
352
348
|
# Detect if teammate is struggling
|
|
@@ -372,7 +368,7 @@ class TrustBuildingBehaviors:
|
|
|
372
368
|
"estimated_time": task["estimated_time"],
|
|
373
369
|
"why_i_can_help": determine_help_rationale(task),
|
|
374
370
|
"impact_on_teammate": estimate_relief(task, teammate_state),
|
|
375
|
-
}
|
|
371
|
+
},
|
|
376
372
|
)
|
|
377
373
|
|
|
378
374
|
if not tasks_i_can_help_with:
|
|
@@ -391,7 +387,9 @@ class TrustBuildingBehaviors:
|
|
|
391
387
|
f"Offering to take {len(tasks_i_can_help_with)} specific tasks."
|
|
392
388
|
),
|
|
393
389
|
"message_to_teammate": compose_help_offer(
|
|
394
|
-
tasks_i_can_help_with,
|
|
390
|
+
tasks_i_can_help_with,
|
|
391
|
+
my_bandwidth,
|
|
392
|
+
struggle_indicators,
|
|
395
393
|
),
|
|
396
394
|
"trust_building_behavior": "offer_help_to_struggling_teammate",
|
|
397
395
|
}
|
|
@@ -406,29 +404,27 @@ def calculate_risk_level(data: dict) -> str:
|
|
|
406
404
|
"""Calculate overall risk level (low, medium, high, critical)"""
|
|
407
405
|
compliance_pct = data.get("compliance_percentage", 100)
|
|
408
406
|
critical_gaps = len(
|
|
409
|
-
[g for g in data.get("compliance_gaps", []) if g.get("severity") == "critical"]
|
|
407
|
+
[g for g in data.get("compliance_gaps", []) if g.get("severity") == "critical"],
|
|
410
408
|
)
|
|
411
409
|
days_until = data.get("days_until_audit", 999)
|
|
412
410
|
|
|
413
411
|
if critical_gaps > 0 or compliance_pct < 85:
|
|
414
412
|
return "high"
|
|
415
|
-
|
|
413
|
+
if compliance_pct < 90 or days_until < 30:
|
|
416
414
|
return "medium"
|
|
417
|
-
|
|
418
|
-
return "low"
|
|
415
|
+
return "low"
|
|
419
416
|
|
|
420
417
|
|
|
421
418
|
def detect_ambiguity(instruction: str, context: dict) -> dict:
|
|
422
|
-
"""
|
|
423
|
-
Detect ambiguity in instruction
|
|
419
|
+
"""Detect ambiguity in instruction
|
|
424
420
|
|
|
425
421
|
Returns:
|
|
426
422
|
clarity_score: 0.0-1.0 (1.0 = perfectly clear)
|
|
427
423
|
ambiguities: List of detected ambiguities
|
|
428
424
|
questions: Calibrated questions to clarify
|
|
429
425
|
best_guess: Best interpretation if proceeding anyway
|
|
430
|
-
"""
|
|
431
426
|
|
|
427
|
+
"""
|
|
432
428
|
# Simple heuristic-based ambiguity detection
|
|
433
429
|
# In production, could use NLP / LLM analysis
|
|
434
430
|
|
|
@@ -470,7 +466,6 @@ def detect_ambiguity(instruction: str, context: dict) -> dict:
|
|
|
470
466
|
|
|
471
467
|
def compose_clarification_request(instruction: str, ambiguity_signals: dict) -> str:
|
|
472
468
|
"""Compose user-friendly clarification request"""
|
|
473
|
-
|
|
474
469
|
ambiguities_text = "\n".join(f"• {amb}" for amb in ambiguity_signals["ambiguities"])
|
|
475
470
|
questions_text = "\n".join(
|
|
476
471
|
f"{i + 1}. {q}" for i, q in enumerate(ambiguity_signals["questions"])
|
|
@@ -498,8 +493,7 @@ _(This AI clarifies before executing to build trust through accurate work)_
|
|
|
498
493
|
|
|
499
494
|
|
|
500
495
|
def calculate_stress_level(stress_indicators: dict) -> float:
|
|
501
|
-
"""
|
|
502
|
-
Calculate team stress level (0.0-1.0)
|
|
496
|
+
"""Calculate team stress level (0.0-1.0)
|
|
503
497
|
|
|
504
498
|
Indicators:
|
|
505
499
|
- Time pressure (days until deadline)
|
|
@@ -507,7 +501,6 @@ def calculate_stress_level(stress_indicators: dict) -> float:
|
|
|
507
501
|
- Complexity (critical items)
|
|
508
502
|
- Uncertainty (missing information)
|
|
509
503
|
"""
|
|
510
|
-
|
|
511
504
|
stress_factors = []
|
|
512
505
|
|
|
513
506
|
# Time pressure
|
|
@@ -540,7 +533,6 @@ def calculate_stress_level(stress_indicators: dict) -> float:
|
|
|
540
533
|
|
|
541
534
|
def identify_stress_sources(team_state: dict, stress_indicators: dict) -> list[dict]:
|
|
542
535
|
"""Identify specific sources of stress"""
|
|
543
|
-
|
|
544
536
|
sources = []
|
|
545
537
|
|
|
546
538
|
if stress_indicators.get("days_until_deadline", 999) < 30:
|
|
@@ -549,7 +541,7 @@ def identify_stress_sources(team_state: dict, stress_indicators: dict) -> list[d
|
|
|
549
541
|
"type": "time_pressure",
|
|
550
542
|
"description": f"Only {stress_indicators['days_until_deadline']} days until deadline",
|
|
551
543
|
"severity": ("high" if stress_indicators["days_until_deadline"] < 14 else "medium"),
|
|
552
|
-
}
|
|
544
|
+
},
|
|
553
545
|
)
|
|
554
546
|
|
|
555
547
|
if stress_indicators.get("tasks_per_person", 0) > 5:
|
|
@@ -558,7 +550,7 @@ def identify_stress_sources(team_state: dict, stress_indicators: dict) -> list[d
|
|
|
558
550
|
"type": "task_overload",
|
|
559
551
|
"description": f"{stress_indicators['tasks_per_person']} tasks per person",
|
|
560
552
|
"severity": ("high" if stress_indicators["tasks_per_person"] > 10 else "medium"),
|
|
561
|
-
}
|
|
553
|
+
},
|
|
562
554
|
)
|
|
563
555
|
|
|
564
556
|
if len(team_state.get("compliance_gaps", [])) > 10:
|
|
@@ -567,7 +559,7 @@ def identify_stress_sources(team_state: dict, stress_indicators: dict) -> list[d
|
|
|
567
559
|
"type": "information_overload",
|
|
568
560
|
"description": f"{len(team_state['compliance_gaps'])} gaps to process",
|
|
569
561
|
"severity": "medium",
|
|
570
|
-
}
|
|
562
|
+
},
|
|
571
563
|
)
|
|
572
564
|
|
|
573
565
|
return sources
|
|
@@ -575,7 +567,6 @@ def identify_stress_sources(team_state: dict, stress_indicators: dict) -> list[d
|
|
|
575
567
|
|
|
576
568
|
def create_prioritized_timeline(team_state: dict, stress_source: dict) -> dict:
|
|
577
569
|
"""Create structured timeline to relieve time pressure"""
|
|
578
|
-
|
|
579
570
|
return {
|
|
580
571
|
"structure_type": "timeline",
|
|
581
572
|
"phases": [
|
|
@@ -607,7 +598,6 @@ def create_prioritized_timeline(team_state: dict, stress_source: dict) -> dict:
|
|
|
607
598
|
|
|
608
599
|
def create_delegation_framework(team_state: dict, stress_source: dict) -> dict:
|
|
609
600
|
"""Create task delegation structure"""
|
|
610
|
-
|
|
611
601
|
return {
|
|
612
602
|
"structure_type": "delegation_matrix",
|
|
613
603
|
"assignments": {
|
|
@@ -636,7 +626,6 @@ def create_delegation_framework(team_state: dict, stress_source: dict) -> dict:
|
|
|
636
626
|
|
|
637
627
|
def create_decision_dashboard(team_state: dict, stress_source: dict) -> dict:
|
|
638
628
|
"""Create structured information dashboard"""
|
|
639
|
-
|
|
640
629
|
return {
|
|
641
630
|
"structure_type": "decision_dashboard",
|
|
642
631
|
"critical_only_view": {
|
|
@@ -652,7 +641,6 @@ def create_decision_dashboard(team_state: dict, stress_source: dict) -> dict:
|
|
|
652
641
|
|
|
653
642
|
def create_priority_matrix(team_state: dict, stress_source: dict) -> dict:
|
|
654
643
|
"""Create priority decision matrix"""
|
|
655
|
-
|
|
656
644
|
return {
|
|
657
645
|
"structure_type": "priority_matrix",
|
|
658
646
|
"dimensions": {
|
|
@@ -672,7 +660,6 @@ def create_priority_matrix(team_state: dict, stress_source: dict) -> dict:
|
|
|
672
660
|
|
|
673
661
|
def compose_structure_offer(stress_level: float, interventions: list[dict]) -> str:
|
|
674
662
|
"""Compose offer of structural help"""
|
|
675
|
-
|
|
676
663
|
intervention_text = "\n".join(
|
|
677
664
|
f"{i + 1}. **{interv['intervention_type'].replace('_', ' ').title()}**\n"
|
|
678
665
|
f" → Benefit: {interv['benefit']}\n"
|
|
@@ -696,7 +683,6 @@ _(Level 4 Anticipatory Empathy: Structure relieves stress more than encouragemen
|
|
|
696
683
|
|
|
697
684
|
def detect_struggle(teammate_state: dict) -> dict:
|
|
698
685
|
"""Detect if teammate is struggling"""
|
|
699
|
-
|
|
700
686
|
struggle_indicators = []
|
|
701
687
|
struggle_score = 0.0
|
|
702
688
|
|
|
@@ -708,7 +694,7 @@ def detect_struggle(teammate_state: dict) -> dict:
|
|
|
708
694
|
|
|
709
695
|
# Many critical tasks
|
|
710
696
|
critical_count = len(
|
|
711
|
-
[t for t in teammate_state.get("tasks", []) if t.get("severity") == "critical"]
|
|
697
|
+
[t for t in teammate_state.get("tasks", []) if t.get("severity") == "critical"],
|
|
712
698
|
)
|
|
713
699
|
if critical_count > 2:
|
|
714
700
|
struggle_indicators.append(f"Multiple critical tasks: {critical_count}")
|
|
@@ -716,7 +702,7 @@ def detect_struggle(teammate_state: dict) -> dict:
|
|
|
716
702
|
|
|
717
703
|
# Tight deadlines
|
|
718
704
|
urgent_deadlines = len(
|
|
719
|
-
[t for t in teammate_state.get("tasks", []) if t.get("deadline_days", 999) < 3]
|
|
705
|
+
[t for t in teammate_state.get("tasks", []) if t.get("deadline_days", 999) < 3],
|
|
720
706
|
)
|
|
721
707
|
if urgent_deadlines > 0:
|
|
722
708
|
struggle_indicators.append(f"Urgent deadlines: {urgent_deadlines} tasks due <3 days")
|
|
@@ -730,7 +716,6 @@ def detect_struggle(teammate_state: dict) -> dict:
|
|
|
730
716
|
|
|
731
717
|
def can_i_help_with_task(task: dict, my_bandwidth: float) -> bool:
|
|
732
718
|
"""Determine if I can help with this task"""
|
|
733
|
-
|
|
734
719
|
# I can help if:
|
|
735
720
|
# 1. Task is not too complex (medium/low priority)
|
|
736
721
|
# 2. Task doesn't require human judgment (can be automated)
|
|
@@ -751,49 +736,42 @@ def can_i_help_with_task(task: dict, my_bandwidth: float) -> bool:
|
|
|
751
736
|
|
|
752
737
|
def estimate_task_effort(task: dict) -> float:
|
|
753
738
|
"""Estimate effort required for task (0.0-1.0 of bandwidth)"""
|
|
754
|
-
|
|
755
739
|
estimated_time = task.get("estimated_time", "0 minutes")
|
|
756
740
|
minutes = int(estimated_time.split()[0]) if estimated_time.split()[0].isdigit() else 0
|
|
757
741
|
|
|
758
742
|
# Map minutes to bandwidth fraction
|
|
759
743
|
if minutes < 15:
|
|
760
744
|
return 0.1
|
|
761
|
-
|
|
745
|
+
if minutes < 30:
|
|
762
746
|
return 0.2
|
|
763
|
-
|
|
747
|
+
if minutes < 60:
|
|
764
748
|
return 0.3
|
|
765
|
-
|
|
766
|
-
return 0.5
|
|
749
|
+
return 0.5
|
|
767
750
|
|
|
768
751
|
|
|
769
752
|
def determine_help_rationale(task: dict) -> str:
|
|
770
753
|
"""Explain why I can help with this task"""
|
|
771
|
-
|
|
772
754
|
if task.get("type") == "documentation":
|
|
773
755
|
return "I can auto-generate documentation drafts"
|
|
774
|
-
|
|
756
|
+
if task.get("type") == "data_gathering":
|
|
775
757
|
return "I can collect and format data quickly"
|
|
776
|
-
|
|
758
|
+
if task.get("type") == "analysis":
|
|
777
759
|
return "I can run analysis and summarize results"
|
|
778
|
-
|
|
779
|
-
return "I can automate repetitive parts of this task"
|
|
760
|
+
return "I can automate repetitive parts of this task"
|
|
780
761
|
|
|
781
762
|
|
|
782
763
|
def estimate_relief(task: dict, teammate_state: dict) -> str:
|
|
783
764
|
"""Estimate impact on teammate if I take this task"""
|
|
784
|
-
|
|
785
765
|
task_time = estimate_task_effort(task)
|
|
786
766
|
total_load = len(teammate_state.get("tasks", []))
|
|
787
767
|
|
|
788
768
|
if total_load > 10:
|
|
789
769
|
return f"Reduces your load by {(task_time / total_load * 100):.0f}% (meaningful relief)"
|
|
790
|
-
|
|
791
|
-
return "Modest relief but every bit helps"
|
|
770
|
+
return "Modest relief but every bit helps"
|
|
792
771
|
|
|
793
772
|
|
|
794
773
|
def compose_help_offer(tasks: list[dict], bandwidth: float, struggle: dict) -> str:
|
|
795
774
|
"""Compose specific help offer to struggling teammate"""
|
|
796
|
-
|
|
797
775
|
indicators_text = "\n".join(f"• {ind}" for ind in struggle["indicators"])
|
|
798
776
|
|
|
799
777
|
tasks_text = "\n".join(
|
|
@@ -855,7 +833,9 @@ if __name__ == "__main__":
|
|
|
855
833
|
trust_builder = TrustBuildingBehaviors()
|
|
856
834
|
|
|
857
835
|
formatted = trust_builder.pre_format_for_handoff(
|
|
858
|
-
data=raw_data,
|
|
836
|
+
data=raw_data,
|
|
837
|
+
next_person_role="charge_nurse",
|
|
838
|
+
context="audit_preparation",
|
|
859
839
|
)
|
|
860
840
|
|
|
861
841
|
print("=" * 80)
|
|
@@ -879,7 +859,8 @@ if __name__ == "__main__":
|
|
|
879
859
|
}
|
|
880
860
|
|
|
881
861
|
structure_offer = trust_builder.volunteer_structure_during_stress(
|
|
882
|
-
team_state=team_state,
|
|
862
|
+
team_state=team_state,
|
|
863
|
+
stress_indicators=stress_indicators,
|
|
883
864
|
)
|
|
884
865
|
|
|
885
866
|
if structure_offer:
|
coach_wizards/__init__.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Coach Wizards - 17 Specialized Software Development Wizards
|
|
1
|
+
"""Coach Wizards - 17 Specialized Software Development Wizards
|
|
3
2
|
|
|
4
3
|
Level 4 Anticipatory Empathy for software development using the Empathy Framework.
|
|
5
4
|
|
|
@@ -26,21 +25,21 @@ from .security_wizard import SecurityWizard
|
|
|
26
25
|
from .testing_wizard import TestingWizard
|
|
27
26
|
|
|
28
27
|
__all__ = [
|
|
29
|
-
"
|
|
30
|
-
"PerformanceWizard",
|
|
28
|
+
"APIWizard",
|
|
31
29
|
"AccessibilityWizard",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
30
|
+
"CICDWizard",
|
|
31
|
+
"ComplianceWizard",
|
|
34
32
|
"DatabaseWizard",
|
|
35
|
-
"APIWizard",
|
|
36
33
|
"DebuggingWizard",
|
|
37
|
-
"ScalingWizard",
|
|
38
|
-
"ObservabilityWizard",
|
|
39
|
-
"CICDWizard",
|
|
40
34
|
"DocumentationWizard",
|
|
41
|
-
"
|
|
35
|
+
"LocalizationWizard",
|
|
42
36
|
"MigrationWizard",
|
|
43
37
|
"MonitoringWizard",
|
|
44
|
-
"
|
|
38
|
+
"ObservabilityWizard",
|
|
39
|
+
"PerformanceWizard",
|
|
45
40
|
"PromptEngineeringWizard",
|
|
41
|
+
"RefactoringWizard",
|
|
42
|
+
"ScalingWizard",
|
|
43
|
+
"SecurityWizard",
|
|
44
|
+
"TestingWizard",
|
|
46
45
|
]
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
AccessibilityWizard - Web accessibility (WCAG) compliance
|
|
1
|
+
"""AccessibilityWizard - Web accessibility (WCAG) compliance
|
|
3
2
|
|
|
4
3
|
Level 4 Anticipatory Empathy for Accessibility using the Empathy Framework.
|
|
5
4
|
|
|
@@ -13,8 +12,7 @@ from .base_wizard import BaseCoachWizard, WizardIssue, WizardPrediction
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
class AccessibilityWizard(BaseCoachWizard):
|
|
16
|
-
"""
|
|
17
|
-
Web accessibility (WCAG) compliance
|
|
15
|
+
"""Web accessibility (WCAG) compliance
|
|
18
16
|
|
|
19
17
|
Detects:
|
|
20
18
|
- missing alt text
|
|
@@ -36,8 +34,7 @@ class AccessibilityWizard(BaseCoachWizard):
|
|
|
36
34
|
)
|
|
37
35
|
|
|
38
36
|
def analyze_code(self, code: str, file_path: str, language: str) -> list[WizardIssue]:
|
|
39
|
-
"""
|
|
40
|
-
Analyze code for accessibility issues
|
|
37
|
+
"""Analyze code for accessibility issues
|
|
41
38
|
|
|
42
39
|
This is a reference implementation. In production, integrate with:
|
|
43
40
|
- Static analysis tools
|
|
@@ -57,10 +54,13 @@ class AccessibilityWizard(BaseCoachWizard):
|
|
|
57
54
|
return issues
|
|
58
55
|
|
|
59
56
|
def predict_future_issues(
|
|
60
|
-
self,
|
|
57
|
+
self,
|
|
58
|
+
code: str,
|
|
59
|
+
file_path: str,
|
|
60
|
+
project_context: dict[str, Any],
|
|
61
|
+
timeline_days: int = 90,
|
|
61
62
|
) -> list[WizardPrediction]:
|
|
62
|
-
"""
|
|
63
|
-
Level 4 Anticipatory: Predict accessibility issues {timeline_days} days ahead
|
|
63
|
+
"""Level 4 Anticipatory: Predict accessibility issues {timeline_days} days ahead
|
|
64
64
|
|
|
65
65
|
Uses:
|
|
66
66
|
- Historical patterns
|
|
@@ -76,16 +76,16 @@ class AccessibilityWizard(BaseCoachWizard):
|
|
|
76
76
|
|
|
77
77
|
self.logger.info(
|
|
78
78
|
f"{self.name} predicted {len(predictions)} future issues "
|
|
79
|
-
f"for {file_path} ({timeline_days} days ahead)"
|
|
79
|
+
f"for {file_path} ({timeline_days} days ahead)",
|
|
80
80
|
)
|
|
81
81
|
return predictions
|
|
82
82
|
|
|
83
83
|
def suggest_fixes(self, issue: WizardIssue) -> str:
|
|
84
|
-
"""
|
|
85
|
-
Suggest how to fix a accessibility issue
|
|
84
|
+
"""Suggest how to fix a accessibility issue
|
|
86
85
|
|
|
87
86
|
Returns:
|
|
88
87
|
Detailed fix suggestion with code examples
|
|
88
|
+
|
|
89
89
|
"""
|
|
90
90
|
# Implementation depends on issue type
|
|
91
91
|
return f"Fix suggestion for {issue.category} issue: {issue.message}"
|
coach_wizards/api_wizard.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
APIWizard - API design and integration analysis
|
|
1
|
+
"""APIWizard - API design and integration analysis
|
|
3
2
|
|
|
4
3
|
Level 4 Anticipatory Empathy for API using the Empathy Framework.
|
|
5
4
|
|
|
@@ -13,8 +12,7 @@ from .base_wizard import BaseCoachWizard, WizardIssue, WizardPrediction
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
class APIWizard(BaseCoachWizard):
|
|
16
|
-
"""
|
|
17
|
-
API design and integration analysis
|
|
15
|
+
"""API design and integration analysis
|
|
18
16
|
|
|
19
17
|
Detects:
|
|
20
18
|
- inconsistent endpoints
|
|
@@ -36,8 +34,7 @@ class APIWizard(BaseCoachWizard):
|
|
|
36
34
|
)
|
|
37
35
|
|
|
38
36
|
def analyze_code(self, code: str, file_path: str, language: str) -> list[WizardIssue]:
|
|
39
|
-
"""
|
|
40
|
-
Analyze code for api issues
|
|
37
|
+
"""Analyze code for api issues
|
|
41
38
|
|
|
42
39
|
This is a reference implementation. In production, integrate with:
|
|
43
40
|
- Static analysis tools
|
|
@@ -57,10 +54,13 @@ class APIWizard(BaseCoachWizard):
|
|
|
57
54
|
return issues
|
|
58
55
|
|
|
59
56
|
def predict_future_issues(
|
|
60
|
-
self,
|
|
57
|
+
self,
|
|
58
|
+
code: str,
|
|
59
|
+
file_path: str,
|
|
60
|
+
project_context: dict[str, Any],
|
|
61
|
+
timeline_days: int = 90,
|
|
61
62
|
) -> list[WizardPrediction]:
|
|
62
|
-
"""
|
|
63
|
-
Level 4 Anticipatory: Predict api issues {timeline_days} days ahead
|
|
63
|
+
"""Level 4 Anticipatory: Predict api issues {timeline_days} days ahead
|
|
64
64
|
|
|
65
65
|
Uses:
|
|
66
66
|
- Historical patterns
|
|
@@ -76,16 +76,16 @@ class APIWizard(BaseCoachWizard):
|
|
|
76
76
|
|
|
77
77
|
self.logger.info(
|
|
78
78
|
f"{self.name} predicted {len(predictions)} future issues "
|
|
79
|
-
f"for {file_path} ({timeline_days} days ahead)"
|
|
79
|
+
f"for {file_path} ({timeline_days} days ahead)",
|
|
80
80
|
)
|
|
81
81
|
return predictions
|
|
82
82
|
|
|
83
83
|
def suggest_fixes(self, issue: WizardIssue) -> str:
|
|
84
|
-
"""
|
|
85
|
-
Suggest how to fix a api issue
|
|
84
|
+
"""Suggest how to fix a api issue
|
|
86
85
|
|
|
87
86
|
Returns:
|
|
88
87
|
Detailed fix suggestion with code examples
|
|
88
|
+
|
|
89
89
|
"""
|
|
90
90
|
# Implementation depends on issue type
|
|
91
91
|
return f"Fix suggestion for {issue.category} issue: {issue.message}"
|