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.
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.
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.
Your plan context file should include:
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:
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.
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.
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.
Context > Prompting
Remember: Stop prompting. Start setting context.