🚀 Project Initialization Complete! Ready for Milestone 1
We have successfully established the foundation for the Demand Letter Generator:
- ✅ Memory Bank established (all core documents)
- ✅ Project structure created (frontend, backend, ai-service)
- ✅ Initial codebase scaffolding complete
- ✅ Configuration files set up (Docker, TypeScript, Prisma)
- ✅ Git repository initialized
Next: Begin Milestone 1 - Infrastructure & Storage implementation
- Frontend: React + TypeScript (not Next.js)
- Backend: Node.js with Express
- AI Service: Python (AWS Lambda) + Anthropic API
- Database: PostgreSQL
- Real-time: TipTap + Y.js + WebSockets + Redis
- Storage: AWS S3
- Architecture: Microservices
- Started with initial PRD (basic requirements)
- Updated to PRD v2 with critical additions:
- Fact approval workflow (human-in-the-loop quality gate)
- Multi-document handling (up to 50 PDFs)
- Single-firm deployment model (no multi-tenancy)
- Detailed versioning and audit trail
- Clear performance limits
- Decision: All users can create/edit firm templates
- Rationale: No admin role complexity in V1, trust-based single-firm model
- ✅ Memory Bank files created
- ✅ Create project directory structure
- ✅ Initialize Git repository
- ✅ Set up frontend (React + TypeScript + Vite)
- ✅ Set up backend (Node.js + Express + TypeScript)
- ✅ Set up AI service (Python + Lambda structure)
- ✅ Create shared types directory
- ✅ Docker Compose for local Postgres + Redis
- ✅ Initial README with setup instructions
- ✅ Prisma schema defined
- ✅ Basic Express server with health check
- ✅ React app with routing structure
Goal: Database, S3, authentication foundation
Tasks:
- Database schema implementation (Prisma or TypeORM)
- Run initial migrations (users, documents, templates tables)
- S3 bucket setup with encryption
- JWT authentication implementation
- Register endpoint
- Login endpoint
- Refresh token mechanism
- Auth middleware
- Basic health check endpoints
- Error handling middleware
- Request logging
Acceptance Criteria:
- User can register and login
- JWT tokens are issued and validated
- Database tables created and accessible
- S3 bucket ready for file uploads
- Health check returns 200 OK
Goal: Upload PDFs, extract text, store metadata
Tasks:
- PDF upload endpoint (multipart/form-data)
- S3 upload integration with encryption
- Python service: text extraction from PDFs
- Store extracted text in database
- Frontend: PDF upload UI component
- Frontend: Document list view
- Error handling for invalid/corrupted PDFs
Acceptance Criteria:
- User can upload multiple PDFs (up to 50)
- Files stored in S3 with proper naming
- Text extracted and stored in
pdfstable - UI shows upload progress and success
- Invalid files rejected with clear error messages
Goal: Create templates with variables and paragraph modules
Tasks:
- Template CRUD API endpoints
- Paragraph module CRUD API endpoints
- Template builder UI (variable editor)
- Paragraph library UI (create, tag, search)
- Drag-and-drop paragraph insertion
- Template preview with sample data
- Template validation (required fields, structure)
Acceptance Criteria:
- User can create template with variables
- User can create paragraph modules with tags
- User can preview template with sample data
- Templates saved and retrievable
- Paragraph modules associated with templates
Goal: Extract facts, approve, generate draft
Tasks:
- Python Lambda: fact extraction from PDF text
- Anthropic API integration (Claude 3.5 Sonnet)
- Fact extraction prompt engineering
- Fact approval UI (approve/edit/reject)
- Multi-stage draft generation pipeline
- Facts → Narrative
- Narrative + Template → Structure
- Structure + Tone → Draft
- Draft generation API endpoint
- Display generated draft in editor
- Error handling for AI failures
Acceptance Criteria:
- Facts extracted with PDF citations
- User can approve/edit/reject each fact
- Only approved facts used in generation
- Draft generated in < 10 seconds
- Draft displayed in TipTap editor
- Graceful degradation if AI fails
Goal: Real-time multi-user editing
Tasks:
- TipTap editor integration
- Y.js CRDT setup
- WebSocket server implementation
- Redis pub/sub for multi-instance scaling
- Presence indicators (active users)
- Autosave (every 30 seconds)
- Version history (snapshot on save)
- Restore previous version functionality
- Conflict-free editing (Y.js handles this)
Acceptance Criteria:
- 2+ users can edit simultaneously
- Changes sync in real-time (< 100ms latency)
- Presence indicators show active users
- Document autosaves without user action
- User can view and restore previous versions
- No data loss during network interruption
Goal: Export to DOCX with firm letterhead
Tasks:
- DOCX generation library setup (docxtemplater or python-docx)
- Firm letterhead template system
- Export API endpoint
- Convert TipTap JSON to DOCX format
- Preserve formatting (bold, italic, lists, etc.)
- Download endpoint for generated DOCX
- Frontend: Export button + download handling
- Audit log: record export events
Acceptance Criteria:
- User clicks "Export" and receives DOCX file
- File opens correctly in Microsoft Word
- Formatting preserved (fonts, styles, spacing)
- Firm letterhead applied
- Export logged in audit trail
-
Firm Letterhead: Should letterhead be:
- Uploaded as DOCX template file?
- Configured via UI (logo + header/footer text)?
- Hardcoded initially with config file?
-
Session Management: How long should user sessions last?
- Current plan: 15-min access token, 7-day refresh token
- Should we have "remember me" option?
-
PDF Preview: Should we render PDF thumbnails in UI?
- Requires additional processing
- Nice UX but not critical for V1
-
Fact Extraction Quality: What's acceptable accuracy?
- Need golden dataset for testing
- May require prompt iteration
-
Cost Monitoring: Should we track AI API costs per document?
- Useful for analytics but adds complexity
- Could add in post-V1
- Y.js Complexity: Real-time collaboration is technically challenging
- Mitigation: Start with basic TipTap, add Y.js incrementally
- AI Hallucinations: Facts may be inaccurate
- Mitigation: Human approval workflow (already designed)
- PDF Parsing: Not all PDFs extract cleanly
- Mitigation: Clear error messages, manual text input fallback
- WebSocket Scaling: Redis pub/sub required for multi-instance
- Mitigation: Start with single instance, add Redis when needed
-
Tone Slider (P1 Feature):
- When user adjusts tone, regenerate entire draft or inline edits?
- Decision: Defer to post-V1, focus on single tone generation first
-
Track Changes (P1 Feature):
- Redline mode like Word's track changes
- Decision: Defer to post-V1, version history covers basic need
-
OCR (P1 Feature):
- AWS Textract for scanned PDFs
- Decision: Defer to post-V1, focus on text-based PDFs
None - ready to proceed with implementation.
- Memory Bank structure created
- Project scope clarified through PRD updates
- Tech stack confirmed with user
- Working with: User (Dohoon Kim)
- Communication style: Direct, focused on essentials
- Decision speed: Fast - user prefers action over extensive planning
- Preferred approach: Build incrementally, iterate based on working software
- Workspace:
/Users/dohoonkim/GauntletAI/Demand Letter/ - Date: November 11, 2025
- OS: macOS (darwin 24.6.0)
- Shell: zsh