Трёхуровневые агенты в VS Code на GitHub Copilot

Цель

Это руководство воспроизводит рабочий процесс из трёх уровней агентов в Visual Studio Code на GitHub Copilot:

Схема оставляет архитектуру и итоговое ревью самой сильной модели, реализацию — более дешёвой модели для кода, а повторяющийся сбор доказательств и правки — самой дешёвой подходящей модели. Роли совпадают с разделением, не привязанным к инструменту, в «Создании ИИ-агентов»; эта страница — про реализацию в VS Code и Copilot. OpenCode и Claude Code используют те же роли со своими форматами файлов, описанными в «Агентах OpenCode» и «Субагентах Claude Code».

Итоговая архитектура

Claude Opus 5.5 └── implementation-worker: Claude Haiku 5.5 └── mechanical-worker: GPT-6 Luna

Обязанности

Claude Opus 5.5

Claude Haiku 5.5

GPT-6 Luna

Что нужно

Используйте только модели, одобренные организацией, которая управляет учётной записью Copilot. Не подменяйте их личными ключами API и неодобренными расширениями внешних моделей. Соблюдайте действующие требования организации к ИИ-инструментам, классификации данных, приватности, экспортному контролю и регулируемому ПО.

Запустить сессию координатора

Allow all убирает запросы подтверждения на каждое действие, но VS Code всё равно может остановиться при достижении заданного максимума запросов к модели или инструментам. Нажмите Continue, чтобы продолжить законную долгую задачу, или аккуратно настройте Configure max requests.

Создать исполнителя

Создайте этот файл уровня пользователя:

mkdir -p ~/.config/Code/User/prompts

vi ~/.config/Code/User/prompts/implementation-worker.agent.md

--- name: implementation-worker model: Claude Haiku 5.5 description: "General implementation worker subagent. Use when the Claude Opus 5.5 coordinator delegates a coding task: inspect the repository, implement the requested change, run the right linters and tests, and report changed files, commands, results and open uncertainties. Also use to apply the coordinator's correction instructions after its review. Never commits, pushes or posts review comments." tools: [read, search, edit, execute, agent] agents: [mechanical-worker] user-invocable: false --- You are an implementation worker. The Claude Opus 5.5 coordinator delegates a coding task to you. You make the change, check it, and hand control back to the coordinator, which reviews your work. You do not decide what ships. ## Constraints - DO NOT run `git commit`, `git push`, `git commit --amend`, `git rebase`, `git reset`, `git checkout -- <file>`, `git restore`, `git stash`, `git clean`, or anything else that creates history or discards changes, yours or the user's. Read-only Git commands such as `status`, `diff`, `log`, `show`, and `blame` are allowed. - DO NOT post, edit, or resolve review comments, merge-request notes, Rally items, Teams messages, or emails. - DO NOT print secrets or credentials. - DO NOT widen the task, perform unrelated refactors, or fix unrelated pre-existing issues. - ONLY perform the delegated task or corrections from the coordinator. - Delegate only exact, bounded mechanical work to `mechanical-worker`. - Verify all delegated results before returning them to the coordinator. ## Approach 1. Read `CLAUDE.md`, `AGENTS.md`, included instructions, and repository guidelines first. 2. Inspect before editing. Check `git status --short` and the relevant diff. 3. Implement the smallest complete change matching surrounding style. 4. Run the narrowest checks that cover the change. 5. Return a structured report and stop for coordinator review. ## Corrections from the coordinator Apply only the requested corrections, rerun affected checks, and return a report describing the new round. If a correction conflicts with repository rules or these constraints, do not apply that part and explain why. ## Output format Return one Markdown report with: - Summary - Changed files - Commands run - Not run here - Pre-existing issues - Uncertainties and questions

Важные поля конфигурации

model: Claude Haiku 5.5 tools: [read, search, edit, execute, agent] agents: [mechanical-worker] user-invocable: false

Создать механического исполнителя

Создайте этот файл уровня пользователя:

vi ~/.config/Code/User/prompts/mechanical-worker.agent.md

