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.
Files changed (72) hide show
  1. agents/compliance_anticipation_agent.py +113 -118
  2. agents/compliance_db.py +339 -0
  3. agents/epic_integration_wizard.py +37 -48
  4. agents/notifications.py +291 -0
  5. agents/trust_building_behaviors.py +66 -85
  6. coach_wizards/__init__.py +11 -12
  7. coach_wizards/accessibility_wizard.py +12 -12
  8. coach_wizards/api_wizard.py +12 -12
  9. coach_wizards/base_wizard.py +26 -20
  10. coach_wizards/cicd_wizard.py +15 -13
  11. coach_wizards/compliance_wizard.py +12 -12
  12. coach_wizards/database_wizard.py +12 -12
  13. coach_wizards/debugging_wizard.py +12 -12
  14. coach_wizards/documentation_wizard.py +12 -12
  15. coach_wizards/generate_wizards.py +1 -2
  16. coach_wizards/localization_wizard.py +21 -14
  17. coach_wizards/migration_wizard.py +12 -12
  18. coach_wizards/monitoring_wizard.py +12 -12
  19. coach_wizards/observability_wizard.py +12 -12
  20. coach_wizards/performance_wizard.py +12 -12
  21. coach_wizards/prompt_engineering_wizard.py +22 -25
  22. coach_wizards/refactoring_wizard.py +12 -12
  23. coach_wizards/scaling_wizard.py +12 -12
  24. coach_wizards/security_wizard.py +12 -12
  25. coach_wizards/testing_wizard.py +12 -12
  26. {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/METADATA +234 -30
  27. empathy_framework-3.7.0.dist-info/RECORD +105 -0
  28. empathy_healthcare_plugin/__init__.py +1 -2
  29. empathy_llm_toolkit/__init__.py +5 -6
  30. empathy_llm_toolkit/claude_memory.py +14 -15
  31. empathy_llm_toolkit/code_health.py +27 -19
  32. empathy_llm_toolkit/contextual_patterns.py +11 -12
  33. empathy_llm_toolkit/core.py +43 -49
  34. empathy_llm_toolkit/git_pattern_extractor.py +16 -12
  35. empathy_llm_toolkit/levels.py +6 -13
  36. empathy_llm_toolkit/pattern_confidence.py +14 -18
  37. empathy_llm_toolkit/pattern_resolver.py +10 -12
  38. empathy_llm_toolkit/pattern_summary.py +13 -11
  39. empathy_llm_toolkit/providers.py +27 -38
  40. empathy_llm_toolkit/session_status.py +18 -20
  41. empathy_llm_toolkit/state.py +20 -21
  42. empathy_os/__init__.py +72 -73
  43. empathy_os/cli.py +193 -98
  44. empathy_os/cli_unified.py +68 -41
  45. empathy_os/config.py +31 -31
  46. empathy_os/coordination.py +48 -54
  47. empathy_os/core.py +90 -99
  48. empathy_os/cost_tracker.py +20 -23
  49. empathy_os/discovery.py +9 -11
  50. empathy_os/emergence.py +20 -21
  51. empathy_os/exceptions.py +18 -30
  52. empathy_os/feedback_loops.py +27 -30
  53. empathy_os/levels.py +31 -34
  54. empathy_os/leverage_points.py +27 -28
  55. empathy_os/logging_config.py +11 -12
  56. empathy_os/monitoring.py +27 -27
  57. empathy_os/pattern_library.py +29 -28
  58. empathy_os/persistence.py +30 -34
  59. empathy_os/platform_utils.py +46 -47
  60. empathy_os/redis_config.py +14 -15
  61. empathy_os/redis_memory.py +53 -56
  62. empathy_os/templates.py +12 -11
  63. empathy_os/trust_building.py +44 -36
  64. empathy_os/workflow_commands.py +123 -31
  65. empathy_software_plugin/__init__.py +1 -2
  66. empathy_software_plugin/cli.py +32 -25
  67. empathy_software_plugin/plugin.py +4 -8
  68. empathy_framework-3.5.6.dist-info/RECORD +0 -103
  69. {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/WHEEL +0 -0
  70. {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/entry_points.txt +0 -0
  71. {empathy_framework-3.5.6.dist-info → empathy_framework-3.7.0.dist-info}/licenses/LICENSE +0 -0
  72. {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
- Redis Short-Term Memory for Empathy Framework
1
+ """Redis Short-Term Memory for Empathy Framework
3
2
 
4
3
  Per EMPATHY_PHILOSOPHY.md v1.1.0:
5
4
  - Implements fast, TTL-based working memory for agent coordination
@@ -30,8 +29,7 @@ from .memory.short_term import AccessTier
30
29
 
31
30
 
32
31
  class TTLStrategy(Enum):
33
- """
34
- TTL strategies for different memory types
32
+ """TTL strategies for different memory types
35
33
 
36
34
  Per EMPATHY_PHILOSOPHY.md Section 9.3:
37
35
  - Working results: 1 hour
@@ -120,8 +118,7 @@ class StagedPattern:
120
118
 
121
119
  @dataclass
122
120
  class ConflictContext:
123
- """
124
- Context for principled negotiation
121
+ """Context for principled negotiation
125
122
 
126
123
  Per Getting to Yes framework:
127
124
  - Positions: What each party says they want
@@ -162,8 +159,7 @@ class ConflictContext:
162
159
 
163
160
 
164
161
  class RedisShortTermMemory:
165
- """
166
- Redis-backed short-term memory for agent coordination
162
+ """Redis-backed short-term memory for agent coordination
167
163
 
168
164
  Features:
169
165
  - Fast read/write with automatic TTL expiration
@@ -177,6 +173,7 @@ class RedisShortTermMemory:
177
173
  >>> creds = AgentCredentials("agent_1", AccessTier.CONTRIBUTOR)
178
174
  >>> memory.stash("analysis_results", {"issues": 3}, creds)
179
175
  >>> data = memory.retrieve("analysis_results", creds)
176
+
180
177
  """
181
178
 
182
179
  # Key prefixes for namespacing
@@ -194,8 +191,7 @@ class RedisShortTermMemory:
194
191
  password: str | None = None,
195
192
  use_mock: bool = False,
196
193
  ):
197
- """
198
- Initialize Redis connection
194
+ """Initialize Redis connection
199
195
 
200
196
  Args:
201
197
  host: Redis host
@@ -203,6 +199,7 @@ class RedisShortTermMemory:
203
199
  db: Redis database number
204
200
  password: Redis password (optional)
205
201
  use_mock: Use in-memory mock for testing
202
+
206
203
  """
207
204
  self.use_mock = use_mock or not REDIS_AVAILABLE
208
205
 
@@ -277,8 +274,7 @@ class RedisShortTermMemory:
277
274
  credentials: AgentCredentials,
278
275
  ttl: TTLStrategy = TTLStrategy.WORKING_RESULTS,
279
276
  ) -> bool:
280
- """
281
- Stash data in short-term memory
277
+ """Stash data in short-term memory
282
278
 
283
279
  Args:
284
280
  key: Unique key for the data
@@ -291,11 +287,12 @@ class RedisShortTermMemory:
291
287
 
292
288
  Example:
293
289
  >>> memory.stash("analysis_v1", {"findings": [...]}, creds)
290
+
294
291
  """
295
292
  if not credentials.can_stage():
296
293
  raise PermissionError(
297
294
  f"Agent {credentials.agent_id} (Tier {credentials.tier.name}) "
298
- "cannot write to memory. Requires CONTRIBUTOR or higher."
295
+ "cannot write to memory. Requires CONTRIBUTOR or higher.",
299
296
  )
300
297
 
301
298
  full_key = f"{self.PREFIX_WORKING}{credentials.agent_id}:{key}"
@@ -312,8 +309,7 @@ class RedisShortTermMemory:
312
309
  credentials: AgentCredentials,
313
310
  agent_id: str | None = None,
314
311
  ) -> Any | None:
315
- """
316
- Retrieve data from short-term memory
312
+ """Retrieve data from short-term memory
317
313
 
318
314
  Args:
319
315
  key: Key to retrieve
@@ -325,6 +321,7 @@ class RedisShortTermMemory:
325
321
 
326
322
  Example:
327
323
  >>> data = memory.retrieve("analysis_v1", creds)
324
+
328
325
  """
329
326
  owner = agent_id or credentials.agent_id
330
327
  full_key = f"{self.PREFIX_WORKING}{owner}:{key}"
@@ -337,14 +334,14 @@ class RedisShortTermMemory:
337
334
  return payload.get("data")
338
335
 
339
336
  def clear_working_memory(self, credentials: AgentCredentials) -> int:
340
- """
341
- Clear all working memory for an agent
337
+ """Clear all working memory for an agent
342
338
 
343
339
  Args:
344
340
  credentials: Agent credentials (must own the memory or be Steward)
345
341
 
346
342
  Returns:
347
343
  Number of keys deleted
344
+
348
345
  """
349
346
  pattern = f"{self.PREFIX_WORKING}{credentials.agent_id}:*"
350
347
  keys = self._keys(pattern)
@@ -361,8 +358,7 @@ class RedisShortTermMemory:
361
358
  pattern: StagedPattern,
362
359
  credentials: AgentCredentials,
363
360
  ) -> bool:
364
- """
365
- Stage a pattern for validation
361
+ """Stage a pattern for validation
366
362
 
367
363
  Per EMPATHY_PHILOSOPHY.md: Patterns must be staged before
368
364
  being promoted to the active library.
@@ -373,11 +369,12 @@ class RedisShortTermMemory:
373
369
 
374
370
  Returns:
375
371
  True if staged successfully
372
+
376
373
  """
377
374
  if not credentials.can_stage():
378
375
  raise PermissionError(
379
376
  f"Agent {credentials.agent_id} cannot stage patterns. "
380
- "Requires CONTRIBUTOR tier or higher."
377
+ "Requires CONTRIBUTOR tier or higher.",
381
378
  )
382
379
 
383
380
  key = f"{self.PREFIX_STAGED}{pattern.pattern_id}"
@@ -392,8 +389,7 @@ class RedisShortTermMemory:
392
389
  pattern_id: str,
393
390
  credentials: AgentCredentials,
394
391
  ) -> StagedPattern | None:
395
- """
396
- Retrieve a staged pattern
392
+ """Retrieve a staged pattern
397
393
 
398
394
  Args:
399
395
  pattern_id: Pattern ID
@@ -401,6 +397,7 @@ class RedisShortTermMemory:
401
397
 
402
398
  Returns:
403
399
  StagedPattern or None
400
+
404
401
  """
405
402
  key = f"{self.PREFIX_STAGED}{pattern_id}"
406
403
  raw = self._get(key)
@@ -414,14 +411,14 @@ class RedisShortTermMemory:
414
411
  self,
415
412
  credentials: AgentCredentials,
416
413
  ) -> list[StagedPattern]:
