Plan AX: Context Engineering — Feed the Right Context, Get It Right the First Time

Document project memory → spec first → give enough relevant files → iterative feedback → verify & commit

Time
1-3 hours / task
Cost
Low
Difficulty
Advanced

Best for

Best for everyday development tasks in an existing codebase — let AI write code that respects your architecture and constraints, cutting guesswork and rework.

Steps

Build project memory

20-40 min (one-time investment)

Claude Code + you

Use CLAUDE.md / AGENTS.md to capture architecture conventions, common commands, code style and the 'gotchas to avoid', so every session starts from the same understanding. Project memory is the persistent context you feed the AI — write once, benefit for the long run.

💡Only write what's high-frequency: directory layout, build/test commands, dependency constraints, and traps you've hit; keep it lean and iterable rather than a long document nobody maintains.

Spec first

10-20 min

Claude Code / Claude

Write the inputs, outputs and acceptance criteria up front, and have the AI propose a plan before writing code; if it doesn't meet the spec, rework. The spec is the most important part of the context — it decides what the AI should and shouldn't build.

💡Put 'when X happens, then Y' into the spec; ask the AI to restate your requirements to confirm alignment before it starts.

Feed enough relevant files

10-20 min

Claude Code

Use @file references to bring the relevant code, interfaces and docs into context, bounding the change scope so the AI doesn't improvise. Enough context plus a clear boundary is the key to getting it right the first time.

💡Feed only the files directly involved (interfaces, data structures, call sites) rather than dumping the whole repo; pointing the AI at the right files to read itself also works.

Iterative feedback

30-60 min

Claude Code / Claude

Feed the error message, reproduction steps, and expected vs. actual output back together, so the AI fixes within the correct context. The more complete the feedback, the less the AI has to guess and the sharper the fix.

💡Paste the raw error log plus a minimal reproduction; saying 'expected vs. actual' beats just saying 'it doesn't work'.

Verify and commit

20-30 min

Git + tests

Run tests, review the diff, confirm the change fits the architecture constraints, then commit in small steps. Verification turns the AI's correctness into your certainty.

💡Scan the diff for unexpected changes before committing; commit every verifiable unit so rollbacks are easy and bugs localize fast.

Retrospect and update memory

10-20 min

Claude Code + you

Write the traps you hit and the conventions you added back into CLAUDE.md / AGENTS.md, so the next session starts from a higher baseline. Context engineering compounds: each update makes the AI understand your codebase a little better.

💡Have the AI extract the takeaways from the conversation and append them to the project memory; keep entries short and actionable so they don't rot.

Tools involved

Pitfalls to avoid

Letting the AI loose without constraints

The less context you give, the more the AI guesses from generic patterns — code that mismatches your style or calls nonexistent APIs; feed in the architecture constraints and acceptance criteria before it starts.

Too much, too messy context

Dumping dozens of files into context burns tokens and drowns the key constraints in noise; feed only the relevant files and call out the specific lines that matter.

Judging output without the reasoning

A correct result can still rest on wrong assumptions; ask the AI to state its plan and assumptions, referencing the context you gave, and align on key decisions before bugs get baked in.

Never accumulating project memory

Every session starts from zero and you re-trip the same traps; writing conventions into CLAUDE.md / AGENTS.md is what makes the AI keep getting smarter about your codebase.

Related Workflows