iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
GitHub Copilot CLI supports two different kinds of autonomous work: local autopilot, which runs in your current terminal session, and /delegate (or &), which hands a task to GitHub Copilot cloud agent. You can also create reusable specialist profiles in .github/agents/ or ~/.copilot/agents/, then invoke them explicitly or let the CLI select one. The practical workflow is: open the correct repository, create and test a focused .agent.md profile, restart Copilot so it loads the profile, inspect your working tree, delegate a bounded task when you need background execution, and review the resulting pull request.
At a glance
| Option | What you need | Best for |
|---|---|---|
| Custom agent in Copilot CLI | A Markdown file ending in .agent.md in .github/agents/ or ~/.copilot/agents/; restart the CLI after creating it |
Repeatable specialist behavior, restricted tools, deterministic checks, and team rules |
| Local autopilot | An open repository, an interactive Copilot CLI session, and permission to let Copilot act locally | Interactive exploration, debugging, and core feature work while you watch progress |
/delegate or & |
A Copilot-enabled account, a clean checkpoint for unstaged work, and an eligible repository | Bounded asynchronous work that should continue after you disconnect and arrive as a draft pull request |
Eligibility and service availability can change; verify your organization policy and Copilot plan before relying on cloud execution.
What is the difference between local autopilot and /delegate?
Local autopilot keeps Copilot in the current CLI process and repository. Delegation sends the prompt to a GitHub-hosted cloud agent, which continues independently and opens a reviewable branch and draft pull request. GitHub describes these as its two autonomous-work paths in the Copilot CLI best-practices guidance.
Recommended Free Tools
| Decision point | Local autopilot | Cloud delegation |
|---|---|---|
| Execution location | Your machine, inside the active CLI session | GitHub-hosted Copilot cloud agent |
| Continuity | Stops when the local process, session, or machine stops | Continues in the background after you close the terminal or shut down the machine |
| Result | Changes in your local working tree | A cloud-created branch and draft pull request for review |
| Control model | You can grant broad local permissions, so monitor the session closely | Copilot asks you to checkpoint unstaged changes before handing off and gives you a review artifact |
| Task shape | Interactive investigation, debugging, and work that benefits from immediate feedback | Bounded tests, documentation, refactors, or work in another module that can run without you present |
Delegation is not a switch that gives your local session unlimited authority. It is an asynchronous handoff: the cloud agent receives a prompt, works on GitHub, and asks you to review its draft pull request.
Popular on Amazon
- FAST RUNS IN THE FAMILY — The 14-inch MacBook Pro with the M5 Pro or M5 Max chip brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. With all-day battery life, double the starting storage,* and a breathtaking Liquid Retina XDR display, it’s pro in every way.*
- BUCKLE UP — Along with a next-generation CPU, faster unified memory, and up to 2x faster SSD storage,* M5 Pro and M5 Max feature a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance and on-device training capabilities. So you can blaze through demanding workloads at mind-bending speeds.
- BUILT FOR AI — Apple silicon, and every major component that powers it, is designed to run demanding on-device AI workloads like LLM inference and training. And Apple Intelligence helps you write, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
- ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.*
- MACOS RUNS APPS FAST — All your go-to apps run lightning fast in macOS, including built-in apps like FaceTime and Messages. Plus, built-in virus protection and free software updates help keep your Mac running smoothly and securely.
Can I use Copilot CLI and cloud agent with my plan?
GitHub states that Copilot CLI is available with all Copilot plans, while an organization-provided plan must have the CLI policy enabled. Cloud-agent access is limited to paid Copilot plans and to repositories and accounts that meet GitHub’s eligibility rules. The delegate documentation also lists exclusions and changing availability, so check your organization’s policy and the current account requirements before designing an unattended workflow.
Use the official GitHub account and repository settings to confirm access. A custom profile can be used in cloud-agent sessions on GitHub.com and in issue assignments; pull requests identify the custom agent that was used. Those capabilities are described in GitHub’s cloud custom-agent documentation.
Where do I create a custom agent for Copilot CLI?
A custom agent is a Markdown file whose name ends in .agent.md. In an interactive CLI session, enter /agent, press N, and choose a project location (.github/agents/) or a user location (~/.copilot/agents/). Copilot can generate a starter profile, or you can author the file yourself. Restart Copilot after saving it so the new profile is discovered; an already-running process may not reload agent files.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteThe official CLI instructions for creating and using these files are in GitHub’s custom-agent guide for CLI.
Project and personal scope
.github/agents/: repository-scoped profiles that can be committed and reviewed with the project.~/.copilot/agents/: personal profiles available across repositories on your machine.
Use project scope for a team’s API contract reviewer, database migration reviewer, documentation maintainer, or test runner. Use personal scope for a private workflow or a profile that should not be distributed with source code. If a personal and repository profile resolve to the same agent ID, follow GitHub’s documented precedence behavior and avoid ambiguous naming by giving shared agents distinctive filenames.
How are custom-agent IDs formed?
The ID is derived from the filename without .agent.md. For example, security-auditor.agent.md becomes security-auditor. A nested file such as agents/security/security-auditor.agent.md becomes security--security-auditor. That transformed ID matters when you invoke the agent from the command line, so inspect the actual path before scripting it.
Do not confuse .github/agents/ with a generic github/agents/ directory. Similarly, paths such as <plugin>/agents/ or claude/agents/ may be conventions used by other tools or plugins; Copilot CLI does not load them merely because they exist. Place a Copilot profile in .github/agents/ or ~/.copilot/agents/, or deliberately copy and adapt a profile from another system.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →What should a .agent.md profile contain?
A useful profile states four things plainly: the specialist’s name, the expertise it applies, the behavioral rules it must follow, and the tools it may use. Keep the instructions narrow enough that the agent behaves consistently, and put repository-wide rules that should apply to nearly every task in the repository’s normal contribution documentation as well as in the profile.
---
name: api-contract-reviewer
description: Review API changes for compatibility, validation, and contract tests.
tools:
- read
- search
- shell
---
# API contract reviewer
You review REST and event API changes before implementation is merged.
## Rules
- Read the repository's API specification and contribution guide first.
- Identify breaking changes for existing clients and explain the evidence.
- Prefer deterministic checks: schema validation, generated-client diff, and contract tests.
- Do not edit production code unless the user explicitly asks for a patch.
- Never print credentials or copy secrets into logs.
- Report file paths, commands run, and failing assertions.
## Procedure
1. Locate the API specification and the affected handlers.
2. Compare request, response, error, and versioning contracts.
3. Run the repository's test runner and schema validator.
4. Return a checklist with blocking findings and suggested fixes.
The tools list is a control boundary, not decoration. A read-and-search reviewer should not receive write or deployment tools. If an agent must use a particular locally hosted model, GitHub documents a model field and model-policy: required; use that policy only when the model requirement is real and enforceable.
How do I create specialist agents that are actually repeatable?
Give each agent a bounded responsibility, a repeatable procedure, and a defined output. A vague instruction such as “be helpful with databases” produces inconsistent behavior; “inspect migration files, run the deterministic migration check, compare the generated schema, and report rollback risk” gives the agent a lifecycle it can follow.
Database migration reviewer
---
name: database-migration-reviewer
description: Check migrations for safety, rollback coverage, and deterministic validation.
tools:
- read
- search
- shell
---
Read the migration policy before inspecting files. Check naming and ordering, lock duration,
backfill strategy, nullability changes, indexes, rollback or forward-fix plans, and compatibility
with the currently deployed application. Run the repository's migration validator and test runner.
Never connect to a production database. Return: findings by severity, commands and resources used,
and a release/lifecycle checklist.
If a repository provides a staging database, ticketing system, cloud platform, or internal API, expose access through approved, auditable commands and the narrowest possible credentials. The profile should name which environment is allowed, what records may be read, and whether writes are prohibited. Do not place tokens in the Markdown file; use the organization’s normal secret store and permission controls.
Documentation maintainer
---
name: documentation-maintainer
description: Keep product documentation synchronized with code and release metadata.
tools:
- read
- search
- shell
---
Inspect the documentation style guide, public API references, changelog, and release notes.
Use the project's link checker and markdown linter. Update only the requested documentation scope,
keep examples executable, and list every changed page with the source file that supports it.
Do not invent product behavior or silently change a version number.
This profile is suitable for local work or for a cloud task that updates docs and opens a draft pull request. Require a link checker and a deterministic build where possible; the agent’s report should include failures rather than claiming success from an unrun command.
Test runner and validation agent
---
name: test-runner
description: Run focused tests and report reproducible failures.
tools:
- read
- search
- shell
---
Find the project's documented test commands before running anything. Start with the smallest
relevant suite, then expand when failures or changed interfaces require it. Record the exact
command, exit status, environment assumptions, and failing test names. Run format, lint, schema,
security scanning, and generated-artifact checks when they are defined by the repository policy.
Do not weaken tests or modify snapshots to hide a failure.
Deterministic validation, logging, scanning, and lifecycle automation belong in the procedure, not in a promise that the agent is “careful.” Require machine-readable output where the repository supports it, preserve logs as pull-request artifacts when policy allows, and define what happens on a timeout or flaky test.
Also popular on Amazon
How do I invoke a custom agent in Copilot CLI?
You have four practical choices: select one interactively, name it in natural language, let Copilot infer it from the task, or pass its ID programmatically. The CLI invocation modes are documented in GitHub’s CLI and cloud-agent task documentation.
Interactive selection
- Start Copilot CLI in the repository you intend to change.
- Enter
/agent. - Choose the profile from the list, then describe the task.
This is the safest way to confirm that the profile loaded and to see whether a project or personal agent is selected.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Natural-language or inferred selection
Ask for the specialist directly, for example: “Use the database migration reviewer to inspect the pending billing migration.” If the task description clearly matches one profile, Copilot can infer the agent. Inference is convenient, but explicit selection is preferable for regulated checks or any workflow where the tool set matters.
Programmatic invocation
copilot --agent security-auditor --prompt "Check /src/app/validator.go"
Use the filename-derived ID, not the display name shown in prose. In automation, open the correct repository first, verify the current branch, and capture the command output so a reviewer can reproduce the result.
How do I delegate work to Copilot cloud agent?
Delegation is a short handoff from an interactive CLI session to a GitHub-hosted worker. Use it for a bounded task with a clear acceptance test, not for an open-ended design decision that requires your immediate feedback.
- Open the correct repository. Confirm the remote, branch, and working directory. A custom agent and a delegate request are only useful if they target the intended codebase.
- Inspect the working tree. Run your normal status and diff checks. Copilot asks you to commit unstaged changes as a checkpoint in a new branch before delegation; do not skip this review. Your checkpoint makes it clear which changes existed before the cloud task.
- Write a bounded prompt. Include the files or subsystem, acceptance criteria, tests to run, constraints, and the desired review artifact. For example: “Complete the API integration tests in
tests/integration, fix failing edge cases in the client adapter, run the documented test runner, and summarize unresolved failures.” - Send the handoff. Enter either of these forms in the interactive CLI:
/delegate complete the API integration tests and fix any failing edge cases
& complete the API integration tests and fix any failing edge cases
/delegate --base main complete the API integration tests and fix any failing edge cases
- Wait for the cloud result. The agent works in the background, creates a branch, and opens a draft pull request. You can disconnect while it runs.
- Review before merging. Read the generated summary, inspect the diff, check the agent identity, review logs and test results, and run the repository’s required checks yourself or through CI. Resolve comments and convert the draft pull request only when the change meets your normal review standard.
The --base option is useful when the work must be based on a branch other than the repository’s default. Keep the prompt explicit about scope; “fix everything” is not a reliable acceptance criterion.
Can a custom agent be used during cloud delegation?
Yes. A project agent in .github/agents/ can define the specialist behavior used by a cloud-agent session, and GitHub can also use custom agents for issue assignments. Pull requests identify which custom agent was used, which helps reviewers verify that the intended rules and tool restrictions applied.
Design cloud profiles more conservatively than local profiles. A local unattended execution may have access to a developer’s checkout, while a cloud task should assume that every write will be reviewed through the pull request. State which files may change, which commands are safe, and which external systems are read-only. If the task needs a ticketing system, internal API, database, or cloud platform, document the approved integration and failure behavior instead of embedding credentials or asking the agent to guess endpoints.
When should I choose local unattended execution?
Choose local autopilot when you want hands-free execution but still need the current machine’s tools, filesystem, or immediate feedback. It is a good fit for interactive exploration, debugging, and core feature work where you expect to redirect the agent as soon as it encounters an ambiguity.
Before starting, open the correct repository, read the agent’s tool list, and decide which permissions are acceptable. Keep a clean checkpoint so you can distinguish Copilot’s edits from your own. Watch command output for destructive operations, generated files, and unexpected network access. Local unattended execution ends with the local process, so schedule a longer job only when you can keep the machine and session available.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
How do I inspect and accept the cloud result?
Treat the draft pull request as a proposal, not proof of correctness. Start with the changed-files list and compare it with the requested scope. Then inspect the implementation, tests, generated artifacts, configuration changes, and dependency updates. Confirm that the custom agent’s required checks actually ran and that their logs identify command lines and exit statuses.
- Check API contracts, migration ordering, compatibility, and error handling rather than only the happy path.
- Run deterministic validation: formatter, linter, schema or contract checker, unit and integration tests, security scanning, and documentation link checks where the repository requires them.
- Review lifecycle automation such as CI workflows, release scripts, cleanup jobs, and rollback instructions.
- Verify that no credentials, private data, or unrelated files entered the branch.
- Ask for a follow-up change in the pull request when a finding is clear; do not merge merely because the task completed.
For a database migration reviewer, inspect generated SQL and rollback or forward-fix behavior. For an API contract reviewer, compare the specification, handlers, generated clients, and contract tests. For a documentation maintainer, open rendered pages and follow links. For a test runner, reproduce failures from the recorded command before deciding whether they are environmental.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What repository rules should every custom agent follow?
Nearly every profile benefits from a short shared baseline:
Also popular on Amazon
- FAST RUNS IN THE FAMILY — The 16-inch MacBook Pro with the M5 Pro or M5 Max chip brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. With all-day battery life, double the starting storage,* and a breathtaking Liquid Retina XDR display, it’s pro in every way.*
- BUCKLE UP — Along with a next-generation CPU, faster unified memory, and up to 2x faster SSD storage,* M5 Pro and M5 Max feature a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance and on-device training capabilities. So you can blaze through demanding workloads at mind-bending speeds.
- BUILT FOR AI — Apple silicon, and every major component that powers it, is designed to run demanding on-device AI workloads like LLM inference and training. And Apple Intelligence helps you write, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
- ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.*
- MACOS RUNS APPS FAST — All your go-to apps run lightning fast in macOS, including built-in apps like FaceTime and Messages. Plus, built-in virus protection and free software updates help keep your Mac running smoothly and securely.
- Read the contribution guide, security policy, and relevant architecture notes before editing.
- Keep changes inside the requested scope and explain any necessary expansion.
- Prefer existing scripts and the repository’s test runner over ad-hoc replacements.
- Never expose secrets, credentials, customer records, or private URLs in output.
- Use deterministic checks and report exact commands, versions when relevant, and exit statuses.
- Do not disable validation, weaken tests, or suppress scanner findings to obtain a green result.
- Leave a clear summary of changed files, unresolved risks, and recommended follow-up.
- Ask for clarification when requirements conflict instead of silently choosing a risky interpretation.
Put organization-wide rules in the repository’s normal policy files as well as in profiles that need them. A custom agent should add focused expertise, not become a second, contradictory source of truth.
Free tools Windows power users keep installed
One-click scans. No signup required.
How do I handle tools, databases, tickets, and internal APIs safely?
Start with least privilege. A reviewer that only reads code needs read, search, and shell access; it does not need deployment, issue-closing, or database-write capability. If a task requires a database, ticketing system, cloud platform, or internal API, define an approved wrapper command or tool, a permitted environment, rate limits, and a read/write boundary.
For example, an issue-triage agent might read a ticket through a preconfigured command and return the ticket ID in its report, while a release agent might create a draft ticket but never close one. A migration agent can validate against a disposable or staging database but should be explicitly prohibited from connecting to production. Keep authentication outside the profile and ensure logs redact request headers and response bodies that may contain sensitive data.
Why is my new agent missing?
- Confirm the filename ends exactly in
.agent.md, with no hidden second extension. - Check that the file is in
.github/agents/or~/.copilot/agents/, not only ingithub/agents/,<plugin>/agents/, orclaude/agents/. - Restart Copilot CLI after creating or moving the file.
- Use
/agentto verify that the profile appears and inspect its derived ID. - Look for duplicate IDs between personal and repository scope; rename one if precedence is confusing.
- Check Markdown front matter and tool names against the current GitHub documentation.
If the CLI version is old, update the CLI through the installation method your organization uses, then restart Copilot and check again. Keep the profile compatible with the CLI version deployed on your machines and with the cloud-agent capabilities enabled for your account.
What makes a delegated prompt reliable?
State the objective, repository area, constraints, acceptance tests, and handoff format in one prompt. Include a stopping rule: for example, “If the integration environment is unavailable, do not invent results; report the blocked command and leave the code unchanged.” Ask for a concise summary of files changed, tests run, failures, and follow-up risks so the draft pull request is useful even when the task is incomplete.
/delegate --base main
Use the api-contract-reviewer profile. In src/payments, update integration tests for the
new timeout response. Do not change the public schema without documenting compatibility.
Run the documented contract validator and focused test runner. If an external service is
unavailable, record the exact failure and stop rather than fabricating a pass. Open a draft PR
with a summary of changed files, commands, results, and unresolved risks.
This structure also works for documentation updates, deterministic scanning, lifecycle automation, and a separate-module refactor. The narrower the acceptance criteria, the easier it is to inspect and merge the result.
How we picked the workflow
The recommendations above follow the documented distinction between local autopilot and asynchronous delegation, the supported project and user agent locations, filename-derived IDs, explicit and inferred invocation modes, tool restrictions, and draft-pull-request review. The choice is therefore based on execution location, continuity, reviewability, task shape, and permission control—not on an invented benchmark or a claim that one mode is universally faster.
Frequently Asked Questions
Does closing my terminal cancel a delegated Copilot task?
No. Delegation transfers the work to GitHub’s cloud agent, so it can continue after the local CLI session or computer is closed. You still need to return to GitHub and review the draft pull request and its checks.
Can I keep two custom agents with the same name?
You can have personal and repository profiles that resolve to the same ID, but precedence can make the selected behavior surprising. Use distinctive filenames or keep the shared profile in the repository so the team has one reviewed definition.
Should a custom agent be allowed to edit production code?
Only when editing is the agent’s explicit purpose and its tool set, scope, and review process allow it. Review-only agents such as contract or migration reviewers should use read, search, and approved validation commands and should report patches instead of silently applying them.
What happens if a cloud agent cannot access an internal service?
The prompt should require the agent to record the exact blocked command or dependency and stop or continue in a documented degraded mode. It should never fabricate test results; provide an approved wrapper, staging endpoint, or fixture if the task genuinely requires that service.
How do I tell which custom agent produced a pull request?
GitHub identifies the custom agent used for a cloud-agent session in the resulting pull request. Compare that identity with the expected profile and review the profile’s tool restrictions before evaluating the changes.

