AGENTS.md@.agents ยท diff

git:20260911.1c2f8a7 to git:20260916.4e0e8ee

19 added, 41 removed. Audit A to A.

# .agents/
- Agent governance, planning, and history for the `rjmurillo/ai-agents` repository. Consumed by contributors, CI validators, and skills (`retrospective`, `memory`); never shipped to a plugin consumer.
+ Governance, planning, history; no plugin ships it.
## Matters
- - Not a plugin root. Nothing under here reaches an installed `.claude/`, `src/claude/`, or `src/copilot-cli/` consumer.
- - Most subtrees are history or write-only; read one only when the task names it (see Skip).
- - `governance/PROJECT-CONSTRAINTS.md` is the index of record; read it before acting on anything governance-shaped.
- - ADR `status` in YAML frontmatter is truth; `architecture/README.md` is generated from it, never hand-edited.
- - Session log creation is discontinued; do not create a new `.agents/sessions/*.json` file.
- - Markdownlint ignores `.agents/**` (`.markdownlint-cli2.yaml`), but the dash ban and `governance/DOCUMENTATION-LINK-REQUIREMENTS.md` (relative links, not bare paths) still bind.
- - Rules that fire here by `paths:` scope: `session-logs.md`, `token-economy.md` (`.agents/**`), `governance.md` (`governance/**`), `retros.md` (`retrospective/**`), `secret-redaction.md` (`sessions/**`, `retrospective/**`), `tool-use-hook-bar.md` (`architecture/**`), `security.md`/`testing.md` (`security/**`, `security/benchmarks/**`).
+ - Rules auto-load: `session-logs`,`token-economy`->`.agents/**`; `adr-records`,`tool-use-hook-bar`->`architecture/**`; `governance`,`push-lock`->`governance/**`; `canonical-source-mirror`->`governance/**`,`retrospective/**`; `retros`->`retrospective/**`; `secret-redaction`->`sessions/**`,`retrospective/**`; `security`->`security/**`; `testing`->`security/benchmarks/**`.
+ - Markdownlint ignores `.agents/**`; dash ban binds (`staged-dash-policy`). `governance/DOCUMENTATION-LINK-REQUIREMENTS.md`: relative links, unenforced. Gemini skips it (`.gemini/config.yaml`).
## Entry points
- - `governance/PROJECT-CONSTRAINTS.md`: read at session start (root `AGENTS.md` Gates).
- - `sessions/handoffs/<date>-<issue>-handoff.md`: read the latest at start, update at end.
- - `architecture/ADR-NNN-*.md` (108 tracked): check `status` before citing a decision as active.
- - `memory/episodes/*.json` (750 tracked): auto-extracted; read through the `memory` skill, never hand-edit.
+ - `sessions/handoffs/<date>-<issue>-handoff.md`: read latest, update at end. Sibling `handoffs/`: separate per-branch tier (ADR-014 Tier 2).
+ - `AGENT-INSTRUCTIONS.md`: BLOCKING scaffold; `implementer.md`/`orchestrator.md` gate on it.
+ - `architecture/ADR-NNN-*.md`: YAML `status` is truth; `README.md` generated (`generate_adr_index.py`), drift-gated (`OWNED_PREFIXES`), hand-edits lost. Frontmatter ratcheted pre-PR vs committed baseline (`check_adr_lifecycle.py`, ADR-073).
+ - `memory/episodes/*.json`: never hand-edit; auto-staged by `extract-session-episodes` pre-commit, exempt from the 5-file atomic limit. `recovery-hints.yaml`: hand-edited `error_classification.py` data.
## Where to look
| Path | Why |
|---|---|
- | `governance/*.md` | Constraints, testing rigor, generator files, CI feedback subloop, naming; every normative line needs an evidence anchor |
- | `architecture/ADR-NNN-*.md` (108) | Decision records; YAML `status` is truth, `README.md` is generated |
- | `sessions/handoffs/` | Per-issue continuity: read latest at start, update at end |
- | `specs/` | EARS requirements: `REQ-NNN`, `TASK-NNN`, `DESIGN-NNN`; `check_spec_id_uniqueness.py` and `traceability.py` gate it |
- | `steering/claude-skills.md` | Skill schema authority |
- | `memory/episodes/` (750) | Auto-extracted by pre-commit `extract-episodes`; never hand-edit |
- | `security/` | Threat models (`TM-NNN`), reviews; `benchmarks/` is a test location, not docs |
- | `schemas/` | JSON schemas: session-log, skill-output, pr-quality-gate-output, workflow, policy, evidence-entry |
- | `hooks/` | Retired Phase 1 hook inventory; see Dangerous assumptions before trusting it |
+ | `governance/` | Constraints, testing, naming; `GENERATOR-FILES.md` registers generated trees |
+ | `specs/` | EARS `REQ`/`TASK`/`DESIGN-NNN`; ID+traceability gated |
+ | `steering/` | `claude-skills.md` cited by `.claude/skills/CLAUDE.md` |
## Skip
- - `sessions/*.json`: session log creation discontinued; validate-if-present only.
- - `archive/`: closed history; `retrospective/` writes go through the `retro`/`retrospective` skill only.
- - `critique/`, `analysis/`, `qa/`, `planning/`, `plans/`, `projects/`, `audits/`, `audit/`, `checkpoints/`, `eval-results/`, `metrics/`, `pr-checks/`, `pr-consolidation/`, `incidents/`, `devops/`, `debt/`, `decisions/`, `benchmarks/`, `roadmap/`, `handoffs/`: write-only or historical; stale-script-ref and doc-interpreter gates exclude these roots, so treat contents as evidence, not instructions.
- - `prototypes/`: A/B compression candidates (issue #1738), not the active agents in `.claude/agents/`.
- - `.hook-state/`: gitignored runtime log directory, not tracked.
- - `pr-batch-review-session-2025-12-20.md`: stray root file, historical.
+ - `sessions/*.json`, `archive/`, `retrospective/` (same-day file gates non-docs pushes); `critique/`, `metrics/`: read only when named; not all gate-exempt.
+ - Stray: `prototypes/`, `pr-batch-review-session-2025-12-20.md`, `workflow-context.json`. `README.md`: stale project-phase doc.
## Constraints
- - Any `ADR-*.md` edit fires the `adr-review` skill (root `AGENTS.md`).
- - `governance/**` changes need human approval, an ADR for a new rule or policy reversal, and consensus for cross-role rules (`governance.md`); no single agent may alter rules governing another unilaterally.
- - Never amend a commit that already carries a recorded `endingCommit`; commit the SHA in a follow-up commit instead (`session-logs.md` MUST-2), and re-point it after any rebase (MUST-3).
- - `validate-planning-artifacts.yml` fires on `planning/**`: estimate divergence, orphan conditions, task coverage.
- - `sessions/**` and `retrospective/**` content must be secret-redacted before it is written (`secret-redaction.md`).
- - Worktree Serena writes: behavior and the binding rule live in `.claude/rules/universal.md` MUST NOT 10; not restated here.
+ - `validate-planning-artifacts.yml` fires on `planning/**`: estimate divergence (20%) and orphan conditions, not task coverage.
## Dangerous assumptions
- - `hooks/hooks.yaml` looks like the live hook manifest. Its own `hooks/README.md` says otherwise: "a retired inventory. No generator or runtime reads it." The real sources of truth are `.claude/settings.json`, `.claude/hooks/`, and `templates/platforms/copilot-cli.yaml`.
- - `governance/naming-conventions.md` documents a lowercase `prd-name.md` PRD pattern under `.agents/planning/`. Tracked PRDs mostly use `PRD-Name.md` (uppercase) under `specs/`, `plans/`, or `archive/planning/`; go by the tracked files, not the doc alone.
- - `naming-conventions.md` defines no `TASK-EPIC-NNN-MM` pattern; the only other tracked occurrence is `.agents/archive/phase3-complete-handoff.md`, a retired PowerShell validator's pattern list. Live tasks are `TASK-NNN-<kebab-name>.md` under `specs/tasks/`.
+ - `hooks/hooks.yaml` retired, read by nothing; `hooks/README.md` misnames the live sources. ADR-109 B4: `templates/hooks/` is the source, `.claude/hooks/` and `.claude/settings.json` generated. Copilot map: `templates/platforms/copilot-cli.yaml`.
+ - Gate exemptions differ: `check_doc_interpreter_portability.py` `HISTORICAL_ROOTS` and `stale_script_refs.py` omit `metrics/`, `roadmap/`, `plans/`, `handoffs/`; a bare-interpreter call of a tracked script with a non-stdlib import, or a ref to a deleted `.ps1`, fails there.
+ - `AGENT-SYSTEM.md` stale: `**File**:` lines cite `src/claude/<stem>.md`; live is `src/claude/agents/<stem>.md` (generated, ADR-109 B1).
## Dependencies
- - Feeds the `retrospective` skill, memory extraction, and the PreCompact hook, which all read existing session logs under `sessions/`.
- - `architecture/README.md` is generated by `build/scripts/generate_adr_index.py` (via `build/scripts/build_all.py`); a hand-edit is overwritten on next regen.
- - `governance/*.md` changes should cross-link from root `AGENTS.md`/`CLAUDE.md` when they change agent defaults (`governance.md` SHOULD-2).
+ - `schemas/*.json` gate `skillbook/` JSON (`skillbook-validation.yml`); `tests/skillbook/conftest.py` imports `hooks/post-eval.py`.
## Architecture
- - Two "hooks" trees exist and are unrelated: `.agents/hooks/` is a retired Phase 1 inventory; `.claude/hooks/` holds the canonical scripts Claude Code actually runs. Do not edit registrations in the former.
- - `.agents/skills/` (steering learnings), `.agents/skillbook/` (policies/tensions/workflows JSON), and `.claude/skills/` (the actual skill catalog) are three distinct trees; don't conflate them.
+ - Distinct trees: `skills/` (steering learnings), `skillbook/` (policy/tension/workflow JSON), `.claude/skills/` (catalog).
## Commands
```bash
uv run python scripts/validation/pre_pr.py
uv run python scripts/validation/check_adr_links.py
+ uv run python scripts/validation/check_adr_uniqueness.py --print-next
uv run python scripts/validation/check_spec_id_uniqueness.py
uv run python scripts/validate_session_json.py <path-to-log>
```