PRD: Project Matter Refactor and Clean Re-import #2
Labels
No labels
ready-for-agent
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
liang/sales-ai#2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PRD: Project Matter Refactor and Clean Re-import
Labels:
ready-for-agentProblem Statement
The current Sales AI OS stores project work mostly as Communications, Project-level Tasks, Documents, and Daily Logs. That is not enough for manufacturing technical sales work, where the same Project contains many long-running business threads such as RFQs, quotation feedback, technical clarifications, sample delivery concerns, PPAP follow-ups, and quality issues.
The current implementation also writes too much too early: email ingestion can auto-create placeholder Projects, create Tasks directly from extracted action items, and feed old Daily Log and Agent Memory flows that do not match the Project Matter model. Because existing database contents are disposable test data, the system should be rebuilt around the confirmed Project Matter model, then repopulated from Obsidian work logs and archived email.
Solution
Rebuild the database schema around Project, Project Matter, Communication, Intake Item, Review Item, Proposed Change Set, Stored File, File Reference, and Document. Use Obsidian work-log wikilinks as the seed source for Projects, Project Titles, Project Aliases, and Project Responsibility before re-importing emails.
Email re-import should archive Communications and Communication Evidence first, then classify them. Classification should record Classification Decisions and route uncertain work through Intake Flow or Review Queue. Agent write operations must produce Proposed Change Sets rather than directly creating or updating Project Matters, Matter Deadlines, Matter Milestones, Tasks, Communication Interpretations, or responsibility handling.
The first implementation should prioritize a correct data model, deterministic Project matching, clean re-import, API/CLI review execution, and tests. Full UI workflows, Matter-centered Daily Log, Chat, Weekly Review, Agent Memory, and email drafting are explicitly after this foundation.
User Stories
PRJ-23-905209are extracted predictably.L形硬排are available for display and search.titleinstead ofcodename, so that display names are not confused with internal nicknames.Implementation Decisions
codenamewith Project Title and do not keepcodenamein the rebuilt schema.needs_project,needs_responsibility,needs_matter,deferred,archived,resolved.proposed_change_set,visual_review,ambiguous_project,needs_matter,suggested_deadline,rule_suggestion,handoff_decision.high,normal,low.create_project_matter,link_communication_to_matter,link_document_to_matter,set_matter_deadline,add_matter_milestone,create_task,update_matter_summary, andset_matter_status.rfq,quotation_feedback,technical_clarification,sample_delivery,ppap_documentation,quality_issue,commercial_terms,internal_followup, andother.new,open,waiting_customer,waiting_internal,blocked,done,cancelled.newmeans a confirmed Project Matter exists but has not yet been actively handled.urgent,high,normal,low.The first implementation sequence is:
Testing Decisions
Tests should validate externally observable behavior at the highest practical seam. They should not lock in internal helper structure or LLM wording. Where LLM classification is involved, tests should use fake classifiers and deterministic fixtures rather than live model calls.
Existing testing prior art is mostly manual scripts, so this PRD should introduce pytest-based automated tests around deterministic seams. The fake ingestion and fake classifier seams are the preferred high-level seams for most behavior.
Out of Scope
Further Notes
The current codebase still reflects the old model in multiple places: email ingestion can create placeholder Projects and Tasks, Daily Log generation uses raw Communications and Tasks with sentiment, API project views assume Project-level Communications and Tasks, and document storage still uses a simpler file path model. These mismatches are expected and should be resolved by the refactor rather than patched piecemeal.
The implementation should respect all Project Matter ADRs, especially the decisions that Agent writes use Proposed Change Sets, Project matching uses explicit signals, files live outside the database through File References, database contents can be rebuilt, Project Candidates come from editable seed files, Project Title replaces codename, Project Identifier Variants support code matching, and Alembic gets a new baseline.