Engineering
Agent Instructions After-Action
Turn one agent run into better future agent runs.
Use when
A coding agent just learned something about the repo, test harness, edge case, command, or convention that future sessions should not relearn the expensive way.
Cadence
After a successful or painful agent coding session
Verification
Repo instructions contain only reusable, source-grounded lessons and the next similar task can start without rediscovering the same trap.
Advanced specStructured loop spec
| Field | Value |
|---|---|
| Name | Agent Instructions After-Action |
| Category | Engineering |
| Trigger | After a successful or painful agent coding session |
| Objective | Turn one agent run into better future agent runs. |
| Allowed inputs | Relevant files, source notes, logs, tests, screenshots, metrics, or task state for this loop |
| Allowed actions | Review the session diff, failed commands, final passing commands, and any repeated confusion.; Extract only reusable lessons: commands, conventions, tolerances, gotchas, protected paths, or fixture setup.; Patch AGENTS.md, CLAUDE.md, repo docs, or a docs/loops note with concise operational guidance.; Remove one-off transcript noise, blame, and implementation trivia.; Verify the instruction file is readable and references real commands or paths. |
| Verification | Repo instructions contain only reusable, source-grounded lessons and the next similar task can start without rediscovering the same trap. |
| Stop condition | Stop when the verifier passes, the budget is exhausted, no progress is made, a blocker appears, or approval is required. |
| Budget | Set a time, turn, token, retry, file, or dollar cap before running the loop. |
| Approval boundary | Human approval required before public, destructive, financial, legal, account, or production-impacting actions. |
| Safe output | Pull request, patch, report, or evidence log |
| Works with | Claude Code, OpenAI Codex, Cursor, Gemini CLI, any tool-using coding agent |
RunbookSteps
- Review the session diff, failed commands, final passing commands, and any repeated confusion.
- Extract only reusable lessons: commands, conventions, tolerances, gotchas, protected paths, or fixture setup.
- Patch AGENTS.md, CLAUDE.md, repo docs, or a docs/loops note with concise operational guidance.
- Remove one-off transcript noise, blame, and implementation trivia.
- Verify the instruction file is readable and references real commands or paths.
Copy promptPrompt
Run the Agent Instructions After-Action loop. Review the completed agent coding session, failed commands, final verification, and any repeated confusion. Extract reusable lessons only, then patch AGENTS.md, CLAUDE.md, or repo loop docs with concise commands, conventions, tolerances, protected paths, and gotchas. Do not paste chat transcripts or secrets. Verify the updated instruction file references real paths/commands and would help the next similar task.