Skip to content

Add CodeFlow - Multi-Agent Orchestration with CDP Patrol Engine for Cursor IDE#254

Open
joinwell52-AI wants to merge 7 commits intoPatrickJS:mainfrom
joinwell52-AI:add-codeflow
Open

Add CodeFlow - Multi-Agent Orchestration with CDP Patrol Engine for Cursor IDE#254
joinwell52-AI wants to merge 7 commits intoPatrickJS:mainfrom
joinwell52-AI:add-codeflow

Conversation

@joinwell52-AI
Copy link
Copy Markdown

@joinwell52-AI joinwell52-AI commented Apr 14, 2026

What is CodeFlow?

CodeFlow is a human-AI collaboration hub for multi-agent teams in Cursor IDE.

Core Innovation: CDP Patrol Engine

CodeFlow uses Chrome DevTools Protocol to monitor and control Cursor IDE agents — replacing fragile OCR with precise DOM inspection:

OCR (legacy) CDP (CodeFlow)
Accuracy ~90% (font/DPI dependent) 100% (reads DOM directly)
Latency 300-800ms 10-15ms
Agent detection Screenshot + image recognition div[role='tab'] + aria-selected
Busy detection Guessing spinner chars from pixels Stop button visibility + status text
Click method pyautogui.click(x,y) screen coords Input.dispatchMouseEvent window coords

CDP reads Cursor's tab bar (div[role='tab']) and agent sidebar (span.agent-sidebar-cell-text) to identify all agents, detect active/busy states, switch roles via native mouse events, and send messages by bypassing React controlled components.

Graceful degradation: Every CDP operation falls back to OCR automatically. No stuck states.

Other Key Features

  • 4 built-in AI roles: PM-01, DEV-01, OPS-01, QA-01 with .mdc rules defining strict behavior
  • File-based protocol (agent_bridge): every message is TASK-YYYYMMDD-seq-sender-to-recipient.md with YAML metadata
  • 3 team templates: dev-team, media-team, mvp-team
  • Phone PWA sends tasks & views status via WebSocket relay
  • Desktop EXE patrols agents with CDP + OCR self-healing
  • Bilingual: English + Chinese documentation

Why it fits awesome-cursorrules

CodeFlow ships .cursorrules / .mdc rules that define each AI role's behavior. The rules enforce a strict file-based protocol so every agent action is traceable. The CDP engine is what makes multi-agent orchestration practical — without it, agent switching and busy detection are too slow and unreliable for real production use.

Links

Summary by CodeRabbit

  • Documentation
    • Added a CodeFlow entry to the Backend and Full-Stack section with links to the project, product page, and methodology.
    • Added a multi‑agent workflow rules document describing team roles, task/report naming and metadata conventions, orchestration and busy‑detection behaviors with fallback/retry flows, escalation/human‑intervention rules, role‑specific reporting requirements, templates, and prohibited behaviors.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b73f2520-698b-4455-a9e6-2148d56b7257

📥 Commits

Reviewing files that changed from the base of the PR and between 3d34dc8 and 72b1523.

📒 Files selected for processing (1)
  • rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules
🚧 Files skipped from review as they are similar to previous changes (1)
  • rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules

📝 Walkthrough

Walkthrough

Added a README entry for CodeFlow and introduced a new Cursor IDE .cursorrules file implementing a multi-role agent orchestration protocol with enforced task/report markdown files, YAML metadata, a CDP-based "Patrol" engine for agent switching and busy detection, OCR fallback, retry/escalation flows, and role-specific rules. (37 words)

Changes

