fusesell 1.3.42__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 (35) hide show
  1. fusesell-1.3.42.dist-info/METADATA +873 -0
  2. fusesell-1.3.42.dist-info/RECORD +35 -0
  3. fusesell-1.3.42.dist-info/WHEEL +5 -0
  4. fusesell-1.3.42.dist-info/entry_points.txt +2 -0
  5. fusesell-1.3.42.dist-info/licenses/LICENSE +21 -0
  6. fusesell-1.3.42.dist-info/top_level.txt +2 -0
  7. fusesell.py +20 -0
  8. fusesell_local/__init__.py +37 -0
  9. fusesell_local/api.py +343 -0
  10. fusesell_local/cli.py +1480 -0
  11. fusesell_local/config/__init__.py +11 -0
  12. fusesell_local/config/default_email_templates.json +34 -0
  13. fusesell_local/config/default_prompts.json +19 -0
  14. fusesell_local/config/default_scoring_criteria.json +154 -0
  15. fusesell_local/config/prompts.py +245 -0
  16. fusesell_local/config/settings.py +277 -0
  17. fusesell_local/pipeline.py +978 -0
  18. fusesell_local/stages/__init__.py +19 -0
  19. fusesell_local/stages/base_stage.py +603 -0
  20. fusesell_local/stages/data_acquisition.py +1820 -0
  21. fusesell_local/stages/data_preparation.py +1238 -0
  22. fusesell_local/stages/follow_up.py +1728 -0
  23. fusesell_local/stages/initial_outreach.py +2972 -0
  24. fusesell_local/stages/lead_scoring.py +1452 -0
  25. fusesell_local/utils/__init__.py +36 -0
  26. fusesell_local/utils/agent_context.py +552 -0
  27. fusesell_local/utils/auto_setup.py +361 -0
  28. fusesell_local/utils/birthday_email_manager.py +467 -0
  29. fusesell_local/utils/data_manager.py +4857 -0
  30. fusesell_local/utils/event_scheduler.py +959 -0
  31. fusesell_local/utils/llm_client.py +342 -0
  32. fusesell_local/utils/logger.py +203 -0
  33. fusesell_local/utils/output_helpers.py +2443 -0
  34. fusesell_local/utils/timezone_detector.py +914 -0
  35. fusesell_local/utils/validators.py +436 -0
