Quick Reference for Claude Code sessions to understand this project rapidly
DocFilter - Electron desktop app that analyzes documents, URLs, and multimedia using AI to recommend "Read" or "Discard" with summaries and reasoning.
- Tech Stack: Electron + React + TypeScript + SQLite + Vite
- Current Version: 1.6.0 (as of 2025-06-21)
- Purpose: Document triage and classification using local/remote LLMs
📋 For complete technical specifications, see SPECIFICATION.md
src/main/main.ts # Electron main process entry point
src/main/database/init.ts # SQLite database schema and initialization
src/main/ipc/handlers.ts # IPC communication between main and renderer
src/main/services/processor.ts # Core content processing logic
src/main/services/llm/index.ts # LLM provider interface and router
src/main/services/llm/openai.ts # OpenAI API integration
src/main/services/llm/anthropic.ts # Anthropic API integration
src/main/services/llm/local.ts # Local LLM (Ollama) integration
src/main/services/extractors/index.ts # Content extractor router
src/main/services/extractors/pdf.ts # PDF content extraction
src/main/services/extractors/docx.ts # DOCX content extraction
src/main/services/extractors/web.ts # Web scraping and YouTube
src/renderer/src/App.tsx # Main React app component
src/renderer/src/components/DetailPane.tsx # Artifact detail view (shows summary/reasoning)
src/renderer/src/components/Inbox.tsx # Artifact list view
src/renderer/src/components/DropZone.tsx # File drop and URL input
src/renderer/src/components/ConfigModal.tsx # AI provider configuration
README.md # User-facing documentation
HELP.md # Built-in help content
CHANGELOG.md # Version history
SPECIFICATION.md # Complete technical specifications
package.json # Dependencies and scripts
- Content Input → DropZone accepts files/URLs
- Content Extraction → Extractors process different formats
- AI Analysis → LLM providers generate summary + recommendation + reasoning
- Storage → SQLite stores results
- Display → DetailPane shows summary above reasoning
For detailed database schema and TypeScript interfaces, see SPECIFICATION.md
# Development (with hot reload)
npm run dev
# Build for production
npm run build
# Run built app
npm start
# OR
npx electron dist/main/src/main/main.js
# Testing
npm test # Run unit tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage
# Package for distribution
npm run dist # All platforms
npm run dist:win # Windows only
npm run pack # Portable (no installer)
# Sync WSL to Windows (custom script)
./push.sh- IPC Communication: Renderer ↔ Main process via
window.electronAPI - State Management: React useState, no external state library
- Styling: CSS files co-located with components
- Responsive Layout: Split panes with resizable panels
App.tsx
├── Header.tsx (title + config button)
├── DropZone.tsx (file/URL input)
├── Inbox.tsx (artifact list with filters)
├── DetailPane.tsx (summary + reasoning + content)
└── ConfigModal.tsx (AI provider settings)
For version history and recent changes, see CHANGELOG.md
- Create new file in
src/main/services/extractors/ - Implement extractor function
- Export from
src/main/services/extractors/index.ts
- Create new file in
src/main/services/llm/ - Implement provider with LLMResult interface
- Add to switch statement in
src/main/services/llm/index.ts
- Modify schema in
src/main/database/init.ts - Add migration logic with error handling
- Update TypeScript interfaces
- Update IPC handlers for new fields
- Modify React components in
src/renderer/src/components/ - Update CSS files for styling
- Ensure TypeScript interfaces match
- Create test files in
tests/directory - Follow existing patterns:
*.test.tsfor unit tests - Run
npm testto verify all 58 existing tests still pass - Use Jest with mocking for external dependencies
- LLM failures return error artifacts with 'Error' recommendation
- Database operations use Promise wrappers
- UI shows graceful fallbacks for missing data
- TypeScript:
.tsfor logic,.tsxfor React components - Co-located CSS files with same name as component
- Interfaces defined in same files or dedicated
.d.ts
- Feature branches:
feature/description-v1.x.x - Commit format:
feat:,fix:,docs: - PR includes comprehensive description and test plan
- Always include error handling for existing columns
- Test migration on existing databases
- Use
ALTER TABLE ... ADD COLUMNwith IF NOT EXISTS logic
- WSL to Windows: Use
./push.shscript - Path differences: Use
path.join()for file paths - Permissions: Exclude
.gitfolder when copying
- Handle API rate limits and errors gracefully
- Parse structured responses with fallbacks
- Different APIs have different response formats
# Find database location (varies by environment)
find ~ -name "triage.db" 2>/dev/null
# Check schema
sqlite3 path/to/triage.db ".schema artifacts"
# View data
sqlite3 path/to/triage.db "SELECT * FROM artifacts LIMIT 5;"- Main process logs appear in terminal
- Renderer logs appear in DevTools (F12)
- Database path logged on startup in v1.5.0+
- Clear
dist/folder if builds behave strangely - Check TypeScript errors in both main and renderer
- Ensure all dependencies installed with
npm install
When starting a new Claude Code session:
- Read this file first 📖
- Check current branch:
git branch - Review recent commits:
git log --oneline -5 - Check for changes:
git status - Review package.json version for current state
- Scan README.md for any updates
- Read any TODOs or issues mentioned by user
This guide should get you up to speed quickly on the DocFilter codebase! 🚀