Codebase Changes Summary ======================== This file documents the current uncommitted changes found in the working tree. It includes what changed, what the change does, and the main line numbers involved. Important note: - A very large part of this working tree diff is formatting / blank-line / CRLF-LF line-ending churn. - Where a file only appears to have formatting or blank-line cleanup, this summary says so. - Feature-level notes are based on the whitespace-filtered diff and current line numbers. Overall diff summary -------------------- - Deleted tracked files: 3 - Modified tracked files shown by git status: 50 - Untracked files: ASHWIN.txt and prospectiq_history_corrupt.bak - Large frontend files such as static/styles.css, static/js/views/prospecting.js, static/js/app.js, and templates/index.html show very high deletion counts mostly because blank lines were removed. 1. .env.production.example -------------------------- Lines involved: 1-20, entire deleted file Changes made: - Deleted the production environment example file. What it does: - Removes the sample production environment configuration from the tracked codebase. 2. CHANGES_FROM_GITHUB_MAIN.txt ------------------------------- Lines involved: 1-229, entire deleted file Changes made: - Deleted the previous GitHub-main change note. What it does: - Removes an older/manual changelog artifact from the repository. 3. claude_fallback_changelog.txt -------------------------------- Lines involved: 1-84, entire deleted file Changes made: - Deleted the Claude fallback changelog note. What it does: - Removes an older/manual AI fallback changelog artifact from the repository. 4. schema.sql ------------- Lines involved: 11-46 Changes made: - Added permissions table at lines 11-15. - Added roles table at lines 17-25. - Added role_permissions join table at lines 27-34. - Added password_hash to users at line 40. - Added role_id to users at line 41. - Added a users.role_id foreign key to roles at line 46. What it does: - Adds database support for role-based access control. - Lets users be connected to tenant-specific roles. - Prepares the local SQLite schema for password-backed auth and permission checks. 5. supabase_schema.sql ---------------------- Lines involved: 16-43 Changes made: - Added permissions table at lines 16-20. - Added roles table at lines 22-29. - Added role_permissions table at lines 31-35. - Added password_hash to users at line 42. - Added role_id with a roles foreign key at line 43. What it does: - Mirrors the role/permission changes for Supabase/Postgres deployments. - Keeps local and hosted schema definitions aligned. 6. migrate.py ------------- Lines involved: 25-204 Changes made: - Includes migration logic for roles table creation at lines 25-49. - Includes migration logic for permissions table creation at lines 51-68. - Includes migration logic for role_permissions table creation at lines 70-89. - Adds password_hash and role_id columns to existing users tables at lines 96-111. - Seeds default permissions at lines 115-133. - Creates/ensures standard tenant roles at lines 141-148. - Grants permissions to Admin, BD Rep, and Viewer roles at lines 149-181. - Maps existing users to role IDs and default password hashes at lines 184-204. What it does: - Upgrades existing databases to the new role/permission model without requiring a fresh database. - Gives Admin all permissions, BD Rep non-admin operational permissions, and Viewer read permissions. 7. routes/auth.py ----------------- Lines involved: formatting/line-ending change in git diff; current relevant auth code is around 47-584 Changes made: - The file is marked modified, but the whitespace-filtered diff does not show clear content changes. - Current file contains role seeding, permission lookup, admin dashboard, user management, role creation, and role-permission update logic. What it does: - No definite behavior change is attributable to this working-tree diff after ignoring formatting. - The existing auth code supports tenant roles and permissions used by the schema/migration changes. 8. routes/ai.py --------------- Lines involved: 377-394 Changes made: - Added agentspace_system_prompt at line 377. - The prompt tells Agent Space to: - Be conversational and helpful. - Ask clarifying questions instead of returning blunt errors. - Suggest MCQ-style options for ambiguous requests. - Distinguish internal users/reps/roles from external CRM contacts. - Treat saved CRM/database queries differently from external Regional Prospecting. - Extract decision makers into a contacts array when creating companies. - Existing system messages are prefixed with this prompt at line 392. - If no system message exists, the prompt is inserted at line 394. What it does: - Makes Agent Space safer and more precise. - Reduces cases where "add user" becomes an external contact. - Reduces cases where "show companies in CRM" accidentally triggers external prospecting. - Helps AI-created companies include leadership contacts automatically. 9. routes/command.py -------------------- Lines involved: 318, 410-427, 458-513, 528-564, 619-650, 710-762, 775-786, 833-841, 917-1218 Changes made: - Expanded company-name cleanup at line 318 so descriptive phrases, location words, staff-size words, leadership titles, punctuation, and clauses are removed from the company name. - Contact extraction now treats linkedin as a field boundary at line 410. - Added LinkedIn parsing into contact_data at lines 425-427. - Added unscheduled/unassigned handling for task dates at lines 458-459. - Added unscheduled/unassigned handling for task times at lines 492-493. - Removed "unscheduled" and "unassigned" from generated task titles at line 513. - Expanded list intent keywords at line 528, including typo support for "sow" and "shwo". - Added rep/user/role/admin/viewer detection at lines 539-540. - Prevented internal rep/user/role prompts from being interpreted as external contacts at lines 541-556. - Changed company filtering intent so stage/pipeline requests route to CRM filtering at line 564. - Replaced representative parsing with a broader add_rep_match at lines 619-635. - Added a friendly clarification response when adding an internal team member without enough information at lines 636-642. - Added explicit CRM-database detection at lines 710-714. - Added auto-routing to Regional Prospecting only for clear external discovery/prospecting queries at lines 711-712. - Added local CRM filtering and top-N reply generation at lines 730-758. - Returned filter_companies responses with a generated reply at lines 759-762. - Added guardrails to avoid deterministic add_company parsing when a descriptive prompt is too complex at lines 775-776. - Improved industry parsing from "doing/do/in ... business" phrasing at line 781. - Improved staff-size parsing, including ranges like 50-70 using the midpoint, at lines 784-786. - Added LinkedIn as an editable contact field at lines 833-841. - Updated the LLM command-routing prompt at lines 937-1004 with: - CRM database vs Regional Prospecting rules. - Clean company-name extraction rules. - Company notes/current_supplier_notes rules. - Contact extraction from executives and decision makers. - LinkedIn support for contacts. - Unscheduled task behavior. - Internal team member vs external CRM contact clarification. - Removed an unconditional fallback_tool_route return near lines 1211-1213 so weak fallback routes do not override parsed AI results too early. What it does: - Makes the command bar much better at understanding natural-language CRM requests. - Adds support for LinkedIn when adding/editing contacts. - Allows tasks to be saved as unscheduled duties instead of forcing them into the calendar. - Makes "top 3 companies in database" answer from saved CRM data instead of launching geo search. - Makes external discovery queries still route to Regional Prospecting when appropriate. - Makes internal user/rep creation safer and less likely to be confused with customer contacts. 10. services/tool_router.py --------------------------- Lines involved: 56-89 Changes made: - Added is_explicit_crm detection at lines 56-58. - If a query clearly mentions CRM/database/stages/users/contacts/reps, the heuristic router now returns None instead of forcing an external tool route. - Expanded CRM company filter language and typo handling at lines 60-63. - Narrowed geo prospecting patterns so they require clearer location/discovery wording at lines 70-86. - Removed broad trigger text such as "companies in" and "find companies" that could accidentally route CRM queries into geo search. What it does: - Prevents CRM/database commands from being misrouted to Regional Prospecting. - Keeps geo routing for true prospect discovery such as nearby/map-search/discover-new requests. 11. routes/companies.py ----------------------- Lines involved: 3, 193-235, 381-428, 437-475, 487-618 Changes made: - Imported get_request_tenant_id at line 3. - Added extract_contacts_from_descriptive_notes() at lines 193-235. - add_company now reads the current tenant ID at line 381. - add_company now normalizes notes/current_supplier_notes at lines 389-401. - Replaced hard-coded tenant_id 1 with request tenant_id at line 411. - Inserts notes_text into current_supplier_notes at line 428. - Adds contacts from data.contacts or parsed notes at lines 437-466. - Writes notes_text into activities and notes at lines 467-475. - add_company_from_extractor now uses request tenant_id at lines 487 and 514. - add_company_from_ocr now uses request tenant_id at lines 583 and 618. What it does: - New companies are created under the correct tenant instead of always tenant 1. - Descriptive AI company prompts can create company contacts automatically. - Leadership and meeting/background notes are preserved in activity/notes history. 12. static/js/components/inline_assistant.js -------------------------------------------- Lines involved: 225-262, 283-401, 410-444, 453-504 Changes made: - Company profile actions now use switchWorkspaceAndScrollTo() when available at lines 225-226. - Company filtering now scrolls to the company table at lines 250-251. - Company filtering replies are more specific and can use the server-provided reply at lines 255-264. - Add/edit/delete company and contact flows now route and scroll to the correct table sections at lines 283-401. - Task creation now checks whether the date is explicit at line 410. - Unscheduled/unassigned tasks now set date/time to null at lines 410-412. - Notifications distinguish scheduled tasks from unscheduled task-list items at lines 427-430. - Task creation scrolls to calendar-section or tasks-section depending on whether there is a date at lines 434-436. - Task replies distinguish scheduled tasks from unassigned duties at lines 441-444. - Task edits normalize null/unscheduled date and time values at lines 453-454. - Task edit/complete/delete actions scroll to calendar or tasks based on the task's date at lines 463-504. What it does: - Inline AI actions now take the user to the right workspace and section. - Unscheduled duties stay in the task list instead of being forced into the calendar. - Assistant replies are clearer after filtering, scheduling, and task actions. 13. static/js/app.js -------------------- Lines involved: 618, 1018-1050, 1144-1422, 1488 onward Changes made: - Global command input lookup still uses global-command-bar at line 618, now backed by a textarea in the template. - Added switchWorkspaceAndScrollTo() at lines 1018-1050. - Command result handling now uses switchWorkspaceAndScrollTo() for company profile, company table, contact table, calendar, and task-list destinations at lines 1144-1422. - Command input event handling near line 1488 supports textarea behavior. - Large parts of the file also had blank-line cleanup, creating a very large diff that is mostly formatting. What it does: - Command results can move admins from portal mode into workspace mode and scroll directly to the relevant UI area. - The global command bar can behave more like a multi-line command textarea. 14. templates/index.html ------------------------ Lines involved: 140, 334-352 Changes made: - Replaced the global command bar input with a textarea at line 140. - Wrapped the password input in an input group at lines 334-338. - Added a toggle-password button and Bootstrap eye icon at lines 337-338. - Added DOMContentLoaded password visibility toggle script at lines 343-352. - The file also has a large amount of blank-line cleanup. What it does: - Users can type longer commands more comfortably. - Users can show/hide the login password field. 15. static/js/views/profile.js ------------------------------ Lines involved: 29-30, 330, 351, 412, 430, old media tab/pane blocks around previous 448-473 and 1284-1296 Changes made: - Removed media from validTabs at line 29. - Added id="company-profile-header" to the profile header at line 330. - Cleaned Agent Space tab text at lines 351 and 412. - Kept the Agent Space pane at line 430. - Removed the Media & Videos tab/pane. - Removed the old drawVideosTab() placeholder function. - Removed old video watched checkbox/localStorage handling. What it does: - Company profiles no longer show the unused Media & Videos area. - Other code can scroll directly to the company profile header. 16. static/js/views/mockups.js ------------------------------ Lines involved: 20, 24-28, 278-360, 365-581 Changes made: - Added isAdmin check based on users:manage permission at line 20. - Renamed the page heading to "Settings & Configuration" at line 24. - Updated settings description text at lines 24-28. - Redesigned command memory loading/display at lines 278-360. - Command memory items now include "View Checkpoint" buttons at line 322. - Admin console layout/copy changed around lines 365-581. What it does: - Settings now better separates AI memory/checkpoints from admin controls. - Admin-only controls are tied to the actual users:manage permission. 17. static/js/views/prospecting.js ---------------------------------- Lines involved: 1-75, 81-123 and many later sections; major formatting cleanup throughout Changes made: - Prospecting state contains active OCR, geo, and research job fields at lines 1-18. - Added sessionStorage keys for active geo/research jobs at lines 19-20. - Restores active geo job state from sessionStorage at lines 23-29. - Restores active research job state from sessionStorage at lines 35-42. - Added saveGeoJobSession() at lines 44-56. - Added saveResearchJobSession() at lines 58-73. - Added prospecting status helpers and metadata around lines 81-123. - The file shows extremely large deletions because many blank lines were removed. What it does: - Prospecting job state can survive navigation/refresh better. - Regional Prospecting and Company Research status can be tracked through shared helper state. - Most of the huge diff is formatting cleanup rather than isolated feature changes. 18. static/styles.css --------------------- Lines involved: 352-411, 1955-1984, 2258-3218, 3273, 4818-4842, 5482 onward Changes made: - Updated command input/action styling at lines 352-411. - Profile tab styles remain around lines 1955-1984 after Media tab cleanup. - Large Prospecting/Geo Finder style section exists at lines 2258-3218. - Responsive command-bar styling appears at lines 3273 and 4818-4842. - Auth styles appear at line 5482 onward. - The file has the largest diff because many blank lines and formatting were removed. What it does: - Supports the command textarea and command action layout. - Supports the Prospecting/Geo Finder UI styles. - Supports the login/auth UI including the updated password input area. 19. static/js/views/companies.js -------------------------------- Lines involved: line 1 Changes made: - One-line content/formatting change at the start of the file. What it does: - No clear feature-level behavior change is visible from the whitespace-filtered diff. 20. static/js/views/contacts.js ------------------------------- Lines involved: line 1 Changes made: - One-line content/formatting change at the start of the file. What it does: - No clear feature-level behavior change is visible from the whitespace-filtered diff. 21. static/js/views/home.js --------------------------- Lines involved: lines 1-4 Changes made: - Small content/formatting change near the start of the file. What it does: - No clear feature-level behavior change is visible from the whitespace-filtered diff. 22. requirements.txt -------------------- Lines involved: around line 143 Changes made: - Removed an extra blank line around the anthropic dependency. What it does: - No dependency was clearly added or removed in this working-tree diff. - This appears to be formatting cleanup only. 23. db.py --------- Lines involved: around 288, 572-657 Changes made: - Removed blank lines around get_db_connection(), dict_from_row(), Redis cache helpers, and cache_get/cache_set. What it does: - Formatting cleanup only. - No clear behavior change is visible from the whitespace-filtered diff. 24. routes/learning.py ---------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear behavior change. 25. routes/stt.py ----------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed one blank/formatting line. What it does: - No clear behavior change. 26. routes/system.py -------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank/formatting lines only. What it does: - No clear behavior change. 27. services/ai_service.py -------------------------- Lines involved: formatting/blank-line cleanup throughout Changes made: - Removed blank lines around many helper functions and job-management functions. What it does: - Formatting cleanup only in this working-tree diff. - No clear service behavior change is visible after ignoring whitespace. 28. services/export_service.py ------------------------------ Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear export behavior change. 29. services/geo_search.py -------------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear geo-search behavior change in this working-tree diff. 30. services/ocr.py ------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear OCR behavior change. 31. services/rag_service.py --------------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear RAG behavior change. 32. services/research/analyzer.py --------------------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear research analyzer behavior change. 33. services/research/browser.py -------------------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear browser/research behavior change. 34. services/research/pipeline.py --------------------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear pipeline behavior change. 35. services/research/query_generator.py ---------------------------------------- Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear query-generation behavior change. 36. services/research/questionlist.md ------------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear documentation/content behavior change. 37. static/js/components/contact_drawer.js ------------------------------------------ Lines involved: formatting/blank-line cleanup Changes made: - Removed one blank/formatting line. What it does: - No clear behavior change. 38. static/js/components/activity_logger.js ------------------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 39. static/js/components/agent_drawer.js ---------------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 40. static/js/components/buttons.js ----------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 41. static/js/components/columns.js ----------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 42. static/js/components/notifications.js ----------------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 43. static/js/components/tasks.js --------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 44. static/js/router.js ----------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 45. static/js/utils.js ---------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 46. static/js/views/admin_portal.js ----------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear behavior change. 47. static/js/views/learning.js ------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear Learning-page behavior change in this working-tree diff. 48. learning_data/collections_meta.json --------------------------------------- Lines involved: formatting/line-ending change Changes made: - File is marked modified, but no clear content change was visible after whitespace filtering. What it does: - No clear data/content change. 49. tasks.py ------------ Lines involved: formatting/blank-line cleanup Changes made: - Removed blank lines only in the whitespace-filtered diff. What it does: - No clear task behavior change. 50. ASHWIN.txt -------------- Lines involved: entire file Changes made: - Added/rewrote this codebase change summary document. - Expanded it to match the attached example style: numbered file sections, line ranges, changes made, and what each change does. What it does: - Documents the current working tree changes for easier review. 51. prospectiq_history_corrupt.bak ---------------------------------- Lines involved: untracked file Changes made: - An untracked backup file exists in the repository root. What it does: - Likely preserves a corrupted or old ProspectIQ history artifact. - It is not currently part of the tracked codebase unless intentionally added.