mirror of
https://github.com/AventurasTeam/Aventuras.git
synced 2026-12-04 04:03:32 +00:00
This swaps CLAUDE.md and the hand-written docs index for a small decision-record setup, and adds a script that checks the docs so they stop drifting from the code. ## What changes CLAUDE.md is gone. AGENTS.md replaces it as the one instruction file for people and coding agents alike. It has the commands, the rules for every change, the area-doc table, and how to record a decision. (Claude Code only reads AGENTS.md when there's no CLAUDE.md, so it's deleted rather than kept around as an import.) If you use Claude Code, check one thing. It only reads AGENTS.md on version 2.1.277 or later, and only when there's no `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` in the repo or any directory above it. If you keep one of those, set **Project instructions** to `claude-md-and-agents-md` in `/config` to load both. Your `~/.claude/CLAUDE.md` doesn't count, so it's fine. Decisions now live in `docs/decisions/`, one file each, named `YYYY-MM-DD-slug.md`. There's one so far, the record system itself. It sets the bar for when a choice gets an ADR at all: intent the code can't express that spans more than one site or won't fit in a short comment. Anything smaller stays a comment, and refining a decision amends its ADR instead of adding a new one. Only tagged decisions are listed in `docs/README.md`, so the index grows with the decisions that span areas, not with every local choice. The code leads to the local ones, either through an `ADR(slug)` comment at a single site or through `scope`, which lists the directories an ADR governs. For each scoped directory, `npm run docs:gen` writes the ADRs' summaries into a generated block in that directory's `AGENTS.md`, which Claude Code loads when it reads a file there or below. Any hand-written text in that file is left alone. `docs/README.md`, the cross-cutting block in AGENTS.md and the scoped blocks are all generated, so don't edit those by hand. Once an ADR merges, its summary is the ruling and can't change. The rest of the record can still be refined while the summary holds. Changing the ruling means superseding the ADR. Raw material (logs, benchmarks, probe output) goes in `docs/evidence/`, and an ADR has to link it. A new `.ignore` lists the folder so a keyword search over the whole repository skips it, while a search aimed at the folder still finds it. Agents reach evidence through the ADR's link. Two evidence docs record how that was tested: which tools load a nested AGENTS.md (only the Read tool does), and why no hook or instruction file guards the folder. `npm run docs:check` (`scripts/docs-check.ts`) checks: - the decision files and the generated output - `ADR(slug)` comments and scopes - `docs/` paths named in source - relative links in Markdown - that evidence files are linked from a decision It also fails if a merged ADR's summary changed or its slug disappeared, comparing against the merge-base with `origin/master`. `--base <ref>` picks another ref, and a ref git can't resolve is an error. The default `origin/master` only warns when it's missing, so a clone without that remote can still run the check. (`master` has no decisions yet, so there's nothing to compare until this merges.) An active ADR with no tag, no scope and no anchor draws a warning, since nothing would lead a reader to it. Cross-cutting ADRs are exempt because AGENTS.md lists them. `npm run docs:gen` writes nothing while an ADR or the tag list is invalid. Otherwise a broken record would quietly drop out of the index and the AGENTS.md blocks. The check runs in pre-push on every push, and with `--strict` in a new Docs check workflow on PRs to master. That workflow fetches the full history so the merge-base exists. The rules that were in CLAUDE.md now have their own files under `docs/development/`, indexed by `docs/development/README.md`. `release.md` and `platform-support.md` are each split into the rules and a separate evidence file. `docs/ARCHITECTURE.md` is a starting map of the code, and `docs/architecture/network-transport.md` is new. Every doc under `docs/architecture/` and `docs/development/` was also checked against the current code and corrected where it had drifted. ## Smaller changes - Markdown under `docs/` is forced to LF (`.gitattributes` and `docs/.editorconfig`). - Git no longer ignores AGENTS.md or `docs/evidence/`, and the ignores for the old root-level doc files now match only at the repo root. - tsconfig and vitest now pick up TypeScript under `scripts/`. - The README points contributors at AGENTS.md and drops the link to the iOS build doc. ## Needs a follow-up `.github/CODEOWNERS` puts `docs/decisions/` under a placeholder team (`@AventurasTeam/TODO-owning-team`). GitHub ignores an owner it can't resolve, so it does nothing until someone fills in the real team. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EzTd9Y26s2eHcacyqFi1QK <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Documentation** * Added repository guidance for development rules, required checks, and decision records; updated the README to direct contributors to the relevant guides. * Added checks and generated documentation for decision records, links, evidence references, and summaries. * Added ownership guidance for decision records and standardized Markdown line endings in the documentation directory. * Replaced the previous repository guide with the new contributor guidance. * **Chores** * Documentation checks now run on pull requests and before pushing changes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.8 KiB
Markdown
39 lines
1.8 KiB
Markdown
# Comments
|
|
|
|
Comment sparingly and briefly. A comment earns its place only when the code cannot say the
|
|
thing itself: an invariant, a non-obvious constraint, a reason to do it this way rather than
|
|
the obvious way. Everything else is noise the next reader has to parse and the next editor
|
|
has to keep true.
|
|
|
|
## What not to write
|
|
|
|
- **History**: "used to be X", "the first version did Y", "this was a bug where…". Git has
|
|
it, and the reader is looking at the present code.
|
|
- **Measurements or anecdotes**: "38 rows for 31 people on a 41-chapter save", "a measured
|
|
run spent two of five steps…". These belong in `docs/evidence/`, linked from the ADR they
|
|
argue for (or in the area doc, until that area moves into decisions), not scattered over the
|
|
implementation.
|
|
- **Self-referential prose**: "this file exists because…", "the whole reason this function
|
|
is here…", "deliberately not X". Say the rule, not the story of the rule.
|
|
- **Restatements**: a comment that repeats the line under it, or a docblock listing
|
|
parameters the signature already names.
|
|
|
|
## Length
|
|
|
|
Prefer one line to three. If the explanation genuinely needs a paragraph, it is design
|
|
rationale: record it as an ADR in `docs/decisions/` (or the relevant `docs/architecture/*.md`
|
|
until that area moves into decisions) and leave at most a short `ADR(slug)` comment pointing at
|
|
it.
|
|
|
|
```ts
|
|
// Good
|
|
// Indices stay valid for the whole session, so a delete leaves its slot behind.
|
|
// Bad
|
|
// A delete used to splice the array, which shifted every index the model already held and
|
|
// made the next update land on the wrong entry — see the session of 2025-11 where…
|
|
```
|
|
|
|
## Existing comments
|
|
|
|
Existing code has plenty of the long form. Leave it alone unless you are already editing
|
|
that block; do not add more of it.
|