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 spec

Structured loop spec

FieldValue
NameAgent Instructions After-Action
CategoryEngineering
TriggerAfter a successful or painful agent coding session
ObjectiveTurn one agent run into better future agent runs.
Allowed inputsRelevant files, source notes, logs, tests, screenshots, metrics, or task state for this loop
Allowed actionsReview 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.
VerificationRepo instructions contain only reusable, source-grounded lessons and the next similar task can start without rediscovering the same trap.
Stop conditionStop when the verifier passes, the budget is exhausted, no progress is made, a blocker appears, or approval is required.
BudgetSet a time, turn, token, retry, file, or dollar cap before running the loop.
Approval boundaryHuman approval required before public, destructive, financial, legal, account, or production-impacting actions.
Safe outputPull request, patch, report, or evidence log
Works withClaude Code, OpenAI Codex, Cursor, Gemini CLI, any tool-using coding agent
Runbook

Steps

  1. Review the session diff, failed commands, final passing commands, and any repeated confusion.
  2. Extract only reusable lessons: commands, conventions, tolerances, gotchas, protected paths, or fixture setup.
  3. Patch AGENTS.md, CLAUDE.md, repo docs, or a docs/loops note with concise operational guidance.
  4. Remove one-off transcript noise, blame, and implementation trivia.
  5. Verify the instruction file is readable and references real commands or paths.
Copy prompt

Prompt

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.
Metadata

Tags

AGENTS.mdCLAUDE.mdlessons learnedagent harness
Next loops

Related