Autopsy: an AI wrote your postmortem. Is it true?

Video demo: https://www.youtube.com/watch?v=hRQv5_hwKKU
Live site: https://autopsy-postmortem.pages.dev
Source: https://github.com/manulpatel/autopsy

Why I made this

I'm learning Rust and observability, and I wanted a project that forced me to understand both. I picked the thing that annoys every backend engineer: the postmortem. Honestly wasm sounded a little cooler to explore, I added that too. 😉

When a chain of microservices fails, the evidence is scattered. Traces are in one tool, deploys in another, flag flips in a third. A week later most of it is gone, and the postmortem gets written from memory. Sharing the evidence with someone usually means giving them access to production.

Then AI makes it stranger. An assistant can write a smooth, confident postmortem in ten seconds, and nobody can tell which sentences are true.

So the idea is simple. Record the incident into one small file. Let an AI write the postmortem. Then have a program check every claim against the recording, in your browser, with no server.

The whole pipeline

services --OTLP/HTTP--> autopsy-recorder (Rust) receiver -> bounded queue -> aggregator flag watcher, deploys from service.version, POST /changes | v incident.autopsy (small, versioned, validated) | autopsy-core (pure Rust) --+-- the same code, compiled to WebAssembly analyze: baseline, detection, fault sites, ranking claims: check each AI claim against the file | command line MCP server (the AI) static web viewer 

Four parts, one idea: the file is the evidence, and the engine that reads it is the same everywhere.

1. Recording without drowning

The recorder is a Rust binary. It listens for OpenTelemetry traces (OTLP over HTTP) and for change events: a feature flag flipped, a service deployed.

The first design decision was what not to keep. Autopsy stores aggregates, not spans. For every service and every call between two services, in 10-second buckets, it keeps the request count, the error count and a latency histogram. It also keeps up to three example trace IDs of failures. That's enough to answer "what broke, when, and how badly", and the file does not grow with traffic. The 8-service sample is 40 KB; the real recording of the 17-service demo is 91 KB.

The receiver has one rule I'm proud of: it never grows without limit. Incoming batches go through a bounded queue of 32. When the queue is full the receiver answers 503 with Retry-After: 1 and drops that batch, so the sender backs off and memory stays flat. Compressed bodies are capped at 4 MiB, and decompression stops at 8 MiB instead of inflating a gzip bomb first. Every map has a cap: 64 services, 256 call edges, 200,000 remembered spans, 1,000 changes. Under a synthetic flood of about 20,700 spans a second, the recorder refused nothing and used at most 50 MiB (measured once; the flood generator gave out first).

Deploys are found without anyone typing them in. When a service's spans start carrying a new service.version, the recorder adds a deploy change at the moment the first span of that version ended. Flag flips come from a watcher that reads the flag file every second and links each flip to the one it undoes.

2. Finding the cause, with rules you can check

I did not use machine learning for the ranking, on purpose. If the ranking can't be checked by hand, the AI can't be checked against it.

The engine works in four steps:

  1. Baseline. The first part of a recording is a service's own normal. A service is anomalous when its error rate, median latency, tail latency or traffic leaves that range and stays out long enough.
  2. Fault sites. A fault site is a service that broke on its own: it is anomalous and none of the services it calls broke too. This is what separates the cause from the cascade. If checkout fails because payment fails, payment is the fault site and checkout is a victim.
  3. Suspects. For each fault site, the suspects are the changes on that service before it broke, scored by how close they were in time (half the score at 60 seconds). Each one comes with numbers: when the problem started, when the change happened, the error rate before and after, and example trace IDs.
  4. Revert evidence. If a change was later undone, the engine asks whether the error rate went back down. A fix that did nothing shows up as a fix that did nothing.

Every output is sorted and nothing depends on hash-map order, so the same file gives the same report on every machine. That is what makes a claim check mean something. The result is a ranked hypothesis with evidence, not proof of causation. "Exclude this change" re-ranks the suspects. It does not simulate a world without the change, and the viewer says so.

I looked at fancier ideas (PageRank on the call graph, learning a causal graph, letting an LLM rank the suspects) and left them out. PageRank finds important services, not services that broke first. Causal discovery needs far more data than one incident. An LLM ranking can't be checked. The reasons are written in docs/ARCHITECTURE.md.

3. The AI writes claims, the engine checks them

The AI connects through an MCP server (autopsy-recorder mcp --bundle FILE). Its tools are read-only views of the engine's report: incident summary, inspect a service, list changes, check a postmortem. It also gets a write_postmortem prompt that walks it through investigating, writing, checking and fixing.

The AI doesn't write free text. It writes structured claims: a service, a metric, before and after values, a change id. Claim kinds include fault_site, top_change, error_rate, site_cause, step_rise and recovered_after_revert.

The engine checks every claim against the file and returns one of three verdicts:

  • supported: the numbers in the recording match.
  • contradicted: the recording says something else, and the viewer shows the real numbers.
  • unverifiable: the file can't answer it.

A second field checks the sentence itself. A claim can be supported and still carry a wording mismatch, for example "errors reached 12%" next to a measured 31%. The verdict never depends on the sentence. The AI also never decides the ranking, and its text is never evidence by itself.

The postmortem is written once, on my machine, and stored inside the .autopsy file. The public site only re-checks it. No API key, no server.

The real payment-failure sample (the one in the video) shows it working. It is a recording of the OpenTelemetry Demo, 17 services over about 10 minutes, in a 91 KB file. The engine answers first: payment broke at 17:10:30 UTC; the top suspect is the flag paymentFailure: off -> 50%, switched on 9 seconds before; checkout was only a victim; and when the flag was undone, payment recovered.

