Agent 工具栈指南
Cursor CLI 工具与安全配置
在 Cursor 终端使用项目原生命令,并明确区分 workspace 编辑和外部动作。
编程 Agent远程写入
Cursor 命令策略预览
从一个推荐 CLI 开始,以只读模式生成策略;保存前检查命令前缀、目标环境和审批边界。
项目命令策略verified · 2026-07-10
AGENTS.md
## ripgrep command policy
Use `rg` only for source search, pattern discovery, file type filtering, machine-readable matches.
- Default mode: **read-only**.
- Evidence is `verified`, checked 2026-07-10; bounded local checks were recorded for `15.1.0`.
- Verify identity and environment before execution.
- Prefer machine-readable output: `--json`, `--null`.
- Never expose credentials or sensitive output.
- Mode boundary: R0 exact commands may be used; R1, R2, and R3 commands are forbidden.
- Only an explicitly audited suffix-safe prefix may be auto-allowed. Otherwise a generated prefix rule must prompt.
- R3 commands are forbidden in every generated mode; a user request does not silently widen this artifact.
Allowed in read-only mode:
- `rg --json --glob "*.ts" "pattern" src` — R0: Searches a bounded directory and emits one JSON event per line.
- `rg --files --null src` — R0: Lists files while respecting ignore rules.
Require explicit approval in read-only mode:
- None recorded.
Forbidden in read-only mode:
- None recorded.
证据边界
兼容性不等于实测:当前数据没有把独立 CLI 执行归因到具体 Agent。
生成内容是待审查的起点。远程写入、删除、生产操作和任何需要确认的命令仍必须停下获得明确批准。
目标、输入与输出
在 Agent 选择命令前,先明确要交付的结果和证据。
Cursor CLI 工具与安全配置:安全执行步骤
每一步都要在已声明的边界内执行,验证输出后再继续。
审批点与回滚
在列出的决策点停下,并让恢复方法始终紧跟操作。
选 CLI、MCP 还是 API?
根据执行位置、身份、输出合同与权限边界选接口。
建议方案
构建与检查留在终端;GitHub 和部署写入单独审批。
官方证据与参考
执行前使用这些官方或上游来源确认当前命令行为。