Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .cursor/commands/read-branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Read branch / PR review

This file is the system prompt for the Flatbread PR Review Cursor
automation (`/read-branch`). Execute it against the current pull request.

## Models

Use the **latest Cursor Grok** model for architecture, proof-journal, and
correctness work. Do not pin an old Grok version.

1. Do not pass `cursor-grok-4.5-high`, `cursor-grok-4.5-high-fast`, or any
older `cursor-grok-*` slug to Task subagents.
2. Prefer omitting Task `model`, or pass `inherit`, so children match the
parent run. The automation parent should already be the latest Cursor
Grok.
3. If the Task tool requires an explicit slug, pick the newest
`cursor-grok-*` entry in that tool's allow-list. Do not invent a slug
that is not listed.
4. Keep the simplify/quality domain on Composer: `composer-2.5`, or the
newest `composer-*` slug in the allow-list.
5. Do not write a versioned Grok slug into automation memory. Memory may
say "latest Cursor Grok". It must not say `cursor-grok-4.5-high`.

When the review footer names models, name the slugs you actually used.

## Fan-out

Spawn one subagent per domain:

1. architecture
2. opportunities to simplify and improve code quality (including
complexity)
3. Proof journal quality (`/proof`). If the PR contains a significant
event, a Proof record should likely accompany it.
4. code correctness and real-world edge-case coverage

Skip the run when the diff is dependency-only (lockfiles / `package.json`
only). Continue if any non-dependency source or docs remain.

If Oven (`pnpm exec oven`) is missing, use the Task tool as the fallback.
The parent writes `/tmp/review-judge-final.md`.

## Synchronize

On a `synchronize` event:

1. Classify prior automation threads as addressed or still open.
2. Resolve prior threads, then `cleanup_previous`.
3. If no threads are open, skip resolve.

Do not bump Unreleased CHANGELOG notes for packages with no `src` in the
PR.

## Output

Lead with a review verdict. Then list prior notes closed, domain verdicts,
and the models actually used.
20 changes: 20 additions & 0 deletions .cursor/rules/cursor-grok-latest.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
description: PR review and Grok Task subagents use the latest Cursor Grok model, never a pinned 4.5 slug.
alwaysApply: true
---

# Latest Cursor Grok for review subagents

When this run is a pull-request review, or when you spawn Task subagents
for architecture, proof-journal, or correctness:

1. Use the **latest Cursor Grok** model. Prefer omitting Task `model`, or
pass `inherit`, so children match the parent.
2. If the Task tool requires an explicit slug, pick the newest
`cursor-grok-*` entry in that tool's allow-list.
3. Do **not** pass `cursor-grok-4.5-high` or `cursor-grok-4.5-high-fast`.
4. Do **not** write a versioned Grok slug into automation memory.

The Flatbread PR Review automation executes
`.cursor/commands/read-branch.md` as `/read-branch`. That file is the
source of truth for this routing. Quality/simplify work stays on Composer.
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ The repo uses Mergify stacks for PR management. The `mergify-cli` is installed v
- The commit-msg hook (`.husky/commit-msg`) auto-appends a `Change-Id` trailer for stack tracking.
- See `.agents/skills/mergify-stack/SKILL.md` for the full workflow.

### PR review models

The Flatbread PR Review automation runs `.cursor/commands/read-branch.md`
as `/read-branch`. Architecture, proof-journal, and correctness subagents
use the **latest Cursor Grok** model. Do not pin `cursor-grok-4.5-high`.
Prefer `inherit` (or omit Task `model`) so children match the parent.
Quality/simplify stays on Composer. See
`.cursor/rules/cursor-grok-latest.mdc`.

### Gotchas

- **Native build scripts are approved in `pnpm-workspace.yaml`.** The `onlyBuiltDependencies` list allows esbuild, sharp, @swc/core, etc. to run their postinstall scripts automatically during `pnpm install`.
Expand Down
34 changes: 34 additions & 0 deletions scripts/cursor-grok-latest.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import test from 'ava';
import { readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');

function readRepo(rel) {
return readFileSync(path.join(root, rel), 'utf8');
}

const command = readRepo('.cursor/commands/read-branch.md');
const rule = readRepo('.cursor/rules/cursor-grok-latest.mdc');
const agents = readRepo('AGENTS.md');

test('/read-branch tells review subagents to use the latest Cursor Grok', (t) => {
t.true(command.includes('latest Cursor Grok'));
t.true(command.includes('inherit'));
t.true(command.includes('Do not pass `cursor-grok-4.5-high`'));
t.false(command.includes('models cursor-grok-4.5-high'));
});

test('always-on rule forbids pinning Grok 4.5 on review Task children', (t) => {
t.true(rule.includes('alwaysApply: true'));
t.true(rule.includes('latest Cursor Grok'));
t.true(rule.includes('cursor-grok-4.5-high'));
t.true(rule.includes('Do **not** pass `cursor-grok-4.5-high`'));
});

test('AGENTS.md points PR review routing at the in-repo command and rule', (t) => {
t.true(agents.includes('.cursor/commands/read-branch.md'));
t.true(agents.includes('.cursor/rules/cursor-grok-latest.mdc'));
t.true(agents.includes('latest Cursor Grok'));
});
Loading