Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/ly1836/spring-ai-rag-demoWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/ly1836/spring-ai-rag-demo/spring-ai-rag-demo-module)<a href="https://agentmods.dev/rules/ly1836/spring-ai-rag-demo/spring-ai-rag-demo-module"><img src="https://agentmods.dev/badge/rules/ly1836/spring-ai-rag-demo/spring-ai-rag-demo-module/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/ly1836/spring-ai-rag-demo/spring-ai-rag-demo-module"><img src="https://agentmods.dev/badge/rules/ly1836/spring-ai-rag-demo/spring-ai-rag-demo-module.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01633 | $0.01633 |
| Opus 5 | $0.00816 | $0.00816 |
| Sonnet 5 | $0.00327 | $0.00327 |
| Haiku 4.5 | $0.00163 | $0.00163 |
Grade A, and why
spring-ai-rag-demo-module scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 71 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Spring AI RAG Demo 项目规则
实施新功能前,先阅读
openspec/context/spring-ai-rag-demo.md了解架构、租户隔离与计费扣费约束。
- 项目类型: 单模块 Spring Boot 应用(非多模块 monorepo,无模块前缀概念)
- 根包:
com.example.rag - 启动类:
com.example.rag.RagDemoApplication - 核心能力: Tool Calling(@Tool 查 ERP MySQL)+ RAG(PgVector 检索产品手册)+ 多模型路由
通用编码约定见 openspec/config.yaml。
设计文档
- 项目 context:
openspec/context/spring-ai-rag-demo.md - 通用配置:
openspec/config.yaml - 变更文档:
openspec/changes/<change-name>/(按业务域命名,如chat-add-stream-mode、billing-monthly-quota、tool-purchase-order) - OpenSpec CLI:在仓库根目录执行(如
openspec list)
业务域包结构
新增功能落到与业务语义一致的子包,避免根包堆积:
chat/— 智能问答入口(ChatController、ErpAssistantService、DocumentLoaderService、ModelRegistry)billing/— 计费账户、配额校验、token 扣费、充值conversation/— 对话历史、ChatMemory、JdbcChatMemoryRepositorytool/— ERP @Tool 方法集合(继承BaseTool,按业务域拆分文件)config/— 数据源、过滤器、租户上下文、全局异常、模型属性vo/— 跨业务域共享的请求/响应 VO(同业务域内部 record 嵌套在XxxVO类中)src/main/resources/static/— 前端资源(index.html/app.js/style.css/vendor/),前后端一体部署,无独立前端工程
要求
- 多租户隔离:所有 ERP 查询必须继承
tool/BaseTool并通过query()/queryWithAlias()执行 SQL,禁止直接使用erpJdbcTemplate.queryXxx()绕过ent_code注入 - 租户上下文:通过
TenantContext.requireEntCode()/TenantContext.getUserIdOrDefault()读取,禁止从 Controller 参数或 Header 中重复解析;新建异步/响应式链路必须经过TenantContextAccessor透传,否则 reactor 线程切换后ent_code会丢失 - 统一响应:REST 接口返回
RespVO<T>(SSE 流式接口除外),业务异常直接抛出IllegalStateException/IllegalArgumentException,由GlobalExceptionHandler兜底转RespVO.error,禁止在 Controller/Service 内自行 try-catch 包装错误码 - 数据源:VectorStore 自动配置依赖
@Primary的 PgVector 数据源;ERP 业务查询必须注入@Qualifier("erpJdbcTemplate") JdbcTemplate - ChatModel 路由:多模型场景统一通过
ModelRegistry按modelId路由,禁止在业务代码中直接注入deepSeekChatModel/openAiChatModel等特定 provider Bean - 计费扣费:每次 LLM 调用入口前置
BillingService.checkQuota(),调用后按Usage调用BillingService.deductTokens();新增问答模式(mode)时必须走相同的前后置流程 - SQL 参数化:严禁 SQL 字符串拼接动态值,全部通过
?占位 + 参数列表传入 - 依赖注入:使用构造器注入 +
private final字段,禁止@Autowired字段注入
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 71 lines · 1,633 tokens per session scan A 4f4318ed6d7f
spring-ai-rag-demo-module is a cursor rule published in the GitHub repository ly1836/spring-ai-rag-demo (86 stars, last pushed yesterday), licensed Apache-2.0. It adds 1,633 tokens to every session, about $0.0082 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
000-core
Core principles for LMForge - production-grade LLMOps platform.
020-flask
Flask API Gateway conventions for LMForge.
cardano-mcp
These rules complement our main development collaboration rules, focusing specifically on the Model Context Protocol (MCP) server project with TypeScript. This project serves as a specialized RAG (Retrieval-Augmented Generation) gateway to existing Cardano resources, documentation, and tools to assist with dApp…
ponytail
Ponytail, lazy senior dev mode. Always pick the simplest solution that works.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.