Chad Research · Paper 05

Git as ground truth.

Git already records every change an organization has made to its code. What it does not record is why. We decompose history into rows of added and deleted lines, link each one to the intent behind it, and let agents find related work with a columnar query instead of re-reading the log.

11 min read14 references

Abstract

A repository’s history is the most reliable record an engineering organization has: every line that exists was put there by a specific change, at a specific time, by someone. More than twenty-five years of mining software repositories research shows how much that record knows about coupling, ownership and defects.

Agents rarely use it. They read the current files, perhaps a git log, and rebuild understanding from scratch on every task. We argue that history should be data, not text: one row per added or deleted line, keyed by file and commit, and linked to the intent that motivated the change. That gives “blame by intent”, end-to-end provenance, and retrieval of related work in milliseconds.

History knows what belongs together

The central result of mining software repositories is that files which changed together in the past tend to change together again, whether or not the code reveals any dependency between them.

1998

Logical coupling

Gall, Hajek and Jazayeri analyze 20 releases of a large telecommunications switching system and show that release history exposes modules that are logically coupled, independent of the code’s static structure. [1]

2004

Mining version histories

Zimmermann et al. mine association rules from co-changes. Their ROSE prototype suggests further locations to change once a developer starts editing, reveals coupling that program analysis cannot detect, and warns about incomplete changes. [2]

2005

Relative churn predicts defects

Nagappan and Ball show that relative code churn measures predict defect density in Windows Server 2003, discriminating fault-prone binaries with 89% accuracy, while absolute churn does not. [4]

2011

Ownership matters

Bird et al. find that in Windows Vista and Windows 7, ownership measures such as the number of low-expertise contributors relate to both pre-release faults and post-release failures. [6]

None of these signals is in the current snapshot of a file. They live in the history, and they are aggregates: co-change counts, churn ratios, ownership shares. That is a hint about the right representation. These are queries over many small facts.

Lines, not commits

A commit is a bundle. It can touch a dozen files for three different reasons, and its message describes the bundle as a whole, if at all. The fact that actually persists in the code is the individual line.

ClickHouse ships a tool that takes this literally. clickhouse git-import reads a repository and produces three tables: commits, file_changes and line_changes, the last with one row per added or deleted line, its sign, and the commit, author and time of the previous change to that line [12]. In other words, blame is precomputed as columns. The ClickHouse documentation uses it to analyze ClickHouse’s own repository, with queries for the most modified files, code age and rewrite patterns.

ClickHouse's own history as tables

Rows inserted per table by clickhouse git-import on the ClickHouse repository, as reported in the documentation (November 2022). Thousands of rows.

Source: ClickHouse example dataset documentation [12], figures from its INSERT outputs. The same page's summary list gives 266,051 rows for the commits TSV; we show the INSERT counts.

At that granularity, the history of a large project is millions of rows, which is small for a columnar engine designed to scan billions with aggressive pruning and vectorized execution [13]. Questions that would take an LLM thousands of tokens of git log -p become filters and group-bys.

line_changes(ts, repo, file, line, sign, commit, prev_commit, author, intent_id) // one row per +/− line

The missing column is intent

Git records what and when. It records why only through the commit message, and the research is not kind to commit messages as a data source.

  • Messages are often weak. Tian et al. analyze about 1,600 messages from five open source projects and estimate that around 44% could be improved; good messages state both what changed and why [7].
  • Links are incomplete. Mining studies usually connect commits to issues by scanning messages for identifiers. Bird et al. show that only a fraction of fixes are linked this way and that the linked subset is systematically biased [5], and Bachmann et al. find the missing links are a biased sample of fixed bugs in turn [14].

The consequence is that most history cannot answer the question an agent needs answered first: what else was done for the same reason? The intent existed. It was in a Linear ticket, a Slack thread, a meeting, a Sentry alert. It just never reached the repository in a form a query could use.

Git is ground truth for what changed. It becomes ground truth for why only if the intent is attached at write time, not guessed later from a message.

Blame by intent

git blame answers “which commit last touched this line”. With an intent_id on every row, the same lookup answers “which decision is this line part of, where did it come from, and who validated it”.

Blame by intent

