# Set up with your agent

Paste one line into Claude Code, Codex, Cursor or any coding agent and it installs repowise, indexes the repo, connects the MCP tools and asks one question.

You do not have to set Repowise up by hand. Paste this into your coding
agent:

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

That page is a [runbook written for agents](https://docs.repowise.dev/getting-started/setup). It
works in Claude Code, Codex, Cursor, VS Code, OpenCode, Hermes, and any other
agent that can fetch a URL and run shell commands.

## What your agent will do

1. Check for Python 3.11+ and a git repository, and install the CLI with
   uv, pipx or pip if `repowise --version` fails. If the repo already has a
   `.repowise/` index, it runs `repowise status` and does not re-index.
2. Index the repo with `repowise init --yes --no-prose`. This builds every
   layer and renders the documentation from the code's structure, with no
   model and no spend, even if an API key is set in your environment.
3. Connect itself: the right `init` flags or `repowise agents add` command
   for the host it is running in.
4. Ask you once whether to add an LLM and semantic search (below).
5. Confirm the MCP tools are live by calling `get_overview`, and run
   `repowise doctor` if they are not.
6. Report back with the architecture, the top hotspots, and the health
   findings worth acting on.

## What it asks

Everything works keyless. The agent then recommends two additions and asks
once:

- **An LLM.** `get_answer` writes cited answers instead of returning ranked
  evidence, the docs explain why the code is shaped the way it is, and
  decisions are mined from the history. In Claude Code or Codex the agent
  offers your existing subscription (`claude_cli`, `codex_cli`, `copilot_cli`),
  so there is no API bill. With an API key it shows the `repowise generate --dry-run`
  estimate and spends nothing until you approve. It never asks you to paste a
  key into the chat.
- **Semantic search.** Search and `get_answer` match by meaning, not only by
  words. It needs a Gemini, OpenAI or OpenRouter key, or Ollama locally.

Say no to both and nothing leaves your machine. The graph, git history, code
health, change risk and dead-code layers are the same either way.

If a key is already in your environment, the agent names it and still asks
before spending. Subscription providers (`claude_cli`, `codex_cli`,
`copilot_cli`, `opencode`) and local Ollama need no key. An agent CLI has no
embedder, so semantic search needs an embedder key of its own. The full provider list is in the
[runbook](https://docs.repowise.dev/getting-started/setup#5-ask-about-an-llm-and-semantic-search).

### Already installed?

If Repowise is on your machine and you only want the repo indexed:

```text
Run `repowise init --yes --no-prose` in this repo. It needs no API key and
spends nothing. Then call get_overview and summarize what this codebase does.
```

## Install the plugin

The fullest setup is the plugin. One install wires the MCP server, six
auto-activating skills, 18 slash commands, and the context hooks together:

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

There is a Codex plugin too. Both are covered in
[Agent plugins](https://docs.repowise.dev/getting-started/plugins), including what each skill
activates on and what the hooks do.

If you only want the MCP server and none of the rest:

```bash
claude mcp add repowise -- repowise mcp
```

Or commit a project `.mcp.json` so your whole team picks it up:

```json
{ "mcpServers": { "repowise": { "command": "repowise", "args": ["mcp"] } } }
```

## Other agents

Eight agent targets are wired end to end: `repowise agents add --target=<id>`
writes the MCP config and, where the host reads one, a managed instructions
file. The tier is derived from what a descriptor actually implements, not
declared:

| Agent | Tier | MCP | Hooks | Instructions | Transcripts | Attribution |
|---|---|---|---|---|---|---|
| [Claude Code](https://docs.claude.com/en/docs/claude-code) | Full | Yes | Yes | Yes | Yes | Yes |
| [Codex CLI](https://developers.openai.com/codex/cli) | Full | Yes | Yes | Yes | Yes | Yes |
| [VS Code](https://code.visualstudio.com/docs/copilot/chat/mcp-servers) | Good | Yes | No | Yes | No | No |
| [Cursor](https://cursor.com/docs/context/mcp) | Good | Yes | Yes | Yes | No | Yes |
| [OpenCode](https://opencode.ai/docs/mcp-servers/) | Good | Yes | No | Yes | No | No |
| [Hermes](https://hermes-agent.nousresearch.com) | Good | Yes | No | Yes | No | No |
| [GitHub Copilot CLI](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference) | Good | Yes | No | Yes | No | No |
| [Kiro](https://kiro.dev/docs/mcp/configuration) | Good | Yes | No | Yes | No | No |

**Full** means MCP tools, a managed instructions file, hook-level
interception of tool calls, and transcript mining after the fact. **Good**
means MCP tools and a managed instructions file where the host reads one,
without transcript mining: the agent can ask repowise questions, but
repowise sees little of what happens in between. Cursor also gets a
`preToolUse` distill hook and an `afterFileEdit` hook. **Attribution** means
repowise can record the agent's edits as they happen, an opt-in set by
`attribution.capture` (see
[`repowise attribution`](https://docs.repowise.dev/cli/components#repowise-attribution)); every
agent's git-ai notes, Agent Trace files and commit trailers are read either
way. Target ids for `--target=`: `claude-code`, `codex`, `vscode`, `cursor`,
`opencode`, `hermes`, `copilot`, `kiro`.

### Codex CLI

```bash
codex mcp add repowise -- repowise mcp
```

Or wire the project up properly, which also writes `.codex/hooks.json` and
a managed `AGENTS.md`:

```bash
repowise init --codex
```

See [Agent plugins → Codex](https://docs.repowise.dev/getting-started/plugins#codex-plugin).

### Cursor

```bash
repowise agents add --target=cursor
```

This writes a project-local `.cursor/mcp.json` (Cursor does not read
`~/.cursor/mcp.json` reliably, since one global entry can only name one
repo) plus a managed `.cursor/rules/repowise.mdc` that Cursor loads on
every conversation. The `.cursor/mcp.json` entry needs a `type: "stdio"`
field that the shared `.mcp.json` does not carry, so hand-copying the repo
root config here silently breaks it:

```json
{
  "mcpServers": {
    "repowise": {
      "type": "stdio",
      "command": "repowise",
      "args": ["mcp", "/path/to/your/project"]
    }
  }
}
```

Remove it with `repowise agents remove --target=cursor`.

### OpenCode

```bash
repowise agents add --target=opencode
```

Registers the server under the `mcp` key (not `mcpServers`) in
`opencode.jsonc`, with each server's invocation as a single `command`
array rather than `command` + `args`, and adds a managed section to
`AGENTS.md`. By default this writes both the repo-local pair and the
per-machine pair under `$XDG_CONFIG_HOME/opencode` (falling back to
`~/.config/opencode`), including on Windows: OpenCode does not read
`%APPDATA%`. Pass `--scope=project` or `--scope=user` for just one.

`AGENTS.md` is shared with Codex and Hermes. All three read the same
file and manage the same marker-delimited section.

### Hermes

```bash
repowise agents add --target=hermes
```

Hermes reads one `config.yaml` per machine, so the MCP server is
registered there and serves every repo it's launched in:
`%LOCALAPPDATA%\hermes\config.yaml` on Windows, `~/.hermes/config.yaml`
everywhere else, or `$HERMES_HOME/config.yaml` when that's set. Project
scope writes the managed `AGENTS.md` section Hermes loads per repo.

> **Warning**
>
> **`platform_toolsets.cli` is an allowlist once it names anything.**
> Hermes exposes every enabled MCP server to the CLI by default, but the
> moment that list names one server it becomes an allowlist and every
> other server drops out. Repowise only adds itself there when the list
> is already an allowlist, so it never turns a permissive config into a
> restrictive one.

### VS Code

The [Repowise extension](https://docs.repowise.dev/getting-started/vscode) registers the MCP
server for you and adds editor-native health signals, refactoring CodeLens,
and branch risk on top. Search **Repowise** in the Marketplace, publisher
`repowise-dev`.

### Other MCP clients

Cline, Windsurf, Zed, Continue, Gemini CLI, JetBrains AI Assistant, Amp,
and Claude Desktop all speak MCP without a dedicated repowise target.
Print the server entry and paste it into whatever config the host reads:

```bash
repowise agents print-config claude-code
```

Or point the client at `repowise mcp`, run from the repo directory, over
stdio:

```json
{
  "mcpServers": {
    "repowise": {
      "command": "repowise",
      "args": ["mcp", "/path/to/your/project"]
    }
  }
}
```

## What agents should know about the CLI

The behaviors that most often trip up an unattended run, all of them
deliberate:

| Behavior | Why it matters to an agent |
|---|---|
| `init` never requires an API key | A missing key is not an error condition. Without a provider it builds the documentation from code and exits 0. |
| `--yes` skips the plan screen and every question | Each answer takes its default. With a key in the environment, `init --yes` writes documentation with a model and accepts the cost. A logged-in Claude Code, Codex or OpenCode is used only with `--provider`. Index with `--yes --no-prose` first, then preview spend with `repowise generate --dry-run`. |
| Exit codes carry the outcome | `0` ready, `2` finished with gaps (the last line names the command that fills them), `130` interrupted (`repowise init --resume`). |
| `--progress json` is for parsing | One JSON event per line on stdout, human text on stderr, ending on a `summary` line with `status`, `mode`, `spend` and `next`. Schema: [Driving init from an agent](https://docs.repowise.dev/cli/indexing#driving-init-from-an-agent-or-script). |
| No prompt when stdin is not a TTY | Nothing hangs waiting for input. A `generate` or `update --full` over the cost threshold with no terminal and no `--yes` stops with an error naming `--yes` instead of spending. |
| Unanswerable prompts degrade | If the plan screen reads EOF, `init` prints a notice and continues with defaults instead of ending the run. |
| `REPOWISE_PROVIDER=""` means unset | An empty value in a CI matrix resolves to normal auto-detection, not a provider named `""`. |
| `--prose` asks for prose, `--no-prose` skips it | On `init`, `--prose` without a resolvable key falls back to documentation built from code with a notice (it only errors when an explicit `--provider` fails to resolve). `--no-prose` never needs a key and makes no model calls, even with a key set. |
| `--mode fast` is Index only | It builds no documentation. Do not reach for it unless the repo is very large; `repowise update --full` finishes it with no key. |

Repowise also writes a managed block into `.claude/CLAUDE.md` and `AGENTS.md`
during `init`, so agents that read those files get the tool guidance without
any MCP call at all. The block is lean by default (date and commit, the files
that need care, one code-health line, the top three decisions, three working
bullets and the tool table), and
[`editor_files.sections`](https://docs.repowise.dev/installation/configuration#the-editor_files-block)
adds sections back.

## Machine-readable docs

This documentation site serves itself in agent-friendly form:

| Endpoint | What you get |
|---|---|
| [`docs.repowise.dev/setup.md`](https://docs.repowise.dev/setup.md) | The agent setup runbook as Markdown. |
| Any page URL plus `.md` | That page as clean Markdown, for example [`docs.repowise.dev/cli/indexing.md`](https://docs.repowise.dev/cli/indexing.md). The docs home is [`/index.md`](https://docs.repowise.dev/index.md). |
| Any page URL with `Accept: text/markdown` | The same Markdown, from the page's own URL. |
| [`docs.repowise.dev/llms.txt`](https://docs.repowise.dev/llms.txt) | The index: every docs page, titled and linked, in one small file. |
| [`docs.repowise.dev/llms-full.txt`](https://docs.repowise.dev/llms-full.txt) | Every docs page as Markdown in one document, code blocks and tables included. |
| [`repowise.dev/llms.txt`](https://repowise.dev/llms.txt) | The site-wide index: features, comparisons, guides, and blog. |

Start with `llms.txt` to find the right page, then fetch that page's `.md`,
or take `llms-full.txt` when you want everything at once. Every page also has
a **Copy page** control at the top, which copies its Markdown or opens it in
Claude or ChatGPT.

## What to do next

1. Skim the [MCP tools](https://docs.repowise.dev/mcp/overview) so you know what your agent
   can ask for.

2. Keep the index current. `init --yes` already installed a post-commit hook;
   [Auto-sync](https://docs.repowise.dev/auto-sync) covers the other options.

3. If the free index proved useful, upgrade the wiki to model-written prose
   with [`repowise generate`](https://docs.repowise.dev/cli/indexing#repowise-generate).
