Building an AI-Powered Git Assistant: The Story Behind Coco featured image

Building an AI-Powered Git Assistant: The Story Behind Coco

May 02, 2025

How I automated the most tedious part of my development workflow and why you might want to too

I’ve lost track of how many hours I’ve spent massaging commit messages. You know the drill: you implement a complex feature, fix a tricky bug, or refactor a critical component, and then the terminal cursor blinks back while you search for a sentence that actually helps future you.

After enough commits titled “fix stuff” and “update code” (guilty), I finally built a helper to do better. That weekend project turned into coco (git-coco) — an AI-powered git assistant that helps turn staged changes into meaningful commit messages, and a few other chores too.

The Problem with Git Commits

Let’s be honest – writing good commit messages is hard. It requires:

  • Understanding the broader context of your changes
  • Summarizing complex modifications concisely
  • Following project conventions (Conventional Commits, anyone?)
  • Remembering to include ticket references
  • Maintaining consistency across team members

Most days I either burn time on wording or settle for “good enough,” and neither feels right.

Enter AI-Powered Git Assistance

What started as a simple commit message generator has evolved into a broader git assistant. I kicked things off around the time ChatGPT-3 first landed, when context windows were tiny and every token counted. The first real challenge was building a pipeline that could condense and summarize staged files just enough to fit into that narrow window while still getting useful answers back.

Here’s where coco has landed so far:

🤖 Intelligent Commit Messages

  • Analyzes staged changes using AI (OpenAI, Anthropic, or local models via Ollama)
  • Accounts for code context and suggests descriptions that make sense
  • Automatically detects and validates against commitlint configurations
  • Supports Conventional Commits out of the box

📋 Automated Changelogs

  • Generates release notes from commit history
  • Works with any commit range or branch
  • Handy when I need to send an update without digging through git log

📊 Code Change Summaries

  • Recap what you’ve worked on (yesterday, last week, last month)
  • Helps with standups, status reports, or just remembering what happened
  • Analyzes working tree changes or historical ranges

🔍 AI Code Review

  • Reviews changes before you commit
  • Flags potential issues and suggests improvements
  • Feels a bit like a teammate giving things a quick once-over

The Technical Journey

Building coco taught me a lot about creating developer tools that feel native to existing workflows. Here are some decisions that shaped the project:

TypeScript + LangChain Architecture

I chose TypeScript for type safety and developer experience, paired with LangChain for flexible AI provider integration. I grabbed LangChain early because it was one of the first broadly supported libraries that let me switch AI providers without rewriting the entire pipeline. That made it possible to support OpenAI and Anthropic alongside Ollama and other local models, so teams that care about privacy could keep their diffs off third-party servers entirely. This means coco works with:

  • OpenAI’s GPT models (most popular)
  • Anthropic’s Claude (excellent for code)
  • Local models via Ollama (privacy-focused)
  • Any LangChain-compatible provider

Directory-Aware Diff Summaries

Small context windows forced me to get creative with how much change history I could send to the model. Early on I wrote a summarization pass (now src/lib/parsers/default/utils/summarizeDiffs.ts) that walks the project tree, groups diffs by their folders, and summarizes each bundle. If a directory is still too wordy, the algorithm backs up a level, merges child summaries, and keeps going until the bundle fits within the available tokens. The folder-first approach kept contextual clues about where changes lived, so very little meaning was lost in the compression. These days context windows are huge so the helper rarely runs, but it was indispensable when every token mattered.

CLI-First Design

The tool needed to feel like a natural extension of git. You can use it in a few different ways:

Bash
# Generate and commit in one go
coco -s

# Use in scripts  
git commit -m "$(coco)"

# Interactive mode for review
coco -i

Smart Commitlint Integration

One of the trickiest features was making coco play nicely with existing project conventions. The solution:

  • Automatically detects commitlint configurations
  • Passes rules to the AI for initial compliance
  • Validates generated messages against your rules
  • Auto-retries with error feedback when validation fails
  • Lets users manually edit with continued validation

Real-World Impact

Since sharing coco, I’ve seen developers use it in ways I never anticipated:

  • Onboarding new team members who aren’t familiar with project conventions
  • Maintaining consistency across large teams with different skill levels
  • Generating documentation from commit histories
  • Code review preparation by understanding changes before submitting PRs
  • Personal productivity for developers who want to focus on code, not commit messages

Feedback has been encouraging, with folks saying they enjoy their git workflow more.

Lessons Learned

1. Developer Tools Need Zero Friction

Any tool that adds friction to a developer’s workflow will be abandoned quickly. Coco had to fit into existing git habits.

2. AI Prompt Engineering is Crucial

The quality of commit messages depends heavily on prompt design. I ended up spending considerable time crafting prompts that understand code context, project conventions, and generate actionable commit messages.

3. Configuration Should Be Optional

While power users love extensive configuration options, the tool needed to work great out of the box. Coco ships with sensible defaults and reveals advanced features when you’re ready for them.

4. Community Input Drives Innovation

The most requested features (like changelog generation and code review) came from user feedback. Building in public and listening to the community shaped coco into something far better than my original vision.

What’s Next

The git assistant space is evolving quickly. Here’s what’s on my radar:

  • Enhanced code review with more sophisticated analysis
  • Team collaboration features for consistent commit standards
  • Integration with popular development tools (VS Code extension, GitHub Actions)
  • Advanced changelog templates for different release styles
  • Multi-repository support for monorepo workflows

Try It Yourself

If you’re tired of writing commit messages or want to streamline your git workflow, give coco a try:

Bash
# Get started with the setup wizard
npx git-coco@latest init

# Or jump right in
npx git-coco@latest

The project is open source on GitHub, and I’d love to hear how you use it or what features would make your workflow even better.

Final Thoughts

Building coco has been a journey of solving a personal pain point and discovering it’s a universal developer frustration. AI has the potential to eliminate many tedious aspects of our workflows, but only when implemented thoughtfully and with deep understanding of how developers actually work.

The goal was never to replace human creativity in software development, but to automate the parts that don’t require it – like summarizing code changes or following formatting conventions. This frees us up to focus on what we do best: building great software.

What tedious parts of your development workflow would you like to see automated? I’d love to hear your thoughts and continue the conversation about AI-assisted development tools.


Interested in the technical details? Check out the full documentation or try coco in your next project. Questions? Feel free to reach out or open an issue on GitHub.