Provenance for agent-written code

Every line of agent code, explained.

git blame tells you an agent wrote it. Cerebral tells you why — the task, the prompt, the reasoning, the decisions.

lib/api/refresh.ts · TypeScriptClick a line
4b6d2af·Claude Code·2 days ago

Return null instead of throwing

Task
A rejected refresh should mean “sign in again”, not a 500 on every page.
Prompt
“The API went down for four minutes and the whole app went with it.”
Reasoning
First attempt threw a typed AuthError. Every one of the four call sites caught it and did the same thing — redirect to sign-in — so the type bought nothing and one missed catch was still a 500.
Decision
Swallow the failure and return null. One branch at each call site, and an unreachable API reads the same as a bad token.

Lines 18, 21–23 · refresh.ts · snapshot on main

services/ingest/embed.py · Pythongit blame
agent · 4 days ago37BATCH = 96
agent · 4 days ago38
agent · 4 days ago39
agent · 4 days ago40def embed_batch(
agent · 4 days ago41 texts: list[str],
agent · 4 days ago42 model: str = EMBED_MODEL,
agent · 4 days ago43) -> list[list[float]]:
agent · 4 days ago44 out: list[list[float]] = []
agent · 4 days ago45 for i in range(0, len(texts), BATCH):
agent · 4 days ago46 out.extend(embed(texts[i : i + BATCH], model))
agent · 4 days ago47 return out

The problem

That’s all blame gives you now.

Not what you asked for. Not what it tried first. Not why it landed here.

Three things

Blame that answers “why”

Click a line. See the task, the reasoning, and the decision behind it.

Replayable history

Every prompt, tool call, and diff — step by step, not just the end result.

Real git underneath

Snapshots are real commits in your repo. Nothing proprietary. Delete Cerebral, keep your history.

How it works

One hook, then it’s just git.

  1. Connect your repo.

  2. Your agent works. Cerebral records each step as a git snapshot.

  3. Open any file. Every line traces back to a decision.

Works with

Claude CodeCursor

Hooks only. No workflow change.

Also

  • Human and agent tasks in one place
  • Approval and QA gates mid-run
  • Local-first

Stop guessing why the code looks like this.

Get started