| description | Load when authoring new docs, reviewing frontmatter validation, or modifying the build-index script. | |||
|---|---|---|---|---|
| lastValidated | 2026-03-12 | |||
| maxAgeDays | 90 | |||
| paths |
|
|||
| tags |
|
|||
| title | Frontmatter schema |
Every Markdown file in docs/ must include a YAML frontmatter block. The schema serves two consumers: the update-frontmatter.py script, which writes and validates field values, and the build-index.py script, which reads them to generate the AGENTS.md index table. Humans read the schema when authoring new docs or reviewing automation PRs. Agents read the compiled index in AGENTS.md and use individual doc frontmatter to decide whether to load a file.
---
title: "Authentication flow"
description: "Load when modifying auth, tokens, session handling, or debugging login failures."
lastValidated: "2025-03-01"
maxAgeDays: 60
paths:
- "src/auth/**"
- "src/middleware/session.ts"
tags:
- auth
- security
---These four fields must be present in every doc. The automation will not generate an AGENTS.md entry for a doc that is missing any of them.
A plain string in sentence case. The index builder uses this as the doc's display name in the AGENTS.md table. Keep it short enough to read in a table column without wrapping.
- Format: Plain string, sentence case.
- Authored by: LLM on creation.
- Example:
"Authentication flow"
The agent's primary signal for whether to load the doc. Because agents make a load-or-skip decision based on this field alone, it must be written as a trigger condition rather than a topic summary.
The LLM prompt enforces a strict formula: "Load when [trigger conditions]." Descriptions that summarize content rather than specify trigger conditions are considered malformed and will be flagged by the validation step.
- Format: Plain string, maximum 160 characters, beginning with "Load when".
- Authored by: LLM on creation, never overwritten after initial generation.
- Example:
"Load when modifying auth, tokens, session handling, or debugging login failures."
A description like "This document covers the authentication system" is invalid. It gives an agent no basis for a load decision.
The date a human last confirmed the doc's content is accurate. The staleness workflow uses this field as the baseline for both time-based and path-based staleness checks. The automation never writes to this field. It is set by a human when they review and confirm a doc.
- Format: ISO 8601 date string (
YYYY-MM-DD). No timestamps, no other formats. - Authored by: Human only.
- Example:
"2025-03-01"
The number of days after lastValidated at which the doc is considered time-stale. This value is per-doc and overrides the repo-level default in .agentsrc.yaml. Docs that change frequently or cover fast-moving parts of the codebase should use a lower value. Conceptual or architectural docs can use a higher one.
- Format: Positive integer.
- Authored by: Human only, or inherited from
.agentsrc.yamlif absent. - Example:
60
These fields improve staleness detection and discoverability but are not required for a doc to appear in the AGENTS.md index.
A list of glob patterns pointing to the code paths this doc describes. The staleness workflow checks these paths against the git log since lastValidated. If any commits have touched these paths since that date, the doc is flagged as path-stale regardless of whether the time threshold has been reached.
Use minimatch glob syntax. This is the standard used by GitHub Actions and most JavaScript tooling, which ensures consistency across the automation scripts and CI configuration.
- Format: YAML list of minimatch glob strings.
- Authored by: LLM on creation.
- Example:
paths:
- "src/auth/**"
- "src/middleware/session.ts"Omit this field for docs that are not tied to specific code paths, such as onboarding guides or architectural overviews. The staleness workflow will only apply time-based checks to docs without a paths field.
A freeform list of lowercase strings for categorization. Tags appear in the AGENTS.md index table and can be used to filter docs. There is no controlled vocabulary. Use whatever terms are natural for the repo.
- Format: YAML list of lowercase strings.
- Authored by: LLM on creation.
- Example:
tags:
- auth
- securityNote that across multiple repos, a meta-index will accumulate tag sprawl over time. This is acceptable until the volume of docs makes it a problem. Do not pre-optimize with a controlled vocabulary unless you already feel the pain.
The automation and humans own different fields. The update-frontmatter.py script never overwrites a field outside its scope.
| Field | Owned by | Notes |
|---|---|---|
title |
LLM | Written on creation. Updated if missing or blank. |
description |
LLM | Written on creation. Never updated after that. |
lastValidated |
Human | Never written by automation. |
maxAgeDays |
Human / repo default | Never written by automation. Inherited from .agentsrc.yaml if absent. |
paths |
LLM | Written on creation. Updated if missing or blank. |
tags |
LLM | Written on creation. Updated if missing or blank. |
The reason description is never updated after creation is intentional. The LLM generates it once from the full document content at the moment of creation. Subsequent edits to the doc do not trigger a regeneration, because silently changing an existing description could break any agent that has already learned to use it as a loading signal. If a description needs to change, a human edits it manually and the change appears in the next automation PR diff for review.
The .agentsrc.yaml file at the repo root sets defaults that apply when per-doc values are absent.
# .agentsrc.yaml
llm:
provider: anthropic
model: claude-sonnet-4-20250514
defaults:
maxAgeDays: 90The only schema field with a repo-level default is maxAgeDays. If a doc's frontmatter includes maxAgeDays, that value takes precedence. If it is absent, the staleness workflow falls back to defaults.maxAgeDays. If .agentsrc.yaml is also absent or the field is not set, the workflow uses a hardcoded fallback of 90 days.
The .agentsrc.yaml file should be committed to the repo root. It is the right place to tune staleness sensitivity for the repo as a whole without editing every individual doc.
The update-frontmatter.py script validates its LLM response before writing any fields to disk. The following rules are checked:
titleis a non-empty string.descriptionis a non-empty string, is 160 characters or fewer, and begins with "Load when".lastValidatedmatches the patternYYYY-MM-DDand is a valid calendar date.maxAgeDaysis a positive integer.- Each entry in
pathsis a non-empty string. The script does not verify that the paths exist in the repo, because a doc may describe paths that have not yet been created. - Each entry in
tagsis a non-empty lowercase string.
If the LLM response fails validation for any field, the script writes only the fields that passed and sets a status: llm-error field in the frontmatter. The index builder reflects this in the AGENTS.md status column, and the automation PR body includes a warning for each affected doc.
Validation is run as a standalone check during the staleness workflow as well, so malformed frontmatter introduced by a manual edit is caught even if no doc content has changed.