Skip to content
Closed
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
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Shared tooling for coding agents. Declare skills, MCP servers, hooks, subagents,

**Shareable.** Skills are directories with a `SKILL.md`. Host them in any git repo, discover them automatically, install with one command.

**Multi-agent.** Configure Claude, Cursor, Codex, GitHub Copilot CLI, Grok, VS Code, OpenCode, and Pi from a single `agents.toml` -- skills, MCP servers, hooks, subagents, and plugins where supported. Pi reads `.agents/skills/` directly.
**Multi-agent.** Configure Claude, Cursor, Codex, GitHub Copilot CLI, Grok, VS Code, OpenCode, Pi, and Google Antigravity from a single `agents.toml` -- skills, MCP servers, hooks, subagents, and plugins where supported. Pi reads `.agents/skills/` directly.

## Quick Start: Global by Default

Expand Down Expand Up @@ -137,9 +137,12 @@ agents = ["claude", "cursor", "codex", "copilot", "grok", "opencode", "pi"]
| `vscode` | `.vscode` | `.vscode/mcp.json` | `.claude/settings.json` | -- |
| `opencode` | `.opencode` | `.opencode/opencode.jsonc` | -- | `.opencode/agents/*.md` |
| `pi` | `.pi` | `.pi/mcp.json` | -- | -- |
| `antigravity` | `.agents` | `.agents/mcp_config.json` | -- | -- |

Pi 0.99+ supports `[[mcp]]` declarations over stdio and Streamable HTTP. With `pi` in `agents`, dotagents writes `.pi/mcp.json` for project scope and `~/.pi/agent/mcp.json` for global scope, or `$PI_CODING_AGENT_DIR/mcp.json` when overridden (`~` is expanded). Existing unrelated servers and top-level settings are preserved. Pi server names allow only letters, digits, underscores, and hyphens. URLs must be literal; `${VAR}` references work in headers and environment values. Pi only reads project MCP config after the project is trusted; use `pi mcp list --json` to check connections and `pi mcp login <server>` for OAuth. Plugin-bundled MCP is not projected to Pi yet.

Google Antigravity reads `.agents/skills/` natively in project scope; for global scope dotagents links `~/.gemini/config/skills` to `~/.agents/skills`. With `antigravity` in `agents`, dotagents writes MCP servers to `.agents/mcp_config.json` for project scope and `~/.gemini/config/mcp_config.json` for global scope over stdio and Streamable HTTP. Existing unrelated servers, comments, and settings are preserved, including per-server settings Antigravity manages such as `disabled`, `enabledTools`, `disabledTools`, `tools`, `timeoutSeconds`, and `oauth`. Server names allow only letters, digits, underscores, and hyphens. Antigravity does not expand `${VAR}` references, so URLs and header values must be literal; stdio servers inherit Antigravity's environment, so `env` names are not written and those variables must be set where Antigravity runs. A fresh global setup does not select `antigravity`; add it to `agents` explicitly. Hooks, subagents, and plugins are not generated for Antigravity yet.

Custom subagents are declared with `[[subagents]]` entries. dotagents writes generated runtime-specific files during `install` and repairs them during `sync`:

