diff --git a/.agents/README.md b/.agents/README.md new file mode 100644 index 0000000..e7fe177 --- /dev/null +++ b/.agents/README.md @@ -0,0 +1,56 @@ +# 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 (``), 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). diff --git a/.agents/rules/cli-protocol.md b/.agents/rules/cli-protocol.md index 895212b..ef416b8 100644 --- a/.agents/rules/cli-protocol.md +++ b/.agents/rules/cli-protocol.md @@ -1,7 +1,7 @@ --- description: "CLI stdout/stderr stream contract and exit code conventions for seal-use commands" globs: "src/cli/**/*.ts" -trigger: "always_on" +trigger: "manual" --- # CLI Stream & Exit Code Protocol diff --git a/.agents/rules/testing.md b/.agents/rules/testing.md index ff1ec8f..85171bf 100644 --- a/.agents/rules/testing.md +++ b/.agents/rules/testing.md @@ -1,7 +1,7 @@ --- description: "Testing conventions and runner guidelines using bun:test" globs: "src/**/*.test.ts" -trigger: "always_on" +trigger: "manual" --- # Testing Guidelines diff --git a/.agents/rules/typescript-style.md b/.agents/rules/typescript-style.md index 5a59668..2d5592b 100644 --- a/.agents/rules/typescript-style.md +++ b/.agents/rules/typescript-style.md @@ -1,7 +1,7 @@ --- description: "TypeScript and ESM coding conventions for seal-use codebase" globs: "src/**/*.ts" -trigger: "always_on" +trigger: "manual" --- # TypeScript & ESM Conventions