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.
npx agentmods add rules/cnwinds/ai-detective/troubleshooting-guidegit clone --depth 1 https://github.com/cnwinds/ai-detectiveWrote 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/cnwinds/ai-detective/troubleshooting-guide)<a href="https://agentmods.dev/rules/cnwinds/ai-detective/troubleshooting-guide"><img src="https://agentmods.dev/badge/rules/cnwinds/ai-detective/troubleshooting-guide.svg" alt="Measured on agentmods" 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 | $0.00000 | $0.04658 |
| Opus 5 | $0.00000 | $0.02329 |
| Sonnet 5 | $0.00000 | $0.00932 |
| Haiku 4.5 | $0.00000 | $0.00466 |
Grade B, and why
troubleshooting-guide scanned grade B with 2 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 4d 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.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
sudo apt install certbot python3-certbot-nginx Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
const response = await fetch(url, { How it starts
The opening of the file, as written. The whole thing — 696 lines — stays where its author put it; the contents beside it link to each section on GitHub.
故障排除和部署指南
常见问题诊断
项目结构问题
问题:模块导入失败
症状: ModuleNotFoundError: No module named 'xxx'
排查步骤:
- 检查backend目录是否有
__init__.py文件 - 确认使用相对导入:
from .module_name import ClassName - 验证启动脚本中的导入路径:
from backend.module_name import ClassName - 检查Python路径设置和工作目录
问题:包结构错误
症状: 导入成功但运行时出现属性错误 排查步骤:
- 确认所有Python文件都在正确的目录中
- 检查backend/init.py文件存在
- 验证相对导入路径的正确性
- 重新启动Python解释器清除缓存
服务器启动问题
问题:FastAPI服务器无法启动
症状: 运行python start_game.py时出现错误
排查步骤:
- 检查Python版本 (需要3.7+)
- 验证依赖安装:
pip install -r requirements.txt - 检查端口占用:
netstat -an | findstr :8000 - 查看错误日志中的具体错误信息
- 确认backend包结构正确
问题:OpenAI API连接失败
症状: AI对话功能不工作,返回API错误 排查步骤:
- 检查
.env文件中的OPENAI_API_KEY - 验证API密钥有效性和余额
- 检查网络连接和防火墙设置
- 查看backend/ai_service.py中的错误处理
- 确认backend/config.py配置正确
前端问题诊断
问题:页面无法加载或显示空白
症状: 浏览器显示空白页面或加载失败 排查步骤:
- 打开浏览器开发者工具查看控制台错误
- 检查网络标签页中的HTTP请求状态
- 验证静态文件路径是否正确
- 检查frontend/desktop.html中的资源引用
- 确认FastAPI服务器正常运行
问题:角色对话显示异常
症状: 切换角色时对话历史显示错误或重复 排查步骤:
- 检查
conversationHistory数组结构 - 验证
showCharacterConversation()方法逻辑 - 查看浏览器控制台中的JavaScript错误
- 确认角色ID和名称匹配正确
- 检查会话状态管理
问题:流式输出不工作
症状: AI回答不是逐字显示,而是一次性出现 排查步骤:
- 检查浏览器是否支持Server-Sent Events
- 验证流式API端点是否正常工作
- 查看网络请求中的响应类型
- 检查frontend/static/js/desktop.js中的流式处理逻辑
WebSocket连接问题
问题:实时通信失败
症状: 游戏状态不同步,WebSocket连接断开 排查步骤:
- 检查WebSocket连接URL是否正确
- 验证session_id是否有效
- 查看服务器端WebSocket处理逻辑
- 检查网络代理或防火墙设置
- 监控连接重试机制
问题:会话管理异常
症状: 游戏状态丢失或会话过期 排查步骤:
- 检查会话ID生成和存储
- 验证会话超时设置
- 查看服务器内存中的会话管理
- 检查浏览器本地存储
调试技巧
前端调试
JavaScript调试
// 在关键位置添加调试信息
console.log('当前游戏状态:', this.gameState);
console.log('对话历史:', this.conversationHistory);
console.log('选中角色:', this.selectedCharacter);
// 使用断点调试
debugger; // 浏览器会在此处暂停执行
// 检查DOM元素状态
console.log('角色列表元素:', document.getElementById('character-list'));
console.log('对话区域:', document.getElementById('conversation-area'));
// 监控状态变化
const originalUpdateState = this.updateGameState;
this.updateGameState = function(newState) {
console.log('状态更新前:', this.gameState);
console.log('新状态:', newState);
originalUpdateState.call(this, newState);
console.log('状态更新后:', this.gameState);
};
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.
- 4d ago First seen · 696 lines · 0 tokens per session scan B 579336f3fb19
troubleshooting-guide 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 4,658 tokens. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
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.
cli-error-handling
CLI command error handling patterns.
prefer-direct-imports-over-module-mocks
Prefer extracting a testable core over vi.mock / vi.resetModules when unit tests need to reach production logic entangled with config, env, or singletons.
control-plane-descriptors
Control plane descriptor and instance implementation patterns.
family-instance-domain-actions
Family instance domain action implementation patterns.