agent-thread
Self-hosted · open source

Every commit remembers why.

Trace any change back to the agent session that wrote it, and read the reasoning.

Added by a git hook at commit time. No network call and nothing extra to do.

The story

A reason that only lived in the chat.

The reason behind agent-written code is often said once, in a chat, and never written down. Here is one line of code, followed over six months and two different agents.

Maya with Claude Code · Tue, Mar 4 · 14:02

Maya explains a constraint the code can't.

Calls to the currency provider keep failing, so Maya asks for retries. She also explains why the retries must work a certain way: the provider blocks clients that retry at random intervals.

Claude writes nine lines of Go. None of them say why the delay is fixed. Neither does the commit message.

claude codepayments-apimain
Maya
fetchRates fails whenever the FX provider blips. Add retries: max 3 attempts, fixed 2s apart. No jitter. They block clients that send jittered bursts; we were locked out for a day in January.
Claude opus
Got it: 3 attempts, a fixed 2 s pause, no jitter. I'll wrap the call in internal/rates/rates.go.
Editinternal/rates/rates.go+9−2
Bashgo test ./internal/rates
Bashgit commit -m "Add retries to fetchRates"
git · 14:09

The commit carries a link back to the conversation.

A git hook sees which agent session is making the commit. It adds an Agent-Thread line to the commit message that points to that session, at the exact moment of the commit.

Then the conversation uploads to your server in the background. Secrets are removed on Maya's machine before anything leaves it. The pull request looks the same as always, with one extra line on the commit.

If agent-thread fails, the commit still goes through.
claude · bash
$ git commit -m "Add retries to fetchRates"
[main 3f9c2e1] Add retries to fetchRates
 1 file changed, 9 insertions(+), 2 deletions(-)
agent-thread: linked to session 7f3c2a10 at a91b04c2
agent-thread: syncing in background (14 KB)

$ git log -1 --format=%B
Add retries to fetchRates

Agent-Thread: https://threads.example.com/acme/s/7f3c2a10?at=a91b04c2
Pull request
Add retries to fetchRates #212
Mergedmaya merged 1 commit into main
Add retries to fetchRatesthread3f9c2e1
Sam with Codex · Thu, Sep 17 · 10:31

A new agent wants to "fix" it.

Sam is making the payments service more reliable and notices the retries. By the usual best practices, three retries at a fixed delay look too simple.

This is where the original reason gets lost, unless the agent can still read it.

codexpayments-apiharden-rates
Sam
The retries in rates.go look too conservative and have no jitter. Make them more resilient.
Codex
Before I change it, I'll check why it was written this way.
Shellagent-thread why internal/rates/rates.go:42
agent-thread why · 10:31

From the line of code to the conversation.

why finds the commit that last changed the line, follows its link to the session, and prints the part of the conversation that led to it. The output is short enough for an agent to read.

Codex reads Maya's original words and keeps the constraint. It still makes the code more reliable, and tells Sam why it left the delay alone.

codex · shell
$ agent-thread why internal/rates/rates.go:42
42 │         time.Sleep(2 * time.Second)

## 3f9c2e1 Add retries to fetchRates  maya · Mar 4
Session 7f3c2a10 · claude · checkpoint a91b04c2

User: fetchRates fails whenever the FX provider blips.
Add retries: max 3 attempts, fixed 2s apart. No jitter.
They block clients that send jittered bursts; we were
locked out for a day in January.

Assistant: Got it: 3 attempts, a fixed 2 s pause, no jitter.
  Edit internal/rates/rates.go (+9 −2)
Codex
I kept the fixed 2 s backoff and the 3-attempt cap. The session behind 3f9c2e1 says the FX provider blocks jittered bursts. I added a timeout for each attempt and a log line on each retry instead. If the provider has changed its policy, tell me and I'll add jitter.
Without the thread
The agent adds random delays. The tests pass. On Friday the provider blocks the account again.
With the thread
The constraint stays, and Sam knows who to ask if it should change.
Sam, in the browser · 10:40

People can open the same thread.

The Agent-Thread line is a link. It opens the session on your server at the moment of the commit, and fades out everything after it. Subagents and forks appear as nested threads.

Viewing at 3f9c2e1 "Add retries to fetchRates" · 1 of 1
MayafetchRates fails whenever the FX provider blips…
ClaudeGot it: 3 attempts, a fixed 2 s pause, no jitter.
Edit internal/rates/rates.go +9 −2 · Bash ×2
commit 3f9c2e1 "Add retries to fetchRates"
MayaThanks. Can you also add a metric for…
4 more events after this commit
Works with your agents

Works the same, whichever agent made the commit.

Most agents already tell their shell which session is running, so their commits are linked with no setup. An optional plugin or hook uploads sessions in the background and teaches the agent to look up history.

  • Claude Code
  • Codex
  • Cursor CLI
  • opencode
  • Amp
  • pi
  • T3 Code
  • Zed
T3 CodeZed
Launched from an app? The session belongs to the agent inside the app. agent-thread also records which app started it.

Subagents and forks

Subagent threads appear under the session that started them. A subagent's commit points to the step that started it.

Rebases and amends

Links move to the new commits after a rebase or amend. Old commit IDs still work.

show, why, log

Short, readable output for agents. A web viewer with search for people.

Self-host

Your conversations stay on your server.

One Go binary, Postgres, and any S3-compatible store. Sign in with Google, GitHub or your own OIDC provider.

1

Start the server

The bundled compose stack runs the server, Postgres and MinIO.

docker compose -f deploy/docker-compose.yml up -d --build
2

Install the CLI

Log in once per machine, with the browser or a token.

go install github.com/amalshaji/agent-thread/cmd/agent-thread@latest
agent-thread login --server <url>
3

Turn it on for a repo

Commit an .agent-thread.toml file, then install the git hooks.

agent-thread init
agent-thread doctor   # check it
≤25 ms

added to your own commits. When no agent is running, agent-thread does not even start.

0 network

calls while you commit. Uploads run in the background and wait when you are offline.

Redacted

on your machine before upload: keys, tokens, JWTs, .env secrets and your own patterns.

Members only

Only members of your organization can see sessions. There are no public links.