AI-Assisted Coding · Module 5Lesson 6

Study explanation · Lesson 06 · 15 min

Cross-cutting context engineering

More context is not always better. Run the same architecture-document task three times in fresh threads, with minimal, structured and targeted context, compare the outputs, and leave with a rule: for task shape X, use strategy Y because Z.

Listen to this lesson

Hear the lesson read aloud, with each sentence highlighted as you go.

Narrated by an AI voice.

The comparison matters more than the document

This part runs the same architecture-document task three times in fresh Codex threads. The architecture document matters, but the comparison matters more: you are learning which context strategy produces useful, honest output for which kind of work.

Key ideaMore context is not always better. The skill is matching the context strategy to the task shape.

Three context strategies

Each strategy changes only what Codex is given. The task stays the same.

The three context strategies · Lecture notes p. 15

A · Minimal context

  • Ask for a one-page architecture document with little extra guidance.
  • Shows how much Codex can infer and where it invents or stays generic.

B · Structured context

  • Provide organized context such as AGENTS.md plus concise file summaries.
  • Often improves completeness, but can produce longer and less focused output.

C · Targeted context

  • Limit Codex to specific anchor files such as main.py, models.py, and storage.py.
  • Forces narrower, more honest output: Codex should say what is not visible instead of guessing.

Five steps, three fresh threads

The comparison only works if each strategy starts clean, so every run gets its own thread and its own file.

Context engineering activity flow · Lecture notes pp. 15-16
StepWhat to doWhat to notice
1. Strategy AFresh thread. Ask for the architecture doc with minimal context. Save as docs/architecture-A.md.What is generic? What is invented? What is surprisingly accurate?
2. Strategy BFresh thread. Give structured context through AGENTS.md and file summaries. Save as docs/architecture-B.md.What became more complete? What became too long?
3. Strategy CFresh thread. Limit Codex to selected anchor files and require honesty about unseen parts. Save as docs/architecture-C.md.What did it refuse to infer? What was more precise?
4. Final docCreate docs/architecture.md from the best parts.The final doc should be useful for onboarding and review.
5. Comparison ruleAdd a comparison log and a two-sentence context strategy rule.For task shape X, use strategy Y because Z.

What the architecture document covers

Whichever strategy you use, the notes list six sections to look for in the result.

Architecture document content · Lecture notes p. 16
SectionWhat you should look for
System overviewA plain-language summary of the Task Tracker components and how they fit together.
Backend structureActual app files, models, routes, storage behavior, and validation boundaries.
Frontend structureHow the UI interacts with the API, if frontend files are part of the repo.
Data flowHow a task moves from request or UI event through validation, storage, response, and display.
Testing and verificationHow tests and manual checks confirm behavior.
Known limitsScope decisions such as no production auth, no real database, or local-development assumptions.

Read with careThe library’s three prompts share one section list, including “Key files - 5-10 important files”. Strategy C reads only three files, so expect it to mark much of that section “not visible from the files I read”. That is the honest answer, not a defect.

Writing the comparison log

The notes give five questions for the log. The instructor emphasis: Strategy C saying “not visible from the files I read” is not a failure. For correctness-sensitive work, honest boundaries are often more valuable than confident guesses.

  1. Which strategy produced the most accurate file-level description?
  2. Which strategy invented the most or sounded generic?
  3. Which strategy was most honest about what it had not inspected?
  4. Which output would help a new teammate fastest?
  5. Which context strategy would you use for security work, onboarding docs, or feature planning?

Four context pitfalls

The transferable lesson is the rule you write at the end, not the architecture document alone.

  • Keeping only the prettiest output The best-written answer may not be the most accurate.
  • Forgetting fresh threads The comparison only works if each strategy starts clean.
  • No strategy rule Without the two-sentence rule, you leave with three documents and no principle.
  • Assuming more context wins Extra context can improve completeness but also increase length and blur the task.

Key takeaways

  • Same task, three fresh threads: minimal, structured, targeted.
  • Structured context often adds completeness and length; targeted context adds honesty about what is unseen.
  • “Not visible from the files I read” is a feature for correctness-sensitive work.
  • Finish with a rule: for task shape X, use strategy Y because Z.

Built from the Module 5 lecture notes, prompt library and additional readings; the videos they accompany were not supplied.

Your study checkpoint

Ready to continue?

Mark the lesson complete once you have read it and tried its idea on something real.

Next · Lesson 7