How to AI: Stop throwing away prompts. Start managing context.

Manage context with plan files to give your AI agents memory. Use an AGENTS.md file and a gather-files script for deep thinking critique.

Sep 27, 2025 3 min read

Stop throwing away prompts

Long, detailed prompts that you paste once and then discard make it harder to resume work. Each new session in Codex/Cursor/Claude Code/Goose starts cold unless you have a way to restore context quickly.

Start managing context

Instead, set context clearly in a committed plan file. Write it once. Commit it. Reference it.

I typically just copy and paste this instruction at the start of a session:

See ./<feature-name>-plan.md for context and then complete the next task

Result: your AI agent gets stable “memory” and direct file paths for every session.

What makes a great context file?

Your plan context file should include:

Step 1: Create your context file

The <feature-name>-plan.md pattern: one file, committed with code, referenced every time.

Spend time iterating on the plan to make it as clear and complete as possible. Then use it as a starting point for your AI agent.

See ./<feature-name>-plan.md for context and then complete the next task

Examples:

Step 2: Set up AGENTS.md

Create an AGENTS.md file in the root of the project with repeated instructions. Example:

- <... detailed instructions for the agent based on your repo, then general best practices...>
- Follow best practices for <language/framework>
- Always run tests with `make test`
- Autoformat/lint with `make format`
- Keep solutions simple and focused
- ALWAYS read and understand relevant files before proposing edits. Do not speculate about code you have not inspected.

Step 3: Gather files script

Create a script to gather all files and copy to clipboard. Usage:

../tmp/gather_files.rb --from-markdown=payout-reconciliation-plan.md

Use the --from-markdown flag to gather every file referenced in your plan. Ask Codex/Cursor/Goose to create this script for you.

Step 4: Use a thinking model as critic

Use the smartest model you have access to (e.g. gpt-5.1-pro) to critique the plan and the code. A model that thinks for 5-15 minutes and come back with deep insights is ideal here.

For now these long thinking models are via the web UI only, so paste the gathered files (using your script) and ask

Thoroughly review the plan and code.
Find bugs, suggest improvements, and make sure the code is correct and maintainable.
The code should be as simple as possible and not overly engineered.

Then pick and choose feedback to implement with Codex/Cursor/Goose.

Key takeaway

Context > Prompting

Remember: Stop prompting. Start setting context.

Read more posts like this in the Software Engineering Toolbox collection.
Visit homepage