One Copilot hook, three places it runs
Copilot’s cloud agent, code review and CLI all read AGENTS.md, so Ultracite’s rules reach each of them from one file. init --hooks copilot adds a postToolUse hook that runs ultracite fix on the file Copilot just edited. In VS Code’s Local agent, what the fix leaves goes back to the model; in the CLI and cloud agent, the fixes land and the rest is left to the commands in the rules.
GitHub Copilot by GitHubChecked against October 2026
# Ultracite Code Standards
This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
## Quick Reference
- **Format code**: `npx ultracite fix`
- **Check for issues**: `npx ultracite check`
- **Diagnose setup**: `npx ultracite doctor`
Oxlint + Oxfmt (the underlying engine) provides robust linting and formatting. Most issues are automatically fixable.
…- 1
~/.copilot/copilot-instructions.mdYour instructions for every repository, in the Copilot CLI. - 2
.github/copilot-instructions.mdRepository-wide instructions, applied to every request made in the repository. - 3
.github/instructions/*.instructions.mdPath-specific: included only when theapplyToglob matches a file Copilot is working on. - 4
AGENTS.mdUltraciteAgent instructions for the cloud agent, code review and the CLI. With several in the tree, the nearest one takes precedence. - 5
CLAUDE.md or GEMINI.mdAlso read as agent instructions: at the repository root by the cloud agent, and wherever the CLI looks forAGENTS.md.
How GitHub Copilot reads the rules
Copilot combines every instructions file that applies instead of picking one. AGENTS.md sits alongside .github/copilot-instructions.md and path-specific .instructions.md files, and when there are several, the nearest AGENTS.md takes precedence.
- Combined
- Every file that applies goes into the prompt. The CLI drops identical duplicates but sets no order between different files, so avoid conflicting instructions.
- Nearest wins
- With several
AGENTS.mdfiles, the one nearest the code Copilot is working on takes precedence. - Path-specific
.github/instructions/*.instructions.mdfiles apply only when theirapplyToglob matches.excludeAgentkeeps one from code review or the cloud agent.- Code review
- Reads
AGENTS.md, repository and path-specific instructions, and skills from the pull request’s head branch. - Imports
- In
AGENTS.md,CLAUDE.mdand.github/copilot-instructions.md, the CLI expands@pathreferences to files inside the repository. - Check it
/instructionsin the Copilot CLI lists every file it found. Edits take effect in the next session.
A postToolUse hook on every edit
init --hooks copilot writes .github/hooks/ultracite.json in the Copilot format (version: 1, camelCase events), which the Copilot CLI and cloud agent read and VS Code maps onto its own. The hook has no matcher, so it runs after every tool, and ultracite fix --hook skips the tools that don’t edit files.
{
"hooks": {
"postToolUse": [
{
"command": "npx ultracite fix --hook",
"type": "command"
}
]
},
"version": 1
}- 01Copilot creates or edits a file, in VS Code, the CLI or a cloud agent session.
- 02The hook runs
ultracite fix --hook, which reads the edited path from the payload and fixes just that file. - 03In VS Code’s Local agent, problems left go to stderr with exit code 2, and the model reads them before its next step.
- 04In the CLI and cloud agent, the hook’s output isn’t passed to the model, so Copilot finds anything left by running
ultracite check.
Worth knowing about GitHub Copilot
The cloud agent needs the hook merged
Copilot cloud agent only uses a hooks file that’s on your default branch, and in its Linux sandbox
.github/hooks/*.jsonis the only hook config there is. Mergeultracite.jsonbefore you assign Copilot an issue.Code review reads the same rules
Copilot code review reads
AGENTS.md, path-specific instructions and skills from the pull request’s head branch, not the base branch, so you can test a change to the rules in the same pull request.VS Code depends on the session target
In VS Code, the Local agent maps the Copilot hook format onto its own and passes stderr to the model on exit code 2. A Copilot session on the Agent Host follows GitHub’s hooks reference instead, where that output only reaches you.
The Ultracite skill
Copilot loads project skills from
.github/skills,.claude/skillsor.agents/skillsin the cloud agent, code review, the CLI and agent mode in VS Code.initinstalls the Ultracite skill into.agents/skills/, so Copilot finds it.
GitHub Copilot questions, answered
- Does GitHub Copilot read AGENTS.md?
- Yes. The cloud agent, code review and the Copilot CLI all read it. The nearest
AGENTS.mdin the tree takes precedence, and it’s combined with.github/copilot-instructions.mdrather than replacing it. - Why doesn’t the Copilot CLI see what the hook couldn’t fix?
- For
postToolUse, the Copilot CLI and cloud agent treat exit code 2 as a warning shown to you, not feedback for the model; only JSON output such asadditionalContextreaches it. VS Code’s Local agent passes a hook’s stderr to the model on exit code 2, so there the agent sees what’s left. - Why isn’t my hook running in the Copilot cloud agent?
- Check that
.github/hooks/ultracite.jsonis on the default branch, is valid JSON and hasversion: 1. Hooks also time out after 30 seconds by default; raisetimeoutSecif a fix takes longer. - How do I check which instructions Copilot loaded?
- In the Copilot CLI, run
/instructionsto list the files it found and turn any of them off. The CLI reads instruction files when a session starts, so exit and resume (copilot --continue) or start a new session after editing them. - Does the Copilot CLI read Claude Code hooks?
- Yes. Besides
.github/hooks/*.json, it reads hooks from.claude/settings.jsonand.claude/settings.local.jsonin the repository and combines every source. The cloud agent reads only.github/hooks/*.json.
Keep going
- AgentClaude CodeAnthropic’s agentic coding tool that edits files and runs commands from your terminal, IDE or desktop.
- AgentCodexOpenAI’s coding agent for the terminal, IDEs, the ChatGPT desktop app and cloud tasks.
- AgentCursor CLIThe Cursor agent in your terminal, interactive or headless.
- DocsAgent rulesWhat
initwrites for every agent, and how to keep it current.
Ship less slop
One command sets up your linter, formatter, editor and agents. Works with Oxlint, Biome and ESLint.