AI conversation history tracker with timeline visualization and Git integration.
- Claude Code Integration: Automatically captures Claude Code conversations
- Git Integration: Track commits and correlate with AI sessions
- Timeline Visualization: View your AI interactions and commits over time
- AI-Powered Summaries: Summarize work sessions using LLMs (OpenAI, OpenRouter, or custom)
- Extensible Architecture: Easy to add new collectors via adapter pattern
# Clone the repository
git clone https://github.com/hwisu/sayu
cd sayu
# Install with pip (Python 3.12+)
pip install -e .
# Or use pipx for isolated installation
pipx install -e .
# Initialize in your project
sayu init
# Collect events manually
sayu collect
# View recent events
sayu timeline -n 20
# Summarize since last commit (short alias: sslc)
sayu sslc
# Or use the full command
sayu summarize-since-last-commit
# Summarize with custom timeframe
sayu summarize --hours 2 --last 8
# Show diff between commits
sayu diff HEAD~2..HEAD
sayu init
- Initialize Sayu in current directorysayu collect
- Manually collect events from all sourcessayu timeline
- Show event timeline with options:-n, --last N
- Show last N events-s, --source
- Filter by source (claude-code, git)-v, --verbose
- Show full content
-
sayu summarize
- Summarize events within timeframes-h, --hours
- Timeframe size in hours--last N
- Look back N hours--since-commit
- Use last commit as reference (default)--structured
- Use structured output format
-
sayu sslc
/sayu summarize-since-last-commit
- Quick summary since last commit-e, --engine
- Custom LLM engine command
-
sayu diff [COMMIT_RANGE]
- Show events between commits- Examples:
sayu diff
- Since last commitsayu diff HEAD~1..HEAD
- Between last 2 commitssayu diff abc123..def456
- Between specific commits
- Examples:
sayu stats
- Show statistics about collected eventssayu watch
- Watch for new events in real-timesayu git-hook
- Set up Git hooks for automatic collectionsayu clean
- Remove Sayu from project
.sayu.yml
:
collectors:
claude-code:
enabled: true
git:
enabled: true
db_path: $HOME/.sayu/events.db
default_provider: openrouter # or openai, custom
timeframe_hours: 2
Sayu supports multiple LLM providers for summarization:
-
OpenRouter (default):
- Set
OPENROUTER_API_KEY
environment variable - Uses Claude 3.5 Sonnet by default
- Set
-
OpenAI:
- Set
OPENAI_API_KEY
environment variable - Uses GPT-4o by default
- Set
-
Custom:
- Use
-e
flag with any command that accepts stdin/stdout - Example:
sayu sslc -e "ollama run llama2"
- Use
OPENROUTER_API_KEY
- API key for OpenRouterOPENAI_API_KEY
- API key for OpenAISAYU_STRUCTURED_OUTPUT=true
- Enable structured output format for summaries
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src/
ruff check src/
# Type checking
mypy src/
Create a new collector by extending the Collector
base class:
from sayu.core import Collector, Event, EventType
from datetime import datetime
class MyCollector(Collector):
@property
def name(self):
return "my-source"
def setup(self):
# Set up hooks or watchers
pass
def teardown(self):
# Clean up
pass
def collect(self, since=None):
# Return list of Event objects
return [
Event(
type=EventType.OTHER,
source=self.name,
content="Event content",
metadata={"key": "value"},
timestamp=datetime.now()
)
]
sayu/
├── src/
│ ├── cli.py # Command-line interface
│ ├── config.py # Configuration management
│ ├── core/
│ │ ├── collector.py # Base collector interface
│ │ └── storage.py # SQLite storage
│ ├── collectors/
│ │ ├── claude_code.py # Claude Code collector
│ │ └── git.py # Git collector
│ ├── engine/
│ │ └── summarizer.py # LLM summarization
│ └── visualizer/
│ └── timeline.py # Timeline visualization
├── pyproject.toml # Package configuration
└── .sayu.yml # User configuration
MIT