empathy-framework 3.7.0__py3-none-any.whl → 3.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.
Files changed (267) hide show
  1. coach_wizards/code_reviewer_README.md +60 -0
  2. coach_wizards/code_reviewer_wizard.py +180 -0
  3. {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/METADATA +20 -2
  4. empathy_framework-3.7.1.dist-info/RECORD +327 -0
  5. {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/top_level.txt +5 -1
  6. empathy_healthcare_plugin/monitors/__init__.py +9 -0
  7. empathy_healthcare_plugin/monitors/clinical_protocol_monitor.py +315 -0
  8. empathy_healthcare_plugin/monitors/monitoring/__init__.py +44 -0
  9. empathy_healthcare_plugin/monitors/monitoring/protocol_checker.py +300 -0
  10. empathy_healthcare_plugin/monitors/monitoring/protocol_loader.py +214 -0
  11. empathy_healthcare_plugin/monitors/monitoring/sensor_parsers.py +306 -0
  12. empathy_healthcare_plugin/monitors/monitoring/trajectory_analyzer.py +389 -0
  13. empathy_llm_toolkit/agent_factory/__init__.py +53 -0
  14. empathy_llm_toolkit/agent_factory/adapters/__init__.py +85 -0
  15. empathy_llm_toolkit/agent_factory/adapters/autogen_adapter.py +312 -0
  16. empathy_llm_toolkit/agent_factory/adapters/crewai_adapter.py +454 -0
  17. empathy_llm_toolkit/agent_factory/adapters/haystack_adapter.py +298 -0
  18. empathy_llm_toolkit/agent_factory/adapters/langchain_adapter.py +362 -0
  19. empathy_llm_toolkit/agent_factory/adapters/langgraph_adapter.py +333 -0
  20. empathy_llm_toolkit/agent_factory/adapters/native.py +228 -0
  21. empathy_llm_toolkit/agent_factory/adapters/wizard_adapter.py +426 -0
  22. empathy_llm_toolkit/agent_factory/base.py +305 -0
  23. empathy_llm_toolkit/agent_factory/crews/__init__.py +67 -0
  24. empathy_llm_toolkit/agent_factory/crews/code_review.py +1113 -0
  25. empathy_llm_toolkit/agent_factory/crews/health_check.py +1246 -0
  26. empathy_llm_toolkit/agent_factory/crews/refactoring.py +1128 -0
  27. empathy_llm_toolkit/agent_factory/crews/security_audit.py +1018 -0
  28. empathy_llm_toolkit/agent_factory/decorators.py +286 -0
  29. empathy_llm_toolkit/agent_factory/factory.py +558 -0
  30. empathy_llm_toolkit/agent_factory/framework.py +192 -0
  31. empathy_llm_toolkit/agent_factory/memory_integration.py +324 -0
  32. empathy_llm_toolkit/agent_factory/resilient.py +320 -0
  33. empathy_llm_toolkit/cli/__init__.py +8 -0
  34. empathy_llm_toolkit/cli/sync_claude.py +487 -0
  35. empathy_llm_toolkit/code_health.py +150 -3
  36. empathy_llm_toolkit/config/__init__.py +29 -0
  37. empathy_llm_toolkit/config/unified.py +295 -0
  38. empathy_llm_toolkit/routing/__init__.py +32 -0
  39. empathy_llm_toolkit/routing/model_router.py +362 -0
  40. empathy_llm_toolkit/security/IMPLEMENTATION_SUMMARY.md +413 -0
  41. empathy_llm_toolkit/security/PHASE2_COMPLETE.md +384 -0
  42. empathy_llm_toolkit/security/PHASE2_SECRETS_DETECTOR_COMPLETE.md +271 -0
  43. empathy_llm_toolkit/security/QUICK_REFERENCE.md +316 -0
  44. empathy_llm_toolkit/security/README.md +262 -0
  45. empathy_llm_toolkit/security/__init__.py +62 -0
  46. empathy_llm_toolkit/security/audit_logger.py +929 -0
  47. empathy_llm_toolkit/security/audit_logger_example.py +152 -0
  48. empathy_llm_toolkit/security/pii_scrubber.py +640 -0
  49. empathy_llm_toolkit/security/secrets_detector.py +678 -0
  50. empathy_llm_toolkit/security/secrets_detector_example.py +304 -0
  51. empathy_llm_toolkit/security/secure_memdocs.py +1192 -0
  52. empathy_llm_toolkit/security/secure_memdocs_example.py +278 -0
  53. empathy_llm_toolkit/wizards/__init__.py +38 -0
  54. empathy_llm_toolkit/wizards/base_wizard.py +364 -0
  55. empathy_llm_toolkit/wizards/customer_support_wizard.py +190 -0
  56. empathy_llm_toolkit/wizards/healthcare_wizard.py +362 -0
  57. empathy_llm_toolkit/wizards/patient_assessment_README.md +64 -0
  58. empathy_llm_toolkit/wizards/patient_assessment_wizard.py +193 -0
  59. empathy_llm_toolkit/wizards/technology_wizard.py +194 -0
  60. empathy_os/__init__.py +52 -52
  61. empathy_os/adaptive/__init__.py +13 -0
  62. empathy_os/adaptive/task_complexity.py +127 -0
  63. empathy_os/cli.py +118 -8
  64. empathy_os/cli_unified.py +121 -1
  65. empathy_os/config/__init__.py +63 -0
  66. empathy_os/config/xml_config.py +239 -0
  67. empathy_os/dashboard/__init__.py +15 -0
  68. empathy_os/dashboard/server.py +743 -0
  69. empathy_os/memory/__init__.py +195 -0
  70. empathy_os/memory/claude_memory.py +466 -0
  71. empathy_os/memory/config.py +224 -0
  72. empathy_os/memory/control_panel.py +1298 -0
  73. empathy_os/memory/edges.py +179 -0
  74. empathy_os/memory/graph.py +567 -0
  75. empathy_os/memory/long_term.py +1193 -0
  76. empathy_os/memory/nodes.py +179 -0
  77. empathy_os/memory/redis_bootstrap.py +540 -0
  78. empathy_os/memory/security/__init__.py +31 -0
  79. empathy_os/memory/security/audit_logger.py +930 -0
  80. empathy_os/memory/security/pii_scrubber.py +640 -0
  81. empathy_os/memory/security/secrets_detector.py +678 -0
  82. empathy_os/memory/short_term.py +2119 -0
  83. empathy_os/memory/storage/__init__.py +15 -0
  84. empathy_os/memory/summary_index.py +583 -0
  85. empathy_os/memory/unified.py +619 -0
  86. empathy_os/metrics/__init__.py +12 -0
  87. empathy_os/metrics/prompt_metrics.py +190 -0
  88. empathy_os/models/__init__.py +136 -0
  89. empathy_os/models/__main__.py +13 -0
  90. empathy_os/models/cli.py +655 -0
  91. empathy_os/models/empathy_executor.py +354 -0
  92. empathy_os/models/executor.py +252 -0
  93. empathy_os/models/fallback.py +671 -0
  94. empathy_os/models/provider_config.py +563 -0
  95. empathy_os/models/registry.py +382 -0
  96. empathy_os/models/tasks.py +302 -0
  97. empathy_os/models/telemetry.py +548 -0
  98. empathy_os/models/token_estimator.py +378 -0
  99. empathy_os/models/validation.py +274 -0
  100. empathy_os/monitoring/__init__.py +52 -0
  101. empathy_os/monitoring/alerts.py +23 -0
  102. empathy_os/monitoring/alerts_cli.py +268 -0
  103. empathy_os/monitoring/multi_backend.py +271 -0
  104. empathy_os/monitoring/otel_backend.py +363 -0
  105. empathy_os/optimization/__init__.py +19 -0
  106. empathy_os/optimization/context_optimizer.py +272 -0
  107. empathy_os/plugins/__init__.py +28 -0
  108. empathy_os/plugins/base.py +361 -0
  109. empathy_os/plugins/registry.py +268 -0
  110. empathy_os/project_index/__init__.py +30 -0
  111. empathy_os/project_index/cli.py +335 -0
  112. empathy_os/project_index/crew_integration.py +430 -0
  113. empathy_os/project_index/index.py +425 -0
  114. empathy_os/project_index/models.py +501 -0
  115. empathy_os/project_index/reports.py +473 -0
  116. empathy_os/project_index/scanner.py +538 -0
  117. empathy_os/prompts/__init__.py +61 -0
  118. empathy_os/prompts/config.py +77 -0
  119. empathy_os/prompts/context.py +177 -0
  120. empathy_os/prompts/parser.py +285 -0
  121. empathy_os/prompts/registry.py +313 -0
  122. empathy_os/prompts/templates.py +208 -0
  123. empathy_os/resilience/__init__.py +56 -0
  124. empathy_os/resilience/circuit_breaker.py +256 -0
  125. empathy_os/resilience/fallback.py +179 -0
  126. empathy_os/resilience/health.py +300 -0
  127. empathy_os/resilience/retry.py +209 -0
  128. empathy_os/resilience/timeout.py +135 -0
  129. empathy_os/routing/__init__.py +43 -0
  130. empathy_os/routing/chain_executor.py +433 -0
  131. empathy_os/routing/classifier.py +217 -0
  132. empathy_os/routing/smart_router.py +234 -0
  133. empathy_os/routing/wizard_registry.py +307 -0
  134. empathy_os/trust/__init__.py +28 -0
  135. empathy_os/trust/circuit_breaker.py +579 -0
  136. empathy_os/validation/__init__.py +19 -0
  137. empathy_os/validation/xml_validator.py +281 -0
  138. empathy_os/wizard_factory_cli.py +170 -0
  139. empathy_os/workflows/__init__.py +360 -0
  140. empathy_os/workflows/base.py +1530 -0
  141. empathy_os/workflows/bug_predict.py +962 -0
  142. empathy_os/workflows/code_review.py +960 -0
  143. empathy_os/workflows/code_review_adapters.py +310 -0
  144. empathy_os/workflows/code_review_pipeline.py +720 -0
  145. empathy_os/workflows/config.py +600 -0
  146. empathy_os/workflows/dependency_check.py +648 -0
  147. empathy_os/workflows/document_gen.py +1069 -0
  148. empathy_os/workflows/documentation_orchestrator.py +1205 -0
  149. empathy_os/workflows/health_check.py +679 -0
  150. empathy_os/workflows/keyboard_shortcuts/__init__.py +39 -0
  151. empathy_os/workflows/keyboard_shortcuts/generators.py +386 -0
  152. empathy_os/workflows/keyboard_shortcuts/parsers.py +414 -0
  153. empathy_os/workflows/keyboard_shortcuts/prompts.py +295 -0
  154. empathy_os/workflows/keyboard_shortcuts/schema.py +193 -0
  155. empathy_os/workflows/keyboard_shortcuts/workflow.py +505 -0
  156. empathy_os/workflows/manage_documentation.py +804 -0
  157. empathy_os/workflows/new_sample_workflow1.py +146 -0
  158. empathy_os/workflows/new_sample_workflow1_README.md +150 -0
  159. empathy_os/workflows/perf_audit.py +687 -0
  160. empathy_os/workflows/pr_review.py +748 -0
  161. empathy_os/workflows/progress.py +445 -0
  162. empathy_os/workflows/progress_server.py +322 -0
  163. empathy_os/workflows/refactor_plan.py +691 -0
  164. empathy_os/workflows/release_prep.py +808 -0
  165. empathy_os/workflows/research_synthesis.py +404 -0
  166. empathy_os/workflows/secure_release.py +585 -0
  167. empathy_os/workflows/security_adapters.py +297 -0
  168. empathy_os/workflows/security_audit.py +1050 -0
  169. empathy_os/workflows/step_config.py +234 -0
  170. empathy_os/workflows/test5.py +125 -0
  171. empathy_os/workflows/test5_README.md +158 -0
  172. empathy_os/workflows/test_gen.py +1855 -0
  173. empathy_os/workflows/test_lifecycle.py +526 -0
  174. empathy_os/workflows/test_maintenance.py +626 -0
  175. empathy_os/workflows/test_maintenance_cli.py +590 -0
  176. empathy_os/workflows/test_maintenance_crew.py +821 -0
  177. empathy_os/workflows/xml_enhanced_crew.py +285 -0
  178. empathy_software_plugin/cli/__init__.py +120 -0
  179. empathy_software_plugin/cli/inspect.py +362 -0
  180. empathy_software_plugin/cli.py +3 -1
  181. empathy_software_plugin/wizards/__init__.py +42 -0
  182. empathy_software_plugin/wizards/advanced_debugging_wizard.py +392 -0
  183. empathy_software_plugin/wizards/agent_orchestration_wizard.py +511 -0
  184. empathy_software_plugin/wizards/ai_collaboration_wizard.py +503 -0
  185. empathy_software_plugin/wizards/ai_context_wizard.py +441 -0
  186. empathy_software_plugin/wizards/ai_documentation_wizard.py +503 -0
  187. empathy_software_plugin/wizards/base_wizard.py +288 -0
  188. empathy_software_plugin/wizards/book_chapter_wizard.py +519 -0
  189. empathy_software_plugin/wizards/code_review_wizard.py +606 -0
  190. empathy_software_plugin/wizards/debugging/__init__.py +50 -0
  191. empathy_software_plugin/wizards/debugging/bug_risk_analyzer.py +414 -0
  192. empathy_software_plugin/wizards/debugging/config_loaders.py +442 -0
  193. empathy_software_plugin/wizards/debugging/fix_applier.py +469 -0
  194. empathy_software_plugin/wizards/debugging/language_patterns.py +383 -0
  195. empathy_software_plugin/wizards/debugging/linter_parsers.py +470 -0
  196. empathy_software_plugin/wizards/debugging/verification.py +369 -0
  197. empathy_software_plugin/wizards/enhanced_testing_wizard.py +537 -0
  198. empathy_software_plugin/wizards/memory_enhanced_debugging_wizard.py +816 -0
  199. empathy_software_plugin/wizards/multi_model_wizard.py +501 -0
  200. empathy_software_plugin/wizards/pattern_extraction_wizard.py +422 -0
  201. empathy_software_plugin/wizards/pattern_retriever_wizard.py +400 -0
  202. empathy_software_plugin/wizards/performance/__init__.py +9 -0
  203. empathy_software_plugin/wizards/performance/bottleneck_detector.py +221 -0
  204. empathy_software_plugin/wizards/performance/profiler_parsers.py +278 -0
  205. empathy_software_plugin/wizards/performance/trajectory_analyzer.py +429 -0
  206. empathy_software_plugin/wizards/performance_profiling_wizard.py +305 -0
  207. empathy_software_plugin/wizards/prompt_engineering_wizard.py +425 -0
  208. empathy_software_plugin/wizards/rag_pattern_wizard.py +461 -0
  209. empathy_software_plugin/wizards/security/__init__.py +32 -0
  210. empathy_software_plugin/wizards/security/exploit_analyzer.py +290 -0
  211. empathy_software_plugin/wizards/security/owasp_patterns.py +241 -0
  212. empathy_software_plugin/wizards/security/vulnerability_scanner.py +604 -0
  213. empathy_software_plugin/wizards/security_analysis_wizard.py +322 -0
  214. empathy_software_plugin/wizards/security_learning_wizard.py +740 -0
  215. empathy_software_plugin/wizards/tech_debt_wizard.py +726 -0
  216. empathy_software_plugin/wizards/testing/__init__.py +27 -0
  217. empathy_software_plugin/wizards/testing/coverage_analyzer.py +459 -0
  218. empathy_software_plugin/wizards/testing/quality_analyzer.py +531 -0
  219. empathy_software_plugin/wizards/testing/test_suggester.py +533 -0
  220. empathy_software_plugin/wizards/testing_wizard.py +274 -0
  221. hot_reload/README.md +473 -0
  222. hot_reload/__init__.py +62 -0
  223. hot_reload/config.py +84 -0
  224. hot_reload/integration.py +228 -0
  225. hot_reload/reloader.py +298 -0
  226. hot_reload/watcher.py +179 -0
  227. hot_reload/websocket.py +176 -0
  228. scaffolding/README.md +589 -0
  229. scaffolding/__init__.py +35 -0
  230. scaffolding/__main__.py +14 -0
  231. scaffolding/cli.py +240 -0
  232. test_generator/__init__.py +38 -0
  233. test_generator/__main__.py +14 -0
  234. test_generator/cli.py +226 -0
  235. test_generator/generator.py +325 -0
  236. test_generator/risk_analyzer.py +216 -0
  237. workflow_patterns/__init__.py +33 -0
  238. workflow_patterns/behavior.py +249 -0
  239. workflow_patterns/core.py +76 -0
  240. workflow_patterns/output.py +99 -0
  241. workflow_patterns/registry.py +255 -0
  242. workflow_patterns/structural.py +288 -0
  243. workflow_scaffolding/__init__.py +11 -0
  244. workflow_scaffolding/__main__.py +12 -0
  245. workflow_scaffolding/cli.py +206 -0
  246. workflow_scaffolding/generator.py +265 -0
  247. agents/code_inspection/patterns/inspection/recurring_B112.json +0 -18
  248. agents/code_inspection/patterns/inspection/recurring_F541.json +0 -16
  249. agents/code_inspection/patterns/inspection/recurring_FORMAT.json +0 -25
  250. agents/code_inspection/patterns/inspection/recurring_bug_20250822_def456.json +0 -16
  251. agents/code_inspection/patterns/inspection/recurring_bug_20250915_abc123.json +0 -16
  252. agents/code_inspection/patterns/inspection/recurring_bug_20251212_3c5b9951.json +0 -16
  253. agents/code_inspection/patterns/inspection/recurring_bug_20251212_97c0f72f.json +0 -16
  254. agents/code_inspection/patterns/inspection/recurring_bug_20251212_a0871d53.json +0 -16
  255. agents/code_inspection/patterns/inspection/recurring_bug_20251212_a9b6ec41.json +0 -16
  256. agents/code_inspection/patterns/inspection/recurring_bug_null_001.json +0 -16
  257. agents/code_inspection/patterns/inspection/recurring_builtin.json +0 -16
  258. agents/compliance_anticipation_agent.py +0 -1422
  259. agents/compliance_db.py +0 -339
  260. agents/epic_integration_wizard.py +0 -530
  261. agents/notifications.py +0 -291
  262. agents/trust_building_behaviors.py +0 -872
  263. empathy_framework-3.7.0.dist-info/RECORD +0 -105
  264. {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/WHEEL +0 -0
  265. {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/entry_points.txt +0 -0
  266. {empathy_framework-3.7.0.dist-info → empathy_framework-3.7.1.dist-info}/licenses/LICENSE +0 -0
  267. /empathy_os/{monitoring.py → agent_monitoring.py} +0 -0
@@ -1,872 +0,0 @@
1
- """Trust-Building Behaviors for Level 4 Anticipatory Agents
2
-
3
- Implements team dynamics that build trust through anticipatory actions:
4
- - Pre-format data for handoffs (reduce cognitive load for next person)
5
- - Clarify confusing instructions before execution (prevent wasted effort)
6
- - Volunteer structure during stress (not pep talks, actual scaffolding)
7
- - Proactively offer help when teammates are struggling
8
-
9
- These behaviors demonstrate Level 4 Anticipatory Empathy by:
10
- 1. Predicting friction points (handoffs, confusion, stress, overload)
11
- 2. Acting without being asked (but without overstepping)
12
- 3. Providing structural relief (not just emotional support)
13
- 4. Building trust through consistent, helpful actions
14
-
15
- Copyright 2025 Smart AI Memory, LLC
16
- Licensed under Fair Source 0.9
17
- """
18
-
19
- import logging
20
- from datetime import datetime
21
-
22
- logger = logging.getLogger(__name__)
23
-
24
-
25
- class TrustBuildingBehaviors:
26
- """Level 4 Anticipatory trust-building behaviors
27
-
28
- Philosophy: Trust is earned through consistent, helpful actions that
29
- demonstrate understanding of team dynamics and proactive problem-solving.
30
- """
31
-
32
- @staticmethod
33
- def pre_format_for_handoff(data: dict, next_person_role: str, context: str) -> dict:
34
- """Scenario: Handoff Risk
35
- Anticipatory Response: Pre-format the data so next person doesn't waste time
36
-
37
- Example:
38
- - Raw compliance data → Formatted summary for charge nurse
39
- - Gap list → Prioritized action items with assignments
40
- - Assessment results → Executive dashboard for manager
41
-
42
- Trust Built:
43
- - "This AI understands my workflow"
44
- - "I don't have to translate data myself"
45
- - "My time is valued"
46
-
47
- """
48
- logger.info(f"Pre-formatting data for handoff to {next_person_role}")
49
-
50
- # Determine format based on recipient role
51
- if next_person_role == "charge_nurse":
52
- # Charge nurses need: Quick scan, action items, patient IDs
53
- formatted = {
54
- "format": "action_oriented",
55
- "summary": {
56
- "critical_actions": [
57
- item
58
- for item in data.get("action_items", [])
59
- if item.get("severity") == "critical"
60
- ],
61
- "high_priority_actions": [
62
- item
63
- for item in data.get("action_items", [])
64
- if item.get("severity") == "high"
65
- ],
66
- "patient_ids_affected": list(
67
- {
68
- pid
69
- for gap in data.get("compliance_gaps", [])
70
- for pid in gap.get("patient_ids", [])
71
- },
72
- ),
73
- "estimated_total_time": sum(
74
- int(item.get("estimated_time", "0 minutes").split()[0])
75
- for item in data.get("action_items", [])
76
- if item.get("estimated_time", "").split()[0].isdigit()
77
- ),
78
- },
79
- "quick_scan_view": {
80
- "red_flags": [
81
- gap
82
- for gap in data.get("compliance_gaps", [])
83
- if gap.get("severity") in ["critical", "high"]
84
- ],
85
- "compliance_percentage": data.get("compliance_percentage", 0),
86
- "days_until_audit": data.get("days_until_audit", 0),
87
- },
88
- "reasoning": (
89
- "Pre-formatted for charge nurse workflow: "
90
- "critical items first, patient IDs for chart review, "
91
- "time estimate for shift planning"
92
- ),
93
- }
94
-
95
- elif next_person_role == "nurse_manager":
96
- # Managers need: Trends, resource allocation, escalation path
97
- formatted = {
98
- "format": "strategic_overview",
99
- "summary": {
100
- "compliance_trend": data.get("compliance_trend", "unknown"),
101
- "category_performance": data.get("category_scores", {}),
102
- "resource_needs": {
103
- "staff_time_required": f"{data.get('estimated_total_time', 0)} minutes",
104
- "external_resources": [
105
- (
106
- "Provider orders"
107
- if any(
108
- "provider" in item.get("assignee", "")
109
- for item in data.get("action_items", [])
110
- )
111
- else None
112
- ),
113
- ],
114
- },
115
- "escalation_needed": len(
116
- [
117
- g
118
- for g in data.get("compliance_gaps", [])
119
- if g.get("severity") == "critical"
120
- ],
121
- )
122
- > 2,
123
- },
124
- "reasoning": (
125
- "Pre-formatted for manager workflow: "
126
- "strategic view, resource allocation, escalation triggers"
127
- ),
128
- }
129
-
130
- elif next_person_role == "cno":
131
- # CNO needs: Executive summary, risk assessment, board reporting
132
- formatted = {
133
- "format": "executive_summary",
134
- "summary": {
135
- "audit_readiness_score": data.get("audit_readiness_score", 0),
136
- "risk_level": calculate_risk_level(data),
137
- "board_talking_points": [
138
- f"Overall compliance: {data.get('compliance_percentage', 0):.1f}%",
139
- f"Audit in {data.get('days_until_audit', 0)} days",
140
- f"{len(data.get('compliance_gaps', []))} gaps identified proactively",
141
- "Remediation plan in place (target: 2 weeks before audit)",
142
- ],
143
- "legal_risk_summary": {
144
- "high_risk_items": len(
145
- [
146
- g
147
- for g in data.get("compliance_gaps", [])
148
- if g.get("legal_risk") == "high"
149
- ],
150
- ),
151
- "can_fix_before_audit": all(
152
- g.get("can_fix_retroactively", True)
153
- for g in data.get("compliance_gaps", [])
154
- ),
155
- },
156
- },
157
- "reasoning": (
158
- "Pre-formatted for executive workflow: "
159
- "board-ready summary, legal risk assessment, organizational impact"
160
- ),
161
- }
162
-
163
- else:
164
- # Default: Structured but general format
165
- formatted = {
166
- "format": "general_structured",
167
- "summary": data,
168
- "reasoning": "General structured format (no role-specific optimization)",
169
- }
170
-
171
- # Add metadata
172
- formatted["handoff_metadata"] = {
173
- "formatted_for": next_person_role,
174
- "formatted_at": datetime.now().isoformat(),
175
- "context": context,
176
- "trust_building_behavior": "pre_format_for_handoff",
177
- }
178
-
179
- logger.info(f"Data formatted in {formatted['format']} style for {next_person_role}")
180
-
181
- return formatted
182
-
183
- @staticmethod
184
- def clarify_before_execution(
185
- instruction: str,
186
- context: dict,
187
- confidence_threshold: float = 0.8,
188
- ) -> dict:
189
- """Scenario: Confusing Instructions
190
- Anticipatory Response: Clarify and summarize before execution
191
-
192
- Example:
193
- - Vague request → Ask calibrated questions (Voss's tactical empathy)
194
- - Ambiguous scope → Propose interpretation, request confirmation
195
- - Missing context → Surface assumptions, verify before proceeding
196
-
197
- Trust Built:
198
- - "This AI doesn't waste my time on wrong implementations"
199
- - "It's safe to give rough instructions"
200
- - "We're collaborating, not just transacting"
201
-
202
- """
203
- logger.info(f"Analyzing instruction clarity: '{instruction[:50]}...'")
204
-
205
- # Analyze instruction for ambiguity
206
- ambiguity_signals = detect_ambiguity(instruction, context)
207
-
208
- if ambiguity_signals["clarity_score"] >= confidence_threshold:
209
- # Clear instruction, proceed
210
- return {
211
- "action": "proceed",
212
- "clarification_needed": False,
213
- "interpretation": instruction,
214
- "confidence": ambiguity_signals["clarity_score"],
215
- "reasoning": "Instruction is clear, proceeding with execution",
216
- }
217
-
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
- }
234
-
235
- @staticmethod
236
- def volunteer_structure_during_stress(team_state: dict, stress_indicators: dict) -> dict | None:
237
- """Scenario: Team Stress Rising
238
- Anticipatory Response: Volunteer structure, not pep talks
239
-
240
- Example:
241
- - Audit in 2 weeks, multiple critical gaps → Propose prioritized timeline
242
- - Overlapping deadlines → Suggest task delegation framework
243
- - Information overload → Create structured dashboard/checklist
244
-
245
- Trust Built:
246
- - "This AI understands real problems"
247
- - "Structure relieves stress more than encouragement"
248
- - "Practical help, not performative support"
249
-
250
- """
251
- logger.info("Analyzing team stress indicators")
252
-
253
- # Detect stress level
254
- stress_level = calculate_stress_level(stress_indicators)
255
-
256
- if stress_level < 0.6:
257
- # No significant stress, no intervention needed
258
- return None
259
-
260
- # Identify stress source
261
- stress_sources = identify_stress_sources(team_state, stress_indicators)
262
-
263
- # Design structural intervention (not emotional support)
264
- structural_interventions = []
265
-
266
- for source in stress_sources:
267
- if source["type"] == "time_pressure":
268
- # Volunteer: Prioritized timeline
269
- structural_interventions.append(
270
- {
271
- "intervention_type": "timeline_structure",
272
- "structure": create_prioritized_timeline(team_state, source),
273
- "benefit": "Clarifies what must be done when → reduces decision paralysis",
274
- "not_this": "⛔ Pep talk: 'You can do this! Stay positive!'",
275
- },
276
- )
277
-
278
- elif source["type"] == "task_overload":
279
- # Volunteer: Task delegation framework
280
- structural_interventions.append(
281
- {
282
- "intervention_type": "delegation_framework",
283
- "structure": create_delegation_framework(team_state, source),
284
- "benefit": "Distributes workload clearly → prevents burnout",
285
- "not_this": "⛔ Pep talk: 'Just push through!'",
286
- },
287
- )
288
-
289
- elif source["type"] == "information_overload":
290
- # Volunteer: Structured dashboard
291
- structural_interventions.append(
292
- {
293
- "intervention_type": "information_structure",
294
- "structure": create_decision_dashboard(team_state, source),
295
- "benefit": "Surfaces critical info only → reduces cognitive load",
296
- "not_this": "⛔ Pep talk: 'Focus on what matters!'",
297
- },
298
- )
299
-
300
- elif source["type"] == "unclear_priorities":
301
- # Volunteer: Decision matrix
302
- structural_interventions.append(
303
- {
304
- "intervention_type": "priority_matrix",
305
- "structure": create_priority_matrix(team_state, source),
306
- "benefit": "Makes trade-offs explicit → enables confident decisions",
307
- "not_this": "⛔ Pep talk: 'Trust your gut!'",
308
- },
309
- )
310
-
311
- if not structural_interventions:
312
- return None
313
-
314
- return {
315
- "stress_level": stress_level,
316
- "stress_sources": stress_sources,
317
- "structural_interventions": structural_interventions,
318
- "reasoning": (
319
- f"Detected stress level: {stress_level:.0%}. "
320
- f"Volunteering {len(structural_interventions)} structural interventions "
321
- "(not emotional support - structure relieves stress more effectively)."
322
- ),
323
- "message_to_team": compose_structure_offer(stress_level, structural_interventions),
324
- "trust_building_behavior": "volunteer_structure_during_stress",
325
- }
326
-
327
- @staticmethod
328
- def offer_help_to_struggling_teammate(
329
- teammate_state: dict,
330
- my_bandwidth: float = 0.7,
331
- ) -> dict | None:
332
- """Scenario: Silent Teammate Struggling
333
- Anticipatory Response: "I've got bandwidth—want me to take a slice of this?"
334
-
335
- Example:
336
- - Charge nurse with 12 action items → Offer to take 5 low-priority items
337
- - Manager preparing audit docs → Offer to generate first draft
338
- - Team member stuck on complex gap → Offer to research solutions
339
-
340
- Trust Built:
341
- - "This AI notices when I'm underwater"
342
- - "Offers concrete help, not vague support"
343
- - "Respects my autonomy (asks, doesn't assume)"
344
-
345
- """
346
- logger.info(f"Checking if teammate needs help (my bandwidth: {my_bandwidth:.0%})")
347
-
348
- # Detect if teammate is struggling
349
- struggle_indicators = detect_struggle(teammate_state)
350
-
351
- if struggle_indicators["struggle_score"] < 0.5:
352
- # Not struggling, no offer needed
353
- return None
354
-
355
- if my_bandwidth < 0.3:
356
- # I'm also overloaded, can't help right now
357
- return None
358
-
359
- # Identify specific tasks I could take
360
- tasks_i_can_help_with = []
361
-
362
- for task in teammate_state.get("tasks", []):
363
- if can_i_help_with_task(task, my_bandwidth):
364
- tasks_i_can_help_with.append(
365
- {
366
- "task_id": task["id"],
367
- "description": task["description"],
368
- "estimated_time": task["estimated_time"],
369
- "why_i_can_help": determine_help_rationale(task),
370
- "impact_on_teammate": estimate_relief(task, teammate_state),
371
- },
372
- )
373
-
374
- if not tasks_i_can_help_with:
375
- return None
376
-
377
- # Compose specific offer (not vague "let me know if you need help")
378
- return {
379
- "teammate_struggling": True,
380
- "struggle_score": struggle_indicators["struggle_score"],
381
- "struggle_indicators": struggle_indicators["indicators"],
382
- "my_available_bandwidth": my_bandwidth,
383
- "specific_help_offers": tasks_i_can_help_with,
384
- "reasoning": (
385
- f"Detected teammate struggle score: {struggle_indicators['struggle_score']:.0%}. "
386
- f"I have {my_bandwidth:.0%} bandwidth available. "
387
- f"Offering to take {len(tasks_i_can_help_with)} specific tasks."
388
- ),
389
- "message_to_teammate": compose_help_offer(
390
- tasks_i_can_help_with,
391
- my_bandwidth,
392
- struggle_indicators,
393
- ),
394
- "trust_building_behavior": "offer_help_to_struggling_teammate",
395
- }
396
-
397
-
398
- # =============================================================================
399
- # Helper Functions
400
- # =============================================================================
401
-
402
-
403
- def calculate_risk_level(data: dict) -> str:
404
- """Calculate overall risk level (low, medium, high, critical)"""
405
- compliance_pct = data.get("compliance_percentage", 100)
406
- critical_gaps = len(
407
- [g for g in data.get("compliance_gaps", []) if g.get("severity") == "critical"],
408
- )
409
- days_until = data.get("days_until_audit", 999)
410
-
411
- if critical_gaps > 0 or compliance_pct < 85:
412
- return "high"
413
- if compliance_pct < 90 or days_until < 30:
414
- return "medium"
415
- return "low"
416
-
417
-
418
- def detect_ambiguity(instruction: str, context: dict) -> dict:
419
- """Detect ambiguity in instruction
420
-
421
- Returns:
422
- clarity_score: 0.0-1.0 (1.0 = perfectly clear)
423
- ambiguities: List of detected ambiguities
424
- questions: Calibrated questions to clarify
425
- best_guess: Best interpretation if proceeding anyway
426
-
427
- """
428
- # Simple heuristic-based ambiguity detection
429
- # In production, could use NLP / LLM analysis
430
-
431
- ambiguities = []
432
- questions = []
433
-
434
- # Check for vague quantifiers
435
- vague_words = ["some", "a few", "several", "many", "most", "soon", "quickly"]
436
- for word in vague_words:
437
- if word in instruction.lower():
438
- ambiguities.append(f"Vague quantifier: '{word}'")
439
- if word in ["some", "a few", "several", "many"]:
440
- questions.append(f"How many specifically? (You said '{word}')")
441
- else:
442
- questions.append(f"What timeframe for '{word}'?")
443
-
444
- # Check for missing scope
445
- if "all" in instruction.lower() and "items" in instruction.lower():
446
- if not context.get("items_defined"):
447
- ambiguities.append("Scope unclear: 'all items' - which items?")
448
- questions.append("Which items specifically? (compliance gaps, action items, patients?)")
449
-
450
- # Check for missing context
451
- if "update" in instruction.lower() or "fix" in instruction.lower():
452
- if not context.get("target_defined"):
453
- ambiguities.append("Target unclear: what should be updated/fixed?")
454
- questions.append("What specifically should be updated/fixed?")
455
-
456
- # Calculate clarity score
457
- clarity_score = max(0.0, 1.0 - (len(ambiguities) * 0.2))
458
-
459
- return {
460
- "clarity_score": clarity_score,
461
- "ambiguities": ambiguities,
462
- "questions": questions,
463
- "best_guess": instruction, # In production, generate interpretation
464
- }
465
-
466
-
467
- def compose_clarification_request(instruction: str, ambiguity_signals: dict) -> str:
468
- """Compose user-friendly clarification request"""
469
- ambiguities_text = "\n".join(f"• {amb}" for amb in ambiguity_signals["ambiguities"])
470
- questions_text = "\n".join(
471
- f"{i + 1}. {q}" for i, q in enumerate(ambiguity_signals["questions"])
472
- )
473
-
474
- return f"""
475
- 🤔 **Clarification Needed (to prevent wasted effort)**
476
-
477
- Your instruction: "{instruction}"
478
-
479
- I want to make sure I understand correctly. I detected {len(ambiguity_signals["ambiguities"])} potential ambiguities:
480
-
481
- {ambiguities_text}
482
-
483
- **Could you clarify:**
484
- {questions_text}
485
-
486
- **My best guess:**
487
- {ambiguity_signals["best_guess"]}
488
-
489
- Is this what you meant? If so, I'll proceed. If not, please clarify and I'll adjust.
490
-
491
- _(This AI clarifies before executing to build trust through accurate work)_
492
- """.strip()
493
-
494
-
495
- def calculate_stress_level(stress_indicators: dict) -> float:
496
- """Calculate team stress level (0.0-1.0)
497
-
498
- Indicators:
499
- - Time pressure (days until deadline)
500
- - Task overload (tasks per person)
501
- - Complexity (critical items)
502
- - Uncertainty (missing information)
503
- """
504
- stress_factors = []
505
-
506
- # Time pressure
507
- days_until_deadline = stress_indicators.get("days_until_deadline", 999)
508
- if days_until_deadline < 30:
509
- time_stress = 1.0 - (days_until_deadline / 30)
510
- stress_factors.append(time_stress)
511
-
512
- # Task overload
513
- tasks_per_person = stress_indicators.get("tasks_per_person", 0)
514
- if tasks_per_person > 5:
515
- overload_stress = min(1.0, (tasks_per_person - 5) / 10)
516
- stress_factors.append(overload_stress)
517
-
518
- # Complexity
519
- critical_tasks = stress_indicators.get("critical_tasks", 0)
520
- if critical_tasks > 0:
521
- complexity_stress = min(1.0, critical_tasks / 5)
522
- stress_factors.append(complexity_stress)
523
-
524
- # Uncertainty
525
- missing_info_count = stress_indicators.get("missing_information", 0)
526
- if missing_info_count > 0:
527
- uncertainty_stress = min(1.0, missing_info_count / 5)
528
- stress_factors.append(uncertainty_stress)
529
-
530
- # Average stress level
531
- return sum(stress_factors) / len(stress_factors) if stress_factors else 0.0
532
-
533
-
534
- def identify_stress_sources(team_state: dict, stress_indicators: dict) -> list[dict]:
535
- """Identify specific sources of stress"""
536
- sources = []
537
-
538
- if stress_indicators.get("days_until_deadline", 999) < 30:
539
- sources.append(
540
- {
541
- "type": "time_pressure",
542
- "description": f"Only {stress_indicators['days_until_deadline']} days until deadline",
543
- "severity": ("high" if stress_indicators["days_until_deadline"] < 14 else "medium"),
544
- },
545
- )
546
-
547
- if stress_indicators.get("tasks_per_person", 0) > 5:
548
- sources.append(
549
- {
550
- "type": "task_overload",
551
- "description": f"{stress_indicators['tasks_per_person']} tasks per person",
552
- "severity": ("high" if stress_indicators["tasks_per_person"] > 10 else "medium"),
553
- },
554
- )
555
-
556
- if len(team_state.get("compliance_gaps", [])) > 10:
557
- sources.append(
558
- {
559
- "type": "information_overload",
560
- "description": f"{len(team_state['compliance_gaps'])} gaps to process",
561
- "severity": "medium",
562
- },
563
- )
564
-
565
- return sources
566
-
567
-
568
- def create_prioritized_timeline(team_state: dict, stress_source: dict) -> dict:
569
- """Create structured timeline to relieve time pressure"""
570
- return {
571
- "structure_type": "timeline",
572
- "phases": [
573
- {
574
- "phase": "CRITICAL (Days 1-3)",
575
- "focus": "Critical gaps only",
576
- "tasks": [
577
- t for t in team_state.get("action_items", []) if t.get("severity") == "critical"
578
- ],
579
- },
580
- {
581
- "phase": "HIGH PRIORITY (Days 4-7)",
582
- "focus": "High-severity gaps",
583
- "tasks": [
584
- t for t in team_state.get("action_items", []) if t.get("severity") == "high"
585
- ],
586
- },
587
- {
588
- "phase": "MEDIUM (Days 8-14)",
589
- "focus": "Medium-severity gaps",
590
- "tasks": [
591
- t for t in team_state.get("action_items", []) if t.get("severity") == "medium"
592
- ],
593
- },
594
- ],
595
- "reasoning": "Phased approach prevents overwhelm by clarifying daily priorities",
596
- }
597
-
598
-
599
- def create_delegation_framework(team_state: dict, stress_source: dict) -> dict:
600
- """Create task delegation structure"""
601
- return {
602
- "structure_type": "delegation_matrix",
603
- "assignments": {
604
- "charge_nurse": {
605
- "tasks": [
606
- t
607
- for t in team_state.get("action_items", [])
608
- if t.get("assignee") == "charge_nurse"
609
- ],
610
- "estimated_time": "X hours",
611
- "can_delegate_to": ["staff_nurses"],
612
- },
613
- "nurse_manager": {
614
- "tasks": [
615
- t
616
- for t in team_state.get("action_items", [])
617
- if t.get("assignee") == "nurse_manager"
618
- ],
619
- "estimated_time": "Y hours",
620
- "can_delegate_to": ["charge_nurse"],
621
- },
622
- },
623
- "reasoning": "Clear delegation prevents duplicate/missed work",
624
- }
625
-
626
-
627
- def create_decision_dashboard(team_state: dict, stress_source: dict) -> dict:
628
- """Create structured information dashboard"""
629
- return {
630
- "structure_type": "decision_dashboard",
631
- "critical_only_view": {
632
- "red_flags": [
633
- g for g in team_state.get("compliance_gaps", []) if g.get("severity") == "critical"
634
- ],
635
- "blocking_issues": [],
636
- "requires_immediate_action": [],
637
- },
638
- "reasoning": "Filters noise, surfaces only decision-critical information",
639
- }
640
-
641
-
642
- def create_priority_matrix(team_state: dict, stress_source: dict) -> dict:
643
- """Create priority decision matrix"""
644
- return {
645
- "structure_type": "priority_matrix",
646
- "dimensions": {
647
- "urgency": "Days until audit",
648
- "importance": "Legal risk + severity",
649
- "effort": "Time to fix",
650
- },
651
- "quadrants": {
652
- "do_first": "High urgency + High importance",
653
- "schedule": "Low urgency + High importance",
654
- "delegate": "High urgency + Low importance",
655
- "drop": "Low urgency + Low importance",
656
- },
657
- "reasoning": "Makes trade-offs explicit for confident prioritization",
658
- }
659
-
660
-
661
- def compose_structure_offer(stress_level: float, interventions: list[dict]) -> str:
662
- """Compose offer of structural help"""
663
- intervention_text = "\n".join(
664
- f"{i + 1}. **{interv['intervention_type'].replace('_', ' ').title()}**\n"
665
- f" → Benefit: {interv['benefit']}\n"
666
- f" → {interv['not_this']}"
667
- for i, interv in enumerate(interventions)
668
- )
669
-
670
- return f"""
671
- 💡 **Structural Support Available**
672
-
673
- I noticed team stress indicators ({stress_level:.0%}). Rather than pep talks, I've prepared {len(interventions)} structural interventions that might help:
674
-
675
- {intervention_text}
676
-
677
- **Would any of these structures be helpful?**
678
- (I'm volunteering structure, not advice—you decide if/how to use)
679
-
680
- _(Level 4 Anticipatory Empathy: Structure relieves stress more than encouragement)_
681
- """.strip()
682
-
683
-
684
- def detect_struggle(teammate_state: dict) -> dict:
685
- """Detect if teammate is struggling"""
686
- struggle_indicators = []
687
- struggle_score = 0.0
688
-
689
- # High task count
690
- task_count = len(teammate_state.get("tasks", []))
691
- if task_count > 10:
692
- struggle_indicators.append(f"High task count: {task_count} tasks")
693
- struggle_score += 0.3
694
-
695
- # Many critical tasks
696
- critical_count = len(
697
- [t for t in teammate_state.get("tasks", []) if t.get("severity") == "critical"],
698
- )
699
- if critical_count > 2:
700
- struggle_indicators.append(f"Multiple critical tasks: {critical_count}")
701
- struggle_score += 0.4
702
-
703
- # Tight deadlines
704
- urgent_deadlines = len(
705
- [t for t in teammate_state.get("tasks", []) if t.get("deadline_days", 999) < 3],
706
- )
707
- if urgent_deadlines > 0:
708
- struggle_indicators.append(f"Urgent deadlines: {urgent_deadlines} tasks due <3 days")
709
- struggle_score += 0.3
710
-
711
- return {
712
- "struggle_score": min(1.0, struggle_score),
713
- "indicators": struggle_indicators,
714
- }
715
-
716
-
717
- def can_i_help_with_task(task: dict, my_bandwidth: float) -> bool:
718
- """Determine if I can help with this task"""
719
- # I can help if:
720
- # 1. Task is not too complex (medium/low priority)
721
- # 2. Task doesn't require human judgment (can be automated)
722
- # 3. I have enough bandwidth
723
-
724
- if task.get("severity") == "critical":
725
- return False # Critical tasks need human oversight
726
-
727
- if task.get("requires_human_judgment", False):
728
- return False
729
-
730
- task_effort = estimate_task_effort(task)
731
- if task_effort > my_bandwidth:
732
- return False
733
-
734
- return True
735
-
736
-
737
- def estimate_task_effort(task: dict) -> float:
738
- """Estimate effort required for task (0.0-1.0 of bandwidth)"""
739
- estimated_time = task.get("estimated_time", "0 minutes")
740
- minutes = int(estimated_time.split()[0]) if estimated_time.split()[0].isdigit() else 0
741
-
742
- # Map minutes to bandwidth fraction
743
- if minutes < 15:
744
- return 0.1
745
- if minutes < 30:
746
- return 0.2
747
- if minutes < 60:
748
- return 0.3
749
- return 0.5
750
-
751
-
752
- def determine_help_rationale(task: dict) -> str:
753
- """Explain why I can help with this task"""
754
- if task.get("type") == "documentation":
755
- return "I can auto-generate documentation drafts"
756
- if task.get("type") == "data_gathering":
757
- return "I can collect and format data quickly"
758
- if task.get("type") == "analysis":
759
- return "I can run analysis and summarize results"
760
- return "I can automate repetitive parts of this task"
761
-
762
-
763
- def estimate_relief(task: dict, teammate_state: dict) -> str:
764
- """Estimate impact on teammate if I take this task"""
765
- task_time = estimate_task_effort(task)
766
- total_load = len(teammate_state.get("tasks", []))
767
-
768
- if total_load > 10:
769
- return f"Reduces your load by {(task_time / total_load * 100):.0f}% (meaningful relief)"
770
- return "Modest relief but every bit helps"
771
-
772
-
773
- def compose_help_offer(tasks: list[dict], bandwidth: float, struggle: dict) -> str:
774
- """Compose specific help offer to struggling teammate"""
775
- indicators_text = "\n".join(f"• {ind}" for ind in struggle["indicators"])
776
-
777
- tasks_text = "\n".join(
778
- f"{i + 1}. {task['description']}\n"
779
- f" → Why I can help: {task['why_i_can_help']}\n"
780
- f" → Impact: {task['impact_on_teammate']}\n"
781
- f" → Time: {task['estimated_time']}"
782
- for i, task in enumerate(tasks[:3])
783
- )
784
-
785
- more_tasks = f"... and {len(tasks) - 3} more tasks" if len(tasks) > 3 else ""
786
-
787
- return f"""
788
- 🤝 **I've Got Bandwidth—Want Me to Take a Slice?**
789
-
790
- I noticed you have {len(struggle["indicators"])} stress indicators:
791
- {indicators_text}
792
-
793
- I have {bandwidth:.0%} bandwidth available and could take these {len(tasks)} tasks off your plate:
794
-
795
- {tasks_text}
796
-
797
- {more_tasks}
798
-
799
- **Want me to take any of these?** (Your call—just offering concrete help)
800
-
801
- _(Level 4 Anticipatory Empathy: Specific offers, not vague "let me know if you need anything")_
802
- """.strip()
803
-
804
-
805
- # =============================================================================
806
- # Example Usage
807
- # =============================================================================
808
-
809
-
810
- if __name__ == "__main__":
811
- # Example 1: Pre-format for handoff
812
- raw_data = {
813
- "compliance_percentage": 88.5,
814
- "compliance_gaps": [
815
- {
816
- "severity": "critical",
817
- "description": "2 missing double-checks",
818
- "patient_ids": ["P123", "P456"],
819
- },
820
- {
821
- "severity": "high",
822
- "description": "5 missing signatures",
823
- "patient_ids": ["P789", "P101", "P112"],
824
- },
825
- ],
826
- "action_items": [
827
- {"severity": "critical", "estimated_time": "20 minutes"},
828
- {"severity": "high", "estimated_time": "15 minutes"},
829
- ],
830
- "days_until_audit": 45,
831
- }
832
-
833
- trust_builder = TrustBuildingBehaviors()
834
-
835
- formatted = trust_builder.pre_format_for_handoff(
836
- data=raw_data,
837
- next_person_role="charge_nurse",
838
- context="audit_preparation",
839
- )
840
-
841
- print("=" * 80)
842
- print("EXAMPLE 1: Pre-Format for Handoff")
843
- print("=" * 80)
844
- print(f"Format: {formatted['format']}")
845
- print(f"Reasoning: {formatted['reasoning']}")
846
- print(f"Quick scan view: {formatted['summary']['quick_scan_view']}")
847
- print()
848
-
849
- # Example 2: Volunteer structure during stress
850
- team_state = {
851
- "compliance_gaps": [{"severity": "critical"}] * 3,
852
- "action_items": [{"severity": "critical"}] * 8,
853
- }
854
-
855
- stress_indicators = {
856
- "days_until_deadline": 14,
857
- "tasks_per_person": 8,
858
- "critical_tasks": 3,
859
- }
860
-
861
- structure_offer = trust_builder.volunteer_structure_during_stress(
862
- team_state=team_state,
863
- stress_indicators=stress_indicators,
864
- )
865
-
866
- if structure_offer:
867
- print("=" * 80)
868
- print("EXAMPLE 2: Volunteer Structure During Stress")
869
- print("=" * 80)
870
- print(f"Stress Level: {structure_offer['stress_level']:.0%}")
871
- print(f"Interventions: {len(structure_offer['structural_interventions'])}")
872
- print(structure_offer["message_to_team"])