Skip to content
Ultracite
Esc
↑↓navigate↵open⌘Jpreview

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.

…
Ultracite’s rules
Where GitHub Copilot looks for instructions
  1. 1~/.copilot/copilot-instructions.mdYour instructions for every repository, in the Copilot CLI.
  2. 2.github/copilot-instructions.mdRepository-wide instructions, applied to every request made in the repository.
  3. 3.github/instructions/*.instructions.mdPath-specific: included only when the applyTo glob matches a file Copilot is working on.
  4. 4AGENTS.mdUltraciteAgent instructions for the cloud agent, code review and the CLI. With several in the tree, the nearest one takes precedence.
  5. 5CLAUDE.md or GEMINI.mdAlso read as agent instructions: at the repository root by the cloud agent, and wherever the CLI looks for AGENTS.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.md files, the one nearest the code Copilot is working on takes precedence.
Path-specific
.github/instructions/*.instructions.md files apply only when their applyTo glob matches. excludeAgent keeps 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.md and .github/copilot-instructions.md, the CLI expands @path references to files inside the repository.
Check it
/instructions in 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
}
init --hooks copilot
  1. 01Copilot creates or edits a file, in VS Code, the CLI or a cloud agent session.
  2. 02The hook runs ultracite fix --hook, which reads the edited path from the payload and fixes just that file.
  3. 03In VS Code’s Local agent, problems left go to stderr with exit code 2, and the model reads them before its next step.
  4. 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/*.json is the only hook config there is. Merge ultracite.json before 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/skills or .agents/skills in the cloud agent, code review, the CLI and agent mode in VS Code. init installs 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.md in the tree takes precedence, and it’s combined with .github/copilot-instructions.md rather 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 as additionalContext reaches 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.json is on the default branch, is valid JSON and has version: 1. Hooks also time out after 30 seconds by default; raise timeoutSec if a fix takes longer.
How do I check which instructions Copilot loaded?
In the Copilot CLI, run /instructions to 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.json and .claude/settings.local.json in the repository and combines every source. The cloud agent reads only .github/hooks/*.json.

Ship less slop

One command sets up your linter, formatter, editor and agents. Works with Oxlint, Biome and ESLint.