Add Cursor Agent CLI profile (cursor-agent)#135
Conversation
Ship a built-in `cursor` profile using headless `--print`/`--trust`, the Copilot hooks dialect at `.cursor/hooks.json`, and SKILL.md-by-path prompts. Document SessionEnd-based completion, probe transcript discovery, and E2E coverage for review, stop/resume, worktrees, and sweeps. Co-authored-by: Cursor <[email protected]>
WalkthroughAdds a built-in Cursor Agent CLI profile with unattended launch settings, skills and hooks configuration, transcript discovery, lifecycle hook tests, and documentation updates across setup, policy, README, features, and changelog materials. ChangesCursor CLI support
Estimated code review effort: 2 (Simple) | ~15 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
docs/setup-guide.md (1)
201-206: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFirst-run note omits
--forceand--approve-mcpsfrom the unattended path.The README table (line 505) lists all four bypass flags, but this setup-guide entry only mentions
--trust. Minor inconsistency — the setup guide is the primary walkthrough users follow.📝 Suggested alignment
-- **cursor** — run `cursor-agent login` once. The profile launches headless with `--print` - + `--trust` (interactive `--trust` is rejected). Skills live in `.agents/skills/`; hooks +- **cursor** — run `cursor-agent login` once. The profile launches headless with `--print` + + `--force` + `--trust` + `--approve-mcps` (interactive `--trust` is rejected without `--print`). Skills live in `.agents/skills/`; hooks🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/setup-guide.md` around lines 201 - 206, Update the cursor entry in the setup guide to include --force and --approve-mcps alongside the existing --print and --trust flags for the unattended first-run path, keeping the surrounding CLI, hooks, and token-usage guidance unchanged.docs/FEATURES.md (1)
130-130: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueCursor entry omits
--forceand--approve-mcpsfrom the unattended path.The README table (line 505) documents the full unattended path as
--force+--trust+--approve-mcps, but this FEATURES.md entry condenses it to just--trust. Consider aligning for completeness.📝 Suggested alignment
-`cursor` (Cursor Agent CLI `cursor-agent`; unattended `--print` + `--trust`; SessionEnd + window-death; `usage_parser = "none"` until transcripts expose tokens). +`cursor` (Cursor Agent CLI `cursor-agent` / `agent`; unattended `--print` + `--force` + `--trust` + `--approve-mcps`; SessionEnd + window-death; `usage_parser = "none"` until transcripts expose tokens).🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/FEATURES.md` at line 130, Update the Cursor entry in the supported E2E-verified list to document the complete unattended `cursor-agent` invocation, including `--print`, `--force`, `--trust`, and `--approve-mcps`, while preserving the existing SessionEnd, window-death, and usage-parser details.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/bmad_loop/probe.py`:
- Around line 64-66: Update the Cursor transcript discovery call in the probe
logic to pass recursive=True to glob.glob when using the
“~/.cursor/projects/*/agent-transcripts/**/*.jsonl” pattern, ensuring
transcripts in nested directories are discovered.
---
Nitpick comments:
In `@docs/FEATURES.md`:
- Line 130: Update the Cursor entry in the supported E2E-verified list to
document the complete unattended `cursor-agent` invocation, including `--print`,
`--force`, `--trust`, and `--approve-mcps`, while preserving the existing
SessionEnd, window-death, and usage-parser details.
In `@docs/setup-guide.md`:
- Around line 201-206: Update the cursor entry in the setup guide to include
--force and --approve-mcps alongside the existing --print and --trust flags for
the unattended first-run path, keeping the surrounding CLI, hooks, and
token-usage guidance unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5f2473de-047b-4437-8154-7a10a1f3a14d
📒 Files selected for processing (12)
CHANGELOG.mdREADME.mddocs/FEATURES.mddocs/setup-guide.mdsrc/bmad_loop/cli.pysrc/bmad_loop/data/profiles/cursor.tomlsrc/bmad_loop/data/skills/bmad-loop-setup/SKILL.mdsrc/bmad_loop/data/skills/bmad-loop-setup/scripts/cleanup-legacy.pysrc/bmad_loop/policy.pysrc/bmad_loop/probe.pytests/test_probe.pytests/test_profile.py
| # Cursor Agent CLI: sessionEnd.transcript_path points at a jsonl under this | ||
| # tree. No token fields yet (usage_parser = "none"); glob is for discovery. | ||
| "cursor": "~/.cursor/projects/*/agent-transcripts/**/*.jsonl", |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if any cursor agent-transcripts exist and their depth under agent-transcripts/
fd -t f -e jsonl . ~/.cursor/projects/*/agent-transcripts/ 2>/dev/null | head -20 || echo "No cursor transcripts found"Repository: bmad-code-org/bmad-loop
Length of output: 161
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Map the file and inspect the relevant range.
wc -l src/bmad_loop/probe.py
cat -n src/bmad_loop/probe.py | sed -n '220,270p'
# Find the glob call sites and family patterns.
rg -n "glob\.glob|Path\.glob|FAMILY_GLOBS|agent-transcripts|recursive=True" src/bmad_loop/probe.pyRepository: bmad-code-org/bmad-loop
Length of output: 2649
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import glob
import os
import tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as d:
root = Path(d)
(root / "a" / "b").mkdir(parents=True)
(root / "a" / "b" / "x.jsonl").write_text("{}\n")
(root / "a" / "x.jsonl").write_text("{}\n")
pattern = str(root / "**" / "*.jsonl")
print("pattern:", pattern)
print("glob.glob(...):", sorted(glob.glob(pattern)))
print("glob.glob(..., recursive=True):", sorted(glob.glob(pattern, recursive=True)))
print("Path.glob('**/*.jsonl'):", sorted(str(p) for p in root.glob("**/*.jsonl")))
PYRepository: bmad-code-org/bmad-loop
Length of output: 428
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import glob
import tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as d:
root = Path(d)
(root / "a" / "b").mkdir(parents=True)
(root / "a" / "b" / "x.jsonl").write_text("{}\n")
(root / "a" / "x.jsonl").write_text("{}\n")
pattern = str(root / "**" / "*.jsonl")
print("pattern:", pattern)
print("glob.glob(...):", sorted(glob.glob(pattern)))
print("glob.glob(..., recursive=True):", sorted(glob.glob(pattern, recursive=True)))
print("Path.glob('**/*.jsonl'):", sorted(str(p) for p in root.glob("**/*.jsonl")))
PYRepository: bmad-code-org/bmad-loop
Length of output: 428
Pass recursive=True for the Cursor glob src/bmad_loop/probe.py:248
glob.glob() only treats ** recursively with recursive=True; otherwise this pattern falls back to a single-level match and can miss deeper transcript paths under agent-transcripts/.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/bmad_loop/probe.py` around lines 64 - 66, Update the Cursor transcript
discovery call in the probe logic to pass recursive=True to glob.glob when using
the “~/.cursor/projects/*/agent-transcripts/**/*.jsonl” pattern, ensuring
transcripts in nested directories are discovered.
Stream NDJSON to the TUI Log via pipe-pane, and note that native Windows attach/Log stay limited under --print. Co-authored-by: Cursor <[email protected]>
Summary
cursorTOML profile for the Cursor Agent CLI (cursor-agent/agent) sobmad-loop init --cli cursorworks out of the box.--print+--output-format stream-json+--stream-partial-output+--force+--trust+--approve-mcps(--trustis rejected without--print). Stream-json feeds the TUI Log tab viapipe-pane(closest parity to Claude scrollback)..agents/skills/; hooks use the Copilot settings dialect at.cursor/hooks.json.sessionEnd+ window-death (stopis registered but was not observed in E2E). Token usage staysusage_parser = none; probe discovery glob is~/.cursor/projects/*/agent-transcripts/**/*.jsonl.Platform notes (from bring-up)
tmux. That is where Log + validate behave like other adapters.pipe-pane/psmux often leaves the TUI Log empty; attach (a) stays sparse under--printby design. Do not drop--printto “fix” attach — interactive Cursor stalls on Workspace Trust./mnt/...in WSL (CRLF false dirty tree). Use a Linux-filesystem clone.Test plan
stream-jsonlaunch_argsbmad-loop init --cli cursor+bmad-loop validateon Linux/WSL with Cursor Agent logged inInterim project overlay kit (same flags): https://github.com/VaporFlow/bmad-loop-cursor-adapter
Summary by CodeRabbit
New Features
cursor-agentprofile with skills loading, hook handling, session lifecycle termination behavior, and transcript discovery.Documentation
Tests