xtask setup-agents symlinks CLAUDE/AGENTS.md -> READMEs#10628
xtask setup-agents symlinks CLAUDE/AGENTS.md -> READMEs#10628david-crespo wants to merge 3 commits into
xtask setup-agents symlinks CLAUDE/AGENTS.md -> READMEs#10628Conversation
|
|
||
| ## Tips | ||
|
|
||
| - Typecheck with `cargo check -p omicron-nexus` (add `--all-targets` for tests). |
There was a problem hiding this comment.
FWIW the top level README.adoc in omicron advises the use of nextest, cargo check, running clippy, rustfmt, etc.
There was a problem hiding this comment.
I'd put that in the top one, but yeah.
There was a problem hiding this comment.
Probably worth a mention of a few key things here unless we intend for it to read the full README every time. Which is plausible, it's only about 4k tokens and we could get rid of a bunch of redundant stuff in here. I'll work on that.
| - Use the `crdb-change` skill to generate schema changes and migrations; it | ||
| keeps `dbinit.sql` and the migration in sync. | ||
| - Every schema change needs both a `dbinit.sql` edit and a migration; the two | ||
| must produce the same result. |
There was a problem hiding this comment.
maybe something about how some migrations require an expectorate run to generate the migration verification files? or is this already in the crdb-change skill?
There was a problem hiding this comment.
It is already in the skill ("Step 8: Generate verification files")
There was a problem hiding this comment.
| @@ -0,0 +1,54 @@ | |||
| # Omicron | |||
|
|
|||
| Omicron is the Oxide control plane. It's a large Cargo workspace (~185 crates). | |||
There was a problem hiding this comment.
| Omicron is the Oxide control plane. It's a large Cargo workspace (~185 crates). | |
| Omicron is the Oxide control plane. It's a large Cargo workspace |
(This seems prone to get out-of-date, and not really necessary for claude to load)
There was a problem hiding this comment.
Yep, very silly.
| @@ -0,0 +1,28 @@ | |||
| # omicron-nexus | |||
There was a problem hiding this comment.
Thoughts on renaming these files to AGENTS.md and putting @AGENTS.md in CLAUDE.md? Or symlinking it. Just want to make sure anyone using a different agent also gets these instructions.
There was a problem hiding this comment.
Definitely could do it, my worry is that that would have to apply to all the nested ones too, or I guess we could include instructions in the top level one to help other agents with different logic?
There was a problem hiding this comment.
Yeah, I'd do it across the repo. (I've used this pattern in nextest and it works quite well.)
|
After discussion in the control plane channel, it seems like we want to get everything in README files (thanks @iliana), and then add an |
xtask setup-agents symlinks CLAUDE/AGENTS.md -> READMEs
The original description below is still relevant because I am still adding a
CLAUDE.mdand we are still depending on how Claude Code pulls inCLAUDE.mdfiles in subdirectories, but this point of this PR is no longer to addCLAUDE.mdfiles. We decided we'd rather keep useful docs in README files, so in order to take advantage of CC's machinery, we gitignoreCLAUDE.md/AGENTS.mdbelow top level and add anxtaskwhich creates symlinks that point at any readmes in the tree so that CC automatically pulls them in when working in that subdirectory. We do bothCLAUDE.mdandAGENTS.mdbecause that covers all agent harnesses in wide use (everybody but CC acceptsAGENTS.md).See https://code.claude.com/docs/en/memory#how-claude-md-files-load.
Claude docs excerpt and test of
CLAUDE.mdloading behaviorThis leaves ambiguous whether the walking-up behavior also applies when reading files lower down the tree, but I had Claude test it:
This means sprinkling
CLAUDE.mdfiles around the tree should work pretty well.Output of
cargo xtask setup-agents --dry-run🤖 How various harnesses handle nested
CLAUDE.md/AGENTS.md@importCLAUDE.md@path, eager)AGENTS.md→AGENT.md→CLAUDE.md@path, globs)AGENTS.mdonlyAGENTS.md(→CLAUDE.mdfallback)AGENTS.mdorCLAUDE.md¹ Codex concatenates
AGENTS.mdalong the git-root→cwd path (root-first, leaf-last), so a nested file loads only if you launch Codex inside that subdirectory. Launched from the repo root — our normal case — it reads just the rootAGENTS.md.² opencode walks up from cwd, so it never auto-loads nested files either. Its
instructionsglob (["**/AGENTS.md"]) could force-load them, but eagerly and unconditionally — all ~31 every session — so it's not worth committing.So only Claude Code and Amp do true on-read, scoped subtree loading. For everyone else the per-directory symlinks are inert at a root launch, which is why the root
AGENTS.mdcarries the model-directed nudge to read the relevant directory README on demand — the one portable mechanism that reaches all five.Original description
We have lots of great docs in this repo, but we could use some brief guidance for robots about which docs to look at when working on what. @sunshowers has already established a great pattern by writing RFDs and docs and then adding skills that point at those. I don't want to change this pattern. The problem with skills is that, by design, they are loaded only if the user invokes them or the model decide they are relevant based on the description in the frontmatter. But there is guidance that is always relevant when working on a given crate, and that's what
CLAUDE.mdis for. The skill descriptions are always in context, so it is not necessary to list skills inCLAUDE.mdfiles.I held off on adding these before because the repo is huge and I didn't know how nested
CLAUDE.mdfiles work. We definitely don't want a giant top-levelCLAUDE.mdthat's meant to apply to everything. Fortunately,CLAUDE.mdfiles in subdirectories work more or less exactly how you would want (see the docs excerpt below):/<root>/a/CLAUDE.mdgets loaded automatically whenever CC reads any file nested inside/<root>/a/.My goal here is to add something very basic and unobjectionable to get us started, and then people can feel free to add more as they work. The top-level
CLAUDE.mdmakes clear that we intend to add more and that we should try to keep them relatively short and general.I also added a
CLAUDE.local.mdto.gitignoreso people can use it for personal guidelines they don't want to check in. I had aCLAUDE.mdthat I was ignoring secretly with.git/info/exclude— if anyone else was doing something similar, copy that file toCLAUDE.local.mdand change your ignore line to that.