Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

agent-return-setup

БесплатноЗапускает вложенные скриптыНе проверен

Installs, configures or removes the agent-return hooks (size budget on every subagent's final return message). Triggers: agent-return, subagent return budget…

kochetkov-maот kochetkov-ma★ 41 звезда на GitHub

Об этом скилле

Agent Return

Installer for a size budget on every subagent's final report. Three hook files (SubagentStart contract, return guard, shared module) and a JSON config hold all runtime behavior; this skill only decides mode, scope and the two thresholds, then a brewcode:hook-creator agent does the file work by the runbook.

Subagent reports are the largest context cost of a delegating session, and a prose rule loses to whatever the agent just did. So the budget is stated at spawn and enforced at return: the report is sized (chars/4) against two integers, no LLM judge.

Prompt contract

$ARGUMENTS is one free-form RU/EN prompt; mode tokens and flags (--unattended) may sit anywhere in it.

  1. Mode: strip --unattended first: a flag, never a mode, scope or name (Modes, Unattended). Then an explicit mode token wins outright; else the most distinct whole-word keyword hits (table in Step 2). Tie with a destructive mode (purge) or of install with a removal mode (uninstall) -> AskUserQuestion; with status -> status; of two other mutating modes -> the keyword that comes first. No hit or empty -> status.
  2. Scope: prose that is not a mode/id/path is still input: take the id, path or target from it.
  3. Ask: at most ONE AskUserQuestion (max 4 questions) to resolve mode and scope, before any work, only when the answer changes what gets written. A read-only run asks nothing. --unattended asks nothing: an open question there ends in RESULT skipped (Modes, Unattended).

Print once, before the first action (labels literal, values in the conversation language):

PLAN — brewtools:agent-return-setup
INPUT:  <arguments verbatim, or "(empty)">
MODE:   <resolved> — <explicit | matched keyword: X | default>
SCOPE:  <resolved paths / target / level / flags>
DO:     <2-5 imperative bullets>
RESULT: <what the user ends up holding>

What the hooks do (informational — skill does NOT implement)

File Registered on Behavior
agent-return-budget.mjs never — imported by the other two config, thresholds, read-only list, estimateTokens, contract text
agent-return-contract.mjs SubagentStart, no matcher injects the budget as additionalContext; advisory. A readOnlyAgentTypes type gets the text without the write-to-file step
agent-return-guard.mjs SubagentStop, no matcher classic path: sizes last_assistant_message, challenges with decision:"block"
the same guard PreToolUse, matcher SubagentHandback auto-mode path: sizes tool_input.message, challenges with permissionDecision:"deny"

The guard tells the two delivery paths apart by event and tool name, never by permission mode; a challenge on either gives the agent one more turn. All three entries: exec form, timeout 5, no onFailure (a size guard fails open). The three files install as a unit: ESM resolution precedes evaluation, so 2 of the 3 means exit 1 and a hook-error banner on every subagent spawn and return.

Tiers, t = Math.ceil(<report text>.length / 4), defaults passTokens 2500 and fileTokens 6000:

Range Challenge
t <= passTokens none
passTokens < t <= fileTokens compress — re-send the same report shortened to the budget; no new work
t > fileTokens file — write the full report to <project root>/<reportDir>/YYYYMMDD-HHMMSS_<agent-slug>-<run-id>/ (config reportDir, default .claude/reports), return that path + verdict + a summary within the budget; a denied write is never retried: a compressed inline report instead
t > fileTokens, agent cannot write essential part — no file; one line names what was left out. Applies in plan mode and to readOnlyAgentTypes: default ["Explore","Plan"], exact agent_type (plugin agents as plugin:name), any array replaces the default

Exactly passTokens passes, exactly fileTokens still compresses. Every order quotes passTokens as budget. The budget is in tokens only: the shape of a report is whatever the caller's brief asks for.

Once per agent: before a challenge the guard exclusive-creates a marker for that agent_id; an agent that has one is never challenged again, on either path, also after a SendMessage resume. A payload without agent_id (main session, internal agents) is never challenged.

Evidence (measured, quote these — do not inflate them)

80 real Agent returns across 4 session transcripts, sized chars/4: p10 502, p25 761, p50 1404, p75 2256, p90 3164, max 7931 est-tokens; total 136.7k, of which 79.4k (58%) is overflow above 800. 2500 is ~p78, so only the heaviest fifth is challenged. 6000, between p90 and the maximum, is a judgement call: below it one compression round can still reach the budget.

Honest limits (state these to the user, do not oversell)

Fact Consequence
One challenge per agent_id; after it nothing is enforced The
Полный SKILL.md на GitHub

Установить agent-return-setup в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Bash
AskUserQuestion
Agent

Вложенные файлы

README.mdassets/INSTALL.mdassets/agent-return-budget.mjsassets/agent-return-contract.mjsassets/agent-return-guard.mjs

FAQ

Что делает скилл agent-return-setup?

Installs, configures or removes the agent-return hooks (size budget on every subagent's final return message). Triggers: agent-return, subagent return budget, return too large, бюджет ответа агента, размер отчёта саб-агента.

Как установить скилл agent-return-setup?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл agent-return-setup запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить agent-return-setup с