api-development

API documentation for an AI detective game running at a local web address. An API is a set of endpoints that software uses to request data or perform actions.

In plain words
What is it for?
Use it to build or test pages for cases, game sessions, history, evaluations, replays, streaming responses, and administrative functions.
Why use it?
It gives developers the exact URLs, request details, data formats, and error information needed to connect a frontend or another program to the game.

Cursor rule for Cursor

Install

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.

agentmods
npx agentmods add rules/cnwinds/ai-detective/api-development
Clone the repo
git clone --depth 1 https://github.com/cnwinds/ai-detective

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,369 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.03369
Opus 5 $0.00000 $0.01684
Sonnet 5 $0.00000 $0.00674
Haiku 4.5 $0.00000 $0.00337

Measured yesterday against content hash 801bfd291381, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-development 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 yesterday.

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.

.cursor/rules/api-development.mdc · 603 lines

How it starts

The opening of the file, as written. The whole thing — 603 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI侦探推理游戏 API 接口文档

📋 目录

🌐 基础信息

Base URL: http://localhost:8000
Content-Type: application/json
时区配置: 支持通过环境变量 TIMEZONE 配置,默认为 Asia/Shanghai


🎨 前端页面接口

1. 主页

GET /

说明: 返回游戏主页面
响应: HTML页面

2. 游戏历史页面

GET /game_history.html

说明: 返回游戏历史记录页面
响应: HTML页面

3. 游戏评价页面

GET /evaluation.html

说明: 返回游戏评价页面
响应: HTML页面

4. 游戏回放页面

GET /replay.html

说明: 返回游戏回放页面
响应: HTML页面
查询参数:

  • session_id: 游戏会话ID

5. 流式测试页面

GET /test_stream.html

说明: 返回流式响应测试页面(开发调试用)
响应: HTML页面


🎮 游戏核心接口

1. 获取案例列表

GET /api/cases

说明: 获取所有可用的游戏案例
查询参数:

  • category (可选): 案例分类筛选
  • difficulty (可选): 难度筛选

响应示例:

{
  "cases": [
    {
      "id": 0,
      "title": "神秘的图书馆命案",
      "description": "一个安静的夜晚,图书馆发生了令人震惊的命案...",
      "category": "murder",
      "difficulty": "medium",
      "estimated_time": "30-45分钟"
    }
  ]
}

2. 获取分类信息

GET /api/categories

说明: 获取案例分类和难度选项

响应示例:

{
  "categories": [
    {"value": "murder", "name": "谋杀案"},
    {"value": "theft", "name": "盗窃案"}
  ],
  "difficulties": [
    {"value": "easy", "name": "简单"},
    {"value": "medium", "name": "中等"},
    {"value": "hard", "name": "困难"}
  ]
}

3. 开始游戏

POST /api/game/start

说明: 开始新的游戏会话

请求体:

{
  "case_index": 0,
  "client_id": "optional_client_identifier"
}

响应示例:

{
  "session_id": "uuid-string",
  "case_title": "神秘的图书馆命案",
  "current_round": 1,
  "max_rounds": 30,
  "hints_used": 0,
  "max_hints": 3,
  "characters": [...],
  "conversation_history": {}
}

4. 获取游戏状态

GET /api/game/{session_id}/state

说明: 获取指定会话的当前游戏状态

路径参数:

  • session_id: 游戏会话ID

Read the full file on GitHub · 603 lines

Changes

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.

  1. yesterday First seen · 603 lines · 0 tokens per session scan A 801bfd291381

Subscribe to this mod's changes

api-development is a cursor rule published in the GitHub repository cnwinds/ai-detective (6 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,369 tokens. 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-31.