Cohort / File(s) Summary
Documentation
README.md
Inserted a new "CodeFlow" entry under "Backend and Full-Stack" linking to the new .cursorrules and external GitHub/Product/Methodology pages.
Cursor IDE rules
rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules
New comprehensive Cursor rules: enforces TASK-YYYYMMDD-sequence-sender-to-recipient.md filenames and YAML front-matter (protocol, version, sender, recipient, thread_key, priority P0–P3); defines CDP Patrol Engine for DOM-based agent detection, agent switching via synthetic events + verification, layered busy detection, textarea/send semantics; specifies OCR fallback, retry/queue/escalation and human intervention flows; documents per-role acceptance/report requirements, chain-of-command and prohibited behaviors, rollback/sensitive-data safeguards, and team/project template links.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Initiator as PM/DEV/etc
    participant Patrol as CDP Patrol Engine
    participant Browser as Cursor IDE (Tab/Sidebar)
    participant Agent as Target Agent Session
    participant OCR as OCR Fallback
    participant Human as Human (Escalation)
    Initiator->>Patrol: Create TASK-YYYYMMDD-...-sender-to-recipient.md (with YAML)
    Patrol->>Browser: Inspect DOM (tab bar, agent sidebar) for role nodes
    Browser-->>Patrol: Return role nodes / coordinates
    Patrol->>Agent: Focus/select agent via synthetic mouse/keyboard (CDP)
    Patrol->>Agent: Verify selection (aria-selected / sidebar text)
    Patrol->>Agent: Check busy state (buttons, spinner, status text)
    alt Not busy
      Patrol->>Agent: Send message (input events / Enter)
      Agent-->>Patrol: Confirm write/update of TASK file (docs/agents/...)
    else Busy or CDP failure
      Patrol->>Patrol: Retry / queue
      alt CDP unavailable or action fails
        Patrol->>OCR: Use OCR to locate/verify UI elements
      end
      alt Retries exhausted
        Patrol->>Human: Escalate for manual intervention
      end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • PatrickJS

Poem

🐰 I hopped through rules and filenames neat,
I traced each task in YAML-sweet,
With CDP paws I clicked and tried,
When pixels hid, OCR I plied,
Now agents march — carrot crumbs beneath my feet.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding CodeFlow, a multi-agent orchestration system with CDP Patrol Engine integration for Cursor IDE, which matches the two new files added (README entry and .cursorrules configuration).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Line 122: The README entry uses absolute URLs for the CodeFlow, Product page,
and Methodology links; update those to repository-relative links or point them
to new local docs pages and use relative paths instead. Edit the bullet
containing the link texts "CodeFlow", "Product page", and "Methodology" to
replace the full external URLs with relative paths within the repo (or create
local markdown pages under docs/ or promo/ and link to those relatively) so the
links follow the repository README guideline.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 73fd0dcb-3f4f-4fdc-a56b-d891291dc517

📥 Commits

Reviewing files that changed from the base of the PR and between fc2ce04 and eb772aa.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md Outdated

### Backend and Full-Stack

