Skip to content

feat: add .cursor/rules/echo_rules.mdc to all echo-start templates#795

Open
LogicLeapLtd wants to merge 1 commit into
Merit-Systems:masterfrom
LogicLeapLtd:fix/issue-636-cursor-rules
Open

feat: add .cursor/rules/echo_rules.mdc to all echo-start templates#795
LogicLeapLtd wants to merge 1 commit into
Merit-Systems:masterfrom
LogicLeapLtd:fix/issue-636-cursor-rules

Conversation

@LogicLeapLtd
Copy link
Copy Markdown

@LogicLeapLtd LogicLeapLtd commented May 12, 2026

/claim #636

Closes #636

What this adds

Each of the 11 echo-start templates now ships with a .cursor/rules/echo_rules.mdc file so Cursor users get in-editor guidance specific to their template out of the box.

Every file has proper MDC front-matter (description, globs, alwaysApply: true) and framework-tailored content covering:

Template Framework Key rules
next Next.js Provider import path, Route Handler pattern, EchoTokens placement
next-chat Next.js + AI chat convertToModelMessages, streaming, model selector
react React/Vite Client-safe usage, proxy pattern
react-chat React/Vite + chat useChat hook, backend proxy
next-image Next.js + images generateImage, deprecated model IDs to avoid
react-image React/Vite + images Backend proxy, loading state, 402 handling
next-video-template Next.js + video Async job pattern, polling, timeout limits
nextjs-api-key-template Next.js + API key auth Key validation, error codes
assistant-ui assistant-ui Runtime wiring, token placement
echo-cli Node.js CLI Auth, balance check, spend logging
authjs Next.js + Auth.js Session extension, server-only key access

How to verify

  1. Clone any template with npx create-echo-app.
  2. Open the project in Cursor — the rules file should be picked up automatically.
  3. Check that Cursor's AI context includes the Echo-specific guidance (visible in Cursor's rules panel).

Closes Merit-Systems#636

Each template now ships with a .cursor/rules/echo_rules.mdc file tailored
to its framework (Next.js, React/Vite, CLI, Auth.js, assistant-ui, video,
image generation). Rules cover:

- What Echo does and the user-pays model
- Required env vars and where they belong
- The correct import path for Echo-wrapped providers
- Framework-specific code patterns (streaming, polling, session handling)
- Common pitfalls (deprecated model IDs, client-side key exposure, 402 handling)

Templates covered: next, next-chat, react, react-chat, next-image, react-image,
next-video-template, nextjs-api-key-template, assistant-ui, echo-cli, authjs
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 12, 2026

@LogicLeapLtd is attempting to deploy a commit to the Merit Systems Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b2badc676

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +21 to +23
import { AssistantRuntimeProvider } from '@assistant-ui/react';
import { useVercelUseChatRuntime } from '@assistant-ui/react-ai-sdk';
import { useChat } from 'ai/react';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the actual assistant-ui runtime API

In this template the installed assistant-ui integration is wired through useChatRuntime from @assistant-ui/react-ai-sdk (templates/assistant-ui/app/page.tsx) and the server returns toUIMessageStreamResponse() (templates/assistant-ui/app/api/chat/route.ts), but this rule tells Cursor to generate code with the legacy/non-template useVercelUseChatRuntime, ai/react, and toDataStreamResponse() pattern. If a user asks Cursor to modify the assistant-ui template, the generated runtime/route will no longer match the AI SDK v5 transport used by the template, leading to compile-time or streaming protocol failures.

Useful? React with 👍 / 👎.

Comment on lines +21 to +22
jwt({ token, account }) {
if (account?.echoApiKey) token.echoApiKey = account.echoApiKey;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve Auth.js access token session fields

The Auth.js template stores the Echo OAuth token as account.access_token / session.accessToken (templates/authjs/src/auth/index.ts) and getEchoClient() reads session.accessToken, but this new guidance tells Cursor to use account.echoApiKey, token.echoApiKey, and session.echoApiKey. Following these rules in this template will create undefined credentials or TypeScript errors instead of passing the Echo access token to EchoClient, breaking authenticated AI routes.

Useful? React with 👍 / 👎.

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.

Add .cursor/rules/echo_rules.mdc to echo-start templates

1 participant