AI agents
An application created by rustcms new carries a kit for AI coding agents (Claude Code, Codex, Cursor and others that read AGENTS.md). The kit holds the RustCMS conventions and rules an agent must follow, and links to the guide of the RustCMS version the application uses. rustcms agents adds the kit to an older application and refreshes it after an upgrade, without replacing what you edited.
Quick start
rustcms new blog # the kit comes with the application
cd blog
rustcms agents # after `rustcms upgrade`: the kit of the new version
git add AGENTS.md CLAUDE.md .claude .rustcmsWhat the kit holds
| File | Holds |
|---|---|
AGENTS.md | the commands, the generators, the layout and the rules that keep the application safe, between two markers; your own notes above or below them |
CLAUDE.md | @AGENTS.md (Claude Code reads it) and your notes; once it exists, only the @AGENTS.md line is ever added back |
.claude/skills/rustcms-*/SKILL.md | one guide per task: resource, api, database, jobs, extension, upgrade |
.rustcms/agents.json | the checksums of the files as installed, to tell your edits apart (commit it) |
The links go to the guide of the version in your Cargo.lock (the rustcms your application depends on, in a workspace too): a release tag of RustCMS-Core gives /v/X.Y.Z/; a branch, a revision, a local checkout or another repository gives the guide of main (/dev/), and the kit says so. The kit needs RustCMS 0.15.0 or later. Nothing secret is written into the kit: no key, no credential, no path of your machine.
The guide as Markdown
Each version of the guide is also published as Markdown, for agents and other tools:
| URL | Holds |
|---|---|
…/v/X.Y.Z/llms.txt | the pages of the guide's navigation in reading order, with a summary and the URL of each page's Markdown |
…/v/X.Y.Z/md/<page>.md | one page; the code samples are included, links and images are absolute URLs of that version |
…/v/X.Y.Z/llms-full.txt | those pages in one file |
Releases up to 0.15.0 have no Markdown copy: the kit of such a version points at its HTML pages.
Refreshing the kit
rustcms agents writes what is missing and replaces what you did not change:
AGENTS.md: only the block between<!-- rustcms:agents:begin vX.Y.Z -->and<!-- rustcms:agents:end -->. Write your own rules outside it.- a skill: the whole file.
CLAUDE.md: kept;@AGENTS.mdis added at the top when it is missing.
| Option | |
|---|---|
--dry-run | print what would change, write nothing |
--force | also replace the files (or block) you edited, after printing what goes |
A file or block you edited is kept and reported; the command then exits with an error so a script notices. Compare it with the new version, merge what you want, and run rustcms agents --force if the new one should win.
An AGENTS.md without the markers, or with them duplicated, out of order or malformed, is left alone with the reason; the other files are still refreshed. Markers count only as whole lines outside code blocks, so an example in your notes is not mistaken for the block. Line endings do not count as edits, and the kit is never written through a symbolic link. Without .rustcms/agents.json (deleted, or never committed), every existing file that differs from this version counts as edited.
rustcms upgrade reminds you to run rustcms agents when the kit is for an older version.
Pitfalls
- Commit
.rustcms/agents.jsonwith the kit: without it, a clone cannot tell your edits from the kit's text and keeps everything. - The kit links to a version's guide; after
rustcms upgrade, runrustcms agentsor the agent reads the guide of the old version. - The rules in
AGENTS.mdsummarize the guide; the guide and the code decide.