Phase 3: JSONL ingestion module#11
Conversation
- pyproject.toml with FastMCP, uvicorn, and dev dependencies - Makefile with check, fmt, lint, test, install, uninstall targets - LaunchAgent plist and install/uninstall scripts for auto-start - dev.sh script for development mode with auto-reload - Basic FastMCP server with placeholder tools: - get_status: Returns server status - ingest_logs: Placeholder for log ingestion - query_tool_frequency: Placeholder for frequency queries - Usage guide as MCP resource at session-analytics://guide - Tests for the placeholder tools - README with installation and usage instructions Server runs on port 8081 (to not conflict with event-bus on 8080). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- storage.py with SQLiteStorage class: - Events table with denormalized fields for fast queries - Sessions table for session metadata - Ingestion state tracking for incremental updates - Patterns table for pre-computed insights - Indexes on timestamp, session_id, tool_name, project_path - Data classes: Event, Session, IngestionState, Pattern - CRUD operations for all entities with batch insert support - get_db_stats() for monitoring database health - Updated server.py to use storage for get_status() - Comprehensive test suite (16 tests) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implements log file discovery and parsing: - find_log_files(): Discovers JSONL files within date range - parse_tool_use(): Extracts tool info (command, file_path, skill_name) - parse_entry(): Parses entries into Event objects - ingest_file(): Incremental ingestion with mtime/size tracking - ingest_logs(): Full ingestion orchestration - update_session_stats(): Aggregates session statistics Integrates with server.py to provide real data for ingest_logs tool. Closes #3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Code Review - Phase 3: JSONL Ingestion ModuleThis PR implements the core ingestion functionality for parsing Claude Code session logs. Overall, this is well-structured, production-ready code with good test coverage and attention to detail. Here's my detailed review: ✅ Strengths1. Excellent Architecture & Design
2. Robust Error Handling
3. Comprehensive Test Coverage
4. Code Quality
5. Performance Considerations
🔧 Issues & RecommendationsCritical IssuesNone found! 🎉 High Priority Improvements1. SQL Injection Protection (
|
Summary
Implements the JSONL log ingestion module for parsing Claude Code session logs:
find_log_files()- Discovers JSONL files in~/.claude/projects/within date rangeparse_tool_use()- Extracts tool info (command, file_path, skill_name) from tool_use blocksparse_entry()- Parses JSONL entries into Event objects, handles tool_use/tool_resultingest_file()- Incremental ingestion with mtime/size tracking (only processes changed files)ingest_logs()- Full ingestion orchestrationupdate_session_stats()- Aggregates session statistics from eventsAlso integrates with
server.pyto provide real data for theingest_logsMCP tool.Test plan
make check- all 31 tests passCloses #3
🤖 Generated with Claude Code