Part 15 / Stage 4
Communication and documentation
Goal: Most engagement problems are communication problems. Build the written artifacts that prevent them: status updates that lead with the bad news, decision logs, design docs, runbooks, and a handoff that actually hands off. Time: ~2.5 hours · Needs: Python 3.14+, the course venv
What you will learn
- Weekly status updates: red/amber/green, worst first, explicit asks
- Decision logs: what was decided, why, and what was rejected
- Design documents: context, options, decision, trade-offs
- Writing for executives: the answer first
- Runbooks someone else can follow at 3 a.m.
- Handoff: leaving the customer able to run it without you
- Difficult conversations
Topics in this part
Practice
Work in the course venv. Check each answer by running it; compare with solutions/ only after trying.
Exercise 1: Status from run data
Generate the weekly update from machine data: given each workstream's metrics (p95_ms, adoption, blocked), write derive_status(w) that computes red/amber/green mechanically (blocked -> red; p95 > 2000 or adoption < 0.5 -> amber; else green), then print the sorted update.
Show the solution to Exercise 1
# Exercise 1: status derived from metrics, not vibes
workstreams = [
{"name": "Acme API integration", "p95_ms": 300, "adoption": 1.0, "blocked": False,
"done": "Pagination and retries shipped", "next": "Load full history"},
{"name": "Dispatch dashboard", "p95_ms": 2100, "adoption": 0.33, "blocked": False,
"done": "Used by 4 of 12 dispatchers", "next": "Fix slow search"},
{"name": "Email auto-replies", "p95_ms": 900, "adoption": 0.0, "blocked": True,
"done": "Prototype at 42%", "next": "Legal sign-off"},
]
def derive_status(w):
if w["blocked"]:
return "red"
if w["p95_ms"] > 2000 or w["adoption"] < 0.5:
return "amber"
return "green"
order = {"red": 0, "amber": 1, "green": 2}
for w in workstreams:
w["status"] = derive_status(w)
print("Overall:", min((w["status"] for w in workstreams), key=order.get).upper())
for w in sorted(workstreams, key=lambda w: order[w["status"]]):
print(f"- [{w['status'].upper()}] {w['name']}: {w['done']}. Next: {w['next']}.")
print("Asks: Priya to chase legal sign-off this week.")
Exercise 2: Query the decision log
Load the two lesson decisions plus one of your own into a list. Write why(decision_log, keyword) that answers "why do we…?" questions by matching decision/why/rejected text. Show it answering "why not database replication?".
Show the solution to Exercise 2
# Exercise 2: the decision log answers "why" questions
DECISIONS = [
{"id": "D-001", "decision": "Sync via Acme's API every 15 minutes, not database replication",
"why": "IT will not open database access; API is supported",
"rejected": ["Nightly CSV export (too stale)", "Direct DB replica (not allowed)"]},
{"id": "D-002", "decision": "Run the AI model inside Acme's cloud region",
"why": "Data residency requirement from discovery",
"rejected": ["Vendor-hosted endpoint in another region"]},
{"id": "D-003", "decision": "Quarantine ambiguous dates instead of guessing the format",
"why": "A wrong guess creates silent bad data; Acme confirms the convention",
"rejected": ["Assume month-first (US default)"]},
]
def why(log, keyword):
hits = [d for d in log if keyword.lower() in (d["decision"] + d["why"] + " ".join(d["rejected"])).lower()]
return hits
for d in why(DECISIONS, "database replication"):
print(f"{d['id']}: {d['decision']}")
print(f" why: {d['why']}")
print(f" rejected: {d['rejected']}")
Exercise 3: The inverted pyramid
Take this buried-lede update and rewrite it (as a printed string) answer-first: "We completed the retry logic this week. The dashboard search was profiled. Legal has still not signed off, which blocks the email workstream and likely the pilot date. We also fixed two bugs." Print before and after.
Show the solution to Exercise 3
# Exercise 3: answer first, detail last
before = ("We completed the retry logic this week. The dashboard search was profiled. "
"Legal has still not signed off, which blocks the email workstream and likely "
"the pilot date. We also fixed two bugs.")
after = ("PILOT DATE AT RISK: legal sign-off is still pending, blocking the email workstream. "
"Ask: Priya to escalate this week. "
"Also this week: retry logic completed, dashboard search profiled, two bugs fixed.")
print("BEFORE (lede buried):\n " + before)
print("\nAFTER (answer first):\n " + after)
Exercise 4: Runbook as data
Model the "sync loaded 0 rows" runbook entry as a dict (symptom, checks, fixes, escalate) and write render_runbook(entries) that prints it in the 3 a.m. format. Add a second entry for "API returns 401".
Show the solution to Exercise 4
# Exercise 4: runbooks as data render consistently
RUNBOOK = [
{"symptom": "Sync loaded 0 rows (alert: freshness > 24h)",
"checks": ["cat /var/log/acme-sync/last_run.json -> expect extracted > 0",
"curl -sS -H \"Authorization: Bearer $TOKEN\" https://api.acme.internal/v1/shipments?page=1"],
"fixes": ["401 -> token rotated: fetch new token from the vault",
"429/5xx -> Acme-side: wait 30 min, then: acme-sync --since yesterday"],
"escalate": "Meena (IT), then vendor support"},
{"symptom": "API returns 401 on every request",
"checks": ["echo $ACME_API_TOKEN | head -c 8 -> matches the vault entry?",
"curl with the vault token directly"],
"fixes": ["Rotate: pull the current token from the vault and restart the service"],
"escalate": "Meena (IT) - token owner"},
]
def render_runbook(entries):
for e in entries:
print(f"## {e['symptom']}")
for i, c in enumerate(e["checks"], 1):
print(f" {i}. check: {c}")
for f in e["fixes"]:
print(f" fix: {f}")
print(f" escalate: {e['escalate']}\n")
render_runbook(RUNBOOK)
Mini-project: The Acme communication set
One script that prints: the weekly status update (derived, sorted, with asks), three decision-log entries (D-001, D-002, and your D-003), and a one-page design doc for the sync (context, two options with trade-offs, decision, consequences).
A solution is in solutions/mini_acme_communication_set.py.
Stretch: write the handoff checklist and run a 30-minute walkthrough with someone playing the customer team.
Sync loaded 0 rows (alert: freshness > 24h)
- Check the run report: cat /var/log/acme-sync/last_run.json -> expect "extracted" > 0
- Test the API: curl -sS -H "Authorization: Bearer $TOKEN" https://api.acme.internal/v1/shipments?page=1
- 401 -> token rotated: fetch the new one from the vault (see access list)
- 429/5xx -> Acme-side: safe to wait; re-run after 30 min: acme-sync --since yesterday
- Still failing -> escalate: Meena (IT, old system), then vendor support.
Test a runbook the only way that works: someone who did not write it follows it, literally, while you watch and say nothing. Every place they stop is a bug in the document.
🧪 **Quick quiz**
1. Who is a runbook written for?
<details><summary>Show the answer</summary>
Whoever operates the system next, often at 3 a.m. without you. Write steps someone else can follow: symptoms, checks, fixes and who to escalate to.
</details>
## Common mistakes
| Mistake | Why it hurts | Fix |
|---|---|---|
| Leading with the green items | The red one lands as a surprise later | Worst first; overall = worst workstream |
| Updates with adjectives | "Good progress" is unverifiable | Facts and numbers per line |
| Decisions without the rejected options | Month-four relitigation | Five fields, same day |
| Design docs after building | The review can change nothing | One page, before; options with trade-offs |
| Runbooks written for yourself | Useless to its actual 3 a.m. reader | Someone else tests it, literally |
| "Handoff" = sending a zip of docs | They still cannot operate it | Their engineer drives the walkthrough |
| Sitting on bad news | Trust compounds in reverse | Early + factual + plan |
## Quick recap
- A status update puts red items first, sets the overall colour to the worst item, reports facts rather than adjectives, and attaches a name and a date to every ask.
- The decision log records the decision, the why, the options rejected, the owner and the date — written the same day.
- A design doc is one page of options with trade-offs, written before the build.
- For executives, give the answer first, make the ask visible, and keep the detail for last.
- A runbook walks from symptom to checks to fixes to escalation, and a stranger has tested it.
- Handoff covers how to run, change and support the system, proven in a walkthrough the customer's team drives.
- Deliver bad news early and with a plan, meet pushback with questions, and say no with options.
## Checklist
- [ ] I generated the status update and can say why RED leads and overall is RED.
- [ ] I wrote a D-003 for a decision in my own pipeline, five fields.
- [ ] I drafted a one-page design doc with two real options.
- [ ] I wrote a runbook entry and had someone follow it cold.
- [ ] I rehearsed the bad-news shape: impact, options, recommendation.
**Read more:** [Architecture decision records](https://adr.github.io/)