Skip to content

Add Cursor Agent CLI profile (cursor-agent)#135

Open
VaporFlow wants to merge 2 commits into
bmad-code-org:mainfrom
VaporFlow:feat/cursor-agent-profile
Open

Add Cursor Agent CLI profile (cursor-agent)#135
VaporFlow wants to merge 2 commits into
bmad-code-org:mainfrom
VaporFlow:feat/cursor-agent-profile

Conversation

@VaporFlow

@VaporFlow VaporFlow commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • Add a built-in cursor TOML profile for the Cursor Agent CLI (cursor-agent / agent) so bmad-loop init --cli cursor works out of the box.
  • Unattended path uses --print + --output-format stream-json + --stream-partial-output + --force + --trust + --approve-mcps (--trust is rejected without --print). Stream-json feeds the TUI Log tab via pipe-pane (closest parity to Claude scrollback).
  • Skills live in .agents/skills/; hooks use the Copilot settings dialect at .cursor/hooks.json.
  • Completion relies on sessionEnd + window-death (stop is registered but was not observed in E2E). Token usage stays usage_parser = none; probe discovery glob is ~/.cursor/projects/*/agent-transcripts/**/*.jsonl.
  • Docs/setup/CHANGELOG/badge updates; profile load + prompt-render tests.

Platform notes (from bring-up)

  • Prefer Linux / Ubuntu / WSL2 with real tmux. That is where Log + validate behave like other adapters.
  • Native Windows can run, but pipe-pane/psmux often leaves the TUI Log empty; attach (a) stays sparse under --print by design. Do not drop --print to “fix” attach — interactive Cursor stalls on Workspace Trust.
  • Avoid running the loop on a Windows checkout mounted at /mnt/... in WSL (CRLF false dirty tree). Use a Linux-filesystem clone.

Test plan

  • Profile/unit expectations updated for stream-json launch_args
  • Local E2E in a BMAD project with this profile (sprint story / review path)
  • CI green on this PR
  • Maintainer: bmad-loop init --cli cursor + bmad-loop validate on Linux/WSL with Cursor Agent logged in
  • Spot-check TUI Log tab receives stream-json events on Linux

Interim project overlay kit (same flags): https://github.com/VaporFlow/bmad-loop-cursor-adapter

Summary by CodeRabbit

  • New Features

    • Added built-in support for the Cursor Agent CLI, including an unattended cursor-agent profile with skills loading, hook handling, session lifecycle termination behavior, and transcript discovery.
  • Documentation

    • Updated the README, changelog, feature docs, and setup guide to advertise Cursor support, explain login/trust prerequisites, document where Cursor skills/hooks live, and add Cursor to adapter/profile option tables.
  • Tests

    • Expanded profile and probe test coverage to include the Cursor profile and transcript/hook registration behavior.

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]>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Adds 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.

Changes

Cursor CLI support

Layer / File(s) Summary
Cursor profile and prompt behavior
src/bmad_loop/data/profiles/cursor.toml, tests/test_profile.py
Defines Cursor Agent launch, skills, prompt, usage-parser, and hook settings, with tests covering profile loading, defaults, and prompt rendering.
Hooks and transcript discovery
src/bmad_loop/probe.py, tests/test_probe.py
Adds Cursor transcript glob discovery and includes Cursor in native hook registration coverage.
Adapter wiring and documentation
src/bmad_loop/cli.py, src/bmad_loop/policy.py, README.md, docs/*, src/bmad_loop/data/skills/*, CHANGELOG.md
Lists Cursor among supported profiles and documents its setup, skills, hooks, authentication, trust, and operational behavior.

Estimated code review effort: 2 (Simple) | ~15 minutes

Poem

I’m a rabbit with Cursor, hopping through code,
A new profile carries the workload.
Skills by path and hooks in a row,
Transcripts bloom where agent files flow.
Tests thump softly: the settings are right—
Cursor now joins the CLI night.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a new Cursor Agent CLI profile.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
docs/setup-guide.md (1)

201-206: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

First-run note omits --force and --approve-mcps from the unattended path.

The README table (line 505) lists all four bypass flags, but this setup-guide entry only mentions --print + --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 value

Cursor entry omits --force and --approve-mcps from the unattended path.

The README table (line 505) documents the full unattended path as --print + --force + --trust + --approve-mcps, but this FEATURES.md entry condenses it to just --print + --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

📥 Commits

Reviewing files that changed from the base of the PR and between cb17076 and 2d14a90.

📒 Files selected for processing (12)
  • CHANGELOG.md
  • README.md
  • docs/FEATURES.md
  • docs/setup-guide.md
  • src/bmad_loop/cli.py
  • src/bmad_loop/data/profiles/cursor.toml
  • src/bmad_loop/data/skills/bmad-loop-setup/SKILL.md
  • src/bmad_loop/data/skills/bmad-loop-setup/scripts/cleanup-legacy.py
  • src/bmad_loop/policy.py
  • src/bmad_loop/probe.py
  • tests/test_probe.py
  • tests/test_profile.py

Comment thread src/bmad_loop/probe.py
Comment on lines +64 to +66
# 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",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.py

Repository: 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")))
PY

Repository: 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")))
PY

Repository: 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.

@VaporFlow VaporFlow closed this Jul 13, 2026
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]>
@VaporFlow VaporFlow reopened this Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant