Quick analysis of code evolution and key patterns
Analyzes git history to identify hotspots, key contributors, and evolution patterns.
/plugin marketplace add dgriffith/bad-daves-robot-army/plugin install dgriffith-bad-daves-robot-army@dgriffith/bad-daves-robot-armyUsing @agent-code-historian analyze the code history and evolution patterns. You must create a concise, executive-level historical analysis report WITHOUT making any changes.
The user invoked: /code-history {optional_scope}
Valid scopes:
If scope is a file or directory path:
git log --follow --stat -- <path> to track changesIf scope includes "author:":
git log --author="<name>" to filter commitsIf scope includes time period:
git log --since="<date>" to filter by dateIf scope is "PR #N":
gh pr view <N> to get PR detailsgit log --grep="<PR reference>" to find related commitsIf scope is "hotspots":
git log --all --numstat --format="%H" to count changes per fileIf scope is "co-changes":
git log --name-only --pretty=format:"%H" to group files by commitIf no scope provided:
Focus on the most important insights:
Create a markdown file at /reports/code-history-{scope}-{timestamp}.md with:
# Code History Analysis (Executive Summary)
Generated: {timestamp}
Scope: {scope_description}
Analysis Period: {date_range}
## š Quick Stats
- Total commits analyzed: X
- Contributors: Y
- Date range: {start} to {end}
- Files analyzed: Z
## ā±ļø Timeline Highlights
### Major Milestones
- YYYY-MM-DD: {significant change} (commit: abc123)
- YYYY-MM-DD: {major refactoring} (commit: def789)
- YYYY-MM-DD: {architecture shift} (commit: ghi012)
## š„ Key Contributors
| Author | Commits | Files | Impact |
|--------|---------|-------|--------|
| Alice | 150 | 45 | High |
| Bob | 120 | 38 | High |
| Carol | 80 | 25 | Medium |
**Ownership Summary**: {1-2 sentence summary of who owns what}
## š„ Hotspots (Top 10-15)
| File | Changes | Authors | Status |
|------|---------|---------|--------|
| src/auth.js | 45 | 3 | ā ļø High churn |
| src/api.js | 38 | 2 | ā ļø High churn |
| config.js | 32 | 4 | ā ļø High churn |
**Hotspot Insight**: {1-2 sentences about what hotspots reveal}
## š Co-change Patterns
**Key Clusters**:
1. **Auth System**: auth.js, user.js, session.js (23 co-changes)
2. **API Layer**: api.js, routes.js, middleware.js (18 co-changes)
3. **Data Layer**: db.js, models.js, migrations.js (15 co-changes)
**Architectural Insight**: {1-2 sentences about module boundaries}
## šÆ Key Findings
1. **{Finding Title}**: {1-2 sentence explanation with data}
2. **{Finding Title}**: {1-2 sentence explanation with data}
3. **{Finding Title}**: {1-2 sentence explanation with data}
4. **{Finding Title}**: {1-2 sentence explanation with data}
5. **{Finding Title}**: {1-2 sentence explanation with data}
## š Development Velocity
- Average commits/week: {X}
- Peak activity period: {when}
- Current trend: {increasing/stable/decreasing}
## ā ļø Risk Indicators
- High churn files: {count}
- Bus factor concerns: {areas with single owner}
- Technical debt areas: {hotspots with many bug fixes}
---
š” **For detailed analysis, use**: `/code-history-detailed {scope}`
Remember: This is the "executive briefing" version. Leaders want key insights fast. For comprehensive analysis, they can use /code-history-detailed.