dr-eamer-ai-shared 1.0.0__tar.gz

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 (151) hide show
  1. dr_eamer_ai_shared-1.0.0/CLAUDE.md +353 -0
  2. dr_eamer_ai_shared-1.0.0/DOCUMENTATION_RECOMMENDATIONS.md +291 -0
  3. dr_eamer_ai_shared-1.0.0/LICENSE +21 -0
  4. dr_eamer_ai_shared-1.0.0/PKG-INFO +78 -0
  5. dr_eamer_ai_shared-1.0.0/__init__.py +11 -0
  6. dr_eamer_ai_shared-1.0.0/config.py +395 -0
  7. dr_eamer_ai_shared-1.0.0/coze_agents.json +1 -0
  8. dr_eamer_ai_shared-1.0.0/data_fetching/__init__.py +54 -0
  9. dr_eamer_ai_shared-1.0.0/data_fetching/archive_client.py +369 -0
  10. dr_eamer_ai_shared-1.0.0/data_fetching/arxiv_client.py +313 -0
  11. dr_eamer_ai_shared-1.0.0/data_fetching/census_client.py +412 -0
  12. dr_eamer_ai_shared-1.0.0/data_fetching/example_usage.py +66 -0
  13. dr_eamer_ai_shared-1.0.0/data_fetching/factory.py +111 -0
  14. dr_eamer_ai_shared-1.0.0/data_fetching/fec_client.py +323 -0
  15. dr_eamer_ai_shared-1.0.0/data_fetching/finance_client.py +183 -0
  16. dr_eamer_ai_shared-1.0.0/data_fetching/github_client.py +232 -0
  17. dr_eamer_ai_shared-1.0.0/data_fetching/judiciary_client.py +117 -0
  18. dr_eamer_ai_shared-1.0.0/data_fetching/mal_client.py +165 -0
  19. dr_eamer_ai_shared-1.0.0/data_fetching/nasa_client.py +221 -0
  20. dr_eamer_ai_shared-1.0.0/data_fetching/news_client.py +218 -0
  21. dr_eamer_ai_shared-1.0.0/data_fetching/openlibrary_client.py +187 -0
  22. dr_eamer_ai_shared-1.0.0/data_fetching/semantic_scholar.py +355 -0
  23. dr_eamer_ai_shared-1.0.0/data_fetching/weather_client.py +183 -0
  24. dr_eamer_ai_shared-1.0.0/data_fetching/wikipedia_client.py +212 -0
  25. dr_eamer_ai_shared-1.0.0/data_fetching/youtube_client.py +210 -0
  26. dr_eamer_ai_shared-1.0.0/dr_eamer_ai_shared.egg-info/PKG-INFO +78 -0
  27. dr_eamer_ai_shared-1.0.0/dr_eamer_ai_shared.egg-info/SOURCES.txt +278 -0
  28. dr_eamer_ai_shared-1.0.0/dr_eamer_ai_shared.egg-info/dependency_links.txt +1 -0
  29. dr_eamer_ai_shared-1.0.0/dr_eamer_ai_shared.egg-info/requires.txt +52 -0
  30. dr_eamer_ai_shared-1.0.0/dr_eamer_ai_shared.egg-info/top_level.txt +1 -0
  31. dr_eamer_ai_shared-1.0.0/llm_providers/__init__.py +150 -0
  32. dr_eamer_ai_shared-1.0.0/llm_providers/anthropic_provider.py +161 -0
  33. dr_eamer_ai_shared-1.0.0/llm_providers/claude_code_provider.py +173 -0
  34. dr_eamer_ai_shared-1.0.0/llm_providers/cohere_provider.py +128 -0
  35. dr_eamer_ai_shared-1.0.0/llm_providers/complexity_router.py +318 -0
  36. dr_eamer_ai_shared-1.0.0/llm_providers/elevenlabs_provider.py +196 -0
  37. dr_eamer_ai_shared-1.0.0/llm_providers/factory.py +476 -0
  38. dr_eamer_ai_shared-1.0.0/llm_providers/gemini_provider.py +143 -0
  39. dr_eamer_ai_shared-1.0.0/llm_providers/groq_provider.py +99 -0
  40. dr_eamer_ai_shared-1.0.0/llm_providers/huggingface_provider.py +226 -0
  41. dr_eamer_ai_shared-1.0.0/llm_providers/manus_provider.py +250 -0
  42. dr_eamer_ai_shared-1.0.0/llm_providers/mistral_provider.py +128 -0
  43. dr_eamer_ai_shared-1.0.0/llm_providers/openai_provider.py +344 -0
  44. dr_eamer_ai_shared-1.0.0/llm_providers/perplexity_provider.py +87 -0
  45. dr_eamer_ai_shared-1.0.0/llm_providers/xai_provider.py +216 -0
  46. dr_eamer_ai_shared-1.0.0/mcp/__init__.py +72 -0
  47. dr_eamer_ai_shared-1.0.0/mcp/app.py +672 -0
  48. dr_eamer_ai_shared-1.0.0/mcp/background_loop.py +152 -0
  49. dr_eamer_ai_shared-1.0.0/mcp/cache_server.py +643 -0
  50. dr_eamer_ai_shared-1.0.0/mcp/claude_code_config.json +25 -0
  51. dr_eamer_ai_shared-1.0.0/mcp/config_server.py +485 -0
  52. dr_eamer_ai_shared-1.0.0/mcp/cursor_mcp_config.json +15 -0
  53. dr_eamer_ai_shared-1.0.0/mcp/data_server.py +1443 -0
  54. dr_eamer_ai_shared-1.0.0/mcp/discovery_resources.py +223 -0
  55. dr_eamer_ai_shared-1.0.0/mcp/master_server.py +126 -0
  56. dr_eamer_ai_shared-1.0.0/mcp/mcp_http_bridge.py +268 -0
  57. dr_eamer_ai_shared-1.0.0/mcp/providers_server.py +561 -0
  58. dr_eamer_ai_shared-1.0.0/mcp/state_backup.json +6 -0
  59. dr_eamer_ai_shared-1.0.0/mcp/stdio_server.py +270 -0
  60. dr_eamer_ai_shared-1.0.0/mcp/streaming.py +491 -0
  61. dr_eamer_ai_shared-1.0.0/mcp/streaming_endpoint.py +382 -0
  62. dr_eamer_ai_shared-1.0.0/mcp/tool_metadata.py +414 -0
  63. dr_eamer_ai_shared-1.0.0/mcp/tool_registry.py +507 -0
  64. dr_eamer_ai_shared-1.0.0/mcp/unified_server.py +1285 -0
  65. dr_eamer_ai_shared-1.0.0/mcp/utility_server.py +551 -0
  66. dr_eamer_ai_shared-1.0.0/mcp/view_costs.py +269 -0
  67. dr_eamer_ai_shared-1.0.0/mcp/web_search_server.py +266 -0
  68. dr_eamer_ai_shared-1.0.0/memory/__init__.py +73 -0
  69. dr_eamer_ai_shared-1.0.0/naming.py +90 -0
  70. dr_eamer_ai_shared-1.0.0/observability/__init__.py +32 -0
  71. dr_eamer_ai_shared-1.0.0/observability/cost_tracker.py +359 -0
  72. dr_eamer_ai_shared-1.0.0/observability/metrics.py +395 -0
  73. dr_eamer_ai_shared-1.0.0/py.typed +0 -0
  74. dr_eamer_ai_shared-1.0.0/pyproject.toml +87 -0
  75. dr_eamer_ai_shared-1.0.0/setup.cfg +4 -0
  76. dr_eamer_ai_shared-1.0.0/setup.py +95 -0
  77. dr_eamer_ai_shared-1.0.0/test_image_vision.py +324 -0
  78. dr_eamer_ai_shared-1.0.0/test_providers.py +113 -0
  79. dr_eamer_ai_shared-1.0.0/tests/test_data_tool_modules.py +302 -0
  80. dr_eamer_ai_shared-1.0.0/tests/test_document_parsers.py +252 -0
  81. dr_eamer_ai_shared-1.0.0/tests/test_dreamwalker_app.py +101 -0
  82. dr_eamer_ai_shared-1.0.0/tests/test_embeddings.py +360 -0
  83. dr_eamer_ai_shared-1.0.0/tests/test_multi_search.py +245 -0
  84. dr_eamer_ai_shared-1.0.0/tests/test_orchestrators.py +135 -0
  85. dr_eamer_ai_shared-1.0.0/tests/test_provider_tools.py +158 -0
  86. dr_eamer_ai_shared-1.0.0/tests/test_time_utils.py +249 -0
  87. dr_eamer_ai_shared-1.0.0/tests/test_tool_registry.py +141 -0
  88. dr_eamer_ai_shared-1.0.0/tests/test_utils_enhancements.py +140 -0
  89. dr_eamer_ai_shared-1.0.0/tests/test_vision.py +518 -0
  90. dr_eamer_ai_shared-1.0.0/tests/test_workflow_state.py +77 -0
  91. dr_eamer_ai_shared-1.0.0/tools/__init__.py +39 -0
  92. dr_eamer_ai_shared-1.0.0/tools/anthropic_tools.py +139 -0
  93. dr_eamer_ai_shared-1.0.0/tools/archive_tool.py +144 -0
  94. dr_eamer_ai_shared-1.0.0/tools/arxiv_tool.py +91 -0
  95. dr_eamer_ai_shared-1.0.0/tools/census_tool.py +147 -0
  96. dr_eamer_ai_shared-1.0.0/tools/cohere_tools.py +136 -0
  97. dr_eamer_ai_shared-1.0.0/tools/data_registry.py +167 -0
  98. dr_eamer_ai_shared-1.0.0/tools/data_tool_base.py +91 -0
  99. dr_eamer_ai_shared-1.0.0/tools/elevenlabs_tools.py +102 -0
  100. dr_eamer_ai_shared-1.0.0/tools/example_tool.py +137 -0
  101. dr_eamer_ai_shared-1.0.0/tools/fec_tool.py +82 -0
  102. dr_eamer_ai_shared-1.0.0/tools/finance_tool.py +111 -0
  103. dr_eamer_ai_shared-1.0.0/tools/gemini_tools.py +138 -0
  104. dr_eamer_ai_shared-1.0.0/tools/github_tool.py +170 -0
  105. dr_eamer_ai_shared-1.0.0/tools/groq_tools.py +101 -0
  106. dr_eamer_ai_shared-1.0.0/tools/huggingface_tools.py +92 -0
  107. dr_eamer_ai_shared-1.0.0/tools/image_generation_tools.py +128 -0
  108. dr_eamer_ai_shared-1.0.0/tools/mistral_tools.py +106 -0
  109. dr_eamer_ai_shared-1.0.0/tools/module_base.py +477 -0
  110. dr_eamer_ai_shared-1.0.0/tools/nasa_tool.py +162 -0
  111. dr_eamer_ai_shared-1.0.0/tools/news_tool.py +160 -0
  112. dr_eamer_ai_shared-1.0.0/tools/openai_tools.py +282 -0
  113. dr_eamer_ai_shared-1.0.0/tools/openlibrary_tool.py +103 -0
  114. dr_eamer_ai_shared-1.0.0/tools/perplexity_tools.py +96 -0
  115. dr_eamer_ai_shared-1.0.0/tools/provider_registry.py +83 -0
  116. dr_eamer_ai_shared-1.0.0/tools/registry.py +594 -0
  117. dr_eamer_ai_shared-1.0.0/tools/semantic_scholar_tool.py +120 -0
  118. dr_eamer_ai_shared-1.0.0/tools/tts_tools.py +124 -0
  119. dr_eamer_ai_shared-1.0.0/tools/vision_tools.py +124 -0
  120. dr_eamer_ai_shared-1.0.0/tools/weather_tool.py +109 -0
  121. dr_eamer_ai_shared-1.0.0/tools/web_search_tool.py +206 -0
  122. dr_eamer_ai_shared-1.0.0/tools/wikipedia_tool.py +100 -0
  123. dr_eamer_ai_shared-1.0.0/tools/xai_tools.py +158 -0
  124. dr_eamer_ai_shared-1.0.0/tools/youtube_tool.py +131 -0
  125. dr_eamer_ai_shared-1.0.0/utils/__init__.py +88 -0
  126. dr_eamer_ai_shared-1.0.0/utils/async_adapter.py +307 -0
  127. dr_eamer_ai_shared-1.0.0/utils/citation.py +417 -0
  128. dr_eamer_ai_shared-1.0.0/utils/crypto.py +124 -0
  129. dr_eamer_ai_shared-1.0.0/utils/data_validation.py +188 -0
  130. dr_eamer_ai_shared-1.0.0/utils/document_parsers.py +979 -0
  131. dr_eamer_ai_shared-1.0.0/utils/embeddings.py +557 -0
  132. dr_eamer_ai_shared-1.0.0/utils/execution.py +375 -0
  133. dr_eamer_ai_shared-1.0.0/utils/file_utils.py +393 -0
  134. dr_eamer_ai_shared-1.0.0/utils/multi_search.py +656 -0
  135. dr_eamer_ai_shared-1.0.0/utils/progress.py +423 -0
  136. dr_eamer_ai_shared-1.0.0/utils/rate_limiter.py +88 -0
  137. dr_eamer_ai_shared-1.0.0/utils/retry_logic.py +154 -0
  138. dr_eamer_ai_shared-1.0.0/utils/text_processing.py +243 -0
  139. dr_eamer_ai_shared-1.0.0/utils/time_utils.py +471 -0
  140. dr_eamer_ai_shared-1.0.0/utils/tts.py +339 -0
  141. dr_eamer_ai_shared-1.0.0/utils/vision.py +614 -0
  142. dr_eamer_ai_shared-1.0.0/web/__init__.py +54 -0
  143. dr_eamer_ai_shared-1.0.0/web/auth.py +110 -0
  144. dr_eamer_ai_shared-1.0.0/web/cors_config.py +73 -0
  145. dr_eamer_ai_shared-1.0.0/web/health.py +79 -0
  146. dr_eamer_ai_shared-1.0.0/web/llm_proxy_blueprint.py +316 -0
  147. dr_eamer_ai_shared-1.0.0/web/middleware.py +78 -0
  148. dr_eamer_ai_shared-1.0.0/web/rate_limit.py +122 -0
  149. dr_eamer_ai_shared-1.0.0/web/swiss-design.css +490 -0
  150. dr_eamer_ai_shared-1.0.0/web/universal_proxy.py +349 -0
  151. dr_eamer_ai_shared-1.0.0/web/vision_service.py +171 -0
