a-hook-aborts-the-tool…
AgentRead this part of the harness loop. A subscriber on `before_tool_call` raises `HookAbort` on the second step of a three-step…
At the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour finding out where things stand. What is missing from the end-of-session artifact, and how do you produce it so that it is never skipped?
Claude Code
$ npx -y skills add rohitg00/ai-engineering-from-scratch --agent claude-code
Cursor
Cursor also loads subagents from .claude/agents, so copy this file there to use it in Cursor.
id: a-handoff-is-not-a-status-report title: What a handoff packet carries that a status report does not card: agents kind: concept level: 1 roles: [agentic-ai-engineer, forward-deployed-ai-engineer, ai-developer-relations-engineer] rounds: [screen, ml-breadth] tags: [handoff, next-action, multi-session, clean-state, state-file] minutes: 6 lessons: [phases/14-agent-engineering/40-multi-session-handoff] manuals: [] practice: [] cheatsheet: [agent-workbench-ops] related: [agents/seven-surfaces-one-symptom-each] updated: 2026-11-03
At the end of each session your agent writes a paragraph that says what it did. The next session still spends its first half hour finding out where things stand. What is missing from the end-of-session artifact, and how do you produce it so that it is never skipped?
The paragraph is a status report, and a handoff needs seven fields: a summary, the changed files, the commands run, the failed attempts, the open risks, the next action and a pointer to the verification and review reports. The next action is the most important field, because it makes the first step of the next session deterministic. Generate the packet from the workbench artifacts instead of asking the agent to write it, and run a cleanup check first so that the packet describes a tree the next session can trust.
| Field | Question it answers | |---|---| | `summary` | What was done, in one paragraph | | `changed_files` | The diff at a glance | | `commands_run` | What was executed, from the feedback records | | `failed_attempts` | What was tried and why it did not work | | `open_risks` | What can hurt the next session, with a severity | | `next_action` | The first concrete step the next session takes | | `verdict_pointer` | The path to the verification and review reports |
A packet with every field except `next_action` is a status report. It is useful, but the next session still has to decide what to do first.
A hand-written handoff is the thing that gets skipped on a hard day. The generator reads the state file, the verification report, the review report and the feedback log, and emits the packet in two forms. `handoff.md` is for the human. `handoff.json` is for the next agent. If they disagree, the JSON wins. The agent's job is to leave the workbench in a state the generator can summarize.
The feedback log can hold hundreds of records. The packet carries only the last K plus every record with a non-zero exit. The next session loads the full log if it needs it.
A perfect packet is useless if the next session opens on a half-applied diff, a stray temp file, a wrong branch and tests that error before they run. Cleanup is its own phase, and it is a check, not a habit. The working tree is committed or stashed with a note. No temp artifacts remain. Tests are green, or red with the failure named in the open risks. The feature board matches reality. The branch is the expected one. The cleanup phase emits a list of blocking issues, and an empty list is the precondition the generator asserts before it writes.
The [multi-session handoff lesson](../../../phases/14-agent-engineering/40-multi-session-handoff/) builds the packet out of the workbench files and adds the cleanup check.
Read this part of the harness loop. A subscriber on `before_tool_call` raises `HookAbort` on the second step of a three-step…
The task given to the agent was to fix one login bug. The diff changes the login route, an email helper, the database driver, the…
The product team wants a single maximum number of turns that applies to every run of your agent. The agent handles one-line…
Read this run method from the toy agent loop. A caller shows the returned string to the user as the answer. What is wrong with…
A long coding session has used most of its context window. The runtime offers to summarize the older turns and keep going. Your…
A tool is registered with this schema, and the model sends the four argument sets below. For each one, say what the registry…
Reviews the repository's shared Claude Code configuration (.claude/settings.json, CLAUDE.md, .claude/rules/, .mcp.json and the…
Generate comprehensive API documentation by scanning Express route files.
Advisor to a busy principal. Optimizes for the user's time, attention, and decision quality. One of the starter-kit council…