# AGENTS.md

> Canonical AI policy for this repo.
> When model-specific mirrors exist (`CLAUDE.md`, `GEMINI.md`), they are generated from this file — never edit them directly.

## Project

`ccd-guide` is the guide and reference CLI for Continuous Context Development. It ships opinionated docs, starter templates, Codex/Claude skills, and a small Rust CLI (`ccd`) that bootstraps and validates CCD repositories for developers working with AI coding agents.

## Coding Standards

- Read `MEMORY.md` before deep implementation work.
- Keep docs, templates, skills, and CLI behavior aligned; if one changes, update the paired surfaces in the same task or explain why not.
- Prefer small, reversible Rust changes. Add new crates only when the standard library or a simple script is not enough.
- Favor deterministic, machine-readable behavior. Agent-facing commands should fail closed and explain the reason.
- Edit canonical sources, not generated mirrors. If mirrors exist, change `AGENTS.md` and regenerate them.

## Architecture Rules

- `AGENTS.md` is the canonical repo policy; `CLAUDE.md`, `GEMINI.md`, and `.claude/CLAUDE.md` are generated derivatives.
- Level 1 templates, `ccd attach`, `ccd doctor`, and the shipped skills must describe the same workflow; if one changes, sync the others.
- `ccd` commands are agent-facing interfaces, so overwrite protection, conservative path handling, and predictable output are first-order requirements.
- Public CLI or template behavior changes require regression coverage in `tests/cli.rs` and doc updates where the behavior is surfaced.

## Workflow

- Plan before implementing. Name the files you expect to touch and why.
- Probe before commit. Run the smallest deterministic check that can fail for the change you made.
- Run `git status` and `git diff --minimal` before any commit.
- Stage explicit paths. Never use `git add .`.
- Show the diff to the human before committing. Wait for approval unless the human has already explicitly delegated commit/push authority for the current task.

## Testing

- Run the smallest check that proves the change.
- For Rust or template behavior changes, prefer targeted `cargo test` coverage in `tests/cli.rs`.
- For repo-policy changes, run `cargo run -- doctor --path .`.
- If mirrors exist or are regenerated, run `cargo run -- sync --path . --check`.
- If you skip a check, say why.

## Safety

- No secrets in docs, code snippets, generated files, or committed history.
- Stay within the declared task scope.
- Ask before touching deployment, publishing, auth, billing, or data-migration paths.
