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

Cursor CLI applies AGENTS.md as a rule

The Cursor CLI (agent) reads AGENTS.md and CLAUDE.md at the project root and applies them as rules alongside .cursor/rules, so Ultracite’s rules load with no extra file. Ultracite doesn’t add a Cursor CLI hook: the agent runs ultracite fix and ultracite check because the rules say to, once you approve the command or allow it in .cursor/cli.json.

Cursor CLI by AnysphereChecked against Cursor CLI 2026.09.28

# 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 Cursor CLI looks for instructions
  1. 1Team rulesOn Team and Enterprise plans. They take precedence over project rules, and enforced ones can’t be turned off.
  2. 2.cursor/rules/*.mdcProject rules. Only .mdc files with frontmatter count, and .cursor/rules folders in subdirectories are found too.
  3. 3AGENTS.mdUltraciteAt the project root, applied as a rule alongside .cursor/rules. This is where init writes Ultracite’s rules.
  4. 4CLAUDE.mdAlso read at the project root and applied the same way.
  5. 5src/**/AGENTS.mdA subdirectory’s file, applied when the agent works on files in that folder or below it.
  6. 6User rulesYour preferences from Customize → Rules, used in every project, with the lowest precedence.

How Cursor CLI reads the rules

Cursor merges every rule that applies, with team rules taking precedence over project rules and project rules over user rules. AGENTS.md needs no frontmatter: it’s plain Markdown that the CLI applies as a rule.

Project rules
.mdc files in .cursor/rules with description, globs and alwaysApply. A plain .md file there is ignored; plain Markdown belongs in AGENTS.md.
Nesting
An AGENTS.md in a subdirectory applies to files there, combined with its parents’; the more specific one wins.
Precedence
Team rules, then project rules, then user rules. All are merged, and earlier sources win on conflicts.
Size
Cursor suggests keeping each rule under 500 lines. Ultracite’s rules are about 125.
File references
@path in a rule points the agent at a file it reads when needed. The file isn’t inlined.
Check it
/rules in the CLI opens an interactive browser of your rules, with inline editing.

A Shell permission for ultracite

The CLI asks before it runs a terminal command unless a permission covers it. The rules give the agent ultracite fix and ultracite check, so approving them, or allowing them in .cursor/cli.json, is all the setup the loop needs.

- **Format code**: `npx ultracite fix`
- **Check for issues**: `npx ultracite check`
- **Diagnose setup**: `npx ultracite doctor`
What the rules tell it to run
  1. 01The agent edits a file in your project, or in a separate worktree with --worktree.
  2. 02Following AGENTS.md, it proposes npx ultracite fix or npx ultracite check.
  3. 03You approve it, or a Shell(...) permission in .cursor/cli.json lets it run without asking.
  4. 04The agent reads the linter’s output and fixes what’s left.

Worth knowing about Cursor CLI

  • It reads Claude Code hooks

    The CLI reads hooks from .claude/settings.json as well as .cursor/hooks.json and merges them. If you’ve set up Ultracite’s Claude Code hook, the Cursor CLI loads that file too.

  • afterFileEdit can’t talk back

    Cursor’s afterFileEdit hook gets the edited file’s path, which is what init --hooks cursor uses, but it has no output the agent reads. postToolUse is the event that can add additional_context after a tool result.

  • Cloud handoff keeps project hooks

    Start a message with & to send the session to a Cloud Agent. Cloud agents run the project’s .cursor/hooks.json, including afterFileEdit, but not hooks from your home directory, and none during early read-only turns.

  • The Ultracite skill

    The Cursor CLI loads skills from .agents/skills/ and .cursor/skills/, and for compatibility from .claude/skills/ and .codex/skills/, in interactive and headless runs. init installs the Ultracite skill into .agents/skills/, so the agent finds it; type / to pick it.

Cursor CLI questions, answered

Does Cursor CLI read AGENTS.md?
Yes. The CLI reads AGENTS.md and CLAUDE.md at the project root and applies them as rules alongside .cursor/rules. Nested AGENTS.md files apply when the agent works on files in their folder.
What is the Cursor CLI command called?
agent. Install it with curl https://cursor.com/install -fsS | bash, then run agent in your project, or agent -p with a prompt for a non-interactive run.
Does Cursor CLI support hooks?
Yes. It runs project hooks from .cursor/hooks.json and also reads Claude Code hooks from .claude/settings.json. Ultracite’s --hooks cursor option writes an afterFileEdit hook to .cursor/hooks.json, but that event has no output the agent sees, so whatever the fix leaves isn’t passed back.
Why doesn’t Cursor pick up my .md rule?
Project rules in .cursor/rules must be .mdc files with frontmatter; a plain .md file there is ignored. Put plain Markdown in AGENTS.md instead.
How do I stop the agent asking before every lint?
Add a Shell(...) entry to permissions.allow in .cursor/cli.json for the project, or ~/.cursor/cli-config.json for every project. A permission matches the command’s first token, so Shell(npx) allows every npx command, not just ultracite.

Ship less slop

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