按各目录实际职责补充源码入口、CLI 命令、认证缓存与 HTTP、工作流子模块说明。 同时补齐项目规则、产品参考、规范路径和历史审阅记录导航,保留已有文档与代码。 验证:README 审计 28 个必需目录全部通过,缺失 0;938 项测试、类型与版本检查通过。 新增文档本地链接全部有效,OpenAPI 打包内容不变。
Agent Customizations & Modular Rules Policy
This directory (.agents/) maintains modular configuration, skills, and guidelines for AI coding assistants working in the hose-use repository.
1. Directory Structure
.agents/
├── README.md # This document: architecture & trigger policy
├── skills.json # Declarative skill path and exclusion filters
├── skills/ # Project-scoped Agent skills
│ └── repo-gh/SKILL.md # Markdown 实体文件驱动 GitHub CLI 与 Git 操作规范
└── rules/ # Modular, domain-specific rule definitions (trigger: "manual")
├── production-safety.md # 生产环境安全红线、免读源码与写操作防护原则
├── cli-protocol.md # CLI stdout/stderr stream contract & exit codes
├── tenant-and-credential.md # 多租户凭据管理、协助链接与单据检索最佳实践
├── testing-and-dev-hygiene.md # 单元测试规范、非交互环境防护与发布流程
├── typescript-style.md # ESM, explicit .js imports, and TypeScript styles
└── windows-development.md # Windows 跨平台协作、全小写分支、LF换行与大文件拦截守则
2. Trigger Strategy & Context Budget Management
Why trigger: "manual"?
In Antigravity (agy), rule files located in .agents/rules/*.md support YAML frontmatter:
---
description: "..."
globs: "src/..."
trigger: "manual"
---
- Token Economy: If set to
trigger: "always_on", every turn of the conversation unconditionally injects all rules into the system prompt (<user_rules>), consuming substantial context tokens on every request regardless of task relevance. - On-Demand Activation: Setting
trigger: "manual"prevents automatic background injection into the prompt budget. The rules remain available on-demand when explicitly referenced or requested by the user or agent. - Cross-Agent Neutrality: Non-agy agents (e.g. OpenAI Codex, Claude Code, Cursor, generic LLMs) do not recognize
agy's private frontmatter triggers. Storing modular guidelines as plain Markdown with a manual trigger ensures they function as clean, standalone reference docs that any agent can read on demand via standard file reading tools without unexpected prompt pollution.
3. Modular Rules & Skills Inventory
Rules (.agents/rules/)
| Rule File | Domain / Scope | Key Responsibilities |
|---|---|---|
rules/production-safety.md |
全局行为 | 生产安全最高红线、严禁私自翻阅源码配置 (Zero Source-Reading)、两阶段确认写保护。 |
rules/tenant-and-credential.md |
凭证与单据 | 同等凭据原则、协助链接导入与 --overwrite 保护、个人单据 (task submitted / bill list --mine) 快速通道。 |
rules/cli-protocol.md |
src/cli/**/*.ts |
严格 stdout JSON vs stderr 诊断输出契约、200KB 大报文防爆拦截、退出码规范。 |
rules/testing-and-dev-hygiene.md |
测试与流程 | bun:test 规范、测试环境禁止阻塞交互输入、bun run check + bun test 门禁与发布更新规范。 |
rules/typescript-style.md |
src/**/*.ts |
ES Modules、强制携带 .js 后缀、Zod 运行时校验与代码规范。 |
rules/windows-development.md |
全局 / 跨平台 | Windows 跨平台协作、全小写分支强校验、换行符 LF、符号链接开启与大文件/保留字拦截守则。 |
Skills (.agents/skills/)
| Skill Directory | Target Tool | Key Responsibilities |
|---|---|---|
skills/repo-gh/ |
gh / git |
Markdown 实体先行(Markdown-First)、.drafts/ 隐藏草稿驱动、杜绝内联长文本、统一简体中文规范。 |
4. Usage Instructions for AI Agents
- Production Operations: Always consult
rules/production-safety.mdandrules/tenant-and-credential.mdbefore interacting with configured enterprise tenants. - Git & GitHub Operations: Always consult
skills/repo-gh/SKILL.mdandrules/windows-development.mdfor branch naming, commits, PR creation, and issue management. - CLI Development: When adding or refactoring CLI commands under
src/cli/, consultrules/cli-protocol.md. - Writing Tests: When creating or modifying tests, consult
rules/testing-and-dev-hygiene.md. - TypeScript & Modules: When adding new TypeScript files or resolving local imports, refer to
rules/typescript-style.md.