Module 02 · Lesson 2.3
Recovering Design Decisions
On this page
- What you will learn
- Why version history shows changes, not reasons
- Where reasons hide: five sources to check
- Worked scenario: three decisions at Tidewell
- Step-by-step workflow
- Asking people about old decisions
- Using an AI assistant to read the clues
- Conclusion and your next step
- Reusable prompt
- Expected output
- Common errors and fixes
- Validation checklist
- Hands-on exercise
- Knowledge check
- Frequently asked questions
- References
Picture a bridge with an odd bend in the middle. Nobody on the team knows why. You could straighten it, and then discover a buried pipe underneath. Code has bends like this. A decision was made, for a reason, and the reason was never written down.
In this lesson you will recover reasons the way a detective does. You will search history, read tests and tickets, and ask people good questions. You will also learn to rate each reason as Known, Inferred or Unknown, so a guess is never mistaken for a fact. An AI assistant can help you read the clues. It cannot remember what the team meant.
The example continues with Tidewell Wholesale and tidewell-orders, after the diagrams from Diagramming What the Code Does. The company, people and data are invented.
What you will learn
- Explain why version history shows what changed but not why.
- Use
git log -Sandgit blameto find the commit behind a line of code, and read it with care. - Combine commit messages, tickets, tests and conversations into a reason you can defend.
- Rate every recovered reason as Known, Inferred or Unknown, and treat an assistant's story as a hypothesis.
Before you start
- You finished Diagramming What the Code Does, or you have a component diagram with questions about why things are built that way.
- A repository with real history, and Git on your machine.
- Permission to share any commit text you give an assistant. See Sharing Code with an AI Assistant Safely.
Why version history shows changes, not reasons
Version control keeps a record of every change. It tells you what changed, when, and who saved it. It does not tell you what the person was thinking. A reason may sit in a commit message, or in a ticket, or only in someone's head.
- Design decision
- A choice that shaped the system, such as 'we use a queue for emails'. Someone chose it over other options for a reason. The reason is the part that gets lost.
- Pickaxe search (`git log -S`)
- A search through history for the commits that added or removed a piece of text. It is like a metal detector you sweep over years of changes. It beeps where the word first appeared or disappeared.
- Blame (`git blame`)
- A view of a file that shows, for each line, the last commit that changed it. It is like looking at who last signed each line of a shared notebook. Despite the name, it is not about fault. It finds the commit, which leads you to the reason.
- Evidence
- Something you can point to: a commit message, a ticket, a test, a comment, or a person's statement. A feeling that 'it was probably for speed' is not evidence.
- Confidence
- How sure you are that a reason is right. This course uses three levels: Known, Inferred and Unknown. The next lesson defines them.
A good habit is to keep two ideas apart. What happened comes from the history. Why it happened needs more. A commit that adds a line proves the line was added. It does not prove the reason you imagine.
Where reasons hide: five sources to check
Check the sources in this order. Written records are stronger than memories. Close-in-time records are stronger than later ones.
| Source | What it can tell you | How far to trust it |
|---|---|---|
| Commit messages | The author's own words about a change, sometimes with a ticket number | High when they explain why. Low when they say only 'fix' or 'update'. |
| Tickets and incident reports | The problem that triggered the change, as customers or support saw it | High for the problem. The chosen solution may have been decided elsewhere. |
| Tests | Behaviour someone thought important enough to protect | Medium. A test shows what is expected. It does not say why. |
| Code comments and docs | Intent at the time of writing | Medium. They can be out of date. |
| People | Context, history, the options that were rejected | Medium to high for recent events. Memory fades, so write down what you hear. |
Worked scenario: three decisions at Tidewell
Your diagram shows three things that look like choices. Confirmation emails go out after the order is saved. A legacy module is still used for contract prices. The system uses Celery and Redis. You want to know why before you build on them.
The commands below were run in a small scratch repository built for this lesson, with fixed dates, so the output is real and repeatable. The hashes belong to that scratch repository. Yours will differ.
Decision 1: queue the email only after the order is saved
In orders/services.py the confirmation is queued with transaction.on_commit. That is a Django feature: it runs a function only after the database has saved the order for good. You search history for that text.
git log -S"transaction.on_commit" --oneline
git show -s --date=short --format="%h %ad%n%n%B" 979b059Find the commit that added transaction.on_commit, then read its full message.
979b059 Queue confirmation on commit (INC-212)
979b059 2023-02-17
Queue confirmation on commit (INC-212)
Customers received a confirmation email for orders that were then
rolled back. Queue the task only after the transaction commits.The commit message gives the reason in plain words, and a ticket number, INC-212. You also read the ticket, which describes customers who got an email for an order that never existed. Two written sources agree. This reason is Known.
Now look at the lines themselves with git blame. The options are --root (treat the first commit like any other), -L 6,11 (only lines 6 to 11) and --date=short (short dates).
git blame --root -L 6,11 --date=short orders/services.pyWho last changed each line?
367791c0 (Tidewell Dev 2022-03-14 6) def create_order(customer, lines, source):
367791c0 (Tidewell Dev 2022-03-14 7) totals = price_order(lines, customer.band)
9871a1cf (Tidewell Dev 2023-01-10 8) check_stock(lines)
979b0599 (Tidewell Dev 2023-02-17 9) with transaction.atomic():
979b0599 (Tidewell Dev 2023-02-17 10) order = save_order(customer, lines, totals, source)
979b0599 (Tidewell Dev 2023-02-17 11) transaction.on_commit(lambda: send_order_confirmation.delay(order.id))Line 10 points to the INC-212 commit. But that commit only moved the line to the right, to put it inside the with block. Add -w and Git ignores white-space changes.
git blame -w --root -L 6,11 --date=short orders/services.pyIgnore white-space changes when blaming.
367791c0 (Tidewell Dev 2022-03-14 6) def create_order(customer, lines, source):
367791c0 (Tidewell Dev 2022-03-14 7) totals = price_order(lines, customer.band)
9871a1cf (Tidewell Dev 2023-01-10 8) check_stock(lines)
979b0599 (Tidewell Dev 2023-02-17 9) with transaction.atomic():
b09c5de5 (Tidewell Dev 2022-06-20 10) order = save_order(customer, lines, totals, source)
979b0599 (Tidewell Dev 2023-02-17 11) transaction.on_commit(lambda: send_order_confirmation.delay(order.id))Now line 10 belongs to an older commit, from 2022-06-20. Lesson: the first commit blame shows may be a tidy-up, not the original change. Check what the commit really did.
Decision 2: Celery with Redis
Nobody on the team remembers why Celery and Redis were chosen. You search for the first appearance of the word celery, and look at what else the commit changed.
git log -S"celery" --format="%h %ad %s" --date=short --name-only
git show --stat --format="%h %ad %s" --date=short b09c5deFind the first commit that used Celery, and see what it touched.
b09c5de 2022-06-20 Add order confirmation emails
orders/tasks.py
tidewell/celery.py
b09c5de 2022-06-20 Add order confirmation emails
docker-compose.yml | 5 +++++
orders/services.py | 7 ++++++-
orders/tasks.py | 6 ++++++
tidewell/celery.py | 5 +++++
4 files changed, 22 insertions(+), 1 deletion(-)Celery, the Redis service in the compose file and the first email task all arrived in one commit, titled 'Add order confirmation emails'. That tells you what Celery was first used for. It does not tell you why Celery was picked over a simpler way, or why Redis was picked as the queue. This reason is Inferred: the team probably wanted emails sent in the background, but no record says so. The platform team lead is the person to ask.
Decision 3: keep legacy/pricing_v1 for contract customers
The module name sounds like something to delete. You look for when it appeared, and for tests that mention contract accounts.
git log -S"pricing_v1" --format="%h %ad %s" --date=short
git log --format="%h %ad %s" --date=short -- tests/invoicing
git grep -n "def test_" -- testsWhen did the legacy pricing module arrive, and who tests it?
8ef9ec7 2022-05-09 Move the old pricing service into legacy/pricing_v1
4f9ec06 2022-09-02 Add tests for contract accounts
tests/invoicing/test_contract_prices.py:1:def test_contract_account_keeps_price_agreed_before_2022():
tests/invoicing/test_contract_prices.py:5:def test_contract_account_ignores_new_list_price():The old 2019 diagram showed a separate pricing service. This commit moved it into the project. Two tests name contract accounts and say they keep the price agreed before 2022. From this you infer the reason: contract customers keep the prices of the old scheme. You then ask the finance systems contact, who confirms it: contract customers keep prices agreed under the old scheme until their contracts renew. A person who owns the rule has confirmed it, so this reason becomes Known.
| Decision | Source of the reason | Confidence |
|---|---|---|
| Queue emails after the order commits | Commit message and incident ticket INC-212 | Known |
| Keep legacy/pricing_v1 for contract customers | Tests suggested it; the finance systems contact confirmed it | Known (first inferred) |
| Use Celery with Redis | Same commit as email sending; nobody remembers why | Inferred |
Step-by-step workflow
Step 1: Pick one thing to explain
Choose a shape in your diagram that you do not understand. Write the question in one sentence, such as 'Why is the email queued after the commit?'
What you should see: One written question per decision.
Step 2: Find the commit
Use
git log -S"text"for a word or line, andgit blame -wfor a line you can see. Read the whole commit, not only its title.What you should see: A commit hash and its date.
Step 3: Read the message, then the neighbours
Read the message, the files it touched and the commits just before and after. Look for a ticket number.
What you should see: The commit's context.
Step 4: Read the ticket and the tests
Open the ticket if there is one. Search the tests for the behaviour. Note what each protects.
What you should see: The problem and the expected behaviour.
Step 5: Ask the right person
Ask by role, with a specific question and the evidence you have. Write the answer down with the date.
What you should see: A confirmation, a correction or 'nobody knows'.
Step 6: Rate and record
Rate the reason as Known, Inferred or Unknown. Keep a short note of the evidence. The next lesson turns it into a decision record.
What you should see: A rated reason with evidence.
- Question
One decision, one sentence
- Find the commit
git log -S, git blame -w
- Read around it
Message, files, neighbours
- Tickets and tests
Problem and behaviour
- Ask people
By role, with evidence
- Rate and record
Known, Inferred, Unknown
Each stage adds evidence. The last stage keeps guesses labelled.
Asking people about old decisions
People remember context that no tool can show. But memory bends. Ask in a way that does not lead the answer.
- Be specific. 'Why do we use Celery?' is too wide. 'Do you remember why the confirmation email moved to a background task in June 2022?' is better.
- Show your evidence. Bring the commit and the ticket. It helps people remember, and it shows you did your homework.
- Do not offer the answer. 'Was it because of scale?' invites a yes. Ask 'What problem were you solving?'
- Ask who else would know. The platform team lead may point you to a support engineer who handled the incident.
- Write it down at once. Note the answer, the person's role and the date. Then rate it. A clear first-hand answer is stronger than 'I think so'.
Using an AI assistant to read the clues
An assistant can help you read a long commit, summarise a ticket or suggest questions to ask. It is a good second reader. It is a poor witness, because it was not there.
Here is a reply you may get if you ask 'Why did Tidewell choose Celery and Redis?' with only the commit title. It is illustrative, not a real run.
Tidewell chose Celery and Redis for scalability and high availability, so the
order service could handle traffic spikes without slowing down checkout.It sounds sensible. But nothing in the evidence mentions traffic, scale or availability. The assistant has written a typical reason, not the real one. If you wrote it into a record, the next engineer would believe it.
- Do: give it the commit text, the diff and the ticket, and ask 'What does this evidence support, and what does it not?'
- Do: ask it for questions to put to the platform team lead.
- Do not: ask it why a team made a choice when you gave it no record of the choice.
- Always: rate its reasons yourself. An unsupported reason is Inferred at best, and often Unknown.
Conclusion and your next step
History shows what changed, and other sources help you guess why. You searched with git log -S, read lines with git blame -w, used tests, tickets and people, and rated each reason as Known, Inferred or Unknown. You also saw how an assistant can invent a story, and how to keep it honest.
Your next step: write the three reasons down so they outlive this week. Continue with Recording Decisions in Short Form and turn each one into a short decision record.
For more, see Reading an Unfamiliar Codebase for the reading log that holds your questions, and the module overview Architecture Recovery and Documentation.
Reusable prompt
Decision evidence reader
Asks an assistant to say what your evidence supports about a past decision, rate confidence, and list questions for the people who might know.
I am trying to recover why a decision was made in a Python and Django service called tidewell-orders (fictional). Use ONLY the evidence below. Do not use general knowledge about why teams usually choose this.
Question: Why does the project use Celery with Redis for background work?
Evidence:
- Commit b09c5de, 2022-06-20, titled "Add order confirmation emails". It adds orders/tasks.py (a task that sends the email), tidewell/celery.py (Celery setup) and a redis service in docker-compose.yml, and changes orders/services.py to queue the task.
- Nobody on the current team remembers why Celery or Redis was chosen.
- No ticket has been found for this commit.
- No other background work exists in the repository.
Please answer in four parts:
1. What the evidence supports (facts only).
2. What it does NOT tell us.
3. A confidence rating: Known, Inferred or Unknown, with one sentence of reasoning.
4. Three specific questions for the platform team lead, who may know.
Do not state a reason that is not in the evidence.Show the reusable template
Replace each {{placeholder}} with your own details.
I am trying to recover why a decision was made in {{system_description}}. Use ONLY the evidence below. Do not use general knowledge about why teams usually choose this.
Question: {{decision_question}}
Evidence:
{{evidence_list}}
Please answer in four parts:
1. What the evidence supports (facts only).
2. What it does NOT tell us.
3. A confidence rating: Known, Inferred or Unknown, with one sentence of reasoning.
4. Three specific questions for {{person_role}}, who may know.
Do not state a reason that is not in the evidence.Expected output and limitations
Four short parts. Facts are tied to the commit. The gaps are stated plainly. The rating is Inferred or Unknown, not Known, and the questions are specific and not leading.
1. Supported: Celery, the Redis service and the first email task were added together in commit b09c5de (2022-06-20). The commit changed orders/services.py to queue the task.
2. Not supported: why Celery was chosen over a simpler approach, why Redis was chosen as the queue, and what problem the team was solving.
3. Confidence: Inferred. The clues suggest background email sending, but no message, ticket or person confirms the reason.
4. Questions for the platform team lead:
- What was sending the emails before June 2022, and what went wrong with it?
- Were other queue options considered, and why were they dropped?
- Is any other work planned to use the same queue?Limitations to keep in mind
- The assistant only sees the text you give it. It cannot find the ticket, or the person who wrote the commit.
- It may drift into 'usual reasons', such as scale. Remove any reason that is not in your evidence.
- It cannot rate the quality of a source. You decide how far a commit message or a memory can be trusted.
- A calm, well-written answer can still be a guess. Check each claim against the evidence you gave.
Common errors and how to fix them
Treating the first commit blame shows as the origin
Why it happens: A later tidy-up, such as re-indenting, replaced the original author's line.
Fix: Use git blame -w, open the commit and check what it really changed. Then search with git log -S for the line's first appearance.
Writing a plausible reason as if it were known
Why it happens: A story that fits the facts feels like an answer, especially when an assistant provides it.
Fix: Rate the reason. If no message, ticket or person supports it, mark it Inferred or Unknown.
Trusting a vague commit message
Why it happens: Titles like 'fix' or 'update' look like records but hold no reason.
Fix: Read the diff and look for a ticket. If nothing explains the change, say so in your notes.
Validation checklist
Tick each item once you have confirmed it.
Hands-on exercise
Recover three decisions in your own repository
Pick three things in a repository you may study that look like deliberate choices, such as a queue, a module or an odd rule. Recover the reason for each, and rate it.
You will need
- Your component diagram and open questions from the previous lessons.
- Git history for the repository.
- Access to tickets or a colleague who may know, if available.
Acceptance criteria
Your work is done when every one of these is true.
Hints (3)
- If a project has little history, tests and comments become your main sources.
- If a line was re-indented or reformatted, try
git blame -wbefore you decide who wrote it. - If you use an assistant, give it only the evidence and ask what it does not support.
Show a model answer
A strong answer has three short entries. Each begins with a question, then the commit and date, then the evidence in order: message, ticket, tests, people. At least one entry is honest about a gap, such as 'Inferred: introduced together with email sending, no record of why', with a question for a named role. A weak answer gives three confident reasons with no commits, and sounds like a design textbook. The best sign of quality is a rating that is lower than the author hoped.
Knowledge check
Choose an answer, then check it. Nothing is recorded — this is for you.
Show the answer and explanation
Answer: B. A reformat changes layout, not intent, so the real author is further back.
-wskips white-space changes. The first answer is the tempting mistake. The line can usually be traced if you look beyond the latest commit.Show the answer and explanation
Answer: B. The commit shows what and when, not why. The reason is pieced together, so it is Inferred. An assistant's reason is a guess unless the evidence backs it.
Show the answer and explanation
Answer: B. An open, specific question tells you what they remember. The first question leads them towards your guess, and the last assumes a fault and may close the conversation.
Frequently asked questions
What does `git log -S` do?
It searches the history for commits where the number of times a piece of text appears changed, so you find when text was added or removed. It is useful when you know a word or line, but not the commit. See the Git documentation for the full options.
Is `git blame` about finding someone to blame?
No. The name is unfortunate. It shows the last commit that touched each line, so you can read the message and find the reason. Think of it as the history of a line.
What if the person who made the decision has left?
Look at their commit messages, tickets and tests. Ask people who worked nearby, such as the support engineer who handled the incident. If nobody knows, record the reason as Unknown, and say what you tried.
Can an AI assistant tell me why code was written that way?
Only from the evidence you give it. If you give it a commit message and a ticket, it can read them and summarise. If you give it nothing, it will invent a typical reason. Treat its answer as a hypothesis.
- Written by
- PromptFable Editorial
- Last updated 19 Nov 2026
- Review
- Reviewed by Waseem Nadir, Technical Reviewer
- Last reviewed 27 Nov 2026
References
Primary sources for the technical details in this lesson. Vendor platforms change — check the official page if anything here looks different from what you see.
- git-log Documentation(opens in a new tab)
Git project · Official documentation · The -S option and the output formats used in this lesson.
- git-blame Documentation(opens in a new tab)
Git project · Official documentation · Options such as -w and -L.
- Database transactions(opens in a new tab)
Django Software Foundation · Official documentation · Explains transaction.atomic and transaction.on_commit (Django-specific).
- Celery - Distributed Task Queue(opens in a new tab)
Celery project · Official documentation
PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.