Skip to content

Commit 2e148fd

Browse files
GeneAIclaude
authored andcommitted
style: Apply black formatting and ruff fixes across codebase
- Black reformatted 268 files total (116 initial + 152 from pre-commit) - Fixed 26 code style violations (B007, B017, F841, RUF022) - Applied import sorting and code upgrades (I, UP rules) - Auto-fixed trailing whitespace and end-of-file issues - No functional changes, style-only updates This cleanup ensures consistent formatting across: - src/empathy_os/ (145 files) - empathy_llm_toolkit/ (65 files) - empathy_software_plugin/ (48 files) - agents/ (45 files) - tests/ (150+ files) - examples/, backend/, coach_wizards/, and other directories 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent fffc397 commit 2e148fd

File tree

605 files changed

+12205
-9443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

605 files changed

+12205
-9443
lines changed

.claude/rules/empathy/bug-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ paths: **/*.py, **/*.js, **/*.ts
33
---
44

55
# Bug Patterns (Auto-generated by Empathy)
6-
Last sync: 2026-01-01 05:30
6+
Last sync: 2026-01-04 16:06
77

88
These patterns help identify and fix common bugs based on your team's history.
99

.claude/rules/empathy/coding-patterns.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ paths: **/*
33
---
44

55
# Coding Patterns (Auto-generated by Empathy)
6-
Last sync: 2026-01-01 05:30
6+
Last sync: 2026-01-04 16:06
77

88
Coding patterns and quality findings from automated inspection.
99

.claude/rules/empathy/security-decisions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ paths: **/*.py, **/*.js, **/*.ts
33
---
44

55
# Security Decisions (Auto-generated by Empathy)
6-
Last sync: 2026-01-01 05:30
6+
Last sync: 2026-01-04 16:06
77

88
Team security decisions and accepted risks. Reference these before flagging issues.
99

.claude/rules/empathy/tech-debt-hotspots.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ paths: **/*
33
---
44

55
# Tech Debt Hotspots (Auto-generated by Empathy)
6-
Last sync: 2026-01-01 05:30
6+
Last sync: 2026-01-04 16:06
77

88
Areas of the codebase with accumulated technical debt.

agents/book_production/__init__.py

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
Book Production Pipeline - Multi-Agent System
1+
"""Book Production Pipeline - Multi-Agent System
32
43
A multi-agent system for transforming technical documentation into
54
polished book chapters. Implements Phase 2 of the Book Production
@@ -57,54 +56,54 @@
5756
from .writer_agent import WriterAgent
5857

5958
__all__ = [
60-
# Pipeline
61-
"BookProductionPipeline",
62-
"PipelineConfig",
63-
"produce_chapter",
64-
# Agents
65-
"ResearchAgent",
66-
"WriterAgent",
67-
"EditorAgent",
68-
"ReviewerAgent",
69-
# Base classes
70-
"BaseAgent",
71-
"OpusAgent",
72-
"SonnetAgent",
7359
# Configuration
7460
"AgentConfig",
75-
"MemDocsConfig",
76-
"RedisConfig",
61+
"AgentPhase",
62+
# Base classes
63+
"BaseAgent",
64+
# Pipeline
65+
"BookProductionPipeline",
66+
"Chapter",
7767
# State management
7868
"ChapterProductionState",
79-
"AgentPhase",
80-
"create_initial_state",
8169
# Data structures
8270
"ChapterSpec",
83-
"SourceDocument",
84-
"DraftVersion",
85-
"QualityScore",
86-
"ResearchResult",
8771
"Draft",
72+
"DraftVersion",
8873
"EditResult",
89-
"ReviewResult",
90-
"Chapter",
91-
# Learning System - SBAR Handoffs
92-
"HandoffType",
93-
"SBARHandoff",
94-
"create_research_to_writer_handoff",
95-
"create_writer_to_editor_handoff",
96-
"create_editor_to_reviewer_handoff",
97-
"create_reviewer_to_writer_handoff",
98-
# Learning System - Quality Gap Detection
99-
"GapSeverity",
100-
"QualityGap",
101-
"QualityGapDetector",
74+
"EditorAgent",
10275
# Learning System - Pattern Extraction
10376
"ExtractedPattern",
104-
"PatternExtractor",
10577
# Learning System - Feedback Loop
10678
"FeedbackEntry",
10779
"FeedbackLoop",
80+
# Learning System - Quality Gap Detection
81+
"GapSeverity",
82+
# Learning System - SBAR Handoffs
83+
"HandoffType",
84+
"MemDocsConfig",
85+
"OpusAgent",
86+
"PatternExtractor",
87+
"PipelineConfig",
88+
"QualityGap",
89+
"QualityGapDetector",
90+
"QualityScore",
91+
"RedisConfig",
92+
# Agents
93+
"ResearchAgent",
94+
"ResearchResult",
95+
"ReviewResult",
96+
"ReviewerAgent",
97+
"SBARHandoff",
98+
"SonnetAgent",
99+
"SourceDocument",
100+
"WriterAgent",
101+
"create_editor_to_reviewer_handoff",
102+
"create_initial_state",
103+
"create_research_to_writer_handoff",
104+
"create_reviewer_to_writer_handoff",
105+
"create_writer_to_editor_handoff",
106+
"produce_chapter",
108107
]
109108

110109
__version__ = "1.0.0"

agents/book_production/base.py

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""
2-
Book Production Pipeline - Base Agent
1+
"""Book Production Pipeline - Base Agent
32
43
Provides the foundation for all book production agents (Research, Writer, Editor, Reviewer).
54
Integrates with Redis for state management and MemDocs for pattern storage.
@@ -39,8 +38,7 @@
3938

