Git History··7 min read

brain_from_git: bootstrap AI memory from your git history

Your git history is the most underutilized knowledge asset in your codebase. Two years of bug fixes, failed approaches, and fragile files — sitting in plain text, completely invisible to your AI assistant. We built brain_from_git to fix that in 30 seconds.

The problem: AI starts blind, every single session

Your team has been building this codebase for years. You know which files break whenever you touch the auth layer. You know that the Docker Compose flag that looks wrong is actually intentional — someone reverted that change in a panic at 11pm six months ago. You know the JWT refresh bug only shows up on Safari and that it took three separate attempts to get right.

Your AI assistant knows none of this. Every session starts with a blank slate. It will confidently suggest the same approach your team already tried and reverted. It has no idea which files are fragile, which patterns have failed, or what your senior engineers have learned the hard way over years of production incidents.

This is not a context window problem — it's a knowledge continuity problem. And the solution has been sitting in your repo all along.

Your git log is a knowledge base. Start using it.

Think about what a commit message actually is: a compressed summary of a decision your team made, with a diff showing exactly what changed. A fix commit tells you what was broken and how it was resolved. A revert commit is even more explicit — it's your team saying "this was wrong enough to undo immediately." A refactor commit maps where the architecture is actively evolving.

Run git log --oneline -100 on any production codebase right now. What you're looking at is a compressed timeline of every lesson your team has learned in the last few months. Bugs that burned you. Deployments that went wrong. Files you've had to touch over and over.

brain_from_git scans that history and turns it into structured AI Brain lessons — automatically, with no manual writing required.

What brain_from_git does

It's a single MCP tool call. Point it at your repo, set a lookback window, and it does the rest:

MCP tool call
brain_from_git({
repo_path: "/path/to/your/repo",
days: 180,
dry_run: false
})

The dry_run flag is worth calling out. Set it to true first to preview exactly what would be imported — lesson keys, severity, content — before committing anything to your Brain. On a new codebase or a team Brain you share with colleagues, it's worth a quick review pass before the import runs.

How it classifies commits

Not every commit has equal informational value. A one-line typo fix and a three-day production incident hotfix are both commits — but they should be weighted very differently as lessons. Here is how the classification works:

  • fix / hotfix commits — imported as success lessons with elevated severity. The Brain learns what was broken and how it was resolved, so it can surface the solution next time you touch related code.
  • revert commits— imported as failure lessons, the highest-value entries in the batch. A revert is your team explicitly saying "this was wrong." The Brain preserves that signal and will warn when a similar approach is suggested again.
  • perf / refactor commits — imported as architecture lessons. Over time these build a map of where the codebase is actively evolving and which patterns your team has deliberately moved away from.
  • hotspot files — files that appear in commits most frequently get tracked as a separate context entry. These are your fragile areas: the files where things break, where the code is complex, where care is always needed.

What the output looks like

Here is actual output from running brain_from_git against a 6-month window on a mid-size production codebase:

🧠 Brain bootstrapped from git history

 

📊 Scanned: 342 commits over last 180 days

✅ Success lessons: 28 ❌ Failure/revert lessons: 9

📁 Hotspot files tracked: 12

💾 Total stored: 31 new lessons

 

Top lessons extracted:

🟡 `auth:jwt-refresh-token` — Fixed token refresh on Safari — use httpOnly cookie

🔴 `deploy:docker-compose-detach` — Reverted: docker compose up without -d blocks SSH

🟡 `redis:connection-pool-timeout` — connectTimeout: 5000 + retryStrategy: null prevents hangs

🔴 `api:rate-limit-headers` — Added X-RateLimit headers after customer reports

🔴 `auth:pkce-safari-16` — PKCE flow broken Safari 16.3, still unresolved

 

💡 Run session_start to see these lessons in your next briefing.

💡 Hotspot files saved — recall_context("git-hotspots") to see fragile areas.

Thirty-one lessons extracted from 342 commits in seconds. That Safari JWT bug your team spent a week debugging. The Docker Compose flag that caught the whole team off guard. The Redis timeout config that took three incidents to get right. All of it is now in your Brain — searchable, surfaced proactively, and available to every developer on the team from their first session.

Three use cases worth calling out

New developer onboarding. The typical new hire spends weeks rediscovering things the team already knows: which files are fragile, which patterns have failed, where the bodies are buried. Run brain_from_git on their first day and their AI assistant immediately has months of institutional context. They get the crash course your senior engineers took years to accumulate.

Switching AI providers. Moving from Copilot to Claude Code, or from Cursor to a custom MCP setup? Your old assistant had implicit context from months of conversation history — none of which transfers. Run brain_from_git once during migration and the new assistant starts with a full backfill of what it missed. No painful re-onboarding of the AI.

Post-holiday recovery. Two weeks out of the codebase and you come back to a wall of context you need to rebuild. Run brain_from_git for the period you were away. Your AI catches you up on what changed, what broke, and what the team had to revert — before you open a single file.

No extra workflow required

The full brain_from_git run takes 30 seconds on a 6-month window and a couple of minutes on a multi-year history. After that, it's done — lessons are in your Brain and available immediately.

For ongoing knowledge capture from future commits, pair it with Ambient Git Learning, which extracts lessons automatically at the end of each session. But for bootstrapping a Brain from existing history — getting immediate, deep context from everything your team has already built — there is nothing else like it.

Your team has already done the hard work. Every bug you fixed, every approach you abandoned, every file you've touched a dozen times — it's all there in the log. You just have not had a way to put it in front of your AI assistant. Now you do.

cachly is a managed AI Brain for developers — persistent memory, team knowledge sharing, and semantic cache for Claude Code, Cursor, GitHub Copilot & Windsurf. One MCP server. 51 tools. Free tier, EU servers, no credit card.

Your AI is forgetting everything right now.

Every session starts blank. Every bug re-discovered. Every deploy procedure re-explained. cachly fixes that in 30 seconds — your AI remembers every lesson, every fix, every teammate's hard-won knowledge. Forever.

🇪🇺 EU servers · GDPR-compliant🆓 Free tier — forever, no credit card⚡ 30-second setup via npx🔌 Claude Code · Cursor · Copilot · Windsurf
Git HistoryAI Memorybrain_from_gitDeveloper OnboardingMCP