Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions .agents/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ The one canonical agent folder, following the
[Agent Skills](https://agentskills.io) open standard and
[AGENTS.md](https://agents.md) conventions.

Every piece of agent configuration is one of three things:
Every piece of agent configuration is one of two things:

| Tier | Strategy |
|---|---|
| **Canonical** — the single source of truth | Lives here: `skills/`, `mcp/servers.json`, `scripts/` |
| **Seed** — a harness reads it straight from the clone, before any script can run | Committed in the harness's own location, kept minimal: hook and environment registrations, one managed key per settings file |
| **Generated** — everything else a harness wants | Rendered by `scripts/sync.py`, gitignored, recreated per checkout for the harnesses detected on that machine |
| **Canonical** — the single source of truth | Lives here: `skills/`, `mcp/servers.json`, `hooks/`, `scripts/` |
| **Generated** — everything a harness reads | Rendered by `scripts/sync.py`, gitignored, recreated per checkout for the harnesses detected on that machine |

There is no committed middle tier. `CLAUDE.md`, `.claude/`, `.cursor/`, and
`.gemini/` are all generated, so a fresh clone has to run
`scripts/bootstrap.sh` before any harness-specific file exists — see the
environments table in `README.md`.

Instructions and skills need almost no adapters: `AGENTS.md` and
`.agents/skills/` are read natively by Codex, Cursor, Copilot's coding agent,
Expand All @@ -24,6 +28,8 @@ tools with a project-level MCP surface; `sync.py list` shows the full table.
- `skills/` — Shared skills. Each is a directory with `SKILL.md`.
- `mcp/servers.json` — Canonical MCP server configuration (Claude `mcpServers`
dialect, plus an optional `tools` read-only allowlist per server).
- `hooks/` — Hook scripts that generated adapters register. Harness-specific in
what registers them, canonical in where they live.
- `scripts/` — `bootstrap.sh` (environment setup entry point), `sync.py`
(adapter generator), `check-skills.py` (vendored-skill lock).
- `setup` — Entry shim for harnesses that execute `.agents/setup` (Amp orbs).
Expand All @@ -48,9 +54,7 @@ It installs into `.agents/skills/` and maintains the same `skills-lock.json`.

1. Edit `.agents/mcp/servers.json`.
2. Run `.agents/scripts/sync.py`.
3. Commit the canonical file plus the two committed seeds it updates
(`.claude/settings.json`, `.gemini/settings.json`). Every other rendered
adapter is gitignored.
3. Commit the canonical file. Every rendered adapter is gitignored.

An optional `tools` array on a server is a read-only allowlist. It renders as
`enabled_tools` for Codex and `includeTools` for Gemini and Qwen; the other
Expand All @@ -64,13 +68,14 @@ harnesses have no equivalent and receive the server's whole tool surface.
adapter.
- To support a new harness, add one entry to the `HARNESSES` table in
`scripts/sync.py` (detection, skills dir if it doesn't read `.agents/skills/`
natively, MCP renderer if it has a project-level MCP file) and mirror any new
output path in `.gitignore`'s generated-adapters block. CI fails if the two
fall out of step.
- Agent-specific configuration stays put. `.cursor/rules/*.mdc` and
`.github/instructions/*.instructions.md` use glob scoping and conditional
loading with no equivalent elsewhere — do not convert them into skills.
Knowledge every agent needs belongs in `AGENTS.md`.
natively, renderer if it has any project-level config file) and mirror every
new output path in `.gitignore`'s generated-adapters block. `sync.py check`
and CI both fail if the two fall out of step.
- Nothing harness-specific is committed. If a harness format has no equivalent
elsewhere — `.cursor/rules/*.mdc` and `.github/instructions/*.instructions.md`
use glob scoping and conditional loading that skills cannot express — add a
renderer for it here rather than committing the file. Knowledge every agent
needs belongs in `AGENTS.md`.
- Keep secrets and machine-local configuration out of committed files.
- Run the pre-commit hooks or their underlying scripts before committing. GitHub
Actions enforces the same checks for pull requests and `main`.
34 changes: 20 additions & 14 deletions .agents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ format. Rendered adapters are gitignored and recreated per checkout.
# Show the harness table: detection state and what each gets
.agents/scripts/sync.py list

# Fail if a managed key in a committed seed file is stale
# Fail if a generated adapter is unignored or committed
.agents/scripts/sync.py check

# Explicitly install this repo's managed MCP block in the user Codex config
Expand All @@ -40,14 +40,19 @@ environment-specific except the hook that calls it:
| Environment | Entry point |
|---|---|
| Local | `.agents/scripts/bootstrap.sh`, once per checkout |
| Claude Code (web/cloud) | `SessionStart` hook → `.claude/hooks/session-start.sh` |
| GitHub Codespaces / devcontainers / Ona | `.devcontainer/devcontainer.json` `postCreateCommand` |
| GitHub Copilot coding agent | `.github/workflows/copilot-setup-steps.yml` (devcontainers are not honored there) |
| Cursor cloud agents | `.cursor/environment.json` `install` |
| Amp orbs | `.agents/setup` |
| Codex cloud | No in-repo hook — put `.agents/scripts/bootstrap.sh` in the environment's Setup script field (chatgpt.com/codex/settings/environments) |
| Jules / Devin / Factory | No in-repo hook — same one-liner in their UI setup/snapshot configuration |
| CI | `.github/workflows/agent-config.yml` |
| Every cloud harness (Claude Code on the web, Cursor, Codex, Copilot, Jules, Devin, Factory, …) | No in-repo hook — put `.agents/scripts/bootstrap.sh` in the environment's setup-script field |

A cloud harness's in-repo setup hook would have to be a committed,
harness-specific file, and this repository has none by design: a hook can only
run once it exists in the clone, but everything harness-specific here is
generated by that very run. So those environments carry the one-line bootstrap
command in their own settings instead — Codex at
chatgpt.com/codex/settings/environments, the others in the equivalent
setup/snapshot field. Until bootstrap runs, a checkout has `AGENTS.md` and
`.agents/` and nothing else agent-facing.

To add another environment, call `bash .agents/scripts/bootstrap.sh` from its
native setup hook. Do not fork the setup logic. Bootstrap must stay
Expand All @@ -56,11 +61,12 @@ secrets at setup time (Codex cloud strips them before the agent phase).

## Generated files

`sync.py` renders adapters from `.agents/mcp/servers.json` and links
`.agents/skills/` for harnesses that don't read it natively — by default only
for harnesses it detects on the machine (CLI on PATH, config directory, or
environment variable; CI renders all). All of it is gitignored; the
`Validate agent configuration` workflow fails if a rendered file ever shows up
untracked. The two committed exceptions, `.claude/settings.json` and
`.gemini/settings.json`, are hand-owned apart from one managed key each
(`enabledMcpjsonServers`, `mcpServers`), which `sync.py check` keeps honest.
`sync.py` renders adapters from `.agents/mcp/servers.json`, points them at the
hook scripts in `.agents/hooks/`, and links `.agents/skills/` for harnesses
that don't read it natively — by default only for harnesses it detects on the
machine (CLI on PATH, config directory, or environment variable; CI renders
all). There are no exceptions: `CLAUDE.md`, `.claude/settings.json`, and
`.gemini/settings.json` are rendered like everything else. All of it is
gitignored — `sync.py check` fails if a renderer output is unignored or
tracked, and the `Validate agent configuration` workflow fails if a bootstrap
run leaves an untracked file behind.
Loading