Documentation
Recall

How to find which AI agent session wrote a line of code

git blame names whoever committed a line. cast blame names the agent session that wrote it and opens the exact message; Git AI and Agent Blame solve it with git notes instead.

git blame tells you who committed a line. When an agent wrote it, that answer is the person who ran the agent, and the reasoning behind the line is gone: the conversation where it was decided, the alternatives that were rejected, the prompt that asked for it. This guide covers how to get that back, with codecast and with the two tools built specifically for it.

With codecast: cast blame

cast blame is a drop in replacement for git blame whose author column names the codecast session that wrote each line:

cast blame src/auth.ts             # every line, with sessions
cast blame src/auth.ts:42          # one line
cast blame -L 10,30 src/auth.ts    # a range
cast blame --open src/auth.ts:42   # open the conversation behind line 42

In place of an author name, a line shows the session's short id, the first name of the person who ran it, and the session's title, for example jx74qbm Samvit Agent prompt guardrails. --open goes further: when codecast knows the message that made the edit, it opens the conversation scrolled to that message; otherwise it opens the session.

It works in three steps. Git does the line history locally, exactly as git blame --porcelain would. Codecast then resolves each commit to the session that made it, by commit hash, or by commit subject and time when the hash no longer matches. Lines that are not committed yet are matched by their content against your recent agent edits. When both apply, the session that wrote the line wins over the session that committed it, and a line no session touched keeps its ordinary git author.

The output matches git blame's default and porcelain formats, so editor integrations that shell out to git blame can call cast blame instead. Porcelain output carries the attribution as extra codecast-session, codecast-title, codecast-url and codecast-message keys, which porcelain parsers ignore. For vim, cast blame --install-fugitive makes :Gblame show sessions, and cast blame --log src/auth.ts lists the sessions that shaped a file, newest first.

Nothing has to be installed in the repository and nothing runs at commit time. The attribution comes from sessions the codecast daemon already recorded, which is also its limit: it covers work done while the daemon was running, in agents codecast records (Claude Code, Codex, Cursor and Gemini), and reading it needs a codecast account with access to those sessions. A stranger who clones the repository sees plain git history.

With a dedicated attribution tool

Two open source tools solve the same question from the other direction, by writing attribution into the repository itself.

Git AI stores attribution in git notes, captured through hooks in the agents while they work, so it has to be installed before the code is written. It supports twelve agents, including Claude Code, Codex, Cursor, Copilot and Gemini CLI, rewrites its attributions through rebases, squashes and cherry picks, and keeps the prompts behind each line.

Agent Blame, from Mesa, also writes git notes: it captures edits from Cursor, Claude Code and OpenCode and matches them to new lines in a post commit hook. Each attributed line shows the tool, the model, and a confidence score; it does not record prompts.

Because both keep the record in git notes, the attribution travels with the code and anyone with a clone can read it, with no service involved.

Choosing

Choose Git AI or Agent Blame when the attribution has to live in the repository: readable by anyone who clones it, auditable without an account, and you can install hooks before the work starts. Choose cast blame when you want the whole conversation behind a line rather than a label, when the code was written before anyone installed anything, or when your team already records its sessions in codecast. They do not conflict: git notes written by either tool sit alongside git history that cast blame reads.

More guides
How agent snippets work
cast install writes versioned instruction sections into your agents' own config files. This is the mechanism every other guide builds on.
Give Claude Code memory across sessions and teammates
Not notes files: every session can search, read, and watch every other session your team has run. The commands, the scopes, and how agents use them.
Messaging between sessions
cast send turns sessions into teammates: any session can message any other, including a teammate's, and manage what the human sees in the inbox.
Ambient awareness
Stable mode injects a live feed of recent sessions into every new session at start. Combined with messaging, sessions know about each other without being told.
See your whole team's Claude Code sessions in one place
Claude Code already writes every session to disk. The codecast daemon syncs those files — plus Codex, Cursor, and Gemini — into one live team feed, inbox, and searchable record.
How to share a Claude Code session with your team
Three different asks hide behind that sentence: read a finished conversation, watch a running one, or make every session visible by default. What Anthropic ships, what Lore does, and where codecast fits.
Pinned thread state
cast state keeps one agent-written line saying where a thread stands, pinned above the composer and on the inbox card, with its staleness on show.
Forks and spawned sessions
cast spawn --subagent delegates a worker that nests under the session that launched it; plain cast spawn and cast fork start independent threads in the human's inbox.
Tasks and plans
The work tracking layer agents report into: tasks, plans, binding, comments, and the dashboard that watches it all.
Triggers
Follow-up work that runs after the session ends: delayed, recurring, or fired by a GitHub event.
Workflows
Execution graphs in DOT syntax: agent steps, shell commands, conditions, and human approval gates.
Orchestration
A conductor agent decomposes a plan, spawns implementers in isolated worktrees, and runs reviewers and critics over the result.
The visual canvas
Agents reply with sandboxed HTML that renders inline: charts, dashboards, diagrams, and small widgets instead of ASCII art.
Published pages
cast publish turns a file into a page at a stable URL, with version history, access gates, and viewer comments that flow back to the session.