You are a coding agent setting up Repowise for the user in the current repository. Follow the steps in order. Ask the user one question, in step 5, and nothing else unless a step fails and tells you to.
What Repowise is
Repowise indexes a repository once and keeps the index current on every commit. The index holds the dependency graph, git history signals (hotspots, ownership, co-change), architectural decisions, code health scores, dead code, and documentation for every module. It runs on this machine. Without an LLM configured, no code leaves it and nothing is billed.
Once it is set up you query the index through MCP tools instead of grepping:
get_overview (architecture map), get_answer (cited answers to code
questions), get_context (docs, symbols and ownership for files and
symbols), get_symbol, search_codebase, get_risk and get_change_risk
(what a change may break), get_why (the decisions behind the code),
get_dead_code, and get_health.
Rules
- Never ask the user to paste an API key into this conversation. Never print, echo or log a key's value. Refer to a key by its environment variable name only.
- Never spend money on an LLM until the user has approved a cost estimate.
- Run every command from the repository root.
1. Check the prerequisites
git rev-parse --show-toplevel # must succeed: Repowise indexes a git repository
repowise --version # prints a version if Repowise is installedgit rev-parsefails: stop and tell the user Repowise needs a git repository.repowise --versionprints a version: skip to step 3.
Repowise needs Python 3.11 or newer. uv provides a suitable Python by itself.
For pipx or pip, check python3 --version (python --version on Windows).
2. Install
Use the first installer that is available:
uv tool install repowise # if uv is on PATH
pipx install repowise # else, if pipx is on PATH
python3 -m pip install repowise # else (on Windows: python -m pip install repowise)Confirm with repowise --version. If the shell says command not found, see
Command not found.
3. Check for an existing index
If a .repowise/ directory exists at the repository root, the repository is
already indexed:
repowise statusDo not re-index. In step 4, skip repowise init and run
repowise agents add --target=<id> --yes for your host, where <id> is one
of claude-code, codex, cursor, vscode, opencode, hermes (any other
client: repowise agents print-config claude-code). Then continue with
step 5.
4. Index and connect your host
You know which host you are running in. Run its commands:
| Host | Commands |
|---|---|
| Claude Code | repowise init --yes --no-prose |
| Codex | repowise init --yes --no-prose --codex |
| Cursor | repowise init --yes --no-prose, then repowise agents add --target=cursor --yes |
| VS Code (Copilot) | repowise init --yes --no-prose |
| OpenCode | repowise init --yes --no-prose, then repowise agents add --target=opencode --yes |
| Hermes | repowise init --yes --no-prose, then repowise agents add --target=hermes --yes |
| Any other MCP client | repowise init --yes --no-prose, then repowise agents print-config claude-code and add the printed server entry to the client's MCP config |
What these do:
--no-prosebuilds every layer and renders the documentation from the code's structure, with no model and no spend, even when an API key is set in the environment. Always index this way first.--yesnever prompts. It also installs a post-commit hook that runsrepowise updateafter each commit (repowise hook uninstallremoves it).initregisters the MCP server:.mcp.jsonand.claude/CLAUDE.mdfor Claude Code,.vscode/mcp.jsonfor VS Code, and the Claude Code entry and hooks in~/.claude/settings.json.--codexadds.codex/config.toml,.codex/hooks.jsonand a managedAGENTS.md.repowise agents addwrites the host's own config file.
Indexing a large repository takes a few minutes. Let it finish.
On Claude Code the user can also install the plugin, which adds slash commands and skills. You cannot run slash commands yourself, so mention it and move on:
/plugin marketplace add repowise-dev/repowise
/plugin install repowise@repowise5. Ask the one question
First, list which API key variables are already set. Print names only, never values:
env | cut -d= -f1 | grep -E '_API_KEY$'
grep -oE '^(export )?[A-Z_]+_API_KEY' .repowise/.env 2>/dev/nullGet-ChildItem Env: | Where-Object Name -like '*_API_KEY' | Select-Object -ExpandProperty NameThen ask the user. Suggested wording:
Repowise is indexed and connected. One choice before I finish:
1. No LLM (free). The documentation is built from the index. Nothing leaves
this machine.
2. An LLM writes the documentation, explaining why the code is shaped the way
it is. It uses your provider account or subscription, and I will show you
the cost estimate before anything is spent.
If 2, which provider?If a key is already set, name it in the question, for example: "I see
ANTHROPIC_API_KEY is set. Should I use Anthropic?" Still wait for the
answer. Do not spend because a key happens to be present.
If the user picks no LLM, go to step 7.
Supported providers:
| Provider | --provider | Key variable |
|---|---|---|
| Anthropic | anthropic | ANTHROPIC_API_KEY |
| OpenAI, or an OpenAI-compatible endpoint | openai | OPENAI_API_KEY, plus OPENAI_BASE_URL for a compatible endpoint |
| Google Gemini | gemini | GEMINI_API_KEY or GOOGLE_API_KEY |
| OpenRouter | openrouter | OPENROUTER_API_KEY |
| DeepSeek | deepseek | DEEPSEEK_API_KEY |
| Kimi | kimi | KIMI_API_KEY |
| Eden AI | edenai | EDENAI_API_KEY |
| LiteLLM proxy | litellm | LITELLM_BASE_URL, plus LITELLM_API_KEY if the proxy needs one |
| Ollama, local | ollama | None. OLLAMA_BASE_URL if not http://localhost:11434 |
| Claude subscription | claude_cli | None. Uses the claude CLI's login |
| Codex subscription | codex_cli | None. Uses the codex CLI's login |
| OpenCode | opencode | None |
6. If the user chose an LLM
Get the key in place
Skip this for a provider whose key variable is "None" in the table, and when the variable is already set.
Make sure the per-repo key file is ignored by git before anyone writes to it:
git check-ignore -q .repowise/.env || printf '\n# repowise API keys (local)\n.repowise/.env\n' >> .gitignoregit check-ignore -q .repowise/.env; if ($LASTEXITCODE -ne 0) { Add-Content .gitignore "`n# repowise API keys (local)`n.repowise/.env" }Then tell the user which variable to set and how, and wait until they say it is done:
- This repository, persistent (recommended): open
.repowise/.envin an editor and add a line such asANTHROPIC_API_KEY=.... Repowise loads this file forgenerate,updateand the MCP server. It is the same filerepowise initsaves a key to (--save-key, on by default). - Their shell: set the variable in the terminal that launches you, then restart you from that terminal. A running agent does not see variables set in another shell.
Confirm the key is visible without printing it:
grep -qE '^(export )?ANTHROPIC_API_KEY=' .repowise/.env && echo "set in .repowise/.env"
[ -n "$ANTHROPIC_API_KEY" ] && echo "set in this shell"Show the cost, then generate
repowise generate --provider anthropic --dry-runReplace anthropic with the chosen provider id. Show the user the estimate
and wait for an explicit yes. Subscription and local providers still get this
step. Then:
repowise generate --provider anthropic --yes--yes is required when no terminal is attached, which is the case for you.
7. Verify
- Most hosts load MCP servers only at startup. Ask the user to restart the
session or reload the window. Claude Code may ask once to approve the
project's
repowiseserver, and/mcpshows its status. Cursor may ask to enable the server. - Call
get_overview. A response with an architecture summary means the setup works. - If the tool is not available, or the call fails, run
repowise doctorand follow Troubleshooting.
8. Report back
Tell the user what you found, in this shape:
Repowise is set up in <repository>.
What this codebase is: <two or three sentences from get_overview>
Architecture: <the main modules or layers, from get_overview>
Hotspots: <the top three files and why, from get_overview>
Worth acting on: <up to three health findings from get_health, with file and finding>
Documentation: <built from the index | written by <provider>>
Files added or changed: <from git status>
Optional next steps:
- Auto-sync is already on through a post-commit hook (repowise hook uninstall removes it).
- Health and change-risk gates in CI: https://docs.repowise.dev/ci
- For a team, Repowise Hosted at https://repowise.dev indexes on every push with nothing to install.Troubleshooting
Command not found after install
The install location is not on PATH:
- uv: run
uv tool update-shell, then open a new shell.uv tool dir --binprints the directory. - pipx: run
pipx ensurepath, then open a new shell. - pip: add the scripts directory under
python3 -m site --user-base(binon macOS and Linux,Scriptson Windows) toPATH.
The MCP host starts repowise by name from .mcp.json, so the host needs the
same PATH. Restart it after fixing PATH.
MCP tools do not appear
- Restart the host. Most read their MCP config only at startup.
- Run
repowise doctor. It checks the Claude Code MCP entry and whether the MCP server responds. - Run
repowise doctor --repair. It re-registers a stuck Claude Code MCP entry and refreshes the config of every wired agent. - Re-run the wiring for your host:
repowise agents add --target=<id> --yes, where<id>is one ofclaude-code,codex,cursor,vscode,opencode,hermes.
Anything else
Run repowise doctor and read
Troubleshooting. Report the failing
check to the user with the command output.