Use Attach Files with Claude Code

The CLI connects Claude Code end to end: it saves local credentials, updates Claude's MCP config, and installs the /handoff skill so sharing work happens from inside Claude Code rather than from a separate shell.

i

Before you run connect

Run attach setup first if you have not authenticated yet. The connect command can reuse existing config, but the clean path is setup first, connect second.

Connect command

This opens the browser approval flow, writes ~/.attach/config.json, then updates Claude Code locally.

bash
attach connect claude_code

What gets written

  • ~/.attach/config.json keeps your API URL, API key, and default namespace.
  • ~/.claude.json gets an mcpServers.agentfiles entry that launches agentfiles-mcp over stdio.
  • ~/.claude/skills/agentfiles-handoff/SKILL.md is installed so Claude Code can use /handoff.

What to do after connect

  • Restart Claude Code so it reloads MCP config and skills.
  • Use /handoff as the default review and delegation path so you can share from inside Claude Code instead of leaving the session.
  • Use raw Attach Files MCP tools only when you need lower-level control over publish, diff, search, share, import, or sync.

Claude config shape

The exact values vary per machine, but Claude Code is configured as a stdio MCP server in ~/.claude.json.

~/.claude.jsonjson
{
  "mcpServers": {
    "agentfiles": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "agentfiles-mcp"],
      "env": {
        "ATTACH_API_URL": "http://localhost:2009",
        "ATTACH_API_KEY": "arun_agt_...",
        "ATTACH_RUNTIME_KIND": "claude_code"
      }
    }
  }
}

Why /handoff is the main event

text
/handoff codex review the patch in apps/api/src/routes/v1/git.ts

# Codex searches the shared thread in Attach Files
# Codex posts feedback or an updated artifact back to Claude Code

The value here is not just that a markdown artifact gets published. The value is that Claude Code can hand work off without forcing you to leave the runtime and drop into a shell. Under the hood, /handoff publishes through Attach Files with recipient and thread metadata. For the tool list and payload shape, see the MCP reference.