417
- """
418
- List all staged patterns awaiting validation
414
+ """List all staged patterns awaiting validation
419
415
 
420
416
  Args:
421
417
  credentials: Any tier can read
422
418
 
423
419
  Returns:
424
420
  List of staged patterns
421
+
425
422
  """
426
423
  pattern = f"{self.PREFIX_STAGED}*"
427
424
  keys = self._keys(pattern)
@@ -439,8 +436,7 @@ class RedisShortTermMemory:
439
436
  pattern_id: str,
440
437
  credentials: AgentCredentials,
441
438
  ) -> StagedPattern | None:
442
- """
443
- Promote staged pattern (remove from staging for library add)
439
+ """Promote staged pattern (remove from staging for library add)
444
440
 
445
441
  Args:
446
442
  pattern_id: Pattern to promote
@@ -448,11 +444,12 @@ class RedisShortTermMemory:
448
444
 
449
445
  Returns:
450
446
  The promoted pattern (for adding to PatternLibrary)
447
+
451
448
  """
452
449
  if not credentials.can_validate():
453
450
  raise PermissionError(
454
451
  f"Agent {credentials.agent_id} cannot promote patterns. "
455
- "Requires VALIDATOR tier or higher."
452
+ "Requires VALIDATOR tier or higher.",
456
453
  )
