The Signal

A post climbing Hacker News front page ( 112 points) walks through how to build a custom Git diff driver — a rarely-used but powerful Git feature that lets you replace the default line-by-line diff with your own comparison logic for specific file types. The article covers the full setup: configuring .gitattributes, wiring up a driver script in .git/config or your global Git config, and pointing Git at any executable that can compare two file versions. The result: readable, semantic diffs for formats Git normally but chers — think minified JSON, binary configs, SQLite databases, or auto -generated protobuf files.

Builder's Take

Solo builders working on AI products deal with file formats Git was never designed for. Prompt files. Embedding indexes. JSON configs that get auto-rewritten by tools. SQLite databases used as lightweight vector stores. Every one of these produces garbage diffs by default — noise that makes code review (even solo self-review) painful and error -prone.

Here's the leverage calculation: you write a diff driver script once — maybe 20-30 lines of Python or shell — and it applies forever across every repo you configure it in. That's classic code leverage. One artifact , infinite reuse.

For AI product builders specifically, this unlocks a few high-value scenarios:

  • Prompt vers ioning: Store prompts as .prompt.json files with metadata (model, temperature, version). A custom diff driver can surface only the text changes, not the surrounding JSON structure noise.
  • Config diffing: LangChain, L lamaIndex, and similar frameworks often serialize chain configs or agent graphs to JSON/YAML. A semantic diff driver makes version comparisons actually readable.
  • SQLite as a data store: If you're using SQLite for lightweight persistence (user data, embeddings metadata), a diff driver wrapping sqlite3 .dump gives you human-readable schema and data diffs instead of binary garbage.
  • Moat angle: If you're building dev tooling for AI teams, a polished Git diff driver for prompt files or agent configs is a genuine differentiator. Nobody has nailed this yet.

Tools & Stack

Core : Git built-ins (free, already installed)

No new dependencies. This is pure Git configuration.

Step 1 — Define the driver in ~/.gitconfig ( global) or .git/config (per-repo):

[diff "prompt diff"]
  command = /usr/local/bin/prompt -diff-driver

Step 2 — Tell Git which files use it via .gitattributes:

*.prompt.json diff=promptdiff

Step 3 — Write your driver script. Git calls it with two args: old file path and new file path.

#!/usr/bin/env python3
import sys,  json

old = json.load(open(sys.argv[1]))
new = json.load(open(sys.argv[2]))

 if old.get('prompt') != new.get('prompt'):
    print(f"--- prompt (old) ")
    print(old.get('prompt', ''))
    print(f"+++ prompt (new)")
    print(new.get(' prompt', ''))

Make it executable: chmod +x /usr/local/bin/prompt-diff-driver

Alternatives worth knowing

  • git-diff for SQLite: Use sqlite3 $1 .dump > /tmp/old.sql pattern — standard shell, no deps.
  • Dif ftastic: A structural diff tool (difftastic.wilfred.me.uk) that understands syntax trees. Works as a drop-in diff driver for many languages. Free , open source.
  • jq-based drivers: For JSON-heavy workflows, pipe through jq for pretty-printing before diff. jq is free and available on Homebrew/apt.

Pricing

Everything here is free. Git, Python, shell scripts. Zero infrastructure cost. This is pure leverage through configuration .

Ship It This Week

Build a prompt version control system with semantic diffs.

Here's the concrete path:

  1. Store your LLM prompts as *.prompt.json files with fields : text, model, temperature, version, last_tested .
  2. Write a 30-line Python diff driver that outputs only the text field diff using Python's built-in difflib.unified_diff — no external deps .
  3. Wire it up with .gitattributes so every git diff or git log -p shows clean prompt diffs.
  4. Add a git log --oneline alias that filters to .prompt.json files only: git log --on eline -- '*.prompt.json'.

Bonus: wrap this into a tiny CLI tool, publish it on PyPI ( check current PyPI publishing docs), and you've got a real open -source project that solves a real pain point for every AI builder using Git. The total build time? A focused afternoon. The ongoing leverage? Every prompt change you ever make, diffed cleanly, forever.

Start with the driver script. You can have a working version in under an hour.