- [CodeFlow](https://github.com/joinwell52-AI/codeflow-pwa) - Multi-role AI team orchestration for Cursor IDE. Desktop EXE patrols agents with OCR-based self-healing, phone PWA sends tasks via WebSocket relay. Includes .mdc rules for PM/DEV/QA/OPS roles and 3 team templates (dev/media/mvp). 87 person-days in 17 days. [Product page](https://joinwell52-ai.github.io/codeflow-pwa/promotion/) | [Methodology](https://joinwell52-ai.github.io/joinwell52/)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Use relative links in this README entry to match repository rules.

This new item uses absolute URLs, but this repo’s README guideline requires relative links. Please convert the links in this bullet to repository-relative paths (or move external references to a local docs page and link that relatively).

As per coding guidelines, "Ensure all links in the README.md file are relative and correct."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 122, The README entry uses absolute URLs for the CodeFlow,
Product page, and Methodology links; update those to repository-relative links
or point them to new local docs pages and use relative paths instead. Edit the
bullet containing the link texts "CodeFlow", "Product page", and "Methodology"
to replace the full external URLs with relative paths within the repo (or create
local markdown pages under docs/ or promo/ and link to those relatively) so the
links follow the repository README guideline.

@joinwell52-AI joinwell52-AI changed the title Add CodeFlow - Multi-Agent Orchestration for Cursor IDE with .mdc Rules Add CodeFlow - Multi-Agent Orchestration with CDP Patrol Engine for Cursor IDE Apr 14, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules (1)

48-48: Clarify ACK sequence allocation to prevent filename collisions.

Line 48 requires immediate ACK but leaves {seq} undefined. In append-only workflows, ambiguous sequence allocation can produce conflicting filenames.

Proposed clarification
-- On receiving `TASK-*-ADMIN01-to-PM01.md`, immediately write an acknowledgement: `TASK-{date}-{seq}-PM01-to-ADMIN01.md`
+- On receiving `TASK-*-ADMIN01-to-PM01.md`, immediately write an acknowledgement using the next available sequence: `TASK-{date}-{next_seq}-PM01-to-ADMIN01.md`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules` at line 48,
The ACK filename pattern "TASK-{date}-{seq}-PM01-to-ADMIN01.md" referenced for
incoming "TASK-*-ADMIN01-to-PM01.md" is underspecified because {seq} is not
allocated and can collide; update the rule that emits the ACK to define a
deterministic sequence allocation (e.g., derive seq from the incoming task id,
append a high-resolution timestamp plus a monotonic counter, or reserve the next
sequence via an append-only counter service) and document which approach is used
so ACKs are unique; specifically change the rule that writes the ACK filename
pattern to compute and insert the chosen seq value (or include original task
identifier) before writing the file.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules`:
- Line 75: The dev-team listing includes an undefined role "E2E" in the line
"**dev-team**: PM · DEV · QA · OPS · E2E"; either remove "E2E" from that
dev-team entry or add a corresponding E2E role contract/rules block (define
responsibilities, permissions, and any message/interaction rules) matching the
style of other roles (PM, DEV, QA, OPS) so every actor is governed; update
whichever you change consistently throughout the file wherever "E2E" is
referenced.
- Line 49: Replace the non-compliant example filenames (`PM01-to-DEV01.md` etc.)
in the "Decompose tasks into separate files per recipient" instruction with the
protocol-compliant pattern required by this ruleset: use
`TASK-YYYYMMDD-sequence-sender-to-recipient.md` (e.g.,
`TASK-20260414-01-PM01-to-DEV01.md`) so parsing/routing remains deterministic;
update the example tokens in the same rule text (the line containing "Decompose
tasks into separate files per recipient") to show the full required pattern and
at least one concrete example following
`TASK-YYYYMMDD-sequence-sender-to-recipient.md`.
- Line 69: The rule "Reports must include verification command output — not just
\"completed\"" should be updated to require redaction of sensitive data before
persisting outputs: modify the .cursorrules entry containing that exact string
to add explicit instructions to redact secrets/PII (e.g., replace tokens,
passwords, IPs, emails) and to run outputs through a redaction utility or regex
sanitizers (ensure you reference the redaction step in the rule text and/or call
a redactor like sanitizeVerificationOutput()), require a brief redaction log
entry (what was redacted) and fail the task if redaction cannot be performed;
update any related validation code that enforces this rule to call
sanitizeVerificationOutput() (or the project’s redactor) and reject unredacted
outputs.

---

Nitpick comments:
In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules`:
- Line 48: The ACK filename pattern "TASK-{date}-{seq}-PM01-to-ADMIN01.md"
referenced for incoming "TASK-*-ADMIN01-to-PM01.md" is underspecified because
{seq} is not allocated and can collide; update the rule that emits the ACK to
define a deterministic sequence allocation (e.g., derive seq from the incoming
task id, append a high-resolution timestamp plus a monotonic counter, or reserve
the next sequence via an append-only counter service) and document which
approach is used so ACKs are unique; specifically change the rule that writes
the ACK filename pattern to compute and insert the chosen seq value (or include
original task identifier) before writing the file.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: dc30bab2-714b-487d-8647-dd10bfe2d671

📥 Commits

Reviewing files that changed from the base of the PR and between eb772aa and f1ac276.

📒 Files selected for processing (2)
  • README.md
  • rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules
✅ Files skipped from review due to trivial changes (1)
  • README.md

Comment thread rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules Outdated
- Only accept tasks from: `TASK-*-PM01-to-OPS01.md`
- High-risk operations (restart services, modify Nginx, clear DB, change firewall) require documented confirmation before execution
- Every deployment must be rollbackable with a backup
- Reports must include verification command output — not just "completed"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Require redaction for OPS verification outputs.

Line 69 mandates command output in reports, but without redaction guidance this can leak secrets/PII into persisted task files.

Proposed fix
 - Reports must include verification command output — not just "completed"
+- Reports must include verification command output — not just "completed"
+- Redact secrets/PII from command output before writing to task files
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules` at line 69,
The rule "Reports must include verification command output — not just
\"completed\"" should be updated to require redaction of sensitive data before
persisting outputs: modify the .cursorrules entry containing that exact string
to add explicit instructions to redact secrets/PII (e.g., replace tokens,
passwords, IPs, emails) and to run outputs through a redaction utility or regex
sanitizers (ensure you reference the redaction step in the rule text and/or call
a redactor like sanitizeVerificationOutput()), require a brief redaction log
entry (what was redacted) and fail the task if redaction cannot be performed;
update any related validation code that enforces this rule to call
sanitizeVerificationOutput() (or the project’s redactor) and reject unredacted
outputs.

Comment thread rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules (1)

152-154: ⚠️ Potential issue | 🟠 Major

Define governance for non-core template roles or mark templates as external rule packs.

media-team and mvp-team list roles that have no intake/output/prohibition contracts in this ruleset. That leaves actors ungoverned if those templates are used.

Proposed fix (minimal)
- - **media-team**: WRITER · EDITOR · PUBLISHER · COLLECTOR
- - **mvp-team**: MARKETER · RESEARCHER · DESIGNER · BUILDER
+ - **media-team**: WRITER · EDITOR · PUBLISHER · COLLECTOR (requires dedicated role contracts in a media-team .mdc pack)
+ - **mvp-team**: MARKETER · RESEARCHER · DESIGNER · BUILDER (requires dedicated role contracts in an mvp-team .mdc pack)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules` around lines
152 - 154, The ruleset lists non-core template role groups media-team and
mvp-team without any intake/output/prohibition contracts, leaving those actors
ungoverned; update the definition of the groups (media-team, mvp-team) to
include explicit intake/output/prohibition contracts matching your ruleset
schema (e.g., add intake:, output:, prohibit: entries for WRITER, EDITOR,
PUBLISHER, COLLECTOR, MARKETER, RESEARCHER, DESIGNER, BUILDER) or, if these role
lists are from external template packs, mark those template definitions as
external rule packs (e.g., add an external: true or include reference to the
external pack) so the contract responsibility is clear; ensure you modify the
group definitions that contain the media-team and mvp-team symbols and keep
dev-team unchanged if already governed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules`:
- Around line 16-24: Update the File Protocol spec to require all task/report
files be placed under a mandatory agent_bridge/ directory—change the filename
pattern from "TASK-YYYYMMDD-sequence-sender-to-recipient.md" to
"agent_bridge/TASK-YYYYMMDD-sequence-sender-to-recipient.md" and update the
example (e.g., "agent_bridge/TASK-20260414-003-PM-to-DEV.md"); also add a brief
rule that consumers/producers must read/write only from the agent_bridge/ path
so agents, watchers and routers use the same location.

---

Duplicate comments:
In `@rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules`:
- Around line 152-154: The ruleset lists non-core template role groups
media-team and mvp-team without any intake/output/prohibition contracts, leaving
those actors ungoverned; update the definition of the groups (media-team,
mvp-team) to include explicit intake/output/prohibition contracts matching your
ruleset schema (e.g., add intake:, output:, prohibit: entries for WRITER,
EDITOR, PUBLISHER, COLLECTOR, MARKETER, RESEARCHER, DESIGNER, BUILDER) or, if
these role lists are from external template packs, mark those template
definitions as external rule packs (e.g., add an external: true or include
reference to the external pack) so the contract responsibility is clear; ensure
you modify the group definitions that contain the media-team and mvp-team
symbols and keep dev-team unchanged if already governed.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f2b6ac5-44b6-404e-9f4a-c9619c48eacd

📥 Commits

Reviewing files that changed from the base of the PR and between f376346 and 1dc11ce.

📒 Files selected for processing (1)
  • rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules

Comment thread rules/codeflow-multi-agent-cursorrules-prompt-file/.cursorrules Outdated
@joinwell52-AI
Copy link
Copy Markdown
Author

@coderabbitai resume

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

✅ Actions performed

Reviews resumed.

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