457
454
 
458
455
  pattern = self.get_staged_pattern(pattern_id, credentials)
@@ -467,8 +464,7 @@ class RedisShortTermMemory:
467
464
  credentials: AgentCredentials,
468
465
  reason: str = "",
469
466
  ) -> bool:
470
- """
471
- Reject a staged pattern
467
+ """Reject a staged pattern
472
468
 
473
469
  Args:
474
470
  pattern_id: Pattern to reject
@@ -477,11 +473,12 @@ class RedisShortTermMemory:
477
473
 
478
474
  Returns:
479
475
  True if rejected
476
+
480
477
  """
481
478
  if not credentials.can_validate():
482
479
  raise PermissionError(
483
480
  f"Agent {credentials.agent_id} cannot reject patterns. "
484
- "Requires VALIDATOR tier or higher."
481
+ "Requires VALIDATOR tier or higher.",
485
482
  )
486
483
 
487
484
  key = f"{self.PREFIX_STAGED}{pattern_id}"
@@ -497,8 +494,7 @@ class RedisShortTermMemory:
497
494
  credentials: AgentCredentials,
498
495
  batna: str | None = None,
499
496
  ) -> ConflictContext:
500
- """
501
- Create context for principled negotiation
497
+ """Create context for principled negotiation
502
498
 
503
499
  Per Getting to Yes framework:
504
500
  - Separate positions from interests
@@ -513,11 +509,12 @@ class RedisShortTermMemory:
513
509
 
514
510
  Returns:
515
511
  ConflictContext for resolution
512
+
516
513
  """
