You are a coding agent setting up Repowise for the user in the current repository. Follow the steps in order. Ask the user once, in step 5, and nothing else unless a step fails and tells you to.
Every Repowise docs page is also Markdown: append .md to its URL. The full
index of pages is docs.repowise.dev/llms.txt,
and Next steps below links the pages for everything after
setup: workspaces, CI, hosted, upgrading and removal.
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.
The graph, git history, health, change risk, tests and dead code never call a model. Two optional additions make the rest much stronger:
| Addition | What it changes | Without it |
|---|---|---|
| An LLM provider | get_answer writes a cited answer; the docs explain why each module is shaped the way it is; decisions are mined from comments and history | get_answer returns ranked evidence marked degraded; docs are rendered from the code's structure |
| An embedder | get_answer and search_codebase match by meaning, not only by words | Search matches keywords only |
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,
copilot, kiro (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 |
| GitHub Copilot CLI | repowise init --yes --no-prose, then repowise agents add --target=copilot --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 the documentation from code, with no model calls and no spend, even when an API key is set in the environment. Always index this way first.--yesskips the plan screen and never prompts. It installs a post-commit hook that runsrepowise updateafter each commit (repowise hook uninstallremoves it), and points the global repowise MCP entry at this repo, printing the old and new target.- The exit code tells you the outcome:
0ready,2finished with gaps (the last line names the command that fills them),130interrupted (runrepowise init --resume). Anything else is a failure: runrepowise doctor. To parse progress, add--progress json: one JSON event per line on stdout, ending on asummaryline with the status, mode, spend and next commands. 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.
Run init in the background. A small repository takes under a minute; a few
thousand files can take several minutes, longer than many tool timeouts, so
wait for the process to exit rather than relying on a fixed timeout. While a
first run is going, repowise status reports the index as incomplete. In CI,
a sandbox, or a repository the user only wants to try, add
--no-editor-setup so only .repowise/ is written.
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 about an LLM and semantic search
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. Recommend an LLM, and offer the provider that costs them
nothing extra first: in Claude Code that is claude_cli, in Codex it is
codex_cli, in GitHub Copilot CLI it is copilot_cli, since you are already
logged in. Suggested wording:
Repowise is indexed and connected, and every tool works now. Two choices
before I finish:
1. An LLM (recommended). get_answer writes cited answers instead of returning
search hits, the docs explain why each module is shaped the way it is, and
decisions are mined from the history. I can use your <Claude | Codex>
subscription, so there is no API bill, or an API key. I will show you the
estimate before anything runs.
Or no LLM: free, and nothing leaves this machine.
2. Semantic search (recommended). Search and get_answer match by meaning, not
only by words. It needs a Gemini, OpenAI, OpenRouter or Eden AI key (embedding
calls are cheap), or Ollama running locally. Or keyword search only.If a key is already set, name it, for example: "I see GEMINI_API_KEY is set;
it covers both choices." Still wait for the answer. Do not spend because a key
happens to be present.
If the user picks no LLM and keyword search, 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 or openai: {base_url: ...} in .repowise/config.yaml for a compatible endpoint. A server on this machine (LM Studio, vLLM) needs no key |
| 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 |
| GitHub Copilot subscription | copilot_cli | None. Uses the copilot CLI's login |
| OpenCode | opencode | None |
6. Apply the choices
Do the parts the user said yes to, in this order.
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=.... Any provider's or embedder's key variable works here.init,update,generate,reindex,serveand the MCP server load this file at startup, and a variable already set in the shell wins over the file. 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.
Pin the provider for answers and updates
get_answer, the MCP server and the post-commit repowise update read the
provider from .repowise/config.yaml. Set it there, keeping every other key
in the file:
# .repowise/config.yaml
provider: claude_cli # the provider id you generated withWithout this, a subscription or local provider is not picked up, and
get_answer keeps answering in degraded mode.
Turn on semantic search
Pick the embedder from the key the user has, then re-embed the existing pages. This makes embedding calls only, no LLM calls:
| Key or setup | Embedder |
|---|---|
GEMINI_API_KEY or GOOGLE_API_KEY | gemini |
OPENAI_API_KEY | openai |
OPENROUTER_API_KEY | openrouter |
EDENAI_API_KEY | edenai |
Ollama running locally, with OLLAMA_EMBEDDING_MODEL set (for example nomic-embed-text) | ollama |
repowise reindex --embedder geminireindex records the embedder in .repowise/config.yaml, so later updates and
the MCP server keep using it.
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 code | Written by <model>>
Answers: <written by <provider> | ranked evidence only (no LLM)>
Search: <semantic, <embedder> | keywords only>
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.md
- For a team, Repowise Hosted at https://repowise.dev indexes on every push with nothing to install.Next steps
When the user asks for more after setup, read the matching page. Each link is the page's Markdown.
| The user wants | Read |
|---|---|
| A different LLM provider, a base URL, or the key variable names | Environment variables |
To see or change what .repowise/ holds and which files are indexed | Configuration |
| Several related repositories indexed together | Workspace setup, then Workspace MCP |
| Checks on pull requests | Gates in CI |
| The index kept current another way (watcher, webhooks) | Auto-sync |
| A second git worktree indexed | Git worktrees |
| Another agent host wired up | Agents |
| What each MCP tool takes and returns | MCP tools |
| Every CLI command | CLI overview |
| A newer version | Upgrading |
| Repowise removed | Uninstall |
| To compare self-hosted with Repowise Hosted | Hosted vs self-hosted |
| Hosted connected to their editor | Connect your IDE |
| What leaves the machine, for a security review | Security and data handling |
| Anything else | Docs index |
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,copilot,kiro.
Anything else
Run repowise doctor and read
Troubleshooting. Report the failing
check to the user with the command output.