Skip to content

Commit 82fb98e

Browse files
committed
feat: Add directive that index.md files are auto-generated
AGENTS.md now warns agents not to manually create or edit ai/**/index.md files since they are generated from frontmatter and overwritten by the pre-commit hook.
1 parent d5d288c commit 82fb98e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/agents-md.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const REQUIRED_DIRECTIVES = [
1818
"root index", // Progressive discovery starting from root
1919
"vision", // Vision document requirement
2020
"conflict", // Conflict resolution
21+
"generated", // Auto-generated files warning
2122
];
2223

2324
// The content for AGENTS.md
@@ -33,6 +34,8 @@ Agents should examine the \`ai/*\` directory listings to understand the availabl
3334
3435
Each folder contains an \`index.md\` file that describes the purpose and contents of that folder. Agents can read these index files to learn the function of files in each folder without needing to read every file.
3536
37+
**Important:** The \`ai/**/index.md\` files are auto-generated from frontmatter. Do not create or edit these files manually—they will be overwritten by the pre-commit hook.
38+
3639
## Progressive Discovery
3740
3841
Agents should only consume the root index until they need subfolder contents. For example:
@@ -144,6 +147,8 @@ Agents should examine the \`ai/*\` directory listings to understand the availabl
144147
145148
Each folder contains an \`index.md\` file that describes the purpose and contents of that folder. Agents can read these index files to learn the function of files in each folder.
146149
150+
**Important:** The \`ai/**/index.md\` files are auto-generated from frontmatter. Do not create or edit these files manually—they will be overwritten by the pre-commit hook.
151+
147152
### Progressive Discovery
148153
149154
Agents should only consume the root index until they need subfolder contents. For example:

lib/agents-md.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe("agents-md", () => {
5151
test("is case insensitive", () => {
5252
const mixedCaseContent = `
5353
Check AI/ directory listings
54-
INDEX.MD files
54+
INDEX.MD files are auto-GENERATED
5555
Root Index from base
5656
VISION document requirement
5757
CONFLICT resolution
@@ -204,7 +204,7 @@ describe("agents-md", () => {
204204
const customContent = `# Custom AGENTS.md
205205
206206
Look at ai/ directory listings.
207-
Read index.md files.
207+
Read index.md files (auto-generated).
208208
Only use root index until you need more.
209209
Always read the vision document first.
210210
Report conflict resolution to the user.

0 commit comments

Comments
 (0)