517
514
  if not credentials.can_stage():
518
515
  raise PermissionError(
519
516
  f"Agent {credentials.agent_id} cannot create conflict context. "
520
- "Requires CONTRIBUTOR tier or higher."
517
+ "Requires CONTRIBUTOR tier or higher.",
521
518
  )
522
519
 
523
520
  context = ConflictContext(
@@ -541,8 +538,7 @@ class RedisShortTermMemory:
541
538
  conflict_id: str,
542
539
  credentials: AgentCredentials,
543
540
  ) -> ConflictContext | None:
544
- """
545
- Retrieve conflict context
541
+ """Retrieve conflict context
546
542
 
547
543
  Args:
548
544
  conflict_id: Conflict identifier
@@ -550,6 +546,7 @@ class RedisShortTermMemory:
550
546
 
551
547
  Returns:
552
548
  ConflictContext or None
549
+
553
550
  """
554
551
  key = f"{self.PREFIX_CONFLICT}{conflict_id}"
555
552
  raw = self._get(key)
@@ -565,8 +562,7 @@ class RedisShortTermMemory:
565
562
  resolution: str,
566
563
  credentials: AgentCredentials,
567
564
  ) -> bool:
568
- """
569
- Mark conflict as resolved
565
+ """Mark conflict as resolved
570
566
 
571
567
  Args:
572
568
  conflict_id: Conflict to resolve
@@ -575,11 +571,12 @@ class RedisShortTermMemory:
575
571
 
576
572
  Returns:
577
573
  True if resolved
574
+
578
575
  """
579
576
  if not credentials.can_validate():
580
577
  raise PermissionError(
581
578
  f"Agent {credentials.agent_id} cannot resolve conflicts. "
582
- "Requires VALIDATOR tier or higher."
579
+ "Requires VALIDATOR tier or higher.",
583
580
  )
584
581
 
585
582
  context = self.get_conflict_context(conflict_id, credentials)
@@ -603,8 +600,7 @@ class RedisShortTermMemory:
603
600
  credentials: AgentCredentials,
604
601
  target_agent: str | None = None,
605
602
  ) -> bool:
606
- """
607
- Send coordination signal to other agents
603
+ """Send coordination signal to other agents
608
604
 
609
605
  Args:
