agex.dev
CLI

File Placement

How agex decides where to write artifact files based on your tools and artifact type.

When you run agex sync or agex add, the CLI materializes artifacts into the correct locations for each tool declared in your agex.toml. This is handled automatically — you don't need to know where each file goes.

How placement works

The CLI looks at:

  1. The tools array in your [project] section
  2. The artifact type (claude-md, mcp-server, hook, etc.)

For each tool that supports that artifact type, a target file path and write strategy are determined.

Placement rules by platform

Claude Code

Artifact typeFile pathStrategy
claude-mdCLAUDE.mdreplace
agents-mdAGENTS.mdreplace
skill-*.claude/skills/{name}/SKILL.mdreplace
hook / hook-config.claude/settings.local.jsonmerge-json (hooks)
mcp-config / mcp-server.mcp.jsonmerge-json (mcpServers)
subagent / agent-team / agent-prompt.claude/agents/{name}.mdreplace
command / slash-command.claude/commands/{name}.mdreplace

Cursor

Artifact typeFile pathStrategy
cursorrules.cursorrulesreplace
skill-*.cursor/rules/{name}.mdcreplace
mcp-config / mcp-server.cursor/mcp.jsonmerge-json (mcpServers)
hook / hook-config.cursor/hooks.jsonmerge-json (hooks)
subagent / agent-prompt.cursor/agents/{name}.mdreplace

Gemini CLI

Artifact typeFile pathStrategy
gemini-mdGEMINI.mdreplace
agents-mdAGENTS.mdreplace
skill-*.gemini/skills/{name}/SKILL.mdreplace
mcp-config / mcp-server.gemini/settings.jsonmerge-json (mcpServers)
hook / hook-config.gemini/settings.jsonmerge-json (hooks)
subagent.gemini/agents/{name}.mdreplace

OpenCode

Artifact typeFile pathStrategy
agents-mdAGENTS.mdreplace
skill-*.opencode/skills/{name}/SKILL.mdreplace
mcp-config / mcp-server.opencode/settings.jsonmerge-json (mcpServers)
hook.opencode/settings.jsonmerge-json (hooks)
subagent.opencode/agents/{name}.mdreplace
command.opencode/commands/{name}.mdreplace

Codex

Artifact typeFile pathStrategy
agents-mdAGENTS.mdreplace
skill-*.codex/skills/{name}/SKILL.mdreplace
mcp-config / mcp-server.mcp.jsonmerge-json (mcpServers)
subagent / agent-prompt.codex/agents/{name}.mdreplace

Write strategies

replace

The artifact content is written directly to the target path, overwriting whatever was there. Used for single-file artifacts like CLAUDE.md and agent definitions.

merge-json

Used for shared JSON config files (.mcp.json, .claude/settings.local.json). The artifact must contain a JSON block. The CLI:

  1. Parses the artifact's JSON content (either raw JSON or a fenced ```json ``` block)
  2. Reads the existing file (or starts with {} if it doesn't exist)
  3. Merges the artifact's entries under the appropriate key (mcpServers, hooks, etc.)
  4. Tags each merged entry with _agex_ref so it can be cleanly removed later

This means multiple MCP server artifacts can coexist in the same .mcp.json without conflicts.

Remote vs. local artifacts

Remote artifacts (from the hub) of types that normally write to a shared file (CLAUDE.md, .cursorrules, AGENTS.md) are redirected to a namespaced location to avoid overwriting your own config:

PlatformRemote artifact location
Claude Code.claude/rules/{artifact-slug}.md
Cursor.cursor/rules/{artifact-slug}.mdc
Others.agex/artifacts/{type}/{artifact-slug}.md

Local artifacts (declared with local: prefix) write directly to the shared file, since they are your config.

Fallback

If no placement rule matches a given tool + artifact type combination, the artifact is written to:

.agex/artifacts/{type}/{name}.md

{name} substitution

Paths containing {name} use the manifest key (the left side of the = in agex.toml) as the file name. For example:

[skills]
deploy-recipe = "@rkrebs/vercel-deploy"

With Claude Code, this writes to .claude/skills/deploy-recipe/SKILL.md.

On this page