# Connect Claude Code to Repowise

Wire Claude Code to the local Repowise MCP server or the hosted one, see which files change, verify the connection and remove it.

Claude Code is the fullest Repowise host: it lists all ten MCP tools, runs
the context hooks and, with the plugin, gets seven skills and 18 slash
commands.

## Install

**Local, with your agent.** Paste this into Claude Code:

```text
Read https://docs.repowise.dev/setup.md and set up Repowise in this repository.
```

**Local, by hand.** `repowise init` wires Claude Code whenever it is
installed. To wire it later, or after `--no-editor-setup`:

```bash
repowise agents add --target=claude-code
```

**The plugin.** One install brings the MCP server, hooks, skills and slash
commands. It runs `repowise mcp`, so the CLI must be on `PATH`:

```text
/plugin marketplace add repowise-dev/repowise
/plugin install repowise@repowise
```

**Hosted.** Run in the repository, then sign in once in the browser. No key:

```bash
repowise agents add --target=claude-code --hosted
```

or without the Repowise CLI:

```bash
claude mcp add --transport http repowise https://api.repowise.dev/mcp/OWNER/REPO
```

## What gets written where

| File | Scope | What repowise writes |
|---|---|---|
| `~/.claude.json` | user | `mcpServers.repowise`, a path-less entry that serves whichever repo Claude Code starts in |
| `~/.claude/settings.json` | user | The `SessionStart`, `PostToolUse`, `PostToolUseFailure` and command-rewrite hooks, and `env.ENABLE_TOOL_SEARCH=true` unless you set it yourself |
| `.mcp.json` | project | `mcpServers.repowise`, only when no user entry or plugin already serves the repo |
| `.claude/settings.local.json` | project | Opt-in coverage re-ingest and health-gate hooks |
| `.claude/CLAUDE.md` | project | The managed Repowise block (`--no-claude-md` skips it) |
| `claude_desktop_config.json` | user | A local entry for Claude Desktop, when Claude Desktop is installed |

The hosted entry goes under this repository's key in `~/.claude.json`
`projects` (Claude Code's local scope), named `repowise`, or
`repowise-hosted` when a local `repowise` server already exists.

## Restart

Restart Claude Code once, then run `/mcp` to confirm `repowise` is
connected (approve the project server if asked). For the hosted entry,
select it in `/mcp` and authenticate in the browser.

## Verify

```bash
repowise agents
```

You should see `claude-code` with status `configured` and where it is wired
(`plugin/user`, `direct/user`, `direct/project`). Then ask Claude Code
something only the index knows, such as "What are the hotspot files in this
repo?". It should call `get_overview` or `get_risk` and name real files.

## Uninstall

```bash
repowise agents remove --target=claude-code
```

This removes the MCP entries, the hooks, the distill allow rules and the
Claude Desktop entry. The plugin is owned by Claude Code: remove it with
`/plugin uninstall repowise@repowise`. To remove Repowise from the repo
entirely, run `repowise uninstall --all`.

## Troubleshooting

| Symptom | Fix |
|---|---|
| `/mcp` does not list `repowise` | Restart Claude Code once. Run `repowise doctor`, which starts the MCP server and names what failed. |
| `repowise agents` shows `configured x2` or more | The plugin and a direct entry both load the server, which costs two processes per hook and duplicate schemas. `repowise doctor` names the entry to remove. |
| `"repowise" entry names a remote server` | A hosted entry holds the local name. Rename it to `repowise-hosted` and re-run `repowise agents add --target=claude-code`. |
| Hook output says `command not found` | The hook entry predates the presence guard. Run `repowise init` or `repowise agents refresh` to rewrite it. |
| Only five tools are listed | Claude Code lists ten unless `mcp.tools` narrows it. Run `repowise config get mcp.tools`. |

## Next
- [Plugins](https://docs.repowise.dev/getting-started/plugins) for the skills and slash commands.
- [Hooks](https://docs.repowise.dev/intelligence/hooks) for what arrives without a tool call.
- [Tools by question](https://docs.repowise.dev/agents/tools-by-question) for which tool answers what.
