Docs & Diagrams

Diagrams & Arch. Decision Records

07 / 12

Use agents to capture decisions while the context is still fresh.

The Shift

Documentation was often the first thing to go. ADRs, sequence diagrams, and the "why" behind a hard decision were valuable, but they took time. So the knowledge stayed in your head and left when you moved on.

Agents reduce that cost. They can read a repo, draft an ADR, and turn a design into a Mermaid or C4 diagram quickly. Work that used to feel hard to justify can now fit inside the normal PR flow.

Your job is to decide what is worth recording and keep it honest. Capture decisions while the context is fresh. Generate the diagram, then verify it matches the code. Future teammates and future agents will use what you leave behind.

docs/adr/0012-async-payment.md

Architecture Decision Record - 012

Accepted

2026-06-30 · supersedes ADR-009

Context

Checkout must not block on Stripe; the call is slow and can time out.

Decision

Create a pending order, return the client_secret, then confirm from the payment_intent.succeeded webhook.

Alternatives

Sync charge + poll — rejected: holds the request open, doubles latency.

Consequences

pending → paid state machine; webhook must be idempotent + signed.

diagrams/checkout.sequence.mmd

verified vs code

  • Client
  • Orders API
  • Stripe
  1. POST /checkout
  2. create order · pending
  3. create PaymentIntent
  4. client_secret
  5. 200 · client_secret
  6. confirmPayment + 3DS
  7. async · webhook = source of truth
  8. payment_intent.succeeded
  9. mark order paid ✓
  10. email receipt

same feature, two views · the ADR is the why, the sequence is the behavior

Docs & Diagrams diagram

Page 32 of 72: Docs & Diagrams

Contents