The sample ships with three postmortems:

  • A draft written from memory, the way people really write them. The checker returns 3 contradicted, 1 unverifiable and 1 supported. The draft says payment failed about 50% of the time, because the flag said 50%. The recording says 22.4%, over 424 requests. The draft also names checkout as where it started; the engine points to payment.
  • Kiro's own postmortem, written through the MCP tools: 10 of 10 claims supported, nothing contradicted.
  • The draft corrected by Kiro, after reading the checker's numbers: 5 of 5 supported.

The 50% against 22.4% is my favourite moment in the project. A human (or an AI) reads the flag and assumes the effect. The recording measures it.

4. The viewer: same engine, in your browser

The engine is compiled to WebAssembly, so the viewer is a static site (about 2 MB) that works with the network off once loaded. Nothing is sent anywhere. The viewer shows:

  • the incident as a spectrogram of every service over time
  • the claim score beside each verdict, with the real numbers
  • the suspect changes, ranked
  • a service map with an error-rate chart and a time slider
  • the numbers for each service
  • Copy as Markdown and Download .md, which turn the incident into a postmortem document with a summary, impact, timeline, claims and limits. Names and AI sentences are escaped, so a hostile file can't inject links or HTML.

Because the file is the only input, you can send someone an incident and they can open it and verify it. They need no access to production.

Testing it for real

Fake incidents are easy to get right. So besides a generator with known causes and decoys (and property tests for the invariants), I ran it on the OpenTelemetry Demo, an online shop of about 20 services, through one extra Collector exporter. I wrote 28 failure scenarios, with the expected answer for each written before any run: single faults, faults in stages, a flapping fault, overlapping faults, decoy changes, a wrong fix, a traffic surge, a silent Kafka consumer, a privacy check and two known blind spots. A runner script resets the flags, records, flips flags at fixed seconds, analyses and compares with the answer. Recordings with a gap in traffic or a flag flipped late are marked invalid and not scored.

What worked: the base case and its variants (payment failing, in stages, flapping, behind a decoy change, during a surge, with a wrong fix in between) get the right fault site, top suspect and revert evidence. Flag flips were recorded on their own with the right undo links. With raw card numbers written into spans, none reached a file.

What didn't: on the final batch at 400 users (22 valid recordings of 28), the engine found 20 of 27 real fault sites and reported 38 false ones. Most false ones are small latency shifts in busy services. Partial faults under 5 points are missed. A shipping service answering some requests 5 seconds late was missed in the earlier batches, because the tail rule is deliberately the slowest to react; it was found in the rerun. And the healthy control is not clean: at 400 users, with nothing changed, it reported four latency fault sites, because the shop's own traffic kept moving during the recording.

I tuned the partial-fault rule on the 100-user recordings and scored it once on an earlier 400-user batch: real sites found went from 14 to 21 of 31, with false ones flat (54 to 53). I had seen that batch's pass counts before, but never used it to tune. Everything, misses included, is in docs/EVALUATION.md.

Bugs the real system found

  • A service that looked broken but wasn't. In one recording, quote was reported as the first service to break, 3.5 minutes before the real payment fault. Its own log showed it kept answering every request. Its spans had simply stopped reaching the recorder. From traces alone, "the service went quiet" and "its telemetry went quiet" look the same. The fix was to also record the callers' view: client spans, counted per caller and callee. I then pointed product-catalog's telemetry at a dead address while it kept serving. Its own spans fell to zero, its callers still saw about 784 calls per 10 seconds, and the engine reported "telemetry dropout" and no incident.
  • Missing Kafka edges. No edge existed from checkout to its Kafka consumers. The consumers' spans have a local parent, and the recorder used it instead of the link to the producer. After the fix, a 2-minute live recording showed 294 and 298 such calls.

Known blind spots

It reads traces only. Memory leaks and queue lag are mostly metric signals, so it sees them weakly. A slow image provider that emits no spans is invisible. Metrics ingestion is not built. I'd rather list this than have you find it.

Built with Kiro

I built all of this in Kiro, and the 4000 credits were a major help. A project like this is many long sessions of requirements, design, code, tests, fixes and explanations until I understood each part. With the credits I could use Kiro on the real work for weeks instead of rationing it. Four things in the .kiro folder did the most:

  • Specs (.kiro/specs): 16 of them, each with requirements and design. The receiver spec set the bounded queue and the 503 rule before any code existed, and I had to understand it to approve it. The misses in the evaluation became specs 10, 12 and 13.
  • Steering (.kiro/steering): product.md says what Autopsy is not, tech.md holds the hard rules (a pure core, no unwrap outside tests, bounded channels, sorted output), rust-conventions.md and visual-design.md keep style steady. I wrote a rule once and every session followed it.
  • Hooks (.kiro/hooks): saving a Rust file runs the tests, and saving a file in the core runs the WebAssembly build check, so an accidental network or file dependency fails at once.
  • MCP and a reviewer agent: mcp.json lets Kiro investigate through the engine, and rust-reviewer is a read-only agent that reviews my diff and explains borrow-checker errors in plain words.

Try it

cargo test --workspace --all-features cargo run -p autopsy-recorder -- analyze web/public/samples/shop-outage.autopsy \ --postmortem web/public/samples/shop-outage.tampered.json 

Or open the live site and load a sample. The tampered sample shows contradicted claims next to the real numbers.