Cognitive debt detection and management for Git repositories. Zero LLM. Zero network. All signals from git.
AI coding agents ship code fast. Humans lose track of what was AI-generated and what was reviewed. Over time, unreviewed AI code accumulates as a liability — call it cognitive debt.
Every git commit automatically:
- Slices the active Claude Code session to the window between this commit and the previous one
- Attributes AI lines by matching agent Write/Edit tool calls against the commit diff
- Scores friction via tree-sitter AST analysis (complexity delta, doc gap, author churn)
- Classifies the commit and writes to the
cognitive/v1orphan branch
Each commit gets three files stored in a sharded orphan branch:
cognitive/v1
└── ab/cd/ef1234/
├── activity.json — classification, friction score, AI attribution, endorsement status
├── endorsements.json — who endorsed it and when
└── session.jsonl — the Claude conversation that produced this commit
No external service. No daemon. Everything in git.
Three signals, weighted sum (0.0–1.0):
- Complexity delta (0.4) — real decision points added (
if,match arm,&&,||, etc.) parsed via tree-sitter AST - Doc gap (0.4) — functions added without a doc comment node in the AST
- Author churn (0.2) — distinct committers on changed files in the last 90 days
Checked in priority order:
Agent-Attribution: 75%trailer in the commit message — exact percentage- Line-level matching — agent Write/Edit lines vs git diff lines, per file
- Keyword scan —
Co-Authored-By: Claude,co-authored-by: copilot,cursor,ai-generated
cargo install git-cognitiveOr from source:
git clone https://github.com/ccherrad/git-cognitive
cd git-cognitive
cargo install --path .# 1. Enable automatic auditing on every commit
git-cognitive enable claude
# 2. See the debt
git-cognitive debt
# 3. Endorse commits interactively
git-cognitive endorse
# 4. Share with your team
git-cognitive pushgit-cognitive enable claude
Writes .git/hooks/post-commit to auto-audit and push on every commit.
git-cognitive index [--commit <SHA>|HEAD] [--since <SHA>] [--all] [--check-zombies]
Walks commits and writes activity to cognitive/v1. Run manually to backfill history.
--all— backfill last 500 commits--check-zombies— flag AI commits unendorsed >30 days with no human follow-up
git-cognitive debt [--interactive]
Flat table of all commits: SHA, classification, friction score, AI%, title, endorsement status.
git-cognitive endorse [<SHA>|HEAD]
git-cognitive endorse # interactive TUI picker
Mark a commit as understood and vouched for. Pushes automatically.
TUI controls: ↑↓/jk navigate, e/Enter endorse, s git show, q quit.
git-cognitive show <SHA>|HEAD
Full activity item + endorsement history for a commit.
git-cognitive session <SHA>|HEAD
Shows the Claude conversation (prompts, responses, tool calls) captured for this commit's window.
git-cognitive push
git-cognitive pull
Share cognitive debt data with your team via the cognitive/v1 branch.
| Class | Trigger |
|---|---|
risk |
AI-attributed + files in a semantic cluster (topology index), or AI ≥70% + feat |
tech_debt |
AI ≥70% + refactor/chore |
new_feature |
feat:, add:, new: + low AI |
bug_fix |
fix:, bug: |
refactor |
refactor:, chore: + low AI |
dependency_update |
Cargo.lock, yarn.lock, etc. — auto-excluded from endorsement queue |
minor |
docs:, test:, ci:, style: — auto-excluded |
other |
anything else |
A zombie is an AI-attributed commit that:
- Has been unendorsed for >30 days
- Has had no human follow-up commit touching the same files
git-cognitive index --check-zombiesAdd to commit messages for precise attribution without relying on line matching:
feat: add payment processing flow
Agent-Attribution: 80%
# morning
git-cognitive pull
git-cognitive debt
# review queue
git-cognitive endorse
# weekly
git-cognitive index --check-zombiesgit-semantic — semantic code search, sibling tool.
MIT OR Apache-2.0