git-ai-archaeology
Produces a complete analysis of AI config evolution in a git repository. Finds when each AI configuration file was created, how AI-config commit velocity evolved month by month, which PRs structured the evolution, and identifies maturity phases.
**Output**: a single file `{output_dir}/{slug}-git-archaeology.md`
Expected Input
/git-ai-archaeology repo_path=/path/to/repo [output=./talks/slug] [slug=talk-name] [since=2025-01-01]- `repo_path`: absolute path to the target git repo (required)
- `output`: output directory (default: `./talks`)
- `slug`: output filename (default: repo folder name)
- `since`: analysis start date (default: first repo commit)
Workflow
- **Verify the repo**: ensure the path exists and is a git repo
- **Global metrics**: total commits, releases, contributors, time period
- **Section 1 — First commits**: find creation date for key AI-config paths
- **Section 2 — Monthly distribution**: commits filtered by AI-config keywords
- **Section 3 — Major PRs**: extract and categorize significant AI-config commits
- **Section 4 — CHANGELOG**: if CHANGELOG.md exists, extract releases with AI mentions
- **Section 5 — Phases**: synthesize evolution phases
- **Save** the output file
---
Step 1: Verification and Global Metrics
# Verify it's a git repo
git -C {repo_path} rev-parse --git-dir
# Global metrics
git -C {repo_path} log --oneline | wc -l # total commits
git -C {repo_path} tag --sort=version:refname | wc -l # total releases
git -C {repo_path} shortlog -sn --no-merges | wc -l # contributors
git -C {repo_path} log --pretty=format:"%ad" --date=short | tail -1 # first commit
git -C {repo_path} log --pretty=format:"%ad" --date=short | head -1 # last commit
git -C {repo_path} log --merges --oneline | wc -l # merged PRs---
Step 2: Section 1 — First Commits per AI-Config Path
For each path, find the origin commit with `--diff-filter=A`:
# Paths to analyze — adapt based on what exists in the repo
PATHS=(
"CLAUDE.md"
".claude"
".claude/commands"
".claude/agents"
".claude/hooks"
".claude/skills"
".claude/rules"
".agents"
".cursor"
"doc/knowledge-base.md"
"doc/guides/ai-instructions"
"doc/guides/ai-review"
)
for path in "${PATHS[@]}"; do
git -C {repo_path} log --diff-filter=A --follow \
--format="%ad | %H | %s" --date=short \
-- "$path" | tail -1
doneBuild the Section 1 table from results. Skip paths with no output (don't exist in this repo).
Also build the ASCII timeline:
{date} ─── {path} ─── {message}Sorted chronologically.
---
Step 3: Section 2 — Monthly Distribution of AI-Config Commits
Filter commits by AI-config-related keywords:
# All commits with AI-config keywords
git -C {repo_path} log --format="%H %s" | \
grep -iE "(claude|feat.ai|docs.ai|tech.ai|mcp|skill|hook|agent|llm|prompt)" \
> /tmp/ai_commits_filtered.txt
# Count AI-config commits per month
git -C {repo_path} log --format="%ad %H" --date=format:"%Y-%m" | \
while read month hash; do
if grep -q "$hash" /tmp/ai_commits_filtered.txt; then
echo "$month"
fi
done | sort | uniq -cMore direct alternative:
git -C {repo_path} log --format="%ad %s" --date=format:"%Y-%m" | \
grep -iE " (feat|fix|docs|tech|chore|refactor)\(ai\)|claude|mcp.*server|\.claude/|skill|hook.*security|guardrail" | \
awk '{print $1}' | sort | uniq -cCompute per month:
- AI-config commit count
- % of monthly total (cross-reference with all-category monthly total)
- Context (if notable period)
Build ASCII distribution chart (horizontal or vertical bars).
---
Step 4: Section
<!-- truncated -->

