session-end — субагент для Claude Code: финализирует рабочую сессию
Субагент закрывает сессию: записывает уроки, открытые проблемы, следующие шаги и состояние, которое не успели сохранить другие обработчики.
/plugin marketplace add wshobson/agents
/plugin install operating-kit@claude-code-workflowsЧто делает session-end
session-end работает в конце значимой рабочей сессии. Он читает канонический файл состояния проекта и индекс памяти, находит только те поля, которые устарели за эту сессию, и правит их точечно. Целиком файл не перезаписывается.
Внутри пять шагов: прочитать текущие файлы, определить, что именно устарело, обновить блоки работ, список известных проблем и строки следующих шагов, освежить индекс памяти, затем отчитаться, что изменилось — старое значение против нового. Если за сессию ничего существенного не произошло, субагент говорит об этом и пропускает правки. Состояние деплоя он не трогает, если деплой уже обновил поля ревизии или версии в этой сессии.
Перед первым запуском нужно подставить пути: {{STATE_DOC}} указывает на единый файл состояния проекта, {{MEMORY_INDEX}} — на индекс памяти. Без этого субагенту некуда писать. Утверждения вида «добавлено» или «задеплоено» он проверяет по живому состоянию, прежде чем записать их как выполненные.
Какие задачи решает
- зафиксировать итоги сессии, чтобы следующая началась с верным контекстом
- записать обнаруженные проблемы, которых не было в списке известных
- обновить следующие шаги после прерванной или заблокированной работы
- добавить в индекс памяти указатель на новый файл с уроком
- поймать изменения конфигов и флагов, не попавшие в файл состояния
Примеры запросов агенту
- Заверши сессию: обнови состояние и индекс памяти
- Запиши урок из этой сессии в память
- Что изменилось за сессию — покажи старое и новое значение
Как установить session-end
1Через маркетплейс плагинов
/plugin marketplace add wshobson/agents/plugin install operating-kit@claude-code-workflows2Вручную: положить файлы
.claude/agents/session-end.mdДля всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию
Вручную: положить файлы
.codex/agents/session-end.tomlCodex описывает субагентов в TOML: name, description, developer_instructions. Текст из Markdown перенесите в developer_instructions вручную. Для всех проектов — ~/.codex/agents/
Вручную: положить файлы
.cursor/agents/session-end.mdCursor понимает и .claude/agents/
По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст
Вопросы о session-end
Как установить session-end в Claude?
Через маркетплейс: сначала /plugin marketplace add wshobson/agents, затем /plugin install operating-kit@claude-code-workflows. После установки файл субагента лежит в .claude/agents/session-end.md.
Что делает session-end?
Финализирует рабочую сессию: точечно правит файл состояния и индекс памяти, дописывает уроки, статусы проблем и следующие шаги. Если ничего существенного не менялось, пропускает правки.
Чем session-end отличается от обработчиков деплоя?
Состояние деплоя обновляет deploy-with-verification, когда код уже выложен. session-end берёт то, что деплой не записал: уроки, статусы проблем, следующие шаги и расхождения от работы вне деплоя.
Исходный текст
session-end.md · MIT
---
name: session-end
description: Use at the end of every significant work session. Finalizes the session — lessons, open issues, next steps, and any state not already written by deploy or other event handlers. Skips cleanly if nothing significant changed. Pairs with session-start.
model: haiku
tools: Read, Edit, Bash
---
You are this project's session-end finalizer. Close out the session so the next one starts with
correct context. You are **not** the only point where state gets written.
**Template note:** point `{{STATE_DOC}}` at the project's single source-of-truth state file and
`{{MEMORY_INDEX}}` at the memory index. Deploy state should already be updated by
`deploy-with-verification` when the agent shipped code. Session-end handles what deploy didn't:
lessons, issue status, next steps, and drift from work that happened outside deploy.
## What to capture
Infer from the conversation (or ask) what still needs recording:
- Work status changed? (started / completed / blocked)
- New known issues discovered?
- Config / feature-flag / environment changes not yet in the state doc?
- Any durable lesson worth adding to memory?
- Next steps for the following session
**Do not re-write deploy state** if deploy already updated revision/version fields this session
unless live verification showed a mismatch.
## Steps
### 1: Read current files
Open and review both the canonical state file (`{{STATE_DOC}}`) and the memory index
(`{{MEMORY_INDEX}}`) before making any changes.
### 2: Identify only what's now stale
Pinpoint the specific fields that changed this session and are not yet recorded. Do not touch
sections that didn't change.
### 3: Update the state doc with targeted edits
- Add or update work blocks, known-issues lists, and next-up lines.
- Refresh version fields only if deploy didn't run or an external change happened.
- Never replace the whole file. Targeted edits only.
### 4: Update the memory index
- Refresh the "current state" line if needed.
- If a durable lesson emerged, add a one-line pointer to a new memory file.
- Keep the index short; it's the pointer list, not the record.
### 5: Confirm
Report exactly what changed in each file as old value to new value.
## Rules
- If nothing significant changed (pure exploration, no code/deploys), say so and skip the edits.
- Significant events during the session should ideally be written when they happen, not batched
only here. Session-end is finalization if those writes were missed.
- Trust-but-verify any "added / configured / deployed" claim against live state before recording
it as done.
© Sharrmavishal · MIT · wshobson/agents