system_info

A set of rules for obtaining timestamps, user details, project paths, and other system information in a consistent, cross-platform way.

In plain words
What is it for?
Use it when generating traceable documents or project metadata that need the current time, author information, project root, or portable path formats.
Why use it?
It prevents documents from using hard-coded author or time data and avoids relying directly on commands that work only on one operating system. It also standardizes path handling.

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/wangqiqi/cursor-ai-rules/system_info
Clone the repo
git clone --depth 1 https://github.com/wangqiqi/cursor-ai-rules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,118 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.01118
Opus 5 $0.00000 $0.00559
Sonnet 5 $0.00000 $0.00224
Haiku 4.5 $0.00000 $0.00112

Measured 3d ago against content hash b46a725df0ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

system_info 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 3d 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.

.cursor/rules/system/system_info.mdc · 134 lines

How it starts

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

🔧 系统信息获取器 (System Information Manager)

版本: v4.3.0 | 最后更新: {{GENERATION_TIME}} | 作者: wangqiqi (https://github.com/wangqiqi)

⚠️ 使用原则

MUST 遵循以下系统信息获取准则:

  • MUST 使用 {{GENERATION_TIME}} 作为时间戳占位符
  • NEVER 硬编码作者信息或时间戳
  • ALWAYS 通过 platform_adapter 获取系统信息
  • DO NOT 直接依赖操作系统特定命令
  • MUST 确保路径格式的跨平台兼容性

核心功能概述 (Core Functions)

系统信息获取器为.cursor规则系统提供统一的时间戳、路径信息和作者信息管理,确保文档的可追溯性和规范化。

自动变量替换

系统自动为文档添加时间戳、作者信息和项目路径,确保内容的可追溯性。

🔧 跨平台适配 (Cross-platform Adaptation)

系统信息获取器依赖 @platform_adapter 规则提供跨平台兼容性:

核心适配功能 (Core Adaptation Features)

  • 命令执行:通过platform_adapter统一执行跨平台命令
  • 路径处理:自动处理不同操作系统的路径格式差异
  • 环境变量:统一访问平台特定的环境变量
  • 错误处理:平台特定的错误信息和恢复策略

集成方式 (Integration Method)

// 通过platform_adapter获取系统信息
const adapter = PlatformAdapterFactory.create();

const timestamp = await adapter.executeCommand('get_timestamp');
const userName = await adapter.executeCommand('get_user_name');
const userEmail = await adapter.executeCommand('get_user_email');
const projectRoot = await adapter.normalizePath(
  await adapter.executeCommand('get_project_root')
);

语言环境检测 (Locale Detection)

系统语言环境检测已集成到 @i18n 规则中,提供智能的多语言支持和自动语言切换功能。

📚 详细使用指南 (Detailed Usage Guide)

支持的变量模板 (Supported Variable Templates)

系统信息获取器支持以下变量自动替换:

变量 说明 示例
{{GENERATION_TIME}} 当前系统时间 2025-12-23 09:38:58 CST
{{AUTHOR_NAME}} Git用户名 your.name
{{AUTHOR_EMAIL}} Git用户邮箱 [email protected]
{{PROJECT_ROOT}} 项目根目录 运行时替换为实际路径
{{WORK_DIR}} 当前工作目录 运行时替换为实际路径

模板使用示例 (Template Usage Examples)

# 文档模板示例
*版本: v3.0.0 | 最后更新: {{GENERATION_TIME}} | 作者: {{AUTHOR_NAME}} <{{AUTHOR_EMAIL}}}*

项目根目录: {{PROJECT_ROOT}}
工作目录: {{WORK_DIR}}

自定义配置 (Custom Configuration)

创建 .env.cursor 文件进行自定义配置:

# 时间格式配置
TIME_FORMAT="%Y-%m-%d %H:%M:%S %Z"
TIMEZONE="Asia/Shanghai"

# 默认作者信息(当Git不可用时)
DEFAULT_AUTHOR_NAME="项目维护者"
DEFAULT_AUTHOR_EMAIL="[email protected]"

# 项目路径配置
PROJECT_TYPE="git"  # git|workspace|custom
CUSTOM_ROOT_PATH="/path/to/project"

Read the full file on GitHub · 134 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. 3d ago First seen · 134 lines · 0 tokens per session scan A b46a725df0ee

Subscribe to this mod's changes

system_info is a cursor rule published in the GitHub repository wangqiqi/cursor-ai-rules (15 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,118 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-30.