610
606
  signal_type: Type of signal (e.g., "ready", "blocking", "complete")
@@ -614,11 +610,12 @@ class RedisShortTermMemory:
614
610
 
615
611
  Returns:
616
612
  True if sent
613
+
617
614
  """
618
615
  if not credentials.can_stage():
619
616
  raise PermissionError(
620
617
  f"Agent {credentials.agent_id} cannot send signals. "
621
- "Requires CONTRIBUTOR tier or higher."
618
+ "Requires CONTRIBUTOR tier or higher.",
622
619
  )
623
620
 
624
621
  target = target_agent or "broadcast"
@@ -637,8 +634,7 @@ class RedisShortTermMemory:
637
634
  credentials: AgentCredentials,
638
635
  signal_type: str | None = None,
639
636
  ) -> list[dict]:
640
- """
641
- Receive coordination signals
637
+ """Receive coordination signals
642
638
 
643
639
  Args:
644
640
  credentials: Agent receiving signals
@@ -646,6 +642,7 @@ class RedisShortTermMemory:
646
642
 
647
643
  Returns:
648
644
  List of signals
645
+
649
646
  """
650
647
  if signal_type:
651
648
  pattern = f"{self.PREFIX_COORDINATION}{signal_type}:*:{credentials.agent_id}"
@@ -673,8 +670,7 @@ class RedisShortTermMemory:
673
670
  credentials: AgentCredentials,
674
671
  metadata: dict | None = None,
675
672
  ) -> bool:
676
- """
677
- Create a collaboration session
673
+ """Create a collaboration session
678
674
 
679
675
  Args:
680
676
  session_id: Unique session identifier
@@ -683,6 +679,7 @@ class RedisShortTermMemory:
683
679
 
684
680
  Returns:
685
681
  True if created
682
+
686
683
  """
687
684
  key = f"{self.PREFIX_SESSION}{session_id}"
688
685
  payload = {
@@ -699,8 +696,7 @@ class RedisShortTermMemory:
699
696
  session_id: str,
700
697
  credentials: AgentCredentials,
701
698
  ) -> bool:
702
- """
703
- Join an existing session
699
+ """Join an existing session
704
700
 
705
701
  Args:
706
702
  session_id: Session to join
@@ -708,6 +704,7 @@ class RedisShortTermMemory:
708
704
 
709
705
  Returns:
710
706
  True if joined
707
+
711
708
  """
712
709
  key = f"{self.PREFIX_SESSION}{session_id}"
713
710
  raw = self._get(key)
@@ -726,8 +723,7 @@ class RedisShortTermMemory:
726
723
  session_id: str,
727
724
  credentials: AgentCredentials,
728
725
  ) -> dict | None:
729
- """
730
- Get session information
726
+ """Get session information
731
727
 
732
728
  Args:
733
729
  session_id: Session identifier
@@ -735,6 +731,7 @@ class RedisShortTermMemory:
735
731
 
736
732
  Returns:
737
733
  Session data or None
734
+
738
735
  """
739
736
  key = f"{self.PREFIX_SESSION}{session_id}"
740
737
  raw = self._get(key)
@@ -748,11 +745,11 @@ class RedisShortTermMemory:
748
745
  # === Health Check ===
749
746
 
750
747
  def ping(self) -> bool:
751
- """
752
- Check Redis connection health
748
+ """Check Redis connection health
753
749
 
754
750
  Returns:
755
751
  True if connected and responsive
752
+
756
753
  """
757
754
  if self.use_mock:
758
755
  return True
@@ -764,24 +761,24 @@ class RedisShortTermMemory:
764
761
  return False
765
762
 
766
763
  def get_stats(self) -> dict:
767
- """
768
- Get memory statistics
764
+ """Get memory statistics
769
765
 
770
766
  Returns:
771
767
  Dict with memory stats
