57 lines
2.9 KiB
Markdown
57 lines
2.9 KiB
Markdown
# Agent Customizations & Modular Rules Policy
|
|
|
|
This directory (`.agents/`) maintains modular configuration, skills, and guidelines for AI coding assistants working in the `seal-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
|
|
├── cli-protocol.md # CLI stdout/stderr stream contract & exit codes
|
|
├── testing.md # Unit/integration testing conventions (bun:test)
|
|
└── 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:
|
|
|
|
```yaml
|
|
---
|
|
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 ~800 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.
|
|
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/cli-protocol.md`](./rules/cli-protocol.md) | `src/cli/**/*.ts` | Strict `stdout` JSON vs `stderr` diagnostics contract, exit code conventions (`0` vs `1`). |
|
|
| [`rules/testing.md`](./rules/testing.md) | `src/**/*.test.ts` | Test runner (`bun:test`), colocated `*.test.ts`, environment restoration in `afterEach()`. |
|
|
| [`rules/typescript-style.md`](./rules/typescript-style.md) | `src/**/*.ts` | ES modules, mandatory `.js` local extensions, Zod runtime validation, formatting rules. |
|
|
|
|
---
|
|
|
|
## 4. Usage Instructions for AI Agents
|
|
|
|
- **General Tasks**: Follow the project root `AGENTS.md` for baseline project architecture and high-level workflow commands.
|
|
- **CLI Development**: When adding or refactoring CLI commands under `src/cli/`, read [`rules/cli-protocol.md`](./rules/cli-protocol.md) before writing output streams.
|
|
- **Writing Tests**: When creating or modifying tests, read [`rules/testing.md`](./rules/testing.md).
|
|
- **TypeScript & Modules**: When adding new TypeScript files or resolving local imports, refer to [`rules/typescript-style.md`](./rules/typescript-style.md).
|