@@ -0,0 +1,873 @@
1
+ Metadata-Version: 2.4
2
+ Name: fusesell
3
+ Version: 1.3.42
4
+ Summary: Complete AI-powered sales automation pipeline that runs entirely on your local machine.
5
+ Author-email: RealTimeX Team <info@realtimex.ai>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/rtavytran/fusesell
8
+ Project-URL: Source, https://github.com/rtavytran/fusesell
9
+ Project-URL: Issues, https://github.com/rtavytran/fusesell/issues
10
+ Project-URL: Changelog, https://github.com/rtavytran/fusesell/blob/main/CHANGELOG.md
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: openai>=1.0.0
15
+ Requires-Dist: requests>=2.25.0
16
+ Requires-Dist: beautifulsoup4>=4.9.0
17
+ Requires-Dist: python-dateutil>=2.8.0
18
+ Requires-Dist: pytz>=2021.1
19
+ Provides-Extra: ocr
20
+ Requires-Dist: pytesseract>=0.3.8; extra == "ocr"
21
+ Requires-Dist: pillow>=8.0.0; extra == "ocr"
22
+ Requires-Dist: easyocr>=1.6.0; extra == "ocr"
23
+ Provides-Extra: pdf
24
+ Requires-Dist: PyPDF2>=3.0.0; extra == "pdf"
25
+ Requires-Dist: PyMuPDF>=1.20.0; extra == "pdf"
26
+ Provides-Extra: gcv
27
+ Requires-Dist: google-cloud-vision>=2.0.0; extra == "gcv"
28
+ Provides-Extra: dev
29
+ Requires-Dist: psutil>=5.8.0; extra == "dev"
30
+ Requires-Dist: pytest>=8.0.0; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # FuseSell Local
34
+
35
+ **Complete AI-powered sales automation pipeline that runs entirely on your local machine.**
36
+
37
+ FuseSell Local is a production-ready implementation of the FuseSell AI sales automation system, converted from server-based YAML workflows to a comprehensive Python command-line tool with full data ownership and privacy control.
38
+
39
+ Latest release: `fusesell==1.2.1` is available on PyPI via `pip install fusesell`.
40
+
41
+ Contributors should review the [Repository Guidelines](AGENTS.md) before opening a pull request.
42
+
43
+ ## 🚀 Complete Pipeline Overview
44
+
45
+ FuseSell Local processes leads through a complete 5-stage AI-powered pipeline:
46
+
47
+ 1. **Data Acquisition** ✅ - Multi-source customer data extraction (websites, business cards, social media)
48
+ 2. **Data Preparation** ✅ - AI-powered customer profiling and pain point analysis
49
+ 3. **Lead Scoring** ✅ - Advanced product-customer fit evaluation with detailed scoring
50
+ 4. **Initial Outreach** ✅ - Intelligent email generation with multiple personalized approaches
51
+ 5. **Follow-up** ✅ - Context-aware follow-up sequences with interaction history analysis
52
+
53
+ **Status: 100% Complete - Production Ready**
54
+
55
+ ## 🚀 Quick Start
56
+
57
+ ### Installation
58
+
59
+ 1. **Install Python dependencies:**
60
+
61
+ ```bash
62
+ cd fusesell-local
63
+ pip install -r requirements.txt
64
+ ```
65
+
66
+ **That's it!** No additional setup required. The system automatically creates all necessary database tables and default configurations on first run.
67
+
68
+ 2. **Test the installation:**
69
+
70
+ ```bash
71
+ python fusesell.py --openai-api-key YOUR_API_KEY \
72
+ --org-id test_org \
73
+ --org-name "Test Company" \
74
+ --input-website "https://example.com" \
75
+ --dry-run
76
+ ```
77
+
78
+ ### First Run (Complete Pipeline)
79
+
80
+ ```bash
81
+ # Full end-to-end sales automation
82
+ python fusesell.py \
83
+ --openai-api-key "sk-your-key" \
84
+ --org-id "mycompany" \
85
+ --org-name "My Company Inc" \
86
+ --input-website "https://targetcompany.com"
87
+ ```
88
+
89
+ This single command will:
90
+ 1. Extract customer data from the website
91
+ 2. Analyze and structure the data using AI
92
+ 3. Score the lead against your products
93
+ 4. Generate personalized email drafts
94
+ 5. Create follow-up sequences
95
+
96
+ ## Library Integration
97
+
98
+ FuseSell Local can now be imported directly so orchestrators like RealtimeX can execute the pipeline without spawning the CLI.
99
+
100
+ 1. Install the package in your Python environment:
101
+
102
+ ```bash
103
+ pip install fusesell
104
+ ```
105
+
106
+ 2. Run the pipeline programmatically with default helpers:
107
+
108
+ ```python
109
+ from fusesell_local import execute_pipeline
110
+
111
+ result = execute_pipeline(
112
+ {
113
+ "openai_api_key": "sk-your-key",
114
+ "org_id": "mycompany",
115
+ "org_name": "My Company Inc",
116
+ "full_input": "Seller: My Company Inc, Customer: Target Corp, Communication: English",
117
+ "input_website": "https://targetcompany.com",
118
+ }
119
+ )
120
+
121
+ print(result["status"])
122
+ ```
123
+
124
+ 3. For finer-grained control (custom logging, shared storage, etc.), compose the lower-level utilities:
125
+
126
+ ```python
127
+ from fusesell_local import (
128
+ build_config,
129
+ configure_logging,
130
+ prepare_data_directory,
131
+ run_pipeline,
132
+ validate_config,
133
+ )
134
+
135
+ options = {
136
+ "openai_api_key": "sk-your-key",
137
+ "org_id": "mycompany",
138
+ "org_name": "My Company Inc",
139
+ "full_input": "Seller: My Company Inc, Customer: Target Corp, Communication: English",
140
+ "input_website": "https://targetcompany.com",
141
+ "customer_timezone": "America/New_York",
142
+ }
143
+
144
+ config = build_config(options)
145
+ prepare_data_directory(config)
146
+ configure_logging(config)
147
+ valid, errors = validate_config(config)
148
+ if not valid:
149
+ raise ValueError(errors)
150
+
151
+ outputs = run_pipeline(config)
152
+ ```
153
+
154
+ When embedding FuseSell inside ephemeral interpreter services, consider supplying a custom `data_dir` scoped per run and set `auto_configure_logging=False` if you prefer stdout logging.
155
+
156
+ 4. Reuse the packaged CLI inside scripts or tests:
157
+
158
+ ```python
159
+ from fusesell_local import FuseSellCLI
160
+
161
+ cli = FuseSellCLI()
162
+ cli.run([
163
+ "--openai-api-key", "sk-your-key",
164
+ "--org-id", "mycompany",
165
+ "--org-name", "My Company Inc",
166
+ "--full-input", "Seller: My Company Inc, Customer: Target Corp, Communication: English",
167
+ "--input-description", "Example Corp lead from automation script",
168
+ "--dry-run",
169
+ ])
170
+ ```
171
+
172
+ ## 📋 Complete Usage Examples
173
+
174
+ ### Example 1: Full Pipeline - Website to Follow-up
175
+
176
+ ```bash
177
+ # Complete end-to-end sales automation
178
+ python fusesell.py \
179
+ --openai-api-key "sk-proj-abc123" \
180
+ --org-id "mycompany" \
181
+ --org-name "My Company Inc" \
182
+ --input-website "https://targetcompany.com"
183
+ ```
184
+
185
+ **Complete Pipeline Execution:**
186
+ 1. **Data Acquisition**: Scrapes website, extracts company information
187
+ 2. **Data Preparation**: AI analysis of company profile and pain points
188
+ 3. **Lead Scoring**: Evaluates product-customer fit with detailed scoring
189
+ 4. **Initial Outreach**: Generates 4 personalized email draft variations
190
+ 5. **Follow-up**: Creates context-aware follow-up sequence strategies
191
+ ### Exa
192
+ mple 2: Multi-Source Data Collection
193
+
194
+ ```bash
195
+ # Combine multiple data sources for comprehensive profiling
196
+ python fusesell.py \
197
+ --openai-api-key "sk-proj-abc123" \
198
+ --org-id "mycompany" \
199
+ --org-name "My Company Inc" \
200
+ --input-website "https://targetcompany.com" \
201
+ --input-business-card "https://example.com/business-card.jpg" \
202
+ --input-linkedin-url "https://linkedin.com/company/targetcompany" \
203
+ --input-facebook-url "https://facebook.com/targetcompany" \
204
+ --input-description "Leading fintech startup in NYC, 50+ employees"
205
+ ```
206
+
207
+ **Multi-Source Processing:**
208
+ - **Website**: Company information, services, team details
209
+ - **Business Card**: Contact information via OCR processing
210
+ - **LinkedIn**: Professional information, company updates, connections
211
+ - **Facebook**: Business information, customer engagement, posts
212
+ - **Description**: Additional context and insights
213
+
214
+ ### Example 3: Email Generation and Management
215
+
216
+ ```bash
217
+ # Generate initial outreach emails only
218
+ python fusesell.py \
219
+ --openai-api-key "sk-proj-abc123" \
220
+ --org-id "mycompany" \
221
+ --org-name "My Company Inc" \
222
+ --input-description "Customer: John Smith at Acme Corp, email: john@acme.com, industry: manufacturing" \
223
+ --stop-after initial_outreach
224
+ ```
225
+
226
+ **Email Generation Features:**
227
+ - **4 Draft Approaches**: Professional Direct, Consultative, Industry Expert, Relationship Building
228
+ - **Personalized Subject Lines**: 4 variations per draft
229
+ - **Personalization Scoring**: 0-100 score based on customer data usage
230
+ - **Draft Comparison**: Side-by-side analysis with recommendations
231
+
232
+ ### Example 4: Email Sending with Smart Scheduling
233
+
234
+ ```bash
235
+ # Send email with optimal timing
236
+ python fusesell.py \
237
+ --action send \
238
+ --selected-draft-id "draft_professional_direct_abc123" \
239
+ --recipient-address "john@acme.com" \
240
+ --recipient-name "John Smith" \
241
+ --org-id "mycompany" \
242
+ --customer-timezone "America/New_York" \
243
+ --business-hours-start "09:00" \
244
+ --business-hours-end "17:00"
245
+ ```
246
+
247
+ **Smart Scheduling Features:**
248
+ - **Timezone Intelligence**: Respects customer's business hours
249
+ - **Optimal Timing**: 2-hour default delay with business hours respect
250
+ - **Weekend Handling**: Automatically schedules for next business day
251
+ - **Database Events**: Creates events for external app processing
252
+
253
+ ### Example 5: Follow-up Email Generation
254
+
255
+ ```bash
256
+ # Generate context-aware follow-up emails
257
+ python fusesell.py \
258
+ --action draft_write \
259
+ --stage follow_up \
260
+ --execution-id "exec_abc123_20241209" \
261
+ --org-id "mycompany"
262
+ ```
263
+
264
+ **Follow-up Intelligence:**
265
+ - **Interaction Analysis**: Analyzes previous email history and engagement
266
+ - **Strategy Selection**: Chooses appropriate follow-up approach (1st, 2nd, 3rd, final)
267
+ - **Context Awareness**: References previous interactions appropriately
268
+ - **Respectful Limits**: Maximum 5 follow-ups with graceful closure
269
+
270
+ ### Example 6: Draft Rewriting and Improvement
271
+
272
+ ```bash
273
+ # Rewrite existing draft based on feedback
274
+ python fusesell.py \
275
+ --action draft_rewrite \
276
+ --selected-draft-id "draft_consultative_xyz789" \
277
+ --reason "Make it more technical and focus on ROI benefits" \
278
+ --org-id "mycompany"
279
+ ```
280
+
281
+ **Draft Rewriting Features:**
282
+ - **LLM-Powered Rewriting**: Uses AI to incorporate feedback
283
+ - **Version Control**: Tracks all rewrites with history
284
+ - **Personalization Maintenance**: Keeps customer-specific details
285
+ - **Improvement Tracking**: Monitors changes and effectiveness
286
+
287
+ ### Example 7: Pipeline Control and Testing
288
+
289
+ ```bash
290
+ # Stop after lead scoring (don't generate emails)
291
+ python fusesell.py \
292
+ --openai-api-key "sk-proj-abc123" \
293
+ --org-id "mycompany" \
294
+ --org-name "My Company Inc" \
295
+ --input-website "https://targetcorp.com" \
296
+ --stop-after lead_scoring
297
+
298
+ # Skip follow-up generation
299
+ python fusesell.py \
300
+ --openai-api-key "sk-proj-abc123" \
301
+ --org-id "mycompany" \
302
+ --org-name "My Company Inc" \
303
+ --input-website "https://targetcorp.com" \
304
+ --skip-stages follow_up
305
+
306
+ # Dry run (no API calls, uses mock data)
307
+ python fusesell.py \
308
+ --openai-api-key "test-key" \
309
+ --org-id "test" \
310
+ --org-name "Test Company" \
311
+ --input-website "https://example.com" \
312
+ --dry-run
313
+
314
+ # Debug mode with detailed logging
315
+ python fusesell.py \
316
+ --openai-api-key "sk-proj-abc123" \
317
+ --org-id "mycompany" \
318
+ --org-name "My Company Inc" \
319
+ --input-website "https://targetcorp.com" \
320
+ --log-level DEBUG
321
+ ```
322
+
323
+ ### Example 8: Process Continuation
324
+
325
+ ```bash
326
+ # First run - stop after data preparation
327
+ python fusesell.py \
328
+ --openai-api-key "sk-proj-abc123" \
329
+ --org-id "mycompany" \
330
+ --org-name "My Company Inc" \
331
+ --input-website "https://targetcorp.com" \
332
+ --execution-id "lead_001" \
333
+ --stop-after data_preparation
334
+
335
+ # Continue from where we left off
336
+ python fusesell.py \
337
+ --openai-api-key "sk-proj-abc123" \
338
+ --org-id "mycompany" \
339
+ --org-name "My Company Inc" \
340
+ --continue-execution "lead_001" \
341
+ --continue-action "approve_and_continue"
342
+ ```
343
+
344
+ ## 📊 Command Reference
345
+
346
+ ### Required Arguments
347
+
348
+ | Argument | Description | Example |
349
+ | ------------------ | -------------------------------------------------------- | ------------------------------------------------------------- |
350
+ | `--openai-api-key` | Your OpenAI API key | `sk-proj-abc123...` |
351
+ | `--org-id` | Organization identifier | `rta` |
352
+ | `--org-name` | Organization name | `"RTA Corp"` |
353
+ | `--full-input` | Full information input (Seller, Customer, Communication) | `"Seller: RTA Corp, Customer: Nagen, Communication: English"` |
354
+
355
+ ### Data Sources (At Least One Required)
356
+
357
+ | Argument | Description | Example |
358
+ | ----------------------- | ------------------------------------------------------ | ------------------------------------------------------------------------------ |
359
+ | `--input-website` | Website URL (empty if not provided) | `https://example.com` |
360
+ | `--input-description` | Full customer info (name, phone, email, address, etc.) | `"Customer: Simone Simmons of company Nagen with email: simonesimmons@rta.vn"` |
361
+ | `--input-business-card` | Business card image URL (empty if not provided) | `https://example.com/card.jpg` |
362
+ | `--input-linkedin-url` | LinkedIn profile/business page URL | `https://linkedin.com/company/acme` |
363
+ | `--input-facebook-url` | Facebook profile/business page URL | `https://facebook.com/acme` |
364
+ | `--input-freetext` | Free text input with customer information | `"Contact John at Acme Corp for software solutions"` |
365
+
366
+ ### Optional Context Fields
367
+
368
+ | Argument | Description | Example |
369
+ | --------------- | ----------------------------------------------- | ------------------------------------------- |
370
+ | `--customer-id` | Customer ID for tracking (null if not provided) | `uuid:5b06617a-339e-47c2-b516-6b32de8ec9a7` |
371
+
372
+ ### Pipeline Control
373
+
374
+ | Argument | Description | Example |
375
+ | ---------------------- | --------------------------- | ---------------------------------------- |
376
+ | `--stop-after` | Stop after specific stage | `--stop-after lead_scoring` |
377
+ | `--skip-stages` | Skip specific stages | `--skip-stages follow_up` |
378
+ | `--continue-execution` | Continue previous execution | `--continue-execution exec_123` |
379
+ | `--continue-action` | Action for continuation | `--continue-action approve_and_continue` |
380
+
381
+ ### Output Options
382
+
383
+ | Argument | Description | Example |
384
+ | ----------------- | ------------------------ | ---------------------- |
385
+ | `--output-format` | Output format | `json`, `yaml`, `text` |
386
+ | `--data-dir` | Data directory | `./my_data` |
387
+ | `--execution-id` | Custom execution ID | `my_execution_001` |
388
+ | `--dry-run` | Test mode (no API calls) | `--dry-run` |
389
+
390
+ ### Team & Project Settings
391
+
392
+ | Argument | Description | Example |
393
+ | ---------------- | --------------- | ------------------------------------------- |
394
+ | `--team-id` | Team identifier | `uuid:6dc8faf9-cf04-07eb-846b-a928dddd701c` |
395
+ | `--team-name` | Team name | `"Annuity Products Sales Team"` |
396
+ | `--project-code` | Project code | `C1293` |
397
+
398
+ ### Advanced Options
399
+
400
+ | Argument | Description | Example |
401
+ | ------------------- | ------------------------------- | -------------------------- |
402
+ | `--language` | Processing language | `en`, `vi` |
403
+ | `--llm-temperature` | LLM creativity (0.0-1.0) | `0.7` |
404
+ | `--llm-max-tokens` | Max tokens per request | `2000` |
405
+ | `--serper-api-key` | Serper API key for enhanced web scraping | `your-serper-key` |
406
+ | `--log-level` | Logging level | `DEBUG`, `INFO`, `WARNING` |
407
+
408
+ ### Email Scheduling Options
409
+
410
+ | Argument | Description | Example |
411
+ | ------------------------ | ---------------------------------- | -------------------- |
412
+ | `--send-immediately` | Skip timing optimization, send now | `--send-immediately` |
413
+ | `--customer-timezone` | Customer's timezone | `"America/New_York"` |
414
+ | `--business-hours-start` | Business hours start time | `"09:00"` |
415
+ | `--business-hours-end` | Business hours end time | `"17:00"` |
416
+ | `--delay-hours` | Custom delay before sending | `4` |
417
+
418
+ ### Action-Based Operations
419
+
420
+ | Action | Description | Required Parameters |
421
+ | --------------- | ------------------------- | -------------------------------------------- |
422
+ | `draft_write` | Generate new email drafts | `--org-id`, `--org-name` |
423
+ | `draft_rewrite` | Modify existing draft | `--selected-draft-id`, `--reason` |
424
+ | `send` | Send/schedule email | `--selected-draft-id`, `--recipient-address` |
425
+ | `close` | Close outreach sequence | `--reason` |
426
+
427
+ ### Stage-Specific Operations
428
+
429
+ | Stage | Purpose | Key Parameters |
430
+ | ------------------ | --------------------- | ---------------------------------------- |
431
+ | `data_acquisition` | Extract customer data | `--input-website`, `--input-description` |
432
+ | `data_preparation` | AI customer analysis | Automatic (uses previous stage data) |
433
+ | `lead_scoring` | Product-customer fit | Automatic (uses previous stage data) |
434
+ | `initial_outreach` | Email generation | `--action draft_write` |
435
+ | `follow_up` | Follow-up sequences | `--action draft_write`, `--execution-id` |
436
+
437
+ ## 🌐 Enha
438
+ nced Web Scraping with Serper API
439
+
440
+ **Optional but Recommended:** Add `--serper-api-key` for better data collection:
441
+
442
+ ```bash
443
+ # Enhanced scraping capabilities
444
+ python fusesell.py \
445
+ --openai-api-key "sk-proj-abc123" \
446
+ --serper-api-key "your-serper-key" \
447
+ --org-id "mycompany" \
448
+ --org-name "My Company Inc" \
449
+ --input-website "https://targetcompany.com"
450
+ ```
451
+
452
+ **Benefits:**
453
+ - 🌐 **Better Website Scraping**: More reliable content extraction
454
+ - 🔍 **Company Research**: Automatic Google search for company info
455
+ - 📱 **Social Media Access**: Enhanced LinkedIn/Facebook scraping
456
+ - 🛑 **Graceful Fallback**: Works without Serper API (shows warnings)
457
+
458
+ **Get Serper API Key:** Visit [serper.dev](https://serper.dev) -> Sign up -> Get free API key
459
+
460
+ ## 🔄 Complete Pipeline Stages
461
+
462
+ ### 1. Data Acquisition ✅
463
+
464
+ **Purpose:** Multi-source customer data extraction
465
+
466
+ **Data Sources:**
467
+ - **Website Scraping**: Company information, contact details, business description
468
+ - **Business Card OCR**: Contact extraction from images (Tesseract, EasyOCR, Cloud APIs)
469
+ - **LinkedIn Profiles**: Professional information, company details, connections
470
+ - **Facebook Pages**: Business information, contact details, public posts
471
+ - **Manual Input**: Structured customer descriptions
472
+
473
+ **AI Processing:**
474
+ - LLM-powered information extraction and structuring
475
+ - Multi-source data merging and conflict resolution
476
+ - Company research via search APIs
477
+
478
+ **Output:** Comprehensive customer profile with contact information
479
+
480
+ ### 2. Data Preparation ✅
481
+
482
+ **Purpose:** AI-powered customer profiling and analysis
483
+
484
+ **AI Analysis:**
485
+ - **Customer Profiling**: Structured company information extraction
486
+ - **Pain Point Identification**: Categorized business challenges and priorities
487
+ - **Financial Analysis**: Revenue estimation, growth potential, funding sources
488
+ - **Technology Assessment**: Digital maturity and technology stack analysis
489
+ - **Competitive Analysis**: Market positioning and competitive landscape
490
+ - **Development Planning**: Growth plans, timeline estimates, resource requirements
491
+
492
+ **Output:** Enriched customer profile with pain points and business insights
493
+
494
+ ### 3. Lead Scoring ✅
495
+
496
+ **Purpose:** Advanced product-customer fit evaluation
497
+
498
+ **Scoring Framework:**
499
+ - **5 Weighted Criteria**: Industry fit, company size, pain points, technology, budget
500
+ - **ROI Analysis**: Payback period estimation and financial impact assessment
501
+ - **Implementation Feasibility**: Technical complexity and resource requirements
502
+ - **Competitive Positioning**: Market advantage and differentiation analysis
503
+ - **Feature Alignment**: Product capabilities vs. customer needs matching
504
+ - **Scalability Assessment**: Growth potential and expansion opportunities
505
+
506
+ **Output:** Detailed scoring breakdown with product recommendations and justifications
507
+
508
+ ### 4. Initial Outreach ✅
509
+
510
+ **Purpose:** Intelligent email generation and draft management
511
+
512
+ **Email Generation:**
513
+ - **4 Approach Variations**: Professional Direct, Consultative, Industry Expert, Relationship Building
514
+ - **Personalized Subject Lines**: 4 variations per draft with company-specific messaging
515
+ - **Advanced Personalization**: 0-100 scoring based on customer data usage
516
+ - **Call-to-Action Optimization**: Automatic CTA extraction and optimization
517
+
518
+ **Draft Management:**
519
+ - **Comparison System**: Side-by-side draft analysis with recommendations
520
+ - **Version Control**: Track original drafts and all rewrites with history
521
+ - **Selection Algorithms**: Configurable criteria-based best draft selection
522
+ - **Customer Readiness**: Outreach readiness scoring with improvement recommendations
523
+
524
+ **Output:** Multiple personalized email drafts with management tools
525
+
526
+ ### 5. Follow-up ✅
527
+
528
+ **Purpose:** Context-aware follow-up sequences with interaction analysis
529
+
530
+ **Interaction Analysis:**
531
+ - **History Tracking**: Days since last interaction, total attempts, engagement patterns
532
+ - **Sentiment Detection**: Customer response analysis and engagement level scoring
533
+ - **Sequence Intelligence**: Automatic progression through follow-up stages
534
+ - **Respectful Limits**: Maximum 5 follow-ups with graceful closure handling
535
+
536
+ **Follow-up Strategies:**
537
+ - **Gentle Reminder** (1st): Friendly check-in with soft approach
538
+ - **Value-Add** (2nd): Industry insights, resources, and helpful information
539
+ - **Alternative Approach** (3rd): Different angle, case studies, social proof
540
+ - **Final Attempt** (4th): Respectful closure with future opportunity maintenance
541
+ - **Graceful Farewell** (5th): Professional relationship preservation
542
+
543
+ **Smart Features:**
544
+ - **Timing Intelligence**: Minimum 3-day intervals between follow-ups
545
+ - **Context Awareness**: References previous interactions appropriately
546
+ - **Engagement Adaptation**: Adjusts tone and approach based on customer behavior
547
+
548
+ **Output:** Context-aware follow-up emails with sequence management
549
+
550
+ ## 🔍 M
551
+ anaging Multiple Sales Processes
552
+
553
+ When running multiple sales processes, use the querying tools:
554
+
555
+ ```bash
556
+ # List all recent sales processes
557
+ python query_sales_processes.py --list
558
+
559
+ # Get complete details for a specific process
560
+ python query_sales_processes.py --details "fusesell_20251010_141010_3fe0e655"
561
+
562
+ # Find processes by customer name
563
+ python query_sales_processes.py --customer "Target Corp"
564
+
565
+ # Get specific stage results
566
+ python query_sales_processes.py --stage-result "task_id" "lead_scoring"
567
+ ```
568
+
569
+ **📚 Complete querying guide: [QUERYING_GUIDE.md](QUERYING_GUIDE.md)**
570
+
571
+ ## 📁 Data Storage & Configuration
572
+
573
+ All data is stored locally in the `fusesell_data` directory with **100% server-compatible schema**:
574
+
575
+ ```
576
+ fusesell_data/
577
+ +--- fusesell.db # SQLite database
578
+ +--- config/ # Configuration files
579
+ | +--- prompts.json # LLM prompts
580
+ | +--- scoring_criteria.json
581
+ | +--- email_templates.json
582
+ +--- drafts/ # Generated email drafts
583
+ +--- logs/ # Execution logs
584
+ ```
585
+
586
+ ### Database Tables
587
+
588
+ - `executions` - Execution records and metadata
589
+ - `customers` - Customer profiles and information
590
+ - `lead_scores` - Lead scoring results and breakdowns
591
+ - `email_drafts` - Generated email drafts and variations
592
+ - `stage_results` - Intermediate results from each stage
593
+
594
+ ### 🔧 Server-Compatible Database Schema
595
+
596
+ FuseSell Local uses **exact server table names** for seamless integration:
597
+
598
+ - **`llm_worker_task`**: Task management (matches server exactly)
599
+ - **`llm_worker_operation`**: Stage execution tracking (matches server exactly)
600
+ - **`gs_customer_llmtask`**: Customer data storage (matches server exactly)
601
+ - **`executions`**: Backward compatibility VIEW that maps to `llm_worker_task`
602
+
603
+ ### Configuration Files
604
+
605
+ #### Custom Prompts (`config/prompts.json`)
606
+
607
+ Customize LLM prompts for different stages:
608
+
609
+ ```json
610
+ {
611
+ "data_preparation": {
612
+ "customer_analysis": "Your custom prompt for customer analysis...",
613
+ "pain_point_identification": "Your custom prompt for pain points..."
614
+ },
615
+ "lead_scoring": {
616
+ "product_evaluation": "Your custom scoring prompt..."
617
+ }
618
+ }
619
+ ```
620
+
621
+ #### Scoring Criteria (`config/scoring_criteria.json`)
622
+
623
+ Customize lead scoring weights and criteria:
624
+
625
+ ```json
626
+ {
627
+ "criteria": {
628
+ "industry_fit": { "weight": 25, "description": "Industry alignment" },
629
+ "company_size": { "weight": 20, "description": "Company size fit" },
630
+ "pain_points": { "weight": 30, "description": "Pain point match" },
631
+ "technology": { "weight": 15, "description": "Technology compatibility" },
632
+ "budget": { "weight": 10, "description": "Budget indicators" }
633
+ }
634
+ }
635
+ ```
636
+
637
+ ## 🎯 Key Features
638
+
639
+ ### ✅ Complete AI-Powered Sales Automation
640
+
641
+ - **Multi-Source Data Collection**: Websites, business cards (OCR), LinkedIn, Facebook
642
+ - **AI Customer Profiling**: Pain point analysis, company research, financial assessment
643
+ - **Intelligent Lead Scoring**: Product-customer fit evaluation with detailed breakdowns
644
+ - **Personalized Email Generation**: 4 different approaches with subject line variations
645
+ - **Context-Aware Follow-ups**: Smart sequence management with interaction history analysis
646
+
647
+ ### ✅ 100% Local Execution & Privacy
648
+
649
+ - **Complete Data Ownership**: All customer data stays on your machine
650
+ - **No External Dependencies**: Except OpenAI API for LLM processing
651
+ - **SQLite Database**: Local data storage with full CRUD operations
652
+ - **Event-Based Scheduling**: Database events for external app integration
653
+ - **Comprehensive Logging**: Detailed execution tracking and debugging
654
+
655
+ ### ✅ Production-Ready Architecture
656
+
657
+ - **Action-Based Routing**: draft_write, draft_rewrite, send, close operations
658
+ - **Error Handling**: Graceful degradation with fallback templates
659
+ - **Draft Management**: Comparison, versioning, and selection utilities
660
+ - **Timezone Intelligence**: Optimal email timing with business hours respect
661
+ - **Extensible Design**: Easy customization and integration
662
+
663
+ ### ✅ Advanced Intelligence Features
664
+
665
+ - **Personalization Scoring**: 0-100 scoring based on customer data usage
666
+ - **Engagement Analysis**: Customer interaction patterns and sentiment detection
667
+ - **Readiness Assessment**: Outreach readiness scoring with recommendations
668
+ - **Sequence Management**: Automatic follow-up progression (1st -> 2nd -> 3rd -> final)
669
+ - **Respectful Automation**: Smart limits and graceful closure handling
670
+
671
+ ## 🛠️ Trou
672
+ bleshooting
673
+
674
+ ### Common Issues
675
+
676
+ #### 1. "No such file or directory: requirements.txt"
677
+
678
+ **Solution:** Make sure you're in the `fusesell-local` directory:
679
+
680
+ ```bash
681
+ cd fusesell-local
682
+ pip install -r requirements.txt
683
+ ```
684
+
685
+ #### 2. "OpenAI API key not provided"
686
+
687
+ **Solution:** Ensure your API key is correct and has sufficient credits:
688
+
689
+ ```bash
690
+ python fusesell.py --openai-api-key "sk-proj-your-actual-key" ...
691
+ ```
692
+
693
+ #### 3. "No data could be collected from any source"
694
+
695
+ **Solution:** Ensure the website URL is accessible and valid:
696
+
697
+ ```bash
698
+ # Test with a known working website
699
+ python fusesell.py ... --input-website "https://google.com" --dry-run
700
+ ```
701
+
702
+ #### 4. "Permission denied" errors
703
+
704
+ **Solution:** Use user installation or virtual environment:
705
+
706
+ ```bash
707
+ pip install --user -r requirements.txt
708
+ # OR
709
+ python -m venv venv
710
+ source venv/bin/activate # Linux/Mac
711
+ venv\Scripts\activate # Windows
712
+ pip install -r requirements.txt
713
+ ```
714
+
715
+ ### Debug Mode
716
+
717
+ Enable detailed logging to troubleshoot issues:
718
+
719
+ ```bash
720
+ python fusesell.py \
721
+ --openai-api-key "sk-proj-abc123" \
722
+ --org-id "test" \
723
+ --org-name "Test Company" \
724
+ --input-website "https://example.com" \
725
+ --log-level DEBUG \
726
+ --dry-run
727
+ ```
728
+
729
+ ### Dry Run Testing
730
+
731
+ Test the system without making API calls:
732
+
733
+ ```bash
734
+ python fusesell.py \
735
+ --openai-api-key "test-key" \
736
+ --org-id "test" \
737
+ --org-name "Test Company" \
738
+ --input-website "https://example.com" \
739
+ --dry-run
740
+ ```
741
+
742
+ **📚 Complete troubleshooting guide: [TROUBLESHOOTING.md](TROUBLESHOOTING.md)**
743
+
744
+ ## 🏆 Production Status
745
+
746
+ **FuseSell Local is 100% complete and production-ready!**
747
+
748
+ ### ✅ All Components Complete:
749
+
750
+ - **CLI Interface**: 25+ configuration options with comprehensive validation
751
+ - **Pipeline Engine**: Complete 5-stage orchestration with business logic
752
+ - **Data Layer**: SQLite database with full CRUD operations and event scheduling
753
+ - **AI Integration**: OpenAI GPT-4o-mini with structured response parsing
754
+ - **Stage Implementations**: All 5 stages production-ready (7,400+ lines of code)
755
+ - **Documentation**: Complete user guides, technical docs, and troubleshooting
756
+
757
+ ### ✅ Stage Implementation Status:
758
+
759
+ | Stage | Status | Lines | Key Features |
760
+ | -------------------- | ----------- | ------ | ---------------------------------------------- |
761
+ | **Data Acquisition** | ✅ Complete | 1,422 | Multi-source extraction, OCR, social media |
762
+ | **Data Preparation** | ✅ Complete | 1,201 | AI profiling, pain point analysis |
763
+ | **Lead Scoring** | ✅ Complete | 1,426 | Product-customer fit evaluation |
764
+ | **Initial Outreach** | ✅ Complete | 1,600+ | Intelligent email generation, draft management |
765
+ | **Follow-up** | ✅ Complete | 1,800+ | Context-aware sequences, interaction analysis |
766
+
767
+ ## 📁 Directory Structure
768
+
769
+ ```
770
+ fusesell-local/
771
+ +--- fusesell.py # Main CLI entry point
772
+ +--- requirements.txt # Python dependencies
773
+ +--- README.md # This file
774
+ +--- fusesell_local/ # Main package
775
+ | +--- __init__.py
776
+ | +--- pipeline.py # Pipeline orchestrator
777
+ | +--- stages/ # Pipeline stages
778
+ | | +--- __init__.py
779
+ | | +--- base_stage.py # Base stage interface
780
+ | | +--- data_acquisition.py
781
+ | | +--- data_preparation.py
782
+ | | +--- lead_scoring.py
783
+ | | +--- initial_outreach.py
784
+ | | +--- follow_up.py
785
+ | +--- utils/ # Utilities
786
+ | | +--- __init__.py
787
+ | | +--- data_manager.py # SQLite database manager
788
+ | | +--- llm_client.py # OpenAI API client
789
+ | | +--- validators.py # Input validation
790
+ | | +--- logger.py # Logging configuration
791
+ | +--- config/ # Configuration
792
+ | +--- __init__.py
793
+ +--- fusesell_data/ # Local data storage
794
+ +--- config/ # Configuration files
795
+ | +--- prompts.json # LLM prompts
796
+ | +--- scoring_criteria.json
797
+ | +--- email_templates.json
798
+ +--- drafts/ # Generated email drafts
799
+ +--- logs/ # Execution logs
800
+ ```
801
+
802
+ ## 🔒 Security & Privacy
803
+
804
+ - **Complete data ownership**: All customer data stays on your machine
805
+ - **API key security**: Keys are only used for LLM calls, never stored
806
+ - **Input validation**: Prevents injection attacks and validates all inputs
807
+ - **Local processing**: No external dependencies except for LLM API calls
808
+
809
+ ## 📚 Additional Documentation
810
+
811
+ ### User Documentation
812
+ - **[QUERYING_GUIDE.md](QUERYING_GUIDE.md)** - Managing multiple sales processes
813
+ - **[TROUBLESHOOTING.md](TROUBLESHOOTING.md)** - Common issues and solutions
814
+
815
+ ### Developer Documentation
816
+ - **[DEVELOPER_GUIDE.md](DEVELOPER_GUIDE.md)** - Customization and extension guide
817
+ - **[API_DOCUMENTATION.md](API_DOCUMENTATION.md)** - Technical API reference
818
+ - **[TECHNICAL.md](TECHNICAL.md)** - Architecture and technical details
819
+ - **[DATABASE.md](DATABASE.md)** - Database schema reference
820
+
821
+ ### Reference Documentation
822
+ - **[business_logic.md](business_logic.md)** - Business logic and orchestration rules
823
+ - **[CHANGELOG.md](CHANGELOG.md)** - Version history and updates
824
+
825
+ ## 🚀 Ready for Production Use
826
+
827
+ - **End-to-End Pipeline**: Complete sales automation workflow
828
+ - **Local Data Ownership**: Full privacy and control
829
+ - **AI-Powered Intelligence**: Personalized and context-aware
830
+ - **Integration Ready**: Database events for external app integration
831
+ - **Comprehensive Testing**: Dry-run mode and extensive error handling
832
+
833
+ ## 💡 Performance Tips
834
+
835
+ ### 1. Use Dry Run for Testing
836
+
837
+ Always test with `--dry-run` first to validate your configuration.
838
+
839
+ ### 2. Optimize API Usage
840
+
841
+ - Use appropriate `--llm-temperature` (0.2-0.8)
842
+ - Set reasonable `--llm-max-tokens` limits
843
+ - Consider stopping after specific stages for testing
844
+
845
+ ### 3. Batch Processing
846
+
847
+ For multiple leads, use different `--execution-id` values:
848
+
849
+ ```bash
850
+ python fusesell.py ... --execution-id "lead_001"
851
+ python fusesell.py ... --execution-id "lead_002"
852
+ ```
853
+
854
+ ### 4. Data Directory Management
855
+
856
+ Use custom data directories for different projects:
857
+
858
+ ```bash
859
+ python fusesell.py ... --data-dir "./project_a_data"
860
+ python fusesell.py ... --data-dir "./project_b_data"
861
+ ```
862
+
863
+ ## 🤝 Support
864
+
865
+ For issues, questions, or contributions:
866
+ - Check the troubleshooting guide for common issues
867
+ - Review the technical documentation for advanced usage
868
+ - Refer to the business logic documentation for workflow details
869
+ - Contact the development team for custom requirements
870
+
871
+ ---
872
+
873
+ **FuseSell Local - Complete AI Sales Automation, 100% Local, 100% Private** 🚀