Files
hose-use/.agents
yunyingk 4b75132b43 feat(agents): add .agents modular rules with manual trigger (keep .agents, omit .agent) (#80)
- Match seal-use repository layout with .agents/rules and skills.json
- Ensure no .agent singular directory or symlink exists
- Set trigger: 'manual' on all rules to prevent automatic prompt injection
- Track .agents/ in git by updating .gitignore
2026-09-17 10:20:10 +08:00
..

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
└── 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

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"
---
  1. 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.
  2. 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.
  3. 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 Inventory

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 运行时校验与代码规范。

4. Usage Instructions for AI Agents