Setting up a repository¶
aegis init gives a repository its rules from Aegis. Run it once in each repository you work in.
You can run it from any folder inside the repository. The files always go at the top level.
What it writes¶
| File | Holds |
|---|---|
CLAUDE.md |
The repository's instructions, then your teams', your role's and your own |
.claude/settings.json |
Settings and permissions for your role in this repository |
.mcp.json |
MCP servers: tools Claude Code can connect to |
.claude/skills/ |
Skills from your role and this repository |
.claude/agents/ |
Agents from your role and this repository |
You only get the files there's something for. Each section of CLAUDE.md is marked with the layer
it came from, such as <!-- aegis:team=backend -->. See
How Aegis works for an example.
If the repository has its own AGENTS.md, the CLAUDE.md Aegis writes starts with a line that
loads it, so Claude Code keeps reading it.
Git ignores these files¶
aegis init adds each file it writes to .git/info/exclude, so git ignores them without any
change to .gitignore. They don't show up in git status.
Files already committed to git¶
If any of these files is already committed to the repository, for example because your team kept
a CLAUDE.md in git before using Aegis, aegis init lists them and asks whether to stop tracking
them:
! CLAUDE.md and .claude/settings.json are tracked by git but managed by Aegis.
Yes: runs `git rm --cached CLAUDE.md .claude/settings.json`. The files stay on disk, and your next commit removes them from the repository.
No: nothing changes. Git shows the files as modified whenever Aegis updates them.
› Stop tracking them in git? [y/N]
If you answer yes, commit and push the change. Once it's pushed, the files leave the repository
for everyone, and each person's next aegis sync writes them back. If you answer no, you're asked
again next time.
Answer yes only once the files are in Aegis; see Bringing in a repository's existing files.
When the CLI can't prompt, such as in a script or from the /aegis:init command, it prints the
git rm --cached command instead and changes nothing.
If a file is already there¶
If the repository already has a CLAUDE.md, or another file Aegis wants to write, that Aegis
didn't write, aegis init asks first:
Press Enter (or answer n) to keep yours. Aegis skips that file and asks again next time.
--force replaces every such file without asking.
How Aegis knows which repository this is¶
Aegis reads the repository's git remotes, the addresses you push to, such as
git@github.com:acme/payments-api.git, and matches them against the repositories your
administrator has registered.
- No remote: Aegis can't tell which repository this is, so it writes nothing and says why.
- A remote that isn't registered: you get a warning, and
CLAUDE.mdcontains only a short note saying the repository isn't registered. Your team, role and personal notes aren't delivered either. Ask an administrator to register the repository.
Your account needs at least one team and a role. Without them, aegis init can't fetch the
repository's rules and says so. Ask an administrator to give you a team and a role.
Keeping it up to date¶
After the first aegis init, aegis sync, or the plugin, keeps the repository's files
current. You don't need to run init again.
Options¶
| Option | Effect |
|---|---|
--force |
Replace files without asking, including ones you've edited |
--no-prune |
Keep files Aegis no longer sends instead of deleting them |
--repo <name> |
Use the rules of the registered repository with this name, instead of matching the remotes |