Hello, this is made by ChatGPT, and I have read it.
I have not tried Background Agent myself, YET, so I can not answer questions, but I thought that it could be a starting point for learning more and sharing experiences.
1. Prerequisites
-
GitHub repo (public or private).
-
GitHub account connected to Cursor with appropriate permissions.
-
Project should be able to run in Ubuntu-based container.
-
Optionally include:
-
.cursor/environment.json
→ installs dependencies. -
Dockerfile
→ for full custom environments.
-
-
Project should be in good structure (agent scans and analyzes it).
2. Starting a Background Agent
-
From Cursor App:
-
Press
Ctrl+E
(orCmd+E
on Mac). -
Type your task as a prompt.
-
Select “Background Agent”.
-
-
From Web Interface:
-
Go to https://cursor.com/agents.
-
Write your prompt and select repo/task.
-
-
From Slack (optional):
- If integrated, send prompts to agent bot.
3. What the Agent Does
-
Spawns a remote container in Cursor’s cloud (not GitHub or your machine).
-
Clones your GitHub repo into the container.
-
Reads the codebase, understands structure and logic.
-
Executes the prompt:
- Writes code, refactors, adds tests, edits docs, etc.
-
Commits to a new branch and pushes to GitHub.
-
Updates
progress.md
(if prompted to).
4. Prompting Style
-
Use clear, intent-based prompts, e.g.:
-
“Implement feature in docs/feature_x.md and update progress.md”
-
“Refactor legacy code in utils/logger.py to follow SOLID principles”
-
-
Avoid overly procedural prompts like:
- “First open X file, then insert Y function…” (Agent figures this out itself).
5. Will the Agent Use My Rules?
-
Yes, if rules are present in:
-
.cursor/rules.json
-
.cursor/config.json
-
.cursor/settings.json
-
-
Agent respects your rules (e.g.,
DRY
,SOLID
,SRP
) if defined. -
Agent does not read your “intentions” unless they’re formalized in those files or reiterated in the prompt.
Pro Tip: Minimal Setup Example
📁 docs/features/login.md:
- Add login page with username & password fields.
- POST to /api/auth/login.
- Display error messages.
📁 .cursor/environment.json:
{
"packages": ["requests", "flask", "pytest"]
}
📁 .cursor/rules.json:
["Follow DRY", "Use SOLID principles", "Prefer async for I/O-bound ops"]
🔁 Prompt:
Analyze docs/features/login.md, write an implementation plan in the same folder, then implement it and track in progress.md.