An incident timeline rebuilt from your git history with Claude
The struggle: After an outage nobody can say which change started it, and the timeline lives in scattered alerts, chat logs and memory.
What you end up with: A sourced timeline of the code and deploy side of an incident, plus a blameless draft the team corrects.
Claude Code reads your repository history in plan mode, so every timeline line points at a real commit, not a memory. You then paste the result into a blameless postmortem format the responders verify.
Tools: Claude. Level: Pro. Time: 1 hour per incident.
Use it if
- The fix is live and you can name the time window of the incident
- Your deploys map to commits in one repository
- You want the code side of the story backed by evidence
Skip it if
- The cause was a vendor outage or infrastructure with no code change
- You only need a chat-based draft from alerts and notes (see the ChatGPT post-mortem Project)
What you need first
- Claude Pro or higher (Claude Code is included from Pro)
- Claude Code installed, and a clone of the repo
- Your postmortem template, or any past postmortem
The method
Start read-only in the repo (Claude: Claude Code)
Open a terminal in a fresh clone of the repo and run claude --permission-mode plan, or press Shift+Tab until the status bar shows plan mode on. Claude reads files and proposes a plan but makes no edits.
Prompt to copy:
Stay in read-only mode for this whole session. First tell me which branch and commit this clone is on, and how far back the history goes. Make no edits and run only read-only commands.
You get: A session that can look but not change anything.
Tip: Use a clone with no .env files or production credentials in it.
Find the changes near the incident (Claude: Claude Code)
Give Claude the incident window and the symptom, and ask it to read the git history, not guess.
Prompt to copy:
Incident window: [start and end time with timezone]. Symptom: [what users saw]. Read the git history for that window and the 24 hours before it. List each commit that touches [affected service or path] with hash, a summary that names no author, and why it could relate. Say what you could not determine. Do not guess a root cause yet.
You get: A list of commits and deploys in the window, each with a one-line reason it could matter.
Tip: Ask for the commit hash on every line, so you can open it yourself.
Trace the likely path (Claude: Claude Code)
Ask Claude to follow the code path from the symptom to the suspect commits, and to say what evidence would confirm each theory.
Prompt to copy:
For the commits you listed, trace the code path from [symptom or error] back to the change. Give up to 3 theories ranked by likelihood. For each: file and line, and the log line or metric that would confirm or kill it. Separate what the repo shows from what needs production data.
You get: Two or three ranked theories with the file and line behind each and the log or metric that would confirm it.
Tip: A theory without a check you can run is a guess. Drop it or mark it unconfirmed.
Keep your postmortem format in a Project (Claude: Projects)
In Claude on the web, click + New Project, add your postmortem template as project knowledge, and in Set project instructions write the blameless rules: systems and processes are causes, never named people.
Prompt to copy:
Paste these into Set project instructions: You help write blameless postmortems in the format of the attached template. Causes are systems, processes and missing safeguards, never named people. Cite a source for every timeline row. Mark anything not supplied as UNVERIFIED. If information is missing, ask before assuming.
You get: A Project that applies your format every time.
Tip: Add last quarter's best postmortem as a model of tone and length.
Draft the postmortem from verified facts (Claude: Chat)
In a chat inside the Project, paste the commit list and theories (no secrets, no customer data) plus your own alert and chat times. Ask for the draft in your format.
Prompt to copy:
Using our postmortem format, draft from the material below. Build a timeline table where each row cites its source (commit, alert, or responder note). Describe contributing factors as system or process gaps, never people. Propose actions with a suggested owner role, not a name. Mark any claim I did not supply as UNVERIFIED. Material: [paste]
You get: A blameless draft with a timeline table, contributing factors and proposed actions marked as proposals.
Tip: Ask for a line marking every claim that came from you rather than from the repo.
Responders verify, then you circulate (Claude: Chat)
Share the draft with the people who were on call. Each checks the timeline against alert and deploy logs and fixes it. Only then do you send it yourself.
You get: A reviewed postmortem the responders agree is true.
Tip: Ask one person who was not involved to read it cold and say what is unclear.
Where this goes wrong
- Claude reads commits, not production. It cannot see traffic, config changes outside the repo or manual fixes, so the timeline is incomplete by design.
- A commit near the incident is not proof of cause. Keep theories marked unconfirmed until logs agree.
- Strip secrets, tokens and customer data from anything you paste. The responders verify every timestamp before the draft is shared.
- A commit time is not a deploy time, so take deploy times from your deploy logs. Plan mode makes no edits, but read each shell command before you approve it.
Sources
- Claude Code docs: Common workflows (plan mode, git, piping)
- Claude Code overview
- Claude Help Center: Projects
- Claude pricing (Claude Code from Pro)
More like this
- Agent pull requests checked before a human merges
- A tracking plan that cleans up your event names
- A dashboard from a pasted export
Updated . Written with AI help and checked by an independent review step, as described in our editorial standards.