Skip to content

How Aegis works

This page follows one company, Acme, from the rules an administrator writes to the files that end up on one developer's laptop.

Some quick concepts

Word Means Acme's example
Global Rules for everyone in the organisation "Never commit secrets."
Team A group of people who work together. A person can be in several backend, data
Role The job someone does. A person has exactly one backend-eng, contractor
Repository A codebase, recognised by its git address payments-api
Person Notes for one developer only Tanya's own preferences

Each of these is a layer: a place to put rules for a certain group of people. Aegis stacks the layers that apply to a developer and hands them the result.

A harness is the AI coding tool a developer works in. At Acme, that's Claude Code.

Step 1: an administrator writes the rules

In the admin UI, under Context & Config, Acme's administrator fills in one layer at a time:

Layer What Acme puts there
Global "Never commit secrets. Ask before running anything that deletes data."
Team backend "We use PostgreSQL. Every migration needs a rollback."
Role backend-eng "You're working with a backend engineer. Run the tests before calling a change done, and explain any change to an API." Settings that let the harness run the test suite without asking. A db-migration skill, a set of steps the harness can follow on request: write the migration and its rollback, run both against a local copy of the database, then add the migration to the changelog.
Repository payments-api "This is the payments service. Start it with make dev and run the tests with make test. Card details are handled by the payment provider and never stored here. Money amounts are integers in cents."

Each save goes into the organisation's history with the administrator's name on it.

Or ask the harness to do it

With the Aegis MCP server, the administrator can ask their harness instead of using the forms: "Set up our rules for backend engineers working in payments-api." It puts each line in the right layer, shows the plan, and saves only what they approve.

Step 2: the administrator adds Tanya

Under Users, the administrator adds Tanya to the backend team, gives her the backend-eng role, and issues her an API key. The key is how Aegis knows a request comes from Tanya, and only she needs to keep it.

Step 3: Tanya installs Aegis

Tanya follows the Developer quickstart. She installs the aegis command, logs in with Acme's Aegis address and her key, and agrees to let Aegis manage the harness's files in her home folder.

Step 4: Aegis works out what Tanya gets

Tanya opens a terminal in her copy of payments-api and runs aegis init. Aegis looks at who she is and where she's working:

  Who is asking?   Tanya  (team: backend, role: backend-eng)
  Where?           payments-api  (recognised from its git address)

           ┌──────────────────────────┐
  Global   │ Never commit secrets…    │──┐
           └──────────────────────────┘  │
           ┌──────────────────────────┐  │
  Repo     │ make dev, make test…     │──┤
           └──────────────────────────┘  │
           ┌──────────────────────────┐  │      ┌──────────────────────────┐
  Team     │ PostgreSQL, rollbacks…   │──┼────► │ Tanya's files            │
           └──────────────────────────┘  │      └──────────────────────────┘
           ┌──────────────────────────┐  │
  Role     │ test settings, skill     │──┤
           └──────────────────────────┘  │
           ┌──────────────────────────┐  │
  Person   │ (nothing yet)            │──┘
           └──────────────────────────┘

A developer on the data team would get the same global and repository rules, but not the backend team's. A contractor in payments-api would get the contractor role's settings instead of backend-eng's.

Step 5: the files appear

Aegis writes the result into the files her harness already reads.

In the repository, payments-api/CLAUDE.md now contains:

<!-- aegis:repo=payments-api -->
This is the payments service. Start it with `make dev` and run the tests with `make test`.
Card details are handled by the payment provider and never stored here. Money amounts are
integers in cents.
<!-- /aegis:repo=payments-api -->

<!-- aegis:team=backend -->
We use PostgreSQL. Every migration needs a rollback.
<!-- /aegis:team=backend -->

<!-- aegis:role=backend-eng -->
You're working with a backend engineer. Run the tests before calling a change done, and explain
any change to an API.
<!-- /aegis:role=backend-eng -->

The comment lines show which layer each part came from. The role's settings go to .claude/settings.json and its skill to .claude/skills/db-migration/. Aegis tells git to ignore all of these files, so none of them ends up in a commit.

In her home folder, the global rules go to ~/.claude/CLAUDE.md, which the harness reads in every project.

Tanya starts her harness, and it knows Acme's rules without her writing a line.

Team, role and personal notes travel in the repository's CLAUDE.md, so a developer receives them only in repositories Aegis recognises. In a repository nobody has registered, Tanya would get the global rules from her home folder and a note explaining that the repository isn't registered.

Step 6: a rule changes

A month later the backend team decides every migration also needs a ticket number. The administrator edits the backend team's text and saves.

With the Aegis plugin installed in her harness, Tanya's copy updates on its own. Before the harness reads her next message, the plugin checks Aegis for changes and rewrites whatever changed. Without the plugin, she runs aegis sync.

If Tanya had edited one of these files herself, Aegis would leave it alone and tell her. See Syncing.

Two kinds of rules

What Aegis delivers falls into two groups:

  • What the AI knows: written instructions, skills and agent definitions. Every layer can add to these, and Aegis joins them together.
  • What the AI is allowed to do: settings, permissions, and the tools it can connect to (MCP servers). Only the global, role and repository layers carry these, plus a role's own settings for one repository. A more specific layer can change a setting from a broader one. For example, a repository can allow a command that the global settings forbid.

Where to go next