@@ -0,0 +1,353 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ The `/home/coolhand/shared` directory is a comprehensive Python library providing reusable AI development infrastructure. It's designed to be imported by multiple projects and contains:
8
+
9
+ - **LLM Provider Abstraction**: Unified interface for 10+ AI providers (OpenAI, Anthropic, xAI, Mistral, Cohere, Gemini, etc.)
10
+ - **Orchestration Framework**: BaseOrchestrator pattern for building multi-agent workflows with streaming support
11
+ - **MCP Server Infrastructure**: Model Context Protocol servers exposing tools, resources, and orchestration capabilities
12
+ - **Data Fetching Clients**: Structured clients for ArXiv, Census, GitHub, NASA, News APIs, Semantic Scholar, Wikipedia, YouTube, and more
13
+ - **Document Generation**: PDF, DOCX, and Markdown output with professional formatting
14
+ - **Configuration Management**: Multi-source config loading (defaults, config files, .env, environment variables)
15
+ - **Utilities**: Vision (image analysis), TTS, document parsers, async adapters, time utilities, validation
16
+
17
+ This library is published as `dr-eamer-ai-shared` and follows the naming convention "Dreamwalker" for orchestration tools.
18
+
19
+ ## Key Architecture
20
+
21
+ ### LLM Providers (`llm_providers/`)
22
+
23
+ All providers implement `BaseLLMProvider` with standardized methods:
24
+ - `complete()`: Generate completions
25
+ - `stream_complete()`: Stream completions
26
+ - `generate_image()`: Image generation (OpenAI, xAI)
27
+ - `analyze_image()`: Vision capabilities (OpenAI, Anthropic, xAI, Gemini)
28
+
29
+ Use `ProviderFactory` to instantiate providers:
30
+ ```python
31
+ from llm_providers import ProviderFactory
32
+
33
+ provider = ProviderFactory.create_provider(
34
+ provider_name='xai', # or 'openai', 'anthropic', etc.
35
+ api_key='your-key',
36
+ model='grok-3'
37
+ )
38
+
39
+ response = provider.complete(messages=[...])
40
+ ```
41
+
42
+ **Complexity Router**: `complexity_router.py` implements automatic provider selection based on task complexity (uses cheaper models for simple tasks, expensive models for complex ones).
43
+
44
+ ### Orchestration Framework (`orchestration/`)
45
+
46
+ Build multi-agent workflows by extending `BaseOrchestrator`:
47
+
48
+ **Required Methods:**
49
+ 1. `decompose_task()`: Break task into subtasks
50
+ 2. `execute_subtask()`: Execute individual subtasks
51
+ 3. `synthesize_results()`: Combine results into final output
52
+
53
+ **Built-in Orchestrators:**
54
+ - `DreamCascadeOrchestrator`: Hierarchical research (Belter → Drummer → Camina tiers)
55
+ - `DreamSwarmOrchestrator`: Multi-domain parallel search
56
+ - `SequentialOrchestrator`: Staged execution with per-step handlers
57
+ - `ConditionalOrchestrator`: Runtime branch selection
58
+ - `IterativeOrchestrator`: Looped refinement until success predicate
59
+
60
+ **Streaming Support**: All orchestrators emit `StreamEvent` objects for real-time progress tracking via SSE/webhooks.
61
+
62
+ **Document Generation**: Automatic PDF/DOCX/Markdown generation with configurable templates.
63
+
64
+ ### MCP Server (`mcp/`)
65
+
66
+ The Model Context Protocol server exposes orchestrator agents and utilities:
67
+
68
+ **Main Server**: `unified_server.py` - Comprehensive MCP server with tools and resources
69
+ **Tools Exposed**:
70
+ - `dream_research`: Execute Dream Cascade workflow
71
+ - `dream_search`: Execute Dream Swarm workflow
72
+ - `dreamwalker_status`: Check workflow status
73
+ - `dreamwalker_cancel`: Cancel running workflow
74
+ - `dreamwalker_patterns`: List orchestrator patterns
75
+ - `dreamwalker_list_tools`: List registered tools
76
+ - `dreamwalker_execute_tool`: Execute a registered tool
77
+
78
+ **Resources Exposed**:
79
+ - `orchestrator://{pattern}/info`: Orchestrator metadata
80
+ - `orchestrator://{task_id}/status`: Workflow status
81
+ - `orchestrator://{task_id}/results`: Workflow results
82
+
83
+ **Streaming**: SSE endpoint at `/stream/{task_id}` for real-time updates
84
+
85
+ **Other Servers**:
86
+ - `providers_server.py`: LLM provider discovery and invocation
87
+ - `data_server.py`: Data fetching client tools
88
+ - `cache_server.py`: Redis-based caching
89
+ - `utility_server.py`: General utilities
90
+ - `web_search_server.py`: Web search integration
91
+
92
+ **Running MCP Server**:
93
+ ```bash
94
+ cd /home/coolhand/shared/mcp
95
+ python unified_server.py
96
+ # Serves at http://localhost:5060
97
+ ```
98
+
99
+ ### Data Fetching (`data_fetching/`)
100
+
101
+ Structured API clients with consistent error handling:
102
+ - `arxiv_client.py`: Academic paper search
103
+ - `census_client.py`: US Census data
104
+ - `github_client.py`: GitHub repository/user data
105
+ - `nasa_client.py`: NASA imagery and data
106
+ - `news_client.py`: News articles via NewsAPI
107
+ - `semantic_scholar.py`: Academic citations and papers
108
+ - `wikipedia_client.py`: Wikipedia content
109
+ - `youtube_client.py`: YouTube video metadata
110
+ - `fec_client.py`: Federal Election Commission data
111
+ - `judiciary_client.py`: Court records
112
+ - `mal_client.py`: MyAnimeList data
113
+
114
+ Use `ClientFactory` for instantiation:
115
+ ```python
116
+ from data_fetching import ClientFactory
117
+
118
+ client = ClientFactory.create_client('arxiv', api_key='optional')
119
+ results = client.search(query='quantum computing', max_results=10)
120
+ ```
121
+
122
+ ### Configuration (`config.py`)
123
+
124
+ Multi-source configuration with clear precedence:
125
+ 1. Default values
126
+ 2. Custom config file (e.g., `.myapp`)
127
+ 3. `.env` file
128
+ 4. Environment variables
129
+ 5. Command-line arguments
130
+
131
+ ```python
132
+ from config import ConfigManager
133
+
134
+ config = ConfigManager(
135
+ app_name='myapp',
136
+ defaults={'MODEL': 'grok-3', 'PROVIDER': 'xai'}
137
+ )
138
+
139
+ model = config.get('MODEL')
140
+ api_key = config.get_api_key('xai')
141
+ available = config.list_available_providers()
142
+ ```
143
+
144
+ ### Web Interface (`web/dreamwalker/`)
145
+
146
+ Flask control panel for MCP orchestrator:
147
+ - Dashboard for health, tools, resources
148
+ - Launch workflows with custom parameters
149
+ - SSE proxy for browser-based streaming
150
+ - REST API for orchestration management
151
+
152
+ **Running Dreamwalker**:
153
+ ```bash
154
+ export MCP_BASE_URL=http://localhost:5060
155
+ python -m web.dreamwalker.app
156
+ # Serves at http://localhost:5000
157
+ ```
158
+
159
+ ## Common Development Tasks
160
+
161
+ ### Running Tests
162
+
163
+ ```bash
164
+ # Run all tests
165
+ pytest
166
+
167
+ # Run specific test file
168
+ pytest tests/test_orchestrators.py
169
+
170
+ # Run with verbose output
171
+ pytest -v
172
+
173
+ # Run with coverage
174
+ pytest --cov=. --cov-report=html
175
+ ```
176
+
177
+ ### Building and Installing
178
+
179
+ ```bash
180
+ # Install in editable mode (for development)
181
+ pip install -e .
182
+
183
+ # Install with all optional dependencies
184
+ pip install -e .[all]
185
+
186
+ # Install specific provider dependencies
187
+ pip install -e .[anthropic,openai,xai]
188
+
189
+ # Build distribution packages
190
+ python setup.py sdist bdist_wheel
191
+ ```
192
+
193
+ ### Using Shared Components in Other Projects
194
+
195
+ ```python
196
+ # In another project, reference shared library
197
+ import sys
198
+ sys.path.insert(0, '/home/coolhand/shared')
199
+
200
+ # Or install as package
201
+ pip install -e /home/coolhand/shared
202
+
203
+ # Then import normally
204
+ from llm_providers import ProviderFactory
205
+ from orchestration import DreamCascadeOrchestrator
206
+ from config import ConfigManager
207
+ from data_fetching import ClientFactory
208
+ ```
209
+
210
+ ### Creating Custom Orchestrators
211
+
212
+ 1. Extend `BaseOrchestrator`
213
+ 2. Implement 3 required methods: `decompose_task()`, `execute_subtask()`, `synthesize_results()`
214
+ 3. Configure with `OrchestratorConfig` or create custom config class
215
+ 4. Use built-in helpers: `_execute_agents_parallel()`, `_emit_event()`, `_generate_documents()`
216
+
217
+ See `orchestration/templates/orchestrator_template.py` for boilerplate.
218
+
219
+ Reference `ORCHESTRATOR_GUIDE.md` for detailed implementation guide.
220
+
221
+ ## Important Conventions
222
+
223
+ ### Naming Conventions
224
+ - **"Dreamwalker"** is the public-facing name for orchestration tools and MCP servers
225
+ - **"Dream Cascade"** refers to hierarchical research orchestrators (formerly "Beltalowda")
226
+ - **"Dream Swarm"** refers to multi-domain search orchestrators
227
+ - Internal code may use legacy names (`BeltalowdaOrchestrator`, `SwarmOrchestrator`) but these are aliased to new names
228
+
229
+ ### Code Style
230
+ - All code credits Luke Steuber as author
231
+ - Use first person ("I") in documentation, not "we"
232
+ - No "Created with Claude" or similar AI attribution comments
233
+ - Type hints required for public APIs
234
+ - Docstrings required for all public functions/classes
235
+
236
+ ### API Keys and Secrets
237
+ - Store in `/home/coolhand/API_KEYS.md` (referenced by global CLAUDE.md)
238
+ - Never commit API keys to version control
239
+ - Use `ConfigManager` to load keys from environment/config files
240
+ - Keys are masked when displayed via `config.as_dict(mask_secrets=True)`
241
+
242
+ ### Port Allocation
243
+ - MCP server: `5060`
244
+ - Dreamwalker UI: `5080` (when managed by service_manager)
245
+ - Development testing: `5010-5019`, `5050-5059`
246
+ - Caddy reverse proxy handles `/5010-5019` → `localhost:5010-5019`
247
+
248
+ ### File Organization
249
+ - Shared components go in `/home/coolhand/shared`
250
+ - Tests go in `tests/` directory
251
+ - MCP servers in `mcp/` subdirectory
252
+ - Documentation (guides, benchmarks) in root or relevant subdirectory
253
+
254
+ ## Dependencies
255
+
256
+ ### Core Dependencies
257
+ - `python-dotenv>=1.0.0`: Environment variable loading
258
+ - `requests>=2.32.5`: HTTP client (security patched)
259
+ - `pillow>=11.0.0`: Image processing
260
+ - `aiohttp>=3.12.14`: Async HTTP operations
261
+
262
+ ### Provider-Specific (Optional)
263
+ Install only what you need via extras:
264
+ - `anthropic`: Claude models
265
+ - `openai`: GPT models, DALL-E, Whisper
266
+ - `xai`: Grok models (uses OpenAI-compatible API)
267
+ - `mistral`: Mistral models
268
+ - `cohere`: Cohere models
269
+ - `gemini`: Google Gemini models
270
+ - `huggingface`: HuggingFace models
271
+
272
+ ### MCP Server Dependencies
273
+ - `flask>=3.0.0`, `flask-cors>=4.0.0`: Web framework
274
+ - `gunicorn>=21.0.0`: Production WSGI server
275
+ - `gevent>=24.0.0`: Async worker support (greenlet-based)
276
+
277
+ ### Document Generation (Optional)
278
+ - `reportlab>=4.0.0`: PDF generation
279
+ - `python-docx>=1.0.0`: DOCX generation
280
+
281
+ ## Integration with Main System
282
+
283
+ This shared library is part of a larger ecosystem:
284
+ - **Server**: dr.eamer.dev, d.reamwalker.com, d.reamwalk.com
285
+ - **Web Root**: `/home/coolhand/html`
286
+ - **Service Manager**: `/home/coolhand/service_manager.py` manages services
287
+ - **Caddy Config**: `/etc/caddy/Caddyfile` for reverse proxy
288
+ - **Projects Directory**: Other projects import from this shared library
289
+
290
+ When making changes that affect other projects, test integration points:
291
+ 1. Verify imports work from external projects
292
+ 2. Check MCP server endpoints are accessible
293
+ 3. Ensure Dreamwalker UI connects to MCP server correctly
294
+ 4. Validate service_manager can start/stop services
295
+
296
+ ## Troubleshooting
297
+
298
+ ### Import Errors
299
+ If imports fail, ensure:
300
+ 1. `sys.path.insert(0, '/home/coolhand/shared')` is called before imports
301
+ 2. Or install package: `pip install -e /home/coolhand/shared`
302
+ 3. Check for circular imports in module structure
303
+
304
+ ### API Provider Issues
305
+ If provider calls fail:
306
+ 1. Verify API key is set: `config.has_api_key('provider_name')`
307
+ 2. Check provider is available: `config.list_available_providers()`
308
+ 3. Install provider extras: `pip install -e .[provider_name]`
309
+ 4. Check `/home/coolhand/API_KEYS.md` for key configuration
310
+
311
+ ### MCP Server Not Starting
312
+ 1. Check port 5060 is available: `sudo lsof -i :5060`
313
+ 2. Verify dependencies installed: `pip install -r mcp/requirements.txt`
314
+ 3. Check logs for import errors or missing API keys
315
+ 4. Ensure `/home/coolhand/shared` is in PYTHONPATH
316
+
317
+ ### Orchestrator Execution Failures
318
+ 1. Verify LLM provider is configured and has API key
319
+ 2. Check task complexity matches model capabilities
320
+ 3. Review streaming events for error details
321
+ 4. Enable debug logging: `logging.basicConfig(level=logging.DEBUG)`
322
+
323
+ ## Testing Philosophy
324
+
325
+ - Write tests for public APIs and orchestrator workflows
326
+ - Mock external API calls (don't hit real APIs in tests)
327
+ - Test configuration loading from multiple sources
328
+ - Validate streaming event emission
329
+ - Test error handling and graceful degradation
330
+ - Use pytest fixtures for common setup
331
+
332
+ ## Documentation
333
+
334
+ Key documentation files in this repository:
335
+ - `ORCHESTRATOR_GUIDE.md`: Building custom orchestrators
336
+ - `ORCHESTRATOR_SELECTION_GUIDE.md`: Choosing the right pattern
337
+ - `ORCHESTRATOR_BENCHMARKS.md`: Performance characteristics
338
+ - Sample workflows in `orchestration/templates/`
339
+
340
+ Web-based documentation:
341
+ - Generated docs at `https://dr.eamer.dev/shared/`
342
+ - Tool catalog and API reference in Dreamwalker UI
343
+
344
+ ## Version Control
345
+
346
+ This library is part of a monorepo at `https://github.com/lukeslp/kernel`
347
+
348
+ When committing changes:
349
+ 1. Add and commit every 1.5 hours during active development
350
+ 2. Write clear commit messages describing "why" not just "what"
351
+ 3. Use format: `type(scope): message` (e.g., `feat(orchestration): add conditional orchestrator`)
352
+ 4. Test changes before committing: `pytest`
353
+ 5. Update CLAUDE.md when making architectural changes
@@ -0,0 +1,291 @@
1
+ # Documentation Audit & Recommendations
2
+
3
+ **Date**: November 20, 2025
4
+ **Status**: Documentation cleanup after Dreamwalker naming convention migration
5
+
6
+ ---
7
+
8
+ ## Current State
9
+
10
+ ### ✅ Documentation that EXISTS and should KEEP
11
+
12
+ **In Repository:**
13
+ 1. **CLAUDE.md** (NEW) - Comprehensive codebase guide for Claude Code
14
+ 2. **orchestration/ORCHESTRATOR_GUIDE.md** - Building custom orchestrators
15
+ 3. **orchestration/ORCHESTRATOR_SELECTION_GUIDE.md** - Decision matrices
16
+ 4. **orchestration/ORCHESTRATOR_BENCHMARKS.md** - Performance data
17
+
18
+ **As HTML (in /home/coolhand/html/shared/):**
19
+ 1. **agents.html** - Agent catalog
20
+ 2. **status.html** - Project status tracker
21
+ 3. **tools-index.html** - Tool registry
22
+ 4. **claude-code-integration.html** - Claude Code setup
23
+ 5. **dreamwalker-naming-guide.html** - Naming conventions
24
+
25
+ ---
26
+
27
+ ## 📁 DELETED Documentation (Git shows "D")
28
+
29
+ ### ⭐ HIGH VALUE - Should RESTORE or RECREATE
30
+
31
+ #### 1. **README.md** (CRITICAL)
32
+ **Status**: Deleted but had comprehensive overview
33
+ **Recommendation**: **CREATE NEW** using content from git history
34
+ **Why**: Essential for GitHub/PyPI visibility, onboarding new developers
35
+
36
+ **Suggested Content:**
37
+ - Project overview and purpose
38
+ - Quick installation (`pip install -e .`)
39
+ - Simple usage examples for each major component
40
+ - Link to CLAUDE.md for detailed architecture
41
+ - Link to orchestration guides
42
+ - Contribution guidelines
43
+ - License (MIT)
44
+
45
+ #### 2. **LLM_PROVIDER_MATRIX.md**
46
+ **Status**: Deleted, contained provider capability matrix
47
+ **Recommendation**: **RESTORE as HTML** at `/home/coolhand/html/shared/provider-matrix.html`
48
+ **Why**: User requested documentation be HTML not MD for mobile reference
49
+ **Content**: Provider comparison table, capabilities, model lists, test results
50
+
51
+ #### 3. **DATA_FETCHING_GUIDE.md**
52
+ **Status**: Deleted, contained comprehensive guide to data clients
53
+ **Recommendation**: **RESTORE as HTML** at `/home/coolhand/html/shared/data-fetching.html`
54
+ **Why**: 12+ data sources need clear documentation for discovery
55
+ **Content**: Client usage, factory patterns, API key requirements, examples
56
+
57
+ #### 4. **IMAGE_VISION_GUIDE.md**
58
+ **Status**: Deleted, contained vision/image gen guide
59
+ **Recommendation**: **RESTORE as HTML** at `/home/coolhand/html/shared/vision-guide.html`
60
+ **Why**: Vision and image generation are key features
61
+ **Content**: Provider comparison, usage examples, capabilities matrix
62
+
63
+ ---
64
+
65
+ ### 🗄️ MEDIUM VALUE - Archive to HTML or Integrate
66
+
67
+ #### 5. **MCP Documentation** (Multiple files deleted)
68
+ **Files**:
69
+ - mcp/README.md
70
+ - mcp/QUICK_START.md
71
+ - mcp/API.md
72
+ - mcp/EXAMPLES.md
73
+ - mcp/INDEX.md
74
+
75
+ **Recommendation**: **CONSOLIDATE to single HTML** at `/home/coolhand/html/shared/mcp-guide.html`
76
+ **Why**: MCP server is core functionality, needs comprehensive single-page reference
77
+ **Content**: Server overview, tool catalog, resource catalog, streaming API, deployment
78
+
79
+ #### 6. **Integration & Setup Guides**
80
+ **Files**:
81
+ - mcp/CLAUDE_CODE_SETUP.md
82
+ - mcp/CURSOR_SETUP_INSTRUCTIONS.md
83
+ - mcp/APP_INTEGRATION_GUIDE.md
84
+
85
+ **Recommendation**: **CONSOLIDATE** into existing `/home/coolhand/html/shared/claude-code-integration.html`
86
+ **Why**: Already have HTML for this, just need to ensure comprehensive
87
+
88
+ ---
89
+
90
+ ### ❌ LOW VALUE - Can ARCHIVE or DELETE
91
+
92
+ #### 7. **Status Reports** (Obsolete)
93
+ **Files**:
94
+ - COMPLETION_SUMMARY.md
95
+ - CONSOLIDATION_REPORT.md
96
+ - ENHANCEMENT_SUMMARY.md
97
+ - IMPROVEMENT_SUMMARY.md
98
+ - MIGRATION_SUMMARY.md
99
+ - EXTRACTION_SUMMARY.md
100
+
101
+ **Recommendation**: **ARCHIVE** to `.backups/documentation_archive_YYYYMMDD/`
102
+ **Why**: Historical record, but not needed for active development
103
+ **Action**: Move to archive, not in repo
104
+
105
+ #### 8. **Analysis/Audit Reports** (Obsolete)
106
+ **Files**:
107
+ - CODE_QUALITY_INDEX.md
108
+ - LOW_HANGING_FRUIT_ANALYSIS.md
109
+ - SHARED_COMPONENTS_CATALOG.md
110
+ - SHARED_USAGE_AUDIT.md
111
+ - TOOL_CAPABILITIES_AUDIT.md
112
+
113
+ **Recommendation**: **ARCHIVE** to `.backups/documentation_archive_YYYYMMDD/`
114
+ **Why**: Point-in-time analysis, superseded by current code state
115
+
116
+ #### 9. **Implementation/Planning Docs** (Obsolete)
117
+ **Files**:
118
+ - QUICK_WINS_CHECKLIST.md
119
+ - QUICK_WINS_IMPLEMENTATION.md
120
+ - MIGRATION_GUIDE.md
121
+ - MIGRATION_TARGETS.md
122
+ - MCP_IMPLEMENTATION.md
123
+ - MCP_SERVER_CONCEPT.md
124
+
125
+ **Recommendation**: **ARCHIVE**
126
+ **Why**: Implementation complete, historical interest only
127
+
128
+ #### 10. **Integration Experiments** (Obsolete)
129
+ **Files**:
130
+ - COZE_AGENTS_EVALUATION.md
131
+ - COZE_INTEGRATION_EXAMPLES.md
132
+ - HYBRID_WORKFLOW.md
133
+
134
+ **Recommendation**: **DELETE** or **ARCHIVE** if any contain useful patterns
135
+ **Why**: Experimental, likely superseded by current implementation
136
+
137
+ #### 11. **Detailed Implementation Docs** (Redundant)
138
+ **Files**:
139
+ - INTEGRATION_ARCHITECTURE_REPORT.md
140
+ - DEPLOYMENT_VERIFIED.md (mcp/)
141
+ - PRODUCTION_DEPLOYMENT_REVIEW.md (mcp/)
142
+ - IMPLEMENTATION_SUMMARY.md (mcp/)
143
+
144
+ **Recommendation**: **DELETE** - Info now in CLAUDE.md
145
+ **Why**: Architecture now documented in CLAUDE.md
146
+
147
+ ---
148
+
149
+ ## 📋 Action Plan
150
+
151
+ ### Phase 1: Critical Documentation (DO NOW)
152
+
153
+ 1. **Create README.md**
154
+ ```bash
155
+ git show HEAD:README.md > /tmp/old_readme.md
156
+ # Review and create new README.md with essential info
157
+ ```
158
+
159
+ 2. **Restore provider matrix as HTML**
160
+ ```bash
161
+ git show HEAD:LLM_PROVIDER_MATRIX.md > /tmp/provider_matrix.md
162
+ # Convert to HTML at /home/coolhand/html/shared/provider-matrix.html
163
+ ```
164
+
165
+ 3. **Restore data fetching guide as HTML**
166
+ ```bash
167
+ git show HEAD:DATA_FETCHING_GUIDE.md > /tmp/data_guide.md
168
+ # Convert to HTML at /home/coolhand/html/shared/data-fetching.html
169
+ ```
170
+
171
+ 4. **Restore vision guide as HTML**
172
+ ```bash
173
+ git show HEAD:IMAGE_VISION_GUIDE.md > /tmp/vision_guide.md
174
+ # Convert to HTML at /home/coolhand/html/shared/vision-guide.html
175
+ ```
176
+
177
+ ### Phase 2: Consolidate MCP Docs (NEXT)
178
+
179
+ 5. **Create comprehensive MCP guide HTML**
180
+ ```bash
181
+ # Combine mcp/README.md, QUICK_START.md, API.md, EXAMPLES.md
182
+ # Output: /home/coolhand/html/shared/mcp-guide.html
183
+ ```
184
+
185
+ 6. **Update claude-code-integration.html**
186
+ ```bash
187
+ # Merge setup instructions from deleted Cursor/Claude Code docs
188
+ ```
189
+
190
+ ### Phase 3: Archive Historical Docs (THEN)
191
+
192
+ 7. **Create archive directory**
193
+ ```bash
194
+ mkdir -p /home/coolhand/shared/.backups/documentation_archive_20251120
195
+ ```
196
+
197
+ 8. **Move obsolete docs to archive**
198
+ ```bash
199
+ # Use git show to extract old files and save to archive
200
+ # Keep in git history, just not active in repo
201
+ ```
202
+
203
+ ### Phase 4: Organize HTML Documentation (FINALLY)
204
+
205
+ 9. **Create documentation index**
206
+ ```bash
207
+ # Create /home/coolhand/html/shared/docs.html
208
+ # Central hub linking to all documentation
209
+ ```
210
+
211
+ ---
212
+
213
+ ## 🎯 Final Documentation Structure
214
+
215
+ ### In Repository (`/home/coolhand/shared/`)
216
+ ```
217
+ shared/
218
+ ├── CLAUDE.md # Codebase guide for Claude Code
219
+ ├── README.md # Project overview (TO CREATE)
220
+ ├── LICENSE # MIT license
221
+ ├── setup.py # Package setup
222
+ ├── pyproject.toml # Modern Python packaging
223
+ ├── pytest.ini # Test configuration
224
+ └── orchestration/
225
+ ├── ORCHESTRATOR_GUIDE.md # Building custom orchestrators
226
+ ├── ORCHESTRATOR_SELECTION_GUIDE.md # Decision matrices
227
+ └── ORCHESTRATOR_BENCHMARKS.md # Performance data
228
+ ```
229
+
230
+ ### As HTML (`/home/coolhand/html/shared/`)
231
+ ```
232
+ html/shared/
233
+ ├── index.html # Documentation hub (TO CREATE)
234
+ ├── agents.html # Agent catalog ✅
235
+ ├── status.html # Project status ✅
236
+ ├── tools-index.html # Tool registry ✅
237
+ ├── provider-matrix.html # LLM provider capabilities (TO CREATE)
238
+ ├── data-fetching.html # Data client guide (TO CREATE)
239
+ ├── vision-guide.html # Vision/Image gen guide (TO CREATE)
240
+ ├── mcp-guide.html # MCP server comprehensive guide (TO CREATE)
241
+ ├── claude-code-integration.html # IDE setup ✅
242
+ └── dreamwalker-naming-guide.html # Naming conventions ✅
243
+ ```
244
+
245
+ ### Archived (`/home/coolhand/shared/.backups/`)
246
+ ```
247
+ .backups/
248
+ └── documentation_archive_20251120/
249
+ ├── status_reports/ # All *_SUMMARY.md files
250
+ ├── analysis_reports/ # All *_AUDIT.md, *_INDEX.md files
251
+ ├── implementation_plans/ # All *_GUIDE.md, *_IMPLEMENTATION.md
252
+ └── experiments/ # COZE_*, HYBRID_*, etc.
253
+ ```
254
+
255
+ ---
256
+
257
+ ## 💡 Guidelines for Future Documentation
258
+
259
+ ### When to Use Markdown (in repo)
260
+ - **CLAUDE.md**: Codebase architecture for AI assistants
261
+ - **README.md**: Project overview and quick start
262
+ - **Guides**: Step-by-step tutorials (orchestrator guides)
263
+ - **Technical specs**: API contracts, data models
264
+
265
+ ### When to Use HTML (in /home/coolhand/html/shared/)
266
+ - **Reference materials**: Matrices, catalogs, indexes
267
+ - **Interactive docs**: Searchable tool lists, filterable tables
268
+ - **Mobile-friendly**: User wants to reference on phone
269
+ - **Rich formatting**: Code highlighting, collapsible sections
270
+ - **Frequent updates**: Status trackers, dashboards
271
+
272
+ ### Documentation Principles
273
+ 1. **Single Source of Truth**: Don't duplicate content
274
+ 2. **Link Rather Than Copy**: Reference other docs
275
+ 3. **Keep It Current**: Delete obsolete docs, don't let them rot
276
+ 4. **Make It Discoverable**: Central index/hub
277
+ 5. **User-Focused**: What do developers need to know?
278
+
279
+ ---
280
+
281
+ ## Summary
282
+
283
+ **Immediate Actions:**
284
+ 1. ✅ CLAUDE.md created
285
+ 2. ⏳ Create README.md from git history
286
+ 3. ⏳ Convert 3 key MD guides to HTML (provider matrix, data fetching, vision)
287
+ 4. ⏳ Consolidate MCP docs to single HTML
288
+ 5. ⏳ Archive obsolete status/analysis reports
289
+ 6. ⏳ Create documentation index hub
290
+
291
+ **Result**: Clean, maintainable documentation structure optimized for reference on mobile, with clear separation between in-repo guides and web-based catalogs.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Luke Steuber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.