4039
@dataclass
4140
class AgentConfig:
42-
"""
43-
Legacy configuration for book production agent.
41+
"""Legacy configuration for book production agent.
4442
4543
DEPRECATED: Use UnifiedAgentConfig or BookProductionConfig instead.
4644
This class is maintained for backward compatibility.
@@ -96,8 +94,7 @@ def to_unified(self, name: str = "book_agent") -> UnifiedAgentConfig:
9694

9795
@dataclass
9896
class MemDocsConfig:
99-
"""
100-
Legacy MemDocs configuration.
97+
"""Legacy MemDocs configuration.
10198
10299
DEPRECATED: Use empathy_llm_toolkit.config.MemDocsConfig instead.
103100
"""
@@ -110,7 +107,7 @@ class MemDocsConfig:
110107
"exemplars": "exemplar_chapters",
111108
"transformations": "transformation_examples",
112109
"feedback": "quality_feedback",
113-
}
110+
},
114111
)
115112

116113
def to_unified(self) -> UnifiedMemDocsConfig:
@@ -124,8 +121,7 @@ def to_unified(self) -> UnifiedMemDocsConfig:
124121

125122
@dataclass
126123
class RedisConfig:
127-
"""
128-
Legacy Redis configuration.
124+
"""Legacy Redis configuration.
129125
130126
DEPRECATED: Use empathy_llm_toolkit.config.RedisConfig instead.
131127
"""
@@ -150,8 +146,7 @@ def to_unified(self) -> UnifiedRedisConfig:
150146

151147

152148
class BaseAgent(ABC):
153-
"""
154-
Base class for all book production agents.
149+
"""Base class for all book production agents.
155150
156151
Provides common functionality:
157152
- LLM interaction with model selection
@@ -183,14 +178,14 @@ def __init__(
183178
redis_config: RedisConfig | None = None,
184179
llm_provider: Any | None = None,
185180
):
186-
"""
187-
Initialize the agent.
181+
"""Initialize the agent.
188182
189183
Args:
190184
config: Agent configuration (model, tokens, etc.)
191185
memdocs_config: MemDocs integration configuration
192186
redis_config: Redis state management configuration
193187
llm_provider: Optional LLM provider (for testing/injection)
188+
194189
"""
195190
self.config = config or AgentConfig(model=self.DEFAULT_MODEL)
196191
self.memdocs_config = memdocs_config or MemDocsConfig()
@@ -209,8 +204,7 @@ def __init__(
209204

210205
@abstractmethod
211206
async def process(self, state: dict[str, Any]) -> dict[str, Any]:
212-
"""
213-
Process the state and return updated state.
207+
"""Process the state and return updated state.
214208
215209
This is the main entry point for the agent. Each agent type
216210
implements this with its specific logic.
@@ -220,19 +214,17 @@ async def process(self, state: dict[str, Any]) -> dict[str, Any]:
220214
221215
Returns:
222216
Updated state with agent's contributions
217+
223218
"""
224-
pass
225219

226220
@abstractmethod
227221
def get_system_prompt(self) -> str:
228-
"""
229-
Return the system prompt for this agent.
222+
"""Return the system prompt for this agent.
230223
231224
The system prompt defines the agent's personality, capabilities,
232225
and constraints. It should encode the patterns that make for
233226
successful book chapters.
234227
"""
235-
pass
236228

237229
# =========================================================================
238230
# LLM Interaction
@@ -245,8 +237,7 @@ async def generate(
245237
max_tokens: int | None = None,
246238
temperature: float | None = None,
247239
) -> str:
248-
"""
249-
Generate text using the configured LLM.
240+
"""Generate text using the configured LLM.
250241
251242
Args:
252243
prompt: User prompt
@@ -256,13 +247,14 @@ async def generate(
256247
257248
Returns:
258249
Generated text content
250+
259251
"""
260252
system = system or self.get_system_prompt()
261253
max_tokens = max_tokens or self.config.max_tokens
262254
temperature = temperature or self.config.temperature
263255