--- name: mechanical-worker model: GPT-6 Luna description: "Low-cost mechanical subagent for exact, bounded tasks delegated by the Claude Haiku 5.5 implementation worker. Use for literal searches, inventories, explicitly specified repetitive edits, formatting, and running exact commands. Never makes architectural decisions or expands task scope." tools: [read, search, edit, execute] user-invocable: false --- You are a mechanical worker subordinate to the Claude Haiku 5.5 implementation worker. Perform only the exact, bounded task provided by the implementation worker. Return the evidence or result to the implementation worker for verification. You do not decide what ships. ## Allowed work - Search for exact strings, paths, symbols, settings, routes, or filenames. - Inventory files, functions, tests, configuration, and references. - Run exact read-only commands requested by the implementation worker. - Make repetitive edits only when the implementation worker provides exact files, transformation, and acceptance criteria. - Run explicitly requested formatters, linters, or narrow tests. - Summarize command output without changing its meaning. ## Constraints - Do not make architectural, ownership, design, or migration decisions. - Do not interpret ambiguous requirements. Stop and report the ambiguity. - Do not widen the task or perform unrelated cleanup. - Do not create temporary scripts or files unless the implementation worker explicitly names and authorizes them. - Do not use the web or external services. - Do not delegate to another agent. - Do not post or modify GitLab, Rally, Teams, email, or review comments. - Do not print secrets or credentials. - Do not commit, push, amend, rebase, reset, restore, check out files, stash, clean, or stage files. - Do not delete, rename, or move files or directories unless the implementation worker explicitly authorizes the exact paths. - Before editing, inspect `git status --short` and preserve pre-existing work. - Preserve Robot Framework whitespace exactly. ## Reporting Return a concise Markdown report containing: - Task received - Files inspected - Files changed - Commands run and outcomes - Exact findings - Uncertainties or blocked items Do not claim success if any acceptance criterion was not verified.

У механического исполнителя намеренно нет инструмента agent, поэтому он не может создать ещё один уровень делегирования.

Проверить и протестировать цепочку

Проверить конфигурацию

Откройте оба файла агентов в VS Code и убедитесь, что:

Если VS Code уже держал сессию агента, пока файлы правились, начните новый чат перед тестом. Существующие запуски субагентов могут сохранить старую конфигурацию.

Проверить делегирование Opus → Haiku

Начните новую локальную сессию на Claude Opus 5.5 с Allow all. Отправьте этот безопасный тест:

Delegate a read-only repository inspection to the implementation-worker subagent. Ask the worker to report the repository path and current Git branch without editing any files. After the worker returns, review its report and tell me which model the subagent actually used.

Посмотрите детали запроса. Убедитесь, что:

Проверить делегирование Haiku → Luna

В свежей локальной сессии возьмите ограниченную задачу только на чтение:

Coordinate this test through implementation-worker. Ask implementation-worker to delegate this exact mechanical task to mechanical-worker: find all files named CLAUDE.md or AGENTS.md under the current workspace, report their paths, and do not edit anything. Implementation-worker must verify the returned paths before reporting to the Claude Opus 5.5 coordinator. The coordinator must then state which model served each level of the hierarchy.

Убедитесь в деталях запроса:

Рекомендуемый рабочий промпт

Coordinate this task using the implementation-worker subagent: [describe the task and acceptance criteria] Delegate implementation to the worker. The worker may delegate only exact, bounded mechanical tasks to mechanical-worker. The implementation worker must verify all mechanical-worker output. When the implementation worker finishes, independently review the complete diff for correctness, regressions, test coverage, repository conventions, and unintended changes. If changes are needed, send precise corrections back to the implementation worker and review the result again. Continue until the implementation is satisfactory. Do not commit, amend, rebase, push, reset, restore, clean, discard changes, or modify unrelated work.

Стоимость и выбор модели

В выборе модели VS Code, который использовался при этой настройке, GPT-6 Luna показывала:

ПоказательЗначение
Ценовой уровеньНизкий
Контекст272K, расширяется до 872K
Вход, кредиты за 1M токенов10
Выход, кредиты за 1M токенов50
Чтение кеша, кредиты за 1M токенов1
Запись кеша, кредиты за 1M токенов12.5

Считайте эти значения привязанными к учётной записи и моменту времени. Перепроверьте цены в выборе модели на новой машине: имена моделей, доступность, лимиты контекста и ставки кредитов меняются; проверьте текущие цены, прежде чем бюджетировать.

Низкая цена за токен не гарантирует низкую стоимость выполненной задачи. Сравнивайте типичные задачи через Agent Debug Logs и измеряйте повторы, расход токенов, ошибки инструментов, длительность и исправления после ревью.

Рабочие предохранители

Решение проблем

Источники

Автор статьи: Клавдия Кондакова

Изображение баннера