agent_archive — субагент для Claude Code: что делает и как установить
Субагент agent_archive для Claude Code переносит сессию кодинг-агента из активного списка в архив. Срабатывает по запросу на наведение порядка или архивацию сессий.
MIT ★ 395 обновлён 2026-11-16
.claude/agents/agent_archive.mdЧто делает agent_archive
Субагент перемещает сессию из agents_list в раздел архива, ничего не удаляя с диска. Для возврата сессии используется agent_unarchive. Если инструмент агента поддерживает встроенный архив (например, Codex), субагент запрашивает архивацию у него и возвращает статус операции: done, pending или unsupported.
Для вызова требуются параметры machine и session_id. Флаг close по умолчанию выключен. При его активации субагент закрывает процесс и вкладку терминала на целевом компьютере, предварительно запросив подтверждение через телефон. Занятого агента архивировать нельзя: если сессия выполняет код, ждёт фоновую задачу, крутит цикл /loop или держит открытый порт, запрос отклоняется.
Флаг force: true позволяет принудительно отменить и закрыть агента, который застрял в ожидании подтверждения в терминале. Не работает для обычных диалогов Persona — для них предназначен conversation_archive.
Какие задачи решает
- перенести завершённую сессию кодинг-агента в архив
- закрыть зависший на подтверждении терминала процесс с флагом
force - остановить агентский процесс и закрыть вкладку терминала на машине
- проверить статус нативной архивации сессии в Codex
Примеры запросов агенту
- Архивируй сессию a1b2c3d4 на машине dev-box
- Убери в архив сессию 98765432 и закрой её терминал на рабочем компьютере
- Принудительно останови и заархивируй зависшего агента e5f6a7b8 на сервере mac-mini
Как установить agent_archive
Вручную: положить файлы
.claude/agents/agent_archive.mdДля всех проектов — ~/.claude/agents/. Claude делегирует задачу сам по полю description или по @-упоминанию
Вручную: положить файлы
.codex/agents/agent_archive.tomlCodex описывает субагентов в TOML: name, description, developer_instructions. Текст из Markdown перенесите в developer_instructions вручную. Для всех проектов — ~/.codex/agents/
Вручную: положить файлы
.cursor/agents/agent_archive.mdCursor понимает и .claude/agents/
По шагам, с командами для каждой платформы: Субагенты Claude Code: как создать, вызвать и не утопить контекст
Вопросы об agent_archive
Как установить agent_archive в Claude Code?
Добавьте файл конфигурации по пути .claude/agents/agent_archive.md.
Что делает agent_archive?
Субагент убирает сессию агента из активного списка в архив без удаления стенограммы. При передаче флага close он также останавливает сессию и закрывает вкладку терминала.
Что произойдёт, если агент выполняет задачу в момент вызова?
Запрос на архивацию будет отклонён. Субагент не трогает агентов, которые работают, ждут ответ, держат очереди сообщений, циклы /loop или активные порты.
Исходный текст
agent_archive.md · MIT
Archive a coding agent's session (from agents_list) when the user asks to archive or tidy up agents: it leaves the Agents list for Archived in the app, nothing is deleted, and agent_unarchive brings it back (never remove a session any other way). Persona also asks the agent's own tool to archive it where that tool has an archive (Codex); the result says whether it did (native: done / pending / unsupported). Without close the agent itself is not closed: one open on its computer stays open. With close, its agent and its terminal tab are also closed on its computer (its transcript stays; then it is stopped until resumed): only when the user asks to close it too, and the user confirms on the phone first (declined: nothing changes). A busy agent is refused and nothing changes: working, waiting for an answer or background work, and for close also a /loop, queued messages or a server it runs. When the close does not happen the session stays archived and still open on the computer, and the result says why: tell the user exactly that, not that it was closed. With `force: true`, explicitly cancel and close an Agent stuck waiting for a terminal confirmation, then archive it, as `paseo archive --force` does. Use force only when the user asks to stop or archive that blocked Agent. Pending permissions and plans are rejected or cancelled, never allowed. Working Agents, background work, running subagents/workflows, queued messages, loops and serving ports are still refused. A failed close leaves it visible. Force implies close and does not ask for a second permission card. Not for Persona conversations (conversation_archive).
```json
{
"type": "object",
"required": ["machine", "session_id"],
"properties": {
"machine": {
"type": "string",
"description": "the machine's id or name, as agents_list shows it"
},
"session_id": {
"type": "string",
"description": "the agent's session id, or its first 8 characters"
},
"force": {
"type": "boolean",
"description": "cancel and close a confirmation-blocked Agent before archiving; only when the user asks; never approve its pending request"
},
"close": {
"type": "boolean",
"description": "also close its agent on the computer (asks the user on the phone first); default false: archive only"
}
}
}
```
© nwverse · MIT · nwverse/persona