Google Analytics, Vercel Web Analytics, Leadsy and the TikTok Pixel stay off until you accept. The help chat starts once you have chosen. The scheduling button starts once you have chosen. Read our Privacy Policy.

Skip to content
StellarFirmStellarFirm

Platforms

Cursor and OpenAI Codex agent tips: rules and AGENTS.md

Tips for Cursor and OpenAI Codex from their docs: project rules, AGENTS.md, background and cloud agents, MCP, and review habits, with copy-ready prompts.

StellarFirm team5 min read

View as Markdown
On this page

Cursor and OpenAI Codex are two popular ways to work with a coding agent, and each rewards the same habit: write your project's instructions down where the agent will read them. This guide collects stable tips from the official documentation of each tool, so you can set up your repository once and get steadier results. Product names, menus, and limits change often, so confirm details in the linked docs.

How do I give Cursor lasting instructions?#

Cursor reads project rules from files in your repository, so the agent starts every task knowing your conventions. The docs describe project rules stored in a rules folder inside the project, plus user level rules in your settings that apply everywhere.

Write rules the way you would brief a new teammate:

  • The commands to build, test, and lint.
  • Conventions the code follows, such as naming or error handling.
  • Things the agent must not touch.
  • Where to find examples of the pattern you want repeated.

Keep each rule short and specific. Several small, focused rules are easier for the agent to apply than one long essay.

PromptDraft Cursor project rules

Read this repository and propose project rules for the agent. Give me a short list of rules in plain Markdown: how to build, test, and lint, the conventions the code follows, and what must never be edited. Mark anything you are unsure about instead of guessing.

What is AGENTS.md and who reads it?#

AGENTS.md is a plain Markdown file in your repository that tells coding agents how to work there. Codex documents it as the way to guide the agent, and Cursor documents it as a simpler alternative to its own rules. The format is described at agents.md, and it is meant to be shared across tools.

A useful AGENTS.md has the same short sections for every tool:

SectionWhat to put there
SetupHow to install dependencies and run the project
ChecksThe exact commands that must pass before a change is done
ConventionsStyle, structure, naming
BoundariesFiles and areas not to change, and when to ask first
Pull requestsTitle format, size, what to include in the description

Because it is one file, a team that uses several agents keeps one source of truth. We cover the file and its website cousin llms.txt in making a codebase and a website agent-ready.

PromptWrite an AGENTS.md

Create an AGENTS.md for this repository with sections for setup, checks, conventions, boundaries, and pull requests. Use only commands you can verify in the repository, and keep it under 80 lines. List anything you could not verify at the end.

How should I use OpenAI Codex?#

Codex works as a command line tool and as a cloud agent, and in either form it reads your AGENTS.md and works through a task you describe. The documentation explains that you choose how much freedom the agent has, through approval and sandbox settings, so start with the stricter options and loosen them as you build trust.

Habits that help:

  • Give one task with a clear finish line, such as "make this failing test pass".
  • Tell it which command proves the task is done.
  • Keep the task small enough to review in one sitting.
  • Read the diff and run the checks yourself before merging.
PromptA well specified Codex task

In this repository, fix the failing test [test name]. Reproduce it first with [test command], find the cause, make the smallest change that fixes it, and run [test command] again. Summarize what was wrong and what you changed. Do not touch unrelated files.

What are background agents good for?#

Background or cloud agents run a task away from your open editor, so you can keep working while they finish. They suit tasks that are independent, well specified, and easy to check, such as dependency bumps, small bug fixes, and adding tests.

A good background task has:

IngredientExample
A single outcome"Add tests for the date helpers"
A way to check it"The test command passes"
Limits"Do not change public function names"
A return format"Open a pull request with a summary"

Because nobody watches the agent work, the review step matters more. Read the diff, check the tests ran, and reject changes you do not understand. The same logic is behind the Approve step in StellarFirm: see approval workflows for AI agents.

PromptBrief a background agent

Task: [one outcome]. Context: [where the code is and what it does]. Done when: [command] passes and no other files change. Limits: do not rename public functions or add dependencies. Return: a pull request with a short summary, the commands you ran, and anything you were unsure about.

Can I connect tools with MCP?#

Yes. Cursor and Codex can each use MCP servers, the open standard that lets an agent call tools on other services. Each has its own configuration, so follow the official docs for the current format. Add only servers you trust, and give them the least access that works.

StellarFirm runs a public, read only MCP server at https://stellarfirm.ai/mcp. In Cursor you add it with a small entry in the MCP configuration file, and the exact JSON is on the MCP server page. It can answer questions about StellarFirm and search its docs. It cannot sign anyone up, send anything, or approve anything. Our MCP guide explains the concepts.

How does this work with the StellarFirm Coder?#

If you already work in Cursor or VS Code, the StellarFirm desktop app lets the Coder meet you there. It can open a file in your editor and apply a change to a project folder you choose on your own computer. Changes land as ordinary edits, so your editor's undo and version control show what happened, and publishing still waits for your Approve. See Cursor and VS Code.

PromptHand a fix to your editor

Coder, fix [problem] in the project I have open and apply the change in my editor. Show me the diff in Jobs. Open a pull request only after I Approve.

Whichever tool you use, the pattern is the same: write the rules once, give small tasks, and review what comes back. For StellarFirm specifics, start with your first week with the Coder.

Frequently asked questions

What is the difference between Cursor rules and AGENTS.md?

Cursor project rules are files in a rules folder that Cursor loads into the agent's context, with options for when they apply. AGENTS.md is a plain Markdown file in the repository that several tools read. Cursor documents support for it as a simple alternative to rules.

Does OpenAI Codex read AGENTS.md?

Yes. OpenAI's Codex documentation describes AGENTS.md files as the place to give Codex guidance about how to work in a repository, such as how to run tests.

What are background agents?

They are agents that run a task in a remote environment instead of in your open editor, so you can keep working. Check the Cursor and Codex docs for how each product names and configures them.

Can StellarFirm work with Cursor?

Yes. From the StellarFirm desktop app the Coder can open a path and apply a change in Cursor or VS Code on your computer. Pushing a branch or opening a pull request still waits for your Approve.

Sources