```toml
Expand Down
8 changes: 6 additions & 2 deletions docs/public/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> Shared tooling for coding agents

dotagents manages agent skills, MCP servers, hooks, subagents, and plugins declared in `agents.toml`, and handles symlinks and config generation so tools like Claude Code, Cursor, Codex, GitHub Copilot CLI, Grok, VS Code, OpenCode, and Pi are configured from a single source of truth.
dotagents manages agent skills, MCP servers, hooks, subagents, and plugins declared in `agents.toml`, and handles symlinks and config generation so tools like Claude Code, Cursor, Codex, GitHub Copilot CLI, Grok, VS Code, OpenCode, Pi, and Google Antigravity are configured from a single source of truth.

Install: `npm install -g @sentry/dotagents`
Run without installing: `npx @sentry/dotagents <command>`
Expand Down Expand Up @@ -158,7 +158,7 @@ targets = ["claude", "cursor", "codex", "copilot", "grok", "opencode", "pi"]
|-------|------|----------|---------|-------------|
| `version` | integer | Yes | -- | Schema version. Always `1`. |
| `defaultRepositorySource` | string | No | `github` | Host used for shorthand `owner/repo` skill sources. Valid values: `github`, `gitlab`. |
| `agents` | string[] | No | `[]` | Agent tool IDs: `claude`, `cursor`, `codex`, `copilot`, `grok`, `vscode`, `opencode`, `pi`. Creates symlinks and config files for each where supported. `grok` is a plugin-only target. |
| `agents` | string[] | No | `[]` | Agent tool IDs: `claude`, `cursor`, `codex`, `copilot`, `grok`, `vscode`, `opencode`, `pi`, `antigravity`. Creates symlinks and config files for each where supported. `grok` is a plugin-only target. |
| `subagents` | table[] | No | `[]` | Custom subagent declarations. Generates runtime-specific files for Claude, Cursor, Codex, and OpenCode. |
| `plugins` | table[] | No | `[]` | Plugin declarations. Installs canonical bundles into `.agents/plugins/` and generates runtime plugin outputs for Claude, Cursor, Codex, Copilot, Grok, OpenCode, and Pi skill projection where supported. |
| `minimum_release_age` | integer | No | -- | Minimum commit age, in minutes, before a git skill, subagent, or plugin can install. |
Expand Down Expand Up @@ -217,6 +217,7 @@ Config files generated per agent:
- Claude: `.mcp.json` (JSON)
- Cursor: `.cursor/mcp.json` (JSON)
- Pi: `.pi/mcp.json` (JSON); requires Pi 0.99 or later
- Google Antigravity: `.agents/mcp_config.json` (JSON, shared)
- Codex: `.codex/config.toml` (TOML, shared with other Codex config)
- VS Code: `.vscode/mcp.json` (JSON)
- OpenCode: `.opencode/opencode.jsonc` by default (JSONC, shared). Existing `.opencode/opencode.json`, `opencode.jsonc`, or `opencode.json` files are reused in precedence order.
Expand All @@ -226,6 +227,8 @@ Copilot accepts both bare server maps and `mcpServers` documents. Global MCP use

Pi 0.99+ supports `[[mcp]]` declarations over stdio and Streamable HTTP. With `pi` in `agents`, dotagents writes `.pi/mcp.json` for project scope and `~/.pi/agent/mcp.json` for global scope, or `$PI_CODING_AGENT_DIR/mcp.json` when overridden (`~` is expanded). Existing unrelated servers and top-level settings are preserved. Pi server names allow only letters, digits, underscores, and hyphens. URLs must be literal; `${VAR}` references work in headers and environment values. Pi only reads project MCP config after the project is trusted; use `pi mcp list --json` to check connections and `pi mcp login <server>` for OAuth. Plugin-bundled MCP is not projected to Pi yet.

Google Antigravity reads `.agents/skills/` natively in project scope; for global scope dotagents links `~/.gemini/config/skills` to `~/.agents/skills`. With `antigravity` in `agents`, dotagents writes MCP servers to `.agents/mcp_config.json` for project scope and `~/.gemini/config/mcp_config.json` for global scope over stdio and Streamable HTTP. Existing unrelated servers, comments, and settings are preserved, including per-server settings Antigravity manages such as `disabled`, `enabledTools`, `disabledTools`, `tools`, `timeoutSeconds`, and `oauth`. Server names allow only letters, digits, underscores, and hyphens. Antigravity does not expand `${VAR}` references, so URLs and header values must be literal; stdio servers inherit Antigravity's environment, so `env` names are not written and those variables must be set where Antigravity runs. A fresh global setup does not select `antigravity`; add it to `agents` explicitly. Hooks, subagents, and plugins are not generated for Antigravity yet.

### Hooks

Each `[[hooks]]` entry requires `event` and `command`. Optional: `matcher` to filter by tool name.
Expand Down Expand Up @@ -522,6 +525,7 @@ Check selected-scope health: gitignore setup where applicable, installed skills
| `vscode` | VS Code Copilot | `.vscode` | (reads `.agents/skills/` natively) | `.vscode/mcp.json` | `.claude/settings.json` | Not supported |
| `opencode` | OpenCode | `.opencode` | (reads `.agents/skills/` natively) | `.opencode/opencode.jsonc` by default | Not supported | `.opencode/agents/*.md` |
| `pi` | Pi | `.pi` | (reads `.agents/skills/` natively) | `.pi/mcp.json` | Not supported | Not supported |
| `antigravity` | Google Antigravity | `.agents` | Project: reads `.agents/skills/`; global: `~/.gemini/config/skills/` symlink | `.agents/mcp_config.json` | Not supported | Not supported |

Claude uses `.claude/skills/`, and Cursor shares the same Claude-compatible skills symlink. Codex, VS Code, and OpenCode read `.agents/skills/` directly.

Expand Down
12 changes: 11 additions & 1 deletion docs/src/content/docs/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ Status output:
| Field | Type | Default | Description |
| --- | --- | --- | --- |
| `version` | integer | -- | Schema version. Always `1`. |
| `agents` | string[] | `[]` | Agent targets: `claude`, `cursor`, `codex`, `copilot`, `grok`, `vscode`, `opencode`, `pi`. `grok` is a plugin-only target. |
| `agents` | string[] | `[]` | Agent targets: `claude`, `cursor`, `codex`, `copilot`, `grok`, `vscode`, `opencode`, `pi`, `antigravity`. `grok` is a plugin-only target. |
| `subagents` | table[] | `[]` | Custom subagent declarations for Claude, Cursor, Codex, and OpenCode |
| `plugins` | table[] | `[]` | Plugin declarations for Claude, Cursor, Codex, Copilot, Grok, OpenCode, and Pi. |
| `minimum_release_age` | integer | -- | Minimum commit age, in minutes, before a git skill, subagent, or plugin can install. |
Expand Down Expand Up @@ -429,6 +429,16 @@ Pi reads project MCP config only after the project is trusted. Check connections
with `pi mcp list --json` and sign in with `pi mcp login <server>` for OAuth.
Plugin-bundled MCP is not projected to Pi yet.

Google Antigravity uses `.agents/mcp_config.json` in project scope and
`~/.gemini/config/mcp_config.json` globally. Existing unrelated servers,
comments, and settings are preserved, including per-server settings
Antigravity manages such as `disabled`. Server names allow letters, digits,
underscores, and hyphens. Antigravity does not expand `${VAR}` references, so
URLs and header values must be literal. Stdio servers inherit Antigravity's
environment, so `env` names are not written and those variables must be set
where Antigravity runs. A fresh global setup does not select `antigravity`;
add it to `agents` explicitly.

### Hooks

| Field | Type | Required | Description |
Expand Down
3 changes: 2 additions & 1 deletion docs/src/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ targets = ["claude", "cursor", "codex", "copilot", "opencode"]`}</code></pre>
<section className="dotagents-section">
<div className="dotagents-section-heading">
<h2 id="supported-agents">Supported Agents</h2>
<p>The `agents` array tells dotagents which tools to configure. Grok is a plugin-only target. Pi supports MCP and reads `.agents/skills/` directly.</p>
<p>The `agents` array tells dotagents which tools to configure. Grok is a plugin-only target. Pi and Google Antigravity support MCP and read `.agents/skills/` directly.</p>
</div>

| Agent | Config Dir | MCP Config | Hooks | Subagents |
Expand All @@ -109,6 +109,7 @@ targets = ["claude", "cursor", "codex", "copilot", "opencode"]`}</code></pre>
| `vscode` | `.vscode` | `.vscode/mcp.json` | `.claude/settings.json` | None |
| `opencode` | `.opencode` | `.opencode/opencode.jsonc` | None | `.opencode/agents/*.md` |
| `pi` | `.pi` | `.pi/mcp.json` (Pi 0.99+) | None | None |
| `antigravity` | `.agents` | `.agents/mcp_config.json` | None | None |

OpenCode reuses existing project config from `.opencode/opencode.jsonc`, `.opencode/opencode.json`, `opencode.jsonc`, or `opencode.json`, in that order. New projects use `.opencode/opencode.jsonc`.
</section>
Expand Down
44 changes: 44 additions & 0 deletions packages/dotagents/src/cli/commands/install-user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,48 @@ source = "path:skill-source/pdf"
const lockfile = await loadLockfile(scope.lockPath);
expect(lockfile!.skills["pdf"]).toEqual({ source: "path:skill-source/pdf" });
});

it("links Antigravity global skills and merges its global MCP config", async () => {
tmpDir = await mkdtemp(join(tmpdir(), "dotagents-user-install-"));
const homeDir = join(tmpDir, "home");
const geminiConfig = join(homeDir, ".gemini", "config");
process.env["HOME"] = homeDir;
process.env["DOTAGENTS_HOME"] = join(tmpDir, "agents");
process.env["DOTAGENTS_STATE_DIR"] = join(tmpDir, "state");
vi.resetModules();

const [{ runInstall }, { resolveScope }] = await Promise.all([
import("./install.js"),
import("../../scope.js"),
]);

await mkdir(geminiConfig, { recursive: true });
const manual = { serverUrl: "https://manual.example/mcp", oauth: { clientId: "manual" } };
await writeFile(join(geminiConfig, "mcp_config.json"), JSON.stringify({ mcpServers: { manual } }));
const scope = resolveScope("user");
await mkdir(scope.root, { recursive: true });
await writeFile(
scope.configPath,
`version = 1
agents = ["antigravity"]

[[mcp]]
name = "fixture"
command = "node"
args = ["server.js"]
`,
);

await runInstall({ scope });

const skillsLink = join(geminiConfig, "skills");
expect((await lstat(skillsLink)).isSymbolicLink()).toBe(true);
expect(await readlink(skillsLink)).toBe(relative(geminiConfig, scope.skillsDir));
expect(JSON.parse(await readFile(join(geminiConfig, "mcp_config.json"), "utf-8"))).toEqual({
mcpServers: {
manual,
fixture: { command: "node", args: ["server.js"] },
},
});
});
});
49 changes: 49 additions & 0 deletions packages/dotagents/src/cli/commands/mcp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { loadConfig } from "../../config/loader.js";
import { resolveScope, type ScopeRoot } from "../../scope.js";
import { runSync } from "./sync.js";
import { runInstall } from "./install.js";
import { parse as parseJsonc } from "jsonc-parser";

describe("mcp", () => {
let tmpDir: string;
Expand Down Expand Up @@ -127,6 +128,54 @@ describe("mcp", () => {
expect(await readFile(scope.configPath, "utf-8")).toBe(config);
});

it("installs and repairs Antigravity MCP in .agents/mcp_config.json while preserving unrelated settings", async () => {
await writeFile(scope.configPath, 'version = 1\nagents = ["antigravity"]\n');
const targetPath = join(projectRoot, ".agents", "mcp_config.json");
const manual = { command: "manual-server", disabled: true, timeoutSeconds: 30 };
await writeFile(targetPath, `{\n // Added by hand\n "mcpServers": { "manual": ${JSON.stringify(manual)}, },\n}\n`);

await runMcpAdd({ scope, name: "local-tools", command: "node", args: ["server.mjs"], env: ["TOOLS_TOKEN"] });
await runMcpAdd({ scope, name: "remote_tools", url: "https://example.com/mcp", headers: ["X-Team:docs"] });
const expected = {
mcpServers: {
manual,
"local-tools": { command: "node", args: ["server.mjs"] },
remote_tools: { url: "https://example.com/mcp", headers: { "X-Team": "docs" } },
},
};
const written = await readFile(targetPath, "utf-8");
expect(written).toContain("// Added by hand");
expect(parseJsonc(written)).toEqual(expected);

// Settings changed in Antigravity survive sync without counting as drift.
const disabled = { ...expected.mcpServers["local-tools"], disabled: true, disabledTools: ["write"] };
await writeFile(targetPath, JSON.stringify({ mcpServers: { ...expected.mcpServers, "local-tools": disabled } }));
expect((await runSync({ scope })).mcpRepaired).toBe(0);

await writeFile(targetPath, JSON.stringify({ mcpServers: { manual, "local-tools": { ...disabled, args: ["old.mjs"] } } }));
expect((await runSync({ scope })).mcpRepaired).toBe(1);
expect(JSON.parse(await readFile(targetPath, "utf-8"))).toEqual({
mcpServers: { ...expected.mcpServers, "local-tools": disabled },
});

// Credentials for an old endpoint must not follow the server to a new URL.
const oldRemote = { serverUrl: "https://old.example/mcp", oauth: { clientId: "old" }, disabled: true };
await writeFile(targetPath, JSON.stringify({ mcpServers: { ...expected.mcpServers, remote_tools: oldRemote } }));
expect((await runSync({ scope })).mcpRepaired).toBe(1);
expect(JSON.parse(await readFile(targetPath, "utf-8")).mcpServers.remote_tools).toEqual(expected.mcpServers.remote_tools);
});

it.each([
{ name: "server.v2", url: "https://example.com/mcp", headers: undefined, error: "Invalid Antigravity MCP server name" },
{ name: "remote", url: "https://${HOST}/mcp", headers: undefined, error: "does not expand" },
{ name: "remote", url: "https://example.com/mcp", headers: ["Authorization:Bearer ${API_TOKEN}"], error: "does not expand" },
])("rejects unsupported Antigravity declarations before saving: $name / $url", async ({ name, url, headers, error }) => {
const config = 'version = 1\nagents = ["antigravity"]\n';
await writeFile(scope.configPath, config);
await expect(runMcpAdd({ scope, name, url, headers })).rejects.toThrow(error);
expect(await readFile(scope.configPath, "utf-8")).toBe(config);
});

it("adds a stdio server", async () => {
await runMcpAdd({
scope,
Expand Down
9 changes: 5 additions & 4 deletions packages/dotagents/src/cli/ensure-user-scope.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { readFile, rm, mkdtemp } from "node:fs/promises";
import { join } from "node:path";
import { tmpdir } from "node:os";
import { ensureUserScopeBootstrapped } from "./ensure-user-scope.js";
import { allAgentIds } from "../targets/registry.js";
import { allAgents } from "../targets/registry.js";
import type { ScopeRoot } from "../scope.js";

function userScope(home: string): ScopeRoot {
Expand Down Expand Up @@ -42,10 +42,11 @@ describe("ensureUserScopeBootstrapped", () => {
const content = await readFile(scope.configPath, "utf-8");
expect(content).toContain("version = 1");

// Should include all known agents
for (const id of allAgentIds()) {
expect(content).toContain(`"${id}"`);
// Should include every agent except opt-in targets
for (const agent of allAgents()) {
expect(content.includes(`"${agent.id}"`)).toBe(!agent.optIn);
}
expect(content).not.toContain('"antigravity"');
expect(console.error).toHaveBeenCalledWith(
expect.stringContaining("Initialized"),
);
Expand Down
4 changes: 2 additions & 2 deletions packages/dotagents/src/cli/ensure-user-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync } from "node:fs";
import { mkdir, writeFile } from "node:fs/promises";
import chalk from "chalk";
import { generateDefaultConfig } from "../config/writer.js";
import { allAgentIds } from "../targets/registry.js";
import { allAgents } from "../targets/registry.js";
import type { ScopeRoot } from "../scope.js";

/**
Expand All @@ -19,7 +19,7 @@ export async function ensureUserScopeBootstrapped(scope: ScopeRoot): Promise<voi
await mkdir(scope.skillsDir, { recursive: true });
await writeFile(
scope.configPath,
generateDefaultConfig({ agents: allAgentIds() }),
generateDefaultConfig({ agents: allAgents().filter((agent) => !agent.optIn).map((agent) => agent.id) }),
"utf-8",
);
console.error(chalk.dim("Initialized ~/.agents/agents.toml"));
Expand Down
3 changes: 3 additions & 0 deletions packages/dotagents/src/cli/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ Options:
Manage MCP server declarations.
Pi 0.99+ uses .pi/mcp.json (project) or ~/.pi/agent/mcp.json (global).
PI_CODING_AGENT_DIR overrides Pi's global config directory.
Antigravity uses .agents/mcp_config.json (project) or ~/.gemini/config/mcp_config.json (global).

Subcommands:
add Add an MCP server declaration
Expand All @@ -73,6 +74,8 @@ Run 'npx @sentry/dotagents mcp <subcommand> --help' for details.`,

Add an MCP server declaration to agents.toml.
Pi server names allow letters, digits, underscores, and hyphens; URLs must be literal.
Antigravity server names follow the same rule; URLs and header values must be literal.
Antigravity stdio servers inherit its environment; --env names are not written.

Options:
--command <cmd> Stdio command including arguments
Expand Down
Loading
Loading