768
+
772
769
  """
773
770
  if self.use_mock:
774
771
  return {
775
772
  "mode": "mock",
776
773
  "total_keys": len(self._mock_storage),
777
774
  "working_keys": len(
778
- [k for k in self._mock_storage if k.startswith(self.PREFIX_WORKING)]
775
+ [k for k in self._mock_storage if k.startswith(self.PREFIX_WORKING)],
779
776
  ),
780
777
  "staged_keys": len(
781
- [k for k in self._mock_storage if k.startswith(self.PREFIX_STAGED)]
778
+ [k for k in self._mock_storage if k.startswith(self.PREFIX_STAGED)],
782
779
  ),
783
780
  "conflict_keys": len(
784
- [k for k in self._mock_storage if k.startswith(self.PREFIX_CONFLICT)]
781
+ [k for k in self._mock_storage if k.startswith(self.PREFIX_CONFLICT)],
785
782
  ),
786
783
  }
787
784
 
empathy_os/templates.py CHANGED
@@ -1,5 +1,4 @@
1
- """
2
- Template Starters for Empathy Framework
1
+ """Template Starters for Empathy Framework
3
2
 
4
3
  Scaffold new projects with Empathy pre-configured for different use cases.
5
4
 
@@ -619,10 +618,12 @@ def list_templates() -> list:
619
618
 
620
619
 
621
620
  def scaffold_project(
622
- template_name: str, project_name: str, target_dir: str | None = None, force: bool = False
621
+ template_name: str,
622
+ project_name: str,
623
+ target_dir: str | None = None,
624
+ force: bool = False,
623
625
  ) -> dict:
624
- """
625
- Create a new project from a template.
626
+ """Create a new project from a template.
626
627
 
627
628
  Args:
628
629
  template_name: Template ID (minimal, python-cli, python-fastapi, python-agent)
@@ -632,6 +633,7 @@ def scaffold_project(
632
633
 
633
634
  Returns:
634
635
  Dict with created files and status
636
+
635
637
  """
636
638
  if template_name not in TEMPLATES:
637
639
  return {
@@ -742,9 +744,8 @@ def cmd_new(args):
742
744
  print(f" $ {step}")
743
745
  print()
744
746
  return 0
745
- else:
746
- print(f"\n Error: {result['error']}")
747
- if "available" in result:
748
- print(f" Available templates: {', '.join(result['available'])}")
749
- print()
750
- return 1
747
+ print(f"\n Error: {result['error']}")
748
+ if "available" in result:
749
+ print(f" Available templates: {', '.join(result['available'])}")
750
+ print()
751
+ return 1
@@ -1,5 +1,4 @@
1
- """
2
- Trust-Building Behaviors for Anticipatory AI Agents
1
+ """Trust-Building Behaviors for Anticipatory AI Agents
3
2
 
4
3
  Implements behaviors that build trust through anticipatory actions:
5
4
  - Pre-format data for handoffs (reduce cognitive load)
@@ -29,8 +28,7 @@ logger = logging.getLogger(__name__)
29
28
 
30
29
  @dataclass
31
30
  class TrustSignal:
32
- """
33
- A signal that indicates trust is building or eroding
31
+ """A signal that indicates trust is building or eroding
34
32
 
35
33
  Trust signals help track how trust evolves over time based on
36
34
  observable behaviors and outcomes.
@@ -44,8 +42,7 @@ class TrustSignal:
44
42
 
45
43
 
46
44
  class TrustBuildingBehaviors:
47
- """
48
- Level 4 Anticipatory trust-building behaviors
45
+ """Level 4 Anticipatory trust-building behaviors
49
46
 
50
47
  Philosophy: Trust is earned through consistent, helpful actions that
51
48
  demonstrate understanding of collaboration dynamics and proactive
@@ -76,6 +73,7 @@ class TrustBuildingBehaviors:
76
73
  ... instruction=instruction,
77
74
  ... ambiguities=["which system?", "what changes?"]
78
75
  ... )
