git blame names the last person to touch a line. This skill reconstructs the
reason the line exists. It traces a file or current line range through local git
history, identifies its origin and later edits, finds files that repeatedly
changed beside it, and extracts intent clues from commit messages.
Everything runs locally. No network calls, API keys, or repository writes.
Get the repository path and tracked file path. Use a line range when the user names a current block or function. If either path is missing, ask only for the missing value. Do not scan sibling repositories.
Paths should be relative to the repository and use forward slashes. Line ranges
use inclusive current line numbers such as 40-72.
From this skill directory:
python3 scripts/archaeologist.py /path/to/repo src/cache.py --lines 40-72 --json
For the complete history of a file, omit --lines:
python3 scripts/archaeologist.py /path/to/repo src/cache.py --json
The script is read-only. With a range it uses git line-log; without one it uses file history with rename following. It also reads current authorship with blame. If it rejects a path or range, report that error and ask for a corrected target.
Before interpreting the JSON, read
references/reading-git-history.md. Its confidence rules prevent blame
ownership, correlation, and commit-message hints from becoming false certainty.
region: normalized repository, current and historical paths, mode, range,
and co-change thresholdintroduced_by: oldest commit in the selected historytimeline: commits ordered oldest to newest, with category, changed files,
and detected renamesco_changed: files present beside the target in enough selected commitsauthors: current blamed lines and historical commit counts, kept separateintent_signals: issue references, reverts, workarounds, temporary markers,
and unfinished-work markers found in commit messagesAn empty signal list means the messages do not say why. It does not mean the change had no reason.
Turn the JSON into a short "why this code exists" report:
changed_files as a dependency.Keep hashes short in prose, but preserve enough characters to identify them. Do not dump the full JSON unless the user asks.
End by offering one relevant follow-up, such as:
For a deliberate-choice question, weigh repeated edits, issue references, reverts, and explicit constraint words. For a change-risk question, inspect the repeated co-change files and the last behavior-changing commits before proposing edits. Do not modify code until the user asks.
scripts/archaeologist.py: offline git history walker and JSON report builderreferences/reading-git-history.md: interpretation and confidence guide