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.
…- 1
Team rulesOn Team and Enterprise plans. They take precedence over project rules, and enforced ones can’t be turned off. - 2
.cursor/rules/*.mdcProject rules. Only.mdcfiles with frontmatter count, and.cursor/rulesfolders in subdirectories are found too. - 3
AGENTS.mdUltraciteAt the project root, applied as a rule alongside.cursor/rules. This is whereinitwrites Ultracite’s rules. - 4
CLAUDE.mdAlso read at the project root and applied the same way. - 5
src/**/AGENTS.mdA subdirectory’s file, applied when the agent works on files in that folder or below it. - 6
User 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
.mdcfiles in.cursor/ruleswithdescription,globsandalwaysApply. A plain.mdfile there is ignored; plain Markdown belongs inAGENTS.md.- Nesting
- An
AGENTS.mdin 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
@pathin a rule points the agent at a file it reads when needed. The file isn’t inlined.- Check it
/rulesin 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`- 01The agent edits a file in your project, or in a separate worktree with
--worktree. - 02Following
AGENTS.md, it proposesnpx ultracite fixornpx ultracite check. - 03You approve it, or a
Shell(...)permission in.cursor/cli.jsonlets it run without asking. - 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.jsonas well as.cursor/hooks.jsonand 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
afterFileEdithook gets the edited file’s path, which is whatinit --hooks cursoruses, but it has no output the agent reads.postToolUseis the event that can addadditional_contextafter 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, includingafterFileEdit, 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.initinstalls 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.mdandCLAUDE.mdat the project root and applies them as rules alongside.cursor/rules. NestedAGENTS.mdfiles apply when the agent works on files in their folder. - What is the Cursor CLI command called?
agent. Install it withcurl https://cursor.com/install -fsS | bash, then runagentin your project, oragent -pwith a prompt for a non-interactive run.- Does Cursor CLI support hooks?
- Yes. It runs project hooks from
.cursor/hooks.jsonand also reads Claude Code hooks from.claude/settings.json. Ultracite’s--hooks cursoroption writes anafterFileEdithook 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/rulesmust be.mdcfiles with frontmatter; a plain.mdfile there is ignored. Put plain Markdown inAGENTS.mdinstead. - How do I stop the agent asking before every lint?
- Add a
Shell(...)entry topermissions.allowin.cursor/cli.jsonfor the project, or~/.cursor/cli-config.jsonfor every project. A permission matches the command’s first token, soShell(npx)allows everynpxcommand, not justultracite.
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.
- AgentGitHub CopilotGitHub’s coding assistant: agent mode in editors, a CLI, and a cloud agent that opens pull requests.
- 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.