264256
self.logger.info(
265-
f"Generating with {self.config.model} (max_tokens={max_tokens}, temp={temperature})"
257+
f"Generating with {self.config.model} (max_tokens={max_tokens}, temp={temperature})",
266258
)
267259

268260
# If we have an injected provider, use it
@@ -324,30 +316,30 @@ async def _generate_with_anthropic(
324316
except Exception as e:
325317
last_error = e
326318
self.logger.warning(
327-
f"LLM call failed (attempt {attempt + 1}/{self.config.retry_attempts}): {e}"
319+
f"LLM call failed (attempt {attempt + 1}/{self.config.retry_attempts}): {e}",
328320
)
329321
if attempt < self.config.retry_attempts - 1:
330322
import asyncio
331323

332324
await asyncio.sleep(self.config.retry_delay)
333325

334326
raise RuntimeError(
335-
f"LLM generation failed after {self.config.retry_attempts} attempts: {last_error}"
327+
f"LLM generation failed after {self.config.retry_attempts} attempts: {last_error}",
336328
)
337329

338330
# =========================================================================
339331
# Redis State Management
340332
# =========================================================================
341333

342334
async def get_state(self, key: str) -> dict[str, Any] | None:
343-
"""
344-
Retrieve state from Redis.
335+
"""Retrieve state from Redis.
345336
346337
Args:
347338
key: State key
348339
349340
Returns:
350341
State dictionary or None if not found
342+
351343
"""
352344
if not self.redis_config.enabled:
353345
return None
@@ -369,8 +361,7 @@ async def set_state(
369361
state: dict[str, Any],
370362
ttl: int | None = None,
371363
) -> bool:
372-
"""
373-
Store state in Redis.
364+
"""Store state in Redis.
374365
375366
Args:
376367
key: State key
@@ -379,6 +370,7 @@ async def set_state(
379370
380371
Returns:
381372
True if successful
373+
382374
"""
383375
if not self.redis_config.enabled:
384376
return False
@@ -427,8 +419,7 @@ async def search_patterns(
427419
limit: int = 5,
428420
min_confidence: float = 0.7,
429421
) -> list[dict[str, Any]]:
430-
"""
431-
Search for patterns in MemDocs.
422+
"""Search for patterns in MemDocs.
432423
433424
Args:
434425
query: Search query
@@ -438,6 +429,7 @@ async def search_patterns(
438429
439430
Returns:
440431
List of matching patterns
432+
441433
"""
442434
if not self.memdocs_config.enabled:
443435
return []
@@ -455,15 +447,15 @@ async def store_pattern(
455447
pattern: dict[str, Any],
456448
collection: str = "patterns",
457449
) -> str:
458-
"""
459-
Store a pattern in MemDocs.
450+
"""Store a pattern in MemDocs.
460451
461452
Args:
462453
pattern: Pattern dictionary with content and metadata
463454
collection: Collection to store in
464455
465456
Returns:
466457
Pattern ID
458+
467459
"""
468460
if not self.memdocs_config.enabled:
469461
return ""
@@ -537,8 +529,7 @@ def add_audit_entry(
537529
action: str,
538530
details: dict[str, Any] | None = None,
539531
) -> dict[str, Any]:
540-
"""
541-
Add an entry to the audit trail.
532+
"""Add an entry to the audit trail.
542533
543534
Args:
544535
state: Current state
@@ -547,6 +538,7 @@ def add_audit_entry(
547538
548539
Returns:
549540
Updated state with audit entry
541+
550542
"""
551543
entry = {
552544
"timestamp": datetime.now().isoformat(),
@@ -579,8 +571,7 @@ def count_words(self, text: str) -> int:
579571

580572

581573
class OpusAgent(BaseAgent):
582-
"""
583-
Base class for agents that use Claude Opus 4.5.
574+
"""Base class for agents that use Claude Opus 4.5.
584575
585576
Use Opus for:
586577
- Creative writing (Writer Agent)
@@ -592,8 +583,7 @@ class OpusAgent(BaseAgent):
592583

593584

594585
class SonnetAgent(BaseAgent):
595-
"""
596-
Base class for agents that use Claude Sonnet.
586+
"""Base class for agents that use Claude Sonnet.
597587
598588
Use Sonnet for:
599589
- Structured extraction (Research Agent)

0 commit comments

Comments
 (0)