76
+
79
77
  """
80
78
 
81
79
  def __init__(self):
@@ -83,10 +81,12 @@ class TrustBuildingBehaviors:
83
81
  self.trust_signals: list[TrustSignal] = []
84
82
 
85
83
  def pre_format_for_handoff(
86
- self, data: dict[str, Any], recipient_role: str, context: str
84
+ self,
85
+ data: dict[str, Any],
86
+ recipient_role: str,
87
+ context: str,
87
88
  ) -> dict[str, Any]:
88
- """
89
- Pre-format data for handoff to reduce recipient's cognitive load
89
+ """Pre-format data for handoff to reduce recipient's cognitive load
90
90
 
91
91
  **Trust Built:**
92
92
  - "This AI understands my workflow"
@@ -109,6 +109,7 @@ class TrustBuildingBehaviors:
109
109
  ... context="board_meeting"
110
110
  ... )
111
111
  >>> # Returns: executive summary format with key highlights
112
+
112
113
  """
113
114
  logger.info(f"Pre-formatting data for handoff to {recipient_role} (context: {context})")
114
115
 
@@ -148,8 +149,7 @@ class TrustBuildingBehaviors:
148
149
  detected_ambiguities: list[str],
149
150
  context: dict[str, Any] | None = None,
150
151
  ) -> dict[str, Any]:
151
- """
152
- Clarify ambiguous instructions before execution to prevent wasted effort
152
+ """Clarify ambiguous instructions before execution to prevent wasted effort
153
153
 
154
154
  **Trust Built:**
155
155
  - "This AI doesn't make dangerous assumptions"
@@ -171,6 +171,7 @@ class TrustBuildingBehaviors:
171
171
  ... instruction=instruction,
172
172
  ... detected_ambiguities=ambiguities
173
173
  ... )
174
+
174
175
  """
175
176
  logger.info(f"Clarifying ambiguous instruction: {instruction}")
176
177
 
@@ -202,10 +203,11 @@ class TrustBuildingBehaviors:
202
203
  return clarification
203
204
 
204
205
  def volunteer_structure_during_stress(
205
- self, stress_indicators: dict[str, Any], available_scaffolding: list[str]
206
+ self,
207
+ stress_indicators: dict[str, Any],
208
+ available_scaffolding: list[str],
206
209
  ) -> dict[str, Any]:
207
- """
208
- Volunteer structure/scaffolding during stressful situations
210
+ """Volunteer structure/scaffolding during stressful situations
209
211
 
210
212
  **Not pep talks, actual structural help:**
211
213
  - Break down overwhelming tasks
@@ -232,6 +234,7 @@ class TrustBuildingBehaviors:
232
234
  ... stress_indicators=stress,
233
235
  ... available_scaffolding=scaffolding
234
236
  ... )
237
+
235
238
  """
236
239
  logger.info("Volunteering structure during detected stress")
237
240
 
@@ -256,7 +259,7 @@ class TrustBuildingBehaviors:
256
259
  "type": "prioritization",
257
260
  "description": "Help prioritize tasks using urgency-importance matrix",
258
261
  "immediate": True,
259
- }
262
+ },
260
263
  )
261
264
 
262
265
  if "breakdown" in available_scaffolding:
@@ -265,7 +268,7 @@ class TrustBuildingBehaviors:
265
268
  "type": "task_breakdown",
266
269
  "description": "Break overwhelming tasks into smaller, manageable steps",
267
270
  "immediate": True,
268
- }
271
+ },
269
272
  )
270
273
 
271
274
  if "templates" in available_scaffolding:
@@ -274,7 +277,7 @@ class TrustBuildingBehaviors:
274
277
  "type": "templates",
275
278
  "description": "Provide templates to reduce creation effort",
276
279
  "immediate": False,
277
- }
280
+ },
278
281
  )
279
282
 
280
283
  # Record trust signal
@@ -287,10 +290,11 @@ class TrustBuildingBehaviors:
287
290
  return support
288
291
 
289
292
  def offer_proactive_help(
290
- self, struggle_indicators: dict[str, Any], available_help: list[str]
293
+ self,
294
+ struggle_indicators: dict[str, Any],
295
+ available_help: list[str],
291
296
  ) -> dict[str, Any]:
292
- """
293
- Proactively offer help when collaborator is struggling
297
+ """Proactively offer help when collaborator is struggling
294
298
 
295
299
  **Trust Built:**
296
300
  - "This AI notices when I'm stuck"
@@ -311,6 +315,7 @@ class TrustBuildingBehaviors:
311
315
  ... struggle_indicators=indicators,
312
316
  ... available_help=help_types
313
317
  ... )
318
+
314
319
  """
315
320
  logger.info("Offering proactive help based on struggle indicators")
316
321
 
@@ -332,7 +337,10 @@ class TrustBuildingBehaviors:
332
337
  if struggle_type == "comprehension":
333
338
  if "explanation" in available_help:
334
339
  help_offered.append(
335
- {"type": "explanation", "description": "Provide clearer explanation of concept"}
340
+ {
341
+ "type": "explanation",
342
+ "description": "Provide clearer explanation of concept",
343
+ },
336
344
  )
337
345
  if "examples" in available_help:
338
346
  help_offered.append({"type": "examples", "description": "Show concrete examples"})
@@ -342,7 +350,7 @@ class TrustBuildingBehaviors:
342
350
  help_offered.append({"type": "debugging", "description": "Help debug the issue"})
343
351
  if "guidance" in available_help:
344
352
  help_offered.append(
345
- {"type": "step_by_step", "description": "Provide step-by-step guidance"}
353
+ {"type": "step_by_step", "description": "Provide step-by-step guidance"},
346
354
  )
347
355
 
348
356
  # Record trust signal
@@ -355,11 +363,11 @@ class TrustBuildingBehaviors:
355
363
  return offer
356
364
 
357
365
  def get_trust_trajectory(self) -> dict[str, Any]:
358
- """
359
- Get trust trajectory based on recorded signals
366
+ """Get trust trajectory based on recorded signals
360
367
 
361
368
  Returns:
362
369
  Analysis of trust evolution over time
370
+
363
371
  """
364
372
  if not self.trust_signals:
365
373
  return {"status": "insufficient_data", "trajectory": "unknown", "signal_count": 0}
@@ -395,12 +403,11 @@ class TrustBuildingBehaviors:
395
403
  """Determine appropriate format based on role and context"""
396
404
  if role in ["executive", "manager", "director"]:
397
405
  return "executive_summary"
398
- elif role in ["developer", "engineer", "analyst"]:
406
+ if role in ["developer", "engineer", "analyst"]:
399
407
  return "technical_detail"
400
- elif role in ["team_lead", "coordinator"]:
408
+ if role in ["team_lead", "coordinator"]:
401
409
  return "action_oriented"
402
- else:
403
- return "general"
410
+ return "general"
404
411
 
405
412
  def _create_executive_summary(self, data: dict, context: str) -> dict:
406
413
  """Create executive summary format"""
@@ -469,7 +476,10 @@ class TrustBuildingBehaviors:
469
476
  return []
470
477
 
471
478
  def _generate_clarifying_question(
472
- self, instruction: str, ambiguity: str, context: dict | None
479
+ self,
480
+ instruction: str,
481
+ ambiguity: str,
482
+ context: dict | None,
473
483
  ) -> dict[str, str]:
474
484
  """Generate a specific clarifying question"""
475
485
  return {
@@ -485,21 +495,19 @@ class TrustBuildingBehaviors:
485
495
 
486
496
  if stress_score >= 4:
487
497
  return "critical"
488
- elif stress_score >= 3:
498
+ if stress_score >= 3:
489
499
  return "high"
490
- elif stress_score >= 2:
500
+ if stress_score >= 2:
491
501
  return "moderate"
492
- else:
493
- return "low"
502
+ return "low"
494
503
 
495
504
  def _classify_struggle(self, indicators: dict) -> str:
496
505
  """Classify type of struggle"""
497
506
  if "repeated_errors" in indicators:
498
507
  return "execution"
499
- elif "time_on_task" in indicators:
508
+ if "time_on_task" in indicators:
500
509
  return "comprehension"
501
- else:
502
- return "general"
510
+ return "general"
503
511
 
504
512
  def _record_trust_signal(self, signal_type: str, behavior: str, evidence: str | None = None):
505
513
  """Record a trust signal"""