src/checkout/cart.ts, each line colored by what last touched it. Hover a line for its provenance, or an intent to isolate its lines. Illustrative data.

2f81aaINT-11021import { money } from "../lib/money";
c0d9e1INT-48212import { clock } from "../lib/clock";
4b7e10INT-39073import { retry } from "../lib/retry";
4
a41f2cINT-48215const TIMEOUT_MS = cfg.checkoutTimeoutMs;
6
2f81aaINT-11027export function subtotal(items: Item[]) {
9d03beINT-11028 return items.reduce((s, i) => s + i.cents * i.qty, 0);
2f81aaINT-11029}
10
b19e0aINT-466011export function applyCoupons(total: number, cs: Coupon[]) {
b19e0aINT-466012 const ordered = [...cs].sort(byPriority);
b19e0aINT-466013 return ordered.reduce((t, c) => c.apply(t), total);
b19e0aINT-466014}
15
2f81aaINT-110216export async function checkout(cart: Cart) {
c0d9e1INT-482117 const deadline = clock.now() + TIMEOUT_MS;
b19e0aINT-466018 const total = applyCoupons(subtotal(cart.items), cart.coupons);
4b7e10INT-390719 return retry(() => gateway.charge(total), {
a41f2cINT-482120 until: deadline,
51ac3fINT-390721 backoff: "exponential",
4b7e10INT-390722 });
2f81aaINT-110223}

23 lines · 7 commits · 4 intents. By commit, the file is a patchwork of hashes. By intent, it is four decisions, each with a source and a validator. Illustrative.

The difference is not cosmetic. By commit, a file is a patchwork of hashes, and understanding any one of them means opening it, reading its message, and hoping it links somewhere. By intent, the same file resolves into a few decisions, each with a source and an acceptance criterion. An agent about to modify line 20 can see that it exists because checkout must not time out under load, and can retrieve every other line, test and config entry that serves the same intent before touching anything.

Ownership research suggests why this matters for quality: changes by contributors far from a component’s history are riskier [6]. An agent is, by default, the least experienced contributor in any file. Intent-level provenance is how it inherits the experience it lacks.

Provenance and bug introduction

The best-known use of line-level history is finding where a bug came from. The SZZ algorithm links bug-fixing commits to issue reports, then traces the lines a fix modified back to the commits that last touched them, which become candidate bug-inducing changes [3]. The original study on Eclipse found fix-inducing changes most frequent on Fridays.

Two decades later, the limits of blame-based tracing are well measured, and recent work turns to LLMs and agents to compensate.

How much blame-based tracing misses

Each paper's own reported figure on Linux kernel data. Different metrics, shown side by side for scale, not comparison. Hover for details.

Sources: Lyu et al. [8], AgentSZZ [10], reporting the recall of LLM4SZZ [9] on developer-annotated Linux data.

  • Ghost commits. Lyu et al. evaluate six SZZ implementations on 76,046 bug-fixing and bug-inducing pairs from Linux, using the kernel’s Fixes: tags as ground truth. About 17% of fixes are ghost commits that SZZ cannot trace at all [8].
  • LLM-assisted SZZ. LLM4SZZ gives a model the candidate commits and surrounding context and reports F1 gains of 6.9% to 16.0% over baselines across three datasets [9].
  • Agentic SZZ. AgentSZZ lets an agent investigate with tools, and reports that nearly a quarter of bug-inducing commits are untraceable by blame-based methods, with recall gains of up to 300% on cross-file cases [10].

Each of these systems reconstructs, after the fact, a link between a fix and its cause that was never recorded. When every line carries its intent, and every fix carries the intent of the incident that triggered it, part of that reconstruction becomes a join. Cross-file causes, the hardest case for blame, are exactly what an intent ties together.

Agents need repository memory

The 2025–2026 agent literature reaches the same conclusion from the other side. Wang et al. observe that coding agents treat each task from scratch, and give them a long-term memory built from commit history: retrieval over recent commits and linked issues, plus summaries of actively evolving code areas. This improves code localization on SWE-bench-Verified and SWE-bench-Live [11].

That work retrieves history as text for the agent to read. We push the same idea one step further: retrieve it as rows, filtered by intent, file and time, so that what reaches the agent’s context is the answer rather than the material to find it in.

How Chad applies it

Chad connects to GitHub and logs every event into ClickHouse. Git history is decomposed into rows of line additions and deletions, and each change is linked to the validated intent behind it, captured from Linear, Jira, Slack, Granola, Sentry, Prometheus or a direct human instruction.

From diffs to rows, from rows to related work

Each hunk becomes rows linked to the intent behind its commit. Then one query finds everything done for an intent, across files and commits. Illustrative data; timing is an example value.

INSERT INTO line_changes …
filelines+/−commitintent_id
 

Rows here summarize one hunk each for readability; the underlying table keeps one row per added or deleted line. Illustrative.

  • Intent at write time. Changes made by Chad’s Builder are attributed to the intent and atomic task that produced them, so the link does not depend on a commit message. Human commits are linked when an intent can be identified, and stay queryable without one.
  • Related work by query. When the Planner or Debugger picks up a task, the context compiler asks ClickHouse for every change linked to the same intent, the files that historically co-change with the targets, and the validated actions on those files. This returns in milliseconds and costs no LLM tokens.
  • Provenance for every loop. Each agent loop starts with a small (~6k-token) compiled context (see Paper 01). The related-changes section of that context comes straight from these rows (see Paper 04).
  • Validated only. An action is written to memory as an input → output pair only after a human or an AI verifier validates it. Rejected attempts never become “related work” for the next agent.

Limits & next steps

Intent links are only as good as the process that creates them. For work Chad performs, attribution is exact. For human commits and for history that predates Chad, linking is inference, with the same incompleteness and bias the mining literature documents [5][14]. We keep those links marked by origin and confidence, and never treat an inferred link as validated.

Line-level history also has known blind spots: renames, moved code, squashed merges and generated files all blur provenance, and ghost commits show that some causes leave no line to trace [8]. Intent-level links reduce, but do not remove, these gaps.

We have not yet published measurements of retrieval quality or latency on real repositories. When we do, they will appear here, with the queries and datasets used.

References

  1. Gall, H., Hajek, K., Jazayeri, M. Detection of Logical Coupling Based on Product Release History. ICSM, 1998.
  2. Zimmermann, T., Weißgerber, P., Diehl, S., Zeller, A. Mining Version Histories to Guide Software Changes. ICSE, 2004.
  3. Śliwerski, J., Zimmermann, T., Zeller, A. When Do Changes Induce Fixes?. MSR, 2005.
  4. Nagappan, N., Ball, T. Use of Relative Code Churn Measures to Predict System Defect Density. ICSE, 2005.
  5. Bird, C. et al. Fair and Balanced? Bias in Bug-Fix Datasets. ESEC/FSE, 2009.
  6. Bird, C., Nagappan, N., Murphy, B., Gall, H., Devanbu, P. Don't Touch My Code! Examining the Effects of Ownership on Software Quality. ESEC/FSE, 2011.
  7. Tian, Y., Zhang, Y., Stol, K.-J., Jiang, L., Liu, H. What Makes a Good Commit Message?. ICSE, 2022.
  8. Lyu, Y., Kang, H. J., Widyasari, R., Lawall, J., Lo, D. Evaluating SZZ Implementations: An Empirical Study on the Linux Kernel. IEEE TSE, 2024.
  9. Tang, L., Liu, J., Liu, Z., Yang, X., Bao, L. LLM4SZZ: Enhancing SZZ Algorithm with Context-Enhanced Assessment on Large Language Models. ISSTA, 2025.
  10. Lyu, Y. et al. AgentSZZ: Teaching the LLM Agent to Play Detective with Bug-Inducing Commits. arXiv:2604.02665, 2026.
  11. Wang, B. et al. Improving Code Localization with Repository Memory. ICLR, 2026.
  12. ClickHouse. Writing Queries in ClickHouse using GitHub Data (git-import example dataset). ClickHouse documentation, 2022.
  13. Schulze, R., Schreiber, T., Yatsishin, I., Dahimene, R., Milovidov, A. ClickHouse - Lightning Fast Analytics for Everyone. PVLDB 17(12), 2024.
  14. Bachmann, A., Bird, C., Rahman, F., Devanbu, P., Bernstein, A. The Missing Links: Bugs and Bug-fix Commits. FSE, 2010.