From greenfield
Mines git history for behavioral intelligence: repository overview, commit message mining, PR/MR extraction, blame-based heat maps, and issue cross-referencing.
How this skill is triggered — by the user, by Claude, or both
Slash command
/greenfield:git-archaeologyThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Extract behavioral intelligence from version control history. Commit messages, PR descriptions, blame annotations, and issue references encode design decisions, behavioral changes, and maintenance patterns that no other source captures.
Extract behavioral intelligence from version control history. Commit messages, PR descriptions, blame annotations, and issue references encode design decisions, behavioral changes, and maintenance patterns that no other source captures.
Git archaeology activates when:
.git directory)This mode runs independently of all other intelligence sources. It requires only access to the git repository and optionally to a GitHub/GitLab remote. All output is RAW (commit messages and PR descriptions may reference proprietary internals).
Source code tells you what the system does NOW. Git history tells you:
Goal: Establish the scope, age, and shape of the project.
# Commit count and date range
echo "Total commits: $(git rev-list --count HEAD)"
echo "First commit: $(git log --reverse --format='%ai' | head -1)"
echo "Latest commit: $(git log -1 --format='%ai')"
# Contributors
git shortlog -sn --no-merges | head -20
# Active branches
git branch -r --sort=-committerdate | head -20
# Tags (releases)
git tag --sort=-version:refname | head -20
# Commit frequency (commits per month, last 12 months)
for i in $(seq 0 11); do
month=$(date -d "$i months ago" +%Y-%m 2>/dev/null || date -v-${i}m +%Y-%m)
count=$(git rev-list --count --after="${month}-01" --before="${month}-31" HEAD 2>/dev/null || echo "0")
echo "$month: $count"
done
# Top-level directory structure at HEAD
git ls-tree --name-only HEAD
Write to workspace/raw/project-history/overview.md.
Goal: Extract behavioral claims from commit messages. Commit messages that describe features, fixes, and breaking changes encode behavioral contracts.
# Conventional commits: feat
git log --oneline --grep="^feat" --no-merges | head -100
# Keywords indicating new behavior
git log --oneline --grep="add\|implement\|introduce\|support\|enable" -i --no-merges | head -100
For each feature commit, extract:
# Conventional commits: fix
git log --oneline --grep="^fix" --no-merges | head -100
# Keywords indicating bug fixes
git log --oneline --grep="fix\|bug\|repair\|correct\|resolve\|patch" -i --no-merges | head -100
Fix commits are especially valuable because they reveal:
# Conventional commits: breaking
git log --oneline --grep="BREAKING" --no-merges | head -50
# Keywords indicating behavioral changes
git log --oneline --grep="breaking\|deprecat\|remov\|migration\|upgrade" -i --no-merges | head -50
Breaking changes reveal behavioral contracts that were considered important enough to announce their violation.
For high-value commits (features, fixes, breaking changes), read the full commit message:
# Full message for a specific commit
git log -1 --format='%H%n%ai%n%an%n%n%B' <commit-sha>
Extract behavioral claims from the message body. Many commit messages contain:
Write to workspace/raw/project-history/behavioral-claims.md.
- The `--output csv` flag was added in v2.3
<!-- cite: source=git-history, ref=abc1234, confidence=inferred, agent=git-archaeologist -->
Goal: Extract behavioral intelligence from pull request and merge request descriptions. PR descriptions often contain the richest behavioral context: motivation, design decisions, testing notes, and review discussions.
# List merged PRs (most recent first)
gh pr list --state merged --limit 100 --json number,title,body,mergedAt,labels
# View a specific PR with full body and comments
gh pr view <number> --json title,body,comments,reviews,labels,mergedAt
# Search PRs by keyword
gh pr list --state merged --search "authentication" --limit 20 --json number,title,body
If the remote is GitLab rather than GitHub:
# List merged MRs
glab mr list --state merged --per-page 100
# View a specific MR
glab mr view <number>
For each PR/MR, extract:
PR descriptions that contain phrases like "this PR adds", "this fixes", "after this change", "the new behavior is" are direct behavioral claims.
Not all repositories have accessible PR history. Check first:
# GitHub: check if gh CLI is authenticated and repo is accessible
gh repo view --json name 2>/dev/null && echo "GitHub accessible" || echo "GitHub not accessible"
# Check if remote is GitHub or GitLab
git remote get-url origin
If PR history is not accessible, document the gap and move on. Do not treat inaccessibility as failure.
Goal: Identify which parts of the codebase are actively maintained, recently modified, or fossilized. Maintenance patterns reveal where behavioral complexity concentrates.
# Files modified in the last 90 days, sorted by modification count
git log --since="90 days ago" --name-only --no-merges --format="" | sort | uniq -c | sort -rn | head -50
# Files with the most commits
git log --name-only --no-merges --format="" | sort | uniq -c | sort -rn | head -50
# Files not modified in over a year
git log --diff-filter=M --since="1 year ago" --name-only --no-merges --format="" | sort -u > /tmp/recently-modified.txt
git ls-files | while read f; do
grep -qx "$f" /tmp/recently-modified.txt || echo "$f"
done | head -100
# Files with the highest churn (lines added + removed) in last 6 months
git log --since="6 months ago" --numstat --no-merges --format="" | \
awk '{adds[$3]+=$1; dels[$3]+=$2} END {for(f in adds) print adds[f]+dels[f], adds[f], dels[f], f}' | \
sort -rn | head -30
| Pattern | Signal |
|---|---|
| High recent churn, many contributors | Active development, likely unstable behavior |
| High recent churn, single contributor | Focused refactoring or feature work |
| No modifications in 1+ year | Fossilized: either stable or abandoned |
| Frequent modifications to test files | Behavioral contracts actively evolving |
| Config files frequently modified | Deployment or environment complexity |
Write to workspace/raw/project-history/maintenance-heatmap.md.
Goal: Extract issue references from commits and fetch the referenced issues for behavioral context.
# Find commits that reference issues (common patterns: #123, GH-123, JIRA-123)
git log --oneline --no-merges --format="%H %s" | grep -oE '#[0-9]+|[A-Z]+-[0-9]+' | sort | uniq -c | sort -rn | head -50
# Full commit messages that reference issues
git log --no-merges --grep='#[0-9]\+' --format="%H %ai %s" | head -50
# Fetch a specific issue
gh issue view <number> --json title,body,comments,labels,state
# List issues with behavioral labels
gh issue list --label "bug" --state all --limit 50 --json number,title,body,state
gh issue list --label "enhancement" --state all --limit 50 --json number,title,body,state
Issues provide behavioral context that commits alone cannot:
Issue tracker access depends on the hosting platform and repository visibility. If the issue tracker is not accessible, document the gap. Extract what you can from commit message references alone.
Write to workspace/raw/project-history/issue-references.md.
All claims from git history analysis use source=git-history:
- The retry logic was added after users reported timeout failures on slow connections
<!-- cite: source=git-history, ref=abc1234, confidence=inferred, agent=git-archaeologist -->
Every behavioral claim gets an inline citation immediately after the claim. The ref field should be the commit SHA (short form is acceptable). For PR-derived claims, use ref=PR-<number>.
workspace/raw/project-history/
overview.md # Repository overview: age, size, contributors, structure
behavioral-claims.md # Behavioral claims extracted from commit messages
maintenance-heatmap.md # File modification patterns and churn analysis
issue-references.md # Issue cross-references and extracted behavioral context
workspace/raw/.inferred claim until corroborated by another source.<!-- cite: --> comment immediately after the claim. Never defer citation to a later step.2plugins reuse this skill
First indexed Jul 8, 2026
npx claudepluginhub earchibald/prime-radiant-marketplace --plugin greenfieldAnalyzes git history using git log, blame, shortlog to trace code evolution, map contributors, and identify commit patterns for repo archaeology.
Analyzes git history to find code hotspots, temporal coupling between files, contributor knowledge distribution, and bus factor risks. Useful for queries on code ownership, frequent changes, or evolution.
Investigates GitHub repository history before risky code changes using git blame/log, PRs, review comments, and rename/cherry-pick heuristics. Use before editing API, security, concurrency, or migration code.