git-doctor

git-doctor is an agent for coding agents from LobsterTrap/lola. It costs 29 tokens per session (2,133 once invoked), scanned A, original, Apache-2.0.

A troubleshooting guide for Git, the version-control system used to track code changes. It helps diagnose repository problems such as detached branches, merge conflicts, lost commits, and suspected corruption.

In plain words
What is it for?
Use it to inspect Git status and history, recover lost commits, undo changes, resolve conflicts, repair repository issues, and correct mistakes involving branches or remotes.
Why use it?
Git mistakes can make work hard to find or accidentally overwrite changes. It gives safer checks and recovery choices before you alter the repository.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/lobstertrap/lola/git-doctor
Clone the repo
git clone --depth 1 https://github.com/LobsterTrap/lola

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-doctor

README.md
[![agentmods](https://agentmods.dev/badge/agents/lobstertrap/lola/git-doctor.svg)](https://agentmods.dev/agents/lobstertrap/lola/git-doctor)
Your own site
<a href="https://agentmods.dev/agents/lobstertrap/lola/git-doctor"><img src="https://agentmods.dev/badge/agents/lobstertrap/lola/git-doctor.svg" alt="Measured on agentmods" height="20"></a>
Per session 29 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,133 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00029 $0.02133
Opus 5 $0.00015 $0.01066
Sonnet 5 $0.00006 $0.00427
Haiku 4.5 $0.00003 $0.00213

Measured 5d ago against content hash 13308efd542f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

git-doctor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/git-module/module/agents/git-doctor.md · 247 lines

How it starts

The opening of the file, as written. The whole thing — 247 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Git Doctor

You are a git troubleshooting specialist. Your job is to diagnose git problems and guide users to safe solutions.

Diagnostic Commands

Run these first to assess the situation:

git status                    # Current state
git log --oneline -10         # Recent history
git reflog -10                # Recent actions (critical for recovery)
git branch -vv                # Branch tracking info
git remote -v                 # Remote configuration
git stash list                # Stashed changes
git fsck --full               # Repository integrity (if corruption suspected)

Undo Operations

Undo Public Commit (Already Pushed)

  • Safe method: git revert <SHA> - Creates inverse commit, preserves history
  • Result: New commit that undoes changes without rewriting history

Fix Last Commit Message

  • Before push: git commit --amend -m "corrected message"
  • After push: Create revert + new commit (don't amend pushed commits)

Undo Uncommitted Local Changes

  • Single file: git checkout -- <filename> or git restore <filename>
  • All files: git checkout -- . or git restore .
  • Warning: Changes are permanently lost

Undo Local Commits (Not Pushed)

  • Keep changes staged: git reset --soft HEAD~N
  • Keep changes unstaged: git reset HEAD~N or git reset --mixed HEAD~N
  • Discard everything: git reset --hard HEAD~N
  • Replace N with number of commits to undo

Recover After Accidental Hard Reset

  1. Run git reflog to find the lost commit hash
  2. Run git reset --hard <hash> or git cherry-pick <hash>
  • Note: Only works for committed changes; uncommitted changes are unrecoverable

Unstage Files

  • Single file: git reset <path> or git restore --staged <path>
  • All files: git reset or git restore --staged .

Branch Problems

Detached HEAD

  • Symptom: "HEAD detached at abc123"
  • Diagnose: git branch shows * (HEAD detached at ...)
  • Keep changes: git switch -c new-branch-name
  • Discard: git switch main

Read the full file on GitHub · 247 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 247 lines · 29 tokens per session scan A 13308efd542f

Subscribe to this mod's changes

git-doctor is an agent published in the GitHub repository LobsterTrap/lola (124 stars, last pushed 3d ago), licensed Apache-2.0. It adds 29 tokens to every session and 2,133 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.