Back to Blog
AI Guides

The AI Coding Session Wrap-Up Prompt

Before ending a coding-agent session, use this prompt to review regressions, inspect the diff, remove verified dead code, check security, and record what still needs attention.

Before you end a coding-agent session, ask it to review the work it just did. A short wrap-up can catch regressions, leave a clear record of what was checked, and preserve useful lessons for the next session.

Use this prompt after the agent has finished its main task. It asks for a review of the current session’s changes and evidence, not a general audit of the whole repository.

Send this to your coding agent

Code
We are closing this session. Work through these steps in order, then
give me a concise report.

1. Find and fix problems introduced during this session: bugs,
   regressions, and conflicts. Base this on the changes from this
   session. Do not invent problems or expand the task.

2. Review the diff, including added, changed, and deleted files. List
   TODOs, debug code, temporary workarounds, and changed areas without
   relevant tests.

3. Record what actually went wrong: failed builds or tests, incorrect
   assumptions, workarounds, and checks that could not be completed.

4. Remove code that is demonstrably unused: functions, files, or
   dependencies. If you cannot verify that something is unused, leave
   it in place and report it instead.

5. Review the changes for security and performance issues. Fix findings
   you can reproduce and verify within this task. Report anything that
   needs a broader change or cannot be verified.

6. Review branches other than main. Say which changes were merged and
   which branches appear abandoned. Do not delete branches.

7. Update project instructions only when a specific lesson from this
   session justifies it. Add narrow rules to the appropriate file; do
   not bloat the root instructions. Include general rules I corrected
   during this session when they apply beyond this task.

8. Say whether the available hooks, skills, and MCP tools were enough.
   If something was missing, name it and explain what it prevented.

End with one short paragraph for each: status, changes, findings,
project rules, tools, tests, and next step.

For anything that does not apply, write “Nothing to do” and continue.
Do not claim work that you did not perform.

Why this prompt helps

Agents can finish a feature while leaving behind a failing check, an unverified assumption, or a temporary workaround. This prompt makes the final review explicit: inspect the session’s diff, report evidence, and separate verified fixes from issues that need broader work.

The instruction to remove only demonstrably unused code matters. A symbol that looks unused in one file may be loaded dynamically or referenced outside the current diff. If the agent cannot establish that removal is safe, it should report the candidate and leave it alone.

When to use it

Run it after a meaningful coding task, especially when the session changed several files or involved a build, tests, dependencies, security-sensitive code, or project instructions. For a one-line edit, use judgment; a full checklist may take longer than the change itself.

The report is only as reliable as the checks the agent actually ran. Review the test output and remaining risks yourself, and do not treat “looks fine” as evidence that a build, security scan